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"));
});
gulp.task('watch', ['scss'], function() {
gulp.task('watch', ['scss'], function () {
gulp.watch('./scss/*.scss', ['scss']);
});
gulp.task('default', ['scss'], function() {
gulp.task('default', ['scss'], function () {
// noop
});

192
js/cms.js
View File

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