Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
opening-hours
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
regionalkauf
opening-hours
Commits
4a12c8cd
Commit
4a12c8cd
authored
Aug 04, 2014
by
Johannes Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed two week view, weeks are now arranged vertically
parent
78cadac7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
23 deletions
+59
-23
dateView.js
lib/dateView.js
+59
-23
No files found.
lib/dateView.js
View file @
4a12c8cd
...
...
@@ -56,16 +56,12 @@ function createWeekView(dataObj, now) {
return
content
;
}
function
createWeekViewVertical
(
dataObj
,
now
,
noOfDays
,
flexibleLayout
,
className
)
{
function
createWeekViewVertical
Raw
(
dataObj
,
now
,
className
,
offset
,
addDayOfWeek
)
{
var
data
=
dataObj
.
intervals
;
var
holidays
=
dataObj
.
holidays
;
noOfDays
=
noOfDays
||
7
;
var
noOfDays
=
7
;
var
offset
;
if
(
flexibleLayout
)
{
offset
=
3
;
}
else
{
if
(
!
offset
)
{
offset
=
now
.
getDay
()
-
1
;
if
(
offset
<
0
)
offset
+=
7
;
}
...
...
@@ -73,11 +69,7 @@ function createWeekViewVertical(dataObj, now, noOfDays, flexibleLayout, classNam
var
startDate
=
new
Date
(
now
.
getFullYear
(),
now
.
getMonth
(),
now
.
getDate
()
-
offset
);
var
endDate
=
new
Date
(
now
.
getFullYear
(),
now
.
getMonth
(),
now
.
getDate
()
+
noOfDays
-
offset
);
var
oHours
=
transformData
(
data
,
startDate
,
endDate
);
var
maxNumber
=
getMaxNoOfItemsPerDay
(
oHours
);
var
tableWidth
=
maxNumber
;
var
content
=
'<div class="'
+
className
+
'-container"><table class="'
+
className
+
'-table">'
;
content
+=
'<tbody>'
;
var
maxItems
=
getMaxNoOfItemsPerDay
(
oHours
);
var
columns
=
[];
...
...
@@ -101,21 +93,46 @@ function createWeekViewVertical(dataObj, now, noOfDays, flexibleLayout, classNam
}
var
datString
=
formatDate
(
day
.
date
);
column
.
push
(
'<td class="'
+
className
+
'-td-first'
+
cls
+
'">'
+
datString
[
0
]
+
'</td>'
);
column
.
push
(
'<td class="'
+
className
+
'-td-date'
+
cls
+
'">'
+
datString
[
1
]
+
'</td>'
);
if
(
addDayOfWeek
)
{
column
.
push
(
'<td class="'
+
className
+
'-td-first'
+
cls
+
'">'
+
datString
[
0
]
+
'</td>'
);
column
.
push
(
'<td class="'
+
className
+
'-td-date'
+
cls
+
'">'
+
datString
[
1
]
+
'</td>'
);
}
else
{
column
.
push
(
'<td class="'
+
className
+
'-td-date2'
+
cls
+
'">'
+
datString
[
1
]
+
'</td>'
);
}
for
(
var
j
=
0
;
j
<
day
.
oHours
.
length
;
j
++
)
{
var
oHour
=
day
.
oHours
[
j
];
column
.
push
(
'<td class="'
+
className
+
'-td '
+
className
+
'-filled'
+
cls
+
'">'
+
formatTime
(
oHour
[
0
])
+
" – "
+
formatTime
(
oHour
[
1
])
+
'</td>'
);
}
for
(
var
j
=
day
.
oHours
.
length
;
j
<
tableWidth
;
j
++
)
{
for
(
var
j
=
day
.
oHours
.
length
;
j
<
maxItems
;
j
++
)
{
column
.
push
(
'<td class="'
+
className
+
'-td '
+
className
+
'-empty'
+
cls
+
'"></td>'
);
}
}
return
columns
;
}
function
createTwoWeekViewVertical
(
dataObj
,
now
)
{
var
className
=
'two-weekview-v'
;
var
columns
=
createWeekViewVerticalRaw
(
dataObj
,
now
,
className
,
3
,
true
);
var
columns2
=
createWeekViewVerticalRaw
(
dataObj
,
new
Date
(
now
.
getFullYear
(),
now
.
getMonth
(),
now
.
getDate
()
+
7
),
className
,
3
,
false
);
for
(
var
i
=
0
;
i
<
columns
.
length
;
i
++
)
{
columns
[
i
]
=
columns
[
i
].
concat
(
columns2
[
i
]);
}
for
(
var
j
=
0
;
j
<
tableWidth
+
2
;
j
++
)
{
var
content
=
'<div class="'
+
className
+
'-container"><table class="'
+
className
+
'-table">'
;
content
+=
'<tbody>'
;
var
jLim
=
columns
[
0
].
length
;
var
iLim
=
columns
.
length
;
for
(
var
j
=
0
;
j
<
jLim
;
j
++
)
{
content
+=
'<tr class="'
+
className
+
'-tr">'
;
for
(
var
i
=
0
;
i
<
noOfDays
;
i
++
)
{
for
(
var
i
=
0
;
i
<
iLim
;
i
++
)
{
content
+=
columns
[
i
][
j
];
}
content
+=
'</tr>'
;
...
...
@@ -125,6 +142,29 @@ function createWeekViewVertical(dataObj, now, noOfDays, flexibleLayout, classNam
content
+=
'</table></div>'
;
return
content
;
}
function
createWeekViewVertical
(
dataObj
,
now
)
{
var
className
=
'weekview-v'
;
var
columns
=
createWeekViewVerticalRaw
(
dataObj
,
now
,
className
,
null
,
true
);
var
content
=
'<div class="'
+
className
+
'-container"><table class="'
+
className
+
'-table">'
;
content
+=
'<tbody>'
;
var
jLim
=
columns
[
0
].
length
;
var
iLim
=
columns
.
length
;
for
(
var
j
=
0
;
j
<
jLim
;
j
++
)
{
content
+=
'<tr class="'
+
className
+
'-tr">'
;
for
(
var
i
=
0
;
i
<
iLim
;
i
++
)
{
content
+=
columns
[
i
][
j
];
}
content
+=
'</tr>'
;
}
content
+=
'</tbody>'
;
content
+=
'</table></div>'
;
return
content
;
}
function
dayInHolidays
(
day
,
holidays
)
{
for
(
var
i
=
0
;
i
<
holidays
.
length
;
i
++
)
{
...
...
@@ -342,12 +382,8 @@ function asString(data, now) {
module
.
exports
.
asString
=
asString
;
module
.
exports
.
weekView
=
createWeekView
;
module
.
exports
.
weekViewV
=
function
(
dataObj
,
now
)
{
return
createWeekViewVertical
(
dataObj
,
now
,
7
,
false
,
'weekview-v'
);
};
module
.
exports
.
twoWeekViewV
=
function
(
dataObj
,
now
)
{
return
createWeekViewVertical
(
dataObj
,
now
,
14
,
true
,
'two-weekview-v'
);
};
module
.
exports
.
weekViewV
=
createWeekViewVertical
;
module
.
exports
.
twoWeekViewV
=
createTwoWeekViewVertical
;
module
.
exports
.
monthView
=
create3MonthView
;
module
.
exports
.
getView
=
getView
;
module
.
exports
.
getPropperEpochSpan
=
getPropperEpochSpan
;
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment