diff --git a/app/models/watcher.rb b/app/models/watcher.rb index 9081156..95426b5 100644 --- a/app/models/watcher.rb +++ b/app/models/watcher.rb @@ -9,6 +9,10 @@ class Watcher validate :ensure_user_or_email + def label + user ? user.name : email + end + protected def ensure_user_or_email diff --git a/app/views/apps/_fields.html.haml b/app/views/apps/_fields.html.haml index c142026..69c717f 100644 --- a/app/views/apps/_fields.html.haml +++ b/app/views/apps/_fields.html.haml @@ -10,5 +10,10 @@ %legend Watchers - f.fields_for :watchers do |w| %div.nested - = w.label :email - = w.text_field :email \ No newline at end of file + %div + = w.label :user + = w.select :user_id, User.all.map{|u| [u.name,u.id]}, :include_blank => '-- Select a User --' + %strong.option - OR - + %div + = w.label :email + = w.text_field :email \ No newline at end of file diff --git a/app/views/apps/show.html.haml b/app/views/apps/show.html.haml index d30fd68..5854f7c 100644 --- a/app/views/apps/show.html.haml +++ b/app/views/apps/show.html.haml @@ -17,11 +17,11 @@ %table.watchers %thead %tr - %th Email + %th User or Email %tbody - @app.watchers.each do |watcher| %tr - %td= watcher.email + %td= watcher.label - if @app.watchers.none? %tr %td diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 8792c0f..827eae3 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -257,6 +257,23 @@ form > div > span { font-size: 0.85em; color: #787878; } +form strong.option { + display: block; + margin: 0.7em 0; + color: #999; +} + +form .nested { + border-top: 1px dotted #BBB; + margin-top: 1.5em; + padding-top: 1.5em; +} + +form legend + .nested { + border: none; + margin-top: 0; + padding-top: 0; +} /* Tables */ table { -- libgit2 0.21.2