Merge branch 'bootstrap' of https://github.com/PrestaShop/PrestaShop into bootstrap

This commit is contained in:
Kevin Granger
2013-10-17 14:01:50 +02:00
5 changed files with 38 additions and 28 deletions
@@ -22,7 +22,7 @@
var click, switched, val, start, end, over, compare, startCompare, endCompare; var click, switched, val, start, end, over, compare, startCompare, endCompare;
// Picker object // Picker object
var Datepicker = function(element, options){ var DateRangePicker = function(element, options){
this.element = $(element); this.element = $(element);
compare = false; compare = false;
@@ -100,8 +100,8 @@
this.showMode(); this.showMode();
}; };
Datepicker.prototype = { DateRangePicker.prototype = {
constructor: Datepicker, constructor: DateRangePicker,
show: function(e) { show: function(e) {
this.picker.show(); this.picker.show();
@@ -112,7 +112,7 @@
} }
var that = this; var that = this;
$(document).on('mousedown', function(ev){ $(document).on('mousedown', function(ev){
if ($(ev.target).closest('.datepicker').length === 0) { if ($(ev.target).closest('.daterangepicker').length === 0) {
that.hide(); that.hide();
} }
}); });
@@ -199,7 +199,7 @@
html += '<th class="dow">'+DPGlobal.dates.daysMin[(dowCnt++)%7]+'</th>'; html += '<th class="dow">'+DPGlobal.dates.daysMin[(dowCnt++)%7]+'</th>';
} }
html += '</tr>'; html += '</tr>';
this.picker.find('.datepicker-days thead').append(html); this.picker.find('.daterangepicker-days thead').append(html);
}, },
fillMonths: function(){ fillMonths: function(){
@@ -208,7 +208,7 @@
while (i < 12) { while (i < 12) {
html += '<span class="month">'+DPGlobal.dates.monthsShort[i++]+'</span>'; html += '<span class="month">'+DPGlobal.dates.monthsShort[i++]+'</span>';
} }
this.picker.find('.datepicker-months td').append(html); this.picker.find('.daterangepicker-months td').append(html);
}, },
fill: function() { fill: function() {
@@ -216,7 +216,7 @@
year = d.getFullYear(), year = d.getFullYear(),
month = d.getMonth(), month = d.getMonth(),
currentDate = this.date.valueOf(); currentDate = this.date.valueOf();
this.picker.find('.datepicker-days th:eq(1)') this.picker.find('.daterangepicker-days th:eq(1)')
.text(year+' / '+DPGlobal.dates.months[month]); .text(year+' / '+DPGlobal.dates.months[month]);
var prevMonth = new Date(year, month-1, 28,0,0,0,0), var prevMonth = new Date(year, month-1, 28,0,0,0,0),
day = DPGlobal.getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth()); day = DPGlobal.getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth());
@@ -250,10 +250,10 @@
} }
prevMonth.setDate(prevMonth.getDate()+1); prevMonth.setDate(prevMonth.getDate()+1);
} }
this.picker.find('.datepicker-days tbody').empty().append(html.join('')); this.picker.find('.daterangepicker-days tbody').empty().append(html.join(''));
var currentYear = this.date.getFullYear(); var currentYear = this.date.getFullYear();
var months = this.picker.find('.datepicker-months') var months = this.picker.find('.daterangepicker-months')
.find('th:eq(1)') .find('th:eq(1)')
.text(year) .text(year)
.end() .end()
@@ -264,7 +264,7 @@
html = ''; html = '';
year = parseInt(year/10, 10) * 10; year = parseInt(year/10, 10) * 10;
var yearCont = this.picker.find('.datepicker-years') var yearCont = this.picker.find('.daterangepicker-years')
.find('th:eq(1)') .find('th:eq(1)')
.text(year + '-' + (year + 9)) .text(year + '-' + (year + 9))
.end() .end()
@@ -617,28 +617,28 @@
if (dir) if (dir)
this.viewMode = Math.max(this.minViewMode, Math.min(2, this.viewMode + dir)); this.viewMode = Math.max(this.minViewMode, Math.min(2, this.viewMode + dir));
this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show(); this.picker.find('>div').hide().filter('.daterangepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
} }
}; };
$.fn.datepicker = function ( option, val ) { $.fn.daterangepicker = function ( option, val ) {
return this.each(function () { return this.each(function () {
var $this = $(this), var $this = $(this),
data = $this.data('datepicker'), data = $this.data('daterangepicker'),
options = typeof option === 'object' && option; options = typeof option === 'object' && option;
if (!data) { if (!data) {
$this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults,options)))); $this.data('daterangepicker', (data = new DateRangePicker(this, $.extend({}, $.fn.daterangepicker.defaults,options))));
} }
if (typeof option === 'string') { data[option](val);} if (typeof option === 'string') { data[option](val);}
}); });
}; };
$.fn.datepicker.defaults = { $.fn.daterangepicker.defaults = {
onRender: function() { onRender: function() {
return ''; return '';
} }
}; };
$.fn.datepicker.Constructor = Datepicker; $.fn.daterangepicker.Constructor = DateRangePicker;
var DPGlobal = { var DPGlobal = {
modes: [ modes: [
@@ -743,20 +743,20 @@
'</thead>', '</thead>',
contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>' contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>'
}; };
DPGlobal.template = '<div class="datepicker">'+ DPGlobal.template = '<div class="daterangepicker">'+
'<div class="datepicker-days">'+ '<div class="daterangepicker-days">'+
'<table class=" table-condensed">'+ '<table class=" table-condensed">'+
DPGlobal.headTemplate+ DPGlobal.headTemplate+
'<tbody></tbody>'+ '<tbody></tbody>'+
'</table>'+ '</table>'+
'</div>'+ '</div>'+
'<div class="datepicker-months">'+ '<div class="daterangepicker-months">'+
'<table class="table-condensed">'+ '<table class="table-condensed">'+
DPGlobal.headTemplate+ DPGlobal.headTemplate+
DPGlobal.contTemplate+ DPGlobal.contTemplate+
'</table>'+ '</table>'+
'</div>'+ '</div>'+
'<div class="datepicker-years">'+ '<div class="daterangepicker-years">'+
'<table class="table-condensed">'+ '<table class="table-condensed">'+
DPGlobal.headTemplate+ DPGlobal.headTemplate+
DPGlobal.contTemplate+ DPGlobal.contTemplate+
@@ -18,13 +18,13 @@
<div class="col-xs-6"> <div class="col-xs-6">
<div class="input-group"> <div class="input-group">
<label class="input-group-addon">{if isset($translations.From)}{$translations.From}{else}{l s='From:'}{/if}</label> <label class="input-group-addon">{if isset($translations.From)}{$translations.From}{else}{l s='From:'}{/if}</label>
<input type="text" name="datepickerFrom" id="datepickerFrom" value="{$datepickerFrom|escape}" class="form-control datepicker"> <input type="text" name="datepickerFrom" id="datepickerFrom" value="{$datepickerFrom|escape}" class="form-control">
</div> </div>
</div> </div>
<div class="col-xs-6"> <div class="col-xs-6">
<div class="input-group"> <div class="input-group">
<label class="input-group-addon">{if isset($translations.To)}{$translations.To}{else}{l s='From:'}{/if}</label> <label class="input-group-addon">{if isset($translations.To)}{$translations.To}{else}{l s='From:'}{/if}</label>
<input type="text" name="datepickerTo" id="datepickerTo" value="{$datepickerTo|escape}" class="datepicker form-control"> <input type="text" name="datepickerTo" id="datepickerTo" value="{$datepickerTo|escape}" class="form-control">
</div> </div>
</div> </div>
</div> </div>
@@ -1,4 +1,4 @@
<div id="datepicker" class="datepicker-days"> <div id="datepicker" class="daterangepicker-days">
<div class="row"> <div class="row">
{if $is_rtl} {if $is_rtl}
<div class="col-sm-6 col-lg-4"> <div class="col-sm-6 col-lg-4">
@@ -180,7 +180,7 @@
}; };
{literal} {literal}
var datepickerStart = $('.datepicker1').datepicker({ var datepickerStart = $('.datepicker1').daterangepicker({
"dates": translated_dates, "dates": translated_dates,
"weekStart": 1, "weekStart": 1,
"start": $("#date-start").val(), "start": $("#date-start").val(),
@@ -189,9 +189,9 @@
if (ev.date.valueOf() >= datepickerEnd.date.valueOf()){ if (ev.date.valueOf() >= datepickerEnd.date.valueOf()){
datepickerEnd.setValue(ev.date.setMonth(ev.date.getMonth()+1)); datepickerEnd.setValue(ev.date.setMonth(ev.date.getMonth()+1));
} }
}).data('datepicker'); }).data('daterangepicker');
var datepickerEnd = $('.datepicker2').datepicker({ var datepickerEnd = $('.datepicker2').daterangepicker({
"dates": translated_dates, "dates": translated_dates,
"weekStart": 1, "weekStart": 1,
"start": $("#date-start").val(), "start": $("#date-start").val(),
@@ -200,7 +200,7 @@
if (ev.date.valueOf() <= datepickerStart.date.valueOf()){ if (ev.date.valueOf() <= datepickerStart.date.valueOf()){
datepickerStart.setValue(ev.date.setMonth(ev.date.getMonth()-1)); datepickerStart.setValue(ev.date.setMonth(ev.date.getMonth()-1));
} }
}).data('datepicker'); }).data('daterangepicker');
$("#date-start").focus(function() { $("#date-start").focus(function() {
datepickerStart.setCompare(false); datepickerStart.setCompare(false);
@@ -42,7 +42,7 @@ class AdminDashboardControllerCore extends AdminController
$admin_webpath = str_ireplace(_PS_ROOT_DIR_, '', _PS_ADMIN_DIR_); $admin_webpath = str_ireplace(_PS_ROOT_DIR_, '', _PS_ADMIN_DIR_);
$admin_webpath = preg_replace('/^'.preg_quote(DIRECTORY_SEPARATOR, '/').'/', '', $admin_webpath); $admin_webpath = preg_replace('/^'.preg_quote(DIRECTORY_SEPARATOR, '/').'/', '', $admin_webpath);
parent::setMedia(); parent::setMedia();
//$this->addJqueryUI('ui.datepicker'); $this->addJqueryUI('ui.datepicker');
$this->addJS(array( $this->addJS(array(
_PS_JS_DIR_.'/vendor/d3.js', _PS_JS_DIR_.'/vendor/d3.js',
__PS_BASE_URI__.$admin_webpath.'/themes/'.$this->bo_theme.'/js/vendor/nv.d3.min.js', __PS_BASE_URI__.$admin_webpath.'/themes/'.$this->bo_theme.'/js/vendor/nv.d3.min.js',
@@ -245,6 +245,16 @@ class AdminModulesPositionsControllerCore extends AdminController
)); ));
} }
public function initPageHeaderToolbar()
{
$this->page_header_toolbar_btn['save'] = array(
'href' => self::$currentIndex.'&addToHook'.($this->display_key ? '&show_modules='.$this->display_key : '').'&token='.$this->token,
'desc' => $this->l('Transplant a module')
);
return parent::initPageHeaderToolbar();
}
public function initMain() public function initMain()
{ {
// Init toolbar // Init toolbar