"backpack/menucrud": "^1.0",
"backpack/newscrud": "^2.1",
"backpack/permissionmanager": "^4.0",
- "backpack/settings": "^2.1",
"backpack/langfilemanager": "^1.0",
"cubist/cms-front": "dev-master",
- "barryvdh/laravel-elfinder": "^0.4.1",
"cubist/util": "dev-master",
"fideloper/proxy": "^4.0",
"predis/predis": "^1.1",
- "webfactor/laravel-backpack-instant-fields": "^2.3.1",
- "webfactor/laravel-backpack-nestedmodels": "^1.0.1@dev",
"spatie/laravel-translatable": "^4.1",
"venturecraft/revisionable": "^1.30",
"gaspertrix/laravel-backpack-dropzone-field": "^1.0"
--- /dev/null
+<?php
+
+
+namespace Cubist\Backpack\app\Magic\Fields;
+
+use Cubist\Backpack\CubistBackpackServiceProvider;
+
+class BunchOfFieldsMultiple extends BunchOfFields
+{
+ use \Cubist\Backpack\app\Magic\BunchOfFields;
+
+ protected $_adminType = 'bunch_multiple';
+ protected $_cast = 'array';
+ protected $_viewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::fields';
+
+ public function getDefaultAttributes()
+ {
+ return array_merge(parent::getDefaultAttributes(), ['bunch' => []]);
+ }
+
+ public function _postSetAttributes()
+ {
+ parent::_postSetAttributes();
+ $this->_setBunchOfFields();
+ }
+
+ protected function _setBunchOfFields()
+ {
+ $bunch = $this->getAttribute('bunch');
+ if (is_array($bunch)) {
+ foreach ($bunch as $item) {
+ if (is_array($item)) {
+ $f = Field::getInstance($item);
+ } else if ($item instanceof Field) {
+ $f = $item;
+ }
+ }
+ $this->_fields[$f->getAttribute('name')] = $f;
+ }
+ if (is_string($bunch)) {
+ if (class_exists($bunch)) {
+ $bunchInstance = new $bunch();
+ if (method_exists($bunchInstance, 'getFields')) {
+ $this->_fields = $bunchInstance->getFields();
+ }
+ }
+ }
+
+ $crudfields = [];
+ foreach ($this->_fields as $field) {
+ $name = $field->getAttribute('name');
+ $e = explode('[', $name);
+ $main = array_shift($e);
+ $name = $this->getAttribute('name') . '___' . $main;
+ foreach ($e as $item) {
+ $name .= '___' . $item;
+ }
+ $field->setAttribute('name', $name);
+ $crudfields[$name] = $field->getDefinition();
+ }
+ $this->setAttribute('bunchfields', $crudfields);
+ }
+}
{
protected static $_templates = [];
- protected $table = 'cms_pages';
+ protected $table = 'cubist_cms_pages';
protected $_options = ['name' => 'page',
'singular' => 'page',
--- /dev/null
+<?php
+
+
+namespace Cubist\Backpack\app\Magic\Models;
+
+
+class Settings
+{
+ protected $table = 'cubist_settings';
+}
<style type="text/css">
.bunch__margin {
- margin: 0;
+ margin: 15px 0;
}
.bunch__wrapper {
--- /dev/null
+<!-- Bunch -->
+
+<?php
+$empty = [];
+$value = old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? $field['default'] ?? $empty;
+if ($value == '') {
+ $value = $empty;
+}
+
+if (!is_string($value)) {
+ $value = json_encode($value);
+}
+
+$unique = 'bunchmultiple_' . rand(1, 100000);
+
+?>
+<div class="bunchmultiple__margin col-xs-12" id="{!! $unique !!}" data-values="{!! $value !!}">
+ <div class="bunchmultiple__wrapper col-xs-12">
+ <div @include('crud::inc.field_wrapper_attributes') >
+ <label>{!! $field['label'] !!}</label>
+ @include('crud::inc.field_translatable_icon')
+ <div class="clearfix"></div>
+
+ <div class="sample">
+ @include('cubist_back::inc.show_bunch_fields', array('bunchfields'=>$field['bunchfields']))
+ </div>
+
+ <div class="clearfix"></div>
+
+ {{-- HINT --}}
+ @if (isset($field['hint']))
+ <p class="help-block">{!! $field['hint'] !!}</p>
+ @endif
+ </div>
+ </div>
+</div>
+
+
+{{-- ########################################## --}}
+{{-- Extra CSS and JS for this particular field --}}
+{{-- If a field type is shown multiple times on a form, the CSS and JS will only be loaded once --}}
+@if ($crud->checkIfFieldIsFirstOfItsType($field))
+
+ {{-- FIELD CSS - will be loaded in the after_styles section --}}
+ @push('crud_fields_styles')
+ <style type="text/css">
+
+ .bunch__margin {
+ margin: 15px 0;
+ }
+
+ .bunch__wrapper {
+ padding: 15px;
+ border: 1px solid #eee;
+ background: #fafafa;
+ margin-bottom: 15px;
+ }
+
+ .bunch__wrapper .form-group {
+ padding: 0;
+ }
+
+ .bunch__wrapper > .form-group > label {
+ font-size: 1.2em;
+ margin-bottom: 24px;
+ }
+ </style>
+ @endpush
+
+ {{-- FIELD JS - will be loaded in the after_scripts section --}}
+ @push('crud_fields_scripts')
+ <script>
+ jQuery(document).ready(function ($) {
+
+
+ });
+ </script>
+ @endpush
+
+@endif
+{{-- End of Extra CSS and JS --}}
+{{-- ########################################## --}}