Admin area improved

This commit is contained in:
Dmitriy Zaporozhets 2012-02-11 19:56:18 +02:00
parent a769204ff4
commit cc043f32d8
39 changed files with 434 additions and 334 deletions

View file

@ -7,5 +7,5 @@
*= require jquery-ui/jquery.tagify *= require jquery-ui/jquery.tagify
*= require chosen *= require chosen
*= require_self *= require_self
*= require common *= require main
*/ */

View file

@ -1,50 +1,3 @@
@import "bootstrap";
/** GITLAB colors **/
$text_color:#222;
$lite_text_color: #666;
$link_color:#111;
$active_link_color:#2FA0BB;
$active_bg_color:#79C3E0;
$active_bd_color: #2FA0BB;
$border_color:#CCC;
$lite_border_color:#EEE;
$min_app_width:980px;
$max_app_width:980px;
$app_padding:20px;
$bg_color: #FFF;
$styled_border_color: #2FA0BB;
$color: "#4BB8D2";
$blue_link: "#2fa0bb";
/** MIXINS **/
@mixin round-borders-bottom($radius) {
border-top: 1px solid #eaeaea;
-moz-border-radius-bottomright: $radius;
-moz-border-radius-bottomleft: $radius;
border-bottom-right-radius: $radius;
border-bottom-left-radius: $radius;
-webkit-border-bottom-left-radius: $radius;
-webkit-border-bottom-right-radius: $radius;
}
@mixin round-borders-top($radius) {
border-top: 1px solid #eaeaea;
-moz-border-radius-topright: $radius;
-moz-border-radius-topleft: $radius;
border-top-right-radius: $radius;
border-top-left-radius: $radius;
-webkit-border-top-left-radius: $radius;
-webkit-border-top-right-radius: $radius;
}
@mixin round-borders-all($radius) {
border: 1px solid #eaeaea;
-moz-border-radius: $radius;
-webkit-border-radius: $radius;
border-radius: $radius;
}
/** COLORS **/ /** COLORS **/
.cgray { color:gray; } .cgray { color:gray; }
.cred { color:#D12F19; } .cred { color:#D12F19; }
@ -173,18 +126,38 @@ img.lil_av {
.author_link { .author_link {
color: $active_link_color; color: $active_link_color;
} }
.entry {
position: relative;
padding: 7px 15px;
margin-bottom: 18px;
color: #404040;
filter:none;
@import "reset_bootstrap.scss"; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
@import "top_panel.scss"; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
@import "projects.css.scss";
@import "commits.css.scss";
@import "tree.scss";
@import "issues.css.scss";
@import "merge_requests.css.scss";
@import "notes.css.scss";
@import "login.scss";
/** CODE HIGHTLIGHT **/ -webkit-border-radius: 4px;
@import "highlight.css.scss"; -moz-border-radius: 4px;
@import "highlight.black.css.scss"; border-radius: 4px;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
background:#F1F1F1;
border: 1px solid #ccc;
p {
margin-bottom: 0;
img {
position:relative;
top:3px;
}
}
}
.widget {
padding:20px;
margin-bottom:20px;
}

View file

@ -1,3 +0,0 @@
#issue_assignee_id {
width:300px;
}

View file

@ -0,0 +1,64 @@
@import "bootstrap";
/** GITLAB colors **/
$text_color:#222;
$lite_text_color: #666;
$link_color:#111;
$active_link_color:#2FA0BB;
$active_bg_color:#79C3E0;
$active_bd_color: #2FA0BB;
$border_color:#CCC;
$lite_border_color:#EEE;
$min_app_width:980px;
$max_app_width:980px;
$app_padding:20px;
$bg_color: #FFF;
$styled_border_color: #2FA0BB;
$color: "#4BB8D2";
$blue_link: "#2fa0bb";
/** MIXINS **/
@mixin round-borders-bottom($radius) {
border-top: 1px solid #eaeaea;
-moz-border-radius-bottomright: $radius;
-moz-border-radius-bottomleft: $radius;
border-bottom-right-radius: $radius;
border-bottom-left-radius: $radius;
-webkit-border-bottom-left-radius: $radius;
-webkit-border-bottom-right-radius: $radius;
}
@mixin round-borders-top($radius) {
border-top: 1px solid #eaeaea;
-moz-border-radius-topright: $radius;
-moz-border-radius-topleft: $radius;
border-top-right-radius: $radius;
border-top-left-radius: $radius;
-webkit-border-top-left-radius: $radius;
-webkit-border-top-right-radius: $radius;
}
@mixin round-borders-all($radius) {
border: 1px solid #eaeaea;
-moz-border-radius: $radius;
-webkit-border-radius: $radius;
border-radius: $radius;
}
@import "reset_bootstrap.scss";
@import "common.scss";
@import "top_panel.scss";
@import "projects.css.scss";
@import "commits.css.scss";
@import "tree.scss";
@import "merge_requests.css.scss";
@import "notes.css.scss";
@import "login.scss";
/** CODE HIGHTLIGHT **/
@import "highlight.css.scss";
@import "highlight.black.css.scss";

View file

@ -201,3 +201,7 @@ input.git_clone_url {
width:60px; width:60px;
} }
} }
#issue_assignee_id {
width:300px;
}

