Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zoheb Lokhandwala
whats-open
Commits
26ce5df5
Commit
26ce5df5
authored
Sep 22, 2013
by
Renfred Harper
Browse files
Add grid info functionality to grid.js
parent
4dee6365
Changes
1
Hide whitespace changes
Inline
Side-by-side
website/static/js/grid.js
View file @
26ce5df5
...
...
@@ -126,3 +126,39 @@ $.ajax({
}
},
1000
);
});
$
(
document
).
ready
(
function
()
{
var
lastClicked
=
null
;
$
(
'
#info-body
'
).
click
(
function
()
{
$
(
this
).
slideUp
(
350
);
});
$
(
document
).
on
(
'
click
'
,
'
.grid-box
'
,
function
()
{
// If the user clicks on the same box twice it will close the info menu
grid_id
=
$
(
this
).
attr
(
'
id
'
);
if
(
lastClicked
==
grid_id
){
$
(
'
#info-body
'
).
slideToggle
(
300
)
}
else
{
$
(
'
#info-body
'
).
slideDown
(
300
);
lastClicked
=
grid_id
;
}
// 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
;
}
});
// Display restaurant info in the info-body
$
(
'
#info-name
'
).
text
(
restaurant
.
name
);
if
(
restaurant
.
open
){
$
(
'
#info-status
'
).
html
(
'
<b>Status:</b> Open
'
);
var
closing
=
Date
.
parse
(
restaurant
.
current
.
end_time
);
$
(
'
#info-next
'
).
html
(
'
<b>Open Till:</b>
'
+
closing
.
toLocaleTimeString
().
replace
(
/:
\d
+ /
,
'
'
));
}
else
{
$
(
'
#info-status
'
).
html
(
'
<b>Status:</b> Closed
'
);
$
(
'
#info-next
'
).
html
(
""
);
}
});
});
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