From: Tom Hughes Date: Wed, 25 Apr 2018 16:38:19 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/pull/1837' X-Git-Tag: live~3029 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/aebfbdcfbdb772914ca55c1b5f957f62c1c9cf24?hp=dfa2fd7d3d969cb196692dc3e7692153ae6ea5b8 Merge remote-tracking branch 'upstream/pull/1837' --- diff --git a/app/controllers/redactions_controller.rb b/app/controllers/redactions_controller.rb index f15060d5b..b8ecce9e2 100644 --- a/app/controllers/redactions_controller.rb +++ b/app/controllers/redactions_controller.rb @@ -25,7 +25,7 @@ class RedactionsController < ApplicationController # note that the description format will default to 'markdown' if @redaction.save - flash[:notice] = t("redaction.create.flash") + flash[:notice] = t(".flash") redirect_to @redaction else render :action => "new" @@ -42,7 +42,7 @@ class RedactionsController < ApplicationController @redaction.description = params[:redaction][:description] if @redaction.save - flash[:notice] = t("redaction.update.flash") + flash[:notice] = t(".flash") redirect_to @redaction else render :action => "edit" @@ -54,14 +54,14 @@ class RedactionsController < ApplicationController @redaction.old_ways.empty? && @redaction.old_relations.empty? if @redaction.destroy - flash[:notice] = t("redaction.destroy.flash") + flash[:notice] = t(".flash") redirect_to :redactions else - flash[:error] = t("redaction.destroy.error") + flash[:error] = t(".error") redirect_to @redaction end else - flash[:error] = t("redaction.destroy.not_empty") + flash[:error] = t(".not_empty") redirect_to @redaction end end diff --git a/app/controllers/user_blocks_controller.rb b/app/controllers/user_blocks_controller.rb index 4a55c9ba2..2b7bf3f58 100644 --- a/app/controllers/user_blocks_controller.rb +++ b/app/controllers/user_blocks_controller.rb @@ -45,7 +45,7 @@ class UserBlocksController < ApplicationController ) if @user_block.save - flash[:notice] = t("user_block.create.flash", :name => @user.display_name) + flash[:notice] = t(".flash", :name => @user.display_name) redirect_to @user_block else render :action => "new" @@ -58,14 +58,14 @@ class UserBlocksController < ApplicationController def update if @valid_params if @user_block.creator != current_user - flash[:error] = t("user_block.update.only_creator_can_edit") + flash[:error] = t(".only_creator_can_edit") redirect_to :action => "edit" elsif @user_block.update( :ends_at => Time.now.getutc + @block_period.hours, :reason => params[:user_block][:reason], :needs_view => params[:user_block][:needs_view] ) - flash[:notice] = t("user_block.update.success") + flash[:notice] = t(".success") redirect_to(@user_block) else render :action => "edit" @@ -80,7 +80,7 @@ class UserBlocksController < ApplicationController def revoke if params[:confirm] if @user_block.revoke! current_user - flash[:notice] = t "user_block.revoke.flash" + flash[:notice] = t ".flash" redirect_to(@user_block) end end @@ -128,10 +128,10 @@ class UserBlocksController < ApplicationController @valid_params = false if !UserBlock::PERIODS.include?(@block_period) - flash[:error] = t("user_block.filter.block_period") + flash[:error] = t("user_blocks.filter.block_period") elsif @user_block && !@user_block.active? - flash[:error] = t("user_block.filter.block_expired") + flash[:error] = t("user_blocks.filter.block_expired") else @valid_params = true diff --git a/app/helpers/user_blocks_helper.rb b/app/helpers/user_blocks_helper.rb index 3c9c0a37e..668eeb0e5 100644 --- a/app/helpers/user_blocks_helper.rb +++ b/app/helpers/user_blocks_helper.rb @@ -7,19 +7,19 @@ module UserBlocksHelper # if the block hasn't expired yet show the date, if the user just needs to login show that if block.needs_view? if block.ends_at > Time.now.getutc - I18n.t("user_block.helper.time_future_and_until_login", :time => friendly_date(block.ends_at)).html_safe + I18n.t("user_blocks.helper.time_future_and_until_login", :time => friendly_date(block.ends_at)).html_safe else - I18n.t("user_block.helper.until_login") + I18n.t("user_blocks.helper.until_login") end else - I18n.t("user_block.helper.time_future", :time => friendly_date(block.ends_at)).html_safe + I18n.t("user_blocks.helper.time_future", :time => friendly_date(block.ends_at)).html_safe end else # the max of the last update time or the ends_at time is when this block finished # either because the user viewed the block (updated_at) or it expired or was # revoked (ends_at) last_time = [block.ends_at, block.updated_at].max - I18n.t("user_block.helper.time_past", :time => friendly_date(last_time)).html_safe + I18n.t("user_blocks.helper.time_past", :time => friendly_date(last_time)).html_safe end end end diff --git a/app/views/redactions/edit.html.erb b/app/views/redactions/edit.html.erb index 2dd63c9cb..fe85d0756 100644 --- a/app/views/redactions/edit.html.erb +++ b/app/views/redactions/edit.html.erb @@ -1,22 +1,21 @@ -<% @title = t 'redaction.edit.title' %> +<% @title = t '.title' %> <% content_for :heading do %> -

