From 7bba30824592035c20e09e04cda2f3f27171ec67 Mon Sep 17 00:00:00 2001 From: moustachu Date: Mon, 6 Apr 2020 12:51:55 +0200 Subject: [PATCH] Squashed commit of the following: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit 11c979a37518a95f2a5f107ab298772c35051438 Author: Sébastien Moret <51788811+MoretS@users.noreply.github.com> Date: Thu Apr 2 13:01:22 2020 +0200 Improve accessibility issues (#5684) * add alt element to logo and add new translation key logo_alt * Add label and title elements to topbar_search * Add alt attribute to author avatar images * Reformat elements heading on homepage * Add aria-label element to off-canvas nav button * Adding screen-reader title to images card links on homepage * Add temporary submit button to search topbar * Add button custo to topbar__search class * Add alt attribute to links and images * Modify muted color contrast * Remove h6 attribute and class from legend element in filter section and replace with mini-title class * Add img role attribute to Decidim icons * Remove role img attrbute from follow button * Modify search topbar submit button * Replace div tag with a nav tag for user menu * Unify main and mini footer background color * Add title to notifications link and conversations link in user menu * Modify secondary color to better contrast in Decidim * Update search topbar to align with submit button * Change primary color to better contrast * Add title attribute to topbar search submit button * Add label to select_area form * Add accessibility to budgets filter forms * Add accessibility to debates filter forms * Add accessibility to meetings filter forms * Add accessibility to accountability search form * Add accessibility to proposals filter forms * Add accessibility to sortitions filter forms * Add translation to cloud-download button * Add title to download link button * Add alt element to assemblies members avatar * Add accessibility to initiatives filter forms * Add accessibility to consultations search form * Add alt attribute to conferences logo partners * Add alt attribute to conferences speaker images * Add alt attribute to conferences media pictures * Add underline text-decoration to links * Add screen reader span to social media links on homepage * Add title attribute and aria_label * Add title attribute to search form * Add title attribute and aria_label * Replace tag with tag and add styling * Add label tag to search form field * Delete title from social media icons * Delete title from share link button * Replace last activity heading card title h5 to h4 * Fix position error with close tag * Modify all platform's heading * Add title to terms and conditions link * Modify cards tabindex on homepage * Remove h6 tag from upcoming meetings card * Redesign of the platform's heading html attributes * Add title to see_all_assemblies button * Add aria_label attribute to read_more button * Add aria_label to number_per_page link * Add aria_label to first_page link * Add aria_label to last_page link * Add aria_label to next_page link * Add aria_label to previous_page link * Add aria_label to comments_count * Add aria_label to endorsements_count * Add aria_label to page_number * Add aria_label to comments link on proposal page * Replace heading with span attribute for card title on last_activity page * Replace all h4 card__title with span attribute * Add explicit titles to home page link buttons * Change calendar_url heading title * Modify heading of proposal page * Modify heading of title action results count * Add href attribute to Cancel link on scope picker * Add href attribute to order and resut_per_page links * Replace attribute with for download_data links on processes * Include existing tag in the
tag * Remove
tag from remember_me checkbox on sign_in page * Modify title of assemblies social network links * Add title attribute to proposal comments/endorsements counter links * Add title attribute to calendar URL field for meetings * Add title attribute to results_per_page link * Add translations for result_per_page and pagination links titles * Add title attrbute to pagination links * Add title attribute to navigation links for pagination * Add title attribute to each
  • results_per page links in diff --git a/decidim-proposals/app/views/decidim/proposals/admin/proposals/bulk_actions/_publish_answers.html.erb b/decidim-proposals/app/views/decidim/proposals/admin/proposals/bulk_actions/_publish_answers.html.erb new file mode 100644 index 0000000000000..958e4b9a99183 --- /dev/null +++ b/decidim-proposals/app/views/decidim/proposals/admin/proposals/bulk_actions/_publish_answers.html.erb @@ -0,0 +1,14 @@ +
    + <%= form_tag(publish_answers_proposals_path, method: :post, remote: true, id: "js-form-publish-answers", class: "flex--cc flex-gap--1") do %> +
    + <% proposals.each do |proposal| %> + <%= check_box_tag "proposal_ids[]", proposal.id, false, class: "js-check-all-proposal js-proposal-id-#{proposal.id}" %> + <% end %> +
    +

    <%= t("decidim.proposals.admin.proposals.publish_answers.number_of_proposals", number: '').html_safe %>

    + + <%= submit_tag(t("decidim.proposals.admin.proposals.index.publish"), id: "js-submit-publish-answers", class: "button small button--simple float-left") %> + + + <% end %> +
    diff --git a/decidim-proposals/app/views/decidim/proposals/admin/proposals/bulk_actions/_scope-change.html.erb b/decidim-proposals/app/views/decidim/proposals/admin/proposals/bulk_actions/_scope-change.html.erb new file mode 100644 index 0000000000000..c20fb79d233c4 --- /dev/null +++ b/decidim-proposals/app/views/decidim/proposals/admin/proposals/bulk_actions/_scope-change.html.erb @@ -0,0 +1,25 @@ +
    + <%= form_tag(update_scope_proposals_path, method: :post, remote: true, id: "js-form-scope-change-proposals", class: "flex--cc flex-gap--1") do %> +
    + <% proposals.each do |proposal| %> + <%= check_box_tag "proposal_ids[]", proposal.id, false, class: "js-check-all-proposal js-proposal-id-#{proposal.id}" %> + <% end %> +
    + + <%= scopes_picker_tag( + :scope_id, + try(:current_participatory_space)&.scope, + field: t("models.proposal.fields.scope", scope: "decidim.proposals") + ) %> + + <%= submit_tag( + t("decidim.proposals.admin.proposals.index.update_scope_button"), + id: "js-submit-scope-change-proposals", + class: "button small button--simple float-left" + ) %> + + + <% end %> +
    diff --git a/decidim-proposals/app/views/decidim/proposals/admin/proposals/bulk_actions/_unassign_from_valuator.html.erb b/decidim-proposals/app/views/decidim/proposals/admin/proposals/bulk_actions/_unassign_from_valuator.html.erb new file mode 100644 index 0000000000000..c54d7b30af3b0 --- /dev/null +++ b/decidim-proposals/app/views/decidim/proposals/admin/proposals/bulk_actions/_unassign_from_valuator.html.erb @@ -0,0 +1,15 @@ +
    + <%= form_tag(valuation_assignment_path, method: :delete, id: "js-form-unassign-proposals-from-valuator", class: "flex--cc flex-gap--1") do %> +
    + <% proposals.each do |proposal| %> + <%= check_box_tag "proposal_ids[]", proposal.id, false, class: "js-check-all-proposal js-proposal-id-#{proposal.id}" %> + <% end %> +
    + + <%= bulk_valuators_select(current_participatory_space, t("decidim.proposals.admin.proposals.index.unassign_from_valuator")) %> + + <%= submit_tag(t("decidim.proposals.admin.proposals.index.unassign_from_valuator_button"), id: "js-submit-unassign-proposals-from-valuator", class: "button small button--simple float-left") %> + + + <% end %> +
    diff --git a/decidim-proposals/app/views/decidim/proposals/admin/proposals/index.html.erb b/decidim-proposals/app/views/decidim/proposals/admin/proposals/index.html.erb index d8df086120171..f19a4abe6be5f 100644 --- a/decidim-proposals/app/views/decidim/proposals/admin/proposals/index.html.erb +++ b/decidim-proposals/app/views/decidim/proposals/admin/proposals/index.html.erb @@ -37,6 +37,12 @@ <%= sort_link(query, :state, [:state, :is_emendation], t("models.proposal.fields.state", scope: "decidim.proposals") ) %> + <% unless current_settings.publish_answers_immediately? %> + + <%= sort_link(query, :state_published, t("models.proposal.fields.published_answer", scope: "decidim.proposals") ) %> + + <% end %> + <% if current_settings.votes_enabled? %> <%= sort_link(query, :proposal_votes_count, t("models.proposal.fields.votes", scope: "decidim.proposals") ) %> @@ -49,11 +55,13 @@ <% end %> - <% if allowed_to? :create, :proposal_note %> - - <%= sort_link(query, :proposal_notes_count, t("models.proposal.fields.notes", scope: "decidim.proposals") ) %> - - <% end %> + + <%= sort_link(query, :proposal_notes_count, t("models.proposal.fields.notes", scope: "decidim.proposals") ) %> + + + + <%= sort_link(query, :valuation_assignments_count, t("models.proposal.fields.valuators", scope: "decidim.proposals") ) %> + <%= sort_link(query, :published_at, t("models.proposal.fields.published_at", scope: "decidim.proposals") ) %> diff --git a/decidim-proposals/app/views/decidim/proposals/admin/proposals/publish_answers.js.erb b/decidim-proposals/app/views/decidim/proposals/admin/proposals/publish_answers.js.erb new file mode 100644 index 0000000000000..a427f9534882d --- /dev/null +++ b/decidim-proposals/app/views/decidim/proposals/admin/proposals/publish_answers.js.erb @@ -0,0 +1,12 @@ +$("<%= escape_javascript(render partial: %q{js-callout}, locals: { css: %q{success}, text: flash.now[:notice] }) %>").appendTo(".callout-wrapper"); + +<% proposal_ids.each do |id| %> + $(".table-list [data-id='<%= id %>']") + .replaceWith("<%= escape_javascript(render partial: %q{proposal-tr}, locals: { proposal: proposal_find(id) }) %>"); +<% end %> + +$(".js-check-all").prop('checked', false); +$(".js-check-all-proposal").prop('checked', false); +window.hideBulkActionForms() +window.showOtherActionsButtons(); +window.selectedProposalsCountUpdate(); diff --git a/decidim-proposals/app/views/decidim/proposals/admin/proposals/show.html.erb b/decidim-proposals/app/views/decidim/proposals/admin/proposals/show.html.erb index 3c2d22625a5a5..e9ea59aeb4c7c 100644 --- a/decidim-proposals/app/views/decidim/proposals/admin/proposals/show.html.erb +++ b/decidim-proposals/app/views/decidim/proposals/admin/proposals/show.html.erb @@ -35,7 +35,7 @@
    - <%= t ".body" %>: <%= simple_format(present(proposal).body(strip_tags: true)) %> + <%= t ".body" %>: <%= simple_format(present(proposal).body(strip_tags: true)) %>
    @@ -51,7 +51,7 @@
    - <%= t ".endorsements_count" %>: <%= proposal.proposal_endorsements_count %> + <%= t ".endorsements_count" %>: <%= proposal.endorsements_count %>
    @@ -138,10 +138,49 @@
    -<% if allowed_to?(:create, :proposal_note) %> +<% if proposal.valuators.any? %> +
    +
    +

    + <%= t ".valuators" %> +

    +
    + +
    +
    + <%= t ".assigned_valuators" %>: +
      + <% proposal.valuation_assignments.each do |assignment| %> + <% presented_valuator = present(assignment.valuator) %> +
    • + <%= link_to( + presented_valuator.name, + presented_valuator.profile_path, + target: :blank + ) %> + + <% if allowed_to? :unassign_from_valuator, :proposals, valuator: assignment.valuator %> + <%= icon_link_to( + "circle-x", + proposal_valuation_assignment_path(proposal, assignment.valuator_role), + t(".remove_assignment"), + method: :delete, + data: { confirm: t(".remove_assignment_confirmation") }, + class: "red-icon" + ) %> + <% end %> +
    • + <% end %> +
    +
    +
    +
    +<% end %> + +<% if allowed_to?(:create, :proposal_note, proposal: proposal) %> <%= render "decidim/proposals/admin/proposal_notes/proposal_notes" %> <% end %> -<% if allowed_to?(:create, :proposal_answer) && !proposal.emendation? %> +<% if allowed_to?(:create, :proposal_answer, proposal: proposal) && !proposal.emendation? %> <%= render "decidim/proposals/admin/proposal_answers/form" %> <% end %> diff --git a/decidim-proposals/app/views/decidim/proposals/admin/proposals/update_category.js.erb b/decidim-proposals/app/views/decidim/proposals/admin/proposals/update_category.js.erb index 7083196c92418..d749876c1f81b 100644 --- a/decidim-proposals/app/views/decidim/proposals/admin/proposals/update_category.js.erb +++ b/decidim-proposals/app/views/decidim/proposals/admin/proposals/update_category.js.erb @@ -11,7 +11,7 @@ <% if flash.now[:notice].present? %> $("<%= escape_javascript(render partial: %q{js-callout}, locals: { css: %q{success}, text: flash.now[:notice] }) %>").appendTo(".callout-wrapper"); - <% @proposal_ids.each do |id| %> + <% proposal_ids.each do |id| %> $(".table-list [data-id='<%= id %>']") .replaceWith("<%= escape_javascript(render partial: %q{proposal-tr}, locals: { proposal: proposal_find(id) }) %>"); <% end %> @@ -19,7 +19,8 @@ $("#js-form-recategorize-proposals #category_id").removeClass("is-invalid-input") $(".js-check-all").prop('checked', false); $(".js-check-all-proposal").prop('checked', false); - window.hideRecategorizeProposalActions() + window.hideBulkActionsButton(); + window.hideBulkActionForms(); window.showOtherActionsButtons(); window.selectedProposalsCountUpdate(); <% end %> diff --git a/decidim-proposals/app/views/decidim/proposals/admin/proposals/update_scope.js.erb b/decidim-proposals/app/views/decidim/proposals/admin/proposals/update_scope.js.erb new file mode 100644 index 0000000000000..4e963741ad9f4 --- /dev/null +++ b/decidim-proposals/app/views/decidim/proposals/admin/proposals/update_scope.js.erb @@ -0,0 +1,27 @@ +<% if flash.now[:error].present? %> + $("#js-form-scope-change-proposals #scope_id").addClass("is-invalid-input") + $("<%= escape_javascript(render partial: %q{js-callout}, locals: { css: %q{alert}, text: flash.now[:error] }) %>").appendTo(".callout-wrapper"); +<% end %> + +<% if flash.now[:alert].present? %> + $("#js-form-scope-change-proposals #scope_id").removeClass("is-invalid-input") + $("<%= escape_javascript(render partial: %q{js-callout}, locals: { css: %q{warning}, text: flash.now[:alert] }) %>").appendTo(".callout-wrapper"); +<% end %> + +<% if flash.now[:notice].present? %> + $("<%= escape_javascript(render partial: %q{js-callout}, locals: { css: %q{success}, text: flash.now[:notice] }) %>").appendTo(".callout-wrapper"); + + <% @proposal_ids.each do |id| %> + $(".table-list [data-id='<%= id %>']") + .replaceWith("<%= escape_javascript(render partial: %q{proposal-tr}, locals: { proposal: proposal_find(id) }) %>"); + <% end %> + + $("#js-form-scope-change-proposals #scope_id").removeClass("is-invalid-input") + $(".js-check-all").prop('checked', false); + $(".js-check-all-proposal").prop('checked', false); + + window.hideBulkActionForms(); + window.hideBulkActionsButton(); + window.showOtherActionsButtons(); + window.selectedProposalsCountUpdate(); +<% end %> diff --git a/decidim-proposals/app/views/decidim/proposals/collaborative_drafts/_filters.html.erb b/decidim-proposals/app/views/decidim/proposals/collaborative_drafts/_filters.html.erb index cde8136b3e2a8..ed43600e46e67 100644 --- a/decidim-proposals/app/views/decidim/proposals/collaborative_drafts/_filters.html.erb +++ b/decidim-proposals/app/views/decidim/proposals/collaborative_drafts/_filters.html.erb @@ -2,10 +2,10 @@
    @@ -67,8 +70,7 @@ @@ -86,7 +88,9 @@ @@ -140,9 +147,18 @@ amb més espai.

    -
    -
    -
    -
    -
    - - <%= image_tag "demo-avatar.jpg" %> - - - Ajuntament de Barcelona +
    +
    + + + +
    +
    +
    -
    -

    Quan sento parlar de contaminació acústica, penso que no hi ha - veïns en tota la ciutat més perjudicats que nosaltres, els que vivim - al Pg de la Vall d'Hebron des del 198 al 208. Per no parlar de la - contaminació atmosfèrica, els tubs d'escapament dels vehicles - gairabé s'evacuarien directament al nostre menjador si no fos que - mantenim les finestres i terrasses tencades de manera permanent.

    -
    -
    -
    -
    -
    - -
    - <%= partial "flag_empty" %> + -
    -
    -

    Al meu entendre, en l'actualitat es requereix un ús provisional per - al solar d'Avinguda Piferrer (Gràcia). Per aquest motiu, considero - que provisionalment es podria oferir l'espai als memebres del Banc - Expropiat. Hem d'aturar aquest conflicte. L'institut Vallcarca es - absolutament necessàri, pero aquesta resposta immediata podria tenir - un fort impacte en la pau social del barri, sense representar una - demóra sustancial en la construcció de l'institut.

    -
    - -
    +
    +
    -
    -

    Quan sento parlar de contaminació acústica, penso que no hi ha veïns - en tota la ciutat més perjudicats que nosaltres, els que vivim al Pg - de la Vall d'Hebron des del 198 al 208. Per no parlar de la - contaminació atmosfèrica, els tubs d'escapament dels vehicles gairabé - s'evacuarien directament al nostre menjador si no fos que mantenim les - finestres i terrasses tencades de manera permanent.

    -
    - -
    -
    -
    -
    - -
    - <%= partial "flag_empty" %> +
    +
    +

    Al meu entendre, en l'actualitat es requereix un ús provisional per + al solar d'Avinguda Piferrer (Gràcia). Per aquest motiu, considero + que provisionalment es podria oferir l'espai als memebres del Banc + Expropiat. Hem d'aturar aquest conflicte. L'institut Vallcarca es + absolutament necessàri, pero aquesta resposta immediata podria tenir + un fort impacte en la pau social del barri, sense representar una + demóra sustancial en la construcció de l'institut.

    +
    + -
    -
    -

    Quan sento parlar de contaminació acústica, penso que no hi ha veïns - en tota la ciutat més perjudicats que nosaltres, els que vivim al Pg - de la Vall d'Hebron des del 198 al 208. Per no parlar de la - contaminació atmosfèrica, els tubs d'escapament dels vehicles gairabé - s'evacuarien directament al nostre menjador si no fos que mantenim les - finestres i terrasses tencades de manera permanent.

    -
    -
    -

    Quan sento parlar de contaminació acústica, penso que no hi ha - veïns tota la ciutat més perjudicats que nosaltres, els que vivim - al Pg la Vall d'Hebron des del 198 al 208. Per no parlar de la - contaminació atmosfèrica, els tubs d'escapament dels vehicles - gairabé s'evacuarien directament al nostre menjador si no fos que - mantenim les finestres i terrasses tencades de manera permanent.

    +

    Quan sento parlar de contaminació acústica, penso que no hi ha veïns + en tota la ciutat més perjudicats que nosaltres, els que vivim al Pg + de la Vall d'Hebron des del 198 al 208. Per no parlar de la + contaminació atmosfèrica, els tubs d'escapament dels vehicles gairabé + s'evacuarien directament al nostre menjador si no fos que mantenim les + finestres i terrasses tencades de manera permanent.

    +
    + +
    +

    Quan sento parlar de contaminació acústica, penso que no hi ha + veïns tota la ciutat més perjudicats que nosaltres, els que vivim + al Pg la Vall d'Hebron des del 198 al 208. Per no parlar de la + contaminació atmosfèrica, els tubs d'escapament dels vehicles + gairabé s'evacuarien directament al nostre menjador si no fos que + mantenim les finestres i terrasses tencades de manera permanent.

    +
    + +
    +
    + +
    -
    - -
    - -
    - +
    + diff --git a/decidim_app-design/app/views/public/partials/_last_activity.html.erb b/decidim_app-design/app/views/public/partials/_last_activity.html.erb index 337e52381b1c3..1fcede170dc5e 100644 --- a/decidim_app-design/app/views/public/partials/_last_activity.html.erb +++ b/decidim_app-design/app/views/public/partials/_last_activity.html.erb @@ -1,12 +1,14 @@ - <% 2.times do %>
    - <%= icon "blog", class: "primary" %> NUEVA PROPUESTA EN <%= link_to "Plan de Equipamentos de Nou Barris", page_path("meetings/meeting-view") %> + Nueva propuesta en <%= link_to "Plan de Equipamentos de Nou Barris", page_path("meetings/meeting-view") %>
    +
    + <%= partial "author_data", { timestamp: true, nick: false } %> +
    <%= link_to page_path("proposal-view"), class: "card__link" do %>
    @@ -17,23 +19,25 @@
    <% end %> - + <% 2.times do %>
    -
    -
    - Nuevo debate: - <%= link_to page_path("proposal-view"), class: "card__link" do %> - <%= Faker::StarWars.quote %> - <% end %> -
    -
    - En <%= link_to "Plan de Equipamentos de Nou Barris", page_path("meetings/meeting-view") %> + Nuevo comentario en <%= link_to "Plan de Equipamentos de Nou Barris", page_path("meetings/meeting-view") %>
    +
    + <%= partial "author_data", { timestamp: true, nick: false } %> +
    +
    + <%= link_to page_path("proposal-view"), class: "card__link" do %> +
    + <%= Faker::StarWars.quote %> +
    + <% end %> +
    <% end %> diff --git a/decidim_app-design/app/views/public/proposals/comment-view.html.erb b/decidim_app-design/app/views/public/proposals/comment-view.html.erb new file mode 100644 index 0000000000000..cf424a0b18fe0 --- /dev/null +++ b/decidim_app-design/app/views/public/proposals/comment-view.html.erb @@ -0,0 +1,86 @@ +<% +@title = "Comentario -- Decidim Barcelona" +@activesection = "processes" +@activepage = "proposals" +%> + +<%= partial "template_top" %> + +
    + <%= partial "process_header" %> +
    +
    +

    Cobriment de la Ronda de Dalt al seu pas per la Vall d'Hebrón

    + <%= partial "author_data", { extra: true } %> +
    +
    +
    +
    +
    + <%= partial "progress_bar", { vertical: true } %> + + <%= partial "adhesion_buttons", { status: "secondary" } %> +
    +
    + <%= partial "followme" %> + <%= partial "share" %> +
    + Referencia: BCN-2016-01-173 +
    +
    +
    +
    + Acceptada +

    + Millores en un conjunt de carrers dels barris del districte que + incorporin la renovació integral de les seves infraestructures + (voreres, accessibilitat, asfaltat, enllumenat, clavegueram, + arbrat, mobiliari urbà...), Interiors de Canyelles, Guineueta + i Aiguablava-Portlligat i Amilcar-Cartellà-Av. de Borbó-Maragall, + connexió del carrer Pedraforca amb Agudes, accessibilitat i + enllumenat a Renfe Meridiana, urbanització de Nou Pins, Mina de la + ciutat, Canfranc, Oristà i Almansa, pèrgola del Campillo de la + virgen i del parc de Serra Martí, redacció del projecte del + passeig de la Peira, reforma de les escales de Matagalls, millores + a l'Av. de Borbó i projecte d'intervenció a la Font Pla de + Fornells. Millores en el Parc de la Guineueta incloent un espai + d'aparells per a la gent gran. Estudi de la viabilitat tècnica + d'instal·lar escales mecàniques entre Ciutat Meridiana i Torre + Baró per millorar la connectivitat entre els dos barris o millora + de l'escala actual. Millores d'accessibilitat, arranjaments i + enllumenat en l'àmbit de Renfe Meridiana. Millores en la + urbanització per a l'accessibilitat d'acord amb les + particularitats orogràfiques al barri de Roquetes. +

    +
    +
    Arxivat a
    + +
    +
    +
    + <%= partial "related_actions" %> +
    +
    + <%= partial "related_meetings" %> +
    +
    +
    +
    + +
    +
    +
    +
    + <%= partial "comment-single" %> +
    +
    +
    +
    +
    + +<%= partial "template_bottom" %> diff --git a/docs/advanced/endorsable.md b/docs/advanced/endorsable.md new file mode 100644 index 0000000000000..9b316c90ee499 --- /dev/null +++ b/docs/advanced/endorsable.md @@ -0,0 +1,111 @@ +# Endorsable + +## Things can be endorsable + +`Endorsable` is a feature to allow participants to promote (reivindicate, etc.) resources in the platform to their followers. + +When endorsing an element the endorsements counter for this element is increased and a notification to all the followers of the participant is sent. + +Participants can endorse with their own identity or with the identify of the `user_groups` they belong to. Each endorsing identity on its own will increment the endorsements counter by one. + +## Data model + +A `decidim_endorsements` table registers each endorsement that each identity gives to each element. This is, one endorsable has many endorsements, and each endorsement belongs to one endorsable. +For performance, an endorsable has a counter cache of endorsements. + +``` ++----------------------+ +| Decidim::Endorsable | +| ((Proposal,...)) | +-------------+ ++----------------------+ 0..N +--------------------+ +--+Decidim::User| +|-has_many endorsements|-------+Decidim::Endorsement| | +-------------+ +|#counter cahce column | +--------------------+ | +|-endorsements_counter | |-author: may be a |<--+ ++----------------------+ | user or a | | + | user_group | | +------------------+ + +--------------------+ +--+Decidim::UserGroup| + +------------------+ +``` + +Thus, each endorsable must have the endorsements counter cache column. +This is an example migration to add the endorsements counter cache column to a resource: + +```ruby +class AddEndorsementsCounterCacheToProposals < ActiveRecord::Migration[5.2] + def change + add_column :decidim_proposals_proposals, :endorsements_count, :integer, null: false, default: 0 + end +end + +``` + +## Administration Panel + +It is a good practice to give the opportunity to the admin to switch Endorsements on and off. + +There are two switches that are normally defined in the manifest of the element in the following way: + +``` + settings.attribute :endorsements_enabled, type: :boolean, default: true + settings.attribute :endorsements_blocked, type: :boolean +``` + +- `endorsements_enabled`: when enabled endorsement functionality appears in the public views, when disabled, this functionality is hidden. +- `endorsements_blocked`: when blocked, the counter of endorsements is visible but no more endorsements can be added or withdrawn, the button is hidden. + +## Permissions + +In some cases, it may be interesting to require the user to be verified in order to be able to endorse. To do so, add the endorse action to the component manifest: +``` + component.actions = %w(endorse vote create withdraw amend) +``` + +Given that some settings have been defined in the Administration Panel, for the user to have permissions to endorse endorsements should be enabled and not blocked. + +## Public view + +### The "Endorse" buttons cell +It normally appears in the resource detail view (show). At the action card, in right-side of the view. +It allows users to endorse with any of their identities, the personal one, and/or their user_groups', if any. +It also shows the current number of endorsements for this resource. + +To render this button, `decidim-core` offers the `decidim/endorsement_buttons` cell. It is strongly recommended to use this cell to make new resources endorsable. + +```ruby +cell("decidim/endorsement_buttons", resource) +``` + +This cell, renders the endorsements counter and the endorsement button by default. But it has the possibility to be invoked to render elements sepparately. + +```ruby +# By default the `show` method is invoked as usual +# Renders `render_endorsements_count` and `render_endorsements_button` in a block. +cell("decidim/endorsement_buttons", resource) +# It is recommended to use the `endorsement_buttons_cell` helper method +endorsement_buttons_cell(resource) + +# Renders the "Endorse" button +# It takes into account: +# - if endorsements are enabled +# - if users are logged in +# - if users can endorse with many identities (of their user_groups) +# - if users require verification +endorsement_buttons_cell(resource).render_endorsements_button + +# Renders the counter of endorsements that appears in card. +endorsement_buttons_cell(resource).render_endorsements_count + +# Renders a button to perform the endorse action, but only with the personal identity of the user. It does not take into account if the user belongs to any user group. +endorsement_buttons_cell(resource).render_user_identity_endorse_button +``` + +### The list of endorsers + +The `Decidim::EndorsersListCell` renders the list of endorsers of a resource. It is usually rendered in the show of the resource, just upside the comments. + +```ruby +# to render the list of endorsers, the cell requires the endorsable resource, and the current user +cell "decidim/endorsers_list", resource +# or using the helper +endorsers_list_cell(resource) +``` \ No newline at end of file diff --git a/docs/customization/views.md b/docs/customization/views.md index 9ba03cd740ef7..2efea78512531 100644 --- a/docs/customization/views.md +++ b/docs/customization/views.md @@ -1,5 +1,33 @@ # Views (HTML) -If you want to add a new HTML page, you can do this by working as a regular Rails application. +As usual you should make some tests with the changes that you made and configure a Continuous Integration environment for checking that your overrides doesn't get removed with new decidim versions. -If you want to override a view or partial given by Decidim you can do this just by naming it with the same filename that you already have. +## Overrides + +To find what you need to change you'll need to make some detective work to find out which partial or view do you need to change. You can do so by: +* looking at your application log and finding the lines that start with "Rendered" +* inspecting with the web development tools of your browser, copying a special class and using `grep`, github search or your IDE search by multiple files to find out on which file this exists. + +### Filename method + +If you want to override a view or partial given by Decidim you can do this just by naming it with the same filename that you already have. On more details, if you want to change the social media icons on the footer, you can do so by looking at which file you need to change, copying that file to your application with the same filename and directory structure, and making your local changes. + +As an example, if I want to change the footer, you'd need to search for the file (on this case, it's on [`decidim-core/app/views/layouts/decidim/_mini_footer.html.erb`](https://github.com/decidim/decidim/blob/e181d7e67bdf915a3a8e58416c683f52346de047/decidim-core/app/views/layouts/decidim/_mini_footer.html.erb)), and copy that file to your own application on `app/views/layouts/decidim/_mini_footer.html.erb`). + +## Deface method + +You'll need the [`deface` gem](https://github.com/spree/deface) installed on your application, and follow their instructions on how to use the different overridign methods that they support. + +As an example, if you want to change the footer, you can do so by creating the file `app/overrides/layouts/decidim/_main_footer/pre_footer.html.erb.deface` with these contents: + +```html + +hello world +``` + +## New pages + +If you want to add a new HTML page, you can do this by working as a regular Rails application (ie, you can scaffold a new view and work with the HTML as usual). + +As an example of how to do this on Decidim Barcelona application, there's the [StaticController]( +https://github.com/AjuntamentdeBarcelona/decidim-barcelona/blob/d47d4a9ae6be26a0c5c4000907dda3c195579636/app/controllers/static_controller.rb) (main accountability section pages). You should inherit your controller from Decidim::ApplicationController. diff --git a/docs/development_guide.md b/docs/development_guide.md index 732a1868efaa6..b054617444ce9 100644 --- a/docs/development_guide.md +++ b/docs/development_guide.md @@ -30,6 +30,26 @@ Once created you are ready to: - `bin/rails s` +## Gitflow Branching model + +The Decidim respository follows the Gitflow branching model. There are good documentations on it at: + +- the original post: https://nvie.com/posts/a-successful-git-branching-model/ +- provided by Atlassian: https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow. + +This model introduces the `develop` branch as a kind of queue for new features to enter into the next release. + +In summary, Decidim developers that work on `feature/...` or `fix/...` branches will branch off from `develop` and must be merged back into `develop`. + +Then, to start a new feature branch off from `develop` in the following way: + +``` +git checkout develop +git checkout -b feature/xxx +``` + +Implement the feature, and open a Pull Request as normal, but against `develop` branch. As this is the most common operation, `develop` is the default branch instead of `master`. + ## During development When creating new migrations in Decidim's modules, you will need to "apply" this migrations to your development_app. The way to do this is by copying the migration from your module into the db/migrate dir of your development_app. Luckily we already have a script that automates this: it copies all missing migrations in development_app/db/migrate. The command is: @@ -38,6 +58,8 @@ When creating new migrations in Decidim's modules, you will need to "apply" this bin/rails decidim:upgrade ``` +Anyway we recommend re-creating your development_app every once in a while. + ## Useful commands ### erb-lint @@ -63,11 +85,12 @@ bundle exec i18n-tasks normalize --locales en ### JavaScript linter -We use JavaScript's lint library to ensure homogeneous formatting of JavaScrip code. +[eslint](https://eslint.org/docs/user-guide/command-line-interface) and [tslint](https://palantir.github.io/tslint/) are used to ensure homogeneous formatting of JavaScript code. + +To lint and try to fix linting errors, run: ```console -yarn install -yarn run lint --fix +npm run lint --fix ``` ### Stylelinter diff --git a/docs/getting_started.md b/docs/getting_started.md index 5286b930bb4c6..b80d9abb2af77 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -67,7 +67,7 @@ Then create a development application ```console d/bundle install d/rake development_app -d/rails server +d/rails server -b 0.0.0.0 ``` In general, to use the docker development environment, change any instruction in diff --git a/lib/decidim/gem_manager.rb b/lib/decidim/gem_manager.rb index ca749f4db2475..4f919401a1c9b 100644 --- a/lib/decidim/gem_manager.rb +++ b/lib/decidim/gem_manager.rb @@ -157,7 +157,7 @@ def root end def semver_friendly_version - version.gsub(/\.pre/, "-pre").gsub(/\.dev/, "-dev") + version.gsub(/\.pre/, "-pre").gsub(/\.dev/, "-dev").gsub(/.rc(\d*)/, "-rc\\1") end def version_file diff --git a/lib/decidim/version.rb b/lib/decidim/version.rb index a9e8285818ec0..6e04790b39ceb 100644 --- a/lib/decidim/version.rb +++ b/lib/decidim/version.rb @@ -3,6 +3,6 @@ # This holds the decidim version and the faker version it uses. module Decidim def self.version - "0.21.0.pre.dev" + "0.22.0.dev" end end diff --git a/logo.svg b/logo.svg index ba4de1072b17c..d381b7141bb68 100644 --- a/logo.svg +++ b/logo.svg @@ -1,130 +1 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 0c83b6caa5136..f489abac7b9e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "decidim", - "version": "0.21.0-pre-dev", + "version": "0.22.0-dev", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 1130a5dac1acd..bd0f0ca9cfb84 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "decidim", "description": "The participatory democracy framework", - "version": "0.21.0-pre-dev", + "version": "0.22.0-dev", "repository": { "url": "git@github.com:decidim/decidim.git", "type": "git" @@ -274,6 +274,7 @@ "uuid": "^3.2.1" }, "jest": { + "testURL": "https://decidim.dev/", "setupFiles": [ "raf/polyfill", "/decidim-admin/app/frontend/entry_test.ts",