subproject.diff

Vitaliy Ischenko, 2009-06-25 17:10

Download (1.44 KB)

View differences:

app/controllers/projects_controller.rb (working copy)
75 75
    else
76 76
      @project.enabled_module_names = params[:enabled_modules]
77 77
      if @project.save
78
        @project.set_parent!(params[:project]['parent_id']) if User.current.admin? && params[:project].has_key?('parent_id')
78
        @project.set_parent!(params[:project]['parent_id']) if User.current.allowed_to?(:add_project, nil, :global => true) && params[:project].has_key?('parent_id')
79 79
        # Add current user as a project member if he is not admin
80 80
        unless User.current.admin?
81 81
          r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
app/views/projects/_form.rhtml (working copy)
4 4
<!--[form:project]-->
5 5
<p><%= f.text_field :name, :required => true %><br /><em><%= l(:text_caracters_maximum, 30) %></em></p>
6 6

  
7
<% if User.current.admin? && !@project.possible_parents.empty? %>
7
<% if User.current.allowed_to?(:add_project, nil, :global => true) && !@project.possible_parents.empty? %>
8 8
    <p><label><%= l(:field_parent) %></label><%= parent_project_select_tag(@project) %></p>
9 9
<% end %>
10 10