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

Filter projects on dashboard

parent fcccf762
......@@ -8,6 +8,21 @@ class Dashboard
@toggleFilter($(event.currentTarget))
@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: ->
$(".content_list").html ''
Pager.init 20, true
......
......@@ -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
%h5.title
Projects
%span.light
(#{@projects_count})
%h5.title.clearfix
= search_field_tag :filter_projects, nil, placeholder: 'Filter by name', class: 'dash-projects-filter'
- if current_user.can_create_project?
%span.pull-right
= link_to new_project_path, class: "btn btn-small" do
= link_to new_project_path, class: "btn" do
%i.icon-plus
New Project
%ul.well-list
%ul.well-list.dash-projects-list
- projects.each do |project|
%li
= link_to project_path(project), class: dom_class(project) do
......
%ul.nav.nav-tabs.dash-sidebar-tabs
%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
= 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-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