Commit 6ae0945a2634c1cefd31af105fdef5c1847fa4a6
1 parent
fed22b92
Exists in
master
and in
1 other branch
Allow the nested forms for watchers to have a user watcher.
Showing
4 changed files
with
30 additions
and
4 deletions
Show diff stats
app/models/watcher.rb
app/views/apps/_fields.html.haml
@@ -10,5 +10,10 @@ | @@ -10,5 +10,10 @@ | ||
10 | %legend Watchers | 10 | %legend Watchers |
11 | - f.fields_for :watchers do |w| | 11 | - f.fields_for :watchers do |w| |
12 | %div.nested | 12 | %div.nested |
13 | - = w.label :email | ||
14 | - = w.text_field :email | ||
15 | \ No newline at end of file | 13 | \ No newline at end of file |
14 | + %div | ||
15 | + = w.label :user | ||
16 | + = w.select :user_id, User.all.map{|u| [u.name,u.id]}, :include_blank => '-- Select a User --' | ||
17 | + %strong.option - OR - | ||
18 | + %div | ||
19 | + = w.label :email | ||
20 | + = w.text_field :email | ||
16 | \ No newline at end of file | 21 | \ No newline at end of file |
app/views/apps/show.html.haml
@@ -17,11 +17,11 @@ | @@ -17,11 +17,11 @@ | ||
17 | %table.watchers | 17 | %table.watchers |
18 | %thead | 18 | %thead |
19 | %tr | 19 | %tr |
20 | - %th Email | 20 | + %th User or Email |
21 | %tbody | 21 | %tbody |
22 | - @app.watchers.each do |watcher| | 22 | - @app.watchers.each do |watcher| |
23 | %tr | 23 | %tr |
24 | - %td= watcher.email | 24 | + %td= watcher.label |
25 | - if @app.watchers.none? | 25 | - if @app.watchers.none? |
26 | %tr | 26 | %tr |
27 | %td | 27 | %td |
public/stylesheets/application.css
@@ -257,6 +257,23 @@ form > div > span { | @@ -257,6 +257,23 @@ form > div > span { | ||
257 | font-size: 0.85em; | 257 | font-size: 0.85em; |
258 | color: #787878; | 258 | color: #787878; |
259 | } | 259 | } |
260 | +form strong.option { | ||
261 | + display: block; | ||
262 | + margin: 0.7em 0; | ||
263 | + color: #999; | ||
264 | +} | ||
265 | + | ||
266 | +form .nested { | ||
267 | + border-top: 1px dotted #BBB; | ||
268 | + margin-top: 1.5em; | ||
269 | + padding-top: 1.5em; | ||
270 | +} | ||
271 | + | ||
272 | +form legend + .nested { | ||
273 | + border: none; | ||
274 | + margin-top: 0; | ||
275 | + padding-top: 0; | ||
276 | +} | ||
260 | 277 | ||
261 | /* Tables */ | 278 | /* Tables */ |
262 | table { | 279 | table { |