<%= t 'redaction.edit.heading' %>

+

<%= t '.heading' %>

<% end %> <%= form_for(@redaction) do |f| %> <%= f.error_messages %>

- <%= f.label :title, t('redaction.edit.title') %>
+ <%= f.label :title, t('.title') %>
<%= f.text_field :title %>

- <%= f.label :description, t('redaction.edit.description') %>
+ <%= f.label :description, t('.description') %>
<%= richtext_area :redaction, :description, :cols => 80, :rows => 20, :format => @redaction.description_format %>

- <%= f.submit t('redaction.edit.submit') %> + <%= f.submit t('.submit') %>

<% end %> - diff --git a/app/views/redactions/index.html.erb b/app/views/redactions/index.html.erb index a5a85c38d..b53e9b747 100644 --- a/app/views/redactions/index.html.erb +++ b/app/views/redactions/index.html.erb @@ -1,10 +1,10 @@ -<% @title = t('redaction.index.title') %> +<% @title = t('.title') %> <% content_for :heading do %> -

<%= t('redaction.index.heading') %>

+

<%= t('.heading') %>

<% end %> <% unless @redactions.empty? %> <%= render :partial => 'redactions' %> <% else %> -

<%= t 'redaction.index.empty' %>

+

<%= t '.empty' %>

<% end %> diff --git a/app/views/redactions/new.html.erb b/app/views/redactions/new.html.erb index 5004c0e1e..e6838073d 100644 --- a/app/views/redactions/new.html.erb +++ b/app/views/redactions/new.html.erb @@ -1,22 +1,20 @@ -<% @title = t 'redaction.new.title' %> +<% @title = t '.title' %> <% content_for :heading do %> -

<%= t 'redaction.new.heading' %>

+

<%= t '.heading' %>

<% end %> <%= form_for(@redaction) do |f| %> <%= f.error_messages %>

- <%= f.label :title, t('redaction.new.title') %>
+ <%= f.label :title, t('.title') %>
<%= f.text_field :title %>

- <%= f.label :description, t('redaction.new.description') %>
+ <%= f.label :description, t('.description') %>
<%= richtext_area :redaction, :description, :cols => 80, :rows => 20, :format => @redaction.description_format %>

- <%= f.submit t('redaction.new.submit') %> + <%= f.submit t('.submit') %>

<% end %> - - diff --git a/app/views/redactions/show.html.erb b/app/views/redactions/show.html.erb index 99f7cd1f1..8ec72f3ac 100644 --- a/app/views/redactions/show.html.erb +++ b/app/views/redactions/show.html.erb @@ -1,20 +1,20 @@ -<% @title = t('redaction.show.title') %> +<% @title = t('.title') %> <% content_for :heading do %> -

<%= t('redaction.show.heading', :title => @redaction.title) %>

+

<%= t('.heading', :title => @redaction.title) %>

<% end %>

