From dd33891d591dbe2019856a1ab77b3aa4820b2032 Mon Sep 17 00:00:00 2001
From: fishermans
Date: Tue, 25 Jun 2013 14:23:45 +0200
Subject: [PATCH 1/5] Added support for subprojects on the overview page
---
app/views/projects/show.html.erb | 176 +++++++++++++++++++++++++++++++
1 file changed, 176 insertions(+)
create mode 100644 app/views/projects/show.html.erb
diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb
new file mode 100644
index 0000000..b3d8351
--- /dev/null
+++ b/app/views/projects/show.html.erb
@@ -0,0 +1,176 @@
+
+ <% if User.current.allowed_to?(:add_subprojects, @project) %>
+ <%= link_to l(:label_subproject_new), new_project_path(:parent_id => @project), :class => 'icon icon-add' %>
+ <% end %>
+ <% if User.current.allowed_to?(:close_project, @project) %>
+ <% if @project.active? %>
+ <%= link_to l(:button_close), close_project_path(@project), :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock' %>
+ <% else %>
+ <%= link_to l(:button_reopen), reopen_project_path(@project), :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-unlock' %>
+ <% end %>
+ <% end %>
+
+
+<%=l(:label_overview)%>
+
+<% unless @project.active? %>
+ <%= l(:text_project_closed) %>
+<% end %>
+
+
+ <% if @project.description.present? %>
+
+ <%= textilizable @project.description %>
+
+ <% end %>
+
+ <% unless @project.homepage.blank? %>
+ - <%=l(:field_homepage)%>: <%= link_to h(@project.homepage), @project.homepage %>
+ <% end %>
+ <% if @subprojects.any? %>
+
+
+
+ | <%=l(:label_project)%> |
+ <%=l(:field_description)%> |
+ <%=l(:field_go_to)%> |
+ <%=l(:field_versions)%> |
+ <%=l(:field_created_on)%> |
+
+
+
+ <% ancestors = [] %>
+ <% for project in @subprojects %>
+ <% rowid = "" %>
+ <% classes = "" %>
+ <% spanicon = "" %>
+ <% openonclick = "" %>
+ <% showchildren = true %>
+ <% project_id_lsd = "%04d" % project.id %>
+ <% project.children.each do |child| %>
+ <% if @projects.include?(child) %>
+ <% showchildren = true %>
+ <% break %>
+ <% end %>
+ <% end %>
+ <% if(!project.children.empty? && showchildren) %>
+ <% classes += " open parent " + cycle("odd", "even") %>
+ <% rowid = "#{project_id_lsd}span" %>
+ <% openonclick = "showHide('#{project_id_lsd}','#{project_id_lsd}span')".html_safe %>
+ <% spanicon = content_tag(:span, " ".html_safe, {:onclick => openonclick, :class => "expander"}) %>
+ <% else %>
+ <% classes += " child" %>
+ <% end %>
+ <% if(project.parent_id == nil) %>
+ <% ancestors.clear %>
+ <% ancestors << project.id %>
+ <% else %>
+ <% while (ancestors.any? && !(project.parent_id == ancestors.last)) %>
+ <% ancestors.pop %>
+ <% end %>
+ <% if( !(ancestors.detect {|pid| pid == project.parent_id })) %>
+ <% prvclasses = "open show parent " + cycle("odd", "even") %>
+ <% ancestors.each do |pid| %>
+ <% prvclasses += " " + "%04d" % pid %>
+ <% end %>
+ <% project_parent_id_lsd = "%04d" % project.parent.id %>
+ <% openonclick = "showHide('"+project_parent_id_lsd+"','"+project_parent_id_lsd+"span')".html_safe %>
+ <%= content_tag :tr, :id => project_parent_id_lsd + "span", :class => prvclasses do -%>
+
+ <%= content_tag(:span, " ".html_safe, :onclick => openonclick, :class => "expander") %>
+ <%= h(project.parent.name)%>
+ <%= content_tag(:span, " ".html_safe, :onclick => openonclick, :class => "empty") %>
+ |
+ <%= content_tag :td, :onclick => openonclick do -%><%= textilizable project.parent.short_description.gsub(/\!.+\!/,""), :project => project.parent %><% end -%>
+ <%= favorite_project_modules_links(project.parent) %> |
+ <%= render_project_progress(project.parent) %> |
+ <%= format_date(project.parent.created_on) %> |
+
+ <% end -%>
+ <% ancestors << project.parent_id %>
+ <% end %>
+ <% ancestors.each do |pid| %>
+ <% classes += " " + "%04d" % pid %>
+ <% end %>
+ <% ancestors << project.id %>
+ <% end %>
+ <%= content_tag :tr, :class => classes, :id => rowid do -%>
+
+ <%= content_tag :span, '', :style => "padding-left: #{(2*(ancestors.length-1)).to_s}em;" %>
+ <%= spanicon %>
+ <%= project.active? ? link_to(h(project.name), {:controller => 'projects', :action => 'show', :id => project}, :class => "project") : h(project.name) %>
+ <%= content_tag :span, ' '.html_safe, :onclick => openonclick, :class => "empty #{User.current.member_of?(project) ? 'my-project' : nil}"%>
+ |
+ <%= content_tag :td, :onclick => openonclick do -%><%= textilizable project.short_description.gsub(/\!.+\!/,""), :project => project %><% end -%>
+ <%= favorite_project_modules_links(project) %> |
+ <%= render_project_progress(project) %> |
+ <%= format_date(project.created_on) %> |
+ <% end -%>
+ <% end %>
+
+
+ <% end %>
+ <% @project.visible_custom_field_values.each do |custom_value| %>
+ <% if !custom_value.value.blank? %>
+ - <%=h custom_value.custom_field.name %>: <%=h show_value(custom_value) %>
+ <% end %>
+ <% end %>
+
+
+ <% if User.current.allowed_to?(:view_issues, @project) %>
+
+
<%=l(:label_issue_tracking)%>
+
+ <% for tracker in @trackers %>
+ - <%= link_to h(tracker.name), project_issues_path(@project, :set_filter => 1, :tracker_id => tracker.id) %>:
+ <%= l(:label_x_open_issues_abbr_on_total, :count => @open_issues_by_tracker[tracker].to_i,
+ :total => @total_issues_by_tracker[tracker].to_i) %>
+
+ <% end %>
+
+
+ <%= link_to l(:label_issue_view_all), project_issues_path(@project, :set_filter => 1) %>
+ <% if User.current.allowed_to?(:view_calendar, @project, :global => true) %>
+ | <%= link_to l(:label_calendar), project_calendar_path(@project) %>
+ <% end %>
+ <% if User.current.allowed_to?(:view_gantt, @project, :global => true) %>
+ | <%= link_to l(:label_gantt), project_gantt_path(@project) %>
+ <% end %>
+
+
+ <% end %>
+ <%= call_hook(:view_projects_show_left, :project => @project) %>
+
+
+
+ <%= render :partial => 'members_box' %>
+
+ <% if @news.any? && authorize_for('news', 'index') %>
+
+
<%=l(:label_news_latest)%>
+ <%= render :partial => 'news/news', :collection => @news %>
+
<%= link_to l(:label_news_view_all), project_news_index_path(@project) %>
+
+ <% end %>
+ <%= call_hook(:view_projects_show_right, :project => @project) %>
+
+
+<% content_for :sidebar do %>
+ <% if @total_hours.present? %>
+ <%= l(:label_spent_time) %>
+ <%= l_hours(@total_hours) %>
+
+ <% if User.current.allowed_to?(:log_time, @project) %>
+ <%= link_to l(:button_log_time), new_project_time_entry_path(@project) %> |
+ <% end %>
+ <%= link_to(l(:label_details), project_time_entries_path(@project)) %> |
+ <%= link_to(l(:label_report), report_project_time_entries_path(@project)) %>
+ <% end %>
+ <%= call_hook(:view_projects_show_sidebar_bottom, :project => @project) %>
+<% end %>
+
+<% content_for :header_tags do %>
+<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :key => User.current.rss_key}) %>
+<% end %>
+
+<% html_title(l(:label_overview)) -%>
From 073f1cee6c12444a32ed0b6d7951cd460193409c Mon Sep 17 00:00:00 2001
From: fishermans
Date: Tue, 25 Jun 2013 16:58:26 +0200
Subject: [PATCH 2/5] Bugfix if project has children Removed additional columns
for subtreeview
---
app/views/projects/show.html.erb | 236 ++++++++++++++-----------------
1 file changed, 108 insertions(+), 128 deletions(-)
diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb
index b3d8351..79cbf40 100644
--- a/app/views/projects/show.html.erb
+++ b/app/views/projects/show.html.erb
@@ -19,158 +19,138 @@
<% if @project.description.present? %>
-
- <%= textilizable @project.description %>
-
- <% end %>
-
- <% if User.current.allowed_to?(:view_issues, @project) %>
-
-
<%=l(:label_issue_tracking)%>
-
- <% for tracker in @trackers %>
- - <%= link_to h(tracker.name), project_issues_path(@project, :set_filter => 1, :tracker_id => tracker.id) %>:
- <%= l(:label_x_open_issues_abbr_on_total, :count => @open_issues_by_tracker[tracker].to_i,
- :total => @total_issues_by_tracker[tracker].to_i) %>
-
+
+ <% unless @project.homepage.blank? %>
+ - <%=l(:field_homepage)%>: <%= link_to h(@project.homepage), @project.homepage %>
<% end %>
-
-
- <%= link_to l(:label_issue_view_all), project_issues_path(@project, :set_filter => 1) %>
- <% if User.current.allowed_to?(:view_calendar, @project, :global => true) %>
- | <%= link_to l(:label_calendar), project_calendar_path(@project) %>
+ <% @project.visible_custom_field_values.each do |custom_value| %>
+ <% if !custom_value.value.blank? %>
+
- <%=h custom_value.custom_field.name %>: <%=h show_value(custom_value) %>
<% end %>
- <% if User.current.allowed_to?(:view_gantt, @project, :global => true) %>
- | <%= link_to l(:label_gantt), project_gantt_path(@project) %>
- <% end %>
-
-
- <% end %>
+ <% end %>
+
<%= call_hook(:view_projects_show_left, :project => @project) %>
+ <% if User.current.allowed_to?(:view_issues, @project) %>
+
+
<%=l(:label_issue_tracking)%>
+
+ <% for tracker in @trackers %>
+ - <%= link_to h(tracker.name), project_issues_path(@project, :set_filter => 1, :tracker_id => tracker.id) %>:
+ <%= l(:label_x_open_issues_abbr_on_total, :count => @open_issues_by_tracker[tracker].to_i,
+ :total => @total_issues_by_tracker[tracker].to_i) %>
+
+ <% end %>
+
+
+ <%= link_to l(:label_issue_view_all), project_issues_path(@project, :set_filter => 1) %>
+ <% if User.current.allowed_to?(:view_calendar, @project, :global => true) %>
+ | <%= link_to l(:label_calendar), project_calendar_path(@project) %>
+ <% end %>
+ <% if User.current.allowed_to?(:view_gantt, @project, :global => true) %>
+ | <%= link_to l(:label_gantt), project_gantt_path(@project) %>
+ <% end %>
+
+
+ <% end %>
+
+
<%= render :partial => 'members_box' %>
<% if @news.any? && authorize_for('news', 'index') %>
-
-
<%=l(:label_news_latest)%>
- <%= render :partial => 'news/news', :collection => @news %>
-
<%= link_to l(:label_news_view_all), project_news_index_path(@project) %>
-
+
+
<%=l(:label_news_latest)%>
+ <%= render :partial => 'news/news', :collection => @news %>
+
<%= link_to l(:label_news_view_all), project_news_index_path(@project) %>
+
<% end %>
<%= call_hook(:view_projects_show_right, :project => @project) %>
<% content_for :sidebar do %>
- <% if @total_hours.present? %>
+ <% if @total_hours.present? %>
<%= l(:label_spent_time) %>
<%= l_hours(@total_hours) %>
- <% if User.current.allowed_to?(:log_time, @project) %>
- <%= link_to l(:button_log_time), new_project_time_entry_path(@project) %> |
- <% end %>
- <%= link_to(l(:label_details), project_time_entries_path(@project)) %> |
- <%= link_to(l(:label_report), report_project_time_entries_path(@project)) %>
- <% end %>
- <%= call_hook(:view_projects_show_sidebar_bottom, :project => @project) %>
+ <% if User.current.allowed_to?(:log_time, @project) %>
+ <%= link_to l(:button_log_time), new_project_time_entry_path(@project) %> |
+ <% end %>
+ <%= link_to(l(:label_details), project_time_entries_path(@project)) %> |
+ <%= link_to(l(:label_report), report_project_time_entries_path(@project)) %>
+ <% end %>
+ <%= call_hook(:view_projects_show_sidebar_bottom, :project => @project) %>
<% end %>
<% content_for :header_tags do %>
-<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :key => User.current.rss_key}) %>
+ <%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :key => User.current.rss_key}) %>
<% end %>
<% html_title(l(:label_overview)) -%>
From 65a70b8128758f72ed3d3ba80d3bd3f06ae77857 Mon Sep 17 00:00:00 2001
From: fishermans
Date: Mon, 19 Jan 2015 16:04:20 +0100
Subject: [PATCH 3/5] * Added option to disable project progress bar on project
tab. * Layout mods
---
app/views/projects/index.html.erb | 8 ++++++--
app/views/settings/_project_tree_settings.html.erb | 8 ++++++++
config/locales/de.yml | 4 +++-
config/locales/en.yml | 1 +
config/locales/pt-BR.yml | 1 +
init.rb | 8 ++++++--
lib/projects_tree_view/patches/projects_helper.rb | 4 +---
7 files changed, 26 insertions(+), 8 deletions(-)
create mode 100644 app/views/settings/_project_tree_settings.html.erb
diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb
index b54ef42..f2370a9 100644
--- a/app/views/projects/index.html.erb
+++ b/app/views/projects/index.html.erb
@@ -16,7 +16,9 @@
<%=l(:label_project)%> |
<%=l(:field_description)%> |
<%=l(:field_go_to)%> |
- <%=l(:field_versions)%> |
+ <% if Setting.plugin_projects_tree_view['show_project_progress'] %>
+ <%=l(:field_versions)%> |
+ <% end %>
<%=l(:field_created_on)%> |
@@ -85,7 +87,9 @@
<%= content_tag :td, :onclick => openonclick do -%><%= textilizable project.short_description.gsub(/\!.+\!/,""), :project => project %><% end -%>
<%= favorite_project_modules_links(project) %> |
- <%= render_project_progress(project) %> |
+ <% if Setting.plugin_projects_tree_view['show_project_progress'] %>
+ |
+ <% end %>
<%= format_date(project.created_on) %> |
<% end -%>
<% end %>
diff --git a/app/views/settings/_project_tree_settings.html.erb b/app/views/settings/_project_tree_settings.html.erb
new file mode 100644
index 0000000..40dc840
--- /dev/null
+++ b/app/views/settings/_project_tree_settings.html.erb
@@ -0,0 +1,8 @@
+
+
+
+ | <%= l(:show_progress) %> |
+ <%= check_box_tag('settings[show_project_progress]', true, @settings['show_project_progress'])%> |
+
+
+
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 2e11903..f8eb557 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -3,4 +3,6 @@ de:
field_versions: Versionen
field_go_to: zu einem Modul wechseln
- subprojects: Untergeordnete Bereiche
\ No newline at end of file
+ subprojects: Untergeordnete Bereiche
+ show_progress: "Projektfortschritt anzeigen"
+
\ No newline at end of file
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 04710ce..2135fc4 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -5,3 +5,4 @@ en:
field_go_to: Go to module
subprojects: sub projects
expand_all: "Expand All"
+ show_progress: "Show project progress"
diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml
index 399b1e0..d3d6546 100644
--- a/config/locales/pt-BR.yml
+++ b/config/locales/pt-BR.yml
@@ -3,3 +3,4 @@ pt-BR:
field_go_to: "Ir para módulo"
subprojects: "Sub-projetos"
expand_all: "Expandir todos os projetos"
+ show_progress: "Show project progress"
diff --git a/init.rb b/init.rb
index 835253c..40daa95 100644
--- a/init.rb
+++ b/init.rb
@@ -5,9 +5,13 @@
Redmine::Plugin.register :projects_tree_view do
name 'Projects Tree View plugin'
- author 'Chris Peterson and Github community'
+ author 'Github community'
description 'This is a Redmine plugin which will turn the projects page into a tree view'
- version '0.0.7'
+ url 'https://github.com/fishermans/projects_tree_view'
+ version '0.0.8'
+ settings :default => {
+ 'show_project_progress' => true
+ }, :partial => 'settings/project_tree_settings'
end
class ProjectsTreeViewListener < Redmine::Hook::ViewListener
diff --git a/lib/projects_tree_view/patches/projects_helper.rb b/lib/projects_tree_view/patches/projects_helper.rb
index 39c6c5a..735706b 100644
--- a/lib/projects_tree_view/patches/projects_helper.rb
+++ b/lib/projects_tree_view/patches/projects_helper.rb
@@ -50,10 +50,8 @@ def render_project_progress(project)
content_tag(:div, :style => "clear:both; display: block") {
link_to_version(version) + ": ".html_safe +
link_to_if(version.open_issues_count > 0, l(:label_x_open_issues_abbr, :count => version.open_issues_count), :controller => 'issues', :action => 'index', :project_id => version.project, :status_id => 'o', :fixed_version_id => version, :set_filter => 1) +
- content_tag(:small) {
" / ".html_safe +
- link_to_if(version.closed_issues_count > 0, l(:label_x_closed_issues_abbr, :count => version.closed_issues_count), :controller => 'issues', :action => 'index', :project_id => version.project, :status_id => 'c', :fixed_version_id => version, :set_filter => 1)
- } +
+ link_to_if(version.closed_issues_count > 0, l(:label_x_closed_issues_abbr, :count => version.closed_issues_count), :controller => 'issues', :action => 'index', :project_id => version.project, :status_id => 'c', :fixed_version_id => version, :set_filter => 1) +
' '.html_safe + due_date_distance_in_words(version.effective_date) if version.effective_date
} +
# content_tag(:br) +
From 5646c2dd77a3fda5527b62c58fb2eecd8d199006 Mon Sep 17 00:00:00 2001
From: fishermans
Date: Mon, 19 Jan 2015 16:09:36 +0100
Subject: [PATCH 4/5] * update for README.rdoc * update for CHANGELOG
---
CHANGELOG | 4 ++++
README.rdoc | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG b/CHANGELOG
index b443628..ec6f2f1 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+0.0.8 (2015-01-19):
+ * Support for Redmine 2.6.1
+ * Added feature to disable progress bar on project tab
+ * Layout fixes
0.0.7 (2012-06-16):
* UI updated to prevent the continual need for html_safe declarations
* second commit for 0.0.7 due to error in init.rb
diff --git a/README.rdoc b/README.rdoc
index 8c86841..2894ca3 100644
--- a/README.rdoc
+++ b/README.rdoc
@@ -18,7 +18,7 @@ For the complete changelog see the CHANGELOG-file in the Projects Tree
==Latest stable release
-The currently available, latest stable release of the plugin is version 0.0.7.
+The currently available, latest stable release of the plugin is version 0.0.8.
==Compatibility
From 2344eab62cee95a9cd78ef5caf3c80c6dd94a357 Mon Sep 17 00:00:00 2001
From: fishermans
Date: Tue, 20 Jan 2015 18:43:32 +0100
Subject: [PATCH 5/5] * Added show/hide for modules
---
app/views/projects/index.html.erb | 8 ++++++--
app/views/settings/_project_tree_settings.html.erb | 4 ++++
config/locales/de.yml | 3 ++-
config/locales/en.yml | 1 +
config/locales/pt-BR.yml | 1 +
5 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb
index f2370a9..b714ab2 100644
--- a/app/views/projects/index.html.erb
+++ b/app/views/projects/index.html.erb
@@ -15,7 +15,9 @@
| <%=l(:label_project)%> |
<%=l(:field_description)%> |
- <%=l(:field_go_to)%> |
+ <% if Setting.plugin_projects_tree_view['show_available_modules'].present? %>
+ <%= l(:field_go_to)%> |
+ <% end %>
<% if Setting.plugin_projects_tree_view['show_project_progress'] %>
<%=l(:field_versions)%> |
<% end %>
@@ -86,7 +88,9 @@
<%= content_tag :span, ' '.html_safe, :onclick => openonclick, :class => "empty #{User.current.member_of?(project) ? 'my-project' : nil}"%>
<%= content_tag :td, :onclick => openonclick do -%><%= textilizable project.short_description.gsub(/\!.+\!/,""), :project => project %><% end -%>
- <%= favorite_project_modules_links(project) %> |
+ <% if Setting.plugin_projects_tree_view['show_available_modules'].present? %>
+ <%= favorite_project_modules_links(project) %> |
+ <% end %>
<% if Setting.plugin_projects_tree_view['show_project_progress'] %>
|
<% end %>
diff --git a/app/views/settings/_project_tree_settings.html.erb b/app/views/settings/_project_tree_settings.html.erb
index 40dc840..c4a6d3c 100644
--- a/app/views/settings/_project_tree_settings.html.erb
+++ b/app/views/settings/_project_tree_settings.html.erb
@@ -4,5 +4,9 @@
<%= l(:show_progress) %> |
<%= check_box_tag('settings[show_project_progress]', true, @settings['show_project_progress'])%> |
+
+ | <%= l(:show_modules) %> |
+ <%= check_box_tag('settings[show_available_modules]', true, @settings['show_available_modules'])%> |
+
diff --git a/config/locales/de.yml b/config/locales/de.yml
index f8eb557..a881a1b 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -1,8 +1,9 @@
-de:
+de:
# German strings go here
field_versions: Versionen
field_go_to: zu einem Modul wechseln
subprojects: Untergeordnete Bereiche
show_progress: "Projektfortschritt anzeigen"
+ show_modules: "Module in Projektübersichtsliste anzeigen"
\ No newline at end of file
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 2135fc4..2569db5 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -6,3 +6,4 @@ en:
subprojects: sub projects
expand_all: "Expand All"
show_progress: "Show project progress"
+ show_modules: "Show module list"
diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml
index d3d6546..f23cffb 100644
--- a/config/locales/pt-BR.yml
+++ b/config/locales/pt-BR.yml
@@ -4,3 +4,4 @@ pt-BR:
subprojects: "Sub-projetos"
expand_all: "Expandir todos os projetos"
show_progress: "Show project progress"
+ show_modules: "Show module list"