Skip to content
Extraits de code Groupes Projets
Valider 40d4e1e5 rédigé par Thomas Steur's avatar Thomas Steur
Parcourir les fichiers

refs #6022 added option to edit goal on goal page.

Added new attribute edit-url to enriched headline. Setting this will
make the headline clickable, on hover appears a title and pointer to
indicate that it is clickable and to explain what happens when clicking
on it. I think this is more intuitive than showing an edit icon on hover
which would be an alternative. As it is done in enriched headline we
could otherwise change the behaviour easily.

Also fixed feature name for goals no longer contains the actual goal
name.
parent 9ed81d72
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de avec 49 ajouts et 9 suppressions
...@@ -182,6 +182,7 @@ class CoreHome extends \Piwik\Plugin ...@@ -182,6 +182,7 @@ class CoreHome extends \Piwik\Plugin
$translationKeys[] = 'CoreHome_FlattenDataTable'; $translationKeys[] = 'CoreHome_FlattenDataTable';
$translationKeys[] = 'CoreHome_UnFlattenDataTable'; $translationKeys[] = 'CoreHome_UnFlattenDataTable';
$translationKeys[] = 'CoreHome_ExternalHelp'; $translationKeys[] = 'CoreHome_ExternalHelp';
$translationKeys[] = 'CoreHome_ClickToEditX';
$translationKeys[] = 'SitesManager_NotFound'; $translationKeys[] = 'SitesManager_NotFound';
$translationKeys[] = 'Annotations_ViewAndAddAnnotations'; $translationKeys[] = 'Annotations_ViewAndAddAnnotations';
$translationKeys[] = 'General_RowEvolutionRowActionTooltipTitle'; $translationKeys[] = 'General_RowEvolutionRowActionTooltipTitle';
......
<div class="enrichedHeadline" <div class="enrichedHeadline"
ng-mouseenter="view.showIcons=true" ng-mouseleave="view.showIcons=false"> ng-mouseenter="view.showIcons=true" ng-mouseleave="view.showIcons=false">
<span ng-transclude></span> <span ng-show="!editUrl" class="title" ng-transclude></span>
<a ng-show="editUrl" class="title" href="{{ editUrl }}"
title="{{ 'CoreHome_ClickToEditX'|translate:featureName }}"
ng-transclude></a>
<span ng-show="view.showIcons"> <span ng-show="view.showIcons">
<a ng-if="helpUrl && !inlineHelp" <a ng-if="helpUrl && !inlineHelp"
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
* <h2 piwik-enriched-headline help-url="http://piwik.org/guide">All Websites Dashboard</h2> * <h2 piwik-enriched-headline help-url="http://piwik.org/guide">All Websites Dashboard</h2>
* -> shows help icon and links to external url * -> shows help icon and links to external url
* *
* <h2 piwik-enriched-headline edit-url="index.php?module=Foo&action=bar&id=4">All Websites Dashboard</h2>
* -> makes the headline clickable linking to the specified url
*
* <h2 piwik-enriched-headline>All Websites Dashboard * <h2 piwik-enriched-headline>All Websites Dashboard
* <div class="inlineHelp">My <strong>inline help</strong></div> * <div class="inlineHelp">My <strong>inline help</strong></div>
* </h2> * </h2>
...@@ -29,7 +32,8 @@ ...@@ -29,7 +32,8 @@
function piwikEnrichedHeadline($document, piwik, $filter){ function piwikEnrichedHeadline($document, piwik, $filter){
var defaults = { var defaults = {
helpUrl: '' helpUrl: '',
editUrl: ''
}; };
return { return {
...@@ -37,6 +41,7 @@ ...@@ -37,6 +41,7 @@
restrict: 'A', restrict: 'A',
scope: { scope: {
helpUrl: '@', helpUrl: '@',
editUrl: '@',
featureName: '@' featureName: '@'
}, },
templateUrl: 'plugins/CoreHome/angularjs/enrichedheadline/enrichedheadline.directive.html?cb=' + piwik.cacheBuster, templateUrl: 'plugins/CoreHome/angularjs/enrichedheadline/enrichedheadline.directive.html?cb=' + piwik.cacheBuster,
...@@ -63,7 +68,7 @@ ...@@ -63,7 +68,7 @@
} }
if (!attrs.featureName) { if (!attrs.featureName) {
attrs.featureName = $.trim(element.text()); attrs.featureName = $.trim(element.find('.title').first().text());
} }
}; };
} }
......
...@@ -5,6 +5,14 @@ ...@@ -5,6 +5,14 @@
.enrichedHeadline { .enrichedHeadline {
min-height: 22px; min-height: 22px;
a.title {
cursor: pointer;
}
.title {
color: @color-black-piwik;
}
.inlineHelp { .inlineHelp {
display:block; display:block;
background: #F7F7F7; background: #F7F7F7;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
"CategoryNoData": "No data in this category. Try to \"Include all population\".", "CategoryNoData": "No data in this category. Try to \"Include all population\".",
"CheckForUpdates": "Check for updates", "CheckForUpdates": "Check for updates",
"CheckPiwikOut": "Check Piwik out!", "CheckPiwikOut": "Check Piwik out!",
"ClickToEditX": "Click to edit %s",
"CloseWidgetDirections": "You can close this widget by clicking on the 'X' icon at the top of the widget.", "CloseWidgetDirections": "You can close this widget by clicking on the 'X' icon at the top of the widget.",
"DataForThisReportHasBeenPurged": "The data for this report is more than %s months old and has been purged.", "DataForThisReportHasBeenPurged": "The data for this report is more than %s months old and has been purged.",
"DataTableExcludeAggregateRows": "Aggregate rows are shown %s Hide them", "DataTableExcludeAggregateRows": "Aggregate rows are shown %s Hide them",
......
...@@ -163,6 +163,12 @@ class Controller extends \Piwik\Plugin\Controller ...@@ -163,6 +163,12 @@ class Controller extends \Piwik\Plugin\Controller
$goals = $this->goals; $goals = $this->goals;
$view->goals = $goals; $view->goals = $goals;
$idGoal = Common::getRequestVar('idGoal', 0, 'int');
$view->idGoal = 0;
if ($idGoal && array_key_exists($idGoal, $goals)) {
$view->idGoal = $idGoal;
}
// unsanitize goal names and other text data (not done in API so as not to break // unsanitize goal names and other text data (not done in API so as not to break
// any other code/cause security issues) // any other code/cause security issues)
......
...@@ -189,12 +189,17 @@ function ajaxAddGoal() { ...@@ -189,12 +189,17 @@ function ajaxAddGoal() {
ajaxRequest.send(true); ajaxRequest.send(true);
} }
function editGoal(goalId)
{
var goal = piwik.goals[goalId];
initGoalForm("Goals.updateGoal", _pk_translate('Goals_UpdateGoal'), goal.name, goal.match_attribute, goal.pattern, goal.pattern_type, (goal.case_sensitive != '0'), goal.revenue, goal.allow_multiple, goalId);
showAddNewGoal();
}
function bindListGoalEdit() { function bindListGoalEdit() {
$('a[name=linkEditGoal]').click(function () { $('a[name=linkEditGoal]').click(function () {
var goalId = $(this).attr('id'); var goalId = $(this).attr('id');
var goal = piwik.goals[goalId]; editGoal(goalId);
initGoalForm("Goals.updateGoal", _pk_translate('Goals_UpdateGoal'), goal.name, goal.match_attribute, goal.pattern, goal.pattern_type, (goal.case_sensitive != '0'), goal.revenue, goal.allow_multiple, goalId);
showAddNewGoal();
return false; return false;
}); });
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
"ConversionsOverviewBy": "Conversions overview by type of visit", "ConversionsOverviewBy": "Conversions overview by type of visit",
"CreateNewGOal": "Create a new Goal", "CreateNewGOal": "Create a new Goal",
"DaysToConv": "Days to Conversion", "DaysToConv": "Days to Conversion",
"Details": "Goal details",
"DefaultGoalConvertedOncePerVisit": "(default) Goal can only be converted once per visit", "DefaultGoalConvertedOncePerVisit": "(default) Goal can only be converted once per visit",
"DefaultRevenue": "Goal default revenue is", "DefaultRevenue": "Goal default revenue is",
"DefaultRevenueHelp": "For example, a Contact Form submitted by a visitor may be worth $10 on average. Piwik will help you understand how well your visitors segments are performing.", "DefaultRevenueHelp": "For example, a Contact Form submitted by a visitor may be worth $10 on average. Piwik will help you understand how well your visitors segments are performing.",
......
...@@ -45,9 +45,15 @@ ...@@ -45,9 +45,15 @@
{% if onlyShowAddNewGoal is not defined %} {% if onlyShowAddNewGoal is not defined %}
piwik.goals = {{ goalsJSON|raw }}; piwik.goals = {{ goalsJSON|raw }};
bindListGoalEdit(); bindListGoalEdit();
showEditGoals();
{% if idGoal %}
editGoal({{ idGoal|e('js') }});
{% else %}
showEditGoals();
{% endif %}
{% else %} {% else %}
initAndShowAddGoalForm(); initAndShowAddGoalForm();
{% endif %} {% endif %}
</script> </script>
<span data-graph-id="{{ nameGraphEvolution }}"></span> <span data-graph-id="{{ nameGraphEvolution }}"></span>
{% if displayFullReport or headline is defined %} {% if displayFullReport or headline is defined %}
<h2 piwik-enriched-headline>{% if headline is defined %}{{ headline }}{% elseif goalName is defined %}{{ 'Goals_GoalX'|translate(goalName)|raw }}{% else %}{{ 'General_EvolutionOverPeriod'|translate }}{% endif %}</h2> <h2 piwik-enriched-headline
{% if idGoal is defined and idGoal and goalName is defined and not ecommerce is defined %}
edit-url="{{ linkTo({'module': 'Goals', 'action': 'manage', 'idGoal': idGoal})|e('html_attr') }}"
feature-name="{{ 'Goals_Details'|translate|e('html_attr') }}"
{% endif %}
>{% if headline is defined %}{{ headline }}{% elseif goalName is defined %}{{ 'Goals_GoalX'|translate(goalName)|raw }}{% else %}{{ 'General_EvolutionOverPeriod'|translate }}{% endif %}</h2>
{% endif %} {% endif %}
{{ graphEvolution|raw }} {{ graphEvolution|raw }}
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
piwik-enriched-headline piwik-enriched-headline
help-url="http://piwik.org/docs/manage-websites/" help-url="http://piwik.org/docs/manage-websites/"
feature-name="{{ 'SitesManager_WebsitesManagement'|translate }}"> feature-name="{{ 'SitesManager_WebsitesManagement'|translate }}">
{{ 'SitesManager_WebsitesManagement'|translate }} {{ 'SitesManager_WebsitesManagement'|translate }}
</h2> </h2>
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter