From 886c3e295b25b6e9098b18285aa87d7a0abe3e41 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 21 Feb 2011 13:34:33 +0000 Subject: [PATCH] Splits private/public issue queries in the sidebar (#1067). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4908 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/issues_helper.rb | 18 +++++++++++++++++- app/views/issues/_sidebar.rhtml | 8 +------- config/locales/bg.yml | 1 + config/locales/bs.yml | 1 + config/locales/ca.yml | 1 + config/locales/cs.yml | 1 + config/locales/da.yml | 1 + config/locales/de.yml | 1 + config/locales/el.yml | 1 + config/locales/en.yml | 1 + config/locales/es.yml | 1 + config/locales/eu.yml | 1 + config/locales/fa.yml | 1 + config/locales/fi.yml | 1 + config/locales/fr.yml | 1 + config/locales/gl.yml | 1 + config/locales/he.yml | 1 + config/locales/hr.yml | 1 + config/locales/hu.yml | 1 + config/locales/id.yml | 1 + config/locales/it.yml | 1 + config/locales/ja.yml | 1 + config/locales/ko.yml | 1 + config/locales/lt.yml | 1 + config/locales/lv.yml | 1 + config/locales/mk.yml | 1 + config/locales/mn.yml | 1 + config/locales/nl.yml | 1 + config/locales/no.yml | 1 + config/locales/pl.yml | 1 + config/locales/pt-BR.yml | 1 + config/locales/pt.yml | 1 + config/locales/ro.yml | 1 + config/locales/ru.yml | 1 + config/locales/sk.yml | 1 + config/locales/sl.yml | 1 + config/locales/sr-YU.yml | 1 + config/locales/sr.yml | 1 + config/locales/sv.yml | 1 + config/locales/th.yml | 1 + config/locales/tr.yml | 1 + config/locales/uk.yml | 1 + config/locales/vi.yml | 1 + config/locales/zh-TW.yml | 1 + config/locales/zh.yml | 1 + 45 files changed, 61 insertions(+), 8 deletions(-) diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index ce23668e..38cc52fe 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -106,13 +106,29 @@ module IssuesHelper # Project specific queries and global queries visible << (@project.nil? ? ["project_id IS NULL"] : ["project_id IS NULL OR project_id = ?", @project.id]) @sidebar_queries = Query.find(:all, - :select => 'id, name', + :select => 'id, name, is_public', :order => "name ASC", :conditions => visible.conditions) end @sidebar_queries end + def query_links(title, queries) + content_tag('h3', title) + + queries.collect {|query| + link_to(h(query.name), :controller => 'issues', :action => 'index', :project_id => @project, :query_id => query) + }.join('
') + end + + def render_sidebar_queries + out = '' + queries = sidebar_queries.select {|q| !q.is_public?} + out << query_links(l(:label_my_queries), queries) if queries.any? + queries = sidebar_queries.select {|q| q.is_public?} + out << query_links(l(:label_query_plural), queries) if queries.any? + out + end + def show_detail(detail, no_html=false) case detail.property when 'attr' diff --git a/app/views/issues/_sidebar.rhtml b/app/views/issues/_sidebar.rhtml index db85f97b..6de1c2d6 100644 --- a/app/views/issues/_sidebar.rhtml +++ b/app/views/issues/_sidebar.rhtml @@ -13,11 +13,5 @@ <% end %> <%= call_hook(:view_issues_sidebar_planning_bottom) %> -<% unless sidebar_queries.empty? -%> -

<%= l(:label_query_plural) %>

- -<% sidebar_queries.each do |query| -%> -<%= link_to(h(query.name), :controller => 'issues', :action => 'index', :project_id => @project, :query_id => query) %>
-<% end -%> +<%= render_sidebar_queries %> <%= call_hook(:view_issues_sidebar_queries_bottom) %> -<% end -%> diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 1f79f60a..ac507e4f 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -945,3 +945,4 @@ bg: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/bs.yml b/config/locales/bs.yml index 8d991ee0..04d4c99f 100644 --- a/config/locales/bs.yml +++ b/config/locales/bs.yml @@ -959,3 +959,4 @@ bs: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 0bdf1d41..62e69ace 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -948,3 +948,4 @@ ca: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/cs.yml b/config/locales/cs.yml index 46a08d66..0b3110a0 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -1169,3 +1169,4 @@ cs: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/da.yml b/config/locales/da.yml index b2b00e71..fad0592f 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -961,3 +961,4 @@ da: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/de.yml b/config/locales/de.yml index 0592c5a4..d62eb2ce 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -962,3 +962,4 @@ de: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/el.yml b/config/locales/el.yml index ee110c63..98f7dae3 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -945,3 +945,4 @@ el: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/en.yml b/config/locales/en.yml index 3c8f4c33..6989ee77 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -595,6 +595,7 @@ en: label_query: Custom query label_query_plural: Custom queries label_query_new: New query + label_my_queries: My custom queries label_filter_add: Add filter label_filter_plural: Filters label_equals: is diff --git a/config/locales/es.yml b/config/locales/es.yml index 3f153a6d..b6b6ed92 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -982,3 +982,4 @@ es: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/eu.yml b/config/locales/eu.yml index d0f2e993..425a6070 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -949,3 +949,4 @@ eu: setting_commit_logtime_enabled: "Erregistrutako denbora gaitu" notice_gantt_chart_truncated: Grafikoa moztu da bistara daitekeen elementuen kopuru maximoa gainditu delako (%{max}) setting_gantt_items_limit: "Gantt grafikoan bistara daitekeen elementu kopuru maximoa" + label_my_queries: My custom queries diff --git a/config/locales/fa.yml b/config/locales/fa.yml index f4635875..03186b77 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -941,3 +941,4 @@ fa: text_tip_issue_begin_end_day: issue beginning and ending this day text_tip_issue_end_day: issue ending this day text_warn_on_leaving_unsaved: The current page contains unsaved text that will be lost if you leave this page. + label_my_queries: My custom queries diff --git a/config/locales/fi.yml b/config/locales/fi.yml index a71a1959..948aaae2 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -966,3 +966,4 @@ fi: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 41bfb5e3..a8df9de4 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -596,6 +596,7 @@ fr: label_query: Rapport personnalisé label_query_plural: Rapports personnalisés label_query_new: Nouveau rapport + label_my_queries: Mes rapports personnalisés label_filter_add: "Ajouter le filtre " label_filter_plural: Filtres label_equals: égal diff --git a/config/locales/gl.yml b/config/locales/gl.yml index 67335357..6e98cb7f 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -957,3 +957,4 @@ gl: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/he.yml b/config/locales/he.yml index 0fe8f0cf..767d4754 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -950,3 +950,4 @@ he: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/hr.yml b/config/locales/hr.yml index ba853797..93ae02af 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -952,3 +952,4 @@ hr: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 4cfa9d26..9f124a6d 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -964,3 +964,4 @@ label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/id.yml b/config/locales/id.yml index a9970701..ba2d27e3 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -953,3 +953,4 @@ id: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/it.yml b/config/locales/it.yml index ee751d4c..45e693e9 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -946,3 +946,4 @@ it: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/ja.yml b/config/locales/ja.yml index fd55d952..23471098 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -966,3 +966,4 @@ ja: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/ko.yml b/config/locales/ko.yml index aafb8ec4..bd6a96cf 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -997,3 +997,4 @@ ko: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/lt.yml b/config/locales/lt.yml index 7a55c54e..bea93e63 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -1005,3 +1005,4 @@ lt: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/lv.yml b/config/locales/lv.yml index f5a6a440..51e95ea0 100644 --- a/config/locales/lv.yml +++ b/config/locales/lv.yml @@ -940,3 +940,4 @@ lv: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/mk.yml b/config/locales/mk.yml index cd41c837..970608a8 100644 --- a/config/locales/mk.yml +++ b/config/locales/mk.yml @@ -945,3 +945,4 @@ mk: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/mn.yml b/config/locales/mn.yml index 520114a4..08dd597e 100644 --- a/config/locales/mn.yml +++ b/config/locales/mn.yml @@ -946,3 +946,4 @@ mn: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/nl.yml b/config/locales/nl.yml index f0787221..4a808f87 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -927,3 +927,4 @@ nl: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/no.yml b/config/locales/no.yml index 242ef875..79a2a609 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -932,3 +932,4 @@ label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/pl.yml b/config/locales/pl.yml index c4fc3460..c35c8149 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -962,3 +962,4 @@ pl: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 6f321f60..9d4fb416 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -965,3 +965,4 @@ pt-BR: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/pt.yml b/config/locales/pt.yml index 0fc086bb..fbc0c365 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -949,3 +949,4 @@ pt: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/ro.yml b/config/locales/ro.yml index 004c17a9..343d8c1d 100644 --- a/config/locales/ro.yml +++ b/config/locales/ro.yml @@ -938,3 +938,4 @@ ro: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 11c44b3c..63bcb4e2 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -1058,3 +1058,4 @@ ru: label_cvs_path: CVSROOT label_git_path: Путь к каталогу .git label_mercurial_path: Каталог + label_my_queries: My custom queries diff --git a/config/locales/sk.yml b/config/locales/sk.yml index e71d5b8c..a7430f76 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -940,3 +940,4 @@ sk: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/sl.yml b/config/locales/sl.yml index fef33bfe..4fa87a0f 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -941,3 +941,4 @@ sl: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/sr-YU.yml b/config/locales/sr-YU.yml index c5eb04e3..1f4674ab 100644 --- a/config/locales/sr-YU.yml +++ b/config/locales/sr-YU.yml @@ -945,3 +945,4 @@ sr-YU: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/sr.yml b/config/locales/sr.yml index 4cacef55..1118f3a1 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -946,3 +946,4 @@ sr: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/sv.yml b/config/locales/sv.yml index 0a68eb7c..97a85dd2 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -986,3 +986,4 @@ sv: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/th.yml b/config/locales/th.yml index 110d7044..78ed93a6 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -942,3 +942,4 @@ th: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/tr.yml b/config/locales/tr.yml index 9c039584..b066ff20 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -964,3 +964,4 @@ tr: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/uk.yml b/config/locales/uk.yml index efcc6632..ed100385 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -941,3 +941,4 @@ uk: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/vi.yml b/config/locales/vi.yml index b163a85b..48be079c 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -996,3 +996,4 @@ vi: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 6de2ce73..22d9749e 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -1026,3 +1026,4 @@ label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 4a2de541..2473eac1 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -959,3 +959,4 @@ zh: label_cvs_path: CVSROOT label_git_path: Path to .git directory label_mercurial_path: Root directory + label_my_queries: My custom queries