diff --git a/CHANGELOG.md b/CHANGELOG.md index e2ed0d4a1..e609918af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ -* **Build 14x** (2014-09-xx) +* **Build 15x** (2014-09-xx) + - Moved `ViewMaker` trait to live under system, it can be useful for Models too. + +* **Build 149** (2014-09-29) - Added new `hint` form field type (see Backend > Forms docs). - Added new `containerAttributes` property to form fields (see Backend > Forms docs). + - Field attributes have had an API change `$field->attributes` should now be `$field->getAttributes()`. + - Added scheduled console commands (see Help > Console docs). * **Build 145** (2014-09-13) - Standard setting pages now have **Save** and **Save and Close** buttons. diff --git a/app/config/cms.php b/app/config/cms.php index ad0263d98..4d0138734 100644 --- a/app/config/cms.php +++ b/app/config/cms.php @@ -21,6 +21,7 @@ return array( | Specify which modules should be registered when using the application. | */ + 'loadModules' => ['System', 'Backend', 'Cms'], /* @@ -31,6 +32,7 @@ return array( | Specify plugin codes which will always be disabled in the application. | */ + 'disablePlugins' => [], /* diff --git a/modules/backend/assets/js/october.controls.js b/modules/backend/assets/js/october.controls.js index dc94b45c1..cc25822aa 100644 --- a/modules/backend/assets/js/october.controls.js +++ b/modules/backend/assets/js/october.controls.js @@ -51,9 +51,14 @@ formatSelection: formatSelectOption, escapeMarkup: function(m) { return m; } }) - - $(document).on('disable', 'select.custom-select', function(event, status){ - $(this).select2('enable', !status) - }) }) + + $(document).on('disable', 'select.custom-select', function(event, status){ + $(this).select2('enable', !status) + }) + + $(document).on('focus', 'select.custom-select', function(event){ + setTimeout($.proxy(function() { $(this).select2('focus') }, this), 10) + }) + })(jQuery); \ No newline at end of file diff --git a/modules/backend/assets/js/october.hotkey.js b/modules/backend/assets/js/october.hotkey.js index 261b698c0..934d8a2ab 100644 --- a/modules/backend/assets/js/october.hotkey.js +++ b/modules/backend/assets/js/october.hotkey.js @@ -27,14 +27,9 @@ keysCount = keys.length, keyConditions = [], keyPressed = { shift: false, ctrl: false, cmd: false, alt: false }, - keyMap = {8: "backspace", 9: "tab", 10: "return", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause", - 20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home", - 37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del", 59: ";", 61: "=", - 96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7", - 104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/", - 112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8", - 120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 173: "-", 186: ";", 187: "=", - 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\", 221: "]", 222: "'"} + keyMap = {'esc':27, 'tab':9, 'space':32, 'return':13, 'enter':13, 'backspace':8, 'scroll':145, 'capslock':20, 'numlock':144, 'pause':19, + 'break':19, 'insert':45, 'home':36, 'delete':46, 'suppr':46, 'end':35, 'pageup':33, 'pagedown':34, 'left':37, 'up':38, 'right':39, 'down':40, + 'f1':112, 'f2':113, 'f3':114, 'f4':115, 'f5':116, 'f6':117, 'f7':118, 'f8':119, 'f9':120, 'f10':121, 'f11':122, 'f12':123} for (var i = 0; i < keysCount; i++) { keyConditions.push(makeCondition(trim(keys[i]))) diff --git a/modules/backend/assets/js/october.sortable.js b/modules/backend/assets/js/october.sortable.js index 881e7556d..535de838c 100644 --- a/modules/backend/assets/js/october.sortable.js +++ b/modules/backend/assets/js/october.sortable.js @@ -1,7 +1,7 @@ /* * Sortable plugin, a forked version of johnny's sortable plugin. * - * Forked from: https://github.com/johnny/jquery-sortable/tree/271cd2c742439842000e6f92d4dae96bb8dcd595 + * Forked from: https://github.com/johnny/jquery-sortable/tree/1563f32858cfe250051ad0a573425569c49d631f * * Note: Consider using october.simplelist.js with "is-sortable" class. * @@ -31,7 +31,6 @@ +function ($) { "use strict"; var eventNames, - isTouch = 'ontouchstart' in window, cursorAdjustment, containerDefaults = { drag: true, // Items can be dragged from this container @@ -174,23 +173,13 @@ top: 0, bottom: 0, right: 0 - } - - if (isTouch) { + }, eventNames = { - start: "touchstart", - drop: "touchend", - drag: "touchmove", + start: "touchstart.sortable mousedown.sortable", + drop: "touchend.sortable touchcancel.sortable mouseup.sortable", + drag: "touchmove.sortable mousemove.sortable", scroll: "scroll.sortable" } - } else { - eventNames = { - start: "mousedown.sortable", - drop: "mouseup.sortable", - drag: "mousemove.sortable", - scroll: "scroll.sortable" - } - } /* * a is Array [left, right, top, bottom] @@ -316,8 +305,8 @@ groupDefaults.onDrag, e) - var x = (isTouch) ? e.originalEvent.touches[0].pageX : e.pageX, - y = (isTouch) ? e.originalEvent.touches[0].pageY : e.pageY, + var x = e.pageX || e.originalEvent.pageX, + y = e.pageY || e.originalEvent.pageY, box = this.sameResultBox, t = this.options.tolerance @@ -417,17 +406,7 @@ return this.offsetParent }, setPointer: function (e) { - if (isTouch) { - var pointer = { - left: e.originalEvent.touches[0].pageX, - top: e.originalEvent.touches[0].pageY - } - } else { - var pointer = { - left: e.pageX, - top: e.pageY - } - } + var pointer = this.getPointer(e) if (this.$getOffsetParent()) { var relativePointer = getRelativePosition(pointer, this.$getOffsetParent()) @@ -439,17 +418,16 @@ this.pointer = pointer }, distanceMet: function (e) { - if (isTouch) { - return (Math.max( - Math.abs(this.pointer.left - e.originalEvent.touches[0].pageX), - Math.abs(this.pointer.top - e.originalEvent.touches[0].pageY) - ) >= this.options.distance) - - } else { - return (Math.max( - Math.abs(this.pointer.left - e.pageX), - Math.abs(this.pointer.top - e.pageY) - ) >= this.options.distance) + var currentPointer = this.getPointer(e) + return (Math.max( + Math.abs(this.pointer.left - currentPointer.left), + Math.abs(this.pointer.top - currentPointer.top) + ) >= this.options.distance) + }, + getPointer: function(e) { + return { + left: e.pageX || e.originalEvent.pageX, + top: e.pageY || e.originalEvent.pageY } }, setupDelayTimer: function () { diff --git a/modules/backend/assets/js/october.tab.js b/modules/backend/assets/js/october.tab.js index c53b6453c..2420f74c1 100644 --- a/modules/backend/assets/js/october.tab.js +++ b/modules/backend/assets/js/october.tab.js @@ -433,7 +433,9 @@ /* * Detect invalid fields, focus the tab */ - $(window).on('ajaxInvalidField', function(ev, element, name){ + $(window).on('ajaxInvalidField', function(event, element, name, messages, isFirst){ + if (!isFirst) return + event.preventDefault() element.closest('[data-control=tab]').ocTab('goToElement', element) element.focus() }) diff --git a/modules/backend/assets/js/october.treelist.js b/modules/backend/assets/js/october.treelist.js index 6c48263c2..c5ef48c59 100644 --- a/modules/backend/assets/js/october.treelist.js +++ b/modules/backend/assets/js/october.treelist.js @@ -3,6 +3,8 @@ * * Supported options: * - handle - class name to use as a handle + * - nested - set to false if sorting should be kept within each OL container, if using + * a handle it should be focused enough to exclude nested handles. * * Events: * - move.oc.treelist - triggered when a node on the tree is moved. @@ -20,26 +22,37 @@ this.options = options || {}; var sortableOptions = { - handle: options.handle, - onDrop: function($item, container, _super) { - self.$el.trigger('move.oc.treelist', { item: $item, container: container }) - _super($item, container) - }, - afterMove: function($placeholder, container, $closestEl) { - self.$el.trigger('aftermove.oc.treelist', { placeholder: $placeholder, container: container, closestEl: $closestEl }) + handle: options.handle, + nested: options.nested, + onDrop: function($item, container, _super) { + self.$el.trigger('move.oc.treelist', { item: $item, container: container }) + _super($item, container) + }, + afterMove: function($placeholder, container, $closestEl) { + self.$el.trigger('aftermove.oc.treelist', { placeholder: $placeholder, container: container, closestEl: $closestEl }) + } } - } $el.find('> ol').sortable($.extend(sortableOptions, options)) + + if (!options.nested) { + $el.find('> ol ol').sortable($.extend(sortableOptions, options)) + } } TreeListWidget.prototype.unbind = function() { this.$el.find('> ol').sortable('destroy') + + if (!this.options.nested) { + this.$el.find('> ol ol').sortable('destroy') + } + this.$el.removeData('oc.treelist') } TreeListWidget.DEFAULTS = { - handle: null + handle: null, + nested: true } // TREELIST WIDGET PLUGIN DEFINITION diff --git a/modules/backend/behaviors/FormController.php b/modules/backend/behaviors/FormController.php index c7883ec2a..7f640857d 100644 --- a/modules/backend/behaviors/FormController.php +++ b/modules/backend/behaviors/FormController.php @@ -76,7 +76,7 @@ class FormController extends ControllerBehavior $config = $this->makeConfig($this->config->form); $config->model = $model; - $config->arrayName = Str::getRealClass($model); + $config->arrayName = class_basename($model); $config->context = $context; /* diff --git a/modules/backend/behaviors/RelationController.php b/modules/backend/behaviors/RelationController.php index f16d474a3..a53fff7a5 100644 --- a/modules/backend/behaviors/RelationController.php +++ b/modules/backend/behaviors/RelationController.php @@ -1,7 +1,6 @@ field) $id .= '-' . $this->field; @@ -673,7 +672,7 @@ class RelationController extends ControllerBehavior elseif ($this->viewMode == 'single') { $config = $this->makeConfig($this->config->form); $config->model = $this->relationModel; - $config->arrayName = Str::getRealClass($this->relationModel); + $config->arrayName = class_basename($this->relationModel); $config->context = 'relation'; $config->alias = $this->alias . 'ViewForm'; @@ -732,7 +731,7 @@ class RelationController extends ControllerBehavior elseif ($this->manageMode == 'form' && isset($this->config->form)) { $config = $this->makeConfig($this->config->form); $config->model = $this->relationModel; - $config->arrayName = Str::getRealClass($this->relationModel); + $config->arrayName = class_basename($this->relationModel); $config->context = 'relation'; $config->alias = $this->alias . 'ManageForm'; @@ -778,7 +777,7 @@ class RelationController extends ControllerBehavior { $config = $this->makeConfig($this->config->pivot); $config->model = $this->relationModel; - $config->arrayName = Str::getRealClass($this->relationModel); + $config->arrayName = class_basename($this->relationModel); $config->context = 'relation'; $config->alias = $this->alias . 'ManagePivotForm'; diff --git a/modules/backend/classes/Controller.php b/modules/backend/classes/Controller.php index b4dcd6b8a..88d6557df 100644 --- a/modules/backend/classes/Controller.php +++ b/modules/backend/classes/Controller.php @@ -1,7 +1,6 @@ action; + $id = class_basename(get_called_class()) . '-' . $this->action; if ($suffix !== null) $id .= '-' . $suffix; diff --git a/modules/backend/classes/ControllerBehavior.php b/modules/backend/classes/ControllerBehavior.php index 6d0fc4ed3..8d137bccc 100644 --- a/modules/backend/classes/ControllerBehavior.php +++ b/modules/backend/classes/ControllerBehavior.php @@ -4,7 +4,7 @@ use Str; use Lang; use System\Classes\ApplicationException; use October\Rain\Extension\ExtensionBase; -use Backend\Traits\ViewMaker; +use System\Traits\ViewMaker; /** * Controller Behavior base class @@ -14,10 +14,10 @@ use Backend\Traits\ViewMaker; */ class ControllerBehavior extends ExtensionBase { + use \Backend\Traits\WidgetMaker; use \System\Traits\AssetMaker; use \System\Traits\ConfigMaker; - use \Backend\Traits\WidgetMaker; - use \Backend\Traits\ViewMaker { + use \System\Traits\ViewMaker { ViewMaker::makeFileContents as localMakeFileContents; } diff --git a/modules/backend/classes/Skin.php b/modules/backend/classes/Skin.php index 39598eba7..f2041ec8b 100644 --- a/modules/backend/classes/Skin.php +++ b/modules/backend/classes/Skin.php @@ -1,6 +1,5 @@ skinPath = $classFile ? $classFile . '/' . $classFolder diff --git a/modules/backend/classes/WidgetBase.php b/modules/backend/classes/WidgetBase.php index 3c05e776a..cab703203 100644 --- a/modules/backend/classes/WidgetBase.php +++ b/modules/backend/classes/WidgetBase.php @@ -16,7 +16,7 @@ abstract class WidgetBase use \System\Traits\AssetMaker; use \System\Traits\ConfigMaker; - use \Backend\Traits\ViewMaker; + use \System\Traits\ViewMaker; use \Backend\Traits\WidgetMaker; use \October\Rain\Support\Traits\Emitter; @@ -123,7 +123,7 @@ abstract class WidgetBase */ public function getId($suffix = null) { - $id = Str::getRealClass(get_called_class()); + $id = class_basename(get_called_class()); if ($this->alias != $this->defaultAlias) $id .= '-' . $this->alias; diff --git a/modules/backend/controllers/editorpreferences/index.htm b/modules/backend/controllers/editorpreferences/index.htm index 26ec34f6e..25be31fb9 100644 --- a/modules/backend/controllers/editorpreferences/index.htm +++ b/modules/backend/controllers/editorpreferences/index.htm @@ -38,8 +38,7 @@ type="submit" data-request="onSave" data-request-data="redirect:0" - data-hotkey="ctrl+s" - data-hotkey-mac="cmd+s" + data-hotkey="ctrl+s, cmd+s" data-load-indicator="" class="btn btn-primary"> diff --git a/modules/backend/controllers/groups/create.htm b/modules/backend/controllers/groups/create.htm index 5f9bd728a..62f852781 100644 --- a/modules/backend/controllers/groups/create.htm +++ b/modules/backend/controllers/groups/create.htm @@ -17,8 +17,7 @@