create ajax modal for lang edition
This commit is contained in:
64
templates/admin/default/ajax/language-update-modal.html
Normal file
64
templates/admin/default/ajax/language-update-modal.html
Normal file
@@ -0,0 +1,64 @@
|
||||
{* Update an Address *}
|
||||
|
||||
{form name="thelia.lang.update"}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "edit_lang_dialog"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
<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}" name="{$name}" class="form-control" value="{$value}" title="{intl l={$label} }" placeholder="{intl l='Label'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='code'}
|
||||
<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}" name="{$name}" class="form-control" value="{$value}" title="{intl l={$label}}" placeholder="{intl l='Company'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='locale'}
|
||||
<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}" name="{$name}" class="form-control" value="{$value}" title="{intl l={$label}}" placeholder="{intl l='Company'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='date_format'}
|
||||
<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}" name="{$name}" class="form-control" value="{$value}" title="{intl l={$label}}" placeholder="{intl l='Company'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='time_format'}
|
||||
<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}" name="{$name}" class="form-control" value="{$value}" title="{intl l={$label}}" placeholder="{intl l='Company'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "edit_lang_dialog"
|
||||
dialog_title = {intl l="Edit a language"}
|
||||
dialog_body = {$smarty.capture.edit_lang_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Edit this language"}
|
||||
dialog_cancel_label = {intl l="Cancel"}
|
||||
|
||||
form_action = {url path="/admin/configuration/languages/save/{$lang_id}"}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
|
||||
{/form}
|
||||
@@ -1,46 +0,0 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="page-title"}{intl l='Languages an URLs'}{/block}
|
||||
|
||||
{block name="check-resource"}admin.configuration.languages{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="modules">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
<div class="clearfix">
|
||||
<ul class="breadcrumb pull-left">
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/modules'}">{intl l="Languages & URLs"}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption class="clearfix">
|
||||
{intl l="Languages management"}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l="Title"}</th>
|
||||
<th>{intl l="code ISO 639"}</th>
|
||||
<th>{intl l="locale"}</th>
|
||||
<th>{intl l="locale"}</th>
|
||||
|
||||
{module_include location='modules_table_header'}
|
||||
|
||||
<th class="actions">{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/block}
|
||||
@@ -19,7 +19,7 @@
|
||||
{module_include location='languages_top'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-12">
|
||||
<div class="general-block-decorator">
|
||||
|
||||
<form action="" method="">
|
||||
@@ -38,61 +38,43 @@
|
||||
<tr>
|
||||
<th>{intl l="Language name"}</th>
|
||||
<th>{intl l="ISO 639 Code"}</th>
|
||||
<th>{intl l="Locale"}</th>
|
||||
<th>{intl l="date form"}</th>
|
||||
<th>{intl l="time form"}</th>
|
||||
<th>{intl l="Default"}</th>
|
||||
<th>{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{loop type="lang" name="lang.list" backend_context="1"}
|
||||
<tr>
|
||||
<td><input type="text" class="form-control" name="" value="France"></td>
|
||||
<td><input type="text" class="form-control" name="" value="fr"></td>
|
||||
<td>{$TITLE}</td>
|
||||
<td>{$CODE}</td>
|
||||
<td>{$LOCALE}</td>
|
||||
<td>{$DATE_FORMAT}</td>
|
||||
<td>{$TIME_FORMAT}</td>
|
||||
<td>
|
||||
<div class="make-switch switch-small switch-radio" 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="radio" name="" checked>
|
||||
<input type="radio" name="" {if $IS_DEFAULT}checked{/if}>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
<a href="#delete_dialog" data-toggle="modal" class="btn btn-default btn-xs" title="{intl l="Delete this language"}"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="text" class="form-control" name="" value="English"></td>
|
||||
<td><input type="text" class="form-control" name="" value="en"></td>
|
||||
<td>
|
||||
<div class="make-switch switch-small switch-radio" 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="radio" name="">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<a href="#delete_dialog" data-toggle="modal" class="btn btn-default btn-xs" title="{intl l="Delete this language"}"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="text" class="form-control" name="" value="Spanish"></td>
|
||||
<td><input type="text" class="form-control" name="" value="es"></td>
|
||||
<td>
|
||||
<div class="make-switch switch-small switch-radio" 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="radio" name="">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<a href="#delete_dialog" data-toggle="modal" class="btn btn-default btn-xs" title="{intl l="Delete this language"}"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.configuration.language" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs lang-change" data-id="{$ID}" title="{intl l='Change this language'}">
|
||||
<span class="glyphicon glyphicon-edit"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.configuration.language" access="DELETE"}
|
||||
<a href="#delete_dialog" data-toggle="modal" class="btn btn-default btn-xs" title="{intl l="Delete this language"}">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<button type="submit" class="btn btn-default btn-primary pull-right"><span class="glyphicon glyphicon-check"></span> {intl l="Save"}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
@@ -100,13 +82,18 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="general-block-decorator">
|
||||
|
||||
|
||||
<div class="title title-without-tabs">{intl l="Parameters"}</div>
|
||||
|
||||
<form action="" method="post">
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label for="" class="label-control">{intl l="If a translation is missing or incomplete :"}</label>
|
||||
<div class="input-group">
|
||||
@@ -124,24 +111,19 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-6">
|
||||
<div class="general-block-decorator clearfix">
|
||||
|
||||
<div class="title title-without-tabs">{intl l="Association language/URL"}</div>
|
||||
|
||||
<form action="" method="post">
|
||||
<div class="col-md-6">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="" class="label-control"><input type="radio" name="" checked> {intl l="Using a same domain for all languages"}</label>
|
||||
<input type="url" class="form-control" name="" placeholder="http://www.domain.com">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="" class="label-control"><input type="radio" name=""> {intl l="Using a domain or subdomain for each language"}</label>
|
||||
</div>
|
||||
@@ -169,7 +151,6 @@
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@@ -249,6 +230,7 @@
|
||||
form_content = {$smarty.capture.delete_dialog nofilter}
|
||||
}
|
||||
|
||||
<div id="lang-update-modal"></div>
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
@@ -270,4 +252,23 @@
|
||||
{javascripts file='assets/js/bootstrap-select/bootstrap-select.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("a.lang-change").click(function(e){
|
||||
var baseUrl = "{url path="/admin/configuration/languages/update/"}";
|
||||
$('body').append('<div class="modal-backdrop fade in" id="loading-event"><div class="loading"></div></div>');
|
||||
$.ajax({
|
||||
method: 'get',
|
||||
url: baseUrl+$(this).data('id')
|
||||
}).done(function(data){
|
||||
$("#loading-event").remove();
|
||||
$("#lang-update-modal").html(data);
|
||||
$("#edit_lang_dialog").modal("show");
|
||||
}).fail(function(){
|
||||
$("#loading-event").remove();
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
Reference in New Issue
Block a user