Commit 68bfcd05 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add public filter to admin projects

parent 122acb22
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
@import "sections/profile.scss"; @import "sections/profile.scss";
@import "sections/login.scss"; @import "sections/login.scss";
@import "sections/editor.scss"; @import "sections/editor.scss";
@import "sections/admin.scss";
@import "highlight/white.scss"; @import "highlight/white.scss";
@import "highlight/dark.scss"; @import "highlight/dark.scss";
......
.admin-filter form {
label { width: 110px; }
.controls { margin-left: 130px; }
.form-actions { padding-left: 130px; background: #fff }
}
...@@ -4,6 +4,7 @@ class Admin::ProjectsController < AdminController ...@@ -4,6 +4,7 @@ class Admin::ProjectsController < AdminController
def index def index
@projects = Project.scoped @projects = Project.scoped
@projects = @projects.where(namespace_id: params[:namespace_id]) if params[:namespace_id].present? @projects = @projects.where(namespace_id: params[:namespace_id]) if params[:namespace_id].present?
@projects = @projects.where(public: true) if params[:public_only].present?
@projects = @projects.where(namespace_id: nil) if params[:namespace_id] == Namespace.global_id @projects = @projects.where(namespace_id: nil) if params[:namespace_id] == Namespace.global_id
@projects = @projects.search(params[:name]) if params[:name].present? @projects = @projects.search(params[:name]) if params[:name].present?
@projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(20) @projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(20)
......
...@@ -7,5 +7,6 @@ class Public::ProjectsController < ApplicationController ...@@ -7,5 +7,6 @@ class Public::ProjectsController < ApplicationController
def index def index
@projects = Project.public @projects = Project.public
@projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(20)
end end
end end
%h3.page_title %h3.page_title
Projects (#{Project.count}) Projects
= link_to 'New Project', new_project_path, class: "btn small right" = link_to 'New Project', new_project_path, class: "btn small right"
%br
= form_tag admin_projects_path, method: :get, class: 'form-inline' do
= select_tag :namespace_id, namespaces_options(params[:namespace_id], :all), class: "chosen xlarge", prompt: "Project namespace"
= text_field_tag :name, params[:name], class: "xlarge"
= submit_tag "Search", class: "btn submit primary"
%table %hr
%thead
%tr .row
%th .span4
Name .admin-filter
%i.icon-sort-down = form_tag admin_projects_path, method: :get, class: 'form-inline' do
%th Path .control-group
%th Team Members = label_tag :name, 'Name:', class: 'control-label'
%th Owner .controls
%th Last Commit = text_field_tag :name, params[:name], class: "span2"
%th Edit
%th.cred Danger Zone! .control-group
= label_tag :namespace_id, 'Namespace:', class: 'control-label'
.controls
= select_tag :namespace_id, namespaces_options(params[:namespace_id], :all), class: "chosen span2", prompt: "Any"
.control-group
= label_tag :public_only, 'Public Only', class: 'control-label'
.controls
= check_box_tag :public_only, 1, params[:public_only]
.form-actions
= submit_tag "Search", class: "btn submit primary"
= link_to "Reset", admin_projects_path, class: "btn"
.span8
.ui-box
%h5.title
Projects (#{@projects.total_count})
%ul.well-list
- @projects.each do |project| - @projects.each do |project|
%tr %li
%td - if project.public
%i.icon-unlock.cred
- else
%i.icon-lock.cgreen
= link_to project.name_with_namespace, [:admin, project] = link_to project.name_with_namespace, [:admin, project]
%td .right
%span.monospace= project.path_with_namespace + ".git" = link_to 'Edit', edit_admin_project_path(project), id: "edit_#{dom_id(project)}", class: "btn small"
%td= project.users_projects.count = link_to 'Destroy', [:admin, project], confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn small danger"
%td - if @projects.blank?
- if project.owner %p.nothing_here_message 0 projects matches
= link_to project.owner.name, [:admin, project.owner]
- else - else
(deleted) %li.bottom
%td= last_commit(project) = paginate @projects, theme: "admin"
%td= link_to 'Edit', edit_admin_project_path(project), id: "edit_#{dom_id(project)}", class: "btn small"
%td.bgred= link_to 'Destroy', [:admin, project], confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn small danger"
= paginate @projects, theme: "admin"
...@@ -47,3 +47,5 @@ ...@@ -47,3 +47,5 @@
%li %li
%span= link_to "System Hooks", help_system_hooks_path %span= link_to "System Hooks", help_system_hooks_path
%li
%span= link_to "Public Area", help_public_area_path
%h3.page_title Public Area
.back_link
= link_to help_path do
&larr; to index
%hr
%p
Public area - is part of application with public access.
%br
It used to list all projects with public read-only access.
%br
If you enable public http access to the project - it will appears there
%br
Follow #{link_to "this link", public_root_path} to visit Public Area
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
%span.count= current_user.cared_merge_requests.opened.count %span.count= current_user.cared_merge_requests.opened.count
= nav_link(path: 'search#show') do = nav_link(path: 'search#show') do
= link_to "Search", search_path = link_to "Search", search_path
= nav_link(path: 'help#index') do = nav_link(controller: :help) do
= link_to "Help", help_path = link_to "Help", help_path
.content= yield .content= yield
...@@ -12,3 +12,6 @@ ...@@ -12,3 +12,6 @@
.right .right
%span.monospace.tiny %span.monospace.tiny
git clone #{project.http_url_to_repo} git clone #{project.http_url_to_repo}
= paginate @projects, theme: "admin"
...@@ -35,6 +35,7 @@ Gitlab::Application.routes.draw do ...@@ -35,6 +35,7 @@ Gitlab::Application.routes.draw do
get 'help/markdown' => 'help#markdown' get 'help/markdown' => 'help#markdown'
get 'help/ssh' => 'help#ssh' get 'help/ssh' => 'help#ssh'
get 'help/raketasks' => 'help#raketasks' get 'help/raketasks' => 'help#raketasks'
get 'help/public_area' => 'help#public_area'
# #
# Public namespace # Public namespace
......
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