Commit 78680a81774d67997fa0abece4dc1d4a5ec12ce6
1 parent
fcccf762
Exists in
master
and in
4 other branches
Filter projects on dashboard
Showing
4 changed files
with
35 additions
and
8 deletions
Show diff stats
app/assets/javascripts/dashboard.js.coffee
... | ... | @@ -8,6 +8,21 @@ class Dashboard |
8 | 8 | @toggleFilter($(event.currentTarget)) |
9 | 9 | @reloadActivities() |
10 | 10 | |
11 | + $(".dash-projects-filter").keyup -> | |
12 | + terms = $(this).val() | |
13 | + if terms == "" || terms == undefined | |
14 | + $(".dash-projects-list li").show() | |
15 | + else | |
16 | + $(".dash-projects-list li").each (index) -> | |
17 | + name = $(this).find(".well-title").text() | |
18 | + | |
19 | + if name.search(terms) == -1 | |
20 | + $(this).hide() | |
21 | + else | |
22 | + $(this).show() | |
23 | + | |
24 | + | |
25 | + | |
11 | 26 | reloadActivities: -> |
12 | 27 | $(".content_list").html '' |
13 | 28 | Pager.init 20, true | ... | ... |
app/assets/stylesheets/sections/dashboard.scss
app/views/dashboard/_projects.html.haml
1 | 1 | .ui-box |
2 | - %h5.title | |
3 | - Projects | |
4 | - %span.light | |
5 | - (#{@projects_count}) | |
2 | + %h5.title.clearfix | |
3 | + = search_field_tag :filter_projects, nil, placeholder: 'Filter by name', class: 'dash-projects-filter' | |
6 | 4 | - if current_user.can_create_project? |
7 | 5 | %span.pull-right |
8 | - = link_to new_project_path, class: "btn btn-small" do | |
6 | + = link_to new_project_path, class: "btn" do | |
9 | 7 | %i.icon-plus |
10 | 8 | New Project |
11 | 9 | |
12 | - %ul.well-list | |
10 | + %ul.well-list.dash-projects-list | |
13 | 11 | - projects.each do |project| |
14 | 12 | %li |
15 | 13 | = link_to project_path(project), class: dom_class(project) do | ... | ... |
app/views/dashboard/_sidebar.html.haml
1 | 1 | %ul.nav.nav-tabs.dash-sidebar-tabs |
2 | 2 | %li.active |
3 | - = link_to 'Projects', '#projects', 'data-toggle' => 'tab', id: 'sidebar-projects-tab' | |
3 | + = link_to '#projects', 'data-toggle' => 'tab', id: 'sidebar-projects-tab' do | |
4 | + Projects | |
5 | + %span.badge= @projects_count | |
4 | 6 | %li |
5 | - = link_to 'Groups', '#groups', 'data-toggle' => 'tab', id: 'sidebar-groups-tab' | |
7 | + = link_to '#groups', 'data-toggle' => 'tab', id: 'sidebar-groups-tab' do | |
8 | + Groups | |
9 | + %span.badge= @groups.count | |
6 | 10 | |
7 | 11 | .tab-content |
8 | 12 | .tab-pane.active#projects | ... | ... |