diff options
Diffstat (limited to 'plugins/MobileMessaging/templates/macros.twig')
-rw-r--r-- | plugins/MobileMessaging/templates/macros.twig | 90 |
1 files changed, 68 insertions, 22 deletions
diff --git a/plugins/MobileMessaging/templates/macros.twig b/plugins/MobileMessaging/templates/macros.twig index e0c1d499c6..9cb4c93e6d 100644 --- a/plugins/MobileMessaging/templates/macros.twig +++ b/plugins/MobileMessaging/templates/macros.twig @@ -1,33 +1,79 @@ -{% macro manageSmsApi(credentialSupplied, creditLeft, smsProviders, provider) %} +{% macro manageSmsApi(credentialSupplied, creditLeft, smsProviderOptions, smsProviders, provider) %} +<div ng-controller="ManageSmsProviderController as manageProvider"> + + <div piwik-activity-indicator loading="manageProvider.isDeletingAccount"></div> + <div id="ajaxErrorManageSmsProviderSettings"></div> + {% if credentialSupplied %} - {{ 'MobileMessaging_Settings_CredentialProvided'|translate(provider) }} - {{ creditLeft }} - <br/> - {{ 'MobileMessaging_Settings_UpdateOrDeleteAccount'|translate("<a id='displayAccountForm'>","</a>","<a id='deleteAccount'>","</a>")|raw }} + <p> + {{ 'MobileMessaging_Settings_CredentialProvided'|translate(provider) }} + {{ creditLeft }} + <br/> + {{ 'MobileMessaging_Settings_UpdateOrDeleteAccount'|translate('<a ng-click="manageProvider.showUpdateAccount()" id="displayAccountForm">',"</a>",'<a ng-click="manageProvider.deleteAccount()" id="deleteAccount">',"</a>")|raw }} + </p> {% else %} - {{ 'MobileMessaging_Settings_PleaseSignUp'|translate }} + <p>{{ 'MobileMessaging_Settings_PleaseSignUp'|translate }}</p> {% endif %} - <div id='accountForm' {% if credentialSupplied %}style='display: none;'{% endif %}> - <br/> - {{ 'MobileMessaging_Settings_SMSProvider'|translate }} - <select id='smsProviders'> - {% for smsProvider, description in smsProviders %} - <option value='{{ smsProvider }}'> - {{ smsProvider }} - </option> - {% endfor %} - </select> - - {{ 'MobileMessaging_Settings_APIKey'|translate }} - <input size='25' id='apiKey'/> - - <input type='submit' value='{{ 'General_Save'|translate }}' id='apiAccountSubmit' class='submit'/> + + <div piwik-form id='accountForm' {% if credentialSupplied %}ng-show="manageProvider.showAccountForm"{% endif %}> + + <div piwik-field uicontrol="select" name="smsProviders" + options="{{ smsProviderOptions|json_encode }}" + ng-model="manageProvider.smsProvider" + ng-change="manageProvider.isUpdateAccountPossible()" + title="{{ 'MobileMessaging_Settings_SMSProvider'|translate|e('html_attr') }}" + value="{{ provider }}"> + </div> + + <div piwik-field uicontrol="text" name="apiKey" + ng-model="manageProvider.apiKey" + required="true" + ng-change="manageProvider.isUpdateAccountPossible()" + title="{{ 'MobileMessaging_Settings_APIKey'|translate|e('html_attr') }}" + value=""> + </div> + + <div piwik-save-button id='apiAccountSubmit' + disabled="!manageProvider.canBeUpdated" + saving="manageProvider.isUpdatingAccount" + onconfirm="manageProvider.updateAccount()"></div> {% for smsProvider, description in smsProviders %} - <div class='providerDescription' id='{{ smsProvider }}'> + <div class='providerDescription' + ng-show="manageProvider.smsProvider == '{{ smsProvider|e('js') }}'" + id='{{ smsProvider }}'> {{ description|raw }} </div> {% endfor %} </div> +</div> +{% endmacro %} + +{% macro selectPhoneNumbers(phoneNumbers, angularContext, value, withIntroduction) %} + <div id="mobilePhoneNumbersHelp" class="inline-help-node"> + <span class="icon-info"></span> + + {% if phoneNumbers|length == 0 %} + {{ 'MobileMessaging_MobileReport_NoPhoneNumbers'|translate }} + {% else %} + {{ 'MobileMessaging_MobileReport_AdditionalPhoneNumbers'|translate|e('html_attr') }} + {% endif %} + <a href="{{ linkTo({'module':"MobileMessaging", 'action': 'index', 'updated':null}) }}">{{ 'MobileMessaging_MobileReport_MobileMessagingSettingsLink'|translate }}</a> + </div> + + <div class='mobile' + piwik-field uicontrol="checkbox" + var-type="array" + name="phoneNumbers" + ng-model="{{ angularContext }}.report.phoneNumbers" + {% if withIntroduction %} + introduction="{{ 'ScheduledReports_SendReportTo'|translate|e('html_attr') }}" + {% endif %} + title="{{ 'MobileMessaging_PhoneNumbers'|translate|e('html_attr') }}" + {% if phoneNumbers|length == 0 %}disabled="true"{% endif %} + options="{{ phoneNumbers|json_encode }}" + inline-help="#mobilePhoneNumbersHelp" + {% if value %}value="{{ value|json_encode }}"{% endif %}> + </div> {% endmacro %}
\ No newline at end of file |