Commit aedd520db82ee5d3da3e7fc445d17805de563d76
1 parent
847f4d31
Exists in
master
and in
1 other branch
Use `.label` method instead of `.class::Label` for retrieving issue tracker labels
Showing
7 changed files
with
12 additions
and
12 deletions
Show diff stats
app/assets/stylesheets/issue_tracker_icons.css.erb
1 | 1 | /* Issue Tracker inactive, select, create and goto icons */ |
2 | -<% trackers = IssueTracker.subclasses.map{|t| t::Label } << 'none' %> | |
2 | +<% trackers = IssueTracker.subclasses.map{|t| t.label } << 'none' %> | |
3 | 3 | <% trackers.each do |tracker| %> |
4 | 4 | div.issue_tracker.nested label.<%= tracker %> { |
5 | 5 | background: url(/assets/<%= tracker %>_inactive.png) no-repeat; | ... | ... |
app/models/issue_tracker.rb
... | ... | @@ -30,9 +30,9 @@ class IssueTracker |
30 | 30 | |
31 | 31 | def url; nil; end |
32 | 32 | |
33 | + # Retrieve tracker label from either class or instance. | |
33 | 34 | Label = '' |
34 | - def self.label | |
35 | - self::Label | |
36 | - end | |
35 | + def self.label; self::Label; end | |
36 | + def label; self.class.label; end | |
37 | 37 | end |
38 | 38 | ... | ... |
app/models/problem.rb
... | ... | @@ -149,7 +149,7 @@ class Problem |
149 | 149 | def issue_type |
150 | 150 | # Return issue_type if configured, but fall back to detecting app's issue tracker |
151 | 151 | attributes['issue_type'] ||= |
152 | - (app.issue_tracker_configured? && app.issue_tracker.class::Label) || nil | |
152 | + (app.issue_tracker_configured? && app.issue_tracker.label) || nil | |
153 | 153 | end |
154 | 154 | |
155 | 155 | private | ... | ... |
app/views/apps/_issue_tracker_fields.html.haml
... | ... | @@ -7,14 +7,14 @@ |
7 | 7 | = w.radio_button :type, "IssueTracker", 'data-section' => 'none' |
8 | 8 | (None) |
9 | 9 | - IssueTracker.subclasses.each do |tracker| |
10 | - = label_tag "type_#{tracker::Label}:", :for => label_for_attr(w, "type_#{tracker.name.downcase.gsub(':','')}"), :class => "label_radio #{tracker::Label}" do | |
11 | - = w.radio_button :type, tracker.name, 'data-section' => tracker::Label | |
10 | + = label_tag "type_#{tracker.label}:", :for => label_for_attr(w, "type_#{tracker.name.downcase.gsub(':','')}"), :class => "label_radio #{tracker.label}" do | |
11 | + = w.radio_button :type, tracker.name, 'data-section' => tracker.label | |
12 | 12 | = tracker.name[/::(.*)Tracker/,1].titleize |
13 | 13 | |
14 | 14 | %div.tracker_params.none{:class => (w.object && !(w.object.class < IssueTracker)) ? 'chosen' : nil} |
15 | 15 | %p When no issue tracker has been configured, you will be able to leave comments on errors. |
16 | 16 | - IssueTracker.subclasses.each do |tracker| |
17 | - %div.tracker_params{:class => (w.object.is_a?(tracker) ? 'chosen ' : '') << tracker::Label} | |
17 | + %div.tracker_params{:class => (w.object.is_a?(tracker) ? 'chosen ' : '') << tracker.label} | |
18 | 18 | - if defined?(tracker::Note) |
19 | 19 | %p= tracker::Note.html_safe |
20 | 20 | - tracker::Fields.each do |field, field_info| |
... | ... | @@ -23,7 +23,7 @@ |
23 | 23 | = w.send field_type, field, :placeholder => field_info[:placeholder], :value => w.object.send(field) |
24 | 24 | |
25 | 25 | .image_preloader |
26 | - - (IssueTracker.subclasses.map{|t| t::Label } << 'none').each do |tracker| | |
26 | + - (IssueTracker.subclasses.map{|t| t.label } << 'none').each do |tracker| | |
27 | 27 | = image_tag "#{tracker}_inactive.png" |
28 | 28 | = image_tag "#{tracker}_create.png" |
29 | 29 | ... | ... |
app/views/apps/index.html.haml
... | ... | @@ -24,7 +24,7 @@ |
24 | 24 | - if any_issue_trackers? |
25 | 25 | %td.issue_tracker |
26 | 26 | - if app.issue_tracker_configured? |
27 | - - tracker_img = image_tag("#{app.issue_tracker.class::Label}_goto.png") | |
27 | + - tracker_img = image_tag("#{app.issue_tracker.label}_goto.png") | |
28 | 28 | - if app.issue_tracker.url |
29 | 29 | = link_to( tracker_img, app.issue_tracker.url ) |
30 | 30 | - else | ... | ... |
app/views/errs/_issue_tracker_links.html.haml
... | ... | @@ -9,4 +9,4 @@ |
9 | 9 | - if current_user.github_account? && @app.github_repo? |
10 | 10 | %span= link_to 'create issue', create_issue_app_err_path(@app, @problem, :tracker => 'user_github'), :method => :post, :class => "github_create create-issue" |
11 | 11 | - if @app.issue_tracker_configured? && !@app.issue_tracker.is_a?(GithubIssuesTracker) |
12 | - %span= link_to 'create issue', create_issue_app_err_path(@app, @problem), :method => :post, :class => "#{@app.issue_tracker.class::Label}_create create-issue" | |
12 | + %span= link_to 'create issue', create_issue_app_err_path(@app, @problem), :method => :post, :class => "#{@app.issue_tracker.label}_create create-issue" | ... | ... |
db/migrate/20120605091105_set_issue_type_on_problems.rb
... | ... | @@ -2,7 +2,7 @@ class SetIssueTypeOnProblems < Mongoid::Migration |
2 | 2 | def self.up |
3 | 3 | Problem.all.each do |p| |
4 | 4 | if p.issue_link.present? && p.app.issue_tracker_configured? |
5 | - p.update_attribute :issue_type, p.app.issue_tracker.class::Label | |
5 | + p.update_attribute :issue_type, p.app.issue_tracker.label | |
6 | 6 | end |
7 | 7 | end |
8 | 8 | end | ... | ... |