Improve admin/projects page

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2014-06-03 14:19:11 +03:00
parent 4e55dd5f14
commit 95d61a094d
No known key found for this signature in database
GPG key ID: 627C5F589F467F17
3 changed files with 39 additions and 29 deletions

View file

@ -21,12 +21,22 @@
}
.admin-filter form {
label { width: 110px; }
.controls { margin-left: 130px; }
.form-actions { padding-left: 130px; background: #fff }
.visibility-levels {
.controls {
margin-bottom: 9px;
.select2-container {
width: 100%
}
.controls {
margin-left: 130px;
}
.form-actions {
padding-left: 130px;
background: #fff
}
.visibility-levels {
.controls {
margin-bottom: 9px;
}
i {

View file

@ -4,10 +4,8 @@ class Admin::ProjectsController < Admin::ApplicationController
before_filter :repository, only: [:show, :transfer]
def index
owner_id = params[:owner_id]
user = User.find_by(id: owner_id)
@projects = user ? user.owned_projects : Project.all
@projects = Project.all
@projects = @projects.where(namespace_id: params[:namespace_id]) if params[:namespace_id].present?
@projects = @projects.where("visibility_level IN (?)", params[:visibility_levels]) if params[:visibility_levels].present?
@projects = @projects.with_push if params[:with_push].present?
@projects = @projects.abandoned if params[:abandoned].present?

View file

@ -1,5 +1,5 @@
.row
.col-md-4
.col-md-3
.admin-filter
= form_tag admin_projects_path, method: :get, class: '' do
.form-group
@ -7,19 +7,21 @@
= text_field_tag :name, params[:name], class: "form-control"
.form-group
= label_tag :owner_id, 'Owner:'
%div
= users_select_tag :owner_id, selected: params[:owner_id], class: 'input-large input-clamp'
.checkbox
= label_tag :with_push, 'Not empty'
= check_box_tag :with_push, 1, params[:with_push]
&nbsp;
%span.light Projects with push events
.checkbox
= label_tag :abandoned, 'Abandoned'
= check_box_tag :abandoned, 1, params[:abandoned]
&nbsp;
%span.light No activity over 6 month
= label_tag :namespace_id, "Namespace"
= namespace_select_tag :namespace_id, selected: params[:namespace_id], class: 'input-large'
.form-group
%strong Activity
.checkbox
= label_tag :with_push, 'Not empty'
= check_box_tag :with_push, 1, params[:with_push]
&nbsp;
%span.light Projects with push events
.checkbox
= label_tag :abandoned, 'Abandoned'
= check_box_tag :abandoned, 1, params[:abandoned]
&nbsp;
%span.light No activity over 6 month
%fieldset
%strong Visibility level:
@ -31,12 +33,12 @@
%span.descr
= visibility_level_icon(level)
= label
.form-actions
= hidden_field_tag :sort, params[:sort]
= submit_tag "Search", class: "btn submit btn-primary"
= link_to "Reset", admin_projects_path, class: "btn"
%hr
= hidden_field_tag :sort, params[:sort]
= submit_tag "Search", class: "btn submit btn-primary"
= link_to "Reset", admin_projects_path, class: "btn btn-cancel"
.col-md-8
.col-md-9
.panel.panel-default
.panel-heading
Projects (#{@projects.total_count})