X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=js%2Fjquery%2Fjquery.dashboard.js;h=d1f68bb4e16badc3d23e99def5a6048643ba2cf8;hb=58cb13f8bfa693af1dcf19e5eb24e13d77da2d14;hp=44bef065ba6d0cae6411016239b001d7996bee9f;hpb=65af936e3055779f3b6e8134218314397efc1e57;p=civicrm-core.git diff --git a/js/jquery/jquery.dashboard.js b/js/jquery/jquery.dashboard.js index 44bef065ba..d1f68bb4e1 100644 --- a/js/jquery/jquery.dashboard.js +++ b/js/jquery/jquery.dashboard.js @@ -2,7 +2,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.7 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2015 | + | Copyright CiviCRM LLC (c) 2004-2016 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -36,8 +36,11 @@ * Draggable * UI Core * + * NOTE: This file is viewed as "legacy" and shouldn't be used to + * develop new functionality. Its lint problems are grandfathered + * (although if someone wants to cleanup+test, please feel welcome). */ - +/* jshint ignore:start */ (function($) { // Create closure. // Constructor for dashboard object. $.fn.dashboard = function(options) { @@ -78,19 +81,19 @@ var params = {}; // For each column... - for (var c in dashboard.columns) { + for (var c2 in dashboard.columns) { // IDs of the sortable elements in this column. - if( typeof dashboard.columns[c] == 'object' ) var ids = dashboard.columns[c].element.sortable('toArray'); + var ids = (typeof dashboard.columns[c2] == 'object') ? dashboard.columns[c2].element.sortable('toArray') : undefined; // For each id... for (var w in ids) { // Chop 'widget-' off of the front so that we have the real widget id. - if( typeof ids[w] == 'string' ) var id = ids[w].substring('widget-'.length); + var id = (typeof ids[w] == 'string') ? ids[w].substring('widget-'.length) : undefined; // Add one flat property to the params object that will look like an array element to the PHP server. // Unfortunately jQuery doesn't do this for us. - if ( typeof dashboard.widgets[id] == 'object' ) params['columns[' + c + '][' + id + ']'] = (dashboard.widgets[id].minimized ? '1' : '0'); + if ( typeof dashboard.widgets[id] == 'object' ) params['columns[' + c2 + '][' + id + ']'] = (dashboard.widgets[id].minimized ? '1' : '0'); } } @@ -266,7 +269,7 @@ // Callback for when a user starts resorting a list. Hides all the empty placeholders. function hideEmptyPlaceholders(e, ui) { for (var c in dashboard.columns) { - if( typeof dashboard.columns[c] == 'object ' ) dashboard.columns[c].emptyPlaceholder.hide(); + if( (typeof dashboard.columns[c]) == 'object' ) dashboard.columns[c].emptyPlaceholder.hide(); } } @@ -306,14 +309,14 @@ }; widget.minimize = function() { $('.widget-content', widget.element).slideUp(opts.animationSpeed); - $(widget.controls.minimize.element).addClass( 'maximize-icon' ); - $(widget.controls.minimize.element).removeClass( 'minimize-icon' ); + $(widget.controls.minimize.element).addClass( 'fa-caret-right' ); + $(widget.controls.minimize.element).removeClass( 'fa-caret-down' ); widget.minimized = true; }; widget.maximize = function() { $('.widget-content', widget.element).slideDown(opts.animationSpeed); - $(widget.controls.minimize.element).removeClass( 'maximize-icon' ); - $(widget.controls.minimize.element).addClass( 'minimize-icon' ); + $(widget.controls.minimize.element).removeClass( 'fa-caret-right' ); + $(widget.controls.minimize.element).addClass( 'fa-caret-down' ); widget.minimized = false; }; @@ -422,7 +425,7 @@ // Adds controls to a widget. id is for internal use and image file name in images/dashboard/ (a .gif). widget.addControl = function(id, control) { - var markup = ''; + var markup = ''; control.element = $(markup).prependTo($('.widget-controls', widget.element)).click(control.callback); }; @@ -453,19 +456,23 @@ widget.controls = { settings: { description: ts('Configure this dashlet'), - callback: widget.toggleSettings + callback: widget.toggleSettings, + icon: 'fa-wrench' }, minimize: { description: ts('Collapse or expand'), - callback: widget.toggleMinimize + callback: widget.toggleMinimize, + icon: 'fa-caret-down', }, fullscreen: { description: ts('View fullscreen'), - callback: widget.enterFullscreen + callback: widget.enterFullscreen, + icon: 'fa-expand', }, close: { description: ts('Remove from dashboard'), - callback: widget.remove + callback: widget.remove, + icon: 'fa-times' } }; // End public properties of widget.