335 lines
16 KiB
HTML
335 lines
16 KiB
HTML
{extends file="admin-layout.tpl"}
|
|
|
|
{block name="no-return-functions"}
|
|
{$admin_current_location = 'configuration'}
|
|
{/block}
|
|
|
|
{block name="page-title"}{intl l='Edit a feature'}{/block}
|
|
|
|
{block name="check-resource"}admin.configuration.feature{/block}
|
|
{block name="check-access"}update{/block}
|
|
|
|
{block name="main-content"}
|
|
<div class="features edit-feature">
|
|
|
|
<div id="wrapper" class="container">
|
|
|
|
{loop name="feature_edit" type="feature" id=$feature_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/features'}">{intl l="Features"}</a></li>
|
|
<li>{intl l='Editing feature "%name"' name={$TITLE}}</li>
|
|
</ul>
|
|
|
|
{hook name="feature-edit.top" feature_id=$feature_id}
|
|
|
|
<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 feature "%name"' name={$TITLE}}
|
|
</div>
|
|
|
|
<div class="col-md-12">
|
|
<div class="form-container">
|
|
{form name="thelia.admin.feature.modification"}
|
|
<form method="POST" action="{url path='/admin/configuration/features/save'}" {form_enctype} class="clearfix">
|
|
|
|
{include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/configuration/features'}"}
|
|
|
|
<div class="col-md-6">
|
|
|
|
<p class="title title-without-tabs">{intl l='Feature information'}</p>
|
|
|
|
{form_field field='id'}
|
|
<input type="hidden" name="{$name}" value="{$feature_id}" />
|
|
{/form_field}
|
|
|
|
{* Be sure to get the feature ID, even if the form could not be validated *}
|
|
<input type="hidden" name="feature_id" value="{$feature_id}" />
|
|
|
|
{form_hidden_fields}
|
|
|
|
{form_field field='success_url'}
|
|
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/features'}" />
|
|
{/form_field}
|
|
|
|
{form_field 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}
|
|
|
|
{include file="includes/standard-description-form-fields.html"}
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
|
|
<p class="title title-without-tabs clearfix">
|
|
{intl l='Feature values'}
|
|
{include file='renderer/buttons.html' btn_group=false buttons=[
|
|
[
|
|
'type' => 'create',
|
|
'class' => 'action-btn pull-right',
|
|
'title' => {intl l='Add a new feature value'},
|
|
'href' => '#creation_dialog',
|
|
'auth' => ['resource' => 'admin.configuration.feature', 'access' => 'UPDATE'],
|
|
'data' => [
|
|
'toggle' => 'modal'
|
|
]
|
|
]
|
|
]}
|
|
</p>
|
|
|
|
<div class="alert alert-info">
|
|
{intl l="Enter here all possible feature values. To get a free text feature in product forms, don't add any value."}
|
|
</div>
|
|
|
|
<div class="table-responsive">
|
|
<table class="table table-striped table-condensed table-left-aligned">
|
|
<thead>
|
|
<tr>
|
|
<th>
|
|
{admin_sortable_header
|
|
current_order=$featureav_order
|
|
order='id'
|
|
reverse_order='id_reverse'
|
|
request_parameter_name='featureav_order'
|
|
path={url path='/admin/configuration/features/update' feature_id=$feature_id}
|
|
label="{intl l='ID'}"
|
|
}
|
|
</th>
|
|
|
|
<th>
|
|
{admin_sortable_header
|
|
current_order=$featureav_order
|
|
order='alpha'
|
|
reverse_order='alpha_reverse'
|
|
request_parameter_name='featureav_order'
|
|
path={url path='/admin/configuration/features/update' feature_id=$feature_id}
|
|
label="{intl l='Value'}"
|
|
}
|
|
</th>
|
|
|
|
<th class="text-center">
|
|
{admin_sortable_header
|
|
current_order=$featureav_order
|
|
order='manual'
|
|
reverse_order='manual_reverse'
|
|
request_parameter_name='featureav_order'
|
|
path={url path='/admin/configuration/features/update' feature_id=$feature_id}
|
|
label="{intl l="Position"}"
|
|
}
|
|
</th>
|
|
|
|
{hook name="features-value.table-header" location="features_value_table_header" }
|
|
|
|
<th class="actions">{intl l="Actions"}</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
{loop name="list" type="feature-availability" feature=$feature_id backend_context="1" lang=$edit_language_id order=$featureav_order}
|
|
<tr>
|
|
<td>{$ID}</td>
|
|
|
|
<td>
|
|
{* FIXME : integrate this in the encolsing form to provide standard form processing *}
|
|
<input class="js-edit form-control" type="text" name="feature_values[{$ID}]" value="{$TITLE}" />
|
|
</td>
|
|
|
|
<td class="text-center">
|
|
{admin_position_block
|
|
resource="admin.configuration.feature"
|
|
access="UPDATE"
|
|
path={url path='/admin/configuration/features-av/update-position' feature_id=$feature_id}
|
|
url_parameter="featureav_id"
|
|
in_place_edit_class="positionChange"
|
|
position="$POSITION"
|
|
id="$ID"
|
|
}
|
|
</td>
|
|
|
|
{hook name="features-value.table-row" location="features_value_table_row" feature_id={$feature_id} }
|
|
|
|
<td class="actions">
|
|
{loop type="auth" name="can_create" role="ADMIN" resource="admin.configuration.feature" access="UPDATE"}
|
|
<a class="btn btn-default btn-xs value-delete" title="{intl l='Delete this value'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal">
|
|
<span class="glyphicon glyphicon-trash"></span>
|
|
</a>
|
|
{/loop}
|
|
</td>
|
|
</tr>
|
|
{/loop}
|
|
|
|
{elseloop rel="list"}
|
|
<tr>
|
|
<td colspan="4">
|
|
<div class="alert alert-info">
|
|
{intl l="No value has been created yet. Click the + button to create one."}
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{/elseloop}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
{/form}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{hook name="feature-edit.bottom" feature_id=$feature_id}
|
|
|
|
{/loop}
|
|
|
|
{elseloop rel="feature_edit"}
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="alert alert-error">
|
|
{intl l="Sorry, feature ID=%id was not found." id={$feature_id}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{/elseloop}
|
|
|
|
</div>
|
|
</div>
|
|
|
|
{* Adding a new feature *}
|
|
|
|
{form name="thelia.admin.featureav.creation"}
|
|
|
|
{* Capture the dialog body, to pass it to the generic dialog *}
|
|
|
|
{capture "creation_dialog"}
|
|
{form_hidden_fields}
|
|
|
|
{* Be sure to get the feature ID, even if the form could not be validated *}
|
|
<input type="hidden" name="feature_id" value="{$feature_id}" />
|
|
|
|
{form_field field='success_url'}
|
|
{* on success, redirect to this page *}
|
|
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/features/update' feature_id=$feature_id}" />
|
|
{/form_field}
|
|
|
|
{form_field field='feature_id'}
|
|
<input type="hidden" name="{$name}" value="{$feature_id}" />
|
|
{/form_field}
|
|
|
|
{form_field field='title'}
|
|
<div class="form-group {if $error}has-error{/if}">
|
|
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
|
|
|
{loop type="lang" name="current-edit-lang" id="$edit_language_id"}
|
|
<div class="input-group">
|
|
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Feature title'}" placeholder="{intl l='Title'}">
|
|
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.png"}" alt="{$TITLE}" /></span>
|
|
</div>
|
|
|
|
<div class="help-block">{intl l="Enter here the value in the current edit language (%language_name)" language_name={$TITLE}}</div>
|
|
|
|
{form_field field='locale'}
|
|
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
|
{/form_field}
|
|
{/loop}
|
|
</div>
|
|
{/form_field}
|
|
|
|
{hook name="feature.value-create-form" location="feature_value_create_form" feature_id={$feature_id} }
|
|
|
|
{/capture}
|
|
|
|
{include
|
|
file = "includes/generic-create-dialog.html"
|
|
|
|
dialog_id = "creation_dialog"
|
|
dialog_title = {intl l="Create a new feature value"}
|
|
dialog_body = {$smarty.capture.creation_dialog nofilter}
|
|
|
|
dialog_ok_label = {intl l="Create this value"}
|
|
|
|
form_action = {url path='/admin/configuration/features-av/create'}
|
|
form_enctype = {form_enctype}
|
|
form_error_message = $form_error_message
|
|
}
|
|
{/form}
|
|
|
|
{* Delete value confirmation dialog *}
|
|
|
|
{capture "delete_dialog"}
|
|
<input type="hidden" name="feature_id" value="{$feature_id}" />
|
|
<input type="hidden" name="featureav_id" id="value_delete_id" value="" />
|
|
{/capture}
|
|
|
|
{include
|
|
file = "includes/generic-confirm-dialog.html"
|
|
|
|
dialog_id = "delete_dialog"
|
|
dialog_title = {intl l="Delete feature value"}
|
|
dialog_message = {intl l="Do you really want to delete this feature value ?"}
|
|
|
|
form_action = {token_url path='/admin/configuration/features-av/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 feature ID in delete from
|
|
$('a.value-delete').click(function(ev) {
|
|
$('#value_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.featureav.creation"
|
|
}
|
|
|
|
{* Inline editing of object position using bootstrap-editable *}
|
|
|
|
$('.positionChange').editable({
|
|
type : 'text',
|
|
title : '{intl l="Enter new value position"}',
|
|
mode : 'popup',
|
|
inputclass : 'input-mini',
|
|
placement : 'left',
|
|
success : function(response, newValue) {
|
|
// The URL template
|
|
var url = "{url noamp='1' path='/admin/configuration/features-av/update-position' featureav_id='__ID__' position='__POS__' feature_id=$feature_id}";
|
|
|
|
// Perform subtitutions
|
|
url = url.replace('__ID__', $(this).data('id')).replace('__POS__', newValue);
|
|
|
|
// Reload the page
|
|
location.href = url;
|
|
}
|
|
});
|
|
|
|
});
|
|
</script>
|
|
{/block}
|
|
|
|
{block name="javascript-last-call"}
|
|
{hook name="feature.edit-js" location="feature-edit-js" feature_id={$feature_id} }
|
|
{hook name="wysiwyg.js" location="wysiwyg-feature-edit-js" }
|
|
{/block}
|