This commit is contained in:
mespeche
2013-09-16 12:56:47 +02:00
46 changed files with 1423 additions and 373 deletions

View File

@@ -1,15 +1,102 @@
<div class="form-group">
{ifloop rel="free_attributes"}
<select name="free_attributes" id="free_attributes" class="form-control">
<option value="">Select an attribute...</option>
{loop name="free_attributes" type="attribute" template="$template_id" backend_context="1" lang="$edit_language_id"}
<option value="{$ID}">{$TITLE}</option>
{/loop}
</select>
<span class="help-block">{intl l='Select an attribute and click (+) to add it to this template'}</span>
<form action="{url path='/admin/configuration/templates/attributes/add'}">
<input type="hidden" name="template_id" value="{$template_id}" />
<div class="input-group">
<select required="required" name="attribute_id" id="attribute_id" class="form-control">
<option value="">Select an attribute...</option>
{loop name="free_attributes" type="attribute" exclude_template="$template_id" backend_context="1" lang="$edit_language_id"}
<option value="{$ID}">{$TITLE}</option>
{/loop}
</select>
<span class="input-group-btn">
<button class="btn btn-default btn-primary action-btn" type="submit"><span class="glyphicon glyphicon-plus-sign"></span></button>
</span>
</div>
<span class="help-block">{intl l='Select an attribute and click (+) to add it to this template'}</span>
</form>
{/ifloop}
{elseloop rel="free_attributes"}
<div class="alert alert-info">There is currently no available attributes.</div>
{/elseloop}
</div>
<table class="table table-striped table-condensed table-left-aligned">
<thead>
<tr>
<th>{intl l='ID'}</th>
<th>{intl l='Attribute title'}</th>
{module_include location='template_attributes_table_header'}
<th class="actions">{intl l="Actions"}</th>
</tr>
</thead>
<tbody>
{loop name="assigned_attributes" type="attribute" template="$template_id" backend_context="1" lang="$edit_language_id"}
<tr>
<td>{$ID}</td>
<td>
{$TITLE}
</td>
{module_include location='template_attributes_table_row'}
<td class="actions">
<div class="btn-group">
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.template.attribute.delete"}
<a class="btn btn-default btn-xs delete-attribute" title="{intl l='Delete this attribute'}" href="#delete_attribute_dialog" data-id="{$ID}" data-toggle="modal">
<span class="glyphicon glyphicon-trash"></span>
</a>
{/loop}
</div>
</td>
</tr>
{/loop}
{elseloop rel="assigned_attributes"}
<tr>
<td colspan="3">
<div class="alert alert-info">
{intl l="This template contains no attributes"}
</div>
</td>
</tr>
{/elseloop}
</tbody>
</table>
{* Delete value confirmation dialog *}
{capture "delete_attribute_dialog"}
<input type="hidden" name="template_id" value="{$template_id}" />
<input type="hidden" name="attribute_id" id="attribute_delete_id" value="" />
{/capture}
{include
file = "includes/generic-confirm-dialog.html"
dialog_id = "delete_attribute_dialog"
dialog_title = {intl l="Remove attribute"}
dialog_message = {intl l="Do you really want to remove this attribute from the template ?"}
form_action = {url path='/admin/configuration/templates/attributes/delete'}
form_content = {$smarty.capture.delete_attribute_dialog nofilter}
}
<script>
$(function() {
// Set proper attribute ID in delete attribute from
$('a.delete-attribute').click(function(ev) {
$('#attribute_delete_id').val($(this).data('id'));
});
});
</script>

View File

@@ -0,0 +1,102 @@
<div class="form-group">
{ifloop rel="free_features"}
<form action="{url path='/admin/configuration/templates/features/add'}">
<input type="hidden" name="template_id" value="{$template_id}" />
<div class="input-group">
<select required="required" name="feature_id" id="feature_id" class="form-control">
<option value="">Select an feature...</option>
{loop name="free_features" type="feature" exclude_template="$template_id" backend_context="1" lang="$edit_language_id"}
<option value="{$ID}">{$TITLE}</option>
{/loop}
</select>
<span class="input-group-btn">
<button class="btn btn-default btn-primary action-btn" type="submit"><span class="glyphicon glyphicon-plus-sign"></span></button>
</span>
</div>
<span class="help-block">{intl l='Select an feature and click (+) to add it to this template'}</span>
</form>
{/ifloop}
{elseloop rel="free_features"}
<div class="alert alert-info">There is currently no available features.</div>
{/elseloop}
</div>
<table class="table table-striped table-condensed table-left-aligned">
<thead>
<tr>
<th>{intl l='ID'}</th>
<th>{intl l='Feature title'}</th>
{module_include location='template_features_table_header'}
<th class="actions">{intl l="Actions"}</th>
</tr>
</thead>
<tbody>
{loop name="assigned_features" type="feature" template="$template_id" backend_context="1" lang="$edit_language_id"}
<tr>
<td>{$ID}</td>
<td>
{$TITLE}
</td>
{module_include location='template_features_table_row'}
<td class="actions">
<div class="btn-group">
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.template.feature.delete"}
<a class="btn btn-default btn-xs delete-feature" title="{intl l='Delete this feature'}" href="#delete_feature_dialog" data-id="{$ID}" data-toggle="modal">
<span class="glyphicon glyphicon-trash"></span>
</a>
{/loop}
</div>
</td>
</tr>
{/loop}
{elseloop rel="assigned_features"}
<tr>
<td colspan="3">
<div class="alert alert-info">
{intl l="This template contains no features"}
</div>
</td>
</tr>
{/elseloop}
</tbody>
</table>
{* Delete value confirmation dialog *}
{capture "delete_feature_dialog"}
<input type="hidden" name="template_id" value="{$template_id}" />
<input type="hidden" name="feature_id" id="feature_delete_id" value="" />
{/capture}
{include
file = "includes/generic-confirm-dialog.html"
dialog_id = "delete_feature_dialog"
dialog_title = {intl l="Remove feature"}
dialog_message = {intl l="Do you really want to remove this feature from the template ?"}
form_action = {url path='/admin/configuration/templates/features/delete'}
form_content = {$smarty.capture.delete_feature_dialog nofilter}
}
<script>
$(function() {
// Set proper feature ID in delete feature from
$('a.delete-feature').click(function(ev) {
$('#feature_delete_id').val($(this).data('id'));
});
});
</script>

View File

@@ -108,8 +108,8 @@
<script>
$(function() {
$('#attribute_list_management').load("{admin_viewurl view='ajax/template-attribute-list' template_id=$template_id}");
$('#feature_list_management').load("{admin_viewurl view='ajax/template-feature-list' template_id=$template_id}");
$('#feature_list_management').load("{url path='/admin/configuration/templates/features/list' template_id=$template_id}");
$('#attribute_list_management').load("{url path='/admin/configuration/templates/attributes/list' template_id=$template_id}");
});
</script>
{/block}