Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
whats-open
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Zoheb Lokhandwala
whats-open
Commits
3399856a
Commit
3399856a
authored
Nov 24, 2013
by
Renfred Harper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for special schedules to be displayed in info container
parent
18670825
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
42 deletions
+47
-42
website/static/js/grid.js
website/static/js/grid.js
+1
-0
website/static/js/info.js
website/static/js/info.js
+46
-42
No files found.
website/static/js/grid.js
View file @
3399856a
...
...
@@ -76,6 +76,7 @@ function update_grid(restaurants) {
if
(
schedule
===
undefined
)
{
schedule
=
restaurant
.
main_schedule
;
}
restaurant
.
current_schedule
=
schedule
;
// Open the restaurants that are open, leave the rest closed.
$
.
each
(
schedule
.
open_times
,
function
(
idx
,
time
)
{
var
start_day
=
time
.
start_day
;
...
...
website/static/js/info.js
View file @
3399856a
...
...
@@ -12,38 +12,7 @@ function compareTimes(time1, time2){
return
true
;
}
days
=
{
0
:
"
Mon
"
,
1
:
"
Tues
"
,
2
:
"
Wed
"
,
3
:
"
Thu
"
,
4
:
"
Fri
"
,
5
:
"
Sat
"
,
6
:
"
Sun
"
}
$
(
document
).
ready
(
function
()
{
var
lastClicked
=
null
;
$
(
'
#info-body
'
).
click
(
function
()
{
// Only allow closing the info pane via click on larger screens
if
(
$
(
window
).
width
()
>=
992
)
{
$
(
this
).
slideUp
(
350
);
}
});
// Displays more info about a restaurant on-click
$
(
document
).
on
(
'
click
'
,
'
.grid-box
'
,
function
()
{
grid_id
=
$
(
this
).
attr
(
'
id
'
);
// Keep track of the users vertical position so it can be scolled back
//to when the window is closed
position
=
$
(
window
).
scrollTop
();
// Search though the restaurnts object to find the selected restaurant's info
var
restaurant
;
$
.
each
(
restaurants
,
function
(
idx
,
restaurant_i
)
{
if
(
restaurant_i
.
id
==
grid_id
)
{
restaurant
=
restaurant_i
;
return
false
;
}
});
function
dispalyInfo
(
restaurant
)
{
// Display restaurant info in the info-body without bracketed locations
$
(
'
#info-name
'
).
text
(
restaurant
.
name
.
replace
(
/
?\[(
.+
)\]
/
,
''
));
if
(
restaurant
.
location
!==
null
){
...
...
@@ -54,7 +23,7 @@ $(document).ready(function() {
}
if
(
restaurant
.
open
){
$
(
'
#info-status
'
).
html
(
'
<b>Status:</b> Open
'
);
var
closing
=
Date
.
parse
(
restaurant
.
current
.
end_time
);
var
closing
=
Date
.
parse
(
restaurant
.
current_time
.
end_time
);
// Print the time the restaurant closes in local format with the seconds removed via regex
$
(
'
#info-next
'
).
html
(
'
<b>Open Till:</b>
'
+
closing
.
toLocaleTimeString
().
replace
(
/
(\d
+:
\d{2})(
:
\d
+
)
/
,
"
$1
"
)).
show
();
}
...
...
@@ -63,7 +32,7 @@ $(document).ready(function() {
$
(
'
#info-next
'
).
empty
().
hide
()
}
// Display all open times for the main schedule
var
open_times
=
restaurant
.
main
_schedule
.
open_times
;
var
open_times
=
restaurant
.
current
_schedule
.
open_times
;
var
element
=
''
;
$
(
'
#info-schedule
'
).
empty
();
for
(
var
i
=
0
;
i
<
open_times
.
length
;
i
++
){
...
...
@@ -86,6 +55,41 @@ $(document).ready(function() {
element
=
''
;
}
}
}
days
=
{
0
:
"
Mon
"
,
1
:
"
Tues
"
,
2
:
"
Wed
"
,
3
:
"
Thu
"
,
4
:
"
Fri
"
,
5
:
"
Sat
"
,
6
:
"
Sun
"
}
$
(
document
).
ready
(
function
()
{
var
lastClicked
=
null
;
$
(
'
#info-body
'
).
click
(
function
()
{
// Only allow closing the info pane via click on larger screens
if
(
$
(
window
).
width
()
>=
992
)
{
$
(
this
).
slideUp
(
350
);
}
});
// Displays more info about a restaurant on-click
$
(
document
).
on
(
'
click
'
,
'
.grid-box
'
,
function
()
{
grid_id
=
$
(
this
).
attr
(
'
id
'
);
// Keep track of the users vertical position so it can be scolled back
//to when the window is closed
position
=
$
(
window
).
scrollTop
();
// Search though the restaurnts object to find the selected restaurant's info
var
restaurant
;
$
.
each
(
restaurants
,
function
(
idx
,
restaurant_i
)
{
if
(
restaurant_i
.
id
==
grid_id
)
{
restaurant
=
restaurant_i
;
return
false
;
}
});
dispalyInfo
(
restaurant
);
// If the user clicks on the same box twice it will close the info menu
if
(
lastClicked
==
grid_id
){
$
(
'
#info-body
'
).
slideToggle
(
300
)
...
...
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