Project

General

Profile

Patch #14679 » redmine-2.3-stable.roadmap.patch

Jun Den, 2013-08-13 13:20

View differences:

app/models/issue.rb (工作副本)
1030 1030
    end
1031 1031
  end
1032 1032

  
1033
  def parents_count                                                                                                                                             
1034
    parent.nil? ? 0 : 1 + parent.parents_count                                                                                                                  
1035
  end
1036

  
1033 1037
  # Returns true if issue's project is a valid
1034 1038
  # parent issue project
1035 1039
  def valid_parent_project?(issue=parent)
app/models/version.rb (工作副本)
40 40
    includes(:project).where(Project.allowed_to_condition(args.first || User.current, :view_issues))
41 41
  }
42 42

  
43
  safe_attributes 'name', 
43
  safe_attributes 'name',
44 44
    'description',
45 45
    'effective_date',
46 46
    'due_date',
......
205 205

  
206 206
  scope :sorted, order(fields_for_order_statement)
207 207

  
208
  def sorted_fixed_issues(options = {})
209
    issues = []
210
    conditions = {:parent_id => options[:parent]}
211
    conditions[:tracker_id] = options[:trackers] if options[:trackers]
212
    fixed_issues.visible.find(:all,
213
                              :conditions => conditions,
214
                              :include => [:status, :tracker, :priority],
215
                              :order => "#{Tracker.table_name}.position, #{Issue.table_name}.subject").each do |issue|
216
    issues << issue
217
    issues += sorted_fixed_issues(options.merge(:parent => issue))
218
    end
219
    issues
220
  end
221

  
208 222
  # Returns the sharings that +user+ can set the version to
209 223
  def allowed_sharings(user = User.current)
210 224
    VERSION_SHARINGS.select do |s|
app/controllers/versions_controller.rb (工作副本)
62 62
  end
63 63

  
64 64
  def show
65
    respond_to do |format|
66
      format.html {
67
        @issues = @version.fixed_issues.visible.
68
          includes(:status, :tracker, :priority).
69
          reorder("#{Tracker.table_name}.position, #{Issue.table_name}.id").
70
          all
71
      }
72
      format.api
73
    end
65
    #respond_to do |format|
66
    #  format.html {
67
    #    @issues = @version.fixed_issues.visible.
68
    #      includes(:status, :tracker, :priority).
69
    #      reorder("#{Tracker.table_name}.position, #{Issue.table_name}.id").
70
    #      all
71
    #  }
72
    #  format.api
73
    #end
74
    @issues = @version.sorted_fixed_issues
74 75
  end
75 76

  
76 77
  def new
app/views/versions/index.html.erb (工作副本)
13 13
    <%= render :partial => 'versions/overview', :locals => {:version => version} %>
14 14
    <%= render(:partial => "wiki/content", :locals => {:content => version.wiki_page.content}) if version.wiki_page %>
15 15

  
16
    <% if (issues = @issues_by_version[version]) && issues.size > 0 %>
16
    <% if (issues = version.sorted_fixed_issues) && issues.size > 0 %>
17 17
    <%= form_tag({}) do -%>
18 18
    <table class="list related-issues">
19 19
    <caption><%= l(:label_related_issues) %></caption>
20 20
    <% issues.each do |issue| -%>
21 21
      <tr class="hascontextmenu">
22 22
        <td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td>
23
        <td><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
23
        <td style="padding-left: <%= issue.parents_count %>em"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
24 24
      </tr>
25 25
    <% end -%>
26 26
    </table>
app/views/versions/show.html.erb (工作副本)
39 39
  <table class="list related-issues">
40 40
  <caption><%= l(:label_related_issues) %></caption>
41 41
  <%- @issues.each do |issue| -%>
42
    <tr class="hascontextmenu">
42
    <tr class="hascontextmenu"">
43 43
      <td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td>
44
      <td><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
44
      <td style="padding-left: <%= issue.parents_count %>em"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
45 45
    </tr>
46 46
  <% end %>
47 47
  </table>
(1-1/2)