Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: aliss/gapp
base: ec8c6a6e62
...
head fork: aliss/gapp
compare: fd286c36fd
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 29 additions and 6 deletions.
  1. +3 −3 index.html
  2. +26 −3 js/gapp.js
6 index.html
View
@@ -166,7 +166,7 @@ <h3 class="span-5 last">Saved searches</h3>
<p class="pagination span-18 last">
<span class="span-3 select_all">
- <input type="checkbox" class="result-select" name="resources-all" id="select_all" value="1" />
+ <input type="checkbox" class="result-select select_all" name="resources-all" value="1" />
<label for="select_all">Select All</label>
</span>
<span class="span-8 prepend-1 last">
@@ -191,7 +191,7 @@ <h3 class="span-5 last">Saved searches</h3>
<% var counter = start; _.each(resources, function(resource) { %>
<% counter++; %>
<% var desc = resource.description; %>
- <h3><input type="checkbox" class="result-select" name="resources[]" value="<%= resource.id %>" /> <%= counter %>. <%= resource.title %></h3>
+ <h3><input type="checkbox" class="result_individual result-select" name="resources[]" value="<%= resource.id %>" /> <%= counter %>. <%= resource.title %></h3>
<span class="truncate"><%= desc %>&hellip;</span>
<p><a href="#" class="detail" data-id="<%= resource.id %>">View details</a></p>
<hr/>
@@ -201,7 +201,7 @@ <h3 class="span-5 last">Saved searches</h3>
<p class="pagination span-18 last">
<span class="span-3 select_all">
- <input type="checkbox" class="result-select" name="resources-all" id="select_all" value="1" />
+ <input type="checkbox" class="result-select select_all" name="resources-all" value="1" />
<label for="select_all">Select All</label>
</span>
<span class="span-8 prepend-1 last">
29 js/gapp.js
View
@@ -21,7 +21,7 @@ $(function(){
var BaseModel = Backbone.Model.extend({
cache: true,
- cache_time: 120,
+ cache_time: 600,
queryData: {},
currentQueryData: {},
@@ -39,7 +39,7 @@ $(function(){
var BaseCollection = Backbone.Collection.extend({
cache: true,
- cache_time: 120,
+ cache_time: 600,
queryData: {},
currentQueryData: {},
@@ -381,7 +381,9 @@ $(function(){
'click .next': 'nextPage',
'click .previous': 'previousPage',
'click .first': 'firstPage',
- 'click .detail': 'showResource'
+ 'click .detail': 'showResource',
+ 'click input.select_all': 'selectAll',
+ 'click input.result_individual': 'resultSelect'
},
results: new ResourceCollection(),
@@ -419,6 +421,13 @@ $(function(){
search: function(){
this.showLoading()
+ var query = $('#id_query').val(), location = $('#id_location').val()
+
+ if(location){
+ this.router.navigate("!/search/" + query + "/" + location)
+ } else {
+ this.router.navigate("!/search/" + query)
+ }
this.results.fetch({data:$('#search_form').serializeHash()})
},
@@ -514,6 +523,20 @@ $(function(){
return false
},
+ selectAll: function(e){
+ var checked = $(e.currentTarget).is(":checked");
+ $('input.result-select').attr('checked', checked);
+ },
+
+ resultSelect: function(e){
+
+ var checked = $(e.currentTarget).is(":checked");
+ if(!checked){
+ $('input.select_all').attr('checked', checked);
+ }
+
+ },
+
render: function(template){
$('#resourceView').hide()

No commit comments for this range

Something went wrong with that request. Please try again.