Implemented "Remember Me" feature on admin. Started template management
This commit is contained in:
15
templates/admin/default/ajax/template-attribute-list.html
Normal file
15
templates/admin/default/ajax/template-attribute-list.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<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>
|
||||
{/ifloop}
|
||||
{elseloop rel="free_attributes"}
|
||||
<div class="alert alert-info">There is currently no available attributes.</div>
|
||||
{/elseloop}
|
||||
</div>
|
||||
|
||||
@@ -224,7 +224,7 @@
|
||||
dialog_title = {intl l="Delete attribute"}
|
||||
dialog_message = {intl l="Do you really want to delete this attribute ? It will be removed from all product templates."}
|
||||
|
||||
form_action = {url path='/admin/configuration/attributes/remove_from-all-templates' attribute_id=$ID}
|
||||
form_action = {url path='/admin/configuration/attributes/delete'}
|
||||
form_content = {$smarty.capture.delete_dialog nofilter}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
{block name="javascript-initialization"}
|
||||
<script>
|
||||
$(function () {
|
||||
$(".feed-list").load("{admin_viewurl view='includes/thelia_news_feed'}");
|
||||
$(".feed-list").load("{admin_viewurl view='ajax/thelia_news_feed'}");
|
||||
})
|
||||
</script>
|
||||
{/block}
|
||||
115
templates/admin/default/template-edit.html
Normal file
115
templates/admin/default/template-edit.html
Normal file
@@ -0,0 +1,115 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="page-title"}{intl l='Edit a template'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.templates.edit{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="templates edit-template">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
{loop name="template_edit" type="template" id="$template_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/templates'}">{intl l="Templates"}</a></li>
|
||||
<li>{intl l='Editing template "%name"' name="{$NAME}"}</li>
|
||||
</ul>
|
||||
|
||||
<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 template $NAME"}
|
||||
</div>
|
||||
|
||||
<div class="form-container">
|
||||
<div class="col-md-12">
|
||||
|
||||
{form name="thelia.admin.template.modification"}
|
||||
<form method="POST" action="{url path='/admin/configuration/templates/save'}" {form_enctype form=$form} class="clearfix">
|
||||
|
||||
{* Be sure to get the template ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="template_id" value="{$template_id}" />
|
||||
|
||||
{include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/configuration/templates'}"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/templates'}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form 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}
|
||||
|
||||
{form_field form=$form field='name'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value}" title="{intl l='Template name'}" placeholder="{intl l='Template name'}" class="form-control">
|
||||
</div>
|
||||
{/form_field}
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="form-container">
|
||||
<div class="col-md-6">
|
||||
<p class="title title-without-tabs">{intl l='Attributes'}</p>
|
||||
<p>Manage attributes included in this product templates</p>
|
||||
|
||||
<div id="attribute_list_management">
|
||||
<div class="loading"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<p class="title title-without-tabs">{intl l='Features'}</p>
|
||||
<p>Manage features included in this product templates</p>
|
||||
|
||||
<div id="feature_list_management">
|
||||
<div class="loading"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="template_edit"}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-error">
|
||||
{intl l="Sorry, template ID=$template_id was not found."}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/elseloop}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
|
||||
<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}");
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
215
templates/admin/default/templates.html
Normal file
215
templates/admin/default/templates.html
Normal file
@@ -0,0 +1,215 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="page-title"}{intl l='Thelia Product Templates'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.templates.view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="templates">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
<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/templates'}">{intl l="Product templates"}</a></li>
|
||||
</ul>
|
||||
|
||||
{module_include location='templates_top'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<form action="#" method="post">
|
||||
<div class="general-block-decorator">
|
||||
|
||||
{if ! empty($general_error) }
|
||||
<div class="alert alert-danger">{$general_error}</div>
|
||||
{/if}
|
||||
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption>
|
||||
{intl l='Thelia product templates'}
|
||||
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.templates.create"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new product template'}" href="#creation_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
{admin_sortable_header
|
||||
current_order=$order
|
||||
order='id'
|
||||
reverse_order='id_reverse'
|
||||
path='/admin/configuration/templates'
|
||||
label="{intl l='ID'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th>
|
||||
{admin_sortable_header
|
||||
current_order=$order
|
||||
order='alpha'
|
||||
reverse_order='alpha_reverse'
|
||||
path='/admin/configuration/templates'
|
||||
label="{intl l='Title'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
{module_include location='templates_table_header'}
|
||||
|
||||
<th class="actions">{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="list" type="template" backend_context="1" lang=$lang_id order=$order}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
|
||||
<td>
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.templates.change"}
|
||||
<a title="{intl l='Change this template'}" href="{url path='/admin/configuration/templates/update' template_id=$ID}">{$NAME}</a>
|
||||
{/loop}
|
||||
{elseloop rel="can_change"}
|
||||
{$NAME}
|
||||
{/elseloop}
|
||||
</td>
|
||||
|
||||
{module_include location='templates_table_row'}
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.templates.change"}
|
||||
<a class="btn btn-default btn-xs template-change" title="{intl l='Change this product template'}" href="{url path='/admin/configuration/templates/update' template_id=$ID}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.templates.delete"}
|
||||
<a class="btn btn-default btn-xs template-delete" title="{intl l='Delete this product template'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="list"}
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="alert alert-info">
|
||||
{intl l="No product template has been created yet. Click the + button to create one."}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/elseloop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{module_include location='templates_bottom'}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* Adding a new template *}
|
||||
|
||||
{form name="thelia.admin.template.creation"}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "creation_dialog"}
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to the edition page, _ID_ is replaced with the created template ID, see controller *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/templates/update' template_id='_ID_'}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='name'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
|
||||
{loop type="lang" name="default-lang" default_only="1"}
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Template title'}" placeholder="{intl l='Title'}">
|
||||
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" /></span>
|
||||
</div>
|
||||
|
||||
<div class="help-block">{intl l="Enter here the template name in the default language ($TITLE)"}</div>
|
||||
|
||||
{* Switch edition to the current locale *}
|
||||
<input type="hidden" name="edit_language_id" value="{$ID}" />
|
||||
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
||||
{/form_field}
|
||||
{/loop}
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='template_create_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "creation_dialog"
|
||||
dialog_title = {intl l="Create a new product template"}
|
||||
dialog_body = {$smarty.capture.creation_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create this product template"}
|
||||
|
||||
form_action = {url path='/admin/configuration/templates/create'}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
{/form}
|
||||
|
||||
{* Delete confirmation dialog *}
|
||||
|
||||
{capture "delete_dialog"}
|
||||
<input type="hidden" name="template_id" id="template_delete_id" value="" />
|
||||
|
||||
{module_include location='template_delete_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "delete_dialog"
|
||||
dialog_title = {intl l="Delete template"}
|
||||
dialog_message = {intl l="Do you really want to delete this template ? It will be removed from all products."}
|
||||
|
||||
form_action = {url path='/admin/configuration/templates/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 template ID in delete from
|
||||
$('a.template-delete').click(function(ev) {
|
||||
$('#template_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.template.creation"
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
Reference in New Issue
Block a user