summaryrefslogtreecommitdiff
path: root/users/app/views/emails
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-12-18 13:41:41 +0100
committerAzul <azul@leap.se>2012-12-18 13:41:41 +0100
commit285b23f39765d8346a658a81eca8b70d70b3e9bf (patch)
treeddb8f4d433c6f0461f7832ad08475b9a5bae99b2 /users/app/views/emails
parent6e8a45145722c12dee4d15b33cc28d2b09881e1a (diff)
refactored email_alias creation and validation
using CouchRests user.email_aliases.build so the casted_by method is set in the alias Used this to move the validations into the alias itself. This is where they belong and allows us to render the errors inline along the email field they belong to.
Diffstat (limited to 'users/app/views/emails')
-rw-r--r--users/app/views/emails/_email.html.haml11
1 files changed, 6 insertions, 5 deletions
diff --git a/users/app/views/emails/_email.html.haml b/users/app/views/emails/_email.html.haml
index f5eb2d0..3feb6f0 100644
--- a/users/app/views/emails/_email.html.haml
+++ b/users/app/views/emails/_email.html.haml
@@ -1,5 +1,6 @@
-%li.pull-right
- %code= email
- = link_to(user_email_alias_path(@user, email), :method => :delete) do
- %i.icon-remove
-.clearfix
+- if email.valid?
+ %li.pull-right
+ %code= email
+ = link_to(user_email_alias_path(@user, email), :method => :delete) do
+ %i.icon-remove
+ .clearfix