Add share project from group lock

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2016-03-11 19:03:19 +01:00
parent 068fd5de8a
commit 9a95b15552
No known key found for this signature in database
GPG key ID: 627C5F589F467F17
5 changed files with 20 additions and 6 deletions

View file

@ -133,7 +133,7 @@ class GroupsController < Groups::ApplicationController
end
def group_params
params.require(:group).permit(:name, :description, :path, :avatar, :public)
params.require(:group).permit(:name, :description, :path, :avatar, :public, :share_with_group_lock)
end
def load_events

View file

@ -881,8 +881,7 @@ class Project < ActiveRecord::Base
end
def allowed_to_share_with_group?
# TODO: replace with logic
true
!namespace.share_with_group_lock
end
def ci_commit(sha)

View file

@ -23,6 +23,15 @@
%hr
= link_to 'Remove avatar', group_avatar_path(@group.to_param), data: { confirm: "Group avatar will be removed. Are you sure?"}, method: :delete, class: "btn btn-remove btn-sm remove-avatar"
.form-group
%hr
= f.label :share_with_group_lock, class: 'control-label' do
Share with group lock
.col-sm-10
.checkbox
= f.check_box :share_with_group_lock
%span.descr Prevent sharing a project with another group within this group
.form-actions
= f.submit 'Save group', class: "btn btn-save"

View file

@ -0,0 +1,5 @@
class AddGroupShareLock < ActiveRecord::Migration
def change
add_column :namespaces, :share_with_group_lock, :boolean, default: false
end
end

View file

@ -576,6 +576,7 @@ ActiveRecord::Schema.define(version: 20160309140734) do
t.string "type"
t.string "description", default: "", null: false
t.string "avatar"
t.boolean "share_with_group_lock", default: false
end
add_index "namespaces", ["created_at", "id"], name: "index_namespaces_on_created_at_and_id", using: :btree