From 0ed6b0da6b1b714c64fa1c9bcbd526b8e5b98f51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Thu, 14 Sep 2017 12:52:03 +0200 Subject: [PATCH] Added Legislation Proposals views --- .../legislation/processes/proposals.html.erb | 29 +++ .../legislation/proposals/_actions.html.erb | 10 + .../proposals/_categories.html.erb | 12 ++ .../legislation/proposals/_comments.html.erb | 24 +++ .../proposals/_featured_proposal.html.erb | 27 +++ .../proposals/_featured_votes.html.erb | 44 +++++ .../proposals/_filter_subnav.html.erb | 30 +++ .../proposals/_flag_actions.html.erb | 21 ++ .../legislation/proposals/_form.html.erb | 103 ++++++++++ .../legislation/proposals/_geozones.html.erb | 6 + .../proposals/_notifications.html.erb | 17 ++ .../legislation/proposals/_popular.html.erb | 6 + .../legislation/proposals/_proposal.html.erb | 81 ++++++++ .../proposals/_refresh_flag_actions.js.erb | 1 + .../legislation/proposals/_retired.html.erb | 13 ++ .../legislation/proposals/_votes.html.erb | 66 +++++++ app/views/legislation/proposals/edit.html.erb | 14 ++ .../legislation/proposals/index.html.erb | 102 ++++++++++ app/views/legislation/proposals/map.html.erb | 1 + app/views/legislation/proposals/new.html.erb | 24 +++ .../proposals/retire_form.html.erb | 38 ++++ .../legislation/proposals/share.html.erb | 51 +++++ app/views/legislation/proposals/show.html.erb | 183 ++++++++++++++++++ .../legislation/proposals/suggest.js.erb | 1 + .../legislation/proposals/summary.html.erb | 53 +++++ app/views/legislation/proposals/vote.js.erb | 1 + .../proposals/vote_featured.js.erb | 1 + config/locales/es/legislation.yml | 1 + 28 files changed, 960 insertions(+) create mode 100644 app/views/legislation/processes/proposals.html.erb create mode 100644 app/views/legislation/proposals/_actions.html.erb create mode 100644 app/views/legislation/proposals/_categories.html.erb create mode 100644 app/views/legislation/proposals/_comments.html.erb create mode 100644 app/views/legislation/proposals/_featured_proposal.html.erb create mode 100644 app/views/legislation/proposals/_featured_votes.html.erb create mode 100644 app/views/legislation/proposals/_filter_subnav.html.erb create mode 100644 app/views/legislation/proposals/_flag_actions.html.erb create mode 100644 app/views/legislation/proposals/_form.html.erb create mode 100644 app/views/legislation/proposals/_geozones.html.erb create mode 100644 app/views/legislation/proposals/_notifications.html.erb create mode 100644 app/views/legislation/proposals/_popular.html.erb create mode 100644 app/views/legislation/proposals/_proposal.html.erb create mode 100644 app/views/legislation/proposals/_refresh_flag_actions.js.erb create mode 100644 app/views/legislation/proposals/_retired.html.erb create mode 100644 app/views/legislation/proposals/_votes.html.erb create mode 100644 app/views/legislation/proposals/edit.html.erb create mode 100644 app/views/legislation/proposals/index.html.erb create mode 100644 app/views/legislation/proposals/map.html.erb create mode 100644 app/views/legislation/proposals/new.html.erb create mode 100644 app/views/legislation/proposals/retire_form.html.erb create mode 100644 app/views/legislation/proposals/share.html.erb create mode 100644 app/views/legislation/proposals/show.html.erb create mode 100644 app/views/legislation/proposals/suggest.js.erb create mode 100644 app/views/legislation/proposals/summary.html.erb create mode 100644 app/views/legislation/proposals/vote.js.erb create mode 100644 app/views/legislation/proposals/vote_featured.js.erb diff --git a/app/views/legislation/processes/proposals.html.erb b/app/views/legislation/processes/proposals.html.erb new file mode 100644 index 000000000..9e54ba46e --- /dev/null +++ b/app/views/legislation/processes/proposals.html.erb @@ -0,0 +1,29 @@ +<% provide :title do %><%= @process.title %><% end %> + +<%= render 'legislation/processes/header', process: @process, header: :full %> + +<%= render 'key_dates', process: @process, phase: :proposals %> + +
+
+
+
+
+ <% if @process.proposals.empty? %> +
+

