summaryrefslogtreecommitdiff
path: root/users/app
diff options
context:
space:
mode:
Diffstat (limited to 'users/app')
-rw-r--r--users/app/models/email.rb (renamed from users/app/models/email_alias.rb)7
-rw-r--r--users/app/models/user.rb4
-rw-r--r--users/app/views/emails/_email.html.haml4
-rw-r--r--users/app/views/users/_email_aliases.html.haml8
4 files changed, 13 insertions, 10 deletions
diff --git a/users/app/models/email_alias.rb b/users/app/models/email.rb
index 25e4b27..0988d9f 100644
--- a/users/app/models/email_alias.rb
+++ b/users/app/models/email.rb
@@ -1,6 +1,9 @@
-class EmailAlias
+class Email
include CouchRest::Model::Embeddable
property :email, String
- timestamps!
+
+ def to_s
+ email
+ end
end
diff --git a/users/app/models/user.rb b/users/app/models/user.rb
index 3ad69c7..fcb211e 100644
--- a/users/app/models/user.rb
+++ b/users/app/models/user.rb
@@ -6,7 +6,7 @@ class User < CouchRest::Model::Base
property :email, String, :accessible => true
property :email_forward, String, :accessible => true
- property :email_aliases, [EmailAlias]
+ property :email_aliases, [Email]
validates :login, :password_salt, :password_verifier,
:presence => true
@@ -77,7 +77,7 @@ class User < CouchRest::Model::Base
def email_aliases_attributes=(attrs)
if attrs
- email_alias = EmailAlias.new(attrs.values.first)
+ email_alias = Email.new(attrs.values.first)
email_aliases << email_alias
end
end
diff --git a/users/app/views/emails/_email.html.haml b/users/app/views/emails/_email.html.haml
new file mode 100644
index 0000000..f182ed9
--- /dev/null
+++ b/users/app/views/emails/_email.html.haml
@@ -0,0 +1,4 @@
+%li.pull-right
+ %code= email
+ %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 41d4f9e..646480e 100644
--- a/users/app/views/users/_email_aliases.html.haml
+++ b/users/app/views/users/_email_aliases.html.haml
@@ -1,10 +1,6 @@
.span6
%ul.unstyled
- - @user.email_aliases.each do |email_alias|
- %li.pull-right
- %code= email_alias.email
- %i.icon-remove
- .clearfix
+ =render @user.email_aliases
.clearfix
-= f.simple_fields_for :email_aliases, EmailAlias.new do |e|
+= f.simple_fields_for :email_aliases, Email.new do |e|
= e.input :email, :placeholder => "alias@#{request.domain}"