Commit 78680a81 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Filter projects on dashboard

parent fcccf762
...@@ -8,6 +8,21 @@ class Dashboard ...@@ -8,6 +8,21 @@ class Dashboard
@toggleFilter($(event.currentTarget)) @toggleFilter($(event.currentTarget))
@reloadActivities() @reloadActivities()
$(".dash-projects-filter").keyup ->
terms = $(this).val()
if terms == "" || terms == undefined
$(".dash-projects-list li").show()
else
$(".dash-projects-list li").each (index) ->
name = $(this).find(".well-title").text()
if name.search(terms) == -1
$(this).hide()
else
$(this).show()
reloadActivities: -> reloadActivities: ->
$(".content_list").html '' $(".content_list").html ''
Pager.init 20, true Pager.init 20, true
......
...@@ -46,3 +46,13 @@ ...@@ -46,3 +46,13 @@
} }
} }
.dashboard {
.dash-projects-filter {
margin: 0;
padding: 4px 6px;
width: 202px;
float: left;
margin-top: 3px;
margin-left: -2px;
}
}
.ui-box .ui-box
%h5.title %h5.title.clearfix
Projects = search_field_tag :filter_projects, nil, placeholder: 'Filter by name', class: 'dash-projects-filter'
%span.light
(#{@projects_count})
- if current_user.can_create_project? - if current_user.can_create_project?
%span.pull-right %span.pull-right
= link_to new_project_path, class: "btn btn-small" do = link_to new_project_path, class: "btn" do
%i.icon-plus %i.icon-plus
New Project New Project
%ul.well-list %ul.well-list.dash-projects-list
- projects.each do |project| - projects.each do |project|
%li %li
= link_to project_path(project), class: dom_class(project) do = link_to project_path(project), class: dom_class(project) do
......
%ul.nav.nav-tabs.dash-sidebar-tabs %ul.nav.nav-tabs.dash-sidebar-tabs
%li.active %li.active
= link_to 'Projects', '#projects', 'data-toggle' => 'tab', id: 'sidebar-projects-tab' = link_to '#projects', 'data-toggle' => 'tab', id: 'sidebar-projects-tab' do
Projects
%span.badge= @projects_count
%li %li
= link_to 'Groups', '#groups', 'data-toggle' => 'tab', id: 'sidebar-groups-tab' = link_to '#groups', 'data-toggle' => 'tab', id: 'sidebar-groups-tab' do
Groups
%span.badge= @groups.count
.tab-content .tab-content
.tab-pane.active#projects .tab-pane.active#projects
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment