diff --git a/app/views/images/_admin_image.html.erb b/app/views/images/_admin_image.html.erb index a782b743b..12874137f 100644 --- a/app/views/images/_admin_image.html.erb +++ b/app/views/images/_admin_image.html.erb @@ -2,7 +2,6 @@
<%= f.label :image, t("images.form.admin_title") %> - <%= link_to_add_association t('images.form.add_new_image'), f, :image, force_non_association_create: true, partial: "images/image_fields", @@ -15,6 +14,8 @@ association_insertion_node: "#nested-image", association_insertion_method: "append" } %> + + <%= render_image(f.object.image, :thumb, false) if f.object.image %>
<%= f.fields_for :image do |image_builder| %> @@ -26,17 +27,11 @@ <%= image_builder.text_field :title, placeholder: t("images.form.title_placeholder"), label: "#{t("images.form.admin_alt_text")}" %> -
<%= render_image_attachment(image_builder, imageable, image_builder.object) %>
- -
-
-
-
<% end %> diff --git a/spec/features/admin/poll/polls_spec.rb b/spec/features/admin/poll/polls_spec.rb index be987df2d..d69e7ad75 100644 --- a/spec/features/admin/poll/polls_spec.rb +++ b/spec/features/admin/poll/polls_spec.rb @@ -70,14 +70,18 @@ feature 'Admin polls' do scenario "Edit" do poll = create(:poll) + create(:image, imageable: poll) visit admin_poll_path(poll) click_link "Edit" end_date = 1.year.from_now + expect(page).to have_css("img[alt='#{poll.image.title}']") + fill_in "poll_name", with: "Next Poll" fill_in 'poll_ends_at', with: end_date.strftime("%d/%m/%Y") + click_button "Update poll" expect(page).to have_content "Poll updated successfully" diff --git a/spec/features/polls/polls_spec.rb b/spec/features/polls/polls_spec.rb index 683c0402a..22b90740a 100644 --- a/spec/features/polls/polls_spec.rb +++ b/spec/features/polls/polls_spec.rb @@ -6,11 +6,15 @@ feature 'Polls' do scenario 'Polls can be listed' do polls = create_list(:poll, 3) + create(:image, imageable: polls[0]) + create(:image, imageable: polls[1]) + create(:image, imageable: polls[2]) visit polls_path polls.each do |poll| expect(page).to have_content(poll.name) + expect(page).to have_css("img[alt='#{poll.image.title}']") expect(page).to have_link("Participate in this poll") end end @@ -59,7 +63,7 @@ feature 'Polls' do context 'Show' do let(:geozone) { create(:geozone) } - let(:poll) { create(:poll) } + let(:poll) { create(:poll, summary: "Summary", description: "Description") } scenario 'Lists questions from proposals as well as regular ones' do normal_question = create(:poll_question, poll: poll) @@ -67,6 +71,8 @@ feature 'Polls' do visit poll_path(poll) expect(page).to have_content(poll.name) + expect(page).to have_content(poll.summary) + expect(page).to have_content(poll.description) expect(page).to have_content(normal_question.title) expect(page).to have_content(proposal_question.title)