Commit 757778888939d5af7d2a4a2cd8678e9af047e731
Committed by
Antonio Terceiro
1 parent
6bcb3863
Exists in
master
and in
23 other branches
ActionItem1175: cannot edit name/email on contact
Showing
3 changed files
with
5 additions
and
16 deletions
Show diff stats
app/controllers/public/contact_controller.rb
| @@ -20,11 +20,7 @@ class ContactController < PublicController | @@ -20,11 +20,7 @@ class ContactController < PublicController | ||
| 20 | flash[:notice] = _('Contact not sent') | 20 | flash[:notice] = _('Contact not sent') |
| 21 | end | 21 | end |
| 22 | else | 22 | else |
| 23 | - if logged_in? | ||
| 24 | - @contact = Contact.new(:name => user.name, :email => user.email) | ||
| 25 | - else | ||
| 26 | - @contact = Contact.new | ||
| 27 | - end | 23 | + @contact = Contact.new(:name => user.name, :email => user.email) |
| 28 | end | 24 | end |
| 29 | end | 25 | end |
| 30 | 26 |
app/views/contact/new.rhtml
| @@ -8,8 +8,6 @@ | @@ -8,8 +8,6 @@ | ||
| 8 | 8 | ||
| 9 | <%= required_fields_message %> | 9 | <%= required_fields_message %> |
| 10 | 10 | ||
| 11 | - <%= required f.text_field(:name) %> | ||
| 12 | - <%= required f.text_field(:email) %> | ||
| 13 | <% unless environment.enabled?('disable_select_city_for_contact') %> | 11 | <% unless environment.enabled?('disable_select_city_for_contact') %> |
| 14 | <%= labelled_form_field _('City and state'), select_city(true) %> | 12 | <%= labelled_form_field _('City and state'), select_city(true) %> |
| 15 | <% end %> | 13 | <% end %> |
test/functional/contact_controller_test.rb
| @@ -35,11 +35,6 @@ class ContactControllerTest < Test::Unit::TestCase | @@ -35,11 +35,6 @@ class ContactControllerTest < Test::Unit::TestCase | ||
| 35 | assert_tag :tag => 'form', :attributes => { :action => "/contact/#{enterprise.identifier}/new", :method => 'post' } | 35 | assert_tag :tag => 'form', :attributes => { :action => "/contact/#{enterprise.identifier}/new", :method => 'post' } |
| 36 | end | 36 | end |
| 37 | 37 | ||
| 38 | - should 'display input for destinatary email' do | ||
| 39 | - get :new, :profile => enterprise.identifier | ||
| 40 | - assert_tag :tag => 'input', :attributes => { :name => 'contact[email]', :type => 'text' } | ||
| 41 | - end | ||
| 42 | - | ||
| 43 | should 'display input for message' do | 38 | should 'display input for message' do |
| 44 | get :new, :profile => enterprise.identifier | 39 | get :new, :profile => enterprise.identifier |
| 45 | assert_tag :tag => 'textarea', :attributes => { :name => 'contact[message]' } | 40 | assert_tag :tag => 'textarea', :attributes => { :name => 'contact[message]' } |
| @@ -51,14 +46,14 @@ class ContactControllerTest < Test::Unit::TestCase | @@ -51,14 +46,14 @@ class ContactControllerTest < Test::Unit::TestCase | ||
| 51 | assert_redirected_to :action => 'new' | 46 | assert_redirected_to :action => 'new' |
| 52 | end | 47 | end |
| 53 | 48 | ||
| 54 | - should 'fill email if user logged in' do | 49 | + should 'have logged user email' do |
| 55 | get :new, :profile => enterprise.identifier | 50 | get :new, :profile => enterprise.identifier |
| 56 | - assert_tag :tag => 'input', :attributes => {:name => 'contact[email]', :value => profile.email} | 51 | + assert_equal profile.email, assigns(:contact).email |
| 57 | end | 52 | end |
| 58 | 53 | ||
| 59 | - should 'fill name if user logged in' do | 54 | + should 'have logged user name' do |
| 60 | get :new, :profile => enterprise.identifier | 55 | get :new, :profile => enterprise.identifier |
| 61 | - assert_tag :tag => 'input', :attributes => {:name => 'contact[name]', :value => profile.name} | 56 | + assert_equal profile.name, assigns(:contact).name |
| 62 | end | 57 | end |
| 63 | 58 | ||
| 64 | should 'define city and state' do | 59 | should 'define city and state' do |