fixed_roadmap_links.diff

Danil Tashkinov, 2014-05-13 15:25

Download (5.37 KB)

View differences:

app/helpers/application_helper.rb
1339 1339
    end
1340 1340
  end
1341 1341

  
1342
  def version_issues_cpath(version, options = {})
1343
    options = { :fixed_version_id => version, :set_filter => 1 }.merge(options)
1344
    project = case version.sharing
1345
                when 'hierarchy', 'tree'
1346
                  version.project.root if version.project.root.visible?
1347
                when 'system'
1348
                  nil
1349
                else
1350
                  version.project
1351
              end
1352
    project ? project_issues_path(project, options) : issues_path(options)
1353
  end
1354

  
1342 1355
  private
1343 1356

  
1344 1357
  def wiki_helper
app/views/versions/_overview.html.erb
19 19
    <%= progress_bar([version.closed_percent, version.completed_percent],
20 20
                     :width => '40em', :legend => ('%0.0f%' % version.completed_percent)) %>
21 21
    <p class="progress-info">
22
      <%= link_to(l(:label_x_issues, :count => version.issues_count), 
23
                  project_issues_path(version.project,
24
                  :status_id => '*', :fixed_version_id => version,
25
                  :set_filter => 1)) %>
26
        &nbsp;
27
        (<%= link_to_if(version.closed_issues_count > 0,
28
                        l(:label_x_closed_issues_abbr, :count => version.closed_issues_count), 
29
                        project_issues_path(version.project, :status_id => 'c',
30
                        :fixed_version_id => version, :set_filter => 1)) %>
31
        &#8212;
32
        <%= link_to_if(version.open_issues_count > 0,
33
                       l(:label_x_open_issues_abbr, :count => version.open_issues_count), 
34
                       project_issues_path(version.project, :status_id => 'o',
35
                       :fixed_version_id => version, :set_filter => 1)) %>)
22
      <%= link_to(l(:label_x_issues, :count => version.issues_count),
23
                  version_issues_cpath(version, :status_id => '*')) %>
24
      &nbsp;
25
      (<%= link_to_if(version.closed_issues_count > 0,
26
                      l(:label_x_closed_issues_abbr, :count => version.closed_issues_count),
27
                      version_issues_cpath(version, :status_id => 'c')) %>
28
      &#8212;
29
      <%= link_to_if(version.open_issues_count > 0,
30
                     l(:label_x_open_issues_abbr, :count => version.open_issues_count),
31
                     version_issues_cpath(version, :status_id => 'o')) %>)
36 32
    </p>
37 33
<% else %>
38 34
    <p class="progress-info"><%= l(:label_roadmap_no_issues) %></p>
test/unit/helpers/application_helper_test.rb
291 291
    board_url = {:controller => 'boards', :action => 'show', :id => 2, :project_id => 'ecookbook'}
292 292

  
293 293
    message_url = {:controller => 'messages', :action => 'show', :board_id => 1, :id => 4}
294
    
294

  
295 295
    news_url = {:controller => 'news', :action => 'show', :id => 1}
296 296

  
297 297
    project_url = {:controller => 'projects', :action => 'show', :id => 'subproject1'}
......
933 933
  def test_pre_content_should_not_parse_wiki_and_redmine_links
934 934
    raw = <<-RAW
935 935
[[CookBook documentation]]
936
  
936

  
937 937
#1
938 938

  
939 939
<pre>
940 940
[[CookBook documentation]]
941
  
941

  
942 942
#1
943 943
</pre>
944 944
RAW
......
1513 1513
    assert_equal "#{ja} #{ja}...", result
1514 1514
    assert !result.html_safe?
1515 1515
  end
1516

  
1517
  def test_version_issues_cpath_sharing_none
1518
    version = Version.new(:name => 'test', :sharing => 'none')
1519
    version.project = Project.find(5)
1520
    assert_match '/projects/private-child/issues?', version_issues_cpath(version)
1521
  end
1522

  
1523
  def test_version_issues_cpath_sharing_descendants
1524
    version = Version.new(:name => 'test', :sharing => 'descendants')
1525
    version.project = Project.find(5)
1526
    assert_match '/projects/private-child/issues?', version_issues_cpath(version)
1527
  end
1528

  
1529
  def test_version_issues_cpath_sharing_hierarchy
1530
    version = Version.new(:name => 'test', :sharing => 'hierarchy')
1531
    version.project = Project.find(5)
1532
    assert_match '/projects/ecookbook/issues?', version_issues_cpath(version)
1533
  end
1534

  
1535
  def test_version_issues_cpath_sharing_tree
1536
    version = Version.new(:name => 'test', :sharing => 'tree')
1537
    version.project = Project.find(5)
1538
    assert_match '/projects/ecookbook/issues?', version_issues_cpath(version)
1539
  end
1540

  
1541
  def test_version_issues_cpath_sharing_system
1542
    version = Version.new(:name => 'test', :sharing => 'system')
1543
    version.project = Project.find(5)
1544
    assert_match /^\/issues\?/, version_issues_cpath(version)
1545
  end
1516 1546
end
1517
-