Added brands management
This commit is contained in:
178
templates/backOffice/default/brand-edit.html
Normal file
178
templates/backOffice/default/brand-edit.html
Normal file
@@ -0,0 +1,178 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="no-return-functions"}
|
||||
{$admin_current_location = 'tools'}
|
||||
{/block}
|
||||
|
||||
{block name="check-resource"}admin.brand{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="page-title"}{intl l='Edit brand'}{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="brand edit-brand">
|
||||
<div id="wrapper" class="container">
|
||||
{loop name="brand_edit" type="brand" visible="*" id="{$brand_id}" backend_context="1" lang="$edit_language_id"}
|
||||
|
||||
<nav>
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='admin/home'}">{intl l='Home'}</a></li>
|
||||
<li><a href="{url path='admin/tools'}">{intl l='Tools'}</a></li>
|
||||
<li><a href="{url path='admin/brand'}">{intl l='Brands'}</a></li>
|
||||
<li>{intl l='Editing brand "%title"' title="$TITLE"}</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 general-block-decorator">
|
||||
<div class="row">
|
||||
<div class="col-md-7 title">
|
||||
{intl l='Edit brand %title' title={$TITLE}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<ul class="nav nav-tabs" id="tabbed-menu">
|
||||
<li class="active">
|
||||
<a href="#general" data-toggle="tab">{intl l="General description"}</a>
|
||||
</li>
|
||||
<li><a href="#seo" data-toggle="tab">{intl l="SEO"}</a></li>
|
||||
<li><a href="#images" data-toggle="tab">{intl l="Images"}</a></li>
|
||||
<li><a href="#documents" data-toggle="tab">{intl l="Documents"}</a></li>
|
||||
<li><a href="#modules" data-toggle="tab">{intl l="Modules"}</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade active in" id="general">
|
||||
|
||||
<div class="form-container">
|
||||
|
||||
{form name="thelia.admin.brand.modification"}
|
||||
|
||||
<form method="POST" action="{url path="/admin/brand/save/{$ID}"}" {form_enctype form=$form} class="clearfix">
|
||||
|
||||
{include file="includes/inner-form-toolbar.html" close_url={url path='/admin/brand'}}
|
||||
|
||||
<input type="hidden" name="current_tab" value="general"/>
|
||||
|
||||
{* Be sure to get the currency ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="brand_id" value="{$ID}" />
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{admin_form_field form=$form name="success_url" value={url path="/admin/brand/update/{$ID}"}}
|
||||
{admin_form_field form=$form name="locale" value={$edit_language_locale}}
|
||||
|
||||
{if $form_error}
|
||||
<div class="alert alert-danger">{$form_error_message}</div>
|
||||
{/if}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{include file="includes/standard-description-form-fields.html"}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{admin_form_field form=$form name="visible"}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{include
|
||||
file="includes/inner-form-toolbar.html"
|
||||
hide_submit_buttons = false
|
||||
hide_flags = true
|
||||
|
||||
close_url={url path="/admin/brand"}
|
||||
}
|
||||
|
||||
<small>{intl l='Brand created on %date_create. Last modification: %date_change' date_create={format_date date=$CREATE_DATE} date_change={format_date date=$UPDATE_DATE} }</small>
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="seo">
|
||||
{form name="thelia.admin.seo"}
|
||||
{include
|
||||
file = "includes/seo-tab.html"
|
||||
form = $form
|
||||
formAction = {url path='/admin/brand/seo/save'}
|
||||
closeUrl = {url path='/admin/brand'}
|
||||
current_id = $brand_id
|
||||
}
|
||||
{/form}
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="images">
|
||||
{include file='includes/image-upload-form.html' imageType='brand' parentId=$brand_id}
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="documents">
|
||||
{include file='includes/document-upload-form.html' documentType='brand' parentId=$brand_id}
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="modules">
|
||||
<div class="form-container">
|
||||
{include
|
||||
file = "includes/inner-form-toolbar.html"
|
||||
hide_submit_buttons = true
|
||||
page_url = {$pageUrl}
|
||||
close_url = {$closeUrl}
|
||||
current_tab = "modules"
|
||||
}
|
||||
</div>
|
||||
|
||||
{include file="includes/module-tab-content.html" location="brand-edit"}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/loop}
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
{javascripts file='assets/js/dropzone.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
{javascripts file='assets/js/image-upload.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
{javascripts file='assets/js/document-upload.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
{javascripts file='assets/js/jquery-ui-1.10.3.custom.min.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
<script>
|
||||
$(function() {
|
||||
// Load active tab
|
||||
|
||||
$.imageUploadManager.initImageDropZone();
|
||||
$.documentUploadManager.initDocumentDropZone();
|
||||
|
||||
$('.use_default_rewriten_url').click(function(ev) {
|
||||
alert("Not functionnal");
|
||||
|
||||
ev.preventDefault();
|
||||
});
|
||||
|
||||
// Show proper tab, if defined
|
||||
{if ! empty($current_tab)}
|
||||
$('.nav-tabs a[href="#{$current_tab}"]').trigger("click");
|
||||
{/if}
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
|
||||
{block name="javascript-last-call"}
|
||||
{module_include location='brand-edit-js'}
|
||||
{/block}
|
||||
304
templates/backOffice/default/brands.html
Normal file
304
templates/backOffice/default/brands.html
Normal file
@@ -0,0 +1,304 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="no-return-functions"}
|
||||
{$admin_current_location = 'tools'}
|
||||
{/block}
|
||||
|
||||
{block name="page-title"}{intl l='Brands'}{/block}
|
||||
|
||||
{block name="check-resource"}admin.brand{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="brands">
|
||||
|
||||
<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/tools'}">{intl l="Tools"}</a></li>
|
||||
<li><a href="{url path='/admin/brand'}">{intl l="Brands"}</a></li>
|
||||
</ul>
|
||||
|
||||
{module_include location='brands_top'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<div class="general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed">
|
||||
<caption class="clearfix">
|
||||
{intl l='Brands'}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.brand" access="CREATE"}
|
||||
<span class="pull-right">
|
||||
<a class="btn btn-default btn-primary" title="{intl l='Add a new brand'}" href="#creation_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
</span>
|
||||
{/loop}
|
||||
</caption>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
{admin_sortable_header
|
||||
current_order=$order
|
||||
order='id'
|
||||
reverse_order='id-reverse'
|
||||
path='/admin/brands'
|
||||
label="{intl l='ID'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th> </th>
|
||||
|
||||
<th>
|
||||
{admin_sortable_header
|
||||
current_order=$order
|
||||
order='alpha'
|
||||
reverse_order='alpha-reverse'
|
||||
path='/admin/brand'
|
||||
label="{intl l='Name'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th class="text-center">
|
||||
{admin_sortable_header
|
||||
current_order=$order
|
||||
order='manual'
|
||||
reverse_order='manual-reverse'
|
||||
path='/admin/brand'
|
||||
label="{intl l="Position"}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th class="text-center">
|
||||
{admin_sortable_header
|
||||
current_order=$content_order
|
||||
order='visible'
|
||||
reverse_order='visible-reverse'
|
||||
path={url path='/admin/brand'}
|
||||
label="{intl l='Online'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
{module_include location='brands_table_header'}
|
||||
|
||||
<th class="actions">{intl l='Actions'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="brands" type="brand" visible="*" backend_context="1" lang=$lang_id order=$order}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
|
||||
<td>
|
||||
{loop type="image" name="folder_image" source="brand" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"}
|
||||
<a href="{url path="admin/brand/update/$OBJECT_ID"}" title="{intl l='Edit this brand'}">
|
||||
<img src="{$IMAGE_URL}" alt="{$TITLE}" />
|
||||
</a>
|
||||
{/loop}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.brand" access="UPDATE"}
|
||||
<a title="{intl l='Change this brand'}" href="{url path="/admin/brand/update/$ID"}">{$TITLE}</a>
|
||||
{/loop}
|
||||
{elseloop rel="can_change"}
|
||||
{$TITLE}
|
||||
{/elseloop}
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
resource="admin.brand"
|
||||
access="UPDATE"
|
||||
path="/admin/brand/update-position"
|
||||
url_parameter="brand_id"
|
||||
in_place_edit_class="brandPositionChange"
|
||||
position="$POSITION"
|
||||
id="$ID"
|
||||
}
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.brand" access="UPDATE"}
|
||||
<div class="make-switch switch-small visibleToggle" data-id="{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="checkbox" class="visibleToggle" {if $VISIBLE == 1}checked="checked"{/if}>
|
||||
</div>
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="can_change"}
|
||||
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="checkbox" class="disabled" disabled="disabled" {if $VISIBLE == 1}checked="checked"{/if}>
|
||||
</div>
|
||||
{/elseloop}
|
||||
</td>
|
||||
|
||||
{module_include location='brands_table_row'}
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.brand" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs brand-change" title="{intl l='Change this brand'}" href="{url path="/admin/brand/update/$ID"}">
|
||||
<span class="glyphicon glyphicon-edit"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.brand" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs brand-delete" title="{intl l='Delete this brand'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{elseloop rel="brands"}
|
||||
<tr>
|
||||
<td colspan="8">
|
||||
<div class="alert alert-info">
|
||||
{intl l="No brand has been created yet. Click the + button to create one."}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/elseloop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{module_include location='brands_bottom'}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{* Adding a new brand *}
|
||||
|
||||
{form name="thelia.admin.brand.creation"}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "creation_dialog"}
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{loop type="lang" name="default-lang" default_only="1"}
|
||||
{* Switch edition to the current locale *}
|
||||
<input type="hidden" name="edit_language_id" value="{$ID}" />
|
||||
|
||||
{admin_form_field form=$form name="locale" value=$LOCALE}
|
||||
{/loop}
|
||||
|
||||
{admin_form_field form=$form name="success_url" value={url path='/admin/brand/update/_ID_'}}
|
||||
{admin_form_field form=$form name="title"}
|
||||
{admin_form_field form=$form name="visible"}
|
||||
|
||||
{module_include location='brand_create_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "creation_dialog"
|
||||
dialog_title = {intl l="Create a new brand"}
|
||||
dialog_body = {$smarty.capture.creation_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create this brand"}
|
||||
|
||||
form_action = {url path='/admin/brand/create'}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
{/form}
|
||||
|
||||
|
||||
{* Delete confirmation dialog *}
|
||||
|
||||
{capture "delete_dialog"}
|
||||
<input type="hidden" name="brand_id" id="brand_delete_id" value="" />
|
||||
|
||||
{module_include location='brand_delete_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "delete_dialog"
|
||||
dialog_title = {intl l="Delete brand"}
|
||||
dialog_message = {intl l="Do you really want to delete this brand ?"}
|
||||
|
||||
form_action = {url path='/admin/brand/delete'}
|
||||
form_content = {$smarty.capture.delete_dialog nofilter}
|
||||
}
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
|
||||
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
{javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
// Set proper brand ID in delete from
|
||||
$('a.brand-delete').click(function(ev) {
|
||||
$('#brand_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.brand.creation"
|
||||
}
|
||||
|
||||
{* Inline editing of object position using bootstrap-editable *}
|
||||
|
||||
$('.brandPositionChange').editable({
|
||||
type : 'text',
|
||||
title : '{intl l="Enter new brand position"}',
|
||||
mode : 'popup',
|
||||
inputclass : 'input-mini',
|
||||
placement : 'left',
|
||||
success : function(response, newValue) {
|
||||
// The URL template
|
||||
var url = "{url noamp='1' path='/admin/brand/update-position' brand_id='__ID__' position='__POS__'}";
|
||||
|
||||
// Perform subtitutions
|
||||
url = url.replace('__ID__', $(this).data('id')).replace('__POS__', newValue);
|
||||
|
||||
// Reload the page
|
||||
location.href = url;
|
||||
}
|
||||
});
|
||||
|
||||
{* Visibility toggle *}
|
||||
|
||||
$(".visibleToggle").on('switch-change', function(event, data) {
|
||||
$.ajax({
|
||||
url : "{url path='admin/brand/toggle-online'}",
|
||||
data : {
|
||||
brand_id : $(this).data('id'),
|
||||
action : 'visibilityToggle'
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
|
||||
{block name="javascript-last-call"}
|
||||
{module_include location='brands-js'}
|
||||
{/block}
|
||||
@@ -40,6 +40,13 @@
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop name="auth-export" type="auth" role="ADMIN" resource="admin.brand" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/brand'}">{intl l="Brands"}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/brand'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop name="auth-export" type="auth" role="ADMIN" resource="admin.export" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/export'}">{intl l="Export"}</a></td>
|
||||
|
||||
Reference in New Issue
Block a user