"autoload": {
"psr-0": {
"Cubist\\Backpack\\": "src"
- }
+ },
+ "files": [
+ "app/helpers.php"
+ ]
},
"authors": [
{
use Cubist\Backpack\app\Console\Command\MigrateCommand;
use Cubist\Backpack\app\Console\Commands\GenerateCommand;
use Cubist\Backpack\app\Console\Commands\InstallCommand;
+use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
class CubistBackpackServiceProvider extends ServiceProvider
}
$this->loadViewsFrom(realpath(__DIR__ . '/resources/views'), self::NAMESPACE);
+ Blade::directive('vendorasset', function ($path) {
+
+ });
}
--- /dev/null
+<?php
+if (!function_exists(vendor_asset)) {
+ function vendor_asset($path)
+ {
+ return asset($path);
+ }
+}
--- /dev/null
+(function ($) {
+ function JQbunchmultiple(element) {
+ this.element = element;
+ this.init();
+ }
+
+ JQbunchmultiple.prototype = {
+ init: function () {
+ var $this = this;
+ var initValues = this.data('values');
+ $.each(initValues, function (k, v) {
+ $this.initItem(v);
+ });
+ if (initValues.length === 0) {
+ this.initItem({});
+ }
+ },
+
+ initItem: function (values) {
+ var item = this.element.find('.sample').clone();
+ $(".bunchmultiple__items").append($(item));
+ },
+ };
+
+ jQuery.fn.bunchmultiple = function () {
+ return this.each(function () {
+ var $this = $(this);
+ if ($(this).data('bunchmultiple') === undefined) {
+ $(this).data('bunchmultiple', new JQbunchmultiple($this));
+ }
+ })
+ };
+})(jQuery);
+
+jQuery(document).ready(function ($) {
+ $(".bunchmultiple").bunchmultiple();
+});
--- /dev/null
+.bunchmultiple {
+ .bunchmultiple__wrapper {
+ padding: 15px;
+ border: 1px solid #eee;
+ background: #fafafa;
+ margin-bottom: 15px;
+
+ > .form-group {
+ padding: 0;
+
+ > label {
+ font-size: 1.2em;
+ margin-bottom: 24px;
+ }
+ }
+
+ .sample {
+ display: none;
+ }
+ }
+}
+
+
$unique = 'bunchmultiple_' . rand(1, 100000);
?>
-<div class="bunchmultiple__margin col-xs-12" id="{!! $unique !!}" data-values="{!! $value !!}">
+<div class="bunchmultiple 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 class="bunchmultiple__items">
+ <div class="item sample">
+ <div class="legend">move Editer +-</div>
+ @include('cubist_back::inc.show_bunch_fields', array('bunchfields'=>$field['bunchfields']))
+ </div>
</div>
<div class="clearfix"></div>
{{-- 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>
+ <link rel="stylesheet" type="text/css" href="{{ vendorasset('vendor/cubist/backpack/bunchmultiple.css') }}">
@endpush
{{-- FIELD JS - will be loaded in the after_scripts section --}}
@push('crud_fields_scripts')
- <script>
- jQuery(document).ready(function ($) {
-
-
- });
- </script>
+ <script type="text/javascript" src="{{ vendorasset('vendor/cubist/backpack/bunchmultiple.js') }}"></script>
@endpush
@endif