- <%= t 'redaction.show.user' %> + <%= t '.user' %> <%= link_to(@redaction.user.display_name, user_path(@redaction.user)) %>

- <%= t 'redaction.show.description' %> + <%= t '.description' %> <%= @redaction.description.to_html %>

<% if current_user and current_user.moderator? %>
- <%= button_to t('redaction.show.edit'), edit_redaction_path(@redaction), :method => :get %> - <%= button_to t('redaction.show.destroy'), @redaction, :method => "delete", :remote => true, :data => { :confirm => t('redaction.show.confirm') } %> + <%= button_to t('.edit'), edit_redaction_path(@redaction), :method => :get %> + <%= button_to t('.destroy'), @redaction, :method => "delete", :remote => true, :data => { :confirm => t('.confirm') } %>
<% end %> diff --git a/app/views/user/index.html.erb b/app/views/user/index.html.erb deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/views/user_blocks/blocks_by.html.erb b/app/views/user_blocks/blocks_by.html.erb index 8b7a290fc..69af9374a 100644 --- a/app/views/user_blocks/blocks_by.html.erb +++ b/app/views/user_blocks/blocks_by.html.erb @@ -1,10 +1,10 @@ -<% @title = t('user_block.blocks_by.title', :name => h(@user.display_name)) %> +<% @title = t('.title', :name => h(@user.display_name)) %> <% content_for :heading do %> -

<%= raw(t('user_block.blocks_by.heading', :name => link_to(h(@user.display_name), user_path(@user)))) %>

+

<%= raw(t('.heading', :name => link_to(h(@user.display_name), user_path(@user)))) %>

<% end %> <% unless @user_blocks.empty? %> <%= render :partial => 'blocks', :locals => { :show_revoke_link => (current_user and current_user.moderator?), :show_user_name => true, :show_creator_name => false } %> <% else %> -

<%= t "user_block.blocks_by.empty", :name => h(@user.display_name) %>

+

<%= t ".empty", :name => h(@user.display_name) %>

<% end %> diff --git a/app/views/user_blocks/blocks_on.html.erb b/app/views/user_blocks/blocks_on.html.erb index 7abcc8674..6e4fd3ca6 100644 --- a/app/views/user_blocks/blocks_on.html.erb +++ b/app/views/user_blocks/blocks_on.html.erb @@ -1,9 +1,9 @@ -<% @title = t('user_block.blocks_on.title', :name => h(@user.display_name)) %> +<% @title = t('.title', :name => h(@user.display_name)) %> <% content_for :heading do %> -

<%= raw(t('user_block.blocks_on.heading', :name => link_to(h(@user.display_name), user_path(@user)))) %>

+

<%= raw(t('.heading', :name => link_to(h(@user.display_name), user_path(@user)))) %>

<% end %> <% unless @user_blocks.empty? %> <%= render :partial => 'blocks', :locals => { :show_revoke_link => (current_user and current_user.moderator?), :show_user_name => false, :show_creator_name => true } %> <% else %> -

<%= t "user_block.blocks_on.empty", :name => h(@user.display_name) %>

+

<%= t ".empty", :name => h(@user.display_name) %>

<% end %> diff --git a/app/views/user_blocks/edit.html.erb b/app/views/user_blocks/edit.html.erb index 289f7a831..a3bb9c682 100644 --- a/app/views/user_blocks/edit.html.erb +++ b/app/views/user_blocks/edit.html.erb @@ -1,11 +1,11 @@ -<% @title = t 'user_block.edit.title', :name => h(@user_block.user.display_name) %> +<% @title = t '.title', :name => h(@user_block.user.display_name) %> <% content_for :heading do %> -

