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
Christopher M Reffett
whats-open
Commits
32c0ead5
Commit
32c0ead5
authored
Mar 24, 2013
by
Daniel Bond
Browse files
Merge branch 'master' of github.com:thallada/whats-open
parents
5db2114b
105f9dc5
Changes
4
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
32c0ead5
...
@@ -120,10 +120,21 @@ we do I will have instructions on how to deploy the code here.
...
@@ -120,10 +120,21 @@ we do I will have instructions on how to deploy the code here.
*
Get all restaurants displaying correct open times on the page. AKA. make
*
Get all restaurants displaying correct open times on the page. AKA. make
extensive tests.
extensive tests.
*
Sort by location view
*
Sort by location view
*
Get a decent UI
*
Get a decent UI (make sure everything is pretty and usable)
*
Get a usable admin interface UI, currently it is very confusing to add a
restaurant and schedule.
*
Add times until opening/closing for restaurants that are close, and exact
*
Add times until opening/closing for restaurants that are close, and exact
times for those that aren't.
times for those that aren't.
*
Add yellow close-to-closing condition.
*
Add yellow close-to-closing condition.
*
Possible: Make an API?
*
Make page refresh, or more preferably have the data refresh. For
example, with AJAX calls.
*
Create more useful API calls. Document them.
*
Allow switching between campuses. In the database, mark which campus each
restauraunt is on, include this information in the JSON object returned at
`ajax/schedule`
and store the campus choice in the user's cookies
so that when they come back the page will already be set to their campus.
Default would be Fairfax of course.
[
jquery-cookie
](
https://github.com/carhartl/jquery-cookie
)
would be useful
fo
[
jquery-cookie
](
https://github.com/carhartl/jquery-cookie
)
would be useful
for this.
*
Create a more user-friendly way of creating restaurants and updating
schedules on the admin site. This could be done by modifying the admin site
or creating our own Django forms and doing it outside the admin site.
website/static/css/style.css
View file @
32c0ead5
...
@@ -22,6 +22,7 @@ body {
...
@@ -22,6 +22,7 @@ body {
font-size
:
50px
;
font-size
:
50px
;
font-weight
:
900
;
font-weight
:
900
;
margin-top
:
30px
;
margin-top
:
30px
;
line-height
:
50px
;
}
}
#grid
div
[
class
*=
'span'
]
{
#grid
div
[
class
*=
'span'
]
{
...
@@ -50,6 +51,7 @@ body {
...
@@ -50,6 +51,7 @@ body {
.search-row
{
.search-row
{
text-align
:
center
;
text-align
:
center
;
padding-top
:
15px
;
}
}
ul
.ui-autocomplete
{
ul
.ui-autocomplete
{
list-style
:
none
;
list-style
:
none
;
...
...
website/static/js/grid.js
View file @
32c0ead5
function
sort_restaurants
(
restaurants
)
{
var
restaurants
=
[];
var
open
=
$
.
grep
(
restaurants
,
function
sort_restaurants
(
filtered_restaurants
)
{
var
open
=
$
.
grep
(
filtered_restaurants
,
function
(
r
,
idx
)
{
return
(
r
.
open
===
true
)
});
function
(
r
,
idx
)
{
return
(
r
.
open
===
true
)
});
var
closed
=
$
.
grep
(
restaurants
,
var
closed
=
$
.
grep
(
filtered_
restaurants
,
function
(
r
,
idx
)
{
return
(
r
.
open
===
false
)
});
function
(
r
,
idx
)
{
return
(
r
.
open
===
false
)
});
return
$
.
merge
(
open
,
closed
);
return
$
.
merge
(
open
,
closed
);
}
}
function
construct_grid
(
restaurants
)
{
function
construct_grid
(
filtered_restaurants
)
{
restaurants
=
sort_restaurants
(
restaurants
);
// Hide footer while generating grid to prevent it flying across the screen
$
.
each
(
restaurants
,
function
(
idx
,
restaurant
)
{
$
(
'
#footer
'
).
hide
();
$
(
'
#grid
'
).
empty
();
$
(
'
#grid
'
).
html
(
'
<div class="row"></div>
'
);
if
(
filtered_restaurants
.
length
==
0
)
{
$
(
'
#grid
'
).
append
(
'
<span class="span2 offset5">No results found.</span>
'
);
return
;
}
sorted_restaurants
=
sort_restaurants
(
filtered_restaurants
);
$
.
each
(
sorted_restaurants
,
function
(
idx
,
restaurant
)
{
var
open_class
=
'
closed
'
;
var
open_class
=
'
closed
'
;
if
(
restaurant
.
open
)
{
if
(
restaurant
.
open
)
{
open_class
=
'
opened
'
;
open_class
=
'
opened
'
;
...
@@ -25,16 +35,13 @@ function construct_grid(restaurants) {
...
@@ -25,16 +35,13 @@ function construct_grid(restaurants) {
);
);
}
}
});
});
$
(
'
#footer
'
).
show
();
}
}
$
.
ajax
({
$
.
ajax
({
url
:
'
/ajax/schedule/
'
,
url
:
'
/ajax/schedule/
'
,
}).
done
(
function
(
data
)
{
}).
done
(
function
(
data
)
{
// Hide footer while generating grid to prevent it flying across the screen
restaurants
=
data
.
data
;
$
(
'
#footer
'
).
hide
();
$
(
'
#grid
'
).
empty
();
$
(
'
#grid
'
).
html
(
'
<div class="row"></div>
'
);
var
restaurants
=
data
.
data
;
$
.
each
(
restaurants
,
function
(
idx
,
restaurant
)
{
$
.
each
(
restaurants
,
function
(
idx
,
restaurant
)
{
var
now
=
new
Date
();
var
now
=
new
Date
();
var
date
=
new
Date
().
setHours
(
0
,
0
,
0
,
0
);
var
date
=
new
Date
().
setHours
(
0
,
0
,
0
,
0
);
...
@@ -101,5 +108,4 @@ $.ajax({
...
@@ -101,5 +108,4 @@ $.ajax({
});
});
});
});
construct_grid
(
restaurants
);
construct_grid
(
restaurants
);
$
(
'
#footer
'
).
show
();
});
});
website/static/js/typeAhead.js
View file @
32c0ead5
...
@@ -2,38 +2,27 @@ $.ajax({
...
@@ -2,38 +2,27 @@ $.ajax({
url
:
'
/ajax/schedule/
'
,
url
:
'
/ajax/schedule/
'
,
}).
done
(
function
(
data
)
{
}).
done
(
function
(
data
)
{
//collecting list of restaurant names from server data
//collecting list of restaurant names from server data
var
rest
aurant
s
=
[];
var
rest
_name
s
=
[];
for
(
var
i
=
0
;
i
<
data
.
data
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
data
.
data
.
length
;
i
++
)
{
rest
aurant
s
.
push
(
data
.
data
[
i
].
name
);
rest
_name
s
.
push
(
data
.
data
[
i
].
name
);
};
};
//Monitors for keyboard activity to detect when the input field is empty
$
(
'
#searchBar
'
).
keyup
(
function
()
{
var
value
=
$
(
'
#searchBar
'
).
val
();
if
(
value
==
0
){
//resets all backgrounds to white if the search bar is empty
$
(
'
.open
'
).
css
(
'
background-color
'
,
'
white
'
);
$
(
'
.closed
'
).
css
(
'
background-color
'
,
'
white
'
);
}
});
// For doumentation on jQuery's autocomplete: (api.jqueryui.com/autocomplete)
// For doumentation on jQuery's autocomplete: (api.jqueryui.com/autocomplete)
$
(
"
#searchBar
"
).
autocomplete
({
$
(
"
#searchBar
"
).
autocomplete
({
source
:
rest
aurant
s
,
source
:
rest
_name
s
,
//making it so the search result list doesn't physically appear
//making it so the search result list doesn't physically appear
messages
:
{
messages
:
{
noResults
:
''
,
noResults
:
''
,
results
:
function
(){}
results
:
function
(){}
},
},
minLength
:
0
,
response
:
function
(
event
,
ui
)
{
response
:
function
(
event
,
ui
)
{
//resets all backgrounds to white if the search bar is edited
$
(
'
.open
'
).
css
(
'
background-color
'
,
'
white
'
);
$
(
'
.closed
'
).
css
(
'
background-color
'
,
'
white
'
);
//ui.content array contains all names that are returned from the search
//ui.content array contains all names that are returned from the search
for
(
var
result
in
ui
.
content
){
results
=
$
.
map
(
ui
.
content
,
function
(
r
)
{
return
r
.
value
;
});
//Highlights all search results
filtered
=
$
.
grep
(
restaurants
,
function
(
r
,
idx
)
{
$
(
'
.open:contains("
'
+
ui
.
content
[
result
].
value
+
'
")
'
).
css
(
'
background-color
'
,
'
#FDFFBF
'
);
return
(
$
.
inArray
(
r
.
name
,
results
)
!=
-
1
);
$
(
'
.closed:contains("
'
+
ui
.
content
[
result
].
value
+
'
")
'
).
css
(
'
background-color
'
,
'
#FDFFBF
'
);
}
);
}
construct_grid
(
filtered
);
// To prevent the page width from extending
// To prevent the page width from extending
$
(
'
.ui-autocomplete
'
).
remove
();
$
(
'
.ui-autocomplete
'
).
remove
();
}
}
...
...
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