~eventum-developers/eventum/trunk

« back to all changes in this revision

Viewing changes to templates/manage/custom_fields.tpl.html

  • Committer: Elan Ruusamäe
  • Date: 2015-04-03 17:16:08 UTC
  • Revision ID: glen@delfi.ee-20150403171608-u41tcmt49uayv0g4
discard {literal} from templates

it is rarely needed in Smarty3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
{extends "manage/manage.tpl.html"}
2
2
 
3
3
{block "manage_content"}
4
 
  {literal}
 
4
 
5
5
  <script type="text/javascript">
6
6
  <!--
7
7
  var editing_option_id = -1;
9
9
  {
10
10
      var f = $('#email_account_form');
11
11
      if (Validation.isFieldWhitespace('title')) {
12
 
          alert('{/literal}{t escape=js}Please enter the title of this custom field.{/t}{literal}');
 
12
          alert('{t escape=js}Please enter the title of this custom field.{/t}');
13
13
          Validation.selectField('title');
14
14
          return false;
15
15
      }
16
16
      if (!Validation.hasOneSelected('projects[]')) {
17
 
          alert('{/literal}{t escape=js}Please assign the appropriate projects for this custom field.{/t}{literal}');
 
17
          alert('{t escape=js}Please assign the appropriate projects for this custom field.{/t}');
18
18
          Validation.selectField('projects[]');
19
19
          return false;
20
20
      }
37
37
          }
38
38
      }
39
39
      if (removed_projects.length > 0) {
40
 
          var answer = confirm('{/literal}{t escape=js}WARNING: You have removed project(s){/t}{literal} ' + removed_projects + ' {/literal}{t}from the list{/t}{literal} ' +
41
 
             '{/literal}{t escape=js}of associated projects. This will remove all data for this field from the selected project(s).{/t}{literal} ' +
42
 
             '{/literal}{t escape=js}Do you want to continue?{/t}{literal}');
 
40
          var answer = confirm('{t escape=js}WARNING: You have removed project(s){/t} ' + removed_projects + ' {t}from the list{/t} ' +
 
41
             '{t escape=js}of associated projects. This will remove all data for this field from the selected project(s).{/t} ' +
 
42
             '{t escape=js}Do you want to continue?{/t}');
43
43
          if (answer == false) {
44
44
              return false;
45
45
          }
55
55
      var val_field = $('input[name=new_value]');
56
56
      var value = val_field.val();
57
57
      if (Validation.isWhitespace(value)) {
58
 
          alert('{/literal}{t escape=js}Please enter the new value for the combo box.{/t}{literal}');
 
58
          alert('{t escape=js}Please enter the new value for the combo box.{/t}');
59
59
          val_field.val('');
60
60
          val_field.focus();
61
61
          return false;
70
70
      // check for an existing option with the same value
71
71
      for (var i = 0; i < field.options.length; i++) {
72
72
          if (field.options[i].text == value) {
73
 
              alert('{/literal}{t escape=js}The specified value already exists in the list of options.{/t}{literal}');
 
73
              alert('{t escape=js}The specified value already exists in the list of options.{/t}');
74
74
              val_field.focus();
75
75
              return false;
76
76
          }
91
91
  {
92
92
      var new_value = Eventum.getField('new_value').val();
93
93
      if (Validation.isWhitespace(new_value)) {
94
 
          alert('{/literal}{t escape=js}Please enter the updated value.{/t}{literal}');
 
94
          alert('{t escape=js}Please enter the updated value.{/t}');
95
95
          return false;
96
96
      }
97
97
      var option = Eventum.getField('field_options[]').children('option').filter("[value='" + editing_option_id + "']'");
105
105
  {
106
106
      var options = Eventum.getField('field_options[]').children(':selected');
107
107
      if (options.length == 0) {
108
 
          alert('{/literal}{t escape=js}Please select an option from the list.{/t}{literal}');
 
108
          alert('{t escape=js}Please select an option from the list.{/t}');
109
109
          return false;
110
110
      }
111
111
      editing_option_id = options[0].value;
115
115
  function removeFieldOption(e)
116
116
  {
117
117
      if (!Validation.hasOneSelected('field_options[]')) {
118
 
          alert('{/literal}{t escape=js}Please select an option from the list.{/t}{literal}');
 
118
          alert('{t escape=js}Please select an option from the list.{/t}');
119
119
          return false;
120
120
      }
121
121
      Eventum.getField('field_options[]').find('option:selected').remove();
122
122
      var field = Eventum.getField('field_options[]')[0];
123
123
      if (field.options.length == 0) {
124
 
          field.options[0] = new Option('{/literal}{t escape=js}enter a new option above{/t}{literal}', '-1');
 
124
          field.options[0] = new Option('{t escape=js}enter a new option above{/t}', '-1');
125
125
      }
126
126
  }
127
127
  function toggleCustomOptionsField()
148
148
  function checkDelete()
149
149
  {
150
150
      if (!Validation.hasOneChecked('items[]')) {
151
 
          alert('{/literal}{t escape=js}Please select at least one of the custom fields.{/t}{literal}');
 
151
          alert('{t escape=js}Please select at least one of the custom fields.{/t}');
152
152
          return false;
153
153
      }
154
 
      if (!confirm('{/literal}{t escape=js}This action will permanently remove the selected custom fields.{/t}{literal}')) {
 
154
      if (!confirm('{t escape=js}This action will permanently remove the selected custom fields.{/t}')) {
155
155
          return false;
156
156
      } else {
157
157
          return true;
174
174
      $('input[name=remove_button]').click(removeFieldOption);
175
175
      $('input[name=update_button]').click(updateFieldOption);
176
176
  });
177
 
  {/literal}
 
177
 
178
178
  var selected_projects = [];
179
179
  {if $info.project|default:'' != '' && $info.project|@count > 0}
180
180
  {foreach from=$info.projects item=prj_id}