<%= raw t('user_block.edit.title', +

<%= raw t('.title', :name => link_to(h(@user_block.user.display_name), user_path(@user_block.user))) %>

<% end %> @@ -13,18 +13,18 @@ <%= f.error_messages %>

- <%= f.label :reason, t('user_block.edit.reason', :name => h(@user_block.user.display_name)) %>
+ <%= f.label :reason, t('.reason', :name => h(@user_block.user.display_name)) %>
<%= richtext_area :user_block, :reason, :cols => 80, :rows => 20, :format => @user_block.reason_format %>

- <%= label_tag 'user_block_period', t('user_block.edit.period') %>
- <%= select_tag('user_block_period', options_for_select(UserBlock::PERIODS.collect { |h| [t('user_block.period', :count => h), h.to_s] }, params[:user_block_period])) %> + <%= label_tag 'user_block_period', t('.period') %>
+ <%= select_tag('user_block_period', options_for_select(UserBlock::PERIODS.collect { |h| [t('user_blocks.period', :count => h), h.to_s] }, params[:user_block_period])) %>

<%= f.check_box :needs_view %> - <%= f.label :needs_view, t('user_block.edit.needs_view') %> + <%= f.label :needs_view, t('.needs_view') %>

- <%= f.submit t('user_block.edit.submit') %> + <%= f.submit t('.submit') %>

<% end %> diff --git a/app/views/user_blocks/index.html.erb b/app/views/user_blocks/index.html.erb index ce7f12b91..adfc0dc28 100644 --- a/app/views/user_blocks/index.html.erb +++ b/app/views/user_blocks/index.html.erb @@ -1,10 +1,10 @@ -<% @title = t('user_block.index.title') %> +<% @title = t('.title') %> <% content_for :heading do %> -

<%= t('user_block.index.heading') %>

+

<%= t('.heading') %>

<% end %> <% unless @user_blocks.empty? %> <%= render :partial => 'blocks', :locals => { :show_revoke_link => (current_user and current_user.moderator?), :show_user_name => true, :show_creator_name => true } %> <% else %> -

<%= t "user_block.index.empty" %>

+

<%= t ".empty" %>

<% end %> diff --git a/app/views/user_blocks/new.html.erb b/app/views/user_blocks/new.html.erb index f26a91c5c..bd941babc 100644 --- a/app/views/user_blocks/new.html.erb +++ b/app/views/user_blocks/new.html.erb @@ -1,6 +1,6 @@ -<% @title = t 'user_block.new.title', :name => h(@user.display_name) %> +<% @title = t '.title', :name => h(@user.display_name) %> <% content_for :heading do %> -

<%= raw t('user_block.new.heading', +

<%= raw t('.heading', :name => link_to( h(@user.display_name), user_path(@user))) %>

@@ -9,21 +9,21 @@ <%= f.error_messages %>

- <%= f.label :reason, t('user_block.new.reason', :name => @user.display_name) %>
+ <%= f.label :reason, t('.reason', :name => @user.display_name) %>
<%= richtext_area :user_block, :reason, :cols => 80, :rows => 20 %>

- <%= label_tag 'user_block_period', t('user_block.new.period') %>
- <%= select_tag('user_block_period', options_for_select(UserBlock::PERIODS.collect { |h| [t('user_block.period', :count => h), h.to_s] }, params[:user_block_period] )) %> + <%= label_tag 'user_block_period', t('.period') %>
+ <%= select_tag('user_block_period', options_for_select(UserBlock::PERIODS.collect { |h| [t('user_blocks.period', :count => h), h.to_s] }, params[:user_block_period] )) %>

<%= f.check_box :needs_view %> - <%= f.label :needs_view, t('user_block.new.needs_view') %> + <%= f.label :needs_view, t('.needs_view') %>

<%= hidden_field_tag 'display_name', @user.display_name %> - <%= f.submit t('user_block.new.submit') %> + <%= f.submit t('.submit') %>

<% end %> -<%= link_to t('user_block.new.back'), user_blocks_path %> +<%= link_to t('.back'), user_blocks_path %> diff --git a/app/views/user_blocks/not_found.html.erb b/app/views/user_blocks/not_found.html.erb index 3b5323d72..6aad7eef3 100644 --- a/app/views/user_blocks/not_found.html.erb +++ b/app/views/user_blocks/not_found.html.erb @@ -1,3 +1,3 @@ -

<%= t'user_block.not_found.sorry', :id => params[:id] %>

+

<%= t'.sorry', :id => params[:id] %>

-<%= link_to t('user_block.not_found.back'), user_blocks_path %> +<%= link_to t('.back'), user_blocks_path %> diff --git a/app/views/user_blocks/revoke.html.erb b/app/views/user_blocks/revoke.html.erb index f812ffff6..c7eee6703 100644 --- a/app/views/user_blocks/revoke.html.erb +++ b/app/views/user_blocks/revoke.html.erb @@ -1,9 +1,9 @@ -<% @title = t('user_block.revoke.title', +<% @title = t('.title', :block_on => h(@user_block.user.display_name), :block_by => h(@user_block.creator.display_name)) %> <% content_for :heading do %> -

<%= raw t('user_block.revoke.heading', +

<%= raw t('.heading', :block_on => link_to( h(@user_block.user.display_name), user_path(@user_block.user)), @@ -14,22 +14,22 @@ <% if @user_block.ends_at > Time.now %>

- <%= t('user_block.revoke.time_future', :time => distance_of_time_in_words_to_now(@user_block.ends_at)) %> + <%= t('.time_future', :time => distance_of_time_in_words_to_now(@user_block.ends_at)) %>

<%= form_for :revoke, :url => { :action => "revoke" } do |f| %> <%= f.error_messages %>

<%= check_box_tag 'confirm', 'yes' %> - <%= label_tag 'confirm', t('user_block.revoke.confirm') %> + <%= label_tag 'confirm', t('.confirm') %>

- <%= submit_tag t('user_block.revoke.revoke') %> + <%= submit_tag t('.revoke') %>

<% end %> <% else %>

- <%= t('user_block.revoke.past', :time => distance_of_time_in_words_to_now(@user_block.ends_at)) %> + <%= t('.past', :time => distance_of_time_in_words_to_now(@user_block.ends_at)) %>

<% end %> diff --git a/app/views/user_blocks/show.html.erb b/app/views/user_blocks/show.html.erb index 51fbcaf49..4dc03f4e4 100644 --- a/app/views/user_blocks/show.html.erb +++ b/app/views/user_blocks/show.html.erb @@ -1,9 +1,9 @@ -<% @title = t('user_block.show.title', +<% @title = t('.title', :block_on => @user_block.user.display_name, :block_by => @user_block.creator.display_name) %> <% content_for :heading do %> -

<%= raw t('user_block.show.heading', +

<%= raw t('.heading', :block_on => link_to( h(@user_block.user.display_name), user_path(@user_block.user)), @@ -13,26 +13,26 @@ <% end %> <% if @user_block.revoker %>

- <%= t'user_block.show.revoker' %> + <%= t'.revoker' %> <%= link_to h(@user_block.revoker.display_name), user_path(@user_block.revoker) %>

<% end %> -

<%= t'user_block.show.created' %>: <%= raw t'user_block.show.ago', :time => friendly_date(@user_block.created_at) %>

+

<%= t'.created' %>: <%= raw t'.ago', :time => friendly_date(@user_block.created_at) %>

-

<%= t'user_block.show.status' %>: <%= block_status(@user_block) %>

+

<%= t'.status' %>: <%= block_status(@user_block) %>

-

<%= t'user_block.show.reason' %>

+

<%= t'.reason' %>

<%= @user_block.reason.to_html %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index e3c773810..9c7ab2b49 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2108,7 +2108,7 @@ en: are_you_sure: "Are you sure you want to revoke the role `%{role}' from the user `%{name}'?" confirm: "Confirm" fail: "Could not revoke role `%{role}' from user `%{name}'. Please check that the user and role are both valid." - user_block: + user_blocks: model: non_moderator_update: "Must be a moderator to create or update a block." non_moderator_revoke: "Must be a moderator to revoke a block." @@ -2188,7 +2188,6 @@ en: back: "View all blocks" revoker: "Revoker:" needs_view: "The user needs to log in before this block will be cleared." - user_blocks: block: not_revoked: "(not revoked)" show: "Show" @@ -2401,7 +2400,7 @@ en: show_address: Show address query_features: Query features centre_map: Centre map here - redaction: + redactions: edit: description: "Description" heading: "Edit redaction"