diff options
author | Nathan Sollenberger <nathan@spacenate.com> | 2015-07-10 04:15:06 +0300 |
---|---|---|
committer | Nathan Sollenberger <nathan@spacenate.com> | 2015-08-26 03:59:26 +0300 |
commit | 0645b8f8b2a3635dc68d4f0c719526ed42f40090 (patch) | |
tree | 7087b02e73ed2680cd550dd44b4a094ea4c6ef2b /plugins/Goals | |
parent | 3a2a00db22907f98cc48479ddbee3096e717a750 (diff) |
Only load necessary templates and javascript for non-admin users in _addEditGoal.twig
Diffstat (limited to 'plugins/Goals')
-rw-r--r-- | plugins/Goals/templates/_addEditGoal.twig | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/plugins/Goals/templates/_addEditGoal.twig b/plugins/Goals/templates/_addEditGoal.twig index dc217c9a66..79a9491afc 100644 --- a/plugins/Goals/templates/_addEditGoal.twig +++ b/plugins/Goals/templates/_addEditGoal.twig @@ -7,12 +7,14 @@ {% if onlyShowAddNewGoal is not defined %} {% include "@Goals/_listGoalEdit.twig" %} {% endif %} - {% include "@Goals/_formAddGoal.twig" %} - {% if onlyShowAddNewGoal is not defined %} - <div class='entityCancel' style='display:none;'> - {{ 'General_OrCancel'|translate("<a class='entityCancelLink'>","</a>")|raw }} - </div> + {% if userCanEditGoals %} + {% include "@Goals/_formAddGoal.twig" %} + {% if onlyShowAddNewGoal is not defined %} + <div class='entityCancel' style='display:none;'> + {{ 'General_OrCancel'|translate("<a class='entityCancelLink'>","</a>")|raw }} + </div> + {% endif %} {% endif %} <a id='bottom'></a> </div> @@ -27,33 +29,38 @@ }; 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\\\/(.*)'") }}", + <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'") }}", + <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'") }}", + <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'") }}" + <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_IsExactly'|translate("'click'") }} \ + <br />{{ 'General_ForExampleShort'|translate }} {{ 'Goals_MatchesExpression'|translate("'(.*)_banner'") }}" }; $(document).ready(function () { - bindGoalForm(); + {% if userCanEditGoals %} + bindGoalForm(); - {% if onlyShowAddNewGoal is not defined %} - piwik.goals = {{ goalsJSON|raw }}; - bindListGoalEdit(); + {% if onlyShowAddNewGoal is not defined %} + piwik.goals = {{ goalsJSON|raw }}; + bindListGoalEdit(); - {% if idGoal %} - editGoal({{ idGoal|e('js') }}); + {% if idGoal %} + editGoal({{ idGoal|e('js') }}); + {% else %} + showEditGoals(); + {% endif %} {% else %} - showEditGoals(); + initAndShowAddGoalForm(); {% endif %} {% else %} - initAndShowAddGoalForm(); + piwik.goals = {{ goalsJSON|raw }}; + showEditGoals(); {% endif %} }); |