// Include datetime picker for all admin controllers

This commit is contained in:
Jerome Nadaud
2013-11-22 16:41:52 +01:00
parent 361450aab9
commit 3fe6608a62
5 changed files with 44 additions and 7 deletions
@@ -309,7 +309,7 @@ $(document).ready(function () {
{/foreach}
</script>
<div id="add_specific_price" class="well" style="display: none;">
<div id="add_specific_price" class="well clearfix" style="display: none;">
<div class="col-lg-12">
<div class="form-group">
<label class="control-label col-lg-2" for="{if !$multi_shop}spm_currency_0{else}sp_id_shop{/if}">{l s='For'}</label>
@@ -536,7 +536,22 @@
</span>
</div>
</div>
{elseif $input.type == 'datetime'}
<div class="row">
<div class="input-group col-lg-4">
<input
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
type="text"
data-hex="true"
{if isset($input.class)}class="{$input.class}"
{else}class="datetimepicker"{/if}
name="{$input.name}"
value="{$fields_value[$input.name]|escape:'html':'UTF-8'}" />
<span class="input-group-addon">
<i class="icon-calendar-empty"></i>
</span>
</div>
</div>
{elseif $input.type == 'free'}
{$fields_value[$input.name]}
{/if}
@@ -680,6 +695,25 @@
nextText: '',
dateFormat: 'yy-mm-dd'
});
if ($(".datetimepicker").length > 0)
$('.datetimepicker').datetimepicker({
prevText: '',
nextText: '',
dateFormat: 'yy-mm-dd',
// Define a custom regional settings in order to use PrestaShop translation tools
currentText: '{l s='Now'}',
closeText: '{l s='Done'}',
ampm: false,
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
timeFormat: 'hh:mm:ss tt',
timeSuffix: '',
timeOnlyTitle: '{l s='Choose Time'}',
timeText: '{l s='Time'}',
hourText: '{l s='Hour'}',
minuteText: '{l s='Minute'}',
});
{if isset($use_textarea_autosize)}
$(".textarea-autosize").autosize();
{/if}
+6
View File
@@ -1966,12 +1966,18 @@ class AdminControllerCore extends Controller
$this->addJquery();
$this->addjQueryPlugin(array('cluetip', 'hoverIntent', 'scrollTo', 'alerts', 'chosen'));
$this->addJqueryUI(array(
'ui.slider',
'ui.datepicker'
));
$this->addJS(array(
_PS_JS_DIR_.'admin.js',
_PS_JS_DIR_.'toggle.js',
_PS_JS_DIR_.'tools.js',
_PS_JS_DIR_.'ajax.js',
_PS_JS_DIR_.'toolbar.js',
_PS_JS_DIR_.'jquery/plugins/timepicker/jquery-ui-timepicker-addon.js',
));
//loads specific javascripts for the admin theme, bootstrap.js should be moved into /js root directory
@@ -1294,8 +1294,6 @@ class AdminProductsControllerCore extends AdminController
'ui.core',
'ui.widget',
'ui.accordion',
'ui.slider',
'ui.datepicker'
));
$this->addjQueryPlugin(array(
@@ -1321,7 +1319,6 @@ class AdminProductsControllerCore extends AdminController
_PS_JS_DIR_.'jquery/plugins/treeview-categories/jquery.treeview-categories.edit.js',
_PS_JS_DIR_.'admin-categories-tree.js',
_PS_JS_DIR_.'jquery/ui/jquery.ui.progressbar.min.js',
_PS_JS_DIR_.'jquery/plugins/timepicker/jquery-ui-timepicker-addon.js',
_PS_JS_DIR_.'vendor/spin.js',
_PS_JS_DIR_.'vendor/ladda.js'
));
@@ -237,12 +237,12 @@ class AdminSpecificPriceRuleControllerCore extends AdminController
)
),
array(
'type' => 'date',
'type' => 'datetime',
'label' => $this->l('From'),
'name' => 'from'
),
array(
'type' => 'date',
'type' => 'datetime',
'label' => $this->l('To'),
'name' => 'to'
),