<%= t('.empty_questions') %>

+
+ <% else %> + <%= render @process.proposals %> + <% end %> +
+
+ +
+
+

<%= t('.participate') %>

+
+
+
+
+
diff --git a/app/views/legislation/proposals/_actions.html.erb b/app/views/legislation/proposals/_actions.html.erb new file mode 100644 index 000000000..b2bc9f111 --- /dev/null +++ b/app/views/legislation/proposals/_actions.html.erb @@ -0,0 +1,10 @@ +<% if can? :hide, proposal %> + <%= link_to t("admin.actions.hide").capitalize, hide_moderation_proposal_path(proposal), + method: :put, remote: true, data: { confirm: t('admin.actions.confirm') } %> +<% end %> + +<% if can? :hide, proposal.author %> +  |  + <%= link_to t("admin.actions.hide_author").capitalize, hide_moderation_user_path(proposal.author_id), + method: :put, data: { confirm: t('admin.actions.confirm') } %> +<% end %> diff --git a/app/views/legislation/proposals/_categories.html.erb b/app/views/legislation/proposals/_categories.html.erb new file mode 100644 index 000000000..a694eb555 --- /dev/null +++ b/app/views/legislation/proposals/_categories.html.erb @@ -0,0 +1,12 @@ + + +
+ + diff --git a/app/views/legislation/proposals/_comments.html.erb b/app/views/legislation/proposals/_comments.html.erb new file mode 100644 index 000000000..c304bc4dd --- /dev/null +++ b/app/views/legislation/proposals/_comments.html.erb @@ -0,0 +1,24 @@ +<% cache [locale_and_user_status, @current_order, commentable_cache_key(@proposal), @comment_tree.comments, @comment_tree.comment_authors, @proposal.comments_count, @comment_flags] do %> +
+
+ <%= render 'shared/wide_order_selector', i18n_namespace: "comments" %> + + <% if user_signed_in? %> + <%= render 'comments/form', {commentable: @proposal, parent_id: nil, toggeable: false} %> + <% else %> +
+ +
+ <%= t("proposals.show.login_to_comment", + signin: link_to(t("votes.signin"), new_user_session_path), + signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %> +
+ <% end %> + + <% @comment_tree.root_comments.each do |comment| %> + <%= render 'comments/comment', comment: comment %> + <% end %> + <%= paginate @comment_tree.root_comments %> +
+
+<% end %> diff --git a/app/views/legislation/proposals/_featured_proposal.html.erb b/app/views/legislation/proposals/_featured_proposal.html.erb new file mode 100644 index 000000000..5500b2418 --- /dev/null +++ b/app/views/legislation/proposals/_featured_proposal.html.erb @@ -0,0 +1,27 @@ + diff --git a/app/views/legislation/proposals/_featured_votes.html.erb b/app/views/legislation/proposals/_featured_votes.html.erb new file mode 100644 index 000000000..3177812a4 --- /dev/null +++ b/app/views/legislation/proposals/_featured_votes.html.erb @@ -0,0 +1,44 @@ +
+
+ <% if voted_for?(@featured_proposals_votes, proposal) %> +
+ <%= t("proposals.proposal.already_supported") %> +
+ <% else %> + <%= link_to vote_featured_proposal_path(proposal, value: 'yes'), + class: "button button-support small expanded", + title: t('proposals.proposal.support_title'), method: "post", remote: true do %> + <%= t("proposals.proposal.support") %> + <% end %> + <% end %> +
+ + <% if user_signed_in? && current_user.organization? %> + + <% elsif user_signed_in? && !proposal.votable_by?(current_user)%> + + <% elsif !user_signed_in? %> + + <% end %> + + <% if voted_for?(@featured_proposals_votes, proposal) %> + <% if setting['twitter_handle'] %> + + <% end %> + <% end %> +
diff --git a/app/views/legislation/proposals/_filter_subnav.html.erb b/app/views/legislation/proposals/_filter_subnav.html.erb new file mode 100644 index 000000000..fece62a17 --- /dev/null +++ b/app/views/legislation/proposals/_filter_subnav.html.erb @@ -0,0 +1,30 @@ +
+
+
    +
  • + <%= link_to "#tab-comments" do %> +

    + <%= t("proposals.show.comments_tab") %> + (<%= @proposal.comments_count %>) +

    + <% end %> +
  • +
  • + <%= link_to "#tab-notifications" do %> +

    + <%= t("proposals.show.notifications_tab") %> + (<%= @notifications.count %>) +

    + <% end %> +
  • +
  • + <%= link_to "#tab-documents" do %> +

    + <%= t("documents.tab") %> + (<%= @proposal.documents.count %>) +

    + <% end %> +
  • +
+
+
diff --git a/app/views/legislation/proposals/_flag_actions.html.erb b/app/views/legislation/proposals/_flag_actions.html.erb new file mode 100644 index 000000000..3e776de66 --- /dev/null +++ b/app/views/legislation/proposals/_flag_actions.html.erb @@ -0,0 +1,21 @@ + + + <% if show_flag_action? proposal %> + + + + + <%= link_to t('shared.flag'), flag_proposal_path(proposal), method: :put, remote: true, id: "flag-proposal-#{ proposal.id }" %> + + <% end %> + + <% if show_unflag_action? proposal %> + + + + + <%= link_to t('shared.unflag'), unflag_proposal_path(proposal), method: :put, remote: true, id: "unflag-proposal-#{ proposal.id }" %> + + <% end %> + + diff --git a/app/views/legislation/proposals/_form.html.erb b/app/views/legislation/proposals/_form.html.erb new file mode 100644 index 000000000..73b39dfdb --- /dev/null +++ b/app/views/legislation/proposals/_form.html.erb @@ -0,0 +1,103 @@ +<%= form_for(@proposal, url: form_url) do |f| %> + <%= render 'shared/errors', resource: @proposal %> + +
+
+ <%= f.label :title, t("proposals.form.proposal_title") %> + <%= f.text_field :title, maxlength: Proposal.title_max_length, placeholder: t("proposals.form.proposal_title"), label: false, data: {js_suggest_result: "js_suggest_result", js_suggest: "#js-suggest", js_url: suggest_proposals_path}%> +
+
+ + <%= f.invisible_captcha :subtitle %> + +
+ <%= f.label :question, t("proposals.form.proposal_question") %> +

+ <%= t("proposals.form.proposal_question_example_html") %> +

+ <%= f.text_field :question, maxlength: Proposal.question_max_length, + placeholder: t("proposals.form.proposal_question"), + label: false, + aria: {describedby: "question-help-text"} %> +
+ +
+ <%= f.label :summary, t("proposals.form.proposal_summary") %> +

<%= t("proposals.form.proposal_summary_note") %>

+ <%= f.text_area :summary, rows: 4, maxlength: 200, label: false, + placeholder: t('proposals.form.proposal_summary'), + aria: {describedby: "summary-help-text"} %> +
+ +
+ <%= f.label :description, t("proposals.form.proposal_text") %> + <%= f.cktext_area :description, maxlength: Proposal.description_max_length, ckeditor: { language: I18n.locale }, label: false %> +
+ +
+ <%= f.label :video_url, t("proposals.form.proposal_video_url") %> +

<%= t("proposals.form.proposal_video_url_note") %>

+ <%= f.text_field :video_url, placeholder: t("proposals.form.proposal_video_url"), label: false, + aria: {describedby: "video-url-help-text"} %> +
+ +
+ <%= f.label :external_url, t("proposals.form.proposal_external_url") %> + <%= f.text_field :external_url, placeholder: t("proposals.form.proposal_external_url"), label: false %> +
+ +
+ <%= render 'documents/nested_documents', documentable: @proposal %> +
+ +
+ <%= f.label :geozone_id, t("proposals.form.geozone") %> + <%= f.select :geozone_id, geozone_select_options, {include_blank: t("geozones.none"), label: false} %> +
+ +
+ <%= f.label :tag_list, t("proposals.form.tags_label") %> +

<%= t("proposals.form.tags_instructions") %>

+ +
+ <%= f.label :category_tag_list, t("proposals.form.tag_category_label") %> + <% @categories.each do |tag| %> + <%= tag.name %> + <% end %> +
+ +
+ <%= f.text_field :tag_list, value: @proposal.tag_list.to_s, + label: false, + placeholder: t("proposals.form.tags_placeholder"), + class: 'js-tag-list', + aria: {describedby: "tag-list-help-text"} %> +
+ + <% if current_user.unverified? %> +
+ <%= f.label :responsible_name, t("proposals.form.proposal_responsible_name") %> +

<%= t("proposals.form.proposal_responsible_name_note") %>

+ <%= f.text_field :responsible_name, placeholder: t("proposals.form.proposal_responsible_name"), label: false, + aria: {describedby: "responsible-name-help-text"} %> +
+ <% end %> + +
+ <% if @proposal.new_record? %> + <%= f.label :terms_of_service do %> + <%= f.check_box :terms_of_service, title: t('form.accept_terms_title'), label: false %> + + <%= t("form.accept_terms", + policy: link_to(t("form.policy"), "/privacy", target: "blank"), + conditions: link_to(t("form.conditions"), "/conditions", target: "blank")).html_safe %> + + <% end %> + <% end %> +
+ +
+ <%= f.submit(class: "button", value: t("proposals.#{action_name}.form.submit_button")) %> +
+
+<% end %> diff --git a/app/views/legislation/proposals/_geozones.html.erb b/app/views/legislation/proposals/_geozones.html.erb new file mode 100644 index 000000000..7e4dbcaa4 --- /dev/null +++ b/app/views/legislation/proposals/_geozones.html.erb @@ -0,0 +1,6 @@ + + +
+<%= link_to map_proposals_path, id: 'map', title: t("shared.tags_cloud.districts_list") do %> + <%= image_tag("map.jpg", alt: t("shared.tags_cloud.districts_list")) %> +<% end %> diff --git a/app/views/legislation/proposals/_notifications.html.erb b/app/views/legislation/proposals/_notifications.html.erb new file mode 100644 index 000000000..69389b2c5 --- /dev/null +++ b/app/views/legislation/proposals/_notifications.html.erb @@ -0,0 +1,17 @@ +
+
+
+ <% if @notifications.blank? %> +
+ <%= t('proposals.show.no_notifications') %> +
+ <% end %> + + <% @notifications.each do |notification| %> +

<%= notification.title %>

+

<%= notification.created_at.to_date %>

+

<%= notification.body %>

+ <% end %> +
+
+
diff --git a/app/views/legislation/proposals/_popular.html.erb b/app/views/legislation/proposals/_popular.html.erb new file mode 100644 index 000000000..7f46ea802 --- /dev/null +++ b/app/views/legislation/proposals/_popular.html.erb @@ -0,0 +1,6 @@ + + + +

+ <%= link_to t("proposals.index.top_link_proposals"), summary_proposals_path, class: "small" %>
+

diff --git a/app/views/legislation/proposals/_proposal.html.erb b/app/views/legislation/proposals/_proposal.html.erb new file mode 100644 index 000000000..c269146ab --- /dev/null +++ b/app/views/legislation/proposals/_proposal.html.erb @@ -0,0 +1,81 @@ +
Proposal.votes_needed_for_success) %>" + data-type="proposal"> +
+
+
+ +
+
+ <% cache [locale_and_user_status(proposal), 'index', proposal, proposal.author] do %> +

