diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin_request_controller.rb | 16 | ||||
-rw-r--r-- | app/controllers/request_controller.rb | 2 | ||||
-rw-r--r-- | app/models/public_body.rb | 34 | ||||
-rw-r--r-- | app/views/admin_request/_some_annotations.html.erb | 48 | ||||
-rw-r--r-- | app/views/admin_request/show.html.erb | 49 | ||||
-rw-r--r-- | app/views/admin_user/show.html.erb | 6 | ||||
-rw-r--r-- | app/views/reports/new.html.erb | 8 | ||||
-rw-r--r-- | app/views/request/_view_html_prefix.html.erb | 4 | ||||
-rw-r--r-- | app/views/request/_view_html_stylesheet.html.erb | 2 | ||||
-rw-r--r-- | app/views/user/wall.html.erb | 25 |
10 files changed, 104 insertions, 90 deletions
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index 4d45ced8b..2f5f51c0f 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -26,15 +26,13 @@ class AdminRequestController < AdminController def show @info_request = InfoRequest.find(params[:id]) - # XXX is this *really* the only way to render a template to a - # variable, rather than to the response? - vars = OpenStruct.new(:name_to => @info_request.user_name, - :name_from => AlaveteliConfiguration::contact_name, - :info_request => @info_request, :reason => params[:reason], - :info_request_url => 'http://' + AlaveteliConfiguration::domain + request_url(@info_request), - :site_name => site_name) - template = File.read(File.join(File.dirname(__FILE__), "..", "views", "admin_request", "hidden_user_explanation.html.erb")) - @request_hidden_user_explanation = ERB.new(template).result(vars.instance_eval { binding }) + vars_for_explanation = {:reason => params[:reason], + :info_request => @info_request, + :name_to => @info_request.user_name, + :name_from => AlaveteliConfiguration::contact_name, + :info_request_url => request_url(@info_request, :only_path => false)} + @request_hidden_user_explanation = render_to_string(:template => "admin_request/hidden_user_explanation", + :locals => vars_for_explanation) end def resend diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index d982bd391..6f80be7a6 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -326,7 +326,7 @@ class RequestController < ApplicationController if !authenticated?( :web => _("To send your FOI request").to_str, :email => _("Then your FOI request to {{public_body_name}} will be sent.",:public_body_name=>@info_request.public_body.name), - :email_subject => _("Confirm your FOI request to ") + @info_request.public_body.name + :email_subject => _("Confirm your FOI request to {{public_body_name}}",:public_body_name=>@info_request.public_body.name) ) # do nothing - as "authenticated?" has done the redirect to signin page for us return diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 933825d2a..a78a6677e 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -346,22 +346,26 @@ class PublicBody < ActiveRecord::Base # The "internal admin" is a special body for internal use. def PublicBody.internal_admin_body - I18n.with_locale(I18n.default_locale) do - pb = PublicBody.find_by_url_name("internal_admin_authority") - if pb.nil? - pb = PublicBody.new( - :name => 'Internal admin authority', - :short_name => "", - :request_email => AlaveteliConfiguration::contact_email, - :home_page => "", - :notes => "", - :publication_scheme => "", - :last_edit_editor => "internal_admin", - :last_edit_comment => "Made by PublicBody.internal_admin_body" - ) - pb.save! + # Use find_by_sql to avoid the search being specific to a + # locale, since url_name is a translated field: + sql = "SELECT * FROM public_bodies WHERE url_name = 'internal_admin_authority'" + matching_pbs = PublicBody.find_by_sql sql + case + when matching_pbs.empty? then + I18n.with_locale(I18n.default_locale) do + PublicBody.create!(:name => 'Internal admin authority', + :short_name => "", + :request_email => AlaveteliConfiguration::contact_email, + :home_page => "", + :notes => "", + :publication_scheme => "", + :last_edit_editor => "internal_admin", + :last_edit_comment => "Made by PublicBody.internal_admin_body") end - return pb + when matching_pbs.length == 1 then + matching_pbs[0] + else + raise "Multiple public bodies (#{matching_pbs.length}) found with url_name 'internal_admin_authority'" end end diff --git a/app/views/admin_request/_some_annotations.html.erb b/app/views/admin_request/_some_annotations.html.erb new file mode 100644 index 000000000..dfd46f828 --- /dev/null +++ b/app/views/admin_request/_some_annotations.html.erb @@ -0,0 +1,48 @@ +<% if comments.size > 0 %> + <div class="accordion" id="comments"> + <% for comment in comments %> + <div class="accordion-group"> + <div class="accordion-heading"> + <a href="#comment_<%=comment.id%>" data-toggle="collapse" data-parent="#comments"><%= chevron_right %></a> + <%= link_to admin_request_edit_comment_path(comment) do %> + #<%=comment.id%> + -- + <%=h(comment.user.name)%> + <%=admin_value(comment.created_at)%> + <% end %> + <blockquote class="incoming-message"> + <%= truncate(comment.body, :length => 400) %> + </blockquote> + </div> + <div id="comment_<%=comment.id%>" class="accordion-body collapse"> + <table class="table table-striped table-condensed"> + <tbody> + <tr> + <td colspan="2"> + By <%= user_both_links(comment.user) %> + </td> + </tr> + <% comment.for_admin_column do |name, value, type, column_name |%> + <tr> + <td> + <b><%=name%></b> + </td> + <td> + <% if column_name == 'body' && !comment.visible %> + <s><%=h comment.send(column_name) %></s> + <% else %> + <%=h comment.send(column_name) %> + <% end %> + </td> + </tr> + <% end %> + </tbody> + </table> + </div> + </div> + <% end %> + </div> +<% else %> + <p>None yet.</p> +<% end %> + diff --git a/app/views/admin_request/show.html.erb b/app/views/admin_request/show.html.erb index 83d9c3764..2589e52b4 100644 --- a/app/views/admin_request/show.html.erb +++ b/app/views/admin_request/show.html.erb @@ -325,53 +325,8 @@ <hr> <h2>Annotations</h2> -<% if @info_request.comments.size > 0 %> - <div class="accordion" id="comments"> - <% for comment in @info_request.comments %> - <div class="accordion-group"> - <div class="accordion-heading"> - <a href="#comment_<%=comment.id%>" data-toggle="collapse" data-parent="#comments"><%= chevron_right %></a> - <%= link_to admin_request_edit_comment_path(comment) do %> - #<%=comment.id%> - -- - <%=h(comment.user.name)%> - <%=admin_value(comment.created_at)%> - <% end %> - <blockquote class="incoming-message"> - <%= truncate(comment.body, :length => 400) %> - </blockquote> - </div> - <div id="comment_<%=comment.id%>" class="accordion-body collapse"> - <table class="table table-striped table-condensed"> - <tbody> - <tr> - <td colspan="2"> - By <%= user_both_links(comment.user) %> - </td> - </tr> - <% comment.for_admin_column do |name, value, type, column_name |%> - <tr> - <td> - <b><%=name%></b> - </td> - <td> - <% if column_name == 'body' && !comment.visible %> - <s><%=h comment.send(column_name) %></s> - <% else %> - <%=h comment.send(column_name) %> - <% end %> - </td> - </tr> - <% end %> - </tbody> - </table> - </div> - </div> - <% end %> - </div> -<% else %> - <p>None yet.</p> -<% end %> +<%= render :partial => 'admin_request/some_annotations' , :locals => { :comments => @info_request.comments } %> + <hr> <h2>Mail server delivery logs</h2> diff --git a/app/views/admin_user/show.html.erb b/app/views/admin_user/show.html.erb index c93c08e50..6d12aeff5 100644 --- a/app/views/admin_user/show.html.erb +++ b/app/views/admin_user/show.html.erb @@ -91,6 +91,12 @@ <hr> +<h2>Annotations</h2> + +<%= render :partial => 'admin_request/some_annotations' , :locals => { :comments => @admin_user.comments } %> + +<hr> + <h2>Censor rules</h2> <%= render :partial => 'admin_censor_rule/show', :locals => { :censor_rules => @admin_user.censor_rules, :user => @admin_user } %> diff --git a/app/views/reports/new.html.erb b/app/views/reports/new.html.erb index 7d558ab4e..1197b2255 100644 --- a/app/views/reports/new.html.erb +++ b/app/views/reports/new.html.erb @@ -4,17 +4,17 @@ <p><%= _("This request has already been reported for administrator attention") %></p> <% else %> <p> - Reporting a request notifies the site administrators. They will respond as soon as possible. + <%= _("Reporting a request notifies the site administrators. They will respond as soon as possible.") %> </p> - <p>Why specifically do you consider this request unsuitable?</p> + <p><%= _("Why specifically do you consider this request unsuitable?") %></p> <%= form_tag request_report_path(:request_id => @info_request.url_title) do %> <p> <label class="form_label" for="reason">Reason:</label> - <%= select_tag :reason, options_for_select(@info_request.report_reasons, @reason), :prompt => "Choose a reason" %> + <%= select_tag :reason, options_for_select(@info_request.report_reasons, @reason), :prompt => _("Choose a reason") %> </p> <p> - <label class="form_label" for="message">Please tell us more:</label> + <label class="form_label" for="message"><%= _("Please tell us more:") %></label> <%= text_area_tag :message, @message, :rows => 10, :cols => 60 %> </p> diff --git a/app/views/request/_view_html_prefix.html.erb b/app/views/request/_view_html_prefix.html.erb index 63caa98d4..63fac7c6d 100644 --- a/app/views/request/_view_html_prefix.html.erb +++ b/app/views/request/_view_html_prefix.html.erb @@ -1,9 +1,9 @@ <div class="view_html_prefix"> <div class="view_html_logo"> - <a href="/"><%= image_tag "navimg/logo-trans-small.png", :alt => site_name %></a> + <a href="/"><img src="/assets/navimg/logo-trans-small.png" alt="<%= site_name %>"></a> </div> <div class="view_html_download_link"> - <%=link_to _("Download original attachment"), @attachment_url %> + <%=link_to _("Download original attachment"), @attachment_url %> <br>(<%=h @attachment.name_of_content_type %>) </div> <%= _('This is an HTML version of an attachment to the Freedom of Information request')%> diff --git a/app/views/request/_view_html_stylesheet.html.erb b/app/views/request/_view_html_stylesheet.html.erb index d6cb932a8..125ce66ec 100644 --- a/app/views/request/_view_html_stylesheet.html.erb +++ b/app/views/request/_view_html_stylesheet.html.erb @@ -1 +1 @@ -<%= stylesheet_link_tag 'main', :title => "Main", :rel => "stylesheet" %> +<link type="text/css" title="Main" rel="stylesheet" media="screen" href="/assets/application.css"> diff --git a/app/views/user/wall.html.erb b/app/views/user/wall.html.erb index 190cc0a6d..6699c55fa 100644 --- a/app/views/user/wall.html.erb +++ b/app/views/user/wall.html.erb @@ -1,16 +1,19 @@ <% @title = h(@display_user.name) + _(" - wall") %> -<% if @is_you %> <div class="medium_column"> - <p><%= _('You can change the requests and users you are following on <a href="{{profile_url}}">your profile page</a>.', :profile_url => show_user_profile_path) %> - <%= render :partial => 'change_receive_email' %> + <% if @is_you %> + <h2><%= _("My wall") %></h2> + <p><%= _('You can change the requests and users you are following on <a href="{{profile_url}}">your profile page</a>.', :profile_url => show_user_profile_path) %></p> + <%= render :partial => 'change_receive_email' %> + <% else %> + <h2><%= _("This is <a href=\"{{profile_url}}\">{{user_name}}'s</a> wall", :profile_url => show_user_profile_path, :user_name => h(@display_user.name)) %></h2> + <% end %> </div> -<% end %> <div id="user_profile_search"> - <% if !@feed_results.nil? %> - <% for result in @feed_results %> - <%= render :partial => 'request/wall_listing', :locals => { :event => result, :info_request => result.info_request } %> - <% end %> - <% end %> - - + <% if !@feed_results.nil? and !@feed_results.empty? %> + <% for result in @feed_results %> + <%= render :partial => 'request/wall_listing', :locals => { :event => result, :info_request => result.info_request } %> + <% end %> + <% else %> + <p><%= _("There is nothing to display yet.") %></p> + <% end %> </div> |