diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-11-03 00:55:32 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2015-11-04 23:02:10 +0300 |
commit | 8c970d3ecd5ee10825882eee2dfaf60f92a3a6ea (patch) | |
tree | 264a701b99ef0b77ade9ef7bdbacfe85d12a2318 /plugins | |
parent | 89eb98b2fdaf3fa72a4a038daa050764f904ecc6 (diff) |
changed look of custom variables screen, merge metadata when specified
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/CoreAdminHome/Menu.php | 2 | ||||
-rw-r--r-- | plugins/CustomVariables/Archiver.php | 3 | ||||
-rw-r--r-- | plugins/CustomVariables/CustomVariables.php | 2 | ||||
-rw-r--r-- | plugins/CustomVariables/Menu.php | 2 | ||||
-rw-r--r-- | plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.controller.js | 20 | ||||
-rw-r--r-- | plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.html | 75 | ||||
-rw-r--r-- | plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.less | 4 | ||||
-rw-r--r-- | plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.model.js | 10 | ||||
-rw-r--r-- | plugins/CustomVariables/lang/en.json | 6 | ||||
-rw-r--r-- | plugins/CustomVariables/tests/UI/CustomVariables_spec.js | 6 | ||||
-rw-r--r-- | plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_create.png | bin | 19928 -> 0 bytes | |||
-rw-r--r-- | plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_manage.png | bin | 44125 -> 68494 bytes |
12 files changed, 65 insertions, 65 deletions
diff --git a/plugins/CoreAdminHome/Menu.php b/plugins/CoreAdminHome/Menu.php index b4621e2f5e..a149baa399 100644 --- a/plugins/CoreAdminHome/Menu.php +++ b/plugins/CoreAdminHome/Menu.php @@ -61,7 +61,7 @@ class Menu extends \Piwik\Plugin\Menu if (!Piwik::isUserIsAnonymous()) { $menu->addManageItem('CoreAdminHome_TrackingCode', $this->urlForAction('trackingCodeGenerator'), - $order = 10); + $order = 20); if (SettingsManager::hasUserPluginsSettingsForCurrentUser()) { $menu->addPersonalItem('CoreAdminHome_PluginSettings', diff --git a/plugins/CustomVariables/Archiver.php b/plugins/CustomVariables/Archiver.php index 4a53ab78df..39aa9e6bb7 100644 --- a/plugins/CustomVariables/Archiver.php +++ b/plugins/CustomVariables/Archiver.php @@ -11,6 +11,7 @@ namespace Piwik\Plugins\CustomVariables; use Piwik\Config; use Piwik\DataAccess\LogAggregator; use Piwik\DataArray; +use Piwik\DataTable; use Piwik\Metrics; use Piwik\Tracker\GoalManager; use Piwik\Tracker; @@ -52,7 +53,7 @@ class Archiver extends \Piwik\Plugin\Archiver public function aggregateMultipleReports() { - $columnsAggregationOperation = null; + $columnsAggregationOperation = array('slots' => 'uniquearraymerge'); $this->getProcessor()->aggregateDataTableRecords( self::CUSTOM_VARIABLE_RECORD_NAME, diff --git a/plugins/CustomVariables/CustomVariables.php b/plugins/CustomVariables/CustomVariables.php index 03238212f1..24525983cd 100644 --- a/plugins/CustomVariables/CustomVariables.php +++ b/plugins/CustomVariables/CustomVariables.php @@ -151,7 +151,7 @@ class CustomVariables extends \Piwik\Plugin { $translationKeys[] = 'CustomVariables_CustomVariables'; $translationKeys[] = 'CustomVariables_ManageDescription'; - $translationKeys[] = 'CustomVariables_Scope'; + $translationKeys[] = 'CustomVariables_ScopeX'; $translationKeys[] = 'CustomVariables_Index'; $translationKeys[] = 'CustomVariables_Usages'; $translationKeys[] = 'CustomVariables_Unused'; diff --git a/plugins/CustomVariables/Menu.php b/plugins/CustomVariables/Menu.php index 80e1d78193..b97aa1bb01 100644 --- a/plugins/CustomVariables/Menu.php +++ b/plugins/CustomVariables/Menu.php @@ -27,7 +27,7 @@ class Menu extends \Piwik\Plugin\Menu $idSite = Common::getRequestVar('idSite', $default, 'int'); if (Piwik::isUserHasAdminAccess($idSite)) { - $menu->addManageItem('Custom Variables', $this->urlForAction('manage'), $orderId = 30); + $menu->addManageItem('Custom Variables', $this->urlForAction('manage'), $orderId = 15); } } } diff --git a/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.controller.js b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.controller.js index 4b6b1c213d..4cbc8dc3e8 100644 --- a/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.controller.js +++ b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.controller.js @@ -13,23 +13,7 @@ manageCustomVarsModel.fetchUsages(); this.model = manageCustomVarsModel; - this.createCustomVariableSlot = function () { - var highestIndex = 5; - angular.forEach(manageCustomVarsModel.customVariables, function (customVar) { - if (customVar.index > highestIndex) { - highestIndex = customVar.index; - } - }); - - var translate = $filter('translate'); - - var command = './console customvariables:set-max-custom-variables ' + (highestIndex + 1); - var text = translate('CustomVariables_CreatingCustomVariableTakesTime'); - text += '<br /><br />' + translate('CustomVariables_CurrentAvailableCustomVariables', '<strong>' + highestIndex + '</strong>'); - text += '<br /><br />' + translate('CustomVariables_ToCreateCustomVarExecute'); - text += '<br /><br /><code>' + command + '</code>'; - - piwik.helper.modalConfirm('<div class="ui-confirm" title="' + translate('CustomVariables_CreateNewSlot') + '">' + text + '<br /><br /></div>'); - } + this.siteName = piwik.siteName; + this.scopes = ['visit', 'page']; } })();
\ No newline at end of file diff --git a/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.html b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.html index 8cc7c60e60..2870295847 100644 --- a/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.html +++ b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.html @@ -1,41 +1,50 @@ <div class="manageCustomVars"> - <h2 piwik-enriched-headline>{{ 'CustomVariables_CustomVariables'|translate }}</h2> + <h2 piwik-enriched-headline help-url="http://piwik.org/docs/custom-variables/">{{ 'CustomVariables_CustomVariables'|translate }}</h2> - {{ 'CustomVariables_ManageDescription'|translate }} + <p> + <span ng-bind-html="'CustomVariables_ManageDescription'|translate:manageCustomVars.siteName"></span> + </p> - <br /> + <div ng-repeat="scope in manageCustomVars.scopes"> + <h2 class="secondary">{{ 'CustomVariables_ScopeX'|translate:(scope|ucfirst) }}</h2> + <table class="dataTable entityTable"> + <thead> + <tr> + <th>{{'CustomVariables_Index'|translate }}</th> + <th>{{'CustomVariables_Usages'|translate }}</th> + </tr> + </thead> + <tbody> + <tr> + <td colspan="3" ng-show="manageCustomVars.model.isLoading">{{ 'General_Loading'|translate }}</td> + </tr> + <tr ng-repeat="customVariables in manageCustomVars.model.customVariables|filter:{scope: scope}"> + <td class="index">{{ customVariables.index }}</td> + <td> + <span ng-show="(customVariables.usages|length) === 0" + class="unused">{{'CustomVariables_Unused'|translate }}</span> + <span ng-show="customVariables.usages|length" ng-repeat="cvar in customVariables.usages|orderBy:'-nb_actions'"> + <span title="{{ 'CustomVariables_UsageDetails'|translate:(cvar.nb_visits ? cvar.nb_visits : 0):(cvar.nb_actions ? cvar.nb_actions : 0) }}">{{ cvar.name }}</span><span ng-show="!$last">, </span> + </span> + </td> + </tr> + </tbody> + </table> + </div> - <h3>{{ customVariables.scope }}</h3> - <table class="dataTable entityTable" style="max-width: 900px;"> - <thead> - <tr> - <th>{{'CustomVariables_Scope'|translate }}</th> - <th>{{'CustomVariables_Index'|translate }}</th> - <th>{{'CustomVariables_Usages'|translate }}</th> - </tr> - </thead> - <tbody> - <tr> - <td colspan="3" ng-show="manageCustomVars.model.isLoading">{{ 'General_Loading'|translate }}</td> - </tr> - <tr ng-repeat="customVariables in manageCustomVars.model.customVariables"> - <td class="scope">{{ customVariables.scope|ucfirst }}</td> - <td class="index">{{ customVariables.index }}</td> - <td> - <span ng-show="(customVariables.usages|length) === 0" - class="unused">{{'CustomVariables_Unused'|translate }}</span> - <span ng-show="customVariables.usages|length" ng-repeat="cvar in customVariables.usages|orderBy:'-nb_actions'"> - <span title="{{ 'CustomVariables_UsageDetails'|translate:cvar.nb_visits:cvar.nb_actions }}">{{ cvar.name }}</span><span ng-show="!$last">, </span> - </span> - </td> - </tr> - </tbody> - </table> + <h2 class="secondary" ng-show="!manageCustomVars.model.isLoading">{{ 'CustomVariables_CreateNewSlot'|translate }}</h2> - <br/> - <a class="btn addCustomVar" ng-show="!manageCustomVars.model.isLoading" value="" - ng-click="manageCustomVars.createCustomVariableSlot()" - >{{ 'CustomVariables_CreateNewSlot'|translate }} <span class="icon-info"></span></a><br/> + <p ng-show="!manageCustomVars.model.isLoading"> + {{ 'CustomVariables_CreatingCustomVariableTakesTime'|translate }} + <br /><br /> + <span ng-bind-html="'CustomVariables_CurrentAvailableCustomVariables'|translate:('<strong>'+manageCustomVars.model.numSlotsAvailable+'</strong>')"></span> + <br /> + <br /> + {{ 'CustomVariables_ToCreateCustomVarExecute'|translate }} + <br /> + <br /> + <code>./console customvariables:set-max-custom-variables {{ manageCustomVars.model.numSlotsAvailable + 1 }}</code> + </p> </div>
\ No newline at end of file diff --git a/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.less b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.less index 2d3e4e4f04..3a37f84a43 100644 --- a/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.less +++ b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.less @@ -3,6 +3,10 @@ color: @color-silver; } + table, p { + width: 900px; + } + .scope, .index { width: 90px; max-width: 90px; diff --git a/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.model.js b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.model.js index 3cc5b3d4b2..87d3f92fe6 100644 --- a/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.model.js +++ b/plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.model.js @@ -15,7 +15,8 @@ customVariables : [], extractions : [], isLoading: false, - fetchUsages: fetchUsages + fetchUsages: fetchUsages, + numSlotsAvailable: 5, }; return model; @@ -27,6 +28,13 @@ piwikApi.fetch({method: 'CustomVariables.getUsagesOfSlots'}) .then(function (customVariables) { model.customVariables = customVariables; + + angular.forEach(customVariables, function (customVar) { + if (customVar.index > model.numSlotsAvailable) { + model.numSlotsAvailable = customVar.index; + } + }); + })['finally'](function () { // .finally() is not IE8 compatible see https://github.com/angular/angular.js/commit/f078762d48d0d5d9796dcdf2cb0241198677582c model.isLoading = false; }); diff --git a/plugins/CustomVariables/lang/en.json b/plugins/CustomVariables/lang/en.json index 61033b2757..810cd19702 100644 --- a/plugins/CustomVariables/lang/en.json +++ b/plugins/CustomVariables/lang/en.json @@ -7,12 +7,12 @@ "PluginDescription": "Custom Variables are (name, value) pairs that you can assign using the Javascript API to visitors or any of their action. Piwik will then report how many visits, pages, conversions for each of these custom names and values. View the detailed Custom Variables for each user and action in the Visitor Log.<br />Required to use <a href=\"http://piwik.org/docs/ecommerce-analytics/\">Ecommerce Analytics</a> feature!", "ScopePage": "scope page", "ScopeVisit": "scope visit", - "ManageDescription": "This overview shows all custom variable slots and their usages. The names within each slot are ordered by how often they were used in total.", - "Scope": "Scope", + "ManageDescription": "This overview shows all custom variable slots and their usages for website '%s'. The names within each slot are ordered by how often they were used in total.", + "ScopeX": "Scope %s", "Index": "Index", "Usages": "Usages", "Unused": "Unused", - "CreateNewSlot": "Create a new Custom Variable slot", + "CreateNewSlot": "Increase the number of available Custom Variables slots", "UsageDetails": "%s visits and %s actions since creation of this website.", "CreatingCustomVariableTakesTime": "Creating a new custom variable slot can take a long time depending on the size of your database. Therefore it is only possible to do this via a command which needs to be executed on the command line.", "CurrentAvailableCustomVariables": "Currently you can use up to %s Custom Variables per site.", diff --git a/plugins/CustomVariables/tests/UI/CustomVariables_spec.js b/plugins/CustomVariables/tests/UI/CustomVariables_spec.js index a64a1cd7ce..1e247fca56 100644 --- a/plugins/CustomVariables/tests/UI/CustomVariables_spec.js +++ b/plugins/CustomVariables/tests/UI/CustomVariables_spec.js @@ -22,10 +22,4 @@ describe("CustomVariables", function () { expect.screenshot('link_in_menu').to.be.captureSelector('li:contains(Manage)', function (page) { }, done); }); - - it('should show custom variable creation command in dialog', function (done) { - expect.screenshot('create').to.be.captureSelector('.ui-dialog', function (page) { - page.click('.manageCustomVars .addCustomVar') - }, done); - }); });
\ No newline at end of file diff --git a/plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_create.png b/plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_create.png Binary files differdeleted file mode 100644 index ccd46cfa9b..0000000000 --- a/plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_create.png +++ /dev/null diff --git a/plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_manage.png b/plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_manage.png Binary files differindex c520cde1bf..c03b7e3795 100644 --- a/plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_manage.png +++ b/plugins/CustomVariables/tests/UI/expected-ui-screenshots/CustomVariables_manage.png |