<%= link_to proposal.title, namespaced_proposal_path(proposal) %>

+

+   + <%= link_to t("proposals.proposal.comments", count: proposal.comments_count), namespaced_proposal_path(proposal, anchor: "comments") %> + +  •  + <%= l proposal.created_at.to_date %> + + <% if proposal.author.hidden? || proposal.author.erased? %> +  •  + + <%= t("proposals.show.author_deleted") %> + + <% else %> +  •  + + <%= proposal.author.name %> + + <% if proposal.author.display_official_position_badge? %> +  •  + + <%= proposal.author.official_position %> + + <% end %> + <% end %> + + <% if proposal.author.verified_organization? %> +  •  + + <%= t("shared.collective") %> + + <% end %> +

+
+

<%= proposal.summary %>

+
+
+ <%= render "shared/tags", taggable: proposal, limit: 5 %> + <% end %> +
+
+ +
+ <% if proposal.successful? %> +
+ +

+ <%= t("proposals.proposal.successful", + voting: link_to(t("proposals.proposal.voting"), polls_path)).html_safe %> +

+
+ <% if can? :create, Poll::Question %> +

+ <%= link_to t('poll_questions.create_question'), + new_admin_question_path(proposal_id: proposal.id), + class: "button hollow" %> +

+ <% end %> + <% elsif proposal.archived? %> +
+ <%= t("proposals.proposal.supports", count: proposal.total_votes) %> +

