diff options
author | Azul <azul@leap.se> | 2012-12-18 13:41:41 +0100 |
---|---|---|
committer | Azul <azul@leap.se> | 2012-12-18 13:41:41 +0100 |
commit | 285b23f39765d8346a658a81eca8b70d70b3e9bf (patch) | |
tree | ddb8f4d433c6f0461f7832ad08475b9a5bae99b2 /users/app/views | |
parent | 6e8a45145722c12dee4d15b33cc28d2b09881e1a (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')
-rw-r--r-- | users/app/views/emails/_email.html.haml | 11 | ||||
-rw-r--r-- | users/app/views/users/_email_aliases.html.haml | 2 |
2 files changed, 7 insertions, 6 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 diff --git a/users/app/views/users/_email_aliases.html.haml b/users/app/views/users/_email_aliases.html.haml index 646480e..121acc4 100644 --- a/users/app/views/users/_email_aliases.html.haml +++ b/users/app/views/users/_email_aliases.html.haml @@ -2,5 +2,5 @@ %ul.unstyled =render @user.email_aliases .clearfix -= f.simple_fields_for :email_aliases, Email.new do |e| += f.simple_fields_for :email_aliases, @email_alias do |e| = e.input :email, :placeholder => "alias@#{request.domain}" |