diff options
author | Nathan Sollenberger <nsollenberger@gmail.com> | 2015-07-05 00:26:17 +0300 |
---|---|---|
committer | Nathan Sollenberger <nathan@spacenate.com> | 2015-08-26 03:55:46 +0300 |
commit | e0d495c0c674d7783856328ded8914893a69b3f2 (patch) | |
tree | 11e6afaacf54604207c9e109d423cd009d4952c6 /plugins/Goals | |
parent | dbfcfd47b86d7972b3f88636571fc7050054fb13 (diff) |
ManageGoals text edits, also added non-editable goal table for non-admins
Diffstat (limited to 'plugins/Goals')
-rw-r--r-- | plugins/Goals/lang/en.json | 7 | ||||
-rw-r--r-- | plugins/Goals/templates/_listGoalView.twig | 57 | ||||
-rw-r--r-- | plugins/Goals/templates/_viewGoal.twig | 53 | ||||
-rw-r--r-- | plugins/Goals/templates/addNewGoal.twig | 1 | ||||
-rw-r--r-- | plugins/Goals/templates/editGoals.twig | 11 |
5 files changed, 120 insertions, 9 deletions
diff --git a/plugins/Goals/lang/en.json b/plugins/Goals/lang/en.json index fa8e20ae07..76ccc9677b 100644 --- a/plugins/Goals/lang/en.json +++ b/plugins/Goals/lang/en.json @@ -76,8 +76,9 @@ "MatchesExpression": "matches the expression %s", "NewGoalIntro": "Goal Conversion tracking is one of the most efficient ways to measure and improve your business objectives.", "NewVisitorsConversionRateIs": "New visitors conversion rate is %s", - "NoGoalsNeedAccess": "Only an Administrator or a user with Super User access can add Goals for a given website. Please ask your Piwik administrator to set up a Goal for your website. <br>Tracking Goals is a great way to help understand and maximize your website performance!", - "Optional": "(optional)", + "NoGoalsNeedAccess": "Only an Administrator or a user with Super User access can manage Goals for a given website. Please ask your Piwik administrator to set up a Goal for your website. <br>Tracking Goals is a great way to help understand and maximize your website performance!", + "NeedAccess": "Only an Administrator or a user with Super User access can manage Goals for a given website.", + "Optional": "(optional)", "OverallConversionRate": "%s overall conversion rate (visits with a completed goal)", "OverallRevenue": "%s overall revenue", "PageTitle": "Page Title", @@ -103,4 +104,4 @@ "WhereVisitedPageManuallyCallsJavascriptTrackerLearnMore": "where the visited page contains a call to the JavaScript 'trackGoal' method (%slearn more%s)", "YouCanEnableEcommerceReports": "You can enable %s for this website in the %s page." } -}
\ No newline at end of file +} diff --git a/plugins/Goals/templates/_listGoalView.twig b/plugins/Goals/templates/_listGoalView.twig new file mode 100644 index 0000000000..f8ef672877 --- /dev/null +++ b/plugins/Goals/templates/_listGoalView.twig @@ -0,0 +1,57 @@ +<div id='entityEditContainer' class="managegoals" style="display:none;"> + <table class="dataTable entityTable"> + <thead> + <tr> + <th class="first">Id</th> + <th>{{ 'Goals_GoalName'|translate }}</th> + <th>{{ 'Goals_GoalIsTriggeredWhen'|translate }}</th> + <th>{{ 'General_ColumnRevenue'|translate }}</th> + </tr> + </thead> + {% if goals is empty %} + <tr> + <td colspan='7'> + <br/> + {{ 'Goals_ThereIsNoGoalToManage'|translate(siteName)|raw }}. + <br/><br/> + </td> + </tr> + {% else %} + {% for goal in goals %} + <tr> + <td class="first">{{ goal.idgoal }}</td> + <td>{{ goal.name|raw }}</td>{# NOTE: goal names are escaped in the DB #} + <td><span class='matchAttribute'>{{ goal.match_attribute }}</span> + {% if goal.pattern_type is defined %} + <br/> + {{ 'Goals_Pattern'|translate }} {{ goal.pattern_type }}: {{ goal.pattern|raw }} + {% endif %} + </td> + <td>{% if goal.revenue==0 %}-{% else %}{{ goal.revenue|money(idSite)|raw }}{% endif %}</td> + </tr> + {% endfor %} + {% endif %} + </table> +</div> + +<script type="text/javascript"> + var goalTypeToTranslation = { + "manually": "{{ 'Goals_ManuallyTriggeredUsingJavascriptFunction'|translate }}", + "file": "{{ 'Goals_Download'|translate }}", + "url": "{{ 'Goals_VisitUrl'|translate }}", + "title": "{{ 'Goals_VisitPageTitle'|translate }}", + "external_website": "{{ 'Goals_ClickOutlink'|translate }}", + "event_action": "{{ 'Goals_SendEvent'|translate }} ({{ 'Events_EventAction'|translate }})", + "event_category": "{{ 'Goals_SendEvent'|translate }} ({{ 'Events_EventCategory'|translate }})", + "event_name": "{{ 'Goals_SendEvent'|translate }} ({{ 'Events_EventName'|translate }})" + }; + + $(document).ready(function () { + // translation of the goal "match attribute" to human readable description + $('.matchAttribute').each(function () { + var matchAttribute = $(this).text(); + var translation = goalTypeToTranslation[matchAttribute]; + $(this).text(translation); + }); + }); +</script> diff --git a/plugins/Goals/templates/_viewGoal.twig b/plugins/Goals/templates/_viewGoal.twig new file mode 100644 index 0000000000..40c7323b95 --- /dev/null +++ b/plugins/Goals/templates/_viewGoal.twig @@ -0,0 +1,53 @@ + +{% import 'ajaxMacros.twig' as ajax %} +{{ ajax.errorDiv() }} +{{ ajax.loadingDiv('goalAjaxLoading') }} + +<div class="entityContainer"> + {% if onlyShowAddNewGoal is not defined %} + {% include "@Goals/_listGoalView.twig" %} + {% endif %} + <a id='bottom'></a> +</div> + +<script type="text/javascript"> + var mappingMatchTypeName = { + "url": "{{ 'Goals_URL'|translate }}", + "title": "{{ 'Goals_PageTitle'|translate }}", + "file": "{{ 'Goals_Filename'|translate }}", + "external_website": "{{ 'Goals_ExternalWebsiteUrl'|translate }}", + "event": "{{ 'Events_Event'|translate }}" + }; + var mappingMatchTypeExamples = { + "url": "{{ 'General_ForExampleShort'|translate }} {{ 'Goals_Contains'|translate("'checkout/confirmation'") }} \ + <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_IsExactly'|translate("'http://example.com/thank-you.html'") }} \ + <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_MatchesExpression'|translate("'(.*)\\\/demo\\\/(.*)'") }}", + "title": "{{ 'General_ForExampleShort'|translate }} {{ 'Goals_Contains'|translate("'Order confirmation'") }}", + "file": "{{ 'General_ForExampleShort'|translate }} {{ 'Goals_Contains'|translate("'files/brochure.pdf'") }} \ + <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_IsExactly'|translate("'http://example.com/files/brochure.pdf'") }} \ + <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_MatchesExpression'|translate("'(.*)\\\.zip'") }}", + "external_website": "{{ 'General_ForExampleShort'|translate }} {{ 'Goals_Contains'|translate("'amazon.com'") }} \ + <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_IsExactly'|translate("'http://mypartner.com/landing.html'") }} \ + <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_MatchesExpression'|translate("'http://www.amazon.com\\\/(.*)\\\/yourAffiliateId'") }}", + "event": "{{ 'General_ForExampleShort'|translate }} {{ 'Goals_Contains'|translate("'video'") }} \ + <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_IsExactly'|translate("'click'") }} \ + <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_MatchesExpression'|translate("'(.*)_banner'") }}" + }; + $(document).ready(function () { + bindGoalForm(); + + {% if onlyShowAddNewGoal is not defined %} + piwik.goals = {{ goalsJSON|raw }}; + bindListGoalEdit(); + + {% if idGoal %} + editGoal({{ idGoal|e('js') }}); + {% else %} + showEditGoals(); + {% endif %} + {% else %} + initAndShowAddGoalForm(); + {% endif %} + }); + +</script> diff --git a/plugins/Goals/templates/addNewGoal.twig b/plugins/Goals/templates/addNewGoal.twig index 3bb52e543a..a2b44b88e9 100644 --- a/plugins/Goals/templates/addNewGoal.twig +++ b/plugins/Goals/templates/addNewGoal.twig @@ -17,4 +17,5 @@ <p> {{ 'Goals_LearnMoreAboutGoalTrackingDocumentation'|translate("<a href='?module=Proxy&action=redirect&url=http://piwik.org/docs/tracking-goals-web-analytics/' target='_blank'>","</a>")|raw }} </p> + {% endif %} diff --git a/plugins/Goals/templates/editGoals.twig b/plugins/Goals/templates/editGoals.twig index a88f1e38a1..63943ca432 100644 --- a/plugins/Goals/templates/editGoals.twig +++ b/plugins/Goals/templates/editGoals.twig @@ -6,12 +6,11 @@ {% else %} - <h2>{{ 'Goals_AddNewGoal'|translate }}</h2> + <h2>{{ 'Goals_ManageGoals'|translate }}</h2> <p> - {{ 'Goals_NoGoalsNeedAccess'|translate|raw }} - </p> - <p> - {{ 'Goals_LearnMoreAboutGoalTrackingDocumentation'|translate("<a href='?module=Proxy&action=redirect&url=http://piwik.org/docs/tracking-goals-web-analytics/' target='_blank'>","</a>")|raw }} + {{ 'Goals_NeedAccess'|translate|raw }} </p> -{% endif %}
\ No newline at end of file + {% include "@Goals/_viewGoal.twig" %} + +{% endif %} |