<%= t("proposals.proposal.archived") %>

+
+ <% else %> + <%= render 'votes', + { proposal: proposal, vote_url: vote_proposal_path(proposal, value: 'yes') } %> + <% end %> +
+
+
+
diff --git a/app/views/legislation/proposals/_refresh_flag_actions.js.erb b/app/views/legislation/proposals/_refresh_flag_actions.js.erb new file mode 100644 index 000000000..0e20636ae --- /dev/null +++ b/app/views/legislation/proposals/_refresh_flag_actions.js.erb @@ -0,0 +1 @@ +$("#<%= dom_id(@proposal) %> .js-flag-actions").html('<%= j render("proposals/flag_actions", proposal: @proposal) %>'); diff --git a/app/views/legislation/proposals/_retired.html.erb b/app/views/legislation/proposals/_retired.html.erb new file mode 100644 index 000000000..2167b14af --- /dev/null +++ b/app/views/legislation/proposals/_retired.html.erb @@ -0,0 +1,13 @@ + + + +<% if params[:retired].blank? %> +

<%= link_to t("proposals.index.retired_proposals_link"), proposals_path(retired: 'all'), class: "small" %>

+<% else %> + +<% end %> diff --git a/app/views/legislation/proposals/_votes.html.erb b/app/views/legislation/proposals/_votes.html.erb new file mode 100644 index 000000000..fb41357af --- /dev/null +++ b/app/views/legislation/proposals/_votes.html.erb @@ -0,0 +1,66 @@ +
+
+ + + <%= supports_percentage(proposal) %> / <%= t("proposals.proposal.total_percent") %> + +
+ + + <%= t("proposals.proposal.supports", count: proposal.total_votes) %>  + + "> + <%= t("proposals.proposal.supports_necessary", number: number_with_delimiter(Proposal.votes_needed_for_success)) %> + + + + +
+ <% if voted_for?(@proposal_votes, proposal) %> +
+ <%= t("proposals.proposal.already_supported") %> +
+ <% elsif user_signed_in? && proposal.votable_by?(current_user) %> + <%= link_to vote_url, + class: "button button-support small expanded", + title: t('proposals.proposal.support_title'), method: "post", remote: true do %> + <%= t("proposals.proposal.support") %> + <% end %> + <% else %> +
+ <%= t("proposals.proposal.support") %> +
+ <% end %> +
+ + <% if user_signed_in? && current_user.organization? %> + + <% elsif user_signed_in? && !proposal.votable_by?(current_user) %> +
+ +
+ <% elsif !user_signed_in? %> +
+ +
+ <% end %> + + <% if voted_for?(@proposal_votes, proposal) && setting['twitter_handle'] %> + + <% end %> +
diff --git a/app/views/legislation/proposals/edit.html.erb b/app/views/legislation/proposals/edit.html.erb new file mode 100644 index 000000000..6e5b14a08 --- /dev/null +++ b/app/views/legislation/proposals/edit.html.erb @@ -0,0 +1,14 @@ +
+ +
+ <%= back_link_to %> + +
+ <%= link_to t("proposals.edit.show_link"), @proposal %> +
+ +

