Merge branch 'master' into poll-shifts

This commit is contained in:
Raimond Garcia
2017-09-05 14:45:31 +02:00
committed by GitHub
127 changed files with 2421 additions and 293 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -14,6 +14,7 @@
//= require jquery_ujs
//= require jquery-ui/widgets/datepicker
//= require jquery-ui/i18n/datepicker-es
//= require jquery-fileupload/basic
//= require foundation
//= require turbolinks
//= require ckeditor/loader
@@ -59,6 +60,7 @@
//= require legislation_annotatable
//= require watch_form_changes
//= require followable
//= require documentable
//= require tree_navigator
//= require custom
@@ -94,6 +96,7 @@ var initialize_modules = function() {
App.LegislationAnnotatable.initialize();
App.WatchFormChanges.initialize();
App.TreeNavigator.initialize();
App.Documentable.initialize();
};
$(function(){

View File

@@ -0,0 +1,101 @@
App.Documentable =
initialize: ->
@initializeDirectUploads()
@initializeInterface()
initializeDirectUploads: ->
$('input.document_ajax_attachment[type=file]').fileupload
paramName: "document[attachment]"
formData: null
add: (e, data) ->
wrapper = $(e.target).closest('.document')
index = $(e.target).data('index')
is_nested_document = $(e.target).data('nested-document')
$(wrapper).find('.progress-bar-placeholder').empty()
data.progressBar = $(wrapper).find('.progress-bar-placeholder').html('<div class="progress-bar"><div class="loading-bar uploading"></div></div>')
$(wrapper).find('.progress-bar-placeholder').css('display','block')
data.formData = {
"document[title]": $(wrapper).find('input.document-title').val() || data.files[0].name
"index": index,
"nested_document": is_nested_document
}
data.submit()
change: (e, data) ->
wrapper = $(e.target).parent()
$.each(data.files, (index, file)->
$(wrapper).find('.file-name').text(file.name)
)
progress: (e, data) ->
progress = parseInt(data.loaded / data.total * 100, 10)
$(data.progressBar).find('.loading-bar').css 'width', progress + '%'
return
initializeInterface: ->
input_files = $('input.document_ajax_attachment[type=file]')
$.each input_files, (index, file) ->
wrapper = $(file).parent()
App.Documentable.watchRemoveDocumentbutton(wrapper)
watchRemoveDocumentbutton: (wrapper) ->
remove_document_button = $(wrapper).find('.remove-document')
$(remove_document_button).on 'click', (e) ->
e.preventDefault()
$(wrapper).remove()
$('#new_document_link').show()
$('.max-documents-notice').hide()
uploadNestedDocument: (id, nested_document, result) ->
$('#' + id).replaceWith(nested_document)
@updateLoadingBar(id, result)
@initialize()
uploadPlainDocument: (id, nested_document, result) ->
$('#' + id).replaceWith(nested_document)
@updateLoadingBar(id, result)
@initialize()
updateLoadingBar: (id, result) ->
if result
$('#' + id).find('.loading-bar').addClass 'complete'
else
$('#' + id).find('.loading-bar').addClass 'errors'
$('#' + id).find('.progress-bar-placeholder').css('display','block')
new: (nested_fields) ->
$(".documents-list").append(nested_fields)
@initialize()
destroyNestedDocument: (id, notice) ->
$('#' + id).remove()
@updateNotice(notice)
replacePlainDocument: (id, notice, plain_document) ->
$('#' + id).replaceWith(plain_document)
@updateNotice(notice)
@initialize()
updateNotice: (notice) ->
if $('[data-alert]').length > 0
$('[data-alert]').replaceWith(notice)
else
$("body").append(notice)
updateNewDocumentButton: (link) ->
if $('.document').length >= $('.documents').data('max-documents')
$('#new_document_link').hide()
$('.max-documents-notice').removeClass('hide')
$('.max-documents-notice').show()
else if $('#new_document_link').length > 0
$('#new_document_link').replaceWith(link)
$('.max-documents-notice').hide()
else
$('.max-documents-notice').hide()
$(link).insertBefore('.documents hr:last')

View File

@@ -43,6 +43,7 @@ $budget: #7e328a;
$budget-hover: #7571bf;
$highlight: #e7f2fc;
$highlight-soft: #f3f8fd;
$light: #f5f7fa;
$featured: #ffdc5c;

View File

@@ -15,3 +15,4 @@
@import 'annotator_overrides';
@import 'jquery-ui/datepicker';
@import 'datepicker_overrides';
@import 'documentable';

View File

@@ -0,0 +1,59 @@
.progress-bar-placeholder {
display: none;
}
.document-form {
.document .file-name {
margin-top: 0;
}
.progress-bar-placeholder {
margin-bottom: 15px;
}
.document .loading-bar.errors {
margin-top: $line-height * 2;
}
}
.document {
.button {
font-weight: normal;
}
.progress-bar {
width: 100%;
background-color: $light-gray;
}
input.document_ajax_attachment[type=file]{
display: none;
}
.file-name {
margin-top: $line-height / 2;
}
.loading-bar {
height: 5px;
width: 0;
transition: width 500ms ease-out;
&.uploading {
background-color: $dark-gray;
}
&.complete {
background-color: $success-color;
width: 100%;
}
&.errors {
background-color: $alert-color;
width: 100%;
margin-top: $line-height / 2;
}
}
.loading-bar.no-transition {
transition: none;
}
}

View File

@@ -97,6 +97,10 @@
content: '\72';
}
.icon-documents::before {
content: '\68';
}
.icon-proposals::before {
content: '\68';
}

View File

@@ -18,6 +18,7 @@
// 16. Flags
// 17. Activity
// 18. Banners
// 19. Documents
//
// 01. Global styles
@@ -91,6 +92,11 @@ a {
color: $link;
}
.button.hollow.error {
border-color: $alert-border;
color: $color-alert;
}
.postfix.button {
padding: 0;
}
@@ -216,9 +222,8 @@ a {
}
.menu.vertical {
background: #fff;
margin: $line-height 0;
padding: $line-height;
padding: $line-height 0;
li {
margin-bottom: $line-height;
@@ -319,6 +324,10 @@ a {
background: $brand;
}
.align-top {
vertical-align: top;
}
// 02. Header
// ----------
@@ -416,6 +425,7 @@ header {
.menu {
&.is-dropdown-submenu {
background: #fff;
margin: 0;
margin-top: rem-calc(-24);
padding: 0;
@@ -1821,6 +1831,7 @@ table {
.divider {
color: $text-light;
display: inline-block;
}
form {
@@ -2128,3 +2139,125 @@ table {
text-decoration: none;
}
}
// 19. Documents
.document-form form {
.radio-buttons {
label {
margin-right: $line-height;
}
}
.source-option-link {
input {
padding-bottom: 0;
}
.error {
margin-bottom: $line-height;
}
label {
&.error {
margin-bottom: 0;
}
}
}
.source-option-file {
.file-name {
label {
@include breakpoint(small medium) {
float: none;
}
@include breakpoint(large) {
float: left;
}
}
p {
@include breakpoint(small medium) {
float: none;
margin-top: 0;
margin-left: 0;
margin-bottom: 0;
}
@include breakpoint(large) {
float: left;
margin-bottom: 0;
margin-top: $line-height / 2;
margin-left: $line-height;
}
}
}
}
.attachment-errors {
margin-bottom: $line-height;
}
}
.documents-list {
table {
border: 0;
}
td {
position: relative;
@include breakpoint(small) {
float: left;
width: 100%;
}
@include breakpoint(medium) {
float: none;
}
a {
width: 100%;
}
&:first-child {
padding-left: $line-height * 1.5;
@include breakpoint(small) {
width: 100%;
}
@include breakpoint(medium) {
width: 70%;
}
@include breakpoint(large) {
width: 80%;
}
}
&:first-child::before {
color: #007bb7;
content: 'G';
font-family: "icons" !important;
font-size: rem-calc(24);
left: rem-calc(6);
position: absolute;
top: 0;
@include breakpoint(small) {
padding-top: rem-calc(12);
}
@include breakpoint(medium) {
padding-top: rem-calc(22);
}
}
}
}

View File

@@ -248,11 +248,13 @@
.debate-form,
.proposal-form,
.budget-investment-form,
.spending-proposal-form {
.spending-proposal-form,
.document-form {
.icon-debates,
.icon-proposals,
.icon-budget {
.icon-budget,
.icon-documents {
font-size: rem-calc(50);
line-height: $line-height;
opacity: 0.5;
@@ -262,7 +264,8 @@
color: $debates;
}
.icon-proposals {
.icon-proposals,
.icon-documents {
color: $proposals;
}
@@ -294,7 +297,8 @@
}
}
.proposal-form {
.proposal-form,
.document-form {
.recommendations li::before {
color: $proposals;
@@ -311,7 +315,8 @@
.polls-show,
.debate-quiz,
.budget-investment-show,
.draft-panels {
.draft-panels,
.debate-questions {
p {
word-wrap: break-word;
@@ -328,10 +333,13 @@
.whatsapp::before {
background-color: #43d854;
color: #fff;
font-size: 1.7em;
margin-left: rem-calc(0.5);
padding: rem-calc(9.5) rem-calc(9.8);
vertical-align: rem-calc(10);
display: inline-block;
font-size: rem-calc(30);
height: rem-calc(48);
padding-top: rem-calc(9);
text-align: center;
vertical-align: top;
width: rem-calc(48);
}
.edit-debate,
@@ -424,33 +432,30 @@
.document-link,
.video-link {
border: 1px solid $border;
background: $highlight-soft;
border: 1px solid $highlight;
display: block;
margin: $line-height / 2 0;
padding: $line-height / 2;
position: relative;
a {
padding-left: rem-calc(24);
word-wrap: break-word;
}
::before {
color: #007bb7;
content: 'G';
font-family: "icons" !important;
[class^="icon-"] {
display: inline-block;
font-size: rem-calc(24);
left: rem-calc(6);
padding-top: rem-calc(3);
position: absolute;
top: 0;
line-height: $line-height;
vertical-align: middle;
}
}
.video-link {
.icon-document {
color: #007bb7;
}
::before {
.icon-video {
color: #cc181e;
content: 'D';
}
}
@@ -745,6 +750,12 @@
display: none;
}
.document-form{
max-width: 75rem;
margin-left: auto;
margin-right: auto;
}
.more-info {
clear: both;
color: $text-medium;
@@ -874,6 +885,20 @@
}
}
.help-link {
margin-left: $line-height;
position: relative;
&::before {
color: $link;
content: '\4e';
font-family: 'icons';
position: absolute;
left: -24px;
top: -2px;
}
}
// 05. Featured
// ------------
@@ -1480,13 +1505,9 @@
.poll,
.poll-question {
background: #fff;
border-radius: rem-calc(6);
border: 1px solid $border;
margin-bottom: $line-height / 2;
}
.poll {
padding: $line-height;
padding: $line-height / 2;
position: relative;
.icon-poll-answer {

View File

@@ -44,10 +44,12 @@ module Budgets
set_comment_flags(@comment_tree.comments)
load_investment_votes(@investment)
@investment_ids = [@investment.id]
@document = Document.new(documentable: @investment)
end
def create
@investment.author = current_user
recover_documents_from_cache(@investment)
if @investment.save
Mailer.budget_investment_created(@investment).deliver_later
@@ -104,7 +106,8 @@ module Budgets
def investment_params
params.require(:budget_investment).permit(:title, :description, :external_url, :heading_id, :tag_list,
:organization_name, :location, :terms_of_service)
:organization_name, :location, :terms_of_service,
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id])
end
def load_ballot

View File

@@ -58,6 +58,8 @@ module CommentableActions
def update
resource.assign_attributes(strong_params)
recover_documents_from_cache(resource)
if resource.save
redirect_to resource, notice: t("flash.actions.update.#{resource_name.underscore}")
else
@@ -110,4 +112,11 @@ module CommentableActions
nil
end
def recover_documents_from_cache(resource)
return false unless resource.try(:documents)
resource.documents = resource.documents.each do |document|
document.set_attachment_from_cached_attachment if document.cached_attachment.present?
end
end
end

View File

@@ -0,0 +1,100 @@
class DocumentsController < ApplicationController
before_action :authenticate_user!
before_filter :find_documentable, except: :destroy
before_filter :prepare_new_document, only: [:new, :new_nested]
before_filter :prepare_document_for_creation, only: :create
load_and_authorize_resource except: :upload
skip_authorization_check only: :upload
def new
end
def new_nested
end
def create
recover_attachments_from_cache
if @document.save
flash[:notice] = t "documents.actions.create.notice"
redirect_to params[:from]
else
flash[:alert] = t "documents.actions.create.alert"
render :new
end
end
def destroy
respond_to do |format|
format.html do
if @document.destroy
flash[:notice] = t "documents.actions.destroy.notice"
else
flash[:alert] = t "documents.actions.destroy.alert"
end
redirect_to params[:from]
end
format.js do
if @document.destroy
flash.now[:notice] = t "documents.actions.destroy.notice"
else
flash.now[:alert] = t "documents.actions.destroy.alert"
end
end
end
end
def destroy_upload
@document = Document.new(cached_attachment: params[:path])
@document.set_attachment_from_cached_attachment
@document.documentable = @documentable
if @document.attachment.destroy
flash.now[:notice] = t "documents.actions.destroy.notice"
else
flash.now[:alert] = t "documents.actions.destroy.alert"
end
render :destroy
end
def upload
@document = Document.new(document_params.merge(user: current_user))
@document.documentable = @documentable
if @document.valid?
@document.attachment.save
@document.set_cached_attachment_from_attachment(URI(request.url))
else
@document.attachment.destroy
end
end
private
def document_params
params.require(:document).permit(:title, :documentable_type, :documentable_id,
:attachment, :cached_attachment, :user_id)
end
def find_documentable
@documentable = params[:documentable_type].constantize.find_or_initialize_by(id: params[:documentable_id])
end
def prepare_new_document
@document = Document.new(documentable: @documentable, user_id: current_user.id)
end
def prepare_document_for_creation
@document = Document.new(document_params)
@document.documentable = @documentable
@document.user = current_user
end
def recover_attachments_from_cache
if @document.attachment.blank? && @document.cached_attachment.present?
@document.set_attachment_from_cached_attachment
end
end
end

View File

@@ -19,11 +19,13 @@ class ProposalsController < ApplicationController
def show
super
@notifications = @proposal.notifications
@document = Document.new(documentable: @proposal)
redirect_to proposal_path(@proposal), status: :moved_permanently if request.path != proposal_path(@proposal)
end
def create
@proposal = Proposal.new(proposal_params.merge(author: current_user))
recover_documents_from_cache(@proposal)
if @proposal.save
redirect_to share_proposal_path(@proposal), notice: I18n.t('flash.actions.create.proposal')
@@ -75,7 +77,8 @@ class ProposalsController < ApplicationController
def proposal_params
params.require(:proposal).permit(:title, :question, :summary, :description, :external_url, :video_url,
:responsible_name, :tag_list, :terms_of_service, :geozone_id)
:responsible_name, :tag_list, :terms_of_service, :geozone_id,
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id] )
end
def retired_params
@@ -121,4 +124,5 @@ class ProposalsController < ApplicationController
def load_successful_proposals
@proposal_successful_exists = Proposal.successful.exists?
end
end

View File

@@ -0,0 +1,41 @@
module DocumentablesHelper
def documentable_class(documentable)
documentable.class.name.parameterize('_')
end
def max_documents_allowed(documentable)
documentable.class.max_documents_allowed
end
def max_file_size(documentable)
bytesToMeg(documentable.class.max_file_size)
end
def accepted_content_types(documentable)
documentable.class.accepted_content_types
end
def accepted_content_types_extensions(documentable_class)
documentable_class.accepted_content_types
.collect{ |content_type| ".#{content_type.split("/").last}" }
.join(",")
end
def humanized_accepted_content_types(documentable)
documentable.class.accepted_content_types
.collect{ |content_type| content_type.split("/").last }
.join(", ")
end
def documentables_note(documentable)
t "documents.form.note", max_documents_allowed: max_documents_allowed(documentable),
accepted_content_types: humanized_accepted_content_types(documentable),
max_file_size: max_file_size(documentable)
end
def max_documents_allowed?(documentable)
documentable.documents.count >= documentable.class.max_documents_allowed
end
end

View File

@@ -0,0 +1,89 @@
module DocumentsHelper
def document_attachment_file_name(document)
document.attachment_file_name
end
def errors_on_attachment(document)
document.errors[:attachment].join(', ') if document.errors.key?(:attachment)
end
def bytesToMeg(bytes)
bytes / Numeric::MEGABYTE
end
def document_nested_field_name(document, index, field)
parent = document.documentable_type.parameterize.underscore
"#{parent.parameterize}[documents_attributes][#{index}][#{field}]"
end
def document_nested_field_id(document, index, field)
parent = document.documentable_type.parameterize.underscore
"#{parent.parameterize}_documents_attributes_#{index}_#{field}"
end
def document_nested_field_wrapper_id(index)
"document_#{index}"
end
def render_destroy_document_link(document, index)
if document.persisted?
link_to t('documents.form.delete_button'),
document_path(document, index: index, nested_document: true),
method: :delete,
remote: true,
data: { confirm: t('documents.actions.destroy.confirm') },
class: "delete float-right"
elsif !document.persisted? && document.cached_attachment.present?
link_to t('documents.form.delete_button'),
destroy_upload_documents_path(path: document.cached_attachment,
nested_document: true,
index: index,
documentable_type: document.documentable_type,
documentable_id: document.documentable_id),
method: :delete,
remote: true,
class: "delete float-right"
else
link_to t('documents.form.delete_button'),
"#",
class: "delete float-right remove-document"
end
end
def render_attachment(document, index)
html = file_field_tag :attachment,
accept: accepted_content_types_extensions(document.documentable_type.constantize),
class: 'document_ajax_attachment',
data: {
url: document_direct_upload_url(document),
cached_attachment_input_field: document_nested_field_id(document, index, :cached_attachment),
multiple: false,
index: index,
nested_document: true
},
name: document_nested_field_name(document, index, :attachment),
id: document_nested_field_id(document, index, :attachment)
if document.attachment.blank? && document.cached_attachment.blank?
klass = document.errors[:attachment].any? ? "error" : ""
html += label_tag document_nested_field_id(document, index, :attachment),
t("documents.form.attachment_label"),
class: "button hollow #{klass}"
if document.errors[:attachment].any?
html += content_tag :small, class: "error" do
errors_on_attachment(document)
end
end
end
html
end
def document_direct_upload_url(document)
upload_documents_url(
documentable_type: document.documentable_type,
documentable_id: document.documentable_id,
format: :js
)
end
end

View File

@@ -40,6 +40,26 @@ module UsersHelper
current_user && current_user.administrator?
end
def current_moderator?
current_user && current_user.moderator?
end
def current_valuator?
current_user && current_user.valuator?
end
def current_manager?
current_user && current_user.manager?
end
def current_poll_officer?
current_user && current_user.poll_officer?
end
def show_admin_menu?
current_administrator? || current_moderator? || current_valuator? || current_manager? || current_poll_officer?
end
def interests_title_text(user)
if current_user == user
t('account.show.public_interests_my_title_list')

View File

@@ -73,6 +73,7 @@ module Abilities
can [:manage], ::Legislation::Question
cannot :comment_as_moderator, [::Legislation::Question, Legislation::Annotation]
can [:create, :destroy], Document
end
end
end

View File

@@ -36,6 +36,9 @@ module Abilities
can [:create, :destroy], Follow
can [:create, :destroy, :new], Document, documentable: { author_id: user.id }
can [:new_nested, :upload, :destroy_upload], Document
unless user.organization?
can :vote, Debate
can :vote, Comment

View File

@@ -1,12 +1,16 @@
class Budget
class Investment < ActiveRecord::Base
include Measurable
include Sanitizable
include Taggable
include Searchable
include Reclassification
include Followable
include Documentable
documentable max_documents_allowed: 3,
max_file_size: 3.megabytes,
accepted_content_types: [ "application/pdf" ]
accepts_nested_attributes_for :documents, allow_destroy: true
acts_as_votable
acts_as_paranoid column: :hidden_at

View File

@@ -0,0 +1,20 @@
module Documentable
extend ActiveSupport::Concern
included do
has_many :documents, as: :documentable, dependent: :destroy
end
module ClassMethods
attr_reader :max_documents_allowed, :max_file_size, :accepted_content_types
private
def documentable(options= {})
@max_documents_allowed = options[:max_documents_allowed]
@max_file_size = options[:max_file_size]
@accepted_content_types = options[:accepted_content_types]
end
end
end

81
app/models/document.rb Normal file
View File

@@ -0,0 +1,81 @@
class Document < ActiveRecord::Base
include DocumentsHelper
include DocumentablesHelper
has_attached_file :attachment, path: ":rails_root/public/system/:class/:prefix/:style/:filename"
attr_accessor :cached_attachment
belongs_to :user
belongs_to :documentable, polymorphic: true
# Disable paperclip security validation due to polymorphic configuration
# Paperclip do not allow to user Procs on valiations definition
do_not_validate_attachment_file_type :attachment
validate :attachment_presence
validate :validate_attachment_content_type, if: -> { attachment.present? }
validate :validate_attachment_size, if: -> { attachment.present? }
validates :title, presence: true
validates :user_id, presence: true
validates :documentable_id, presence: true, if: -> { persisted? }
validates :documentable_type, presence: true, if: -> { persisted? }
after_save :remove_cached_document, if: -> { valid? && persisted? && cached_attachment.present? }
def set_cached_attachment_from_attachment(prefix)
self.cached_attachment = if Paperclip::Attachment.default_options[:storage] == :filesystem
attachment.path
else
prefix + attachment.url
end
end
def set_attachment_from_cached_attachment
self.attachment = if Paperclip::Attachment.default_options[:storage] == :filesystem
File.open(cached_attachment)
else
URI.parse(cached_attachment)
end
end
Paperclip.interpolates :prefix do |attachment, style|
attachment.instance.prefix(attachment, style)
end
def prefix(attachment, style)
if !attachment.instance.persisted?
"cached_attachments/user/#{attachment.instance.user_id}"
else
":attachment/:id_partition"
end
end
private
def validate_attachment_size
if documentable.present? &&
attachment_file_size > documentable.class.max_file_size
errors[:attachment] = I18n.t("documents.errors.messages.in_between",
min: "0 Bytes",
max: "#{max_file_size(documentable)} MB")
end
end
def validate_attachment_content_type
if documentable.present? &&
!accepted_content_types(documentable).include?(attachment_content_type)
errors[:attachment] = I18n.t("documents.errors.messages.wrong_content_type",
content_type: attachment_content_type,
accepted_content_types: humanized_accepted_content_types(documentable))
end
end
def attachment_presence
if attachment.blank? && cached_attachment.blank?
errors[:attachment] = I18n.t("errors.messages.blank")
end
end
def remove_cached_document
File.delete(cached_attachment) if File.exists?(cached_attachment)
end
end

View File

@@ -9,6 +9,11 @@ class Proposal < ActiveRecord::Base
include HasPublicAuthor
include Graphqlable
include Followable
include Documentable
documentable max_documents_allowed: 3,
max_file_size: 3.megabytes,
accepted_content_types: [ "application/pdf" ]
accepts_nested_attributes_for :documents, allow_destroy: true
acts_as_votable
acts_as_paranoid column: :hidden_at

View File

@@ -1,14 +1,9 @@
<% provide :title do %><%= t('budgets.index.title') %><% end %>
<% content_for :canonical do %>
<%= render "shared/canonical", href: budgets_url %>
<% end %>
<div class="expanded budget no-margin-top padding">
<div class="row">
<div class="small-12 column">
<h1><%= t('budgets.index.title') %></h1>
</div>
</div>
</div>
<%= render "shared/section_header", i18n_namespace: "budgets.index.section_header", image: "budgets" %>
<div class="row margin-top">
<div class="small-12 medium-9 column">
@@ -32,5 +27,16 @@
<% end %>
</tbody>
</table>
<div id="section_help" class="margin" data-magellan-target="section_help">
<p class="lead">
<strong><%= t("budgets.index.section_footer.title") %></strong>
</p>
<p><%= t("budgets.index.section_footer.help_text_1") %></p>
<p><%= t("budgets.index.section_footer.help_text_2") %></p>
<p><%= t("budgets.index.section_footer.help_text_3",
org: link_to(setting['org_name'], new_user_registration_path)).html_safe %></p>
<p><%= t("budgets.index.section_footer.help_text_4") %></p>
</div>
</div>
</div>

View File

@@ -17,6 +17,14 @@
</h3>
<% end %>
</li>
<li class="tabs-title">
<%= link_to "#tab-documents" do %>
<h3>
<%= t("documents.tab") %>
(<%= @investment.documents.count %>)
</h3>
<% end %>
</li>
</ul>
</div>
</div>

View File

@@ -21,6 +21,10 @@
<%= f.text_field :external_url %>
</div>
<div class="documents small-12 column" data-max-documents="<%= Budget::Investment.max_documents_allowed %>">
<%= render 'documents/nested_documents', documentable: @investment %>
</div>
<div class="small-12 column">
<%= f.text_field :location %>
</div>

View File

@@ -4,6 +4,12 @@
<div class="small-12 medium-9 column">
<%= back_link_to budget_investments_path(investment.budget, heading_id: investment.heading) %>
<% if can?(:create, @document) && investment.documents.size < Budget::Investment.max_documents_allowed %>
<%= link_to t("documents.upload_document"),
new_document_path(documentable_id:investment, documentable_type: investment.class.name, from: request.url),
class: 'button hollow float-right' %>
<% end %>
<h1><%= investment.title %></h1>
<div class="budget-investment-info">
@@ -14,7 +20,6 @@
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= investment.heading.name %>
</div>
<br>
<p id="investment_code">
<%= t("budgets.investments.show.code_html", code: investment.id) %>
@@ -51,6 +56,7 @@
<h2><%= t('budgets.investments.show.price_explanation') %></h2>
<p><%= investment.price_explanation %></p>
<% end %>
</div>
<aside class="small-12 medium-3 column">

View File

@@ -19,4 +19,11 @@
comment_flags: @comment_flags,
display_comments_count: false } %>
</div>
<div class="tabs-panel" id="tab-documents">
<%= render 'documents/documents',
documents: @investment.documents,
max_documents_allowed: Budget::Investment.max_documents_allowed %>
</div>
</div>

View File

@@ -2,9 +2,9 @@
style="<%= results_type != :compatible ? 'display: none' : '' %>"
id="<%= results_type %>-container">
<h3 class="inline-block">
<h4 class="inline-block">
<%= title %>
</h3>
</h4>
<table id="budget-investments-<%= results_type %>" class="table-for-mobile">
<thead>

View File

@@ -37,21 +37,20 @@
<div class="row">
<div class="small-12 medium-3 large-2 column">
<div class="row">
<ul class="menu vertical no-margin-top no-padding-top">
<h3>
<%= t("budgets.results.heading_selection_title") %>
</h3>
<h3 class="margin-bottom">
<%= t("budgets.results.heading_selection_title") %>
</h3>
<ul class="menu vertical no-margin-top no-padding-top">
<% @budget.headings.order('id ASC').each do |heading| %>
<li>
<%= link_to heading.name,
budget_results_path(@budget, heading_id: heading.to_param),
class: heading.to_param == @heading.to_param ? 'active' : '' %>
</li>
<% end %>
</ul>
</div>
<% @budget.headings.order('id ASC').each do |heading| %>
<li>
<%= link_to heading.name,
budget_results_path(@budget, heading_id: heading.to_param),
class: heading.to_param == @heading.to_param ? 'active' : '' %>
</li>
<% end %>
</ul>
</div>
<span class="float-right"><%= link_to t("budgets.results.show_all_link"), "#", class: "js-toggle-link button hollow margin-bottom", data: {'toggle-selector' => '.js-discarded', 'toggle-text' => t("budgets.results.hide_discarded_link")} %></span>

View File

@@ -6,13 +6,13 @@
title="<%= t('shared.flag') %>">
<span class="icon-flag flag-disable"></span>
</a>
<div id="flag-drop-comment-<%= comment.id %>"
<span id="flag-drop-comment-<%= comment.id %>"
class="dropdown-pane"
data-dropdown
data-auto-focus="true">
<%= link_to t("shared.flag"), flag_comment_path(comment), method: :put,
remote: true, id: "flag-comment-#{comment.id}" %>
</div>
</span>
<% end %>
<% if show_unflag_action? comment %>
@@ -22,9 +22,9 @@
title="<%= t('shared.unflag') %>">
<span class="icon-flag flag-active"></span>
</a>
<div class="dropdown-pane" id="unflag-drop-comment-<%= comment.id %>" data-dropdown data-auto-focus="true">
<span class="dropdown-pane" id="unflag-drop-comment-<%= comment.id %>" data-dropdown data-auto-focus="true">
<%= link_to t("shared.unflag"), unflag_comment_path(comment), method: :put,
remote: true, id: "unflag-comment-#{comment.id}" %>
</div>
</span>
<% end %>
</span>

View File

@@ -3,17 +3,17 @@
<a id="flag-expand-debate-<%= debate.id %>" data-toggle="flag-drop-debate-<%= debate.id %>" title="<%= t('shared.flag') %>">
<span class="icon-flag flag-disable"></span>
</a>
<div class="dropdown-pane" id="flag-drop-debate-<%= debate.id %>" data-dropdown data-auto-focus="true">
<span class="dropdown-pane" id="flag-drop-debate-<%= debate.id %>" data-dropdown data-auto-focus="true">
<%= link_to t('shared.flag'), flag_debate_path(debate), method: :put, remote: true, id: "flag-debate-#{ debate.id }" %>
</div>
</span>
<% end %>
<% if show_unflag_action? debate %>
<a id="unflag-expand-debate-<%= debate.id %>" data-toggle="unflag-drop-debate-<%= debate.id %>" title="<%= t('shared.unflag') %>">
<span class="icon-flag flag-active"></span>
</a>
<div class="dropdown-pane" id="unflag-drop-debate-<%= debate.id %>" data-dropdown data-auto-focus="true">
<span class="dropdown-pane" id="unflag-drop-debate-<%= debate.id %>" data-dropdown data-auto-focus="true">
<%= link_to t('shared.unflag'), unflag_debate_path(debate), method: :put, remote: true, id: "unflag-debate-#{ debate.id }" %>
</div>
</span>
<% end %>
</span>

View File

@@ -9,8 +9,6 @@
<% end %>
<main>
<h1 class="show-for-sr"><%= t("shared.outline.debates") %></h1>
<% if @search_terms || @advanced_search_terms || @tag_filter %>
<div class="highlight no-margin-top padding margin-bottom">
<div class="row">
@@ -33,6 +31,8 @@
</div>
</div>
</div>
<% else %>
<%= render "shared/section_header", i18n_namespace: "debates.index.section_header", image: "debates" %>
<% end %>
<div class="row">
@@ -56,6 +56,21 @@
<%= render @debates %>
<%= paginate @debates %>
<% unless @search_terms || @advanced_search_terms || @tag_filter %>
<div id="section_help" class="margin" data-magellan-target="section_help">
<p class="lead">
<strong><%= t("debates.index.section_footer.title") %></strong>
</p>
<p><%= t("debates.index.section_footer.help_text_1") %></p>
<p><%= t("debates.index.section_footer.help_text_2",
org: link_to(setting['org_name'], new_user_registration_path)).html_safe %></p>
<p><%= t("debates.index.section_footer.help_text_3",
proposal: link_to(t("debates.index.section_footer.proposals_link"), proposals_path),
budget: link_to(t("debates.index.section_footer.budget_link"), budgets_path)).html_safe %>
</p>
</div>
<% end %>
</div>
<div class="small-12 medium-3 column">

View File

@@ -0,0 +1,20 @@
<tr id="<%= dom_id(document)%>">
<td class="document-link">
<%= document.title %>
</td>
<td class="text-center">
<%= link_to t('documents.buttons.download_document'),
document.attachment.url,
target: "_blank",
rel: "nofollow",
class: 'button hollow' %>
</td>
<td class="text-center">
<% if can? :destroy, Document %>
<%= link_to t('documents.buttons.destroy_document'),
document_path(document, from: request.url), method: :delete,
data: { confirm: t('documents.actions.destroy.confirm') },
class: 'button hollow alert' %>
<% end %>
</td>
</tr>

View File

@@ -0,0 +1,35 @@
<% if documents.any? %>
<% if documents.size == max_documents_allowed && can?(:create, Document) %>
<div class="row documents-list">
<div class="small-12 column">
<div class="callout warning text-center">
<%= t "documents.max_documents_allowed_reached_html" %>
</div>
</div>
</div>
<% end %>
<div class="row documents-list">
<div class="small-12 column">
<table>
<tbody>
<% documents.each do |document| %>
<%= render "documents/document", document: document %>
<% end %>
</tbody>
</table>
</div>
</div>
<% else %>
<div class="row">
<div class="small-12 column">
<div class="callout primary text-center">
<%= t('documents.no_documents') %>
</div>
</div>
</div>
<% end %>

View File

@@ -0,0 +1,20 @@
<%= form_for @document,
url: documents_path(
documentable_type: @document.documentable_type,
documentable_id: @document.documentable_id,
from: params[:from]
),
html: { multipart: true, class: "documentable"},
data: { direct_upload_url: upload_documents_url(documentable_type: @document.documentable_type, documentable_id: @document.documentable_id) } do |f| %>
<%= render 'shared/errors', resource: @document %>
<div class="row">
<%= render 'plain_fields', document: @document %>
<div class="actions small-12 medium-6 large-4 end column">
<%= f.submit(t("documents.form.submit_button"), class: "button expanded") %>
</div>
</div>
<% end %>

View File

@@ -0,0 +1,22 @@
<div class="documents-list">
<%= label_tag :documents, t("documents.form.title") %>
<p class="help-text"><%= documentables_note(documentable) %></p>
<% documentable.documents.each_with_index do |document, index| %>
<%= render 'documents/nested_fields', document: document, index: index, documentable: documentable %>
<% end %>
</div>
<% unless max_documents_allowed?(documentable) %>
<%= link_to t("documents.form.add_new_document"),
new_nested_documents_path(documentable_type: documentable.class.name, index: documentable.documents.size),
remote: true,
id: "new_document_link",
class: "button hollow" %>
<% end %>
<div class="max-documents-notice callout warning text-center <%= "hide" unless max_documents_allowed?(documentable) %>">
<%= t "documents.max_documents_allowed_reached_html" %>
</div>
<hr>

View File

@@ -0,0 +1,31 @@
<div id="<%= document_nested_field_wrapper_id(index) %>" class="document">
<%= hidden_field_tag :id,
document.id,
name: document_nested_field_name(document, index, :id),
id: document_nested_field_id(document, index, :id) if document.persisted? %>
<%= hidden_field_tag :user_id,
current_user.id,
name: document_nested_field_name(document, index, :user_id),
id: document_nested_field_id(document, index, :user_id) %>
<%= hidden_field_tag :cached_attachment,
document.cached_attachment,
name: document_nested_field_name(document, index, :cached_attachment),
id: document_nested_field_id(document, index, :cached_attachment) %>
<%= label_tag :title, t("activerecord.attributes.document.title") %>
<%= text_field_tag :title,
document.title,
name: document_nested_field_name(document, index, :title),
id: document_nested_field_id(document, index, :title),
class: "document-title" %>
<% if document.errors[:title].any? %>
<small class="error"><%= document.errors[:title].join(", ") %></small>
<% end %>
<%= render_attachment(document, index) %>
<%= render_destroy_document_link(document, index) %>
<p class="file-name"><%= document_attachment_file_name(document) %></p>
<div class="progress-bar-placeholder"><div class="loading-bar"></div></div>
<hr>
</div>

View File

@@ -0,0 +1,50 @@
<div id="plain_document_fields" class="document">
<div class="small-12 column">
<%= label_tag :document_title, t("activerecord.attributes.document.title") %>
<%= text_field_tag :document_title, document.title, name: "document[title]", class: "document-title" %>
<% if document.errors.has_key?(:title) %>
<small class="error"><%= document.errors[:title].join(", ") %></small>
<% end %>
</div>
<div class="small-12 column">
<%= hidden_field_tag :cached_attachment, document.cached_attachment, name: "document[cached_attachment]" %>
<%= file_field_tag :attachment,
accept: accepted_content_types_extensions(document.documentable.class),
label: false,
class: 'document_ajax_attachment',
data: {
url: upload_documents_url(documentable_type: document.documentable_type, documentable_id: document.documentable_id),
cached_attachment_input_field: "document_cached_attachment",
multiple: false,
nested_document: false
},
id: "document_attachment",
name: "document[attachment]" %>
<% if document.cached_attachment.blank? %>
<%= label_tag :document_attachment, t("documents.form.attachment_label"), class: 'button hollow' %>
<% else %>
<%= link_to t('documents.form.delete_button'),
destroy_upload_documents_path(path: document.cached_attachment,
nested_document: false,
documentable_type: document.documentable_type,
documentable_id: document.documentable_id),
method: :delete,
remote: true,
class: "delete float-right" %>
<% end %>
<% if document.errors.has_key?(:attachment) %>
<div class="small-12 column source-option-file">
<div class="attachment-errors">
<small class="error"><%= errors_on_attachment(document) %></small>
</div>
</div>
<% end %>
<p class="file-name"><%= document_attachment_file_name(document) %></p>
<div class="progress-bar-placeholder"><div class="loading-bar"></div></div>
</div>
</div>

View File

@@ -0,0 +1,17 @@
<% if params[:nested_document] == "true" %>
App.Documentable.destroyNestedDocument("<%= document_nested_field_wrapper_id(params[:index]) %>", "<%= j render('layouts/flash') %>")
<% new_document_link = link_to t("documents.form.add_new_document"),
new_nested_documents_path(documentable_type: @document.documentable_type, index: params[:index]),
remote: true,
id: "new_document_link",
class: "button hollow" %>
App.Documentable.updateNewDocumentButton("<%= j new_document_link %>")
<% else %>
App.Documentable.replacePlainDocument("plain_document_fields",
"<%= j render('layouts/flash') %>",
"<%= j render('plain_fields', document: @document) %>")
<% end %>

View File

@@ -0,0 +1,27 @@
<div class="document-form <%= documentable_class(@document.documentable) %> row">
<div class="small-12 medium-9 column">
<%= back_link_to params[:from] %>
<h1><%= t("documents.new.title") %></h1>
<%= render "documents/form", form_url: documents_url %>
</div>
<div class="small-12 medium-3 column">
<span class="icon-documents float-right"></span>
<h2><%= t("documents.recommendations_title") %></h2>
<ul class="recommendations">
<li>
<%= t "documents.recommendation_one_html",
max_documents_allowed: max_documents_allowed(@document.documentable) %>
</li>
<li>
<%= t "documents.recommendation_two_html",
accepted_content_types: humanized_accepted_content_types(@document.documentable) %>
</li>
<li>
<%= t "documents.recommendation_three_html",
max_file_size: max_file_size(@document.documentable) %>
</li>
</ul>
</div>
</div>

View File

@@ -0,0 +1,9 @@
<%
new_document_link = link_to t("documents.form.add_new_document"),
new_nested_documents_path(documentable_type: params[:documentable_type], index: params[:index].to_i + 1),
remote: true,
id: "new_document_link",
class: "button hollow"
%>
App.Documentable.new("<%= j render('documents/nested_fields', document: @document, index: params[:index]) %>")
App.Documentable.updateNewDocumentButton("<%= j new_document_link %>")

View File

@@ -0,0 +1,12 @@
<% if params[:nested_document] == "true" %>
App.Documentable.uploadNestedDocument("<%= document_nested_field_wrapper_id(params[:index]) %>",
"<%= j render('documents/nested_fields', document: @document, index: params[:index]) %>",
<%= @document.cached_attachment.present? %>)
<% else %>
App.Documentable.uploadPlainDocument("plain_document_fields",
"<%= j render('documents/plain_fields', document: @document) %>",
<%= @document.cached_attachment.present? %>)
<% end %>

View File

@@ -18,7 +18,7 @@
<aside class="small-12 medium-3 column">
<div class="sidebar-divider"></div>
<h2><%= t('legislation.shared.share') %></h2>
<%= render '/legislation/shared/share_buttons',
<%= render '/shared/social_share',
title: t('legislation.shared.share_comment', version_name: @draft_version.title.downcase, process_name: @process.title),
url: legislation_process_draft_version_path(process, draft_version)
%>

View File

@@ -33,7 +33,7 @@
<aside class="small-12 medium-3 column">
<div class="sidebar-divider"></div>
<h2><%= t('legislation.shared.share') %></h2>
<%= render '/legislation/shared/share_buttons',
<%= render '/shared/social_share',
title: t('legislation.shared.share_comment', version_name: @draft_version.title.downcase, process_name: @process.title),
url: legislation_process_draft_version_annotations_path(@process, @draft_version)
%>

View File

@@ -2,12 +2,13 @@
<%= t("layouts.header.collaborative_legislation") %> - <%= t("legislation.processes.index.filters.#{@current_filter}") %>
<% end %>
<div class="row">
<div class="legislation-categories small-12 medium-3 column">
<%= render 'shared/filter_subnav', i18n_namespace: "legislation.processes.index" %>
</div>
<%= render "shared/section_header", i18n_namespace: "legislation.processes.index.section_header", image: "legislation_processes" %>
<div class="row">
<div id="legislation" class="legislation-list small-12 medium-9 column">
<%= render 'shared/filter_subnav', i18n_namespace: "legislation.processes.index" %>
<div id="legislation-list">
<% if @processes.any? %>
<%= render @processes %>
@@ -17,6 +18,16 @@
<%= t(".no_#{@current_filter}_processes") %>
</div>
<% end %>
<div id="section_help" class="margin" data-magellan-target="section_help">
<p class="lead">
<strong><%= t("legislation.processes.index.section_footer.title") %></strong>
</p>
<p><%= t("legislation.processes.index.section_footer.help_text_1") %></p>
<p><%= t("legislation.processes.index.section_footer.help_text_2",
org: setting['org_name']) %></p>
<p><%= t("legislation.processes.index.section_footer.help_text_3") %></p>
</div>
</div>
</div>
</div>

View File

@@ -38,7 +38,7 @@
<aside class="small-12 medium-3 column">
<div id="social-share" class="sidebar-divider"></div>
<h3><%= t('.share') %></h3>
<%= render '/legislation/shared/share_buttons', title: @question.title, url: legislation_process_question_url(@question.process, @question) %>
<%= render '/shared/social_share', title: @question.title, url: legislation_process_question_url(@question.process, @question) %>
</aside>
</div>

View File

@@ -1,9 +0,0 @@
<div class="social-share-full">
<%= social_share_button_tag("#{title} #{setting['twitter_hashtag']}") %>
<% if browser.device.mobile? %>
<a href="whatsapp://send?text=<%= title %> <%= url %>" data-action="share/whatsapp/share">
<span class="icon-whatsapp whatsapp"></span>
<span class="show-for-sr"><%= t("social.whatsapp") %></span>
</a>
<% end %>
</div>

View File

@@ -1,23 +1,14 @@
<% provide :title do %><%= t("polls.index.title") %><% end %>
<% content_for :wrapper_class, "light" %>
<% content_for :canonical do %>
<%= render "shared/canonical", href: polls_url %>
<% end %>
<div class="expanded no-margin-top dark-heading">
<div class="row">
<div class="small-12 medium-6 column padding">
<h1><%= t("polls.index.title") %></h1>
</div>
</div>
</div>
<%= render "shared/section_header", i18n_namespace: "polls.index.section_header", image: "polls" %>
<div class="row">
<div class="small-12 medium-3 column">
<%= render 'shared/filter_subnav_vertical', i18n_namespace: "polls.index" %>
</div>
<div class="small-12 medium-9 column">
<%= render 'shared/filter_subnav', i18n_namespace: "polls.index" %>
<div class="small-12 medium-9 column margin-top">
<% polls_by_geozone_restriction = @polls.group_by(&:geozone_restricted) %>
<% if polls_by_geozone_restriction[false].present? %>
@@ -31,5 +22,15 @@
<% end %>
<%= paginate @polls %>
<div id="section_help" class="margin" data-magellan-target="section_help">
<p class="lead">
<strong><%= t("polls.index.section_footer.title") %></strong>
</p>
<p><%= t("polls.index.section_footer.help_text_1") %></p>
<p><%= t("polls.index.section_footer.help_text_2",
org: link_to(setting['org_name'], new_user_registration_path)).html_safe %></p>
</p>
</div>
</div>
</div>

View File

@@ -1,5 +1,4 @@
<% provide :title do %><%= @poll.name %><% end %>
<% content_for :wrapper_class, "light" %>
<div class="polls-show">
<div class="expanded no-margin-top dark-heading polls-show-header">

View File

@@ -17,6 +17,14 @@
</h3>
<% end %>
</li>
<li class="tabs-title">
<%= link_to "#tab-documents" do %>
<h3>
<%= t("documents.tab") %>
(<%= @proposal.documents.count %>)
</h3>
<% end %>
</li>
</ul>
</div>
</div>

View File

@@ -4,18 +4,18 @@
<a id="flag-expand-proposal-<%= proposal.id %>" data-toggle="flag-drop-proposal-<%= proposal.id %>" title="<%= t('shared.flag') %>">
<span class="icon-flag flag-disable"></span>
</a>
<div class="dropdown-pane" id="flag-drop-proposal-<%= proposal.id %>" data-dropdown data-auto-focus="true">
<span class="dropdown-pane" id="flag-drop-proposal-<%= proposal.id %>" data-dropdown data-auto-focus="true">
<%= link_to t('shared.flag'), flag_proposal_path(proposal), method: :put, remote: true, id: "flag-proposal-#{ proposal.id }" %>
</div>
</span>
<% end %>
<% if show_unflag_action? proposal %>
<a id="unflag-expand-proposal-<%= proposal.id %>" data-toggle="unflag-drop-proposal-<%= proposal.id %>" title="<%= t('shared.unflag') %>">
<span class="icon-flag flag-active"></span>
</a>
<div class="dropdown-pane" id="unflag-drop-proposal-<%= proposal.id %>" data-dropdown data-auto-focus="true">
<span class="dropdown-pane" id="unflag-drop-proposal-<%= proposal.id %>" data-dropdown data-auto-focus="true">
<%= link_to t('shared.unflag'), unflag_proposal_path(proposal), method: :put, remote: true, id: "unflag-proposal-#{ proposal.id }" %>
</div>
</span>
<% end %>
</span>
</span>

View File

@@ -34,7 +34,6 @@
<%= f.cktext_area :description, maxlength: Proposal.description_max_length, ckeditor: { language: I18n.locale }, label: false %>
</div>
<div class="small-12 column">
<%= f.label :video_url, t("proposals.form.proposal_video_url") %>
<p class="help-text" id="video-url-help-text"><%= t("proposals.form.proposal_video_url_note") %></p>
@@ -47,6 +46,10 @@
<%= f.text_field :external_url, placeholder: t("proposals.form.proposal_external_url"), label: false %>
</div>
<div class="documents small-12 column" data-max-documents="<%= Proposal.max_documents_allowed %>">
<%= render 'documents/nested_documents', documentable: @proposal %>
</div>
<div class="small-12 medium-6 column">
<%= f.label :geozone_id, t("proposals.form.geozone") %>
<%= f.select :geozone_id, geozone_select_options, {include_blank: t("geozones.none"), label: false} %>

View File

@@ -9,8 +9,6 @@
<% end %>
<main>
<h1 class="show-for-sr"><%= t("shared.outline.proposals") %></h1>
<% if @search_terms || @advanced_search_terms || @tag_filter || params[:retired].present? %>
<div class="highlight no-margin-top padding margin-bottom">
<div class="row">
@@ -35,6 +33,8 @@
</div>
</div>
</div>
<% else %>
<%= render "shared/section_header", i18n_namespace: "proposals.index.section_header", image: "proposals" %>
<% end %>
<div class="row">
@@ -61,13 +61,27 @@
<%= render 'shared/order_links', i18n_namespace: "proposals.index" %>
<div class="show-for-small-only">
<%= link_to t("proposals.index.start_proposal"), new_proposal_path, class: 'button expanded' %>
</div>
<% if @proposals.any? %>
<div class="show-for-small-only">
<%= link_to t("proposals.index.start_proposal"), new_proposal_path, class: 'button expanded' %>
</div>
<% end %>
<div id="proposals-list">
<%= render partial: 'proposals/proposal', collection: @proposals %>
<%= paginate @proposals %>
<% unless @search_terms || @advanced_search_terms || @tag_filter %>
<div id="section_help" class="margin" data-magellan-target="section_help">
<p class="lead">
<strong><%= t("proposals.index.section_footer.title") %></strong>
</p>
<p><%= t("proposals.index.section_footer.help_text_1") %></p>
<p><%= t("proposals.index.section_footer.help_text_2",
org: link_to(setting['org_name'], new_user_registration_path)).html_safe %></p>
<p><%= t("proposals.index.section_footer.help_text_3") %></p>
</div>
<% end %>
</div>
</div>

View File

@@ -16,6 +16,12 @@
<div class="small-12 medium-9 column">
<%= back_link_to %>
<% if can?(:create, @document) && @proposal.documents.size < Proposal.max_documents_allowed %>
<%= link_to t("documents.upload_document"),
new_document_path(documentable_id: @proposal, documentable_type: @proposal.class.name, from: request.url),
class: 'button hollow float-right' %>
<% end %>
<% if author_of?(@proposal, current_user) %>
<%= link_to t("proposals.show.send_notification"), new_proposal_notification_path(proposal_id: @proposal.id),
class: 'button hollow float-right' %>
@@ -77,14 +83,23 @@
<% if @proposal.external_url.present? %>
<div class="document-link">
<%= text_with_links @proposal.external_url %>
<p>
<span class="icon-document"></span>&nbsp;
<strong><%= t('proposals.show.title_external_url') %></strong>
</p>
<%= text_with_links @proposal.external_url %>
</div>
<% end %>
<% if @proposal.video_url.present? %>
<div class="video-link">
<p>
<span class="icon-video"></span>&nbsp;
<strong><%= t('proposals.show.title_video_url') %></strong>
</p>
<%= text_with_links @proposal.video_url %>
</div>
<% end %>
<h4><%= @proposal.question %></h4>
@@ -156,4 +171,10 @@
<div class="tabs-panel is-active" id="tab-comments">
<%= render "proposals/comments" %>
</div>
<div class="tabs-panel" id="tab-documents">
<%= render 'documents/documents',
documents: @proposal.documents,
max_documents_allowed: Proposal.max_documents_allowed %>
</div>
</div>

View File

@@ -1,4 +1,4 @@
<% if current_user %>
<% if show_admin_menu? %>
<li>
<%= link_to t("layouts.header.administration_menu"), "#", rel: "nofollow" %>
<ul class="menu">

View File

@@ -0,0 +1,10 @@
<div class="highlight jumbo">
<div class="row">
<div class="small-12 medium-9 column" data-magellan>
<%= image_tag "help/help_icon_#{image}.png", alt: t("#{i18n_namespace}.icon_alt"), class: "align-top" %>
<h1 class="inline-block"><%= t("#{i18n_namespace}.title") %></h1>
<p class="lead"><%= t("#{i18n_namespace}.description") %></p>
<%= link_to t("#{i18n_namespace}.help"), "#section_help", class: "help-link" %>
</div>
</div>
</div>

View File

@@ -4,7 +4,7 @@
<% end %>
<div class="social-share-full">
<%= social_share_button_tag("#{title} #{setting['twitter_hashtag']}") %>
<a href="whatsapp://send?text=<%= title.gsub(/\s/, '%20') %>&nbsp;<%= url %>"
<a href="whatsapp://send?text=<%= CGI.escape(title) %>&nbsp;<%= url %>"
class="show-for-small-only" data-action="share/whatsapp/share">
<span class="icon-whatsapp whatsapp"></span>
<span class="show-for-sr"><%= t("social.whatsapp") %></span>

View File

@@ -7,28 +7,34 @@
<% if proposal.retired? %>
<td class="text-center">
<td class="text-center" colspan="2">
<span class="label alert"><%= t('users.proposals.retired') %></span>
</td>
<% elsif author?(proposal) %>
<td class="text-center">
<td>
<%= link_to t("users.proposals.send_notification"),
new_proposal_notification_path(proposal_id: proposal.id),
class: 'button hollow' %>
class: 'button hollow expanded' %>
</td>
<td class="text-center">
<td>
<% if proposal.retired? %>
<span class="label alert"><%= t('users.proposals.retired') %></span>
<% else %>
<%= link_to t('users.proposals.retire'),
retire_form_proposal_path(proposal),
class: 'button hollow alert' %>
class: 'button hollow alert expanded' %>
<% end %>
</td>
<% else %>
<td class="text-center" colspan="2">
<%= link_to t('users.proposals.see'), proposal, class: 'button hollow' %>
</td>
<% end %>
</tr>

View File

@@ -2,45 +2,50 @@
<%= render "shared/canonical", href: root_url %>
<% end %>
<div class="expanded highlight padding no-margin-top">
<div class="jumbo highlight">
<div class="row">
<div class="small-12 medium-6 column">
<div class="small-12 medium-9 small-centered column text-center">
<h1><%= t("layouts.header.open_city_title") %></h1>
<p>
<%= t("layouts.header.open_city_slogan_html") %>&nbsp;
<%= link_to t("layouts.header.more_info"), more_info_path %>
<p class="lead">
<%= t("layouts.header.open_city_slogan_html") %>
</p>
<div class="small-12 medium-6">
<%= link_to t("layouts.header.see_all"), proposals_path, class: "button see-more expanded" %>
<div class="small-12 medium-6 large-4 small-centered">
<%= link_to t("layouts.header.more_info"), more_info_path, class: "button expanded large" %>
</div>
</div>
<div class="hide-for-small-only small-12 medium-5 column text-center">
<%= image_tag(image_path_for("icon_home.png"), size: "330x240", alt:"") %>
</div>
</div>
</div>
<% cache [locale_and_user_status, @featured_debates, @featured_proposals, 'featured'] do %>
<main>
<div class="row text-center margin">
<div class="small-12 medium-3 column">
<h2><%= t("welcome.debates.title") %></h2>
<p><%= t("welcome.debates.description") %></p>
<div class="row">
<div class="small-12 medium-6 column">
<p>
<span class="lead"><strong><%= t("welcome.debates.title") %></strong></span><br>
<%= t("welcome.debates.description") %>
</p>
</div>
<div class="small-12 medium-3 column">
<h2><%= t("welcome.proposal.title") %></h2>
<p><%= t("welcome.proposal.description") %></p>
<div class="small-12 medium-6 column">
<p>
<span class="lead"><strong><%= t("welcome.proposal.title") %></strong></span><br>
<%= t("welcome.proposal.description") %>
</p>
</div>
</div>
<div class="small-12 medium-3 column">
<h2><%= t("welcome.decide.title") %></h2>
<p><%= t("welcome.decide.description") %></p>
<div class="row margin-top">
<div class="small-12 medium-6 column">
<p>
<span class="lead"><strong><%= t("welcome.decide.title") %></strong></span><br>
<%= t("welcome.decide.description") %>
</p>
</div>
<div class="small-12 medium-3 column">
<h2><%= t("welcome.do.title") %></h2>
<p><%= t("welcome.do.description") %></p>
<div class="small-12 medium-6 column">
<p>
<span class="lead"><strong><%= t("welcome.do.title") %></strong></span><br>
<%= t("welcome.do.description") %>
</p>
</div>
</div>
</main>