Initial Commit
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="no-return-functions"}
|
||||
{$admin_current_location = 'configuration'}
|
||||
{/block}
|
||||
|
||||
{block name="page-title"}{intl d='slide.bo.default' l='Edit slide'}{/block}
|
||||
|
||||
{block name="check-module"}slide{/block}
|
||||
{block name="check-access"}update{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
|
||||
<div class="slides edit-slide">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
{loop name="slide_edit" type="slide" active="*" id="$slide_id" backend_context="1" limit="1"}
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='/admin/home'}">{intl d='slide.bo.default' l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/module/slides'}">{intl d='slide.bo.default' l="Slides"}</a></li>
|
||||
<li>{intl d='slide.bo.default' l='Editing slide "%name"' name={$ID}}</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 d='slide.bo.default' l="Edit slide %name" name={$ID}}
|
||||
</div>
|
||||
|
||||
<div class="form-container">
|
||||
<div class="col-md-12">
|
||||
{form name="slide.update.form"}
|
||||
<form method="POST" action='{url path="/admin/module/slide/save/{$slide_id}"}' {form_enctype form=$form}>
|
||||
<fieldset>
|
||||
{* Be sure to get the slide ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="slide_id" value="{$slide_id}" />
|
||||
|
||||
{include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/module/slides'}"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/module/slides'}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='id'}
|
||||
<input type="hidden" name="{$name}" value="{$value}" />
|
||||
{/form_field}
|
||||
|
||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
|
||||
{render_form_field form=$form field="title"}
|
||||
|
||||
{render_form_field form=$form field="content"}
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="slide_edit"}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-error">
|
||||
{intl d='slide.bo.default' l="Sorry, slide ID=%id was not found." id={$slide_id}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/elseloop}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block name="javascript-last-call"}
|
||||
{hook name="slide.edit-js" location="slide-edit-js" }
|
||||
{/block}
|
||||
219
local/modules/Slide/templates/backOffice/default/slides.html
Normal file
219
local/modules/Slide/templates/backOffice/default/slides.html
Normal file
@@ -0,0 +1,219 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="no-return-functions"}
|
||||
{$admin_current_location = 'tools'}
|
||||
{/block}
|
||||
|
||||
{block name="page-title"}{intl d='slide.bo.default' l='Comments'}{/block}
|
||||
|
||||
{block name="check-module"}slide{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
|
||||
<div class="slides">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='/admin/home'}">{intl d='slide.bo.default' l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/module/slides'}">{intl d='slide.bo.default' l="Slides"}</a></li>
|
||||
</ul>
|
||||
|
||||
{hook name="slides.top" location="slides_top" }
|
||||
|
||||
{if $error_message}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-danger">
|
||||
{$error_message}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{* Loop Filter *}
|
||||
{$loop_limit={$smarty.get.loop_limit|default:20}}
|
||||
{$loop_page={$smarty.get.page|default:1}}
|
||||
{$loop_order={$smarty.get.loop_order|default:'id'}}
|
||||
|
||||
{assign var="amount" value={count type="slide" order=$loop_order backend_context="1"}}
|
||||
{if $amount < ($loop_limit * ($loop_page - 1))}
|
||||
{$loop_page=1}
|
||||
{/if}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="general-block-decorator">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption>
|
||||
{intl d='slide.bo.default' l="Slides management"}
|
||||
|
||||
{loop type="auth" name="can_create" role="ADMIN" module="slide" access="CREATE"}
|
||||
<span class="pull-right">
|
||||
<a class="btn btn-primary" title="{intl l='Add a new slide'}" 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=$loop_order
|
||||
order='id'
|
||||
reverse_order='id_reverse'
|
||||
path={url path='/admin/module/slides'}
|
||||
request_parameter_name='loop_order'
|
||||
label="{intl l='ID'}"
|
||||
}
|
||||
</th>
|
||||
<th>{intl d='slide.bo.default' l="Title"}</th>
|
||||
<th>{intl d='slide.bo.default' l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{loop type="slide" name="slide.list" order=$loop_order page=$loop_page limit=$loop_limit backend_context="1"}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
<td>{$TITLE}</td>
|
||||
<td class="actions" data-id="{$ID}">
|
||||
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="slide" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs slide-change" data-id="{$ID}" title="{intl d='slide.bo.default' l='Change this slide'}" href="{url path="/admin/module/slide/update/$ID"}">
|
||||
<span class="glyphicon glyphicon-edit"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="slide" access="DELETE"}
|
||||
<a href="#delete_dialog" data-toggle="modal" data-id="{$ID}" class="btn btn-default btn-xs slide-delete" title="{intl d='slide.bo.default' l="Delete this slide"}">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="100">
|
||||
{include
|
||||
file = "includes/pagination.html"
|
||||
|
||||
loop_ref = "slide.list"
|
||||
max_page_count = $loop_limit
|
||||
page_url = "{url path="/admin/module/slides"}"
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{hook name="slides.bottom" location="slides_bottom" }
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{* Adding a new slide *}
|
||||
|
||||
{form name="slide.create.form"}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "creation_dialog"}
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{render_form_field form=$form field="success_url" value={url path='/admin/module/slide/update/_ID_'}}
|
||||
|
||||
{render_form_field form=$form field="title"}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "creation_dialog"
|
||||
dialog_title = {intl l="Create a new slide"}
|
||||
dialog_body = {$smarty.capture.creation_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create this slide"}
|
||||
|
||||
form_action = {url path='/admin/module/slide/create'}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
{/form}
|
||||
|
||||
|
||||
{* Delete confirmation dialog *}
|
||||
|
||||
{capture "delete_dialog"}
|
||||
<input type="hidden" name="slide_id" id="slide_delete_id" value="" />
|
||||
{hook name="slides.delete-form" location="slides_delete_form" }
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "delete_dialog"
|
||||
dialog_title = {intl d='slide.bo.default' l="Delete slide"}
|
||||
dialog_message = {intl d='slide.bo.default' l="Do you really want to delete this slide ?"}
|
||||
|
||||
form_action = {token_url path='/admin/module/slide/delete'}
|
||||
form_content = {$smarty.capture.delete_dialog nofilter}
|
||||
form_error_message = $error_delete_message
|
||||
}
|
||||
|
||||
<div id="slide-update-modal"></div>
|
||||
|
||||
<div class="modal fade" id="delete-failed" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content alert alert-block alert-danger ">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h2>{intl d='slide.bo.default' l="Error"}</h2>
|
||||
</div>assets
|
||||
<div class="modal-body">
|
||||
<strong>{intl d='slide.bo.default' l="Impossible to delete slide."} {intl d='slide.bo.default' l="Please contact your administrator or try later"}</strong>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
// JS stuff for creation form
|
||||
{include
|
||||
file = "includes/generic-js-dialog.html"
|
||||
dialog_id = "creation_dialog"
|
||||
form_name = "slide.create.form"
|
||||
}
|
||||
|
||||
$(".slide-delete").click(function(){
|
||||
$("#slide_delete_id").val($(this).data("id"));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
{/block}
|
||||
|
||||
{block name="javascript-last-call"}
|
||||
{hook name="slides.js" location="slides-js" }
|
||||
{/block}
|
||||
@@ -0,0 +1,50 @@
|
||||
<script type="application/javascript">
|
||||
|
||||
(function ($) {
|
||||
|
||||
{literal}
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$('form#slide-pos-form').on('submit', function(e){
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
var $form = $(this);
|
||||
var url = $form.attr("action");
|
||||
|
||||
var data = {};
|
||||
|
||||
$('input.form-slide-pos').each(function(){
|
||||
var $field = $(this);
|
||||
if ($field.val() != '') {
|
||||
data[$field.data("id")] = $field.val();
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
url: $form.attr('action')
|
||||
}).done(function(data, textStatus, jqXHR){
|
||||
var status;
|
||||
if (data.success) {
|
||||
//alert(data.message);
|
||||
} else {
|
||||
alert(data.message);
|
||||
}
|
||||
}).fail(function(jqXHR, textStatus, errorThrown){
|
||||
alert(textStatus);
|
||||
});
|
||||
|
||||
//return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
{/literal}
|
||||
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,24 @@
|
||||
<p class="title title-without-tabs">{intl l="Slides" d='slide.bo.default'}</p>
|
||||
|
||||
<form id="slide-pos-form" action="{url path="/admin/slide/position/save/$ref/$ref_id"}" role="form">
|
||||
{loop type="slide" name="slide"}
|
||||
|
||||
{$position=''}
|
||||
{loop type="slide-rel" name="slide-rel" limit="1" slide_id="$ID" ref="$ref" ref_id="$ref_id"}
|
||||
{$position=$POSITION}
|
||||
{/loop}
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-md-2 col-sm-6">
|
||||
<input type="number" class="form-control form-slide-pos" id="slide-pos-{$ID}" data-id="{$ID}" value="{$position}" placeholder="position" />
|
||||
</div>
|
||||
<label for="slide-pos-{$ID}" class="col-md-10 col-sm-6 control-label">{$TITLE}</label>
|
||||
</div>
|
||||
{/loop}
|
||||
<div class="form-group">
|
||||
<input type="submit" class="btn btn-primary" id="slide-pos-validate" value="{intl l='Save' d='slide.bo.default'}" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user