diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 4188d5d9e..bbd6ab229 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -47,14 +47,14 @@ class ProjectsController < ApplicationController def new @project = Project.new - @organizations = current_user.organizations end def create @project = Project.new(project_params) - @project.created_by = current_user + @project.created_by = current_user @project.last_modified_by = current_user - if @project.save + if current_organization.id == project_params[:organization_id].to_i && + @project.save # Create user-project association up = UserProject.new( role: :owner, diff --git a/app/views/projects/_new.html.erb b/app/views/projects/_new.html.erb index 3ed45746c..1f476b610 100644 --- a/app/views/projects/_new.html.erb +++ b/app/views/projects/_new.html.erb @@ -1,15 +1,7 @@
<%= form.text_field :name, label: t("projects.index.modal_new_project.name"), autofocus: true, placeholder: t("projects.index.modal_new_project.name_placeholder") %> -
-
- -
-
-
- <%= form.label t("projects.index.modal_new_project.organization") %> - <%= collection_select(:project, :organization_id, @organizations, :id, :name, {}, { :class => "form-control"} ) %> -
+ <%= hidden_field :project, :organization_id, value: current_organization.id %>