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)
#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; }
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;}
.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); }
: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