summaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-01-24 11:31:15 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-01-24 11:31:15 +0000
commitc9906480d3f279977720dc3f61534f4a5b77d1d2 (patch)
tree23d1ad1fc0a9435bcb703033dd7b5069ac565005 /app/views
parent51b745470c1d71b92072210a008f29c5d5a945d1 (diff)
downloadredmine-c9906480d3f279977720dc3f61534f4a5b77d1d2.tar.gz
redmine-c9906480d3f279977720dc3f61534f4a5b77d1d2.zip
Merged nested projects branch. Removes limit on subproject nesting (#594).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2304 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views')
-rw-r--r--app/views/admin/projects.rhtml20
-rw-r--r--app/views/layouts/_project_selector.rhtml12
-rw-r--r--app/views/layouts/base.rhtml2
-rw-r--r--app/views/projects/_form.rhtml4
-rw-r--r--app/views/projects/activity.rhtml2
-rw-r--r--app/views/projects/destroy.rhtml4
-rw-r--r--app/views/projects/index.rhtml13
-rw-r--r--app/views/projects/show.rhtml12
-rw-r--r--app/views/users/_memberships.rhtml2
9 files changed, 24 insertions, 47 deletions
diff --git a/app/views/admin/projects.rhtml b/app/views/admin/projects.rhtml
index 6c7a21fb5..40177a63b 100644
--- a/app/views/admin/projects.rhtml
+++ b/app/views/admin/projects.rhtml
@@ -17,22 +17,20 @@
<table class="list">
<thead><tr>
- <%= sort_header_tag('name', :caption => l(:label_project)) %>
+ <th><%=l(:label_project)%></th>
<th><%=l(:field_description)%></th>
- <th><%=l(:label_subproject_plural)%></th>
- <%= sort_header_tag('is_public', :caption => l(:field_is_public), :default_order => 'desc') %>
- <%= sort_header_tag('created_on', :caption => l(:field_created_on), :default_order => 'desc') %>
+ <th><%=l(:field_is_public)%></th>
+ <th><%=l(:field_created_on)%></th>
<th></th>
<th></th>
</tr></thead>
<tbody>
<% for project in @projects %>
- <tr class="<%= cycle("odd", "even") %>">
- <td><%= project.active? ? link_to(h(project.name), :controller => 'projects', :action => 'settings', :id => project) : h(project.name) %>
- <td><%= textilizable project.short_description, :project => project %>
- <td align="center"><%= project.children.size %>
- <td align="center"><%= image_tag 'true.png' if project.is_public? %>
- <td align="center"><%= format_date(project.created_on) %>
+ <tr class="<%= cycle("odd", "even") %> <%= css_project_classes(project) %>">
+ <td class="name" style="padding-left: <%= project.level %>em;"><%= project.active? ? link_to(h(project.name), :controller => 'projects', :action => 'settings', :id => project) : h(project.name) %></td>
+ <td><%= textilizable project.short_description, :project => project %></td>
+ <td align="center"><%= image_tag 'true.png' if project.is_public? %></td>
+ <td align="center"><%= format_date(project.created_on) %></td>
<td align="center" style="width:10%">
<small>
<%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project }, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-lock') if project.active? %>
@@ -47,6 +45,4 @@
</tbody>
</table>
-<p class="pagination"><%= pagination_links_full @project_pages, @project_count %></p>
-
<% html_title(l(:label_project_plural)) -%>
diff --git a/app/views/layouts/_project_selector.rhtml b/app/views/layouts/_project_selector.rhtml
deleted file mode 100644
index 545884042..000000000
--- a/app/views/layouts/_project_selector.rhtml
+++ /dev/null
@@ -1,12 +0,0 @@
-<% user_projects_by_root = User.current.projects.find(:all, :include => :parent).group_by(&:root) %>
-<select onchange="if (this.value != '') { window.location = this.value; }">
-<option selected="selected" value=""><%= l(:label_jump_to_a_project) %></option>
-<option disabled="disabled" value="">---</option>
-<% user_projects_by_root.keys.sort.each do |root| %>
- <%= content_tag('option', h(root.name), :value => url_for(:controller => 'projects', :action => 'show', :id => root, :jump => current_menu_item)) %>
- <% user_projects_by_root[root].sort.each do |project| %>
- <% next if project == root %>
- <%= content_tag('option', ('&#187; ' + h(project.name)), :value => url_for(:controller => 'projects', :action => 'show', :id => project, :jump => current_menu_item)) %>
- <% end %>
-<% end %>
-</select>
diff --git a/app/views/layouts/base.rhtml b/app/views/layouts/base.rhtml
index 0de3b0e3d..6e24d9ccf 100644
--- a/app/views/layouts/base.rhtml
+++ b/app/views/layouts/base.rhtml
@@ -34,7 +34,7 @@
<%= link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project}, :accesskey => accesskey(:search) %>:
<%= text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search) %>
<% end %>
- <%= render :partial => 'layouts/project_selector' if User.current.memberships.any? %>
+ <%= render_project_jump_box %>
</div>
<h1><%= h(@project && !@project.new_record? ? @project.name : Setting.app_title) %></h1>
diff --git a/app/views/projects/_form.rhtml b/app/views/projects/_form.rhtml
index f0c9fda55..24b1d9c1f 100644
--- a/app/views/projects/_form.rhtml
+++ b/app/views/projects/_form.rhtml
@@ -4,8 +4,8 @@
<!--[form:project]-->
<p><%= f.text_field :name, :required => true %><br /><em><%= l(:text_caracters_maximum, 30) %></em></p>
-<% if User.current.admin? and !@root_projects.empty? %>
- <p><%= f.select :parent_id, (@root_projects.collect {|p| [p.name, p.id]}), { :include_blank => true } %></p>
+<% if User.current.admin? && !@project.possible_parents.empty? %>
+ <p><label><%= l(:field_parent) %></label><%= parent_project_select_tag(@project) %></p>
<% end %>
<p><%= f.text_area :description, :rows => 5, :class => 'wiki-edit' %></p>
diff --git a/app/views/projects/activity.rhtml b/app/views/projects/activity.rhtml
index b0e536690..67c991359 100644
--- a/app/views/projects/activity.rhtml
+++ b/app/views/projects/activity.rhtml
@@ -48,7 +48,7 @@
<p><% @activity.event_types.each do |t| %>
<label><%= check_box_tag "show_#{t}", 1, @activity.scope.include?(t) %> <%= l("label_#{t.singularize}_plural")%></label><br />
<% end %></p>
-<% if @project && @project.active_children.any? %>
+<% if @project && @project.descendants.active.any? %>
<p><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label></p>
<%= hidden_field_tag 'with_subprojects', 0 %>
<% end %>
diff --git a/app/views/projects/destroy.rhtml b/app/views/projects/destroy.rhtml
index a1913c115..09d7d2a1c 100644
--- a/app/views/projects/destroy.rhtml
+++ b/app/views/projects/destroy.rhtml
@@ -3,8 +3,8 @@
<p><strong><%=h @project_to_destroy %></strong><br />
<%=l(:text_project_destroy_confirmation)%>
-<% if @project_to_destroy.children.any? %>
-<br /><%= l(:text_subprojects_destroy_warning, content_tag('strong', h(@project_to_destroy.children.sort.collect{|p| p.to_s}.join(', ')))) %>
+<% if @project_to_destroy.descendants.any? %>
+<br /><%= l(:text_subprojects_destroy_warning, content_tag('strong', h(@project_to_destroy.descendants.collect{|p| p.to_s}.join(', ')))) %>
<% end %>
</p>
<p>
diff --git a/app/views/projects/index.rhtml b/app/views/projects/index.rhtml
index 4c68717f5..40ea4b862 100644
--- a/app/views/projects/index.rhtml
+++ b/app/views/projects/index.rhtml
@@ -6,20 +6,11 @@
<h2><%=l(:label_project_plural)%></h2>
-<% @project_tree.keys.sort.each do |project| %>
-<h3><%= link_to h(project.name), {:action => 'show', :id => project}, :class => (User.current.member_of?(project) ? "icon icon-fav" : "") %></h3>
-<%= textilizable(project.short_description, :project => project) %>
-
-<% if @project_tree[project].any? %>
- <p><%= l(:label_subproject_plural) %>:
- <%= @project_tree[project].sort.collect {|subproject|
- link_to(h(subproject.name), {:action => 'show', :id => subproject}, :class => (User.current.member_of?(subproject) ? "icon icon-fav" : ""))}.join(', ') %></p>
-<% end %>
-<% end %>
+<%= render_project_hierarchy(@projects)%>
<% if User.current.logged? %>
<p style="text-align:right;">
-<span class="icon icon-fav"><%= l(:label_my_projects) %></span>
+<span class="my-project"><%= l(:label_my_projects) %></span>
</p>
<% end %>
diff --git a/app/views/projects/show.rhtml b/app/views/projects/show.rhtml
index fa6571306..6d5a1536b 100644
--- a/app/views/projects/show.rhtml
+++ b/app/views/projects/show.rhtml
@@ -4,11 +4,13 @@
<%= textilizable @project.description %>
<ul>
<% unless @project.homepage.blank? %><li><%=l(:field_homepage)%>: <%= link_to(h(@project.homepage), @project.homepage) %></li><% end %>
- <% if @subprojects.any? %>
- <li><%=l(:label_subproject_plural)%>: <%= @subprojects.collect{|p| link_to(h(p.name), :action => 'show', :id => p)}.join(", ") %></li>
- <% end %>
- <% if @project.parent %>
- <li><%=l(:field_parent)%>: <%= link_to h(@project.parent.name), :controller => 'projects', :action => 'show', :id => @project.parent %></li>
+ <% if @subprojects.any? %>
+ <li><%=l(:label_subproject_plural)%>:
+ <%= @subprojects.collect{|p| link_to(h(p), :action => 'show', :id => p)}.join(", ") %></li>
+ <% end %>
+ <% if @ancestors.any? %>
+ <li><%=l(:field_parent)%>:
+ <%= @ancestors.collect {|p| link_to(h(p), :action => 'show', :id => p)}.join(" &#187; ") %></li>
<% end %>
<% @project.custom_values.each do |custom_value| %>
<% if !custom_value.value.empty? %>
diff --git a/app/views/users/_memberships.rhtml b/app/views/users/_memberships.rhtml
index 94b49159e..d1657fb98 100644
--- a/app/views/users/_memberships.rhtml
+++ b/app/views/users/_memberships.rhtml
@@ -31,7 +31,7 @@
<p>
<label><%=l(:label_project_new)%></label><br/>
<% form_tag({ :action => 'edit_membership', :id => @user }) do %>
-<%= select_tag 'membership[project_id]', projects_options_for_select(@projects) %>
+<%= select_tag 'membership[project_id]', options_for_membership_project_select(@user, @projects) %>
<%= l(:label_role) %>:
<%= select_tag 'membership[role_id]', options_from_collection_for_select(@roles, "id", "name") %>
<%= submit_tag l(:button_add) %>