fixed new project form

This commit is contained in:
zmagod 2016-10-12 12:56:44 +02:00
parent 8f24d0d80c
commit fa36488397
2 changed files with 4 additions and 12 deletions

View file

@ -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.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,

View file

@ -1,15 +1,7 @@
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<%= form.text_field :name, label: t("projects.index.modal_new_project.name"), autofocus: true, placeholder: t("projects.index.modal_new_project.name_placeholder") %>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="form-group">
<%= form.label t("projects.index.modal_new_project.organization") %>
<%= collection_select(:project, :organization_id, @organizations, :id, :name, {}, { :class => "form-control"} ) %>
</div>
<%= hidden_field :project, :organization_id, value: current_organization.id %>
</div>
</div>