Commit 95d61a094d4d69fc332b40923ba08bbb57776f39

Authored by Dmitriy Zaporozhets
1 parent 4e55dd5f

Improve admin/projects page

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/assets/stylesheets/sections/admin.scss
... ... @@ -21,12 +21,22 @@
21 21 }
22 22  
23 23 .admin-filter form {
24   - label { width: 110px; }
25   - .controls { margin-left: 130px; }
26   - .form-actions { padding-left: 130px; background: #fff }
27   - .visibility-levels {
28   - .controls {
29   - margin-bottom: 9px;
  24 + .select2-container {
  25 + width: 100%
  26 + }
  27 +
  28 + .controls {
  29 + margin-left: 130px;
  30 + }
  31 +
  32 + .form-actions {
  33 + padding-left: 130px;
  34 + background: #fff
  35 + }
  36 +
  37 + .visibility-levels {
  38 + .controls {
  39 + margin-bottom: 9px;
30 40 }
31 41  
32 42 i {
... ...
app/controllers/admin/projects_controller.rb
... ... @@ -4,10 +4,8 @@ class Admin::ProjectsController &lt; Admin::ApplicationController
4 4 before_filter :repository, only: [:show, :transfer]
5 5  
6 6 def index
7   - owner_id = params[:owner_id]
8   - user = User.find_by(id: owner_id)
9   -
10   - @projects = user ? user.owned_projects : Project.all
  7 + @projects = Project.all
  8 + @projects = @projects.where(namespace_id: params[:namespace_id]) if params[:namespace_id].present?
11 9 @projects = @projects.where("visibility_level IN (?)", params[:visibility_levels]) if params[:visibility_levels].present?
12 10 @projects = @projects.with_push if params[:with_push].present?
13 11 @projects = @projects.abandoned if params[:abandoned].present?
... ...
app/views/admin/projects/index.html.haml
1 1 .row
2   - .col-md-4
  2 + .col-md-3
3 3 .admin-filter
4 4 = form_tag admin_projects_path, method: :get, class: '' do
5 5 .form-group
... ... @@ -7,19 +7,21 @@
7 7 = text_field_tag :name, params[:name], class: "form-control"
8 8  
9 9 .form-group
10   - = label_tag :owner_id, 'Owner:'
11   - %div
12   - = users_select_tag :owner_id, selected: params[:owner_id], class: 'input-large input-clamp'
13   - .checkbox
14   - = label_tag :with_push, 'Not empty'
15   - = check_box_tag :with_push, 1, params[:with_push]
16   - &nbsp;
17   - %span.light Projects with push events
18   - .checkbox
19   - = label_tag :abandoned, 'Abandoned'
20   - = check_box_tag :abandoned, 1, params[:abandoned]
21   - &nbsp;
22   - %span.light No activity over 6 month
  10 + = label_tag :namespace_id, "Namespace"
  11 + = namespace_select_tag :namespace_id, selected: params[:namespace_id], class: 'input-large'
  12 +
  13 + .form-group
  14 + %strong Activity
  15 + .checkbox
  16 + = label_tag :with_push, 'Not empty'
  17 + = check_box_tag :with_push, 1, params[:with_push]
  18 + &nbsp;
  19 + %span.light Projects with push events
  20 + .checkbox
  21 + = label_tag :abandoned, 'Abandoned'
  22 + = check_box_tag :abandoned, 1, params[:abandoned]
  23 + &nbsp;
  24 + %span.light No activity over 6 month
23 25  
24 26 %fieldset
25 27 %strong Visibility level:
... ... @@ -31,12 +33,12 @@
31 33 %span.descr
32 34 = visibility_level_icon(level)
33 35 = label
34   - .form-actions
35   - = hidden_field_tag :sort, params[:sort]
36   - = submit_tag "Search", class: "btn submit btn-primary"
37   - = link_to "Reset", admin_projects_path, class: "btn"
  36 + %hr
  37 + = hidden_field_tag :sort, params[:sort]
  38 + = submit_tag "Search", class: "btn submit btn-primary"
  39 + = link_to "Reset", admin_projects_path, class: "btn btn-cancel"
38 40  
39   - .col-md-8
  41 + .col-md-9
40 42 .panel.panel-default
41 43 .panel-heading
42 44 Projects (#{@projects.total_count})
... ...