mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-11 00:18:25 +01:00
Move calendar icon inside input box
This commit is contained in:
parent
d486e50a57
commit
f512d1efae
@ -179,6 +179,9 @@ span.et2_date {
|
|||||||
}
|
}
|
||||||
span.et2_date input.et2_date {
|
span.et2_date input.et2_date {
|
||||||
min-width: 10ex;
|
min-width: 10ex;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: top right;
|
||||||
|
background-size: contain;
|
||||||
}
|
}
|
||||||
span.et2_date span {
|
span.et2_date span {
|
||||||
background-position: center;
|
background-position: center;
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
egw_core;
|
egw_core;
|
||||||
egw_preferences;
|
egw_preferences;
|
||||||
egw_jquery;
|
egw_jquery;
|
||||||
|
egw_css;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
|
egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
|
||||||
@ -34,17 +35,17 @@ egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
|
|||||||
var first_day_pref = _egw.preference("weekdaystarts","calendar");
|
var first_day_pref = _egw.preference("weekdaystarts","calendar");
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'dateformat': dateformat,
|
'dateFormat': dateformat,
|
||||||
'firstDay': first_day_pref ? first_day[first_day_pref] : 0
|
'firstDay': first_day_pref ? first_day[first_day_pref] : 0
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
function setupCalendar(_egw, _input, _time, _callback, _context)
|
function setupCalendar(_egw, _input, _time, _callback, _context)
|
||||||
{
|
{
|
||||||
var prefs = calendarPreferences(_egw);
|
var prefs = calendarPreferences(_egw);
|
||||||
|
|
||||||
var params = {
|
var params = {
|
||||||
dateFormat: prefs.dateformat,
|
dateFormat: prefs.dateFormat,
|
||||||
firstDay: prefs.firstDay,
|
firstDay: prefs.firstDay,
|
||||||
|
|
||||||
autoSize: true,
|
autoSize: true,
|
||||||
@ -53,18 +54,7 @@ egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
|
|||||||
selectOtherMonths: true,
|
selectOtherMonths: true,
|
||||||
showWeek: true, // Week numbers
|
showWeek: true, // Week numbers
|
||||||
changeMonth: true, // Month selectbox
|
changeMonth: true, // Month selectbox
|
||||||
changeYear: true, // Year selectbox
|
changeYear: true // Year selectbox
|
||||||
|
|
||||||
// Trigger button
|
|
||||||
showOn: "both",
|
|
||||||
buttonImage: _egw.image('datepopup','phpgwapi'),
|
|
||||||
buttonImageOnly: true,
|
|
||||||
|
|
||||||
nextText: _egw.lang('Next'),
|
|
||||||
currentText: _egw.lang('today'),
|
|
||||||
prevText: _egw.lang('Prev'),
|
|
||||||
closeText: _egw.lang('Done'),
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the preferences
|
// Get the preferences
|
||||||
@ -83,33 +73,77 @@ egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Translate (after initialize has its way)
|
*/
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translate, and set as default values
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function translate() {
|
||||||
var translate_fields = {
|
var translate_fields = {
|
||||||
|
// These ones are simple strings
|
||||||
|
"nextText": false,
|
||||||
|
"currentText": false,
|
||||||
|
"prevText": false,
|
||||||
|
"closeText": false,
|
||||||
|
|
||||||
|
// These ones are arrays.
|
||||||
|
// Integers are length. If lang() has no short translation, just trim full
|
||||||
"dayNames": false,
|
"dayNames": false,
|
||||||
"dayNamesShort":3,
|
"dayNamesShort":3,
|
||||||
"dayNamesMin": 2,
|
"dayNamesMin": 2,
|
||||||
"monthNames": false,
|
"monthNames": false,
|
||||||
"monthNamesShort": 3
|
"monthNamesShort": 3
|
||||||
}
|
}
|
||||||
|
var regional = {};
|
||||||
var full = [];
|
var full = [];
|
||||||
for(var i in translate_fields)
|
for(var i in translate_fields)
|
||||||
{
|
{
|
||||||
var trans = this.input_date.datepicker("option",i);
|
var trans = jQuery.datepicker._defaults[i];
|
||||||
// Keep the full one for missing short ones
|
if(typeof trans === 'string')
|
||||||
|
{
|
||||||
|
trans = egw().lang(trans);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
for(var key in trans) {
|
for(var key in trans) {
|
||||||
if(translate_fields[i] === false)
|
if(translate_fields[i] === false)
|
||||||
{
|
{
|
||||||
trans[key] = this.egw().lang(trans[key]);
|
trans[key] = egw().lang(trans[key]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
trans[key] = full[key].substr(0,translate_fields[i]);
|
trans[key] = full[key].substr(0,translate_fields[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Keep the full one for missing short ones
|
||||||
if(translate_fields[i] === false) full = trans;
|
if(translate_fields[i] === false) full = trans;
|
||||||
node.datepicker("option",i,trans);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
regional[i] = trans;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set some non-lang defaults too
|
||||||
|
/*
|
||||||
|
var prefs = calendarPreferences(egw());
|
||||||
|
for(var i in prefs)
|
||||||
|
{
|
||||||
|
regional[i] = prefs[i];
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
jQuery.datepicker.setDefaults(regional);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
This should be global, static, run once, but adding this part breaks egw's js juggling
|
||||||
|
*/
|
||||||
|
var css = this.module('css',_wnd);
|
||||||
|
css.css(".et2_date input.et2_date", "background-image: url(" + egw().image('datepopup') + ")");
|
||||||
|
/*
|
||||||
|
var ready = this.module('ready', _wnd);
|
||||||
|
ready.ready(translate,this);
|
||||||
|
*/
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user