diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/request_game_controller.rb | 3 | ||||
-rw-r--r-- | app/models/info_request.rb | 7 | ||||
-rw-r--r-- | app/models/outgoing_message.rb | 2 | ||||
-rw-r--r-- | app/views/request/_request_listing_single.html.erb | 18 | ||||
-rw-r--r-- | app/views/request_game/play.html.erb | 24 |
5 files changed, 31 insertions, 23 deletions
diff --git a/app/controllers/request_game_controller.rb b/app/controllers/request_game_controller.rb index 298818bc7..7eadc1204 100644 --- a/app/controllers/request_game_controller.rb +++ b/app/controllers/request_game_controller.rb @@ -13,7 +13,8 @@ class RequestGameController < ApplicationController @total = InfoRequest.count @done = @total - @missing @percentage = (@done.to_f / @total.to_f * 10000).round / 100.0 - @requests = InfoRequest.get_random_old_unclassified(3, :conditions => ["prominence = 'normal'"]) + @requests = InfoRequest.includes(:public_body, :user).get_random_old_unclassified(3, :conditions => ["prominence = 'normal'"]) + if @missing == 0 flash[:notice] = _('<p>All done! Thank you very much for your help.</p><p>There are <a href="{{helpus_url}}">more things you can do</a> to help {{site_name}}.</p>', diff --git a/app/models/info_request.rb b/app/models/info_request.rb index fd42ccd9c..245de1e15 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -803,11 +803,8 @@ public # Text from the the initial request, for use in summary display def initial_request_text - if outgoing_messages.empty? # mainly for use with incomplete fixtures - return "" - end - excerpt = self.outgoing_messages[0].get_text_for_indexing - return excerpt + return '' if outgoing_messages.empty? # mainly for use with incomplete fixtures + outgoing_messages.first.get_text_for_indexing end # Returns index of last event which is described or nil if none described. diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb index fa83c7381..c2c8ef4f2 100644 --- a/app/models/outgoing_message.rb +++ b/app/models/outgoing_message.rb @@ -302,7 +302,7 @@ class OutgoingMessage < ActiveRecord::Base end def set_default_letter - self.body = get_default_message if body.nil? + self.body = get_default_message if raw_body.nil? end def format_of_body diff --git a/app/views/request/_request_listing_single.html.erb b/app/views/request/_request_listing_single.html.erb index 50f889d75..0f1d7f4ef 100644 --- a/app/views/request/_request_listing_single.html.erb +++ b/app/views/request/_request_listing_single.html.erb @@ -2,14 +2,20 @@ <span class="head"> <%= link_to h(info_request.title), (@play_urls ? categorise_request_path(:url_title => info_request.url_title) : request_path(info_request)) %> </span> + <span class="desc"> <%= excerpt(info_request.initial_request_text, "", :radius => 150) %> - </span> - <span class="bottomline icon_<%= info_request.calculate_status %>"> - <strong> + </span> + + <span class="bottomline icon_<%= info_request.calculate_status %>"> + <strong> <%= info_request.display_status %> - </strong><br> - <%= _('Requested from {{public_body_name}} by {{info_request_user}} on {{date}}',:public_body_name=>public_body_link(info_request.public_body),:info_request_user=>user_link(info_request.user),:date=>simple_date(info_request.created_at)) %> - </span> + </strong> + <br> + <%= _('Requested from {{public_body_name}} by {{info_request_user}} on {{date}}', + :public_body_name => public_body_link(info_request.public_body), + :info_request_user => user_link(info_request.user), + :date => simple_date(info_request.created_at)) %> + </span> </div> diff --git a/app/views/request_game/play.html.erb b/app/views/request_game/play.html.erb index 544274e93..471a0e09e 100644 --- a/app/views/request_game/play.html.erb +++ b/app/views/request_game/play.html.erb @@ -5,43 +5,47 @@ <img width=250 height=125 src="http://chart.apis.google.com/chart?chs=250x125&cht=gom&chd=t:<%=@percentage%>" alt="<%=@percentage%>% of requests have been categorised"> <br><%=pluralize(@missing, 'request')%> left to categorise / <%=@total %> total </p> + <h2>Top recent players</h2> <table> - <% c = 0; for classifications in @league_table_28_days %> + <% @league_table_28_days.each_with_index do |classifications, index| %> <tr> - <td> <%= c += 1 %>. <td> + <td> <%= index += 1 %>. <td> <td> <%= user_link(classifications.user) %> </td> - <td> <%=pluralize(classifications.cnt, 'request').gsub(" ", " ").html_safe %> </td> + <td> <%= pluralize(classifications.cnt, 'request').gsub(" ", " ").html_safe %> </td> </tr> <% end %> </table> <h2>All time best players</h2> <table> - <% c = 0; for classifications in @league_table_all_time %> + <% @league_table_all_time.each_with_index do |classifications, index| %> <tr> - <td> <%= c += 1 %>. <td> + <td> <%= index += 1 %>. <td> <td> <%= user_link(classifications.user) %> </td> <td> <%= pluralize(classifications.cnt, 'request').gsub(" ", " ").html_safe %> </td> </tr> <% end %> </table> </div> + <div id="game"> <h2><%= _("Play the request categorisation game!")%></h2> + <p><%= _("Some people who've made requests haven't let us know whether they were successful or not. We need <strong>your</strong> help – choose one of these requests, read it, and let everyone know whether or not the information has been provided. Everyone'll be exceedingly grateful.")%></p> - <% for info_request in @requests %> + + <% @requests.each do |info_request| %> <%= render :partial => 'request/request_listing_single', :locals => { :info_request => info_request } %> <% end %> + <p id="game_buttons"> - <%= button_to _('I don\'t like these ones — give me some more!'), categorise_play_url %> - <%= button_to _('I don\'t want to do any more tidying now!'), categorise_stop_url %> + <%= button_to _('I don\'t like these ones — give me some more!'), categorise_play_url %> + <%= button_to _('I don\'t want to do any more tidying now!'), categorise_stop_url %> </p> + <p><%= _('Thanks for helping - your work will make it easier for everyone to find successful responses, and maybe even let us make league tables...')%></p> </div> - - |