<%= t("proposals.edit.editing") %>

+ + <%= render "form", form_url: proposal_url(@proposal) %> +
+
diff --git a/app/views/legislation/proposals/index.html.erb b/app/views/legislation/proposals/index.html.erb new file mode 100644 index 000000000..69a8df4a3 --- /dev/null +++ b/app/views/legislation/proposals/index.html.erb @@ -0,0 +1,102 @@ +<% provide :title do %><%= t('proposals.index.title') %><% end %> +<% content_for :header_addon do %> + <%= render "shared/search_form", + search_path: proposals_path(page: 1), + i18n_namespace: "proposals.index.search_form" %> +<% end %> +<% content_for :canonical do %> + <%= render "shared/canonical", href: proposals_url %> +<% end %> + +
+ <% if @search_terms || @advanced_search_terms || @tag_filter || params[:retired].present? %> +
+
+
+ <% if @search_terms || @advanced_search_terms %> +

<%= t("shared.search_results") %>

+

+ <%= page_entries_info @proposals %> + <% if !@advanced_search_terms %> + <%= t("proposals.index.search_results_html", count: @proposals.size, search_term: @search_terms) %> + <% end %> +

+ <% elsif @tag_filter %> +

<%= t("shared.search_results") %>

+

+ <%= page_entries_info @proposals %> + <%= t("proposals.index.filter_topic", count: @proposals.size, topic: @tag_filter) %> +

