diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-10-19 20:12:51 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2015-10-19 20:12:51 +0300 |
commit | 1b6050626d18e966cb18f03320ead7af14525db5 (patch) | |
tree | d6192b535e944226f3e6acf12351db70a5fc36e1 /plugins/Dashboard | |
parent | 6a14b0ce8461e62a4a37298c370775380305d71b (diff) | |
parent | 48ca332907257c35a7d94c1b120c9ad6cfaf320d (diff) |
Merge branch 'master' into 3.0
Conflicts:
core/Version.php
plugins/Actions/Menu.php
plugins/CoreHome/angularjs/history/history.service.js
plugins/CoreHome/javascripts/menu.js
plugins/CoreHome/templates/_menu.twig
plugins/Dashboard/Menu.php
plugins/Ecommerce/Menu.php
plugins/ExampleUI/Menu.php
plugins/Goals/Menu.php
plugins/Referrers/Menu.php
plugins/VisitsSummary/Menu.php
tests/UI/expected-ui-screenshots
tests/UI/specs/UIIntegration_spec.js
Diffstat (limited to 'plugins/Dashboard')
-rw-r--r-- | plugins/Dashboard/Dashboard.php | 1 | ||||
-rw-r--r-- | plugins/Dashboard/javascripts/dashboard.js | 36 | ||||
-rwxr-xr-x | plugins/Dashboard/javascripts/dashboardWidget.js | 11 | ||||
-rw-r--r-- | plugins/Dashboard/lang/en.json | 1 | ||||
-rw-r--r-- | plugins/Dashboard/stylesheets/dashboard.less | 5 |
5 files changed, 36 insertions, 18 deletions
diff --git a/plugins/Dashboard/Dashboard.php b/plugins/Dashboard/Dashboard.php index f46bf1526f..5eee375988 100644 --- a/plugins/Dashboard/Dashboard.php +++ b/plugins/Dashboard/Dashboard.php @@ -297,6 +297,7 @@ class Dashboard extends \Piwik\Plugin $translationKeys[] = 'Dashboard_WidgetNotFound'; $translationKeys[] = 'Dashboard_DashboardCopied'; $translationKeys[] = 'Dashboard_Dashboard'; + $translationKeys[] = 'Dashboard_RemoveDefaultDashboardNotPossible'; $translationKeys[] = 'General_Close'; $translationKeys[] = 'General_Refresh'; } diff --git a/plugins/Dashboard/javascripts/dashboard.js b/plugins/Dashboard/javascripts/dashboard.js index 5a0396e6b3..6286f74791 100644 --- a/plugins/Dashboard/javascripts/dashboard.js +++ b/plugins/Dashboard/javascripts/dashboard.js @@ -161,21 +161,15 @@ function copyDashboardToUser() { // on menu item click, trigger action event on this var self = this; this.$element.on('click', 'ul.submenu li[data-action]', function (e) { - self.$element.toggleClass('expanded'); - - $(self).trigger($(this).attr('data-action')); + if (!$(this).attr('disabled')) { + self.$element.removeClass('expanded'); + $(self).trigger($(this).attr('data-action')); + } }); // open manager on open this.$element.on('click', function (e) { - if ($(e.target).is('.dashboardSettings,.dashboardSettings>span')) { - self.$element.toggleClass('expanded'); - - // fix position - self.$element - .find('.widgetpreview-widgetlist') - .css('paddingTop', self.$element.find('.widgetpreview-categorylist').parent('li').position().top); - + if ($(e.target).is('.dashboardSettings') || $(e.target).closest('.dashboardSettings').length) { self.onOpen(); } }); @@ -273,10 +267,24 @@ function copyDashboardToUser() { $.extend(DashboardManagerControl.prototype, DashboardSettingsControlBase.prototype, { onOpen: function () { if ($('#dashboardWidgetsArea').dashboard('isDefaultDashboard')) { - $('.removeDashboardLink', this.$element).hide(); + $('[data-action=removeDashboard]', this.$element).attr('disabled', 'disabled'); + $(this.$element).tooltip({ + items: '[data-action=removeDashboard]', + show: false, + hide: false, + track: true, + content: function() { + return _pk_translate('Dashboard_RemoveDefaultDashboardNotPossible') + }, + tooltipClass: 'small' + }); } else { - $('.removeDashboardLink', this.$element).show(); - } + $('[data-action=removeDashboard]', this.$element).removeAttr('disabled'); + // try to remove tooltip if any + try { + $(this.$element).tooltip('destroy'); + } catch (e) { } + } }, hide: function () { diff --git a/plugins/Dashboard/javascripts/dashboardWidget.js b/plugins/Dashboard/javascripts/dashboardWidget.js index 969ed9db28..29f0a3a794 100755 --- a/plugins/Dashboard/javascripts/dashboardWidget.js +++ b/plugins/Dashboard/javascripts/dashboardWidget.js @@ -118,9 +118,12 @@ var self = this, currentWidget = this.element; function onWidgetLoadedReplaceElementWithContent(loadedContent) { - $('.widgetContent', currentWidget).html(loadedContent); - $('.widgetContent', currentWidget).removeClass('loading'); - $('.widgetContent', currentWidget).trigger('widget:create', [self]); + var $widgetContent = $('.widgetContent', currentWidget); + + $widgetContent.html(loadedContent); + piwikHelper.compileAngularComponents($widgetContent); + $widgetContent.removeClass('loading'); + $widgetContent.trigger('widget:create', [self]); } // Reading segment from hash tag (standard case) or from the URL (when embedding dashboard) @@ -349,4 +352,4 @@ } }); -})(jQuery);
\ No newline at end of file +})(jQuery); diff --git a/plugins/Dashboard/lang/en.json b/plugins/Dashboard/lang/en.json index 89d8c994d9..68bfd22c8e 100644 --- a/plugins/Dashboard/lang/en.json +++ b/plugins/Dashboard/lang/en.json @@ -21,6 +21,7 @@ "PluginDescription": "Your Web Analytics Dashboard. Customise your dashboard by adding new widgets, drag and drop them around, and change the dashboard column layout. Each user can manage their own custom dashboard.", "RemoveDashboard": "Remove dashboard", "RemoveDashboardConfirm": "Are you sure you want to remove the dashboard \"%s\"?", + "RemoveDefaultDashboardNotPossible": "The default dashboard cannot be removed", "RenameDashboard": "Rename dashboard", "ResetDashboard": "Reset dashboard", "ResetDashboardConfirm": "Are you sure you want to reset your dashboard layout to the default Widgets selection?", diff --git a/plugins/Dashboard/stylesheets/dashboard.less b/plugins/Dashboard/stylesheets/dashboard.less index 39ad2e3ed7..b45398379c 100644 --- a/plugins/Dashboard/stylesheets/dashboard.less +++ b/plugins/Dashboard/stylesheets/dashboard.less @@ -335,6 +335,11 @@ div.widgetpreview-preview { color: @theme-color-link; } +.dashboardSettings .submenu li[disabled], +.dashboardSettings .submenu li[disabled]:hover { + color: #d3d3d3; +} + .dashboardSettings .widgetpreview-widgetlist { width: 228px; font-weight: normal; |