diff options
author | David Cabo <david@calibea.com> | 2011-08-02 00:10:01 +0200 |
---|---|---|
committer | David Cabo <david@calibea.com> | 2011-08-02 00:10:01 +0200 |
commit | 18d5f7588c3040c8bce6798f9d6c9f80172c220c (patch) | |
tree | 0ad3a6474bf39d630a4120343ab0b0da9c414cc1 | |
parent | 13035996a5a794051507f5927cb2f00104be34c0 (diff) | |
parent | 38029517f95d42539dad12db748b789574a8207b (diff) |
merging from master branch
-rw-r--r-- | app/controllers/request_controller.rb | 2 | ||||
-rw-r--r-- | app/models/user.rb | 3 | ||||
-rw-r--r-- | app/views/public_body/show.rhtml | 4 | ||||
-rw-r--r-- | app/views/request/_describe_state.rhtml | 2 | ||||
-rw-r--r-- | app/views/request/_followup.rhtml | 3 | ||||
-rw-r--r-- | app/views/request/new.rhtml | 4 | ||||
-rw-r--r-- | spec/models/user_spec.rb | 18 |
7 files changed, 28 insertions, 8 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index c8c7bd34b..f36fae463 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -375,7 +375,7 @@ class RequestController < ApplicationController # Don't give advice on what to do next, as it isn't their request RequestMailer.deliver_old_unclassified_updated(@info_request) if session[:request_game] - flash[:notice] = _('Thank you for updating the status of the request \'<a href="%s">{{info_request_title}}</a>\'. There are some more requests below for you to classify.',:info_request_title=>CGI.escapeHTML(@info_request.title)) % [CGI.escapeHTML(request_url(@info_request))] + flash[:notice] = _('Thank you for updating the status of the request \'<a href="{{url}}">{{info_request_title}}</a>\'. There are some more requests below for you to classify.',:info_request_title=>CGI.escapeHTML(@info_request.title), :url=>CGI.escapeHTML(request_url(@info_request))) redirect_to play_url else flash[:notice] = _('Thank you for updating this request!') diff --git a/app/models/user.rb b/app/models/user.rb index e29ae3101..fddb6b035 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -118,6 +118,9 @@ class User < ActiveRecord::Base if not name.nil? name.strip! end + if self.public_banned? + name = _("{{user_name}} (Banned)", :user_name=>name) + end name end diff --git a/app/views/public_body/show.rhtml b/app/views/public_body/show.rhtml index dce7ca4f8..3d325e2b8 100644 --- a/app/views/public_body/show.rhtml +++ b/app/views/public_body/show.rhtml @@ -47,8 +47,8 @@ <%= link_to _("Make a new Environmental Information request"), new_request_to_body_url(:url_name => @public_body.url_name)%> to <%= h(@public_body.name) %> <% else %> - <%= _('<a href="%s">Make a new Freedom of Information request</a> to {{public_body_name}}', - :public_body_name => h(@public_body.name)) % new_request_to_body_url(:url_name => @public_body.url_name)%> + <%= _('<a href="{{url}}">Make a new Freedom of Information request</a> to {{public_body_name}}', + :public_body_name => h(@public_body.name), :url=>new_request_to_body_url(:url_name => @public_body.url_name))%> <% end %> <% elsif @public_body.has_notes? %> <%= @public_body.notes_as_html %> diff --git a/app/views/request/_describe_state.rhtml b/app/views/request/_describe_state.rhtml index 8164637bf..052833a67 100644 --- a/app/views/request/_describe_state.rhtml +++ b/app/views/request/_describe_state.rhtml @@ -107,6 +107,6 @@ <%= _('We don\'t know whether the most recent response to this request contains information or not – - if you are {{user_link}} please <a href="%s">sign in</a> and let everyone know.',:user_link=>user_link(@info_request.user)) % [signin_url(:r => request.request_uri)] %> + if you are {{user_link}} please <a href="{{url}}">sign in</a> and let everyone know.',:user_link=>user_link(@info_request.user), :url=>signin_url(:r => request.request_uri)) %> <% end %> diff --git a/app/views/request/_followup.rhtml b/app/views/request/_followup.rhtml index 78de7decd..a15f2912d 100644 --- a/app/views/request/_followup.rhtml +++ b/app/views/request/_followup.rhtml @@ -13,8 +13,7 @@ <% end %> <% if @info_request.allow_new_responses_from == 'nobody' %> - <p><%= _('Follow ups and new responses to this request have been stopped to prevent spam. Please - <a href="%s">contact us</a> if you are {{user_link}} and need to send a follow up.',:user_link=>user_link(@info_request.user) ) % [help_contact_path] %></p> + <p><%= _('Follow ups and new responses to this request have been stopped to prevent spam. Please <a href="{{url}}">contact us</a> if you are {{user_link}} and need to send a follow up.',:user_link=>user_link(@info_request.user), :url=>help_contact_path) %></p> <% else %> <% if @internal_review %> <p> diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml index a640c7d1e..e8dd395a4 100644 --- a/app/views/request/new.rhtml +++ b/app/views/request/new.rhtml @@ -33,9 +33,9 @@ <span id="to_public_body"><%=h(@info_request.public_body.name)%></span> <div class="form_item_note"> <% if @info_request.public_body.info_requests.size > 0 %> - <%= _("Browse <a href='%s'>other requests</a> to '{{public_body_name}}' for examples of how to word your request.", :public_body_name=>h(@info_request.public_body.name)) % [public_body_url(@info_request.public_body)] %> + <%= _("Browse <a href='{{url}}'>other requests</a> to '{{public_body_name}}' for examples of how to word your request.", :public_body_name=>h(@info_request.public_body.name), :url=>public_body_url(@info_request.public_body)) %> <% else %> - <%= _('Browse <a href="%s">other requests</a> for examples of how to word your request.') % [request_list_url] %> + <%= _("Browse <a href='{{url}}'>other requests</a> for examples of how to word your request.", :url=>request_list_url) %> <% end %> </div> </p> diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index c913ce3a8..ee6916ffc 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -15,6 +15,24 @@ describe User, "making up the URL name" do @user.url_name.should == 'user' end end + + +describe User, "showing the name" do + before do + @user = User.new + @user.name = 'Some Name ' + end + + it 'should strip whitespace' do + @user.name.should == 'Some Name' + end + + it 'should show if user has been banned' do + @user.ban_text = "Naughty user" + @user.name.should == 'Some Name (Banned)' + end + +end describe User, " when authenticating" do before do |