From 9572c1725346cdaa08770bfe9ea03498e2efc125 Mon Sep 17 00:00:00 2001 From: alekseybobkov Date: Wed, 3 Sep 2014 19:58:21 -0700 Subject: [PATCH] Minor changes in the back-end UI. The front-end router now triggers an event allowing to override the default routes. The CMS back-end UI now supports view bags in content files. --- modules/backend/assets/css/october.css | 13 +++++++++++++ modules/backend/assets/js/october.treeview.js | 9 ++++++++- .../backend/assets/less/controls/treeview.less | 16 ++++++++++++++++ modules/backend/lang/en/lang.php | 5 ++++- modules/cms/classes/Router.php | 5 +++++ modules/cms/classes/content/fields.yaml | 4 +++- modules/cms/controllers/Index.php | 5 +++-- 7 files changed, 52 insertions(+), 5 deletions(-) diff --git a/modules/backend/assets/css/october.css b/modules/backend/assets/css/october.css index 2427f87ce..555949404 100644 --- a/modules/backend/assets/css/october.css +++ b/modules/backend/assets/css/october.css @@ -13667,6 +13667,11 @@ div[data-control="balloon-selector"]:not(.control-disabled) ul li:hover { .control-treeview ol > li > div:hover span.borders { display: none; } +.control-treeview ol > li[data-no-drag-mode] div:hover span.drag-handle { + cursor: default!important; + opacity: 0.3 !important; + filter: alpha(opacity=30) !important; +} .control-treeview ol > li.dragged li.has-subitems > div:before, .control-treeview ol > li.dragged.has-subitems > div:before { background-position: 0px -52px; @@ -13935,6 +13940,14 @@ div[data-control="balloon-selector"]:not(.control-disabled) ul li:hover { .control-treeview ol > li > ol > li > ol > li > ol > li > ol > li > ol > li > ol > li > ol > li > ol > li > ol > li > ol > li > div > span.expand { left: 102px; } +.control-treeview p.no-data { + padding: 18px 0; + margin: 0; + color: #666666; + font-size: 12px; + text-align: center; + font-weight: 400; +} @media only screen and (-moz-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-devicepixel-ratio: 1.5), only screen and (min-resolution: 1.5dppx) { .control-treeview ol > li > div:before { background-position: 0px -79px; diff --git a/modules/backend/assets/js/october.treeview.js b/modules/backend/assets/js/october.treeview.js index 0e6e5a3a2..e88565171 100644 --- a/modules/backend/assets/js/october.treeview.js +++ b/modules/backend/assets/js/october.treeview.js @@ -83,6 +83,9 @@ $container.append($('Drag')) $container.append($('')) + + if ($(this).attr('data-no-drag-mode') !== undefined) + $('span.drag-handle', this).attr('title', 'Dragging is disabled when the Search is active') }) } @@ -171,7 +174,11 @@ } TreeView.prototype.initSortable = function() { - var self = this + var self = this, + $noDragItems = $('[data-no-drag-mode]', this.$el) + + if ($noDragItems.length > 0) + return if (this.$el.data('oc.treelist')) this.$el.treeListWidget('unbind') diff --git a/modules/backend/assets/less/controls/treeview.less b/modules/backend/assets/less/controls/treeview.less index 35e14b090..b185ef8e5 100644 --- a/modules/backend/assets/less/controls/treeview.less +++ b/modules/backend/assets/less/controls/treeview.less @@ -196,6 +196,13 @@ } } + &[data-no-drag-mode] div:hover { + span.drag-handle { + cursor: default!important; + .opacity(0.3)!important; + } + } + &.dragged { li.has-subitems, &.has-subitems { > div:before { @@ -370,6 +377,15 @@ .tree-view-paddings (@max-level); } + + p.no-data { + padding: 18px 0; + margin: 0; + color: @color-filelist-norecords-text; + font-size: 12px; + text-align: center; + font-weight: 400; + } } // Retina diff --git a/modules/backend/lang/en/lang.php b/modules/backend/lang/en/lang.php index e6483cc11..6cc81cbb7 100644 --- a/modules/backend/lang/en/lang.php +++ b/modules/backend/lang/en/lang.php @@ -164,7 +164,10 @@ return [ 'select_all' => 'all', 'select_none' => 'none', 'insert_row' => 'Insert Row', - 'delete_row' => 'Delete Row' + 'delete_row' => 'Delete Row', + 'concurrency-file-changed-title' => 'File was changed', + 'concurrency-file-changed-description' => 'The file you\'re editing has been changed on disk by another user. You can either reload the file and lose your changes or override the file on the disk.', + 'reload' => 'Reload', ], 'relation' => [ 'missing_definition' => "Relation behavior does not contain a definition for ':field'.", diff --git a/modules/cms/classes/Router.php b/modules/cms/classes/Router.php index d12582063..fcf39329f 100644 --- a/modules/cms/classes/Router.php +++ b/modules/cms/classes/Router.php @@ -4,6 +4,7 @@ use Lang; use File; use Cache; use Config; +use Event; use System\Classes\SystemException; use October\Rain\Router\Router as RainRouter; use October\Rain\Router\Helper as RouterHelper; @@ -72,6 +73,10 @@ class Router { $url = RouterHelper::normalizeUrl($url); + $apiResult = Event::fire('cms.router.beforeRoute', [$url], true); + if ($apiResult !== null) + return $apiResult; + for ($pass = 1; $pass <= 2; $pass++) { $fileName = null; $urlList = []; diff --git a/modules/cms/classes/content/fields.yaml b/modules/cms/classes/content/fields.yaml index cba834257..69f5de265 100644 --- a/modules/cms/classes/content/fields.yaml +++ b/modules/cms/classes/content/fields.yaml @@ -9,10 +9,12 @@ fields: path: content_toolbar cssClass: collapse-visible + components: Cms\FormWidgets\Components + secondaryTabs: stretch: true fields: - content: + markup: tab: cms::lang.editor.content stretch: true type: codeeditor diff --git a/modules/cms/controllers/Index.php b/modules/cms/controllers/Index.php index 9f4e17439..26163597d 100644 --- a/modules/cms/controllers/Index.php +++ b/modules/cms/controllers/Index.php @@ -135,10 +135,11 @@ class Index extends Controller $templatePath = trim(Request::input('templatePath')); $template = $templatePath ? $this->loadTemplate($type, $templatePath) : $this->createTemplate($type); - $settings = $this->upgradeSettings(Request::input('settings')); + $settings = Request::input('settings') ?: []; + $settings = $this->upgradeSettings($settings); $templateData = []; - if (Request::input('settings')) + if ($settings) $templateData['settings'] = $settings; $fields = ['markup', 'code', 'fileName', 'content'];