Commit 940c89cc5fe68f837c6c9fcc75a8f7b0daedad69
Exists in
master
and in
1 other branch
Merge pull request #51 from crossroads/allow_none_for_issue_tracker
Allow user to select (None) for issue tracker.
Showing
3 changed files
with
9 additions
and
4 deletions
Show diff stats
app/models/app.rb
| ... | ... | @@ -35,7 +35,7 @@ class App |
| 35 | 35 | accepts_nested_attributes_for :watchers, :allow_destroy => true, |
| 36 | 36 | :reject_if => proc { |attrs| attrs[:user_id].blank? && attrs[:email].blank? } |
| 37 | 37 | accepts_nested_attributes_for :issue_tracker, :allow_destroy => true, |
| 38 | - :reject_if => proc { |attrs| !%w(lighthouseapp redmine pivotal fogbugz).include?(attrs[:issue_tracker_type]) } | |
| 38 | + :reject_if => proc { |attrs| !%w(none lighthouseapp redmine pivotal fogbugz).include?(attrs[:issue_tracker_type]) } | |
| 39 | 39 | |
| 40 | 40 | # Mongoid Bug: find(id) on association proxies returns an Enumerator |
| 41 | 41 | def self.find_by_id!(app_id) |
| ... | ... | @@ -68,9 +68,9 @@ class App |
| 68 | 68 | def github_url_to_file(file) |
| 69 | 69 | "#{self.github_url}/blob/master#{file}" |
| 70 | 70 | end |
| 71 | - | |
| 71 | + | |
| 72 | 72 | def issue_tracker_configured? |
| 73 | - issue_tracker && !issue_tracker.project_id.blank? | |
| 73 | + issue_tracker && issue_tracker.issue_tracker_type != "none" && !issue_tracker.project_id.blank? | |
| 74 | 74 | end |
| 75 | 75 | |
| 76 | 76 | protected |
| ... | ... | @@ -96,3 +96,4 @@ class App |
| 96 | 96 | end |
| 97 | 97 | |
| 98 | 98 | end |
| 99 | + | ... | ... |
app/models/issue_tracker.rb
| ... | ... | @@ -14,7 +14,7 @@ class IssueTracker |
| 14 | 14 | field :project_id, :type => String |
| 15 | 15 | field :username, :type => String |
| 16 | 16 | field :password, :type => String |
| 17 | - field :issue_tracker_type, :type => String, :default => 'lighthouseapp' | |
| 17 | + field :issue_tracker_type, :type => String, :default => 'none' | |
| 18 | 18 | |
| 19 | 19 | def create_issue err |
| 20 | 20 | case issue_tracker_type |
| ... | ... | @@ -130,3 +130,4 @@ class IssueTracker |
| 130 | 130 | end |
| 131 | 131 | end |
| 132 | 132 | end |
| 133 | + | ... | ... |
app/views/apps/_fields.html.haml
| ... | ... | @@ -39,6 +39,8 @@ |
| 39 | 39 | = f.fields_for :issue_tracker do |w| |
| 40 | 40 | %div.issue_tracker.nested |
| 41 | 41 | %div.choose |
| 42 | + = w.radio_button :issue_tracker_type, :none | |
| 43 | + = label_tag :issue_tracker_type_lighthouseapp, '(None)', :for => label_for_attr(w, 'issue_tracker_type_none') | |
| 42 | 44 | = w.radio_button :issue_tracker_type, :lighthouseapp |
| 43 | 45 | = label_tag :issue_tracker_type_lighthouseapp, 'Lighthouse', :for => label_for_attr(w, 'issue_tracker_type_lighthouseapp') |
| 44 | 46 | = w.radio_button :issue_tracker_type, :redmine |
| ... | ... | @@ -75,3 +77,4 @@ |
| 75 | 77 | = w.text_field :username, :placeholder => 'Username/Email for your account' |
| 76 | 78 | = w.label :password, 'account password' |
| 77 | 79 | = w.password_field :password, :placeholder => 'Password for your account' |
| 80 | + | ... | ... |