diff --git a/app/helpers/work_packages_filter_helper.rb b/app/helpers/work_packages_filter_helper.rb index ae3ad294c2..3c2e558a5f 100644 --- a/app/helpers/work_packages_filter_helper.rb +++ b/app/helpers/work_packages_filter_helper.rb @@ -29,84 +29,120 @@ module WorkPackagesFilterHelper # General - def project_property_path(project, property, property_id) + def project_property_path(project, property, property_id, options = {}) query = { f: [ filter_object(property, "=", property_id), ], t: default_sort } - project_work_packages_with_query_path(project, query) + project_work_packages_with_query_path(project, query, options) end # Links for my page - def work_packages_assigned_to_me_path + def work_packages_assigned_to_me_path(options = {}) query = { f: [ filter_object("assigned_to_id", "=", "me") ], t: 'priority:desc,updated_at:desc' } - work_packages_with_query_path(query) + work_packages_with_query_path(query, options) end - def work_packages_reported_by_me_path + def work_packages_reported_by_me_path(options = {}) query = { f: [ filter_object("author_id", "=", "me") ], t: 'updated_at:desc' } - work_packages_with_query_path(query) + work_packages_with_query_path(query, options) end - def work_packages_responsible_for_path + def work_packages_responsible_for_path(options = {}) query = { f: [ filter_object("responsible_id", "=", "me") ], t: 'priority:desc,updated_at:desc' } - work_packages_with_query_path(query) + work_packages_with_query_path(query, options) end - def work_packages_watched_path + def work_packages_watched_path(options = {}) query = { f: [ filter_object("watcher_id", "=", "me") ], t: 'updated_at:desc' } - work_packages_with_query_path(query) + work_packages_with_query_path(query, options) + end + + # Links for My Project Page plugin + + def project_work_packages_assigned_to_me_path(project, options = {}) + query = { + f: [ filter_object("assigned_to_id", "=", "me") ], + t: 'priority:desc,updated_at:desc' + } + project_work_packages_with_query_path(project, query, options) + end + + def project_work_packages_reported_by_me_path(project, options = {}) + query = { + f: [ filter_object("author_id", "=", "me") ], + t: 'updated_at:desc' + } + project_work_packages_with_query_path(project, query, options) + end + + def project_work_packages_responsible_for_path(project, options = {}) + query = { + f: [ filter_object("responsible_id", "=", "me") ], + t: 'priority:desc,updated_at:desc' + } + project_work_packages_with_query_path(project, query, options) + end + + def project_work_packages_watched_path(project, options = {}) + query = { + f: [ filter_object("watcher_id", "=", "me") ], + t: 'updated_at:desc' + } + project_work_packages_with_query_path(project, query, options) end # Links for project overview - def project_work_packages_closed_version_path(version) + def project_work_packages_closed_version_path(version, options = {}) query = { f: [ filter_object("status_id", "c"), filter_object("fixed_version_id", "=", version.id) ] } - project_work_packages_with_query_path(version.project, query) + project_work_packages_with_query_path(version.project, query, options) end - def project_work_packages_open_version_path(version) + def project_work_packages_open_version_path(version, options = {}) query = { f: [ filter_object("status_id", "o"), filter_object("fixed_version_id", "=", version.id) ] } - project_work_packages_with_query_path(version.project, query) + project_work_packages_with_query_path(version.project, query, options) end # Links for reports - def project_report_property_path(project, property, property_id) + + def project_report_property_path(project, property_name, property_id, options = {}) query = { f: [ + filter_object("status_id", "*"), filter_object("subproject_id", "!*"), - filter_object(property, "=", property_id), + filter_object(property_name, "=", property_id), ], t: default_sort } - project_work_packages_with_query_path(project, query) + project_work_packages_with_query_path(project, query, options) end - def project_report_property_status_path(project, status_id, property, property_id) + def project_report_property_status_path(project, status_id, property, property_id, options = {}) query = { f: [ filter_object("status_id", "=", status_id), @@ -115,10 +151,10 @@ module WorkPackagesFilterHelper ], t: default_sort } - project_work_packages_with_query_path(project, query) + project_work_packages_with_query_path(project, query, options) end - def project_report_property_open_path(project, property, property_id) + def project_report_property_open_path(project, property, property_id, options = {}) query = { f: [ filter_object("status_id", "o"), @@ -127,10 +163,10 @@ module WorkPackagesFilterHelper ], t: default_sort } - project_work_packages_with_query_path(project, query) + project_work_packages_with_query_path(project, query, options) end - def project_report_property_closed_path(project, property, property_id) + def project_report_property_closed_path(project, property, property_id, options = {}) query = { f: [ filter_object("status_id", "c"), @@ -139,19 +175,19 @@ module WorkPackagesFilterHelper ], t: default_sort } - project_work_packages_with_query_path(project, query) + project_work_packages_with_query_path(project, query, options) end - def project_report_property_any_status_path(project, property, property_id) + def project_version_property_path(version, property_name, property_id, options = {}) query = { f: [ filter_object("status_id", "*"), - filter_object("subproject_id", "!*"), - filter_object(property, "=", property_id), + filter_object("fixed_version_id", "=", version.id), + filter_object(property_name, "=", property_id), ], t: default_sort } - project_work_packages_with_query_path(project, query) + project_work_packages_with_query_path(version.project, query, options) end private @@ -160,12 +196,12 @@ module WorkPackagesFilterHelper 'updated_at:desc' end - def work_packages_with_query_path(query) - work_packages_path(query_props: query.to_json) + def work_packages_with_query_path(query, options = {}) + work_packages_path(options.reverse_merge!(query_props: query.to_json)) end - def project_work_packages_with_query_path(project, query) - project_work_packages_path(project, query_props: query.to_json) + def project_work_packages_with_query_path(project, query, options = {}) + project_work_packages_path(project, options.reverse_merge!(query_props: query.to_json)) end def filter_object(property, operator, values = nil) diff --git a/app/views/my/blocks/_issuesassignedtome.html.erb b/app/views/my/blocks/_issuesassignedtome.html.erb index 2c2d547555..1a961d8eb6 100644 --- a/app/views/my/blocks/_issuesassignedtome.html.erb +++ b/app/views/my/blocks/_issuesassignedtome.html.erb @@ -55,7 +55,6 @@ See doc/COPYRIGHT.rdoc for more details. <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, - {controller: :work_packages, action: :index, set_filter: 1, - assigned_to_id: 'me', format: 'atom', key: User.current.rss_key}, + work_packages_assigned_to_me_path({:format => 'atom', :key => User.current.rss_key}), {title: l(:label_assigned_to_me_work_packages)}) %> <% end %> diff --git a/app/views/my/blocks/_issuesreportedbyme.html.erb b/app/views/my/blocks/_issuesreportedbyme.html.erb index 5b86863ca8..e51abfb0e4 100644 --- a/app/views/my/blocks/_issuesreportedbyme.html.erb +++ b/app/views/my/blocks/_issuesreportedbyme.html.erb @@ -49,7 +49,6 @@ See doc/COPYRIGHT.rdoc for more details. <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, - {controller: :work_packages, action: :index, set_filter: 1, - author_id: 'me', format: 'atom', key: User.current.rss_key}, + work_packages_reported_by_me_path({:format => 'atom', :key => User.current.rss_key}), {title: l(:label_reported_work_packages)}) %> <% end %> diff --git a/app/views/my/blocks/_workpackagesresponsiblefor.html.erb b/app/views/my/blocks/_workpackagesresponsiblefor.html.erb index ad355dbf3b..e722af4cb2 100644 --- a/app/views/my/blocks/_workpackagesresponsiblefor.html.erb +++ b/app/views/my/blocks/_workpackagesresponsiblefor.html.erb @@ -55,7 +55,6 @@ See doc/COPYRIGHT.rdoc for more details. <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, - {controller: :work_packages, action: :index, set_filter: 1, - responsible_id: 'me', format: 'atom', key: User.current.rss_key}, + work_packages_responsible_for_path({:format => 'atom', :key => User.current.rss_key}), {title: l(:label_responsible_for_work_packages)}) %> <% end %> diff --git a/app/views/versions/_work_package_counts.html.erb b/app/views/versions/_work_package_counts.html.erb index 1390c72c70..ff6784aed8 100644 --- a/app/views/versions/_work_package_counts.html.erb +++ b/app/views/versions/_work_package_counts.html.erb @@ -53,12 +53,8 @@ See doc/COPYRIGHT.rdoc for more details.