Commit 5d5d3b97ed88ec0c7bb09d18efbf756b29a05a4b

Authored by Nick Recobra
1 parent 35880a56
Exists in master and in 1 other branch production

Issue tracker setup UI.

app/models/issue_tracker.rb
... ... @@ -13,6 +13,9 @@ class IssueTracker
13 13  
14 14 protected
15 15 def check_lighthouseapp_params
16   - errors.add(:base, "You must specify your Lighthouseapp account, token and project id") if %w( api_token project_id account ).map {|m| self[m].blank? }.any?
  16 + blank_flags = %w( api_token project_id account ).map {|m| self[m].blank? }
  17 + if blank_flags.any? && !blank_flags.all?
  18 + errors.add(:base, "You must specify your Lighthouseapp account, token and project id")
  19 + end
17 20 end
18 21 end
... ...
app/views/apps/_fields.html.haml
... ... @@ -21,3 +21,20 @@
21 21 = w.select :user_id, User.all.map{|u| [u.name,u.id.to_s]}, :include_blank => '-- Select a User --'
22 22 %div.email{:class => w.object.email.present? ? 'choosen' : nil}
23 23 = w.text_field :email
  24 +
  25 +%fieldset.nested-wrapper
  26 + %legend Issue trackers
  27 + = f.fields_for :issue_trackers do |w|
  28 + %div.watcher.nested
  29 + %div.choose
  30 + = w.radio_button :issue_tracker_type, :lighthouseapp
  31 + = label_tag :issue_tracker_type_lighthouseapp, 'Lighthouse', :for => label_for_attr(w, 'issue_tracker_type_lighthouseapp')
  32 + %div.lighthouseapp{:class => 'choosen'}
  33 + = w.label :account, "Account"
  34 + = w.text_field :account
  35 + = w.label :api_token, "API token"
  36 + = w.text_field :api_token
  37 + = w.label :project_id, "Project ID"
  38 + = w.text_field :project_id
  39 +
  40 +
... ...