diff --git a/app/controllers/contacts_controller.rb b/app/controllers/contacts_controller.rb
index d5e7db4..7e530aa 100644
--- a/app/controllers/contacts_controller.rb
+++ b/app/controllers/contacts_controller.rb
@@ -249,7 +249,7 @@ class ContactsController < ApplicationController
contact_group.contacts.delete(contact)
end
}
- redirect_to(:action=>"list", :id=>group_id, :params=>{"mode"=>params["mode"]})
+ redirect_to(:action=>"index", :id=>group_id, :params=>{"mode"=>params["mode"]})
end
def edit
@@ -273,12 +273,11 @@ class ContactsController < ApplicationController
@groups[g.id] = 0 # unchecked
end
}
- render :action => "add"
+ render :action => "new"
end
# Insert or update
def create
- logger.info("BEGIN")
if params["contact"]["id"] == ""
# New contact
@contact = Contact.create(params["contact"])
@@ -311,10 +310,10 @@ class ContactsController < ApplicationController
end
}
if @contact.save
- if params["paction"] == _('Save')
- redirect_to :controller => "/contacts/contact", :action =>"list"
+ if params["paction"] == t(:save)
+ redirect_to :action =>:index
else
- redirect_to :controller => "/contacts/contact", :action =>"add"
+ redirect_to :action => :new
end
else
loadLists
@@ -326,13 +325,13 @@ class ContactsController < ApplicationController
@groups[g.id] = 0
end
}
- redirect_to contacts_path
+ render :action => :new
end
end
def delete
Contact.destroy(params['id'])
- redirect_to(:action=>'list')
+ redirect_to(:action=>'index')
end
protected
diff --git a/app/models/contact.rb b/app/models/contact.rb
index a181864..a039675 100644
--- a/app/models/contact.rb
+++ b/app/models/contact.rb
@@ -47,23 +47,23 @@ class Contact < ActiveRecord::Base
protected
def validate
- errors.add 'fname', _('Please enter your first name (2 to 20 characters).') unless self.fname =~ /^.{2,20}$/i
- errors.add 'lname', _('Please enter your surname (2 to 20 characters).') unless self.lname =~ /^.{2,20}$/i
+ errors.add 'fname', I18n.t(:validate_fname_error) unless self.fname =~ /^.{2,20}$/i
+ errors.add 'lname', I18n.t(:validate_lname_error) unless self.lname =~ /^.{2,20}$/i
# Contact e-mail cannot be changed
unless self.new_record?
old_record = Contact.find(self.id)
- errors.add 'email', _('Contacts email cannot be changed.') unless old_record.email == self.email
+ errors.add 'email', I18n.t(:contacto_cannot_be_changed) unless old_record.email == self.email
end
end
def validate_on_create
# Contact e-mail cannot be changed, so we only need to validate it on create
- errors.add 'email', _('Please enter a valid email address.') unless valid_email?(self.email)
+ errors.add 'email', I18n.t(:validate_email_error) unless valid_email?(self.email)
# Already existing e-mail in contacts for this user is not allowed
if self.new_record?
if Contact.find :first, :conditions => {:email => email, :customer_id => customer_id}
- errors.add('email', _('An account for your email address already exists.'))
+ errors.add('email', I18n.t(:email_exists))
end
end
end
diff --git a/app/views/contacts/add_multiple.rhtml b/app/views/contacts/add_multiple.rhtml
index 4bfcf3c..8ab1494 100644
--- a/app/views/contacts/add_multiple.rhtml
+++ b/app/views/contacts/add_multiple.rhtml
@@ -1,26 +1,26 @@
-
<%=_('Add multiple contacts')%>
-<% if @flash["errors"] and not @flash["errors"].empty?%>
- <%= _('Errors')%>
+<%=t :add_multiple_contacts %>
+<% if flash["errors"] and not flash["errors"].empty?%>
+ <%= t(:errors)%>
- <% @flash["errors"].each do |message| %>
+ <% flash["errors"].each do |message| %>
- <%= message %>
<% end %>
<% end %>
\ No newline at end of file
+
diff --git a/app/views/contacts/import_preview.rhtml b/app/views/contacts/import_preview.rhtml
index 3077b94..b972081 100644
--- a/app/views/contacts/import_preview.rhtml
+++ b/app/views/contacts/import_preview.rhtml
@@ -1,9 +1,9 @@
<%= _('Contacts You Are About To Import')%>
-<% if @flash["errors"] and not @flash["errors"].empty?%>
+<% if flash["errors"] and not flash["errors"].empty?%>
<%= _('Errors')%>
- <% @flash["errors"].each do |message| %>
+ <% flash["errors"].each do |message| %>
- <%= message %>
<% end %>
diff --git a/app/views/contacts/index.html.erb b/app/views/contacts/index.html.erb
index ae1f735..342d52a 100644
--- a/app/views/contacts/index.html.erb
+++ b/app/views/contacts/index.html.erb
@@ -8,7 +8,7 @@
<%= t :contacts %>
- <%=link_contact_add_one%>
- - <%=link_contact_add_multiple%>
+ - <%=link_to t(:add_multiple), add_multiple_contacts_path %>
<% if ret = session["return_to"] %>
- <%=link_to(t(:back_to_message), ret) %>
<% end %>
@@ -100,9 +100,11 @@
<% for contact in @contacts %>
- <%= link_to(contact.full_name, :controller=>"/contacts/contact", :action => "edit", :id => contact.id ) %> |
- <%= link_to( contact.email, :controller => "/webmail", :action => "compose", :params => { "mail[to]" => contact.email } ) %> |
- <%= link_to(_('delete'), {:controller=>'/contacts/contact', :action=>'delete', :id=>contact.id}, {:confirm=>sprintf(_('DELETE CONTACT?\r\n\Name - %s\r\nE-mail - %s'), contact.show_name, contact.email)})%> |
+ <%= link_to(contact.full_name, :controller=>:contacts, :action => "edit", :id => contact.id ) %> |
+ <%= link_to( contact.email, :controller => :webmail, :action => "compose", :params => { "mail[to]" => contact.email } ) %> |
+ <%= link_to(t(:delete), {:controller=>:contacts, :action=>'delete', :id=>contact.id},
+ {:confirm=>t(:delete_contact_question, :name => contact.show_name, :email => contact.email)})%>
+ |
<% end %>
<% end %>
diff --git a/config/locales/es-ES.yml b/config/locales/es-ES.yml
index f0e54fe..f833fbf 100644
--- a/config/locales/es-ES.yml
+++ b/config/locales/es-ES.yml
@@ -60,9 +60,21 @@ es-ES:
cancel: Cancelar
add_one_contact: Agregar un contacto
add_multiple: Agregar multiples
+ add_multiple_contacts: Agregar multiples contactos
name: nombre
add_folder: Agregar carpeta
total_messages: Mensajes totales
unseen: No leidos
edit_create_contact: Editar o crear contacto
back_to_contacts: Volver a contactos
+ email_exists: Una cuenta con ese correo electrónico ya existe.
+ delete_contact_question: "Desea borrar este contacto? {{name}} - {{email}}"
+ validate_fname_error: Por favor, ingrese un nombre (2 a 20 caracteres)
+ validate_lname_error: Por favor, ingrese un apellido (2 a 20 caracteres)
+ validate_email_error: Por favor, ingrese una dirección email válida.
+ contact_cannot_be_changed: El email del contacto no puede ser cambiado
+ csv_file: Archivo separado por comas(CSV)
+ tab_file: Archivo separado por tabulaciones
+ select_file: Selecionar archivo
+ import: Importar
+ back_to_folders: Volver a carpetas
diff --git a/config/routes.rb b/config/routes.rb
index 3d511bb..36fed1f 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,6 +1,6 @@
ActionController::Routing::Routes.draw do |map|
map.resources :folders, :requirements => {:id => /[^\/]+/}
- map.resources :contacts, :member => {:add_from_mail => :get}
+ map.resources :contacts, :member => {:add_from_mail => :get}, :collection => {:add_multiple => :get}
map.resources :contact_groups
# Add your own custom routes here.