Merge pull request #2922 from consul/legislation-proposals-imageable
Legislation proposals imageable
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -685,7 +685,8 @@
|
||||
}
|
||||
|
||||
.budget-investments-list .budget-investment,
|
||||
.proposals-list .proposal {
|
||||
.proposals-list .proposal,
|
||||
.legislation-proposals .proposal {
|
||||
|
||||
@include breakpoint(medium) {
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -31,6 +31,12 @@
|
||||
aria: {describedby: "video-url-help-text"} %>
|
||||
</div>
|
||||
|
||||
<% if feature?(:allow_images) %>
|
||||
<div class="images small-12 column">
|
||||
<%= render 'images/nested_image', imageable: @proposal, f: f %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="documents small-12 column" data-max-documents="<%= Legislation::Proposal.max_documents_allowed %>">
|
||||
<%= render 'documents/nested_documents', documentable: @proposal, f: f %>
|
||||
</div>
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
<div id="<%= dom_id(proposal) %>"
|
||||
class="proposal clear <%= ("successful" if proposal.total_votes > Proposal.votes_needed_for_success) %>"
|
||||
data-type="proposal">
|
||||
<div class="panel">
|
||||
<div class="panel <%= ('with-image' if proposal.image.present?) %>">
|
||||
<div class="icon-successful"></div>
|
||||
<div class="row">
|
||||
|
||||
<div class="small-12 medium-9 column">
|
||||
<% if proposal.image.present? %>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-3 large-2 column text-center">
|
||||
<%= image_tag proposal.image_url(:thumb),
|
||||
alt: proposal.image.title.unicode_normalize %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 large-7 column margin-top">
|
||||
<% else %>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-9 column">
|
||||
<% end %>
|
||||
<div class="proposal-content">
|
||||
<% cache [locale_and_user_status(proposal), 'index', proposal, proposal.author] do %>
|
||||
<h3><%= link_to proposal.title, legislation_process_proposal_path(proposal.legislation_process_id, proposal) %></h3>
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
|
||||
</div>
|
||||
|
||||
<%= render_image(@proposal.image, :large, true) if @proposal.image.present? %>
|
||||
|
||||
<br>
|
||||
<p>
|
||||
<%= t("proposals.show.code") %>
|
||||
@@ -113,9 +115,13 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<%= render "legislation/proposals/filter_subnav" %>
|
||||
<div class="additional-content">
|
||||
<div class="filter-subnav">
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<%= render "legislation/proposals/filter_subnav" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user