View file

@ -5,38 +5,3 @@ a {
color: $active_link_color; color: $active_link_color;
} }
} }
.entry {
position: relative;
padding: 7px 15px;
margin-bottom: 18px;
color: #404040;
filter:none;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
background:#F1F1F1;
border: 1px solid #ccc;
p {
margin-bottom: 0;
img {
position:relative;
top:3px;
}
}
}
.widget {
padding:20px;
margin-bottom:20px;
}

View file

@ -11,6 +11,7 @@ body header {
-moz-box-shadow: 0 -1px 0 white inset; -moz-box-shadow: 0 -1px 0 white inset;
-webkit-box-shadow: 0 -1px 0 white inset; -webkit-box-shadow: 0 -1px 0 white inset;
z-index:10;
height:60px; height:60px;
.wrapper { .wrapper {

View file

@ -3,39 +3,15 @@ class Admin::TeamMembersController < ApplicationController
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :authenticate_admin! before_filter :authenticate_admin!
def index
@admin_team_members = UsersProject.page(params[:page]).per(100).order("project_id DESC")
end
def show
@admin_team_member = UsersProject.find(params[:id])
end
def new
@admin_team_member = UsersProject.new(params[:team_member])
end
def edit def edit
@admin_team_member = UsersProject.find(params[:id]) @admin_team_member = UsersProject.find(params[:id])
end end
def create
@admin_team_member = UsersProject.new(params[:team_member])
@admin_team_member.project_id = params[:team_member][:project_id]
if @admin_team_member.save
redirect_to admin_team_member_path(@admin_team_member), notice: 'UsersProject was successfully created.'
else
render action: "new"
end
end
def update def update
@admin_team_member = UsersProject.find(params[:id]) @admin_team_member = UsersProject.find(params[:id])
@admin_team_member.project_id = params[:team_member][:project_id]
if @admin_team_member.update_attributes(params[:team_member]) if @admin_team_member.update_attributes(params[:team_member])
redirect_to admin_team_member_path(@admin_team_member), notice: 'UsersProject was successfully updated.' redirect_to [:admin, @admin_team_member.project], notice: 'Project Access was successfully updated.'
else else
render action: "edit" render action: "edit"
end end
@ -45,6 +21,6 @@ class Admin::TeamMembersController < ApplicationController
@admin_team_member = UsersProject.find(params[:id]) @admin_team_member = UsersProject.find(params[:id])
@admin_team_member.destroy @admin_team_member.destroy
redirect_to admin_team_members_url redirect_to :back
end end
end end

View file

@ -9,8 +9,28 @@ class Admin::UsersController < ApplicationController
def show def show
@admin_user = User.find(params[:id]) @admin_user = User.find(params[:id])
@projects = if @admin_user.projects.empty?
Project
else
Project.without_user(@admin_user)
end.all
end end
def team_update
@admin_user = User.find(params[:id])
UsersProject.user_bulk_import(
@admin_user,
params[:project_ids],
params[:project_access],
params[:repo_access]
)
redirect_to [:admin, @admin_user], notice: 'Teams were successfully updated.'
end
def new def new
@admin_user = User.new(:projects_limit => 10) @admin_user = User.new(:projects_limit => 10)
end end

View file

@ -53,6 +53,7 @@ class Project < ActiveRecord::Base
attr_protected :private_flag, :owner_id attr_protected :private_flag, :owner_id
scope :public_only, where(:private_flag => false) scope :public_only, where(:private_flag => false)
scope :without_user, lambda { |user| where("id not in (:ids)", :ids => user.projects.map(&:id) ) }
def self.active def self.active
joins(:issues, :notes, :merge_requests).order("issues.created_at, notes.created_at, merge_requests.created_at DESC") joins(:issues, :notes, :merge_requests).order("issues.created_at, notes.created_at, merge_requests.created_at DESC")

View file

@ -27,6 +27,20 @@ class UsersProject < ActiveRecord::Base
end end
end end
def self.user_bulk_import(user, project_ids, project_access, repo_access)
UsersProject.transaction do
project_ids.each do |project_id|
users_project = UsersProject.new(
:repo_access => repo_access,
:project_access => project_access,
)
users_project.project_id = project_id
users_project.user_id = user.id
users_project.save
end
end
end
def update_repository def update_repository
Gitlabhq::GitHost.system.new.configure do |c| Gitlabhq::GitHost.system.new.configure do |c|
c.update_project(project.path, project) c.update_project(project.path, project)

View file

@ -1,7 +1,6 @@
= form_for [:admin, @admin_project] do |f| = form_for [:admin, @admin_project] do |f|
-if @admin_project.errors.any? -if @admin_project.errors.any?
#error_explanation .alert-message.block-message.error
%h2= "#{pluralize(@admin_project.errors.count, "error")} prohibited this admin_project from being saved:"
%ul %ul
- @admin_project.errors.full_messages.each do |msg| - @admin_project.errors.full_messages.each do |msg|
%li= msg %li= msg
@ -10,27 +9,58 @@
= f.label :name = f.label :name
.input= f.text_field :name .input= f.text_field :name
.clearfix .clearfix
= f.label :code = f.label :path do
.input= f.text_field :code Path
.input
.input-prepend
%span.add-on= "git@#{GIT_HOST["host"]}:"
= f.text_field :path, :placeholder => "example_project", :disabled => !@admin_project.new_record?
.clearfix .clearfix
= f.label :path = f.label :code do
.input= f.text_field :path Code
.input
.input-prepend
%span.add-on= "http://#{GIT_HOST["host"]}/"
= f.text_field :code, :placeholder => "example"
- unless @admin_project.new_record? - unless @admin_project.new_record?
.clearfix .clearfix
= f.label :owner_id = f.label :owner_id
.input= f.select :owner_id, User.all.map { |user| [user.name, user.id] } .input= f.select :owner_id, User.all.map { |user| [user.name, user.id] }
- unless @admin_project.heads.empty?
.clearfix
= f.label :default_branch, "Default Branch"
.input= f.select(:default_branch, @admin_project.heads.map(&:name), {}, :style => "width:210px;")
.well
%h5 Features
.clearfix
= f.label :issues_enabled, "Issues"
.input= f.check_box :issues_enabled
.clearfix
= f.label :merge_requests_enabled, "Merge Requests"
.input= f.check_box :merge_requests_enabled
.clearfix
= f.label :wall_enabled, "Wall"
.input= f.check_box :wall_enabled
.clearfix .clearfix
= f.label :description = f.label :description
.input= f.text_area :description .input= f.text_area :description, :class => "xxlarge"
.clear .clear
%br %br
.actions .actions
= f.submit 'Save', :class => "btn" = f.submit 'Save', :class => "btn primary"
= link_to 'Cancel', [:admin, @admin_project], :class => "btn"
= link_to 'Destroy', [:admin, @admin_project], :confirm => 'Are you sure?', :method => :delete, :class => "btn danger right"
:javascript :javascript
$(function(){ $(function(){
taggifyForm(); taggifyForm();
$('#project_owner_id').chosen(); $('#project_owner_id').chosen();
$('#project_default_branch').chosen();
}) })

View file

@ -1,7 +1,3 @@
%h2= @admin_project.name %h3= @admin_project.name
%hr
= render 'form' = render 'form'
%br
= link_to 'Back', admin_projects_path, :class => ""
|
= link_to 'Show', [:admin, @admin_project], :class => ""

View file

@ -1,7 +1,10 @@
%table %h3
Projects
= link_to 'New Project', new_admin_project_path, :class => "btn small right"
%hr
%table.zebra-striped
%thead %thead
%th Name %th Name
%th Code
%th Path %th Path
%th Team Members %th Team Members
%th Last Commit %th Last Commit
@ -11,12 +14,9 @@
- @admin_projects.each do |project| - @admin_projects.each do |project|
%tr %tr
%td= link_to project.name, [:admin, project] %td= link_to project.name, [:admin, project]
%td= project.code
%td= project.path %td= project.path
%td= project.users_projects.count %td= project.users_projects.count
%td= last_commit(project) %td= last_commit(project)
%td= link_to 'Edit', edit_admin_project_path(project), :id => "edit_#{dom_id(project)}" %td= link_to 'Edit', edit_admin_project_path(project), :id => "edit_#{dom_id(project)}", :class => "btn small"
%td= link_to 'Destroy', [:admin, project], :confirm => 'Are you sure?', :method => :delete %td= link_to 'Destroy', [:admin, project], :confirm => 'Are you sure?', :method => :delete, :class => "btn small danger"
= paginate @admin_projects = paginate @admin_projects
= link_to 'New Project', new_admin_project_path, :class => "btn"

View file

@ -1,10 +1,10 @@
- unless notice.nil? %h3
%p#notice= notice = @admin_project.name
= link_to 'Edit', edit_admin_project_path(@admin_project), :class => "btn right small"
%hr
%h2= @admin_project.name %table.zebra-striped
%table.round-borders
%tr %tr
%td %td
%b %b
@ -29,14 +29,33 @@
Description: Description:
%td %td
= @admin_project.description = @admin_project.description
%tr
%td{:colspan => 2}
= link_to 'Edit', edit_admin_project_path(@admin_project), :class => "btn"
.span-14 .span-14
%h2 Team %h3
Team
%small
( #{@admin_project.users_projects.count} )
%hr
%table.zebra-striped
%thead
%tr
%th Name
%th Project Access
%th Repository Access
%th
- @admin_project.users_projects.each do |tm|
%tr
%td
= link_to tm.user_name, admin_users_path(tm.user)
%td= select_tag :tm_project_access, options_for_select(Project.access_options, tm.project_access), :class => "medium project-access-select", :disabled => :disabled
%td= select_tag :tm_repo_access, options_for_select(Repository.access_options, tm.repo_access), :class => "medium repo-access-select", :disabled => :disabled
%td= link_to 'Edit Access', edit_admin_team_member_path(tm), :class => "btn small"
%td= link_to 'Remove from team', admin_team_member_path(tm), :confirm => 'Are you sure?', :method => :delete, :class => "btn danger small"
= form_tag team_update_admin_project_path(@admin_project), :class => "bulk_import", :method => :put do = form_tag team_update_admin_project_path(@admin_project), :class => "bulk_import", :method => :put do
%table %table
@ -51,27 +70,8 @@
%td= select_tag :project_access, options_for_select(Project.access_options), :class => "project-access-select" %td= select_tag :project_access, options_for_select(Project.access_options), :class => "project-access-select"
%td= select_tag :repo_access, options_for_select(Repository.access_options), :class => "repo-access-select" %td= select_tag :repo_access, options_for_select(Repository.access_options), :class => "repo-access-select"
%tr .actions
%td{ :colspan => 3 } = submit_tag 'Add', :class => "btn primary"
= submit_tag 'Add', :class => "btn primary"
%table.round-borders
%thead
%tr
%th Name
%th Added
%th Project Access
%th Repository Access
%th
- @admin_project.users_projects.each do |tm|
%tr
%td
= link_to tm.user_name, admin_team_member_path(tm)
%td= time_ago_in_words(tm.updated_at) + " ago"
%td= select_tag :tm_project_access, options_for_select(Project.access_options, tm.project_access), :class => "project-access-select", :disabled => :disabled
%td= select_tag :tm_repo_access, options_for_select(Repository.access_options, tm.repo_access), :class => "repo-access-select", :disabled => :disabled
%td= link_to 'Destroy', admin_team_member_path(tm), :confirm => 'Are you sure?', :method => :delete
:css :css
form select { form select {

View file

@ -1,33 +1,23 @@
= form_for @admin_team_member, :as => :team_member, :url => @admin_team_member.new_record? ? admin_team_members_path(@admin_team_member) : admin_team_member_path(@admin_team_member) do |f| = form_for @admin_team_member, :as => :team_member, :url => admin_team_member_path(@admin_team_member) do |f|
-if @admin_team_member.errors.any? -if @admin_team_member.errors.any?
#error_explanation .alert-message.block-message.error
%h2= "#{pluralize(@admin_team_member.errors.count, "error")} prohibited this admin_project from being saved:"
%ul %ul
- @admin_team_member.errors.full_messages.each do |msg| - @admin_team_member.errors.full_messages.each do |msg|
%li= msg %li= msg
- if @admin_team_member.new_record? .clearfix
.span-6 %label Project Access:
= f.label :user_id .input
.span-6 = f.select :project_access, options_for_select(Project.access_options, @admin_team_member.project_access), {}, :class => "project-access-select"
= f.select :user_id, User.all.map { |user| [user.name, user.id] }
.span-6
= f.label :project_id
.span-6
= f.select :project_id, Project.all.map { |user| [user.name, user.id] }
.span-6 .clearfix
%b Project Access: %label Repository Access:
.span-6 .input
= f.select :project_access, options_for_select(Project.access_options, @admin_team_member.project_access), {}, :class => "project-access-select" = f.select :repo_access, options_for_select(Repository.access_options, @admin_team_member.repo_access), {}, :class => "repo-access-select"
.span-6
%b Repository Access:
.span-6
= f.select :repo_access, options_for_select(Repository.access_options, @admin_team_member.repo_access), {}, :class => "repo-access-select"
%br %br
.actions .actions
= f.submit 'Save', :class => "btn" = f.submit 'Save', :class => "btn primary"
= link_to 'Cancel', :back, :class => "btn"
:css :css
form select { form select {

View file

@ -1,6 +1,19 @@
= render 'form' %h3
Edit access
%small
= @admin_team_member.project.name
&ndash;
= @admin_team_member.user_name
%br %hr
= link_to 'Show', admin_team_member_path(@admin_team_member) %table.zebra-striped
\| %tr
= link_to 'Back', admin_team_members_path %td User:
%td= @admin_team_member.user_name
%tr
%td Project:
%td= @admin_team_member.project.name
%tr
%td Since:
%td= @admin_team_member.updated_at.stamp("Nov 11, 2010")
= render 'form'

View file

@ -1,28 +0,0 @@
- @admin_team_members.group_by(&:project).sort.each do |project, members|
%h3= link_to project.name, [:admin, project]
%table
%thead
%th Name
%th Project Access
%th Repo Access
%th Added
%th
%th
- members.each do |tm|
- user = tm.user
%tr
%td.span-6
= link_to tm.user_name, admin_team_member_path(tm)
%br
%br
= tm.user_email
%td.span-3= select_tag :project_access, options_for_select(Project.access_options, tm.project_access), :class => "project-access-select", :disabled => :disabled
%td.span-3= select_tag :repo_access, options_for_select(Repository.access_options, tm.repo_access), :class => "repo-access-select", :disabled => :disabled
%td.span-3= time_ago_in_words(tm.updated_at) + " ago"
%td= link_to 'Edit', edit_admin_team_member_path(tm), :id => "edit_#{dom_id(tm)}"
%td= link_to 'Destroy', admin_team_member_path(tm), :confirm => 'Are you sure?', :method => :delete
%br
= paginate @admin_team_members
= link_to 'New Team Member', new_admin_team_member_path, :class => "btn"

View file

@ -1,6 +0,0 @@
%h1 New team member
= render 'form'
%br
= link_to 'Back', admin_team_members_path

View file

@ -1,26 +0,0 @@
#infoblock
%p
%b Name:
= @admin_team_member.user_name
%p
%b Project:
= @admin_team_member.project.name
%p
%b Since:
= @admin_team_member.updated_at.stamp("Nov 11, 2010")
#infoblock
.span-6
%b Project Access:
= select_tag :project_access, options_for_select(Project.access_options, @admin_team_member.project_access), :class => "project-access-select", :disabled => true
%br
.span-6
%b Repository Access:
= select_tag :repo_access, options_for_select(Repository.access_options, @admin_team_member.repo_access), :class => "repo-access-select", :disabled => true
%br
= link_to 'Edit', edit_admin_team_member_path(@admin_project)
\|
= link_to 'Back', admin_team_members_path

View file

@ -18,9 +18,6 @@
.clearfix .clearfix
= f.label :password_confirmation = f.label :password_confirmation
.input= f.password_field :password_confirmation .input= f.password_field :password_confirmation
.clearfix
= f.check_box :admin
= f.label :admin
.clearfix .clearfix
= f.label :projects_limit = f.label :projects_limit
@ -35,8 +32,13 @@
.clearfix .clearfix
= f.label :twitter = f.label :twitter
.input= f.text_field :twitter .input= f.text_field :twitter
.clear .clearfix
%br = f.label :admin do
= f.check_box :admin
%span Administrator
.actions .actions
= f.submit 'Save', :class => "btn primary" = f.submit 'Save', :class => "btn primary"
= link_to 'Cancel', admin_users_path, :class => "btn" - if @admin_user.new_record?
= link_to 'Cancel', admin_users_path, :class => "btn"
- else
= link_to 'Cancel', admin_user_path(@admin_user), :class => "btn"

View file

@ -1,6 +1,3 @@
%h3= @admin_user.name
%hr
= render 'form' = render 'form'
%br
= link_to 'Back', admin_users_path, :class => ""
|
= link_to 'Show', [:admin, @admin_user], :class => ""

View file

@ -1,4 +1,8 @@
%table %h3
Users
= link_to 'New User', new_admin_user_path, :class => "btn small right"
%hr
%table.zebra-striped
%thead %thead
%th Admin %th Admin
%th Name %th Name
@ -13,9 +17,7 @@
%td= link_to user.name, [:admin, user] %td= link_to user.name, [:admin, user]
%td= user.email %td= user.email
%td= user.users_projects.count %td= user.users_projects.count
%td= link_to 'Edit', edit_admin_user_path(user), :id => "edit_#{dom_id(user)}" %td= link_to 'Edit', edit_admin_user_path(user), :id => "edit_#{dom_id(user)}", :class => "btn small"
%td= link_to 'Destroy', [:admin, user], :confirm => 'Are you sure?', :method => :delete %td= link_to 'Destroy', [:admin, user], :confirm => 'Are you sure?', :method => :delete, :class => "btn small danger"
= paginate @admin_users = paginate @admin_users
%br
= link_to 'New User', new_admin_user_path, :class => "btn"

View file

@ -1,6 +1,10 @@
%h2= @admin_user.name %h3
= @admin_user.name
= link_to 'Edit', edit_admin_user_path(@admin_user), :class => "btn small right"
%table.round-borders %hr
%table.zebra-striped
%tr %tr
%td %td
%b %b
@ -39,31 +43,57 @@
Twitter: Twitter:
%td %td
= @admin_user.twitter = @admin_user.twitter
%h3 Projects
%hr
%table.zebra-striped
%tr %tr
%td{:colspan => 2} %thead
= link_to 'Edit', edit_admin_user_path(@admin_user), :class => "btn" %th Name
%th Project Access
%th Repository Access
%th
%th
.span-14 - @admin_user.users_projects.each do |tm|
%h2 Projects - project = tm.project
%table.round-borders
%tr %tr
%thead %td= link_to project.name, admin_project_path(project)
%th Name %td= select_tag :tm_project_access, options_for_select(Project.access_options, tm.project_access), :class => "medium project-access-select", :disabled => :disabled
%th Added %td= select_tag :tm_repo_access, options_for_select(Repository.access_options, tm.repo_access), :class => "medium repo-access-select", :disabled => :disabled
%th Project Access %td= link_to 'Edit Access', edit_admin_team_member_path(tm), :class => "btn small"
%th Repository Access %td= link_to 'Remove from team', admin_team_member_path(tm), :confirm => 'Are you sure?', :method => :delete, :class => "btn small danger"
%th
%th
- @admin_user.users_projects.each do |tm| = form_tag team_update_admin_user_path(@admin_user), :class => "bulk_import", :method => :put do
- project = tm.project %table
%thead
%tr %tr
%td= link_to project.name, admin_project_path(project) %th Projects
%td= time_ago_in_words(tm.updated_at) + " ago" %th Project Access:
%td= select_tag :project_access, options_for_select(Project.access_options, tm.project_access), :class => "project-access-select", :disabled => :disabled %th Repo Access:
%td= select_tag :repo_access, options_for_select(Repository.access_options, tm.repo_access), :class => "repo-access-select", :disabled => :disabled
%td= link_to 'Edit', edit_admin_team_member_path(tm) %tr
%td= link_to 'Cancel', admin_team_member_path(tm), :confirm => 'Are you sure?', :method => :delete %td= select_tag :project_ids, options_from_collection_for_select(@projects , :id, :name), :multiple => true
%td= select_tag :project_access, options_for_select(Project.access_options), :class => "project-access-select"
%td= select_tag :repo_access, options_for_select(Repository.access_options), :class => "repo-access-select"
.actions
= submit_tag 'Add', :class => "btn primary"
:css
form select {
width:150px;
}
#project_ids {
width:300px;
}
:javascript
$('select#project_ids').chosen();
$('select#repo_access').chosen();
$('select#project_access').chosen();
= link_to 'Add To Another Project', new_admin_team_member_path(:team_member => {:user_id => @admin_user.id}), :class => "btn"

View file

@ -0,0 +1,9 @@
-# Link to the "First" page
-# available local variables
-# url: url to the first page
-# current_page: a page object for the currently displayed page
-# num_pages: total number of pages
-# per_page: number of items to fetch per page
-# remote: data-remote
%span.first
= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote

View file

@ -0,0 +1,8 @@
-# Non-link tag that stands for skipped pages...
-# available local variables
-# current_page: a page object for the currently displayed page
-# num_pages: total number of pages
-# per_page: number of items to fetch per page
-# remote: data-remote
%span.page.gap
= raw(t 'views.pagination.truncate')

View file

@ -0,0 +1,9 @@
-# Link to the "Last" page
-# available local variables
-# url: url to the last page
-# current_page: a page object for the currently displayed page
-# num_pages: total number of pages
-# per_page: number of items to fetch per page
-# remote: data-remote
%span.last
= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote}

View file

@ -0,0 +1,9 @@
-# Link to the "Next" page
-# available local variables
-# url: url to the next page
-# current_page: a page object for the currently displayed page
-# num_pages: total number of pages
-# per_page: number of items to fetch per page
-# remote: data-remote
%li.next
= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote

View file

@ -0,0 +1,10 @@
-# Link showing page number
-# available local variables
-# page: a page object for "this" page
-# url: url to this page
-# current_page: a page object for the currently displayed page
-# num_pages: total number of pages
-# per_page: number of items to fetch per page
-# remote: data-remote
%li{:class => "page#{' active' if page.current?}"}
= link_to page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil}

View file

@ -0,0 +1,17 @@
-# The container tag
-# available local variables
-# current_page: a page object for the currently displayed page
-# num_pages: total number of pages
-# per_page: number of items to fetch per page
-# remote: data-remote
-# paginator: the paginator that renders the pagination tags inside
= paginator.render do
%div.pagination
%ul
= prev_page_tag unless current_page.first?
- each_page do |page|
- if page.left_outer? || page.right_outer? || page.inside_window?
= page_tag page
- elsif !page.was_truncated?
= gap_tag
= next_page_tag unless current_page.last?

View file

@ -0,0 +1,9 @@
-# Link to the "Previous" page
-# available local variables
-# url: url to the previous page
-# current_page: a page object for the currently displayed page
-# num_pages: total number of pages
-# per_page: number of items to fetch per page
-# remote: data-remote
%li{:class => "prev" }
= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote

View file

@ -4,7 +4,4 @@
= link_to "Projects", projects_path, :class => "#{"active" if current_page?(projects_path)}" = link_to "Projects", projects_path, :class => "#{"active" if current_page?(projects_path)}"
= link_to "Issues", dashboard_issues_path, :class => "#{"active" if current_page?(dashboard_issues_path)}", :id => "issues_slide" = link_to "Issues", dashboard_issues_path, :class => "#{"active" if current_page?(dashboard_issues_path)}", :id => "issues_slide"
= link_to "Requests", dashboard_merge_requests_path, :class => "#{"active" if current_page?(dashboard_merge_requests_path)}", :id => "merge_requests_slide" = link_to "Requests", dashboard_merge_requests_path, :class => "#{"active" if current_page?(dashboard_merge_requests_path)}", :id => "merge_requests_slide"
- if current_user.is_admin?
= link_to admin_root_path, :class => "admin", :title => "Admin" do
Admin
= link_to "Help", help_path, :class => "#{"active" if controller.controller_name == "help"}" = link_to "Help", help_path, :class => "#{"active" if controller.controller_name == "help"}"

View file

@ -4,8 +4,16 @@
You can create at least You can create at least
= current_user.projects_limit = current_user.projects_limit
projects. Click on button to add a new one projects. Click on button to add a new one
= link_to new_project_path, :class => "btn small" do .alert-actions
New Project = link_to new_project_path, :class => "btn small" do
New Project »
- if current_user.is_admin?
.alert-message.block-message.info
You have administrator privilegies. You can configure application following this button:
.alert-actions
= link_to admin_root_path, :class => "btn small", :title => "Admin" do
Visit Admin Area »
- if current_user.projects.count > 0 - if current_user.projects.count > 0
%div.entry %div.entry
@ -18,21 +26,5 @@
= project.name = project.name
= link_to "More » ", projects_path = link_to "More » ", projects_path
-#%h5
-#Your Issues:
-#%ul
-#- current_user.assigned_issues.order("id DESC").limit(5).each do |issue|
-#%li
-#= link_to project_issue_path(issue.project, issue) do
-#= truncate issue.title
-#%h5
-#Your Merge Requests:
-#%ul
-#- current_user.assigned_merge_requests.order("id DESC").limit(5).each do |issue|
-#%li
-#= link_to project_merge_request_path(issue.project, issue) do
-#= truncate issue.title

View file

@ -10,7 +10,6 @@
%aside %aside
= link_to "Users", admin_users_path, :class => controller.controller_name == "users" ? "current" : nil = link_to "Users", admin_users_path, :class => controller.controller_name == "users" ? "current" : nil
= link_to "Projects", admin_projects_path, :class => controller.controller_name == "projects" ? "current" : nil = link_to "Projects", admin_projects_path, :class => controller.controller_name == "projects" ? "current" : nil
= link_to "Teams", admin_team_members_path, :class => controller.controller_name == "team_members" ? "current" : nil
= link_to "Emails", admin_emails_path, :class => controller.controller_name == "mailer" ? "current" : nil = link_to "Emails", admin_emails_path, :class => controller.controller_name == "mailer" ? "current" : nil
= link_to "Resque", "/info/resque" = link_to "Resque", "/info/resque"

View file

@ -28,5 +28,6 @@
= f.label :twitter = f.label :twitter
.input= f.text_field :twitter .input= f.text_field :twitter
= f.submit 'Save', :class => "primary btn" .actions
= f.submit 'Save', :class => "primary btn"

View file

@ -7,14 +7,18 @@ Gitlab::Application.routes.draw do
get 'help' => 'help#index' get 'help' => 'help#index'
namespace :admin do namespace :admin do
resources :users resources :users do
member do
put :team_update
end
end
resources :projects, :constraints => { :id => /[^\/]+/ } do resources :projects, :constraints => { :id => /[^\/]+/ } do
member do member do
get :team get :team
put :team_update put :team_update
end end
end end
resources :team_members resources :team_members, :only => [:edit, :update, :destroy]
get 'emails', :to => 'mailer#preview' get 'emails', :to => 'mailer#preview'
get 'mailer/preview_note' get 'mailer/preview_note'
get 'mailer/preview_user_new' get 'mailer/preview_user_new'

View file

@ -18,7 +18,6 @@ describe "Admin::Projects" do
end end
it "should have projects list" do it "should have projects list" do
page.should have_content(@project.code)
page.should have_content(@project.name) page.should have_content(@project.name)
end end
end end
@ -103,4 +102,18 @@ describe "Admin::Projects" do
page.should have_content(@project.description) page.should have_content(@project.description)
end end
end end
describe "Add new team member" do
before do
@new_user = Factory :user
visit admin_project_path(@project)
end
it "should create new user" do
select @new_user.name, :from => "user_ids"
expect { click_button "Add" }.to change { UsersProject.count }.by(1)
page.should have_content @new_user.name
current_path.should == admin_project_path(@project)
end
end
end end

View file

@ -99,4 +99,18 @@ describe "Admin::Users" do
end end
end end
end end
describe "Add new project" do
before do
@new_project = Factory :project
visit admin_user_path(@user)
end
it "should create new user" do
select @new_project.name, :from => "project_ids"
expect { click_button "Add" }.to change { UsersProject.count }.by(1)
page.should have_content @new_project.name
current_path.should == admin_user_path(@user)
end
end
end end

View file

@ -13,12 +13,6 @@ describe "Admin::Projects" do
it { admin_users_path.should be_denied_for :visitor } it { admin_users_path.should be_denied_for :visitor }
end end
describe "GET /admin/team_members" do
it { admin_team_members_path.should be_allowed_for :admin }
it { admin_team_members_path.should be_denied_for :user }
it { admin_team_members_path.should be_denied_for :visitor }
end
describe "GET /admin/emails" do describe "GET /admin/emails" do
it { admin_emails_path.should be_allowed_for :admin } it { admin_emails_path.should be_allowed_for :admin }
it { admin_emails_path.should be_denied_for :user } it { admin_emails_path.should be_denied_for :user }