Project

General

Profile

Patch #31640 » 0001-Add-clear-link-icon-for-selected-query-in-sidebar.patch

Marius BĂLTEANU, 2019-06-29 13:57

View differences:

app/helpers/queries_helper.rb
392 392
      content_tag('ul',
393 393
        queries.collect {|query|
394 394
            css = +'query'
395
            css << ' selected' if query == @query
396
            content_tag('li', link_to(query.name, url_params.merge(:query_id => query), :class => css))
395
            clear_link = +''
396
            if query == @query
397
              css << ' selected'
398
              clear_link += link_to_clear_query
399
            end
400
            content_tag('li', link_to(query.name, url_params.merge(:query_id => query), :class => css) + clear_link.html_safe)
397 401
          }.join("\n").html_safe,
398 402
        :class => 'queries'
399 403
      ) + "\n"
400 404
  end
401 405

  
406
  def link_to_clear_query
407
    link_to l(:button_clear), { :set_filter => 1, :sort => '', :project_id => @project }, :class => 'icon-only icon-reload', :title => l(:button_clear)
408
  end
409

  
402 410
  # Renders the list of queries for the sidebar
403 411
  def render_sidebar_queries(klass, project)
404 412
    queries = sidebar_queries(klass, project)
public/stylesheets/application.css
91 91
#sidebar ul li, ul.flat li {list-style-type:none;margin: 0px 2px 0px 0px; padding: 0px 0px 0px 0px;}
92 92
#sidebar div.wiki ul {margin:inherit; padding-left:40px;}
93 93
#sidebar div.wiki ul li {list-style-type:inherit;}
94
#sidebar a.icon-only {opacity: 0.4; margin-left: 5px;}
95
#sidebar a.icon-only:hover {opacity: 1;}
94 96

  
95 97
#content { flex-grow: 1; background-color: #fff; margin: 0px; padding: 6px 10px 10px 10px; overflow-x: auto;}
96 98
html>body #content { min-height: 600px; }
......
403 405
td.center {text-align:center;}
404 406

  
405 407
#watchers select {width: 95%; display: block;}
406
#watchers a.delete {opacity: 0.4; margin-left: 5px;}
407
#watchers a.delete:hover {opacity: 1;}
408 408
#watchers img.gravatar {margin: 0 4px 2px 0;}
409 409

  
410 410
span#watchers_inputs {overflow:auto; display:block;}
test/functional/issues_controller_test.rb
292 292
        :query_id => 5
293 293
      }
294 294
    assert_response :success
295

  
296
    assert_select '#sidebar .queries' do
297
      # assert only query is selected in sidebar
298
      assert_select 'a.query.selected', 1
299
      # assert link properties
300
      assert_select 'a.query.selected[href=?]', '/projects/ecookbook/issues?query_id=5', :text => "Open issues by priority and tracker"
301
      # assert only one clear link exists
302
      assert_select 'a.icon-reload', 1
303
      # assert clear link properties
304
      assert_select 'a.icon-reload[title=?][href=?]', 'Clear', '/projects/ecookbook/issues?set_filter=1&sort=', 1
305
    end
295 306
  end
296 307

  
297 308
  def test_index_with_query_grouped_by_tracker
(3-3/7)