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
2271e62f
Commit
2271e62f
authored
Jun 23, 2015
by
Johannes Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
weekview finished
parent
d2eafd42
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
4 deletions
+27
-4
index.js
index.js
+2
-1
dateView.js
lib/dateView.js
+10
-3
test.html
test/test.html
+15
-0
No files found.
index.js
View file @
2271e62f
...
...
@@ -40,7 +40,8 @@ function getFull(info, now, cb) {
threeMonth
:
dateView
.
threeMonth
(
dataObj
,
now
),
isOpen
:
short
.
isOpen
,
text
:
short
.
text
,
status
:
short
.
status
status
:
short
.
status
,
weekView
:
dateView
.
weekViewData
(
dataObj
,
now
)
};
cb
(
null
,
res
);
})
...
...
lib/dateView.js
View file @
2271e62f
...
...
@@ -414,6 +414,7 @@ function formatTime(date) {
function
weekViewData
(
dataObj
,
now
)
{
const
DAY_FORMAT
=
"dd"
;
var
noOfDays
=
7
;
var
offset
=
now
.
getDay
()
-
1
;
...
...
@@ -452,10 +453,16 @@ function weekViewData(dataObj, now) {
var
dayLabels
=
[];
var
today
=
new
Date
(
now
.
getFullYear
(),
now
.
getMonth
(),
now
.
getDate
()).
getTime
();
console
.
log
(
today
);
var
oHours
=
rawHours
.
map
(
function
(
day
)
{
var
isToday
=
day
.
date
.
getTime
()
==
today
;
var
isTodayCls
=
isToday
?
" date-today"
:
""
;
var
labelText
=
moment
(
day
.
date
).
format
(
DAY_FORMAT
);
if
(
isToday
)
labelText
=
"Heute, "
+
labelText
;
dayLabels
.
push
({
class
:
"label-day-"
+
day
.
date
.
getDay
(),
text
:
moment
(
day
.
date
).
format
(
"dd Do MMMM"
)
class
:
"label-day-"
+
day
.
date
.
getDay
()
+
isTodayCls
,
text
:
labelText
});
var
date0
=
new
Date
(
day
.
date
);
date0
.
setHours
(
hourSpan
[
0
]);
...
...
@@ -466,7 +473,7 @@ function weekViewData(dataObj, now) {
var
height
=
(
elem
[
1
]
-
elem
[
0
])
/
dateDiff
;
var
top
=
(
elem
[
0
]
-
date0
)
/
dateDiff
;
return
{
class
:
"day-"
+
day
.
date
.
getDay
(),
class
:
"day-"
+
day
.
date
.
getDay
()
+
isTodayCls
,
top
:
100
*
top
.
toFixed
(
3
)
+
"%"
,
height
:
100
*
height
.
toFixed
(
3
)
+
"%"
,
text
:
formatTime
(
elem
[
0
])
+
timeSeparator
+
formatTime
(
elem
[
1
])
...
...
test/test.html
View file @
2271e62f
...
...
@@ -4,11 +4,18 @@
<meta
charset=
"UTF-8"
>
<title></title>
<style>
div
.outer-container
{
position
:
relative
;
background-color
:
#f1f1f1
;
width
:
500px
;
height
:
300px
;
}
div
.week.container
{
position
:
relative
;
background-color
:
#f1f1f1
;
width
:
500px
;
height
:
300px
;
left
:
10%
;
}
div
.week.container
table
{
border-collapse
:
collapse
;
...
...
@@ -32,9 +39,15 @@
left
:
0%
;
height
:
40%
;
}
div
.labels
{
width
:
20%
;
}
</style>
</head>
<body>
<div
class=
"outer-container"
>
<div
class=
"labels"
>
</div>
<div
class=
"week container"
>
<table
class=
"inner hori-lines"
>
<tr>
<td></td>
</tr>
...
...
@@ -63,5 +76,7 @@
</table>
<div
id=
"item"
>
asd
</div>
</div>
</div>
</body>
</html>
\ 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