diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index e08dd3003..55b7d5812 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-clear-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 45bcc3d39..b2eb47167 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -94,6 +94,8 @@ div#wrapper, div#wrapper2, div#wrapper3 { 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;} @@ -1515,6 +1515,7 @@ td.gantt_selected_column .gantt_hdr,.gantt_selected_column_container { .icon-sorted-desc { background-image: url(../images/arrow_up.png); } .icon-toggle-plus { background-image: url(../images/bullet_toggle_plus.png) } .icon-toggle-minus { background-image: url(../images/bullet_toggle_minus.png) } +.icon-clear-query { background-image: url(../images/close_hl.png); } .icon-file { background-image: url(../images/files/default.png); } .icon-file.text-plain { background-image: url(../images/files/text.png); } diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 2945e8a0a..b9ef3bb27 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-clear-query', 1 + # assert clear link properties + assert_select 'a.icon-clear-query[title=?][href=?]', 'Clear', '/projects/ecookbook/issues?set_filter=1&sort=', 1 + end end def test_index_with_query_grouped_by_tracker