Improve and fix project fork functionality. Fix project create and validation. Add user role display. Add user role at user edit form. Refs #2261
This commit is contained in:
parent
7f8091e83e
commit
3bc2ff894c
|
@ -72,7 +72,13 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
|
||||
def fork
|
||||
redirect_to @project.fork(current_user), :notice => t("flash.project.forked")
|
||||
if forked = @project.fork(current_user) and forked.valid?
|
||||
redirect_to forked, :notice => t("flash.project.forked")
|
||||
else
|
||||
flash[:warning] = t("flash.project.fork_error")
|
||||
flash[:error] = forked.errors.full_messages
|
||||
redirect_to @project
|
||||
end
|
||||
end
|
||||
|
||||
# TODO remove this?
|
||||
|
|
|
@ -14,7 +14,6 @@ class Project < ActiveRecord::Base
|
|||
has_many :collaborators, :through => :relations, :source => :object, :source_type => 'User'
|
||||
has_many :groups, :through => :relations, :source => :object, :source_type => 'Group'
|
||||
|
||||
validates :description, :uniqueness => {:scope => [:owner_id, :owner_type]}, :presence => true
|
||||
validates :name, :uniqueness => {:scope => [:owner_id, :owner_type]}, :presence => true, :format => { :with => /^[a-zA-Z0-9_\-\+\.]+$/ }
|
||||
validates :owner, :presence => true
|
||||
# validate {errors.add(:base, I18n.t('flash.project.save_warning_ssh_key')) if owner.ssh_key.blank?}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
= f.text_field :email, :class => 'text_field'
|
||||
.group
|
||||
= f.label :role, t("activerecord.attributes.user.role"), :class => :label
|
||||
= f.select :role, User::ROLES, :include_blank => true
|
||||
= f.select :role, User::ROLES, :include_blank => 'user'
|
||||
.group
|
||||
= f.label :ssh_key, t("activerecord.attributes.user.ssh_key"), :class => :label
|
||||
= f.text_area :ssh_key, :class => 'text_area'
|
||||
|
|
|
@ -12,15 +12,14 @@
|
|||
%th.first ID
|
||||
%th= t("activerecord.attributes.user.name")
|
||||
%th= t("activerecord.attributes.user.email")
|
||||
%th= t("activerecord.attributes.user.role")
|
||||
%th.last
|
||||
- @users.each do |user|
|
||||
%tr{:class => cycle("odd", "even")}
|
||||
%td
|
||||
= user.id
|
||||
%td
|
||||
= link_to user.name, user_path(user)
|
||||
%td
|
||||
= user.email
|
||||
%td= user.id
|
||||
%td= link_to user.name, user_path(user)
|
||||
%td= user.email
|
||||
%td= user.role
|
||||
%td.last
|
||||
- if can? :read, user
|
||||
= link_to t("layout.show"), user_path(user)
|
||||
|
|
|
@ -48,3 +48,18 @@ Rosa::Application.configure do
|
|||
# Send deprecation notices to registered listeners
|
||||
config.active_support.deprecation = :notify
|
||||
end
|
||||
|
||||
# Uncomment this to stub XML RPC calls
|
||||
# require 'xmlrpc/client'
|
||||
# module XMLRPC
|
||||
# class Client
|
||||
# def call(*args)
|
||||
# # raise args.inspect
|
||||
# case
|
||||
# when args.first == 'get_status'
|
||||
# {:client_count => '1', :count_new_task => '2', :count_build_task => 3}
|
||||
# else; 0
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
|
|
@ -336,6 +336,7 @@ ru:
|
|||
save_warning_ssh_key: Владельцу проекта необходимо указать в профиле свой SSH ключ
|
||||
destroyed: Проект успешно удален
|
||||
forked: Проект успешно форкнут
|
||||
fork_error: Ошибка форка
|
||||
|
||||
user:
|
||||
saved: Пользователь успешно сохранен
|
||||
|
|
Loading…
Reference in New Issue