more calendar improvements (labels etc.)

This commit is contained in:
rolux 2011-05-25 19:32:04 +02:00
parent c661f3a883
commit dc23259308
3 changed files with 31 additions and 8 deletions

View file

@ -17,7 +17,7 @@ Ox.load('UI', {debug: true, hideScreen: true, showScreen: true, theme: 'modern'}
{name: '14th Century', start: '1300', end: '1400', type: 'date'}, {name: '14th Century', start: '1300', end: '1400', type: 'date'},
{name: '15th Century', start: '1400', end: '1500', type: 'date'}, {name: '15th Century', start: '1400', end: '1500', type: 'date'},
{name: '15th Century', start: '1500', end: '1600', type: 'date'}, {name: '16th Century', start: '1500', end: '1600', type: 'date'},
{name: '17th Century', start: '1600', end: '1700', type: 'date'}, {name: '17th Century', start: '1600', end: '1700', type: 'date'},
{name: '18th Century', start: '1700', end: '1800', type: 'date'}, {name: '18th Century', start: '1700', end: '1800', type: 'date'},
{name: '19th Century', start: '1800', end: '1900', type: 'date'}, {name: '19th Century', start: '1800', end: '1900', type: 'date'},
@ -92,7 +92,7 @@ Ox.load('UI', {debug: true, hideScreen: true, showScreen: true, theme: 'modern'}
{name: 'Adolf Hitler', start: '1889-04-20', end: '1945-04-30', type: 'person'}, {name: 'Adolf Hitler', start: '1889-04-20', end: '1945-04-30', type: 'person'},
{name: 'Charles de Gaulle', start: '1890-11-22', end: '1970-11-09', type: 'person'}, {name: 'Charles de Gaulle', start: '1890-11-22', end: '1970-11-09', type: 'person'},
{name: 'Walter Benjamin', start: '1892-07-15', end: '1940-09-26', type: 'person'}, {name: 'Walter Benjamin', start: '1892-07-15', end: '1940-09-26', type: 'person'},
{name: 'Al Capione', start: '1899-01-17', end: '1947-01-25', type: 'person'}, {name: 'Al Capone', start: '1899-01-17', end: '1947-01-25', type: 'person'},
{name: 'Alfred Hitchcock', start: '1899-08-13', end: '1980-04-29', type: 'person'}, {name: 'Alfred Hitchcock', start: '1899-08-13', end: '1980-04-29', type: 'person'},
{name: 'Werner Heisenberg', start: '1901-12-05', end: '1976-02-01', type: 'person'}, {name: 'Werner Heisenberg', start: '1901-12-05', end: '1976-02-01', type: 'person'},
{name: 'Theodor W. Adorno', start: '1903-09-11', end: '1969-08-06', type: 'person'}, {name: 'Theodor W. Adorno', start: '1903-09-11', end: '1969-08-06', type: 'person'},
@ -112,6 +112,7 @@ Ox.load('UI', {debug: true, hideScreen: true, showScreen: true, theme: 'modern'}
{name: 'John Lennon', start: '1940-10-09', end: '1980-12-08', type: 'person'}, {name: 'John Lennon', start: '1940-10-09', end: '1980-12-08', type: 'person'},
{name: 'Jimi Hendrix', start: '1942-11-27', end: '1970-09-18', type: 'person'}, {name: 'Jimi Hendrix', start: '1942-11-27', end: '1970-09-18', type: 'person'},
{name: 'Jim Morrison', start: '1943-12-08', end: '1971-06-03', type: 'person'}, {name: 'Jim Morrison', start: '1943-12-08', end: '1971-06-03', type: 'person'},
{name: 'Osama bin Laden', start: '1957-03-10', end: '2011-05-02', type: 'person'},
{name: 'Michael Jackson', start: '1958-08-29', end: '2009-06-25', type: 'person'}, {name: 'Michael Jackson', start: '1958-08-29', end: '2009-06-25', type: 'person'},
{name: 'Lady Diana', start: '1961-07-01', end: '1997-08-31', type: 'person'}, {name: 'Lady Diana', start: '1961-07-01', end: '1997-08-31', type: 'person'},

View file

@ -138,11 +138,17 @@ Calendar
.OxCalendar .OxEvent { .OxCalendar .OxEvent {
position: absolute; position: absolute;
height: 16px; height: 15px;
padding-top: 1px;
text-overflow: ellipsis;
cursor: pointer;
overflow: hidden;
white-space: nowrap;
}
.OxCalendar .OxEvent .OxEventText {
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
cursor: pointer;
} }
.OxCalendar .OxLine > .OxEvent { .OxCalendar .OxLine > .OxEvent {
border-radius: 4px; border-radius: 4px;

View file

@ -584,8 +584,9 @@ Ox.Calendar = function(options, self) {
function getEventElement(event, zoom) { function getEventElement(event, zoom) {
var left = getPosition(event.start, zoom), var left = getPosition(event.start, zoom),
width = Math.max(getPosition(event.end, zoom) - left, 1); paddingLeft = (event.type && left < 0 ? -left : 0),
Ox.print(event) width = Math.max(getPosition(event.end, zoom) - left, 1) - paddingLeft;
//textLeft = (left < 0 ? -left : 0);
return new Ox.Element() return new Ox.Element()
.addClass('OxEvent' + .addClass('OxEvent' +
(event.type ? ' Ox' + Ox.toTitleCase(event.type) : '' ) + (event.type ? ' Ox' + Ox.toTitleCase(event.type) : '' ) +
@ -593,12 +594,27 @@ Ox.Calendar = function(options, self) {
) )
.css({ .css({
left: left + 'px', left: left + 'px',
width: width + 'px' width: width + 'px',
paddingLeft: paddingLeft + 'px'
}) })
.data({ .data({
id: event.id id: event.id
}) })
.html('&nbsp;' + event.name); .html('&nbsp;' + event.name + '&nbsp;')
/*
.append(
$('<div>')
.addClass('OxEventText')
.css({
position: 'absolute',
width: (width - 4) + 'px',
height: '12px',
padding: '2px',
paddingLeft: textLeft + 'px',
})
.html('&nbsp;' + event.name)
);
*/
} }
function getEventElementById(id) { function getEventElementById(id) {