FIX PHP Linter fixes

This commit is contained in:
Franco Springveldt 2017-09-14 09:55:09 +12:00
parent aec1d542b1
commit 026b64cafb
2 changed files with 98 additions and 98 deletions

View File

@ -8,10 +8,10 @@ gulp.task("scss", function () {
.pipe(gulp.dest("./css")); .pipe(gulp.dest("./css"));
}); });
gulp.task('watch', ['scss'], function() { gulp.task('watch', ['scss'], function () {
gulp.watch('./scss/*.scss', ['scss']); gulp.watch('./scss/*.scss', ['scss']);
}); });
gulp.task('default', ['scss'], function() { gulp.task('default', ['scss'], function () {
// noop // noop
}); });

192
js/cms.js
View File

@ -1,6 +1,6 @@
(function ($) { (function ($) {
$.entwine('ss', function ($) { $.entwine('ss', function ($) {
/** /**
* The page success/error message sits outside of the html block * The page success/error message sits outside of the html block
@ -10,136 +10,136 @@
* @see https://github.com/silverstripe/silverstripe-blog/issues/210 * @see https://github.com/silverstripe/silverstripe-blog/issues/210
*/ */
$('.cms-content-fields > #Form_EditForm_error').entwine({ $('.cms-content-fields > #Form_EditForm_error').entwine({
'onadd': function() { 'onadd': function () {
var $target = $('.blog-admin-outer'); var $target = $('.blog-admin-outer');
if($target.length == 1) { if ($target.length == 1) {
$target.prepend(this); $target.prepend(this);
} }
} }
}); });
/** /**
* Register expandable help text functions with fields. * Register expandable help text functions with fields.
*/ */
$('.toggle-description').entwine({ $('.toggle-description').entwine({
'onadd': function () { 'onadd': function () {
var $this = $(this); var $this = $(this);
/** /**
* Prevent multiple events being added. * Prevent multiple events being added.
*/ */
if ($this.hasClass('toggle-description-enabled')) { if ($this.hasClass('toggle-description-enabled')) {
return; return;
} }
$this.addClass('toggle-description-enabled'); $this.addClass('toggle-description-enabled');
/** /**
* Toggle next description when button is clicked. * Toggle next description when button is clicked.
*/ */
var shown = false; var shown = false;
$this.on('click', function() { $this.on('click', function () {
$this.parent().next('.description')[shown ? 'hide' : 'show'](); $this.parent().next('.description')[shown ? 'hide' : 'show']();
$this.toggleClass('toggle-description-shown'); $this.toggleClass('toggle-description-shown');
shown = !shown; shown = !shown;
}); });
/** /**
* Hide next description by default. * Hide next description by default.
*/ */
$this.parent().next('.description').hide(); $this.parent().next('.description').hide();
/** /**
* Add classes to correct inherited layout issues in a small context. * Add classes to correct inherited layout issues in a small context.
*/ */
$this.parent().addClass('toggle-description-correct-right'); $this.parent().addClass('toggle-description-correct-right');
$this.parent().prev('.middleColumn').addClass('toggle-description-correct-middle'); $this.parent().prev('.middleColumn').addClass('toggle-description-correct-middle');
$this.parent().next('.description').addClass('toggle-description-correct-description'); $this.parent().next('.description').addClass('toggle-description-correct-description');
} }
}); });
/** /**
* Custom merge actions for tags and categories * Custom merge actions for tags and categories
*/ */
$('.MergeAction').entwine({ $('.MergeAction').entwine({
'onadd': function() { 'onadd': function () {
var $this = $(this); var $this = $(this);
$this.on('click', 'select', function() { $this.on('click', 'select', function () {
return false; return false;
}); });
$this.children('button').each(function(i, button) { $this.children('button').each(function (i, button) {
var $button = $(button); var $button = $(button);
var $select = $button.prev('select'); var $select = $button.prev('select');
$button.before('<input type="hidden" name="' + $button.attr('data-target') + '" value="' + $select.val() + '" />'); $button.before('<input type="hidden" name="' + $button.attr('data-target') + '" value="' + $select.val() + '" />');
}); });
$this.on('change', 'select', function(e) { $this.on('change', 'select', function (e) {
var $target = $(e.target); var $target = $(e.target);
$target.next('input').val($target.val()); $target.next('input').val($target.val());
}); });
$this.children('button, select').hide(); $this.children('button, select').hide();
$this.on('click', '.MergeActionReveal', function(e) { $this.on('click', '.MergeActionReveal', function (e) {
var $target = $(e.target); var $target = $(e.target);
$target.parent().children('button, select').show(); $target.parent().children('button, select').show();
$target.hide(); $target.hide();
return false; return false;
}); });
} }
}); });
/** /**
* Customise the cms-panel behaviour for blog sidebar * Customise the cms-panel behaviour for blog sidebar
* *
* see LeftAndMain.Panel.js for base behaviour * see LeftAndMain.Panel.js for base behaviour
*/ */
$('.blog-admin-sidebar.cms-panel').entwine({ $('.blog-admin-sidebar.cms-panel').entwine({
MinInnerWidth: 620, MinInnerWidth: 620,
onadd: function() { onadd: function () {
this._super(); this._super();
this.updateLayout(); this.updateLayout();
// If this panel is open and the left hand column is smaller than the minimum, contract it instead // If this panel is open and the left hand column is smaller than the minimum, contract it instead
if(!this.hasClass('collapsed') && ($(".blog-admin-outer").width() < this.getMinInnerWidth())) { if (!this.hasClass('collapsed') && ($(".blog-admin-outer").width() < this.getMinInnerWidth())) {
this.collapsePanel(); this.collapsePanel();
} }
window.onresize = function() { window.onresize = function () {
this.updateLayout(); this.updateLayout();
}.bind(this); }.bind(this);
}, },
togglePanel: function(bool, silent) { togglePanel: function (bool, silent) {
this._super(bool, silent); this._super(bool, silent);
this.updateLayout(); this.updateLayout();
}, },
/** /**
* Adjust minimum width of content to account for extra panel * Adjust minimum width of content to account for extra panel
* *
* @returns {undefined} * @returns {undefined}
*/ */
updateLayout: function() { updateLayout: function () {
$(this).css('height', '100%'); $(this).css('height', '100%');
var currentHeight = $(this).outerHeight(); var currentHeight = $(this).outerHeight();
var bottomHeight = $('.cms-content-actions').eq(0).outerHeight(); var bottomHeight = $('.cms-content-actions').eq(0).outerHeight();
$(this).css('height', (currentHeight - bottomHeight) + "px"); $(this).css('height', (currentHeight - bottomHeight) + "px");
$(this).css('bottom', bottomHeight + "px"); $(this).css('bottom', bottomHeight + "px");
$('.cms-container').updateLayoutOptions({ $('.cms-container').updateLayoutOptions({
minContentWidth: 820 + this.width() minContentWidth: 820 + this.width()
}); });
} }
}); });
}); });
})(jQuery); })(jQuery);