+ <% elsif params[:retired].present? %> +

<%= t("proposals.index.retired_proposals") %>

+ <% end %> +
+
+
+ <% else %> + <%= render "shared/section_header", i18n_namespace: "proposals.index.section_header", image: "proposals" %> + <% end %> + +
+
+ + <% if has_banners? %> + <%= render "shared/banner" %> + <% end %> + + <% if @featured_proposals.present? %> + + <% end %> + + <%= render("shared/advanced_search", search_path: proposals_path(page: 1)) unless params[:retired].present? %> + + <%= render 'shared/order_links', i18n_namespace: "proposals.index" %> + + <% if @proposals.any? %> +
+ <%= link_to t("proposals.index.start_proposal"), new_proposal_path, class: 'button expanded' %> +
+ <% end %> + +
+ <%= render partial: 'proposals/proposal', collection: @proposals %> + <%= paginate @proposals %> + + <% unless @search_terms || @advanced_search_terms || @tag_filter %> +
+

+ <%= t("proposals.index.section_footer.title") %> +

+

<%= t("proposals.index.section_footer.help_text_1") %>

+

<%= t("proposals.index.section_footer.help_text_2", + org: link_to(setting['org_name'], new_user_registration_path)).html_safe %>

+

<%= t("proposals.index.section_footer.help_text_3") %>

+
+ <% end %> +
+
+ +
+ +
+ +
+
diff --git a/app/views/legislation/proposals/map.html.erb b/app/views/legislation/proposals/map.html.erb new file mode 100644 index 000000000..84c7721f2 --- /dev/null +++ b/app/views/legislation/proposals/map.html.erb @@ -0,0 +1 @@ +<%= render 'shared/map', new_url_path: new_proposal_path %> diff --git a/app/views/legislation/proposals/new.html.erb b/app/views/legislation/proposals/new.html.erb new file mode 100644 index 000000000..95249e36e --- /dev/null +++ b/app/views/legislation/proposals/new.html.erb @@ -0,0 +1,24 @@ +
+ +
+ <%= back_link_to %> + +

<%= t("proposals.new.start_new") %>

+
+ <%= link_to more_info_path(anchor: "proposals") ,title: t('shared.target_blank_html'), target: "_blank" do %> + <%= t("proposals.new.more_info")%> + <% end %> +
+ <%= render "proposals/form", form_url: proposals_url %> +
+ +
+ +

<%= t("proposals.new.recommendations_title") %>

+
    +
  • <%= t("proposals.new.recommendation_one") %>
  • +
  • <%= t("proposals.new.recommendation_two") %>
  • +
  • <%= t("proposals.new.recommendation_three") %>
  • +
+
+
diff --git a/app/views/legislation/proposals/retire_form.html.erb b/app/views/legislation/proposals/retire_form.html.erb new file mode 100644 index 000000000..d56277cb3 --- /dev/null +++ b/app/views/legislation/proposals/retire_form.html.erb @@ -0,0 +1,38 @@ +
+ +
+ +

<%= t("proposals.retire_form.title") %>

+ +

<%= link_to @proposal.title, @proposal %>

