-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattribute-edit.html
333 lines (256 loc) · 15.3 KB
/
attribute-edit.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
{extends file="admin-layout.tpl"}
{block name="no-return-functions"}
{$admin_current_location = 'configuration'}
{/block}
{block name="page-title"}{intl l='Edit an attribute'}{/block}
{block name="check-resource"}admin.configuration.attribute{/block}
{block name="check-access"}update{/block}
{block name="main-content"}
<div class="attributes edit-attribute">
<div id="wrapper" class="container">
{loop name="attribute_edit" type="attribute" id=$attribute_id backend_context="1" lang=$edit_language_id}
<ul class="breadcrumb">
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
<li><a href="{url path='/admin/configuration/attributes'}">{intl l="Attributes"}</a></li>
<li>{intl l='Editing attribute "%name"' name={$TITLE}}</li>
</ul>
{hook name="attribute-edit.top" attribute_id=$attribute_id}
<div class="row">
<div class="col-md-12 general-block-decorator">
<div class="row">
<div class="col-md-12 title title-without-tabs">
{intl l='Edit attribute "%name"' name={$TITLE}}
</div>
<div class="col-md-12">
<div class="form-container">
{form name="thelia.admin.attribute.modification"}
<form method="POST" action="{url path='/admin/configuration/attributes/save'}" {form_enctype} class="clearfix">
{include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/configuration/attributes'}"}
<div class="col-md-6">
<p class="title title-without-tabs">{intl l='Attribute information'}</p>
{form_field field='id'}
<input type="hidden" name="{$name}" value="{$attribute_id}" />
{/form_field}
{* Be sure to get the attribute ID, even if the form could not be validated *}
<input type="hidden" name="attribute_id" value="{$attribute_id}" />
{form_hidden_fields}
{form_field field='success_url'}
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/attributes'}" />
{/form_field}
{form_field field='locale'}
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
{/form_field}
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
{include file="includes/standard-description-form-fields.html"}
</div>
<div class="col-md-6">
<p class="title title-without-tabs clearfix">
{intl l='Attribute values'}
{loop type="auth" name="can_create" role="ADMIN" resource="admin.configuration.attribute" access="UPDATE"}
<span class="pull-right">
<a data-toggle="modal" href="#creation_dialog" title="Add a new attribute value" class="btn btn-primary">
<span class="glyphicon glyphicon-plus-sign"></span>
</a>
</span>
{/loop}
</p>
<div class="alert alert-info">
{intl l="Enter here all possible attribute values."}
</div>
<div class="table-responsive">
<table class="table table-striped table-condensed table-left-aligned">
<thead>
<tr>
<th>
{admin_sortable_header
current_order=$attributeav_order
order='id'
reverse_order='id_reverse'
request_parameter_name='attributeav_order'
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
label="{intl l='ID'}"
}
</th>
<th>
{admin_sortable_header
current_order=$attributeav_order
order='alpha'
reverse_order='alpha_reverse'
request_parameter_name='attributeav_order'
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
label="{intl l='Value'}"
}
</th>
<th class="text-center">
{admin_sortable_header
current_order=$attributeav_order
order='manual'
reverse_order='manual_reverse'
request_parameter_name='attributeav_order'
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
label="{intl l="Position"}"
}
</th>
{hook name="attributes-value.table-header" location="attributes_value_table_header" attribute_id=$attribute_id}
<th class="actions">{intl l="Actions"}</th>
</tr>
</thead>
<tbody>
{loop name="list" type="attribute_availability" attribute=$attribute_id backend_context="1" lang=$edit_language_id order=$attributeav_order}
<tr>
<td>{$ID}</td>
<td>
{* FIXME : integrate this in the encolsing form to provide standard form processing *}
<input class="js-edit form-control" type="text" name="attribute_values[{$ID}]" value="{$TITLE}" />
</td>
<td class="text-center">
{admin_position_block
resource="admin.configuration.attribute"
access="UPDATE"
path={url path='/admin/configuration/attributes-av/update-position' attribute_id=$attribute_id}
url_parameter="attributeav_id"
in_place_edit_class="positionChange"
position="$POSITION"
id="$ID"
}
</td>
{hook name="attributes-value.table-row" location="attributes_value_table_row" attribute_id=$attribute_id}
<td class="actions">
{loop type="auth" name="can_create" role="ADMIN" resource="admin.configuration.attribute" access="UPDATE"}
<a class="btn btn-default btn-xs value-delete" title="{intl l='Delete this value'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal">
<span class="glyphicon glyphicon-trash"></span>
</a>
{/loop}
</td>
</tr>
{/loop}
{elseloop rel="list"}
<tr>
<td colspan="4">
<div class="alert alert-info">
{intl l="No value has been created yet. Click the + button to create one."}
</div>
</td>
</tr>
{/elseloop}
</tbody>
</table>
</div>
</div>
</form>
{/form}
</div>
</div>
</div>
</div>
</div>
{hook name="attribute-edit.bottom" attribute_id=$attribute_id}
{/loop}
{elseloop rel="attribute_edit"}
<div class="row">
<div class="col-md-12">
<div class="alert alert-error">
{intl l="Sorry, attribute ID=%id was not found." id={$attribute_id}}
</div>
</div>
</div>
{/elseloop}
</div>
</div>
{* Adding a new attribute *}
{form name="thelia.admin.attributeav.creation"}
{* Capture the dialog body, to pass it to the generic dialog *}
{capture "creation_dialog"}
{form_hidden_fields}
{* Be sure to get the attribute ID, even if the form could not be validated *}
<input type="hidden" name="attribute_id" value="{$attribute_id}" />
{form_field field='success_url'}
{* on success, redirect to this page *}
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}" />
{/form_field}
{form_field field='attribute_id'}
<input type="hidden" name="{$name}" value="{$attribute_id}" />
{/form_field}
{form_field field='title'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
{loop type="lang" name="current-edit-lang" id="$edit_language_id"}
<div class="input-group">
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Attribute title'}" placeholder="{intl l='Title'}">
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.png"}" alt="{intl l={$TITLE}}" /></span>
</div>
<div class="help-block">{intl l="Enter here the value in the current edit language (%title)" title={$TITLE}}</div>
{form_field field='locale'}
<input type="hidden" name="{$name}" value="{$LOCALE}" />
{/form_field}
{/loop}
</div>
{/form_field}
{hook name="attribute-value.create-form" location="attribute_value_create_form" }
{/capture}
{include
file = "includes/generic-create-dialog.html"
dialog_id = "creation_dialog"
dialog_title = {intl l="Create a new attribute value"}
dialog_body = {$smarty.capture.creation_dialog nofilter}
dialog_ok_label = {intl l="Create this value"}
form_action = {url path='/admin/configuration/attributes-av/create'}
form_enctype = {form_enctype}
form_error_message = $form_error_message
}
{/form}
{* Delete value confirmation dialog *}
{capture "delete_dialog"}
<input type="hidden" name="attribute_id" value="{$attribute_id}" />
<input type="hidden" name="attributeav_id" id="value_delete_id" value="" />
{hook name="attribute.id-delete-form" location="attribute_id_delete_form" attribute_id=$attribute_id}
{/capture}
{include
file = "includes/generic-confirm-dialog.html"
dialog_id = "delete_dialog"
dialog_title = {intl l="Delete attribute value"}
dialog_message = {intl l="Do you really want to delete this attribute value ?"}
form_action = {token_url path='/admin/configuration/attributes-av/delete'}
form_content = {$smarty.capture.delete_dialog nofilter}
}
{/block}
{block name="javascript-initialization"}
{javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'}
<script src="{$asset_url}"></script>
{/javascripts}
<script>
$(function() {
// Set proper attribute ID in delete from
$('a.value-delete').click(function(ev) {
$('#value_delete_id').val($(this).data('id'));
});
// JS stuff for creation form
{include
file = "includes/generic-js-dialog.html"
dialog_id = "creation_dialog"
form_name = "thelia.admin.attributeav.creation"
}
{* Inline editing of object position using bootstrap-editable *}
$('.positionChange').editable({
type : 'text',
title : '{intl l="Enter new value position"}',
mode : 'popup',
inputclass : 'input-mini',
placement : 'left',
success : function(response, newValue) {
// The URL template
var url = "{url noamp='1' path='/admin/configuration/attributes-av/update-position' attributeav_id='__ID__' position='__POS__' attribute_id=$attribute_id}";
// Perform subtitutions
url = url.replace('__ID__', $(this).data('id')).replace('__POS__', newValue);
// Reload the page
location.href = url;
}
});
});
</script>
{/block}
{block name="javascript-last-call"}
{hook name="attribute.edit-js" location="attribute-edit-js" attribute_id=$attribute_id}
{hook name="wysiwyg.js" location="wysiwyg-attribute-edit-js" }
{/block}