diff --git a/app/assets/stylesheets/pages.scss b/app/assets/stylesheets/pages.scss
index d3db7e9b2..efde88d07 100644
--- a/app/assets/stylesheets/pages.scss
+++ b/app/assets/stylesheets/pages.scss
@@ -10,14 +10,24 @@
// ----------------------
.jumbo {
+ background: $highlight;
margin-bottom: $line-height;
margin-top: rem-calc(-24);
padding-bottom: $line-height;
padding-top: $line-height;
+ @include breakpoint(medium) {
+ padding: rem-calc(24) 0;
+ }
+
&.light {
background: #ecf0f1;
}
+
+ h1,
+ p {
+ color: $text;
+ }
}
.lead {
diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss
index f0d194301..1cc6e87c9 100644
--- a/app/assets/stylesheets/participation.scss
+++ b/app/assets/stylesheets/participation.scss
@@ -685,7 +685,8 @@
}
.budget-investments-list .budget-investment,
-.proposals-list .proposal {
+.proposals-list .proposal,
+.legislation-proposals .proposal {
@include breakpoint(medium) {
diff --git a/app/controllers/legislation/proposals_controller.rb b/app/controllers/legislation/proposals_controller.rb
index 6b5e1c973..157c1f8a9 100644
--- a/app/controllers/legislation/proposals_controller.rb
+++ b/app/controllers/legislation/proposals_controller.rb
@@ -54,6 +54,7 @@ class Legislation::ProposalsController < Legislation::BaseController
params.require(:legislation_proposal).permit(:legislation_process_id, :title,
:question, :summary, :description, :video_url, :tag_list,
:terms_of_service, :geozone_id,
+ image_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy],
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id])
end
diff --git a/app/models/legislation/proposal.rb b/app/models/legislation/proposal.rb
index 3fe6a9d96..a345a5904 100644
--- a/app/models/legislation/proposal.rb
+++ b/app/models/legislation/proposal.rb
@@ -11,6 +11,7 @@ class Legislation::Proposal < ActiveRecord::Base
include Communitable
include Documentable
include Notifiable
+ include Imageable
documentable max_documents_allowed: 3,
max_file_size: 3.megabytes,
diff --git a/app/views/legislation/proposals/_form.html.erb b/app/views/legislation/proposals/_form.html.erb
index 23c61a671..48ddc04fe 100644
--- a/app/views/legislation/proposals/_form.html.erb
+++ b/app/views/legislation/proposals/_form.html.erb
@@ -31,6 +31,12 @@
aria: {describedby: "video-url-help-text"} %>
+ <% if feature?(:allow_images) %>
+
+ <%= render 'images/nested_image', imageable: @proposal, f: f %>
+
+ <% end %>
+
<%= render 'documents/nested_documents', documentable: @proposal, f: f %>
diff --git a/app/views/legislation/proposals/_proposal.html.erb b/app/views/legislation/proposals/_proposal.html.erb
index 0916f0de5..a09e0292b 100644
--- a/app/views/legislation/proposals/_proposal.html.erb
+++ b/app/views/legislation/proposals/_proposal.html.erb
@@ -1,11 +1,20 @@
Proposal.votes_needed_for_success) %>"
data-type="proposal">
-
+
-
-
+ <% if proposal.image.present? %>
+
+
+ <%= image_tag proposal.image_url(:thumb),
+ alt: proposal.image.title.unicode_normalize %>
+
+
+ <% else %>
+
+
+ <% end %>
<% cache [locale_and_user_status(proposal), 'index', proposal, proposal.author] do %>
<%= link_to proposal.title, legislation_process_proposal_path(proposal.legislation_process_id, proposal) %>
diff --git a/app/views/legislation/proposals/show.html.erb b/app/views/legislation/proposals/show.html.erb
index 3c88dc307..bd4f25980 100644
--- a/app/views/legislation/proposals/show.html.erb
+++ b/app/views/legislation/proposals/show.html.erb
@@ -39,6 +39,8 @@
+ <%= render_image(@proposal.image, :large, true) if @proposal.image.present? %>
+
<%= t("proposals.show.code") %>
@@ -113,9 +115,13 @@
<% end %>
-
-
- <%= render "legislation/proposals/filter_subnav" %>
+
+
+
+
+ <%= render "legislation/proposals/filter_subnav" %>
+
+
diff --git a/spec/features/legislation/proposals_spec.rb b/spec/features/legislation/proposals_spec.rb
index 8d42f2e14..2c47bd54b 100644
--- a/spec/features/legislation/proposals_spec.rb
+++ b/spec/features/legislation/proposals_spec.rb
@@ -2,6 +2,8 @@ require 'rails_helper'
feature 'Legislation Proposals' do
+ let(:user) { create(:user) }
+ let(:process) { create(:legislation_process) }
let(:proposal) { create(:legislation_proposal) }
context "Concerns" do
@@ -16,4 +18,21 @@ feature 'Legislation Proposals' do
end
end
+ scenario "Create a legislation proposal with an image", :js do
+ create(:legislation_proposal, process: process)
+
+ login_as user
+
+ visit new_legislation_process_proposal_path(process)
+
+ fill_in 'Proposal title', with: 'Legislation proposal with image'
+ fill_in 'Proposal summary', with: 'Including an image on a legislation proposal'
+ imageable_attach_new_file(create(:image), Rails.root.join('spec/fixtures/files/clippy.jpg'))
+ check 'legislation_proposal_terms_of_service'
+ click_button 'Create proposal'
+
+ expect(page).to have_content 'Legislation proposal with image'
+ expect(page).to have_content 'Including an image on a legislation proposal'
+ expect(page).to have_css("img[alt='#{Legislation::Proposal.last.image.title}']")
+ end
end