+ +
+ <%= t("proposals.retire_form.warning") %> +
+ + <%= form_for(@proposal, url: retire_proposal_path(@proposal)) do |f| %> + <%= render 'shared/errors', resource: @proposal %> +
+
+ <%= f.label :retired_reason, t("proposals.retire_form.retired_reason_label") %> + <%= f.select :retired_reason, retire_proposals_options, {include_blank: t("proposals.retire_form.retired_reason_blank"), label: false} %> +
+
+ +
+
+ <%= f.label :retired_explanation, t("proposals.retire_form.retired_explanation_label") %> + <%= f.text_area :retired_explanation, rows: 4, maxlength: 500, label: false, + placeholder: t('proposals.retire_form.retired_explanation_placeholder') %> +
+
+ +
+
+ <%= f.submit(class: "button expanded", value: t("proposals.retire_form.submit_button")) %> +
+
+ <% end %> + +
+
\ No newline at end of file diff --git a/app/views/legislation/proposals/share.html.erb b/app/views/legislation/proposals/share.html.erb new file mode 100644 index 000000000..f86882401 --- /dev/null +++ b/app/views/legislation/proposals/share.html.erb @@ -0,0 +1,51 @@ +<% provide :title do %><%= @proposal.title %><% end %> +<% provide :social_media_meta_tags do %> +<%= render "shared/social_media_meta_tags", + social_url: proposal_url(@proposal), + social_title: @proposal.title, + social_description: @proposal.summary %> +<% end %> +<% content_for :canonical do %> + <%= render "shared/canonical", href: proposal_url(@proposal) %> +<% end %> + +<% cache [locale_and_user_status(@proposal), @proposal, @proposal.author, Flag.flagged?(current_user, @proposal), @proposal_votes] do %> +
+
+
+ +

<%= t("proposals.proposal.created") %>

+ +

+ <%= t("proposals.proposal.share.guide") %>
+ <%= t("proposals.proposal.share.edit") %> +

+ + <%= render partial: 'shared/social_share', locals: { + title: @proposal.title, + url: proposal_url(@proposal) + } %> + + <% if @proposal_improvement_path.present? %> +
+

<%= t("proposals.proposal.improve_info") %>

+ <%= link_to t("proposals.proposal.improve_info_link"), @proposal_improvement_path, class: "button" %> +
+ <% end %> + +
+ <%= link_to t("proposals.proposal.share.view_proposal"), proposal_path(@proposal) %> +
+
+ +
+
+

+ <%= @proposal.title %>
+ <%= t("proposals.show.code") %> <%= @proposal.code %> +

+
+
+
+
+<% end %> diff --git a/app/views/legislation/proposals/show.html.erb b/app/views/legislation/proposals/show.html.erb new file mode 100644 index 000000000..1dc918e8e --- /dev/null +++ b/app/views/legislation/proposals/show.html.erb @@ -0,0 +1,183 @@ +<% provide :title do %><%= @proposal.title %><% end %> +<% content_for :meta_description do %><%= @proposal.summary %><% end %> +<% provide :social_media_meta_tags do %> +<%= render "shared/social_media_meta_tags", + social_url: proposal_url(@proposal), + social_title: @proposal.title, + social_description: @proposal.summary %> +<% end %> +<% content_for :canonical do %> + <%= render "shared/canonical", href: proposal_url(@proposal) %> +<% end %> + +<% cache [locale_and_user_status(@proposal), @proposal, @proposal.author, Flag.flagged?(current_user, @proposal), @proposal_votes] do %> +
+
+
+ <%= 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' %> + <% end %> + + <% if current_user && @proposal.editable_by?(current_user) %> + <%= link_to edit_proposal_path(@proposal), class: 'edit-proposal button hollow float-right' do %> + <%= t("proposals.show.edit_proposal_link") %> + <% end %> + <% end %> + +

<%= @proposal.title %>

+ <% if @proposal.retired? %> +
+ + <%= t("proposals.show.retired_warning") %>
+ <%= link_to t("proposals.show.retired_warning_link_to_explanation"), "#retired_explanation" %> +
+
+ <% elsif @proposal.conflictive? %> +
+ <%= t("proposals.show.flag") %> +
+ <% end %> + +
+ <%= render '/shared/author_info', resource: @proposal %> + +  •  + <%= l @proposal.created_at.to_date %> +  •  +   + <%= link_to t("proposals.show.comments", count: @proposal.comments_count), "#comments" %> + + <% if current_user %> +  •  + <%= render 'proposals/flag_actions', proposal: @proposal %> + <% end %> + +
+ +
+

