+++ /dev/null
-APP_NAME=Laravel
-APP_ENV=local
-APP_KEY=
-APP_DEBUG=true
-APP_URL=http://localhost
-
-LOG_CHANNEL=stack
-
-DB_CONNECTION=mysql
-DB_HOST=127.0.0.1
-DB_PORT=3306
-DB_DATABASE=homestead
-DB_USERNAME=homestead
-DB_PASSWORD=secret
-
-BROADCAST_DRIVER=log
-CACHE_DRIVER=file
-QUEUE_CONNECTION=sync
-SESSION_DRIVER=file
-SESSION_LIFETIME=120
-
-REDIS_HOST=127.0.0.1
-REDIS_PASSWORD=null
-REDIS_PORT=6379
-
-MAIL_DRIVER=smtp
-MAIL_HOST=smtp.mailtrap.io
-MAIL_PORT=2525
-MAIL_USERNAME=null
-MAIL_PASSWORD=null
-MAIL_ENCRYPTION=null
-
-PUSHER_APP_ID=
-PUSHER_APP_KEY=
-PUSHER_APP_SECRET=
-PUSHER_APP_CLUSTER=mt1
-
-MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
-MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
APP_ENV=production
APP_KEY=base64:/Jmlg7TepI/inQ4KJ3VF0YVTqghRGvvBrnDI7NkUk94=
APP_DEBUG=true
-APP_URL=https://pmi.dev.cubedesigners.com
+APP_URL=https://www.pm-instrumentation.com
LOG_CHANNEL=stack
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
+MAIL_FROM_ADDRESS=pmi@cubedesigners.com
+MAIL_FROM_NAME="PM-Instrumentation"
PUSHER_APP_ID=
PUSHER_APP_KEY=
--- /dev/null
+APP_NAME=PMI
+APP_ENV=production
+APP_KEY=base64:/Jmlg7TepI/inQ4KJ3VF0YVTqghRGvvBrnDI7NkUk94=
+APP_DEBUG=true
+APP_URL=https://staging.pm-instrumentation.com
+LOG_CHANNEL=stack
+
+DB_CONNECTION=mysql
+DB_HOST=localhost
+DB_PORT=3306
+DB_DATABASE=pmi
+DB_USERNAME=pmi
+DB_PASSWORD=ZJMcD6nAc3xnLjLVKZ2iWi69
+
+BROADCAST_DRIVER=log
+CACHE_DRIVER=file
+QUEUE_CONNECTION=sync
+SESSION_DRIVER=redis
+SESSION_LIFETIME=120
+
+REDIS_HOST=127.0.0.1
+REDIS_PASSWORD=null
+REDIS_PORT=6379
+
+MAIL_DRIVER=smtp
+MAIL_HOST=localhost
+MAIL_PORT=25
+MAIL_USERNAME=null
+MAIL_PASSWORD=null
+MAIL_ENCRYPTION=null
+MAIL_FROM_ADDRESS=pmi@cubedesigners.com
+MAIL_FROM_NAME="PM-Instrumentation"
+
+PUSHER_APP_ID=
+PUSHER_APP_KEY=
+PUSHER_APP_SECRET=
+PUSHER_APP_CLUSTER=mt1
+
+MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
+MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
+
+GOOGLE_ANALYTICS_ID=UA-4339912-10
+BACKPACK_LICENSE=YwdOWjeEczPAwy06GzkBJggW
--- /dev/null
+<?php
+
+
+namespace App\Models;
+
+use Cubist\Backpack\app\Magic\Models\CMSPage;
+
+class Page extends CMSPage
+{
+
+}
namespace App\Models;
use Cubist\Backpack\app\Magic\Models\CubistMagicModel;
-use Cubist\Util\Text;
use Illuminate\Support\Str;
class Product extends CubistMagicModel
'translatable' => false,
'column' => true,
]);
+
+ $this->addField(['name' => 'button',
+ 'label' => 'Button',
+ 'type' => 'Button']);
}
}
*/
public function boot()
{
- // BladeX Component Aliases
- // Ref: https://docs.spatie.be/laravel-blade-x/v2/introduction
- BladeX::component('components.flexible-image'); // <flexible-image />
- BladeX::component('components.full-width'); // <full-width> ... </full-width>
- BladeX::component('components.content'); // <content> ... </content>
- BladeX::component('components.columns'); // <columns> ... </columns>
- BladeX::component('components.column'); // <column> ... </column>
- BladeX::component('components.grid'); // <grid cols="3" gap="md"> ... </grid>
- BladeX::component('components.text-block'); // <text-block> ... </text-block>
- BladeX::component('components.link-button'); // <link-button> ... </link-button>
+ try {
+ // BladeX Component Aliases
+ // Ref: https://docs.spatie.be/laravel-blade-x/v2/introduction
+ BladeX::component('components.flexible-image'); // <flexible-image />
+ BladeX::component('components.full-width'); // <full-width> ... </full-width>
+ BladeX::component('components.content'); // <content> ... </content>
+ BladeX::component('components.columns'); // <columns> ... </columns>
+ BladeX::component('components.column'); // <column> ... </column>
+ BladeX::component('components.grid'); // <grid cols="3" gap="md"> ... </grid>
+ BladeX::component('components.text-block'); // <text-block> ... </text-block>
+ BladeX::component('components.link-button'); // <link-button> ... </link-button>
+ }catch (\Exception $e){
+
+ }
}
}
--- /dev/null
+<?php
+
+
+namespace App\SubForms;
+
+
+use Cubist\Backpack\app\Magic\SubForm;
+
+class Intro extends SubForm
+{
+ public function init()
+ {
+ parent::init();
+ $this->addField(['name' => 'title',
+ 'label' => 'Titre',
+ 'type' => 'Text']);
+
+ $this->addField(['name' => 'text',
+ 'label' => 'Texte',
+ 'type' => 'Textarea']);
+
+ $this->addField(['name' => 'image',
+ 'label' => 'Image',
+ 'type' => 'Images']);
+
+ $this->addField(['name' => 'button',
+ 'label' => 'Lien',
+ 'type' => 'Button']);
+ }
+}
--- /dev/null
+<?php
+
+
+namespace App\SubForms;
+
+class Slide extends Intro
+{
+ public function init()
+ {
+ parent::init();
+ $this->addField(['name' => 'title',
+ 'label' => 'Titre',
+ 'type' => 'Text']);
+
+ $this->addField(['name' => 'text',
+ 'label' => 'Texte',
+ 'type' => 'Textarea']);
+
+ $this->addField(['name' => 'image',
+ 'label' => 'Image',
+ 'type' => 'Images']);
+
+ $this->addField(['name' => 'button',
+ 'label' => 'Lien',
+ 'type' => 'Button']);
+ }
+}
$this->addField([
'name' => 'content',
'label' => trans('backpack::pagemanager.content'),
- 'type' => 'simplemde',
+ 'type' => 'Markdown',
'placeholder' => trans('backpack::pagemanager.content_placeholder'),
]);
}
{
parent::init();
+ $this->addField([
+ 'name' => 'intro',
+ 'type' => 'BunchOfFields',
+ 'bunch' => 'App\SubForms\Intro',
+ 'label' => __('Introduction'),
+ 'tab' => 'Contenus',
+ ]);
+
}
public function showInDropDown()
<?php
-/**
- * Created by IntelliJ IDEA.
- * User: Vincent
- * Date: 14/03/2019
- * Time: 18:24
- */
namespace App\Templates;
return 'Accueil';
}
-
public function init()
{
parent::init();
$this->addField([
'name' => 'slideshow',
- 'type' => 'list_model',
- 'model' => 'slideshow',
+ 'type' => 'BunchOfFields',
+ 'bunch' => 'App\SubForms\Slide',
'label' => __('Slideshow'),
+ 'tab' => 'Contenus',
]);
}
}
public function init()
{
parent::init();
+ $this->addField(['name' => 'test',
+ 'type' => 'Text',
+ 'label' => 'Super !',
+ 'tab' => 'Contenus'
+ ]);
}
}
// "fr_SN" => "French (Senegal)",
// "fr_CH" => "French (Switzerland)",
// "fr_TG" => "French (Togo)",
- 'fr' => 'French',
+
// "ff_SN" => "Fulah (Senegal)",
// "ff" => "Fulah",
// "gl_ES" => "Galician (Spain)",
+++ /dev/null
-<?php
-
-return [
- // Change this class if you wish to extend PageCrudController
- 'admin_controller_class' => 'Cubist\Backpack\app\Http\Controllers\CubistPageCrudController',
-
- // Change this class if you wish to extend the Page model
- 'page_model_class' => 'Backpack\PageManager\app\Models\Page',
-];
{{--<li><a href="{{ backpack_url('tag') }}"><i class="fa fa-tag"></i> <span>Tags</span></a></li>--}}
{{--</ul>--}}
{{--</li>--}}
- <li><a href="{{ backpack_url('elfinder') }}"><i class="fa fa-files-o"></i>
- <span>{{ trans('backpack::crud.file_manager') }}</span></a></li>
+{{-- <li><a href="{{ backpack_url('elfinder') }}"><i class="fa fa-files-o"></i>--}}
+{{-- <span>{{ trans('backpack::crud.file_manager') }}</span></a></li>--}}
@can('backpack_translation')
<li><a href='{{ backpack_url('language/texts') }}'><i class='fa fa-language'></i> <span>Translate</span></a>
</li>
<li><a href='{{ backpack_url('backup') }}'><i class='fa fa-hdd-o'></i> <span>Backups</span></a></li>
<li><a href='{{ backpack_url('log') }}'><i class='fa fa-terminal'></i> <span>Logs</span></a></li>
@endcan
- <li><a href="{{ backpack_url('elfinder') }}"><i class="fa fa-files-o"></i>
- <span>{{ trans('backpack::crud.file_manager') }}</span></a></li>
+{{-- <li><a href="{{ backpack_url('elfinder') }}"><i class="fa fa-files-o"></i>--}}
+{{-- <span>{{ trans('backpack::crud.file_manager') }}</span></a></li>--}}
@endcan
--- /dev/null
+<div style="margin-left: {{ (15 * ($level - 1)) }}px">
+ <h4>
+ {!! /*$level.*/ucfirst(str_replace(['_', '-'], ' ', trim($header))) !!}
+ <a class="toggle-inputs" href="#"><i class="glyphicon glyphicon-plus-sign"></i></a>
+ </h4>
+ <div class="lang-input-box" style="margin-left: 10px;">
+ {!! $langfile->displayInputs($item, $parents, $header, $level) !!}
+ </div>
+</div>
--- /dev/null
+<div class="form-group">
+<label for="{{ $key }}" class="col-sm-2 control-label">{{ str_replace(['_', '-'], ' ', $key) }}</label>
+ <div class="hidden-sm hidden-xs col-md-5">
+ <div class="well well-sm">
+ @php
+ if (count($parents)) {
+ $parents_array = implode('.', $parents);
+ $string_text = trans($lang_file_name . '.' . $parents_array . '.' . $key);
+ } else {
+ $string_text = trans($lang_file_name . '.' .$key);
+ }
+ echo htmlentities($string_text);
+ @endphp
+ </div>
+ </div>
+ <div class="col-sm-10 col-md-5">
+ @if (preg_match('/(\|)/', $item))
+ @php
+ $chuncks = explode('|', $item);
+ @endphp
+
+ <div style="margin-left: 15px;">
+ @foreach ($chuncks as $k => $chunck)
+ @php
+ preg_match('/^({\w}|\[[\w,]+\])([\w\s:]+)/', trim($chunck), $m);
+ @endphp
+ @if (empty($m))
+ <label for="{{ $chunck }}" class="col-sm-2 control-label">{{ (!$k ? trans('admin.language.singular') : trans('admin.language.plural')).":" }}</label>
+ <textarea name="{{ (empty($parents) ? $key : implode('__', $parents)."__{$key}")."[after][]" }}" class="form-control" rows="2"> {{ $chunck }} </textarea>
+ <br>
+ @else
+ <label for="{{ $chunck }}" class="col-sm-2 control-label">{{ (!$k ? trans('admin.language.singular') : trans('admin.language.plural'))." ($m[1]):" }}</label>
+ <input type="hidden" name="{{ (empty($parents) ? $key : implode('__', $parents)."__{$key}")."[before][]" }}" value="{{ $m[1] }}">
+ <textarea name="{{ (empty($parents) ? $key : implode('__', $parents)."__{$key}")."[after][]" }}" class="form-control" rows="2"> {{ $m[2] }} </textarea>
+ <br>
+ @endif
+ @endforeach
+ </div>
+ @else
+ <textarea name="{{ (empty($parents) ? $key : implode('__', $parents)."__{$key}") }}" class="form-control" rows="2"> {{ $item }} </textarea>
+ <br>
+ @endif
+ </div>
+</div>
\ No newline at end of file
--- /dev/null
+@extends('backpack::layout')
+
+@section('header')
+ <section class="content-header">
+ <h1>
+ {{ trans('backpack::langfilemanager.translate') }} <span class="text-lowercase">{{ trans('backpack::langfilemanager.site_texts') }}</span>
+ </h1>
+ <ol class="breadcrumb">
+ <li><a href="{{ url(config('backpack.base.route_prefix', 'admin').'/dashboard') }}">{{ trans('backpack::crud.admin') }}</a></li>
+ <li><a href="{{ url($crud->route) }}" class="text-capitalize">{{ $crud->entity_name_plural }}</a></li>
+ <li class="active">{{ trans('backpack::crud.edit') }} {{ trans('backpack::langfilemanager.texts') }}</li>
+ </ol>
+ </section>
+@endsection
+
+@section('content')
+<!-- Default box -->
+ <div class="box">
+ <div class="box-header with-border">
+ <h3 class="box-title">{{ ucfirst(trans('backpack::langfilemanager.language')) }}:
+ @foreach ($languages as $lang)
+ @if ($currentLang == $lang->abbr)
+ {{{ $lang->name }}}
+ @endif
+ @endforeach
+ <small>
+ {{ trans('backpack::langfilemanager.switch_to') }}:
+ <select name="language_switch" id="language_switch">
+ @foreach ($languages as $lang)
+ <option value="{{ url(config('backpack.base.route_prefix', 'admin')."/language/texts/{$lang->abbr}") }}" {{ $currentLang == $lang->abbr ? 'selected' : ''}}>{{ $lang->name }}</option>
+ @endforeach
+ </select>
+ </small>
+ </h3>
+ </div>
+ <div class="box-body">
+ <p><em>{!! trans('backpack::langfilemanager.rules_text') !!}</em></p>
+ <br>
+ <ul class="nav nav-tabs">
+ @foreach ($langFiles as $file)
+ <li class="{{ $file['active'] ? 'active' : '' }}">
+ <a href="{{ $file['url'] }}">{{ $file['name'] }}</a>
+ </li>
+ @endforeach
+ </ul>
+ <div class="clearfix"></div>
+ <br>
+ <section class="lang-inputs">
+ @if (!empty($fileArray))
+ <form
+ method="post"
+ id="lang-form"
+ class="form-horizontal"
+ data-required="{{ trans('admin.language.fields_required') }}"
+ action="{{ url(config('backpack.base.route_prefix', 'admin')."/language/texts/{$currentLang}/{$currentFile}") }}"
+ >
+ {!! csrf_field() !!}
+ <button type="submit" class="btn btn-success submit pull-right hidden-xs hidden-sm" style="margin-top: -60px;">{{ trans('backpack::crud.save') }}</button>
+ <div class="form-group hidden-sm hidden-xs">
+ <div class="col-sm-2 text-right">
+ <h4>{{ trans('backpack::langfilemanager.key') }}</h4>
+ </div>
+ <div class="hidden-sm hidden-xs col-md-5">
+ <h4>{{ trans('backpack::langfilemanager.language_text', ['language_name' => $browsingLangObj->name]) }}</h4>
+ </div>
+ <div class="col-sm-10 col-md-5">
+ <h4>{{ trans('backpack::langfilemanager.language_translation', ['language_name' => $currentLangObj->name]) }}</h4>
+ </div>
+ </div>
+ {!! $langfile->displayInputs($fileArray) !!}
+ <hr>
+ <div class="text-center">
+ <button type="submit" class="btn btn-success submit">{{ trans('backpack::crud.save') }}</button>
+ </div>
+ </form>
+ @else
+ <em>{{ trans('backpack::langfilemanager.empty_file') }}</em>
+ @endif
+ </section>
+ </div><!-- /.box-body -->
+ </div><!-- /.box -->
+@endsection
+
+@section('after_scripts')
+ <script>
+ jQuery(document).ready(function($) {
+ $("#language_switch").change(function() {
+ window.location.href = $(this).val();
+ })
+ });
+ </script>
+@endsection
--- /dev/null
+@extends('nestedmodels::ajax.modal')
+
+@section('header')
+ <h3 class="box-title">{{ trans('backpack::crud.add_a_new') }} {{ $crud->entity_name }}</h3>
+@endsection
+
+@section('content')
+ <div class="row">
+ <div class="col-md-10 col-md-offset-1">
+ @include('crud::inc.grouped_errors')
+
+ <!-- load the view from the application if it exists, otherwise load the one in the package -->
+ @if(view()->exists('vendor.backpack.crud.form_content'))
+ @include('vendor.backpack.crud.form_content', ['fields' => $crud->getFields('create'), 'action' => 'create'])
+ @else
+ @include('crud::form_content', ['fields' => $crud->getFields('create'), 'action' => 'create'])
+ @endif
+ </div>
+ </div>
+@endsection
+
+@section('footer')
+ @include('nestedmodels::ajax.inc.form_save_buttons')
+@endsection
+
+@push('crud_fields_scripts')
+<script>
+ $('#create_form').submit(function (e) {
+ return false;
+ });
+</script>
+
+@endpush
\ No newline at end of file
--- /dev/null
+<div id="saveActions" class="form-group">
+
+ <input type="hidden" name="save_action" value="{{ $saveAction['active']['value'] }}">
+
+ <button type="submit" class="btn btn-success" ng-click="save()">
+ <span class="fa fa-save" role="presentation" aria-hidden="true"></span>
+ <span data-value="{{ $saveAction['active']['value'] }}">{{ $saveAction['active']['label'] }}</span>
+ </button>
+
+ <button class="btn btn-default" type="button" ng-click="cancel()">
+ <span class="fa fa-ban"></span>{{ trans('backpack::crud.cancel') }}
+ </button>
+</div>
\ No newline at end of file
--- /dev/null
+@stack('crud_fields_styles')
+{!! Form::open(['id' => 'create_form', 'url' => $crud->route, 'method' => 'post', 'files'=>$crud->hasUploadFields('create')]) !!}
+<div class="modal-header">
+ @yield('header')
+
+</div>
+<div class="modal-body" id="modal-body">
+ @yield('content')
+</div>
+
+<div class="modal-footer">
+ @yield('footer')
+</div>
+{!! Form::close() !!}
+@stack('crud_fields_scripts')
\ No newline at end of file
--- /dev/null
+<style>
+ .modal.new-child-modal{
+ display: block !important; /* I added this to see the modal, you don't need this */
+ height: 100%;
+ height: 100vh;
+ }
+
+ /* Important part */
+ .modal.new-child-modal .modal-dialog{
+ overflow-y: initial !important
+ }
+ .modal.new-child-modal .modal-body{
+ height: 80%;
+ height: 80vh;
+ overflow-y: auto;
+ }
+</style>
\ No newline at end of file
--- /dev/null
+<script>
+ window.modulesList = window.modulesList || angular.module('ModulesList', ['ui.tree', 'ui.bootstrap'], function ($interpolateProvider) {
+ $interpolateProvider.startSymbol('<%');
+ $interpolateProvider.endSymbol('%>');
+ });
+
+ window.modulesList.filter('trustedHtml', function ($sce) {
+ return $sce.trustAsHtml;
+ });
+
+ window.modulesList.controller('ModulesController', function ($scope, $http, $uibModal) {
+
+ $scope.treeOptions = {
+ beforeDrop: beforeDrop,
+ dropped: dropped
+ };
+
+ $scope.collapseAll = function () {
+ $scope.$broadcast('angular-ui-tree:collapse-all');
+ };
+
+ $scope.expandAll = function () {
+ $scope.$broadcast('angular-ui-tree:expand-all');
+ };
+
+ $scope.canDropInto = function (node) {
+ return true // node.type === 'category' || node.type === 'root' || node.type === null
+ };
+
+ $scope.toggleTree = function (event, scope) {
+ event.stopPropagation();
+
+ scope.toggle();
+ };
+
+ $scope.toggleDropdown = function(event, scope) {
+ event.stopPropagation();
+
+ var dropdownToggle = angular.element(event.currentTarget);
+ if (dropdownToggle.hasClass('open')) {
+ dropdownToggle.removeClass('open')
+ } else {
+ dropdownToggle.addClass('open')
+ }
+ };
+
+ $scope.editModule = function (event, scope) {
+ event.stopPropagation();
+
+ var node = scope.$modelValue;
+ var url = '{{ url($crud->route) }}/' + node.id + '/edit';
+ window.location.href = url;
+ };
+
+ $scope.publishModule = function (event, scope) {
+ event.stopPropagation();
+
+ var node = scope.$modelValue;
+ var url = '{{ url($crud->route) }}/' + node.id + '/publish';
+
+ $http({
+ url: url,
+ method: 'POST',
+ data: {
+ publish: !node.published
+ }
+ }).then(function (response) {
+ node.published = !node.published;
+ new PNotify({
+ title: node.published ? 'Freigegeben' : 'Gesperrrt',
+ text: 'Das Modul wurde erfolgreich ' + node.published ? 'freigegeben.' : 'gesperrt.',
+ type: "success"
+ });
+ }, function (error) {
+ new PNotify({
+ title: "Fehler",
+ text: "Es ist ein Fehler aufgetreten. Bitte versuche es später noch einmal.",
+ type: "error"
+ });
+ });
+ };
+
+ $scope.deleteModule = function (event, scope) {
+ event.stopPropagation();
+
+ var node = scope.$modelValue;
+ var url = '{{ url($crud->route) }}/' + node.id;
+
+ if (confirm('Möchtest Du dieses Modul und alle untergeordneten Module wirklich entfernen?') == true) {
+ $http({
+ url: url,
+ method: 'DELETE'
+ }).then(function (response) {
+ new PNotify({
+ title: "{{ trans('backpack::crud.delete_confirmation_title') }}",
+ text: "{{ trans('backpack::crud.delete_confirmation_message') }}",
+ type: "success"
+ });
+ scope.remove();
+ }, function (error) {
+ new PNotify({
+ title: "{{ trans('backpack::crud.delete_confirmation_not_title') }}",
+ text: "{{ trans('backpack::crud.delete_confirmation_not_message') }}",
+ type: "warning"
+ });
+ });
+ }
+ };
+
+ $scope.newChild = function (event, scope, type) {
+ event.stopPropagation();
+
+ var current = scope.$modelValue;
+ $uibModal.open({
+ templateUrl: 'modal.html',
+ controller: 'ModalController',
+ controllerAs: '$ctrl',
+ size: 'lg',
+ windowClass: 'new-child-modal',
+ resolve: {
+ nodeScope: function () {
+ return scope;
+ },
+ type: function () {
+ return type;
+ }
+ }
+ });
+ };
+
+ $scope.preview = function (event, scope) {
+ event.stopPropagation();
+ var current = scope.$modelValue;
+
+ $uibModal.open({
+ templateUrl: 'preview.html',
+ controller: 'PreviewController',
+ controllerAs: '$ctrl',
+ size: 'sm',
+ windowClass: 'preview-modal',
+ resolve: {
+ nodeScope: function () {
+ return scope;
+ }
+ }
+ });
+ };
+
+
+ function beforeDrop(e) {
+ if (!$scope.permissions.reorder) return false;
+
+ var source = e.source.nodeScope.$modelValue;
+ var dest = e.dest.nodesScope.node;
+
+ return confirm('Soll das wikrlich verschoben werden?');
+ }
+
+ function dropped(e) {
+ $http.post('{{ url($crud->route) }}/reorder', $scope.list)
+ .then(function (response) {
+ new PNotify({
+ title: "{{ trans('backpack::crud.reorder_success_title') }}",
+ text: "{{ trans('backpack::crud.reorder_success_message') }}",
+ type: "success"
+ });
+ }, function (error) {
+ new PNotify({
+ title: "{{ trans('backpack::crud.reorder_error_title') }}",
+ text: "{{ trans('backpack::crud.reorder_error_message') }}",
+ type: "error"
+ });
+ // in case of reorder error this will reset the view
+ var indexTo = e.dest.index;
+ var indexFrom = e.source.index;
+ var movedNode = e.dest.nodesScope.node.children.splice(indexTo, 1)[0];
+ e.source.nodesScope.node.children.splice(indexFrom, 0, movedNode);
+ });
+ }
+ });
+
+ window.modulesList.controller('PreviewController', function ($scope, $uibModalInstance, nodeScope) {
+ $scope.node = nodeScope.node;
+ $scope.close = function () {
+ $uibModalInstance.dismiss('cancel');
+ }
+ });
+
+ window.modulesList.controller('ModalController', function ($scope, $uibModalInstance, $http, nodeScope, type) {
+
+ var parent = nodeScope.node.id;
+
+ console.log(nodeScope.node);
+
+ $http.get('{{url( $crud->route )}}/create?type=' + type + '&parent=' + parent).then(function (response) {
+ $scope.data = response.data;
+ });
+
+ $scope.nodeScope = nodeScope;
+
+ $scope.save = function () {
+ if (typeof tinyMCE !== 'undefined' && tinyMCE) {
+ tinyMCE.triggerSave();
+ }
+
+ var summernote = $('.summernote');
+ if (summernote.length !== 0) {
+ summernote.html(summernote.code());
+ }
+
+ var form = $('#create_form');
+ var formData = new FormData(form[0]);
+
+ $.ajax({
+ url: '{{ url($crud->route)}}',
+ type: 'POST',
+ data: formData,
+ processData: false,
+ contentType: false,
+ dataType: 'json',
+ headers: {
+ Accept: 'application/json',
+ },
+ success: function (data) {
+ $scope.nodeScope.node.children.push(data);
+ $uibModalInstance.close();
+ new PNotify({
+ title: "{{ trans('backpack::crud.insert_success') }}",
+ type: "success"
+ });
+ },
+ error: function (error) {
+ console.log(error);
+ var message = $.map(error.responseJSON, function (value, index) {
+ return value.join('\n');
+ }).join('\n');
+
+ new PNotify({
+ title: "{{ trans('backpack::crud.please_fix') }}",
+ text: message,
+ type: "error"
+ });
+ }
+ });
+ };
+
+ $scope.cancel = function () {
+ $uibModalInstance.dismiss('cancel');
+ };
+
+ });
+
+ window.modulesList.directive('compile', ['$compile', function ($compile) {
+ return function (scope, element, attrs) {
+ scope.$watch(
+ function (scope) {
+ return scope.$eval(attrs.compile);
+ },
+ function (value) {
+ element.html(value);
+ $compile(element.contents())(scope);
+ }
+ )
+ };
+ }]);
+
+ angular.element(document).ready(function () {
+ angular.forEach(angular.element('[ng-app]'), function (ctrl) {
+ var ctrlDom = angular.element(ctrl);
+ if (!ctrlDom.hasClass('ng-scope')) {
+ angular.bootstrap(ctrl, [ctrlDom.attr('ng-app')]);
+ }
+ });
+ });
+
+</script>
\ No newline at end of file
--- /dev/null
+<style>
+ /*.angular-ui-tree-handle {*/
+ /*background: #f8faff;*/
+ /*border: 1px solid #dae2ea;*/
+ /*color: #7c9eb2;*/
+ /*}*/
+
+ .angular-ui-tree-handle:hover {
+ color: #438eb9;
+ background: #f4f6f7;
+ border-color: #dce2e8;
+ }
+
+ .angular-ui-tree-placeholder {
+ background: #f0f9ff;
+ border: 2px dashed #bed2db;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ }
+
+ tr.angular-ui-tree-empty {
+ height: 100px
+ }
+
+ .group-title {
+ background-color: #687074 !important;
+ color: #FFF !important;
+ }
+
+ /* --- Tree --- */
+ .tree-node {
+ border: 1px solid #dae2ea;
+ background: #f8faff;
+ color: #7c9eb2;
+ padding: 10px;
+ }
+
+ .nodrop {
+ background-color: #f2dede;
+ }
+
+ .tree-node-content {
+ margin: 10px;
+ position: relative;
+ }
+
+ .tree-node-content-td {
+ display: inline-block;
+ }
+
+ .tree-handle {
+ padding: 10px;
+ background: #428bca;
+ color: #FFF;
+ margin-right: 10px;
+ }
+
+ .angular-ui-tree-handle:hover {
+ }
+
+ .angular-ui-tree-placeholder {
+ background: #f0f9ff;
+ border: 2px dashed #bed2db;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ }
+
+ /* PReview */
+
+ .module-content {
+ max-width: 100%;
+ }
+
+ .module-content img {
+ max-width: 100%;
+ }
+</style>
\ No newline at end of file
--- /dev/null
+<script type="text/ng-template" id="modal.html">
+ <div compile="data"></div>
+</script>
\ No newline at end of file
--- /dev/null
+<!-- Node template -->
+<script type="text/ng-template" id="nodes_renderer.html">
+ <div class="tree-node tree-node-content"
+ ng-click="preview($event, this)"
+ >
+ @include('nestedmodels::node.button_collapse')
+ @include('nestedmodels::node.content')
+ @include('nestedmodels::node.buttons')
+ </div>
+ @include('nestedmodels::node.childrendering')
+</script>
\ No newline at end of file
--- /dev/null
+<a class="btn btn-default btn-xs" ng-if="node.children && node.children.length > 0" data-nodrag
+ ng-click="toggleTree($event, this)">
+ <i class="fa" ng-class="{'fa-folder': collapsed, 'fa-folder-open': !collapsed}"></i>
+</a>
\ No newline at end of file
--- /dev/null
+@include('nestedmodels::node.buttons.reorder')
+@include('nestedmodels::node.buttons.delete')
+@include('nestedmodels::node.buttons.edit')
+@include('nestedmodels::node.buttons.create_child')
\ No newline at end of file
--- /dev/null
+<button class="btn btn-default btn-xs pull-right"
+ style="margin-right: 8px;"
+ ng-click="newChild($event, this)"
+ >
+ <i class="fa fa-plus"></i>
+</button>
+
+
+{{--
+ ----------------------------------------
+ | You can have some kind of dropdown here.
+ | We will add a 'type' attribute to the create route.
+ | Just call "newChild($event, this, '<your_type>' on ng-click.
+ | This way you could create completely different models by redirecting in your NestedModelCrudController subclass.
+ ----------------------------------------
+ SAMPLE CODE
+ ----------------------------------------
+
+<div id="dropdownMenu<% node.id %>" class="dropdown pull-right"
+ ng-click="toggleDropdown($event, this)"
+ ng-if="canDropInto(node) && permissions.create"
+ data-nodrag>
+ <button class="btn btn-primary btn-xs dropdown-toggle" data-toggle="dropdown" style="margin-right: 8px;"
+ aria-expanded="false">
+ Kategorie/Modul hinzufügen
+ </button>
+ <ul class="dropdown-menu" aria-labelledby="dropdownMenu<% node.id %>">
+ <li><a ng-click="newChild($event, this, 'category')">Unterkategorie</a></li>
+ <li><a ng-click="newChild($event, this, 'text')">Text-Modul</a></li>
+ <li><a ng-click="newChild($event, this, 'link')">Link-Modul</a></li>
+ </ul>
+</div>
+
+--}}
--- /dev/null
+<a ng-if="permissions.delete"
+ class="pull-right btn btn-danger btn-xs"
+ data-nodrag
+ ng-click="deleteModule($event, this)"
+ style="margin-right: 8px;">
+ <i class="fa fa-trash"></i>
+</a>
\ No newline at end of file
--- /dev/null
+<a ng-if="permissions.update"
+ class="pull-right btn btn-primary btn-xs"
+ data-nodrag
+ ng-click="editModule($event, this)"
+ style="margin-right: 8px;">
+ <i class="fa fa-edit"></i>
+</a>
\ No newline at end of file
--- /dev/null
+<a class="btn btn-info btn-xs pull-right" ui-tree-handle>
+ <i class="fa fa-bars"></i>
+</a>
\ No newline at end of file
--- /dev/null
+<ol ng-if="!canDropInto(node) || !permissions.reorder" ui-tree-nodes="" data-nodrop-enabled="true"
+ ng-model="node.children"
+ ng-class="{hidden: collapsed}">
+ <li ng-repeat="node in node.children" ui-tree-node data-expand-on-hover="true"
+ ng-include="'nodes_renderer.html'">
+ </li>
+</ol>
+<ol ng-if="canDropInto(node) && permissions.reorder" ui-tree-nodes="" ng-model="node.children"
+ ng-class="{hidden: collapsed}">
+ <li ng-repeat="node in node.children" ui-tree-node data-expand-on-hover="true"
+ ng-include="'nodes_renderer.html'">
+ </li>
+</ol>
\ No newline at end of file
--- /dev/null
+<% node.title %>
\ No newline at end of file
--- /dev/null
+<script type="text/ng-template" id="preview.html">
+ <div class="modal-header">
+ <h1><% node.title %></h1>
+ <h3 ng-if="node.subtitle"><% node.subtitle %></h3>
+ </div>
+ <div class="modal-body" ng-if="node.content">
+ <div class="module-content" ng-bind-html="node.content.body | trustedHtml" ng-if="node.content.body"></div>
+ <a href="<% node.content.url %>" target="_blank" ng-if="node.content.url"><% node.content.url %></a>
+
+ <h4 ng-if="node.content.attachments.length">Anhänge</h4>
+ <a href="file/<% attachment %>" target="_blank" ng-repeat="attachment in node.content.attachments">
+ <% attachment %>
+ </a>
+ </div>
+ <div class="modal-footer">
+ <a type="button" class="btn btn-default" href="{{ $crud->route }}/<% node.id %>/edit">
+ <i class="fa fa-edit"></i> Bearbeiten
+ </a>
+ <a type="button" class="btn btn-default" ng-click="close()">
+ <i class="fa fa-times"></i> Schließen
+ </a>
+ </div>
+</script>
\ No newline at end of file
--- /dev/null
+<!-- Tree template -->
+<script type="text/ng-template" id="tree.html">
+ <div ui-tree="treeOptions" id="tree-root" data-nodrop-enabled="!permissions.reorder" ng-if="list.length > 0">
+ <ol ui-tree-nodes data-expand-on-hover="true" ng-model="list">
+ <li ng-repeat="node in list" ui-tree-node ng-include="'nodes_renderer.html'"></li>
+ </ol>
+ </div>
+ <div class="alert alert-info" ng-if="list.length == 0">
+ {{ trans('backpack::crud.emptyTable') }}
+ </div>
+</script>
--- /dev/null
+@extends('backpack::layout')
+
+@section('header')
+ <section class="content-header">
+ <h1>
+ <span class="text-capitalize">{{ $crud->entity_name_plural }}</span>
+ <small>{{ trans('backpack::crud.all') }}
+ <span>{{ $crud->entity_name_plural }}</span> {{ trans('backpack::crud.in_the_database') }}
+ .
+ </small>
+ </h1>
+ <ol class="breadcrumb">
+ <li>
+ <a href="{{ url(config('backpack.base.route_prefix'), 'dashboard') }}">{{ trans('backpack::crud.admin') }}</a>
+ </li>
+ <li><a href="{{ url($crud->route) }}" class="text-capitalize">{{ $crud->entity_name_plural }}</a></li>
+ <li class="active">{{ trans('backpack::crud.list') }}</li>
+ </ol>
+ </section>
+@endsection
+
+@section('content')
+ <div class="row" ng-app="ModulesList" ng-controller="ModulesController">
+ <div class="col-md-12">
+ <!-- Default box -->
+ <div class="box box-default">
+ <div class="box-header {{ $crud->hasAccess('create')?'with-border':'' }}">
+ @include('crud::inc.button_stack', ['stack' => 'top'])
+ <button class="pull-right btn btn-sm btn-default" ng-click="collapseAll()">
+ <i class="fa fa-bars"></i> Alles einklappen
+ </button>
+ <button class="pull-right btn btn-sm btn-default" ng-click="expandAll()">
+ <i class="fa fa-signal fa-rotate-270"></i> Alles aufklappen
+ </button>
+ </div>
+ <div class="box-body" ng-init="list = {{ json_encode($entries) }};
+ permissions = {
+ create: {{ $crud->hasAccess('create') ? 'true' : 'false' }},
+ update: {{ $crud->hasAccess('update') ? 'true' : 'false' }},
+ delete: {{ $crud->hasAccess('delete') ? 'true' : 'false' }},
+ reorder: {{ $crud->hasAccess('reorder') ? 'true' : 'false' }}
+ }
+">
+ <div ng-include="'tree.html'"></div>
+ </div><!-- /.box-body -->
+ </div><!-- /.box -->
+ </div>
+
+ @include('nestedmodels::tree')
+ @include('nestedmodels::node')
+ @include('nestedmodels::modal')
+ @include('nestedmodels::preview')
+ </div>
+@endsection
+
+@section('after_styles')
+ <link rel="stylesheet" href="{{ asset('vendor/webfactor/nestedmodels/angular-ui-tree/dist/angular-ui-tree.min.css') }}">
+ @include('nestedmodels::inc.tree_style')
+ @include('nestedmodels::inc.modal_style')
+@endsection
+
+@section('after_scripts')
+ <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular.min.js"></script>
+ <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/2.5.0/ui-bootstrap-tpls.min.js"></script>
+ <script type="text/javascript" src="{{ asset('vendor/webfactor/nestedmodels/angular-ui-tree/dist/angular-ui-tree.js') }}"></script>
+
+ <!-- TREE SCRIPT -->
+ @include('nestedmodels::inc.tree_script')
+@endsection
#!/usr/bin/env php
<?php
echo `composer update -v --no-progress --profile --prefer-dist`;
+echo `composer dump-autoload`;
+echo `php artisan config:cache`;
+echo `php artisan view:clear`;
+echo `php artisan view:cache`;
#`php artisan vendor:publish --provider="CubistBackpackServiceProvider"`;
// Database migrations
//`php artisan vendor:publish --tag=migrations`;