mirror of
https://github.com/meineerde/redmine.git
synced 2026-03-11 19:53:07 +00:00
Prettier parent project combo-box and prevent calls to Project#level.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/work@2163 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
161e32889f
commit
311a005af7
@ -34,8 +34,13 @@ module ProjectsHelper
|
||||
tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)}
|
||||
end
|
||||
|
||||
def project_hierarchy_collection_for_select(projects)
|
||||
projects.sort_by(&:lft).collect {|p| [('>' * p.level) + p.name.to_s, p.id]}
|
||||
def parent_project_select_tag(project)
|
||||
options = '<option></option>'
|
||||
project_tree(project.possible_parents) do |p, i|
|
||||
selected = (project.parent == p)
|
||||
options << "<option value='#{p.id}' #{ selected ? 'selected' : nil}>#{ '» ' * i }#{h(p)}</option>"
|
||||
end
|
||||
content_tag('select', options, :name => 'project[parent_id]')
|
||||
end
|
||||
|
||||
# Renders a tree of projects as a nested set of unordered lists
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<p><%= f.text_field :name, :required => true %><br /><em><%= l(:text_caracters_maximum, 30) %></em></p>
|
||||
|
||||
<% if User.current.admin? && !@project.possible_parents.empty? %>
|
||||
<p><%= f.select :parent_id, project_hierarchy_collection_for_select(@project.possible_parents), { :include_blank => true } %></p>
|
||||
<p><label><%= l(:field_parent) %></label><%= parent_project_select_tag(@project) %></p>
|
||||
<% end %>
|
||||
|
||||
<p><%= f.text_area :description, :rows => 5, :class => 'wiki-edit' %></p>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user