diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/stylesheets/responsive/_attachments_layout.scss | 8 | ||||
-rw-r--r-- | app/controllers/admin_request_controller.rb | 3 | ||||
-rw-r--r-- | app/controllers/api_controller.rb | 59 | ||||
-rw-r--r-- | app/controllers/public_body_change_requests_controller.rb | 12 | ||||
-rw-r--r-- | app/controllers/request_controller.rb | 2 | ||||
-rw-r--r-- | app/views/admin_general/index.html.erb | 2 | ||||
-rw-r--r-- | app/views/general/_responsive_topnav.html.erb | 2 | ||||
-rw-r--r-- | app/views/general/_topnav.html.erb | 4 | ||||
-rw-r--r-- | app/views/public_body_change_requests/new.html.erb | 5 | ||||
-rw-r--r-- | app/views/request/_sidebar_request_listing.html.erb | 2 | ||||
-rw-r--r-- | app/views/request/_view_html_stylesheet.html.erb | 9 |
11 files changed, 65 insertions, 43 deletions
diff --git a/app/assets/stylesheets/responsive/_attachments_layout.scss b/app/assets/stylesheets/responsive/_attachments_layout.scss index b41210a5f..070c288b8 100644 --- a/app/assets/stylesheets/responsive/_attachments_layout.scss +++ b/app/assets/stylesheets/responsive/_attachments_layout.scss @@ -62,7 +62,13 @@ } #wrapper_google_embed iframe { - min-height: 800px; + min-height: 400px; + @include respond-min($main_menu-mobile_menu_cutoff ){ + min-height: 800px; + @include lte-ie7{ + height:800px !important; + } + } } diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index 5c45a6e6e..21120e4ad 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -100,7 +100,8 @@ class AdminRequestController < AdminController @info_request.fully_destroy # expire cached files expire_for_request(@info_request) - flash[:notice] = "Request #{url_title} has been completely destroyed. Email of user who made request: " + user.email + email = user.try(:email) ? user.email : 'This request is external so has no associated user' + flash[:notice] = "Request #{ url_title } has been completely destroyed. Email of user who made request: #{ email }" redirect_to admin_request_list_url end diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 837364b19..6f83d89d6 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -191,19 +191,17 @@ class ApiController < ApplicationController raise PermissionDenied.new("#{@public_body.id} != #{params[:id]}") if @public_body.id != params[:id].to_i since_date_str = params[:since_date] - if since_date_str.nil? - @events = InfoRequestEvent.find_by_sql([ - %(select info_request_events.* - from info_requests - join info_request_events on info_requests.id = info_request_events.info_request_id - where info_requests.public_body_id = ? - and info_request_events.event_type in ( - 'sent', 'followup_sent', 'resent', 'followup_resent' - ) - order by info_request_events.created_at desc - ), @public_body.id - ]) - else + since_event_id = params[:since_event_id] + + event_type_clause = "event_type in ('sent', 'followup_sent', 'resent', 'followup_resent')" + + @events = InfoRequestEvent.where(event_type_clause) \ + .joins(:info_request) \ + .where("public_body_id = ?", @public_body.id) \ + .includes([{:info_request => :user}, :outgoing_message]) \ + .order('info_request_events.created_at DESC') + + if since_date_str begin since_date = Date.strptime(since_date_str, "%Y-%m-%d") rescue ArgumentError @@ -212,30 +210,29 @@ class ApiController < ApplicationController :status => 500 return end - @events = InfoRequestEvent.find_by_sql([ - %(select info_request_events.* - from info_requests - join info_request_events on info_requests.id = info_request_events.info_request_id - where info_requests.public_body_id = ? - and info_request_events.event_type in ( - 'sent', 'followup_sent', 'resent', 'followup_resent' - ) - and info_request_events.created_at >= ? - order by info_request_events.created_at desc - ), @public_body.id, since_date - ]) + @events = @events.where("info_request_events.created_at >= ?", since_date) + end + + # We take a "since" parameter that allows the client + # to restrict to events more recent than a certain other event + if since_event_id + begin + event = InfoRequestEvent.find(since_event_id) + rescue ActiveRecord::RecordNotFound + render :json => {"errors" => [ + "Event ID #{since_event_id} not found" ] }, + :status => 500 + return + end + @events = @events.where("info_request_events.created_at > ?", event.created_at) end + + if feed_type == "atom" render :template => "api/request_events", :formats => ['atom'], :layout => false elsif feed_type == "json" - # For the JSON feed, we take a "since" parameter that allows the client - # to restrict to events more recent than a certain other event - if params[:since_event_id] - @since_event_id = params[:since_event_id].to_i - end @event_data = [] @events.each do |event| - break if event.id == @since_event_id request = event.info_request this_event = { diff --git a/app/controllers/public_body_change_requests_controller.rb b/app/controllers/public_body_change_requests_controller.rb index 4a6c5f5cb..773308546 100644 --- a/app/controllers/public_body_change_requests_controller.rb +++ b/app/controllers/public_body_change_requests_controller.rb @@ -1,5 +1,7 @@ class PublicBodyChangeRequestsController < ApplicationController + before_filter :catch_spam, :only => [:create] + def create @change_request = PublicBodyChangeRequest.from_params(params[:public_body_change_request], @user) if @change_request.save @@ -23,6 +25,16 @@ class PublicBodyChangeRequestsController < ApplicationController else @title = _('Ask us to add an authority') end + end + + private + def catch_spam + if params[:public_body_change_request].key?(:comment) + unless params[:public_body_change_request][:comment].empty? + redirect_to frontpage_url + end + end end + end diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 6281959fb..3fa0ef0ce 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -181,7 +181,7 @@ class RequestController < ApplicationController end @filters = params.merge(:latest_status => @view) - @title = _("View and search requests") + @title = _('Browse and search requests') @title = @title + " (page " + @page.to_s + ")" if (@page > 1) @track_thing = TrackThing.create_track_for_search_query(InfoRequestEvent.make_query_from_params(@filters)) diff --git a/app/views/admin_general/index.html.erb b/app/views/admin_general/index.html.erb index 2202663be..f29258162 100644 --- a/app/views/admin_general/index.html.erb +++ b/app/views/admin_general/index.html.erb @@ -39,7 +39,7 @@ <% if message.get_body_for_quoting.strip.size == 0 %> <%= link_to "(no body)", admin_request_show_raw_email_path(message.raw_email_id) %> <% else %> - <%= link_to excerpt(message.get_body_for_quoting, "", 60), admin_request_show_raw_email_path(message.raw_email_id) %> + <%= link_to excerpt(message.get_body_for_quoting, "", :radius => 60), admin_request_show_raw_email_path(message.raw_email_id) %> <% end %> </td> <td class="span2"> diff --git a/app/views/general/_responsive_topnav.html.erb b/app/views/general/_responsive_topnav.html.erb index e726c17f4..0ece0da9a 100644 --- a/app/views/general/_responsive_topnav.html.erb +++ b/app/views/general/_responsive_topnav.html.erb @@ -6,7 +6,7 @@ </li> <li class="<%= 'selected' if params[:controller] == 'request' and !['new', 'select_authority'].include?(params[:action]) %>"> - <%= link_to _("View requests"), request_list_successful_path %> + <%= link_to _("Browse requests"), request_list_successful_path %> </li> <li class="<%= 'selected' if params[:controller] == 'public_body' %>"> diff --git a/app/views/general/_topnav.html.erb b/app/views/general/_topnav.html.erb index d37bd97d1..04ca07fa9 100644 --- a/app/views/general/_topnav.html.erb +++ b/app/views/general/_topnav.html.erb @@ -2,7 +2,9 @@ <ul id="navigation"> <li class="<%= 'selected' if params[:controller] == 'general' and params[:action] != 'blog' and params[:action] != 'search' %>"><%= link_to _("Home"), frontpage_path %></li> <li class="<%= 'selected' if params[:controller] == 'request' and ['new', 'select_authority'].include?(params[:action]) %>"><%= link_to _("Make a request"), select_authority_path, :id => 'make-request-link' %></li> - <li class="<%= 'selected' if params[:controller] == 'request' and !['new', 'select_authority'].include?(params[:action]) %>"><%= link_to _("View requests"), request_list_successful_path %></li> + <li class="<%= 'selected' if params[:controller] == 'request' and !['new', 'select_authority'].include?(params[:action]) %>"> + <%= link_to _("Browse requests"), request_list_successful_path %> + </li> <li class="<%= 'selected' if params[:controller] == 'public_body' %>"><%= link_to _("View authorities"), list_public_bodies_default_path %></li> <% unless AlaveteliConfiguration::blog_feed.empty? %> <li class="<%= 'selected' if params[:controller] == 'general' and params[:action] == 'blog' %>"><%= link_to _("Read blog"), blog_path %></li> diff --git a/app/views/public_body_change_requests/new.html.erb b/app/views/public_body_change_requests/new.html.erb index 7079cd868..b52d583be 100644 --- a/app/views/public_body_change_requests/new.html.erb +++ b/app/views/public_body_change_requests/new.html.erb @@ -54,6 +54,11 @@ <%= f.text_area :notes, :rows => 10, :cols => 60 %> </p> + <p style="display:none;"> + <%= label_tag 'public_body_change_request[comment]', _('Do not fill in this field') %> + <%= text_field_tag 'public_body_change_request[comment]' %> + </p> + <div class="form_button"> <%= submit_tag _("Submit request") %> </div> diff --git a/app/views/request/_sidebar_request_listing.html.erb b/app/views/request/_sidebar_request_listing.html.erb index ec5a5813d..64fe39341 100644 --- a/app/views/request/_sidebar_request_listing.html.erb +++ b/app/views/request/_sidebar_request_listing.html.erb @@ -4,7 +4,7 @@ <%= request_link(info_request) %> </span> <span class="desc"> - <%=h excerpt(info_request.initial_request_text, "", 100) %> + <%=h excerpt(info_request.initial_request_text, "", :radius => 100) %> </span> <span class="bottomline"> <strong> diff --git a/app/views/request/_view_html_stylesheet.html.erb b/app/views/request/_view_html_stylesheet.html.erb index f3d8799da..09f295346 100644 --- a/app/views/request/_view_html_stylesheet.html.erb +++ b/app/views/request/_view_html_stylesheet.html.erb @@ -1,17 +1,16 @@ <% if AlaveteliConfiguration::responsive_styling || params[:responsive] %> <!--[if LTE IE 7]> - <link href="/assets/responsive/application-lte-ie7.css" media="all" rel="stylesheet" title="Main" type="text/css" /> + <link href="/assets/responsive/application-lte-ie7.css" media="all" rel="stylesheet" title="Main" type="text/css" charset="UTF-8" /> <![endif]--> <!--[if IE 8]> - <link href="/assets/responsive/application-ie8.css" media="all" rel="stylesheet" title="Main" type="text/css" /> + <link href="/assets/responsive/application-ie8.css" media="all" rel="stylesheet" title="Main" type="text/css" charset="UTF-8" /> <![endif]--> <!--[if GT IE 8]><!--> - <link href="/assets/responsive/application.css" media="all" rel="stylesheet" title="Main" type="text/css" /> + <link href="/assets/responsive/application.css" media="all" rel="stylesheet" title="Main" type="text/css" charset="UTF-8" /> <!--<![endif]--> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <% else %> - <link type="text/css" title="Main" rel="stylesheet" media="screen" href="/assets/application.css"> - + <link type="text/css" title="Main" rel="stylesheet" media="screen" href="/assets/application.css" charset="UTF-8" /> <% end %> |