Commit f27c6f74 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'performance-fixes' into 'master'

Performance fixes

Fixes #195

See merge request !280
parents f71faaf3 15a0e1d6
...@@ -79,6 +79,8 @@ class Dispatcher ...@@ -79,6 +79,8 @@ class Dispatcher
new ProjectFork() new ProjectFork()
when 'users:show' when 'users:show'
new User() new User()
when 'projects:group_links:index'
new GroupsSelect()
switch path.first() switch path.first()
when 'admin' when 'admin'
......
...@@ -4,15 +4,12 @@ class Projects::GroupLinksController < Projects::ApplicationController ...@@ -4,15 +4,12 @@ class Projects::GroupLinksController < Projects::ApplicationController
def index def index
@group_links = project.project_group_links.all @group_links = project.project_group_links.all
@available_groups = Group.all
@available_groups -= project.invited_groups
@available_groups -= [project.group]
end end
def create def create
link = project.project_group_links.new link = project.project_group_links.new
link.group_id = params[:group_id] link.group_id = params[:link_group_id]
link.group_access = params[:group_access] link.group_access = params[:link_group_access]
link.save link.save
redirect_to project_group_links_path(project) redirect_to project_group_links_path(project)
......
...@@ -20,20 +20,20 @@ ...@@ -20,20 +20,20 @@
%i.icon-remove %i.icon-remove
disable sharing disable sharing
- if @available_groups.present?
.available-groups .available-groups
%h4 %h4
Can be shared with Can be shared with
%div %div
= form_tag project_group_links_path(@project), method: :post, class: 'form-horizontal' do = form_tag project_group_links_path(@project), method: :post, class: 'form-horizontal' do
.form-group .form-group
= label_tag :group_id, 'Group', class: 'control-label' = label_tag :link_group_id, 'Group', class: 'control-label'
.col-sm-10 .col-sm-10
= select_tag :group_id, options_from_collection_for_select(@available_groups, :id, :name), class: 'select2' = groups_select_tag(:link_group_id)
.form-group .form-group
= label_tag :group_access, 'Max access level', class: 'control-label' = label_tag :link_group_access, 'Max access level', class: 'control-label'
.col-sm-10 .col-sm-10
= select_tag :group_access, options_for_select(ProjectGroupLink.access_options, ProjectGroupLink.default_access), class: "form-control" = select_tag :link_group_access, options_for_select(ProjectGroupLink.access_options, ProjectGroupLink.default_access), class: "form-control"
.form-actions .form-actions
= submit_tag "Share", class: "btn btn-create" = submit_tag "Share", class: "btn btn-create"
...@@ -10,6 +10,7 @@ Feature: Project Group Links ...@@ -10,6 +10,7 @@ Feature: Project Group Links
Then I should see project already shared with group "Ops" Then I should see project already shared with group "Ops"
Then I should see project is not shared with group "Market" Then I should see project is not shared with group "Market"
@javascript
Scenario: I share project with group Scenario: I share project with group
When I select group "Market" for share When I select group "Market" for share
Then I should see project is shared with group "Market" Then I should see project is shared with group "Market"
...@@ -2,6 +2,7 @@ class Spinach::Features::ProjectGroupLinks < Spinach::FeatureSteps ...@@ -2,6 +2,7 @@ class Spinach::Features::ProjectGroupLinks < Spinach::FeatureSteps
include SharedAuthentication include SharedAuthentication
include SharedProject include SharedProject
include SharedPaths include SharedPaths
include Select2Helper
step 'I should see project already shared with group "Ops"' do step 'I should see project already shared with group "Ops"' do
within '.enabled-groups' do within '.enabled-groups' do
...@@ -16,8 +17,9 @@ class Spinach::Features::ProjectGroupLinks < Spinach::FeatureSteps ...@@ -16,8 +17,9 @@ class Spinach::Features::ProjectGroupLinks < Spinach::FeatureSteps
end end
step 'I select group "Market" for share' do step 'I select group "Market" for share' do
select "Master", from: 'group_access' group = Group.find_by(path: 'market')
select "Market", from: 'group_id' select2(group.id, from: "#link_group_id")
select "Master", from: 'link_group_access'
click_button "Share" click_button "Share"
end end
...@@ -35,7 +37,7 @@ class Spinach::Features::ProjectGroupLinks < Spinach::FeatureSteps ...@@ -35,7 +37,7 @@ class Spinach::Features::ProjectGroupLinks < Spinach::FeatureSteps
end end
step 'project "Shop" is not shared with group "Market"' do step 'project "Shop" is not shared with group "Market"' do
create(:group, name: 'Market') create(:group, name: 'Market', path: 'market')
end end
step 'I visit project group links page' do step 'I visit project group links page' do
......
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