Use lazy lookups for translations in issues
This commit is contained in:
parent
5effa0a6d6
commit
2aca6920dc
13 changed files with 89 additions and 89 deletions
|
@ -10,7 +10,7 @@ class IssueCommentsController < ApplicationController
|
|||
comment = @issue.comments.build(issue_comment_params)
|
||||
comment.user = current_user
|
||||
comment.save!
|
||||
notice = t("issues.comment.comment_created")
|
||||
notice = t(".comment_created")
|
||||
reassign_issue(@issue) if params[:reassign]
|
||||
redirect_to @issue, :notice => notice
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ class IssuesController < ApplicationController
|
|||
@issues = @issues.where(:reported_user_id => @find_user.id)
|
||||
else
|
||||
@issues = @issues.none
|
||||
flash.now[:warning] = t("issues.index.user_not_found")
|
||||
flash.now[:warning] = t(".user_not_found")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -49,7 +49,7 @@ class IssuesController < ApplicationController
|
|||
def resolve
|
||||
if @issue.resolve
|
||||
@issue.save!
|
||||
redirect_to @issue, :notice => t("issues.resolved")
|
||||
redirect_to @issue, :notice => t(".resolved")
|
||||
else
|
||||
render :show
|
||||
end
|
||||
|
@ -59,7 +59,7 @@ class IssuesController < ApplicationController
|
|||
if @issue.ignore
|
||||
@issue.updated_by = current_user.id
|
||||
@issue.save!
|
||||
redirect_to @issue, :notice => t("issues.ignored")
|
||||
redirect_to @issue, :notice => t(".ignored")
|
||||
else
|
||||
render :show
|
||||
end
|
||||
|
@ -69,7 +69,7 @@ class IssuesController < ApplicationController
|
|||
if @issue.reopen
|
||||
@issue.updated_by = current_user.id
|
||||
@issue.save!
|
||||
redirect_to @issue, :notice => t("issues.reopened")
|
||||
redirect_to @issue, :notice => t(".reopened")
|
||||
else
|
||||
render :show
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ class ReportsController < ApplicationController
|
|||
@report = Report.new
|
||||
@report.issue = Issue.find_or_initialize_by(create_new_report_params)
|
||||
else
|
||||
redirect_to root_path, :notice => t("reports.new.missing_params")
|
||||
redirect_to root_path, :notice => t(".missing_params")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -20,9 +20,9 @@ class ReportsController < ApplicationController
|
|||
if @report.save
|
||||
@report.issue.save
|
||||
@report.issue.reopen! unless @report.issue.open?
|
||||
redirect_to helpers.reportable_url(@report.issue.reportable), :notice => t("issues.create.successful_report")
|
||||
redirect_to helpers.reportable_url(@report.issue.reportable), :notice => t(".successful_report")
|
||||
else
|
||||
redirect_to new_report_path(:reportable_type => @report.issue.reportable_type, :reportable_id => @report.issue.reportable_id), :notice => t("issues.create.provide_details")
|
||||
redirect_to new_report_path(:reportable_type => @report.issue.reportable_type, :reportable_id => @report.issue.reportable_id), :notice => t(".provide_details")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<div class="comment">
|
||||
<%= form_for @new_comment, url: issue_comments_path(@issue) do |f| %>
|
||||
<%= richtext_area :issue_comment, :body, :cols => 10, :rows => 8, :required => true %>
|
||||
<%= label_tag :reassign, t('issues.show.comments.reassign_param') %> <%= check_box_tag :reassign, true %>
|
||||
<%= label_tag :reassign, t('.reassign_param') %> <%= check_box_tag :reassign, true %>
|
||||
<br/>
|
||||
<br/>
|
||||
<%= submit_tag 'Submit' %>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<%= form_tag(issues_path, :method => :get) do %>
|
||||
<p><%= t ".search_guidance" %></p>
|
||||
<%= select_tag :status, options_for_select(Issue.aasm.states.map(&:name).map{|state| [t("issues.states.#{state}"), state]}, params[:status]), :include_blank => t(".select_status"), :data => { :behavior => 'category_dropdown' } %>
|
||||
<%= select_tag :status, options_for_select(Issue.aasm.states.map(&:name).map{|state| [t(".states.#{state}"), state]}, params[:status]), :include_blank => t(".select_status"), :data => { :behavior => 'category_dropdown' } %>
|
||||
<%= select_tag :issue_type, options_for_select(@issue_types, params[:issue_type]), :include_blank => t(".select_type"), :data => { :behavior => 'category_dropdown' } %>
|
||||
<%= text_field_tag :search_by_user, params[:search_by_user], placeholder: t(".reported_user") %>
|
||||
<%= select_tag :last_updated_by, options_for_select(@users.all.collect{|f| [f.display_name, f.id]} << [ t(".not_updated"), "nil"], params[:last_updated_by]), :include_blank => t(".select_last_updated_by"), :data => { :behavior => 'category_dropdown' } %>
|
||||
|
@ -31,7 +31,7 @@
|
|||
<tbody>
|
||||
<% @issues.each do |issue| %>
|
||||
<tr>
|
||||
<td><%= t "issues.states.#{issue.status}" %></td>
|
||||
<td><%= t ".states.#{issue.status}" %></td>
|
||||
<td><%= link_to t(".reports_count", :count => issue.reports_count), issue %></td>
|
||||
<td><%= link_to reportable_title(issue.reportable), reportable_url(issue.reportable) %></td>
|
||||
<td><%= link_to issue.reported_user.display_name, user_path(issue.reported_user.display_name) if issue.reported_user %></td>
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
</small>
|
||||
</p>
|
||||
<p>
|
||||
<%= link_to t('issues.resolve'), resolve_issue_url(@issue), :method => :post if @issue.may_resolve? %>
|
||||
<%= link_to t('.resolve'), resolve_issue_url(@issue), :method => :post if @issue.may_resolve? %>
|
||||
<% if @issue.may_ignore? %>
|
||||
| <%= link_to t('issues.ignore'), ignore_issue_url(@issue), :method => :post %>
|
||||
| <%= link_to t('.ignore'), ignore_issue_url(@issue), :method => :post %>
|
||||
<% end %>
|
||||
</p>
|
||||
<p><%= link_to t('issues.reopen'), reopen_issue_url(@issue), :method => :post if @issue.may_reopen? %></p>
|
||||
<p><%= link_to t('.reopen'), reopen_issue_url(@issue), :method => :post if @issue.may_reopen? %></p>
|
||||
<% end %>
|
||||
|
||||
<div class="report-related-block">
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
<% end %>
|
||||
|
||||
<div class="report-disclaimer">
|
||||
<%= t('issues.new.disclaimer.intro') %>
|
||||
<%= t('.disclaimer.intro') %>
|
||||
<ul>
|
||||
<li> <%= t('issues.new.disclaimer.not_just_mistake') %> </li>
|
||||
<li> <%= t('issues.new.disclaimer.unable_to_fix') %> </li>
|
||||
<li> <%= t('issues.new.disclaimer.resolve_with_user') %> </li>
|
||||
<li> <%= t('.disclaimer.not_just_mistake') %> </li>
|
||||
<li> <%= t('.disclaimer.unable_to_fix') %> </li>
|
||||
<li> <%= t('.disclaimer.resolve_with_user') %> </li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
@ -20,19 +20,19 @@
|
|||
<% end %>
|
||||
|
||||
<div class='form-row'>
|
||||
<p><%= t('issues.new.select') %></p>
|
||||
<p><%= t('.select') %></p>
|
||||
<ul>
|
||||
<% Report.categories_for(@report.issue.reportable).each do |c| %>
|
||||
<li>
|
||||
<%= radio_button :report, :category, c %>
|
||||
<%= label_tag "report_category_#{c}", t("reports.categories.#{@report.issue.reportable.class.name.underscore}.#{c}") %> <br/>
|
||||
<%= label_tag "report_category_#{c}", t(".categories.#{@report.issue.reportable.class.name.underscore}.#{c}") %> <br/>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class='form-row'>
|
||||
<%= text_area :report, :details, :cols => 20, :rows => 5, placeholder: t('issues.new.details'), required: true %>
|
||||
<%= text_area :report, :details, :cols => 20, :rows => 5, placeholder: t('.details'), required: true %>
|
||||
</div>
|
||||
|
||||
<div class='buttons'>
|
||||
|
|
|
@ -963,10 +963,6 @@ en:
|
|||
no_results: "No results found"
|
||||
more_results: "More results"
|
||||
issues:
|
||||
report: Report
|
||||
resolve: Resolve
|
||||
ignore: Ignore
|
||||
reopen: Reopen
|
||||
index:
|
||||
title: Issues
|
||||
select_status: Select Status
|
||||
|
@ -989,21 +985,14 @@ en:
|
|||
one: "1 Report"
|
||||
other: "%{count} Reports"
|
||||
reported_item: Reported Item
|
||||
create:
|
||||
successful_report: Your report has been registered sucessfully
|
||||
provide_details: Please provide the required details
|
||||
states:
|
||||
ignored: Ignored
|
||||
open: Open
|
||||
resolved: Resolved
|
||||
update:
|
||||
new_report: Your report has been registered sucessfully
|
||||
successful_update: Your report has been updated successfully
|
||||
provide_details: Please provide the required details
|
||||
new:
|
||||
details: Please provide some more details about the problem (required).
|
||||
select: "Select a reason for your report:"
|
||||
disclaimer:
|
||||
intro: "Before sending your report to the site moderators, please ensure that:"
|
||||
not_just_mistake: You are certain that the problem is not just a mistake
|
||||
unable_to_fix: You are unable to fix the problem yourself or with the help of your fellow community members
|
||||
resolve_with_user: You have already tried to resolve the problem with the user concerned
|
||||
show:
|
||||
title: "%{status} Issue #%{issue_id}"
|
||||
reports:
|
||||
|
@ -1013,55 +1002,66 @@ en:
|
|||
report_created_at: "First reported at %{datetime}"
|
||||
last_resolved_at: "Last resolved at %{datetime}"
|
||||
last_updated_at: "Last updated at %{datetime} by %{displayname}"
|
||||
resolve: Resolve
|
||||
ignore: Ignore
|
||||
reopen: Reopen
|
||||
reports_of_this_issue: Reports of this Issue
|
||||
read_reports: Read Reports
|
||||
new_reports: New Reports
|
||||
other_issues_against_this_user: Other issues against this user
|
||||
no_other_issues: No other issues against this user.
|
||||
comments_on_this_issue: Comments on this issue
|
||||
comments:
|
||||
reassign_param: Reassign Issue?
|
||||
comment:
|
||||
provide_details: Please provide the required details
|
||||
comment_created: Your comment was successfully created
|
||||
resolve:
|
||||
resolved: Issue status has been set to 'Resolved'
|
||||
ignore:
|
||||
ignored: Issue status has been set to 'Ignored'
|
||||
reopen:
|
||||
reopened: Issue status has been set to 'Open'
|
||||
comments:
|
||||
created_at: "On %{datetime}"
|
||||
reassign_param: Reassign Issue?
|
||||
reports:
|
||||
updated_at: "On %{datetime}"
|
||||
reported_by_html: "Reported as %{category} by %{user}"
|
||||
resolved: Issue status has been set to 'Resolved'
|
||||
ignored: Issue status has been set to 'Ignored'
|
||||
reopened: Issue status has been set to 'Open'
|
||||
states:
|
||||
ignored: Ignored
|
||||
open: Open
|
||||
resolved: Resolved
|
||||
issue_comments:
|
||||
create:
|
||||
comment_created: Your comment was successfully created
|
||||
reports:
|
||||
new:
|
||||
title_html: "Report %{link}"
|
||||
missing_params: "Cannot create a new report"
|
||||
categories:
|
||||
diary_entry:
|
||||
spam: This diary entry is/contains spam
|
||||
offensive: This diary entry is obscene/offensive
|
||||
threat: This diary entry contains a threat
|
||||
other: Other
|
||||
diary_comment:
|
||||
spam: This diary comment is/contains spam
|
||||
offensive: This diary comment is obscene/offensive
|
||||
threat: This diary comment contains a threat
|
||||
other: Other
|
||||
user:
|
||||
spam: This user profile is/contains spam
|
||||
offensive: This user profile is obscene/offensive
|
||||
threat: This user profile contains a threat
|
||||
vandal: This user is a vandal
|
||||
other: Other
|
||||
note:
|
||||
spam: This note is spam
|
||||
personal: This note contains personal data
|
||||
abusive: This note is abusive
|
||||
other: Other
|
||||
details: Please provide some more details about the problem (required).
|
||||
select: "Select a reason for your report:"
|
||||
disclaimer:
|
||||
intro: "Before sending your report to the site moderators, please ensure that:"
|
||||
not_just_mistake: You are certain that the problem is not just a mistake
|
||||
unable_to_fix: You are unable to fix the problem yourself or with the help of your fellow community members
|
||||
resolve_with_user: You have already tried to resolve the problem with the user concerned
|
||||
categories:
|
||||
diary_entry:
|
||||
spam: This diary entry is/contains spam
|
||||
offensive: This diary entry is obscene/offensive
|
||||
threat: This diary entry contains a threat
|
||||
other: Other
|
||||
diary_comment:
|
||||
spam: This diary comment is/contains spam
|
||||
offensive: This diary comment is obscene/offensive
|
||||
threat: This diary comment contains a threat
|
||||
other: Other
|
||||
user:
|
||||
spam: This user profile is/contains spam
|
||||
offensive: This user profile is obscene/offensive
|
||||
threat: This user profile contains a threat
|
||||
vandal: This user is a vandal
|
||||
other: Other
|
||||
note:
|
||||
spam: This note is spam
|
||||
personal: This note contains personal data
|
||||
abusive: This note is abusive
|
||||
other: Other
|
||||
create:
|
||||
successful_report: Your report has been registered sucessfully
|
||||
provide_details: Please provide the required details
|
||||
layouts:
|
||||
project_name:
|
||||
# in <title>
|
||||
|
|
|
@ -19,7 +19,7 @@ class IssuesTest < ApplicationSystemTestCase
|
|||
sign_in_as(create(:moderator_user))
|
||||
|
||||
visit issues_path
|
||||
assert page.has_content?(I18n.t(".issues.index.issues_not_found"))
|
||||
assert page.has_content?(I18n.t("issues.index.issues_not_found"))
|
||||
end
|
||||
|
||||
def test_view_issues
|
||||
|
@ -53,19 +53,19 @@ class IssuesTest < ApplicationSystemTestCase
|
|||
visit issues_path
|
||||
fill_in "search_by_user", :with => good_user.display_name
|
||||
click_on "Search"
|
||||
assert page.has_content?(I18n.t(".issues.index.issues_not_found"))
|
||||
assert page.has_content?(I18n.t("issues.index.issues_not_found"))
|
||||
|
||||
# User doesn't exist
|
||||
visit issues_path
|
||||
fill_in "search_by_user", :with => "Nonexistant User"
|
||||
click_on "Search"
|
||||
assert page.has_content?(I18n.t(".issues.index.user_not_found"))
|
||||
assert page.has_content?(I18n.t("issues.index.user_not_found"))
|
||||
|
||||
# Find Issue against bad_user
|
||||
visit issues_path
|
||||
fill_in "search_by_user", :with => bad_user.display_name
|
||||
click_on "Search"
|
||||
assert !page.has_content?(I18n.t(".issues.index.issues_not_found"))
|
||||
assert !page.has_content?(I18n.t("issues.index.issues_not_found"))
|
||||
end
|
||||
|
||||
def test_commenting
|
||||
|
@ -76,7 +76,7 @@ class IssuesTest < ApplicationSystemTestCase
|
|||
|
||||
fill_in :issue_comment_body, :with => "test comment"
|
||||
click_on "Submit"
|
||||
assert page.has_content?(I18n.t(".issues.comment.comment_created"))
|
||||
assert page.has_content?(I18n.t("issue_comments.create.comment_created"))
|
||||
assert page.has_content?("test comment")
|
||||
|
||||
issue.reload
|
||||
|
@ -110,7 +110,7 @@ class IssuesTest < ApplicationSystemTestCase
|
|||
|
||||
visit issues_path
|
||||
|
||||
assert page.has_link?(I18n.t(".issues.index.reports_count", :count => issue1.reports_count), :href => issue_path(issue1))
|
||||
assert page.has_link?(I18n.t(".issues.index.reports_count", :count => issue2.reports_count), :href => issue_path(issue2))
|
||||
assert page.has_link?(I18n.t("issues.index.reports_count", :count => issue1.reports_count), :href => issue_path(issue1))
|
||||
assert page.has_link?(I18n.t("issues.index.reports_count", :count => issue2.reports_count), :href => issue_path(issue2))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,9 +21,9 @@ class ReportDiaryCommentTest < ApplicationSystemTestCase
|
|||
|
||||
click_on I18n.t("diary_entry.diary_comment.report")
|
||||
assert page.has_content? "Report"
|
||||
assert page.has_content? I18n.t("issues.new.disclaimer.intro")
|
||||
assert page.has_content? I18n.t("reports.new.disclaimer.intro")
|
||||
|
||||
choose I18n.t("reports.categories.diary_comment.spam")
|
||||
choose I18n.t("reports.new.categories.diary_comment.spam")
|
||||
fill_in "report_details", :with => "This comment is spam"
|
||||
click_on "Create Report"
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@ class ReportDiaryEntryTest < ApplicationSystemTestCase
|
|||
|
||||
click_on I18n.t("diary_entry.diary_entry.report")
|
||||
assert page.has_content? "Report"
|
||||
assert page.has_content? I18n.t("issues.new.disclaimer.intro")
|
||||
assert page.has_content? I18n.t("reports.new.disclaimer.intro")
|
||||
|
||||
choose I18n.t("reports.categories.diary_entry.spam")
|
||||
choose I18n.t("reports.new.categories.diary_entry.spam")
|
||||
fill_in "report_details", :with => "This is advertising"
|
||||
click_on "Create Report"
|
||||
|
||||
|
@ -39,9 +39,9 @@ class ReportDiaryEntryTest < ApplicationSystemTestCase
|
|||
|
||||
click_on I18n.t("diary_entry.diary_entry.report")
|
||||
assert page.has_content? "Report"
|
||||
assert page.has_content? I18n.t("issues.new.disclaimer.intro")
|
||||
assert page.has_content? I18n.t("reports.new.disclaimer.intro")
|
||||
|
||||
choose I18n.t("reports.categories.diary_entry.spam")
|
||||
choose I18n.t("reports.new.categories.diary_entry.spam")
|
||||
fill_in "report_details", :with => "This is advertising"
|
||||
click_on "Create Report"
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ class ReportNoteTest < ApplicationSystemTestCase
|
|||
|
||||
click_on I18n.t("browse.note.report")
|
||||
assert page.has_content? "Report"
|
||||
assert page.has_content? I18n.t("issues.new.disclaimer.intro")
|
||||
assert page.has_content? I18n.t("reports.new.disclaimer.intro")
|
||||
|
||||
choose I18n.t("reports.categories.note.spam")
|
||||
choose I18n.t("reports.new.categories.note.spam")
|
||||
fill_in "report_details", :with => "This is spam"
|
||||
click_on "Create Report"
|
||||
|
||||
|
@ -35,9 +35,9 @@ class ReportNoteTest < ApplicationSystemTestCase
|
|||
|
||||
click_on I18n.t("browse.note.report")
|
||||
assert page.has_content? "Report"
|
||||
assert page.has_content? I18n.t("issues.new.disclaimer.intro")
|
||||
assert page.has_content? I18n.t("reports.new.disclaimer.intro")
|
||||
|
||||
choose I18n.t("reports.categories.note.spam")
|
||||
choose I18n.t("reports.new.categories.note.spam")
|
||||
fill_in "report_details", :with => "This is spam"
|
||||
click_on "Create Report"
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ class ReportUserTest < ApplicationSystemTestCase
|
|||
|
||||
click_on I18n.t("user.view.report")
|
||||
assert page.has_content? "Report"
|
||||
assert page.has_content? I18n.t("issues.new.disclaimer.intro")
|
||||
assert page.has_content? I18n.t("reports.new.disclaimer.intro")
|
||||
|
||||
choose I18n.t("reports.categories.user.vandal")
|
||||
choose I18n.t("reports.new.categories.user.vandal")
|
||||
fill_in "report_details", :with => "This user is a vandal"
|
||||
click_on "Create Report"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue