Fix id in forloop

This commit is contained in:
Chrisbr 2014-05-13 16:45:43 +02:00
parent 81a022776b
commit 12fd3b7d5a
3 changed files with 22 additions and 17 deletions

View file

@ -108,32 +108,33 @@
- if event.transition_possible? :accept
%li= link_to 'Accept event',
update_state_admin_conference_event_path(@conference.short_title, event, transition: :accept),
method: :patch, id: 'accept_event'
method: :patch, id: "accept_event_#{event.id}"
- if @conference.email_settings.send_on_accepted?
%li= link_to 'Accept event (without email)',
update_state_admin_conference_event_path(@conference.short_title, event, transition: :accept, send_mail: false),
method: :patch, hint: 'Accept this event without sending an automated email.', id: 'accept_event_without_mail'
method: :patch, hint: 'Accept this event without sending an automated email.',
id: "accept_event_without_mail_#{event.id}"
- if event.transition_possible? :reject
%li= link_to 'Reject event',
update_state_admin_conference_event_path(@conference.short_title, event, transition: :reject),
method: :patch, confirm: 'Are you sure?', id: 'reject_event'
method: :patch, confirm: 'Are you sure?', id: "reject_event_#{event.id}"
- if @conference.email_settings.send_on_rejected?
%li= link_to 'Reject event (without email)',
update_state_admin_conference_event_path(@conference.short_title, event, transition: :reject, send_mail: false),
method: :patch, confirm: 'Are you sure?', id: 'reject_event_without_mail'
method: :patch, confirm: 'Are you sure?', id: "reject_event_without_mail_#{event.id}"
- if event.transition_possible? :start_review
%li= link_to 'Start review',
update_state_admin_conference_event_path(@conference.short_title, event, transition: :start_review),
method: :patch, id: 'review_event'
method: :patch, id: "review_event_#{event.id}"
- if event.transition_possible? :confirm
%li= link_to 'Confirm event',
update_state_admin_conference_event_path(@conference.short_title, event, transition: :confirm),
method: :patch, id: 'confirm_event',
method: :patch, id: "confirm_event_#{event.id}",
hint: 'Confirm that the speaker(s) will be present and that the event will actually take place.'
- if event.transition_possible? :cancel
%li= link_to 'Cancel event',
update_state_admin_conference_event_path(@conference.short_title, event, :transition => :cancel),
method: :patch, id: 'cancel_event',
method: :patch, id: "cancel_event_#{event.id}",
hint: 'Mark this event as cancelled. Usually this means that the speakers had to cancel their appearance.'
:javascript

View file

@ -30,9 +30,9 @@
- if event.transition_possible? :confirm
= link_to 'Confirm',
conference_proposal_confirm_path(@conference.short_title, event, send_mail: false),
method: :patch, class: 'btn btn-mini btn-success', id: 'confirm_proposal'
method: :patch, class: 'btn btn-mini btn-success', id: "confirm_proposal_#{event.id}"
= link_to 'Edit', edit_conference_proposal_path(@conference.short_title, event.id),
class: 'btn btn-mini btn-primary', id: 'edit_proposal'
class: 'btn btn-mini btn-primary', id: "edit_proposal_#{event.id}"
= link_to 'Withdraw', conference_proposal_path(@conference.short_title, event.id), method: :delete,
confirm: 'Are you sure you want to withdraw this proposal?', class: 'btn btn-mini btn-danger',
id: 'delete_proposal'
id: "delete_proposal_#{event.id}"

View file

@ -7,7 +7,9 @@ feature Event do
let!(:admin_role) { create(:admin_role) }
shared_examples 'proposal workflow' do
scenario 'submitts a new proposal, accepts and confirms', feature: true, js: true do
scenario 'submitts a proposal, accepts and confirms',
feature: true, js: true do
admin = create(:admin, email: 'admin@example.com')
participant = create(:participant, email: 'participant@example.com')
@ -17,7 +19,7 @@ feature Event do
conference.email_settings = create(:email_settings)
conference.event_types = [create(:event_type)]
#Submit a new proposal as participant
# Submit a new proposal as participant
sign_in participant
visit conference_proposal_index_path(conference.short_title)
@ -51,31 +53,33 @@ feature Event do
expect(Event.count).to eq(expected_count)
event = Event.where(title: 'Example Proposal').first
visit conference_proposal_index_path(conference.short_title)
expect(page.has_content?('Example Proposal')).to be true
sign_out
#Accept proposal as admin
# Accept proposal as admin
sign_in admin
visit admin_conference_events_path(conference.short_title)
expect(page.has_content?('Example Proposal')).to be true
click_link 'New'
click_link 'accept_event'
click_link "accept_event_#{event.id}"
expect(page.has_content?('Unconfirmed')).to be true
sign_out
#Confirm proposal as participant
# Confirm proposal as participant
sign_in participant
visit conference_proposal_index_path(conference.short_title)
expect(page.has_content?('Example Proposal')).to be true
expect(page.has_content?('Accepted (confirmation pending)')).to be true
click_link 'confirm_proposal'
click_link "confirm_proposal_#{event.id}"
expect(page.find('#flash_notice').text).
to eq('Event was confirmed. Please register to attend the conference.')
to eq('Event was confirmed. Please register to attend the conference.')
find('#register').click