+ <%= t("proposals.show.code") %> + <%= @proposal.code %> +

+ +
<%= @proposal.summary %>
+ + <% if @proposal.video_url.present? %> +
+
+
+
+
+ <% end %> + + <%= safe_html_with_links @proposal.description %> + + <% if @proposal.external_url.present? %> + + <% end %> + + <% if @proposal.video_url.present? %> + + + <% end %> + +

<%= @proposal.question %>

+ + <% if @proposal.retired? %> +
+

<%= t('proposals.show.retired') %>: <%= t("proposals.retire_options.#{@proposal.retired_reason}") unless @proposal.retired_reason == 'other' %>

+ <%= simple_format text_with_links(@proposal.retired_explanation), {}, sanitize: false %> +
+ <% end %> + + <%= render 'shared/tags', taggable: @proposal %> + + <%= render 'shared/geozone', geozonable: @proposal %> + +
+ <%= render 'proposals/actions', proposal: @proposal %> +
+
+ + +
+
+<% end %> + +
+ <%= render "proposals/filter_subnav" %> + <%= render "proposals/notifications" %> + +
+ <%= render "proposals/comments" %> +
+ +
+ <%= render 'documents/documents', + documents: @proposal.documents, + max_documents_allowed: Proposal.max_documents_allowed %> +
+
diff --git a/app/views/legislation/proposals/suggest.js.erb b/app/views/legislation/proposals/suggest.js.erb new file mode 100644 index 000000000..819af2b16 --- /dev/null +++ b/app/views/legislation/proposals/suggest.js.erb @@ -0,0 +1 @@ +<%= render "shared/suggest" %> \ No newline at end of file diff --git a/app/views/legislation/proposals/summary.html.erb b/app/views/legislation/proposals/summary.html.erb new file mode 100644 index 000000000..a28cf8750 --- /dev/null +++ b/app/views/legislation/proposals/summary.html.erb @@ -0,0 +1,53 @@ +
+
+
+ <%= back_link_to %> + + <% @proposals.each do |group_name, proposals| %> +
+

<%= group_name %>

+ + <% proposals[0..2].each do |proposal| %> +
+
+
+
+
+

<%= link_to proposal.title, namespaced_proposal_path(proposal) %>

+ +

+ <% if proposal.author.hidden? || proposal.author.erased? %> + <%= t("proposals.show.author_deleted") %> + <% else %> + <%= proposal.author.name %> + <% if proposal.author.display_official_position_badge? %> + + <%= proposal.author.official_position %> + + <% end %> + <% end %> +

+ +
+

<%= proposal.summary %>

+
+
+
+
+
+
+ <% end %> +
+ <% end %> +
+ +
+ +
+
+
\ No newline at end of file diff --git a/app/views/legislation/proposals/vote.js.erb b/app/views/legislation/proposals/vote.js.erb new file mode 100644 index 000000000..4a5ca6b6b --- /dev/null +++ b/app/views/legislation/proposals/vote.js.erb @@ -0,0 +1 @@ +$("#<%= dom_id(@proposal) %>_votes").html('<%= j render("proposals/votes", proposal: @proposal) %>'); \ No newline at end of file diff --git a/app/views/legislation/proposals/vote_featured.js.erb b/app/views/legislation/proposals/vote_featured.js.erb new file mode 100644 index 000000000..52619282b --- /dev/null +++ b/app/views/legislation/proposals/vote_featured.js.erb @@ -0,0 +1 @@ +$("#<%= dom_id(@proposal) %>_votes").html('<%= j render("proposals/featured_votes", proposal: @proposal) %>'); \ No newline at end of file diff --git a/config/locales/es/legislation.yml b/config/locales/es/legislation.yml index 454422046..2e8b6e201 100644 --- a/config/locales/es/legislation.yml +++ b/config/locales/es/legislation.yml @@ -86,6 +86,7 @@ es: draft_publication_date: Publicación borrador allegations_dates: Alegaciones result_publication_date: Publicación resultados + proposals_dates: Propuestas questions: comments: comment_button: Publicar respuesta