diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index e08dd3003..2d70e1656 100644 --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -392,13 +392,21 @@ module QueriesHelper content_tag('ul', queries.collect {|query| css = +'query' - css << ' selected' if query == @query - content_tag('li', link_to(query.name, url_params.merge(:query_id => query), :class => css)) + clear_link = +'' + if query == @query + css << ' selected' + clear_link += link_to_clear_query + end + content_tag('li', link_to(query.name, url_params.merge(:query_id => query), :class => css) + clear_link.html_safe) }.join("\n").html_safe, :class => 'queries' ) + "\n" end + def link_to_clear_query + link_to l(:button_clear), { :set_filter => 1, :sort => '', :project_id => @project }, :class => 'icon-only icon-close-query', :title => l(:button_clear) + end + # Renders the list of queries for the sidebar def render_sidebar_queries(klass, project) queries = sidebar_queries(klass, project) diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index d5f1762e3..cae99d713 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -94,6 +94,8 @@ div[id^="wrapper"] { min-height: inherit; } #sidebar ul li, ul.flat li {list-style-type:none;margin: 0px 2px 0px 0px; padding: 0px 0px 0px 0px;} #sidebar div.wiki ul {margin:inherit; padding-left:40px;} #sidebar div.wiki ul li {list-style-type:inherit;} +#sidebar a.icon-only {opacity: 0.4; margin-left: 5px;} +#sidebar a.icon-only:hover {opacity: 1;} #content { flex-grow: 1; background-color: #fff; margin: 0px; padding: 6px 10px 10px 10px; overflow-x: auto;} html>body #content { min-height: 600px; } @@ -406,8 +408,6 @@ body.controller-issues .query-totals {margin-top:-2.3em;} td.center {text-align:center;} #watchers select {width: 95%; display: block;} -#watchers a.delete {opacity: 0.4; margin-left: 5px;} -#watchers a.delete:hover {opacity: 1;} #watchers img.gravatar {margin: 0 4px 2px 0;} span#watchers_inputs {overflow:auto; display:block;} @@ -1487,6 +1487,7 @@ td.gantt_selected_column .gantt_hdr,.gantt_selected_column_container { .icon-list { background-image: url(../images/text_list_bullets.png); } .icon-close { background-image: url(../images/close.png); } .icon-close:hover { background-image: url(../images/close_hl.png); } +.icon-close-query { background-image: url(../images/close_hl.png); } .icon-settings { background-image: url(../images/changeset.png); } .icon-group, .icon-groupnonmember, .icon-groupanonymous { background-image: url(../images/group.png); } .icon-roles { background-image: url(../images/database_key.png); } diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 2945e8a0a..3cb1a405e 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -292,6 +292,17 @@ class IssuesControllerTest < Redmine::ControllerTest :query_id => 5 } assert_response :success + + assert_select '#sidebar .queries' do + # assert only query is selected in sidebar + assert_select 'a.query.selected', 1 + # assert link properties + assert_select 'a.query.selected[href=?]', '/projects/ecookbook/issues?query_id=5', :text => "Open issues by priority and tracker" + # assert only one clear link exists + assert_select 'a.icon-close-query', 1 + # assert clear link properties + assert_select 'a.icon-close-query[title=?][href=?]', 'Clear', '/projects/ecookbook/issues?set_filter=1&sort=', 1 + end end def test_index_with_query_grouped_by_tracker