diff options
author | Matthieu Aubry <matt@piwik.org> | 2015-11-03 00:54:27 +0300 |
---|---|---|
committer | Matthieu Aubry <matt@piwik.org> | 2015-11-03 00:54:27 +0300 |
commit | ac169f0014b966fa59b0e8efc26fe7d2d4c136fb (patch) | |
tree | aa2bd43d6391d5d1ceee033939de46c4e9cb6b8c | |
parent | 428b3ad8d82d86dda89f9e5d118360a4a60eedc6 (diff) | |
parent | e060cfaa63f35862e6ca9a9dc5a02d668c048732 (diff) |
Merge pull request #9106 from piwik/8569
In the website selector display tooltip with full website name
-rw-r--r-- | plugins/CoreHome/CoreHome.php | 3 | ||||
-rw-r--r-- | plugins/CoreHome/angularjs/common/filters/htmldecode.js | 26 | ||||
-rw-r--r-- | plugins/CoreHome/angularjs/siteselector/siteselector.directive.html | 3 | ||||
-rw-r--r-- | plugins/CoreHome/lang/en.json | 3 |
4 files changed, 32 insertions, 3 deletions
diff --git a/plugins/CoreHome/CoreHome.php b/plugins/CoreHome/CoreHome.php index 78ee438aa3..f2d788cd54 100644 --- a/plugins/CoreHome/CoreHome.php +++ b/plugins/CoreHome/CoreHome.php @@ -133,6 +133,7 @@ class CoreHome extends \Piwik\Plugin $jsFiles[] = "plugins/CoreHome/angularjs/common/filters/length.js"; $jsFiles[] = "plugins/CoreHome/angularjs/common/filters/trim.js"; $jsFiles[] = "plugins/CoreHome/angularjs/common/filters/pretty-url.js"; + $jsFiles[] = "plugins/CoreHome/angularjs/common/filters/htmldecode.js"; $jsFiles[] = "plugins/CoreHome/angularjs/common/directives/directive.module.js"; $jsFiles[] = "plugins/CoreHome/angularjs/common/directives/autocomplete-matched.js"; @@ -180,7 +181,6 @@ class CoreHome extends \Piwik\Plugin $translationKeys[] = 'General_Show'; $translationKeys[] = 'General_Hide'; $translationKeys[] = 'General_Website'; - $translationKeys[] = 'General_ChooseWebsite'; $translationKeys[] = 'Intl_Year_Short'; $translationKeys[] = 'General_MultiSitesSummary'; $translationKeys[] = 'General_SearchNoResults'; @@ -275,5 +275,6 @@ class CoreHome extends \Piwik\Plugin $translationKeys[] = 'CoreHome_Segments'; $translationKeys[] = 'CoreHome_MenuEntries'; $translationKeys[] = 'SitesManager_Sites'; + $translationKeys[] = 'CoreHome_ChangeCurrentWebsite'; } } diff --git a/plugins/CoreHome/angularjs/common/filters/htmldecode.js b/plugins/CoreHome/angularjs/common/filters/htmldecode.js new file mode 100644 index 0000000000..c3e8107931 --- /dev/null +++ b/plugins/CoreHome/angularjs/common/filters/htmldecode.js @@ -0,0 +1,26 @@ +/*! + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ +(function () { + angular.module('piwikApp.filter').filter('htmldecode', htmldecode); + + htmldecode.$inject = ['piwik']; + + /** + * Be aware that this filter can cause XSS so only use it when you're sure it is safe. + * Eg it should be safe when it is afterwards escaped by angular sanitize again. + */ + function htmldecode(piwik) { + + return function(text) { + if (text && text.length) { + return piwik.helper.htmlDecode(text); + } + + return text; + }; + } +})(); diff --git a/plugins/CoreHome/angularjs/siteselector/siteselector.directive.html b/plugins/CoreHome/angularjs/siteselector/siteselector.directive.html index 9ee4932163..e4e46a676a 100644 --- a/plugins/CoreHome/angularjs/siteselector/siteselector.directive.html +++ b/plugins/CoreHome/angularjs/siteselector/siteselector.directive.html @@ -16,7 +16,7 @@ <a ng-click="view.showSitesList=!view.showSitesList; view.showSitesList && !model.isLoading && model.loadInitialSites();" piwik-onenter="view.showSitesList=!view.showSitesList; view.showSitesList && !model.isLoading && model.loadInitialSites();" href="javascript:void(0)" - title="{{ 'General_ChooseWebsite'|translate }}" + title="{{ 'CoreHome_ChangeCurrentWebsite'|translate:((selectedSite.name || model.firstSiteName)|htmldecode) }}" ng-class="{'loading': model.isLoading}" class="title"> <span class="icon icon-arrow-bottom" @@ -37,6 +37,7 @@ ng-hide="!showSelectedSite && activeSiteId==site.idsite"> <a piwik-ignore-click href="{{ getUrlForSiteId(site.idsite) }}" piwik-autocomplete-matched="view.searchTerm" + title="{{ site.name|htmldecode }}" ng-bind-html="site.name"></a> </li> </ul> diff --git a/plugins/CoreHome/lang/en.json b/plugins/CoreHome/lang/en.json index 69a85e55f2..f45d4811c2 100644 --- a/plugins/CoreHome/lang/en.json +++ b/plugins/CoreHome/lang/en.json @@ -52,6 +52,7 @@ "QuickAccessTitle": "Search for %s. Shortcut: Press 'f' to search.", "MenuEntries": "Menu entries", "Segments": "Segments", - "AdblockIsMaybeUsed": "In case you are using an ad blocker, please disable it for this site to make sure Piwik works without any issues." + "AdblockIsMaybeUsed": "In case you are using an ad blocker, please disable it for this site to make sure Piwik works without any issues.", + "ChangeCurrentWebsite": "Choose a website, currently selected website: %s" } } |