project_tree_view插件修改,增加新增加子项目功能
安装了0。0.4版本的project_tree_view之后,进入到项目的具体页面之后,页面变清晰了,但是带来了另外一个问题,那就是,缺少了新增加子项目的功能,导致每次新增加子项目比较费时,找了一下官网的修改,发现有点小问题,在官网的基础上进行了调整,如下:
?
?
?
vendor/plugins/projects_tree_view/app/views/projects/show.rhtml
?
在<div %> <% spanicon = "" %> <% openonclick = "" %> <% classes = "child " + cycle("odd", "even") %> <% 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" %> <% ancestors.each do |pid| %><% prvclasses += " " + pid.to_s %> <% end %> <% openonclick = "onclick="showHide('"+project.parent_id.to_s+"','"+project.parent_id.to_s+"span')"" %> <tr id="<%= project.parent_id.to_s + "span" %>" ><td style="padding-left: <%= 2*ancestors.length %>em;"><%="<span " + openonclick + " class="expander">  </span>"%><%= h("Sub Projects") %><span <%= openonclick %> " + pid.to_s %><% end %><% ancestors << project.id %> <% end %> <tr <%= rowid %> ><td style="padding-left: <%= 2*project.level %>em;"><%= spanicon %><%= project.active? ? link_to(h(project.name), {:controller => 'projects', :action => 'show', :id => project}, :class => "project") : h(project.name) %><span <%= openonclick %> => 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) %></li> <% end %> </ul> <p><%= link_to l(:label_issue_view_all), :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1 %></p> </div> <% end %> <%= call_hook(:view_projects_show_left, :project => @project) %></div><div class="splitcontentright"><% if users_by_role_implemented %><% if @members_by_role.any? %> <div class="box"><h3 class="icon22 icon22-users"><%=l(:label_member_plural)%></h3><p><% @members_by_role.keys.sort.each do |role| %><%= role.name %>:<%= @members_by_role[role].collect(&:user).sort.collect{|u| link_to_user u}.join(", ") %><br /><% end %></p> </div><% end %><% else %><% if @users_by_role.any? %> <div class="box"><h3 class="icon22 icon22-users"><%=l(:label_member_plural)%></h3> <p><% @users_by_role.keys.sort.each do |role| %><%=h role %>: <%= @users_by_role[role].sort.collect{|u| link_to_user u}.join(", ") %><br /><% end %></p> </div><% end %><% end %> <% if @news.any? && authorize_for('news', 'index') %> <div class="box"> <h3><%=l(:label_news_latest)%></h3> <%= render :partial => 'news/news', :collection => @news %> <p><%= link_to l(:label_news_view_all), :controller => 'news', :action => 'index', :project_id => @project %></p> </div> <% end %> <%= call_hook(:view_projects_show_right, :project => @project) %></div><% content_for :sidebar do %> <% planning_links = [] planning_links << link_to_if_authorized(l(:label_calendar), :controller => 'issues', :action => 'calendar', :project_id => @project) planning_links << link_to_if_authorized(l(:label_gantt), :controller => 'issues', :action => 'gantt', :project_id => @project) planning_links.compact! unless planning_links.empty? %> <h3><%= l(:label_planning) %></h3> <p><%= planning_links.join(' | ') %></p> <% end %> <% if @total_hours && User.current.allowed_to?(:view_time_entries, @project) %> <h3><%= l(:label_spent_time) %></h3> <p><span class="icon icon-time"><%= l_hours(@total_hours) %></span></p> <p><%= link_to(l(:label_details), {:controller => 'timelog', :action => 'index', :project_id => @project}) %> | <%= link_to(l(:label_report), {:controller => 'time_entry_reports', :action => 'report', :project_id => @project}) %></p> <% end %><% 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)) -%>
?
?
相关链接:
?
1.1 redmine插件-Redmine Importer,bug导入插件,导入csv文件1.2 redmine插件安装,如何安装插件的数据库1.3 redmine的知识库插件-Redmine Knowledgebase plugin,程序员们的知识需要管理1.4 redmine的CKEDITOR插件简体中文版脚本1.5 redmine插件推荐-ckeditor,高级功能编辑1.6 redmine-获取最新讨论区信息插件获取最新记录修改-forum_last_message1.7 发现一个redmine非常好的plug-in-Timesheet Plugin作者:无名程序员
微博:weibo.com/wmcxy
blog:wmcxy.iteye.com
转载请注明原作者,谢谢配合!
?