From 456429f08b50b5a1a5364a09dfe7001c8a4d6a89 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Fri, 4 Aug 2017 20:43:07 +0200 Subject: [PATCH 01/64] adds shifts --- .../admin/poll/shifts_controller.rb | 53 +++++++++++++++++++ app/helpers/shifts_helper.rb | 23 ++++++++ app/models/poll.rb | 4 ++ app/models/poll/booth.rb | 1 + app/models/poll/shift.rb | 22 ++++++++ app/views/admin/poll/booths/_booth.html.erb | 3 ++ app/views/admin/poll/booths/index.html.erb | 1 + app/views/admin/poll/shifts/_shifts.html.erb | 24 +++++++++ app/views/admin/poll/shifts/new.html.erb | 46 ++++++++++++++++ config/locales/en/admin.yml | 29 ++++++---- config/locales/es/admin.yml | 29 ++++++---- config/routes.rb | 5 +- .../20170724190805_create_poll_shifts.rb | 15 ++++++ db/schema.rb | 14 ++++- 14 files changed, 245 insertions(+), 24 deletions(-) create mode 100644 app/controllers/admin/poll/shifts_controller.rb create mode 100644 app/helpers/shifts_helper.rb create mode 100644 app/models/poll/shift.rb create mode 100644 app/views/admin/poll/shifts/_shifts.html.erb create mode 100644 app/views/admin/poll/shifts/new.html.erb create mode 100644 db/migrate/20170724190805_create_poll_shifts.rb diff --git a/app/controllers/admin/poll/shifts_controller.rb b/app/controllers/admin/poll/shifts_controller.rb new file mode 100644 index 000000000..8a808a7a9 --- /dev/null +++ b/app/controllers/admin/poll/shifts_controller.rb @@ -0,0 +1,53 @@ +class Admin::Poll::ShiftsController < Admin::BaseController + + before_action :load_booth + before_action :load_polls + + def new + load_officers + load_shifts + @shift = ::Poll::Shift.new + end + + def create + @shift = ::Poll::Shift.new(shift_params) + if @shift.save + notice = t("admin.poll_shifts.flash.create") + redirect_to new_admin_booth_shift_path(@shift.booth), notice: notice + else + load_officers + load_shifts + render :new + end + end + + def destroy + @shift = Poll::Shift.find(params[:id]) + @shift.destroy + notice = t("admin.poll_shifts.flash.destroy") + redirect_to new_admin_booth_shift_path(@booth), notice: notice + end + + private + + def load_booth + @booth = ::Poll::Booth.find(params[:booth_id]) + end + + def load_polls + @polls = ::Poll.current_or_incoming + end + + def load_officers + @officers = ::Poll::Officer.all + end + + def load_shifts + @shifts = @booth.shifts + end + + def shift_params + params.require(:shift).permit(:booth_id, :officer_id, :date) + end + +end \ No newline at end of file diff --git a/app/helpers/shifts_helper.rb b/app/helpers/shifts_helper.rb new file mode 100644 index 000000000..37f22a3e2 --- /dev/null +++ b/app/helpers/shifts_helper.rb @@ -0,0 +1,23 @@ +module ShiftsHelper + + def shift_dates_select_options(polls) + options = [] + (start_date(polls)..end_date(polls)).each do |date| + options << [l(date, format: :long), l(date)] + end + options_for_select(options, params[:date]) + end + + def start_date(polls) + polls.map(&:starts_at).min.to_date + end + + def end_date(polls) + polls.map(&:ends_at).max.to_date + end + + def officer_select_options(officers) + officers.collect { |officer| [officer.name, officer.id] } + end + +end diff --git a/app/models/poll.rb b/app/models/poll.rb index 6d033f514..4ba313963 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -35,6 +35,10 @@ class Poll < ActiveRecord::Base ends_at < timestamp end + def self.current_or_incoming + current + incoming + end + def answerable_by?(user) user.present? && user.level_two_or_three_verified? && diff --git a/app/models/poll/booth.rb b/app/models/poll/booth.rb index c7fb63efc..9edbcbaf0 100644 --- a/app/models/poll/booth.rb +++ b/app/models/poll/booth.rb @@ -2,6 +2,7 @@ class Poll class Booth < ActiveRecord::Base has_many :booth_assignments, class_name: "Poll::BoothAssignment" has_many :polls, through: :booth_assignments + has_many :shifts validates :name, presence: true, uniqueness: true diff --git a/app/models/poll/shift.rb b/app/models/poll/shift.rb new file mode 100644 index 000000000..8ee646ea4 --- /dev/null +++ b/app/models/poll/shift.rb @@ -0,0 +1,22 @@ +class Poll + class Shift < ActiveRecord::Base + belongs_to :booth + belongs_to :officer + + validates :booth_id, presence: true + validates :officer_id, presence: true + validates :date, presence: true + validates :date, uniqueness: { scope: [:officer_id, :booth_id] } + + after_create :create_officer_assignments + + def create_officer_assignments + booth.booth_assignments.each do |booth_assignment| + attrs = { officer_id: officer_id, + date: date, + booth_assignment_id: booth_assignment.id } + Poll::OfficerAssignment.create!(attrs) + end + end + end + end \ No newline at end of file diff --git a/app/views/admin/poll/booths/_booth.html.erb b/app/views/admin/poll/booths/_booth.html.erb index 5732400a8..80b1ef38f 100644 --- a/app/views/admin/poll/booths/_booth.html.erb +++ b/app/views/admin/poll/booths/_booth.html.erb @@ -6,6 +6,9 @@ <%= booth.location %> + <%= link_to t("admin.booths.booth.shifts"), + new_admin_booth_shift_path(booth), + class: "button hollow" %> <%= link_to t("admin.actions.edit"), edit_admin_booth_path(booth), class: "button hollow" %> diff --git a/app/views/admin/poll/booths/index.html.erb b/app/views/admin/poll/booths/index.html.erb index 9618aec59..0dbb62cdf 100644 --- a/app/views/admin/poll/booths/index.html.erb +++ b/app/views/admin/poll/booths/index.html.erb @@ -16,6 +16,7 @@ <%= t("admin.booths.index.name") %> <%= t("admin.booths.index.location") %>   +   <% @booths.each do |booth| %> diff --git a/app/views/admin/poll/shifts/_shifts.html.erb b/app/views/admin/poll/shifts/_shifts.html.erb new file mode 100644 index 000000000..800c6944b --- /dev/null +++ b/app/views/admin/poll/shifts/_shifts.html.erb @@ -0,0 +1,24 @@ +

<%= t("admin.poll_shifts.new.assignments") %>

+ + + + + + + + + + <% @shifts.each do |shift| %> + + + + + + <% end %> + +
<%= t("admin.poll_shifts.new.date") %><%= t("admin.poll_shifts.new.officer") %><%= t("admin.poll_shifts.new.assignment") %>
<%= l(shift.date.to_date, format: :long) %><%= shift.officer.name %> + <%= link_to t("admin.poll_shifts.new.remove_assignment"), + admin_booth_shift_path(@booth, shift), + method: :delete, + class: "button hollow alert" %> +
diff --git a/app/views/admin/poll/shifts/new.html.erb b/app/views/admin/poll/shifts/new.html.erb new file mode 100644 index 000000000..c997dc35f --- /dev/null +++ b/app/views/admin/poll/shifts/new.html.erb @@ -0,0 +1,46 @@ +<%= back_link_to admin_booths_path %> + +

<%= @booth.name %>

+ +<%= form_for @shift, as: :shift, url: admin_booth_shifts_path do |f| %> + <%= render "shared/errors", resource: @shift %> + +
+ + <%= t("admin.poll_shifts.new.new_assignment") %> + + +
+ + <%= f.select :date, + shift_dates_select_options(@polls), + prompt: t("admin.poll_shifts.new.select_date"), + label: false %> +
+ +
+ + <%= f.select :officer_id, + officer_select_options(@officers), + prompt: t("admin.poll_shifts.new.select_officer"), + label: false %> +
+ + <%= f.hidden_field :booth_id, value: @booth.id %> + +
+ <%= f.submit t("admin.poll_shifts.new.add_assignment"), + class: "button expanded hollow margin-top" %> +
+
+<% end %> + +
+ <% if @shifts.empty? %> +
+ <%= t("admin.poll_shifts.new.no_assignments") %> +
+ <% else %> + <%= render "shifts" %> + <% end %> +
\ No newline at end of file diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 69ffa296e..dea45c3a3 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -403,6 +403,7 @@ en: poll_officers: Poll officers polls: Polls poll_booths: Booths location + poll_shifts: Manage shifts officials: Officials organizations: Organisations settings: Configuration settings @@ -481,11 +482,6 @@ en: search: Search user_not_found: User not found poll_officer_assignments: - flash: - destroy: "Officing shift removed" - create: "Officing shift added" - error_destroy: "An error ocurred when removing officer assignment" - error_create: "An error ocurred when adding officer assignment" index: officers_title: "List of officers" no_officers: "There are no officers assigned to this poll." @@ -494,18 +490,27 @@ en: add_officer_assignments: "Add shifts as officer" edit_officer_assignments: "Edit officing shifts" by_officer: - new_assignment: "New shift" date: "Date" booth: "Booth" - assignment: "Assignment" - select_date: "Select day" - select_booth: "Select booth" - add_assignment: "Add shift" - remove_assignment: "Remove" assignments: "Officing shifts in this poll" no_assignments: "This user has no officing shifts in this poll." final_recounts: "Final recounts" final_recount: "Final recount (by officer)" + poll_shifts: + new: + new_assignment: "New shift" + date: "Date" + officer: "Officer" + assignment: "Assignment" + select_date: "Select day" + select_officer: "Select officer" + add_assignment: "Add shift" + remove_assignment: "Remove" + assignments: "Shifts in this booth" + no_assignments: "This booth has no shifts" + flash: + create: "Shift added" + destroy: "Shift removed" poll_booth_assignments: flash: destroy: "Booth not assigned anymore" @@ -618,6 +623,8 @@ en: submit_button: "Update booth" show: location: "Location" + booth: + shifts: "Manage shifts" officials: edit: destroy: Remove 'Official' status diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 280033353..6e4fb2abf 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -414,6 +414,7 @@ es: poll_officers: Presidentes de mesa polls: Votaciones poll_booths: Ubicación de urnas + poll_shifts: Asignar turnos officials: Cargos públicos organizations: Organizaciones settings: Configuración global @@ -481,11 +482,6 @@ es: search: Buscar user_not_found: Usuario no encontrado poll_officer_assignments: - flash: - destroy: "Eliminado turno de presidente de mesa" - create: "Añadido turno de presidente de mesa" - error_destroy: "Se ha producido un error al eliminar el turno" - error_create: "Se ha producido un error al intentar crear el turno" index: officers_title: "Listado de presidentes de mesa asignados" no_officers: "No hay presidentes de mesa asignados a esta votación." @@ -494,18 +490,27 @@ es: add_officer_assignments: "Añadir turnos como presidente de mesa" edit_officer_assignments: "Editar turnos" by_officer: - new_assignment: "Nuevo turno" date: "Fecha" booth: "Urna" - assignment: "Asignación" - select_date: "Seleccionar día" - select_booth: "Seleccionar urna" - add_assignment: "Añadir turno" - remove_assignment: "Eliminar turno" assignments: "Turnos como presidente de mesa en esta votación" no_assignments: "No tiene turnos como presidente de mesa en esta votación." final_recounts: "Recuentos finales" final_recount: "Recuento final (presidente de mesa)" + poll_shifts: + new: + new_assignment: "Nuevo turno" + date: "Fecha" + officer: "Presidente de mesa" + assignment: "Asignación" + select_date: "Seleccionar día" + select_officer: "Seleccionar presidente de mesa" + add_assignment: "Añadir turno" + remove_assignment: "Eliminar turno" + assignments: "Turnos en esta urna" + no_assignments: "Esta urna no tiene turnos asignados" + flash: + create: "Añadido turno de presidente de mesa" + destroy: "Eliminado turno de presidente de mesa" poll_booth_assignments: flash: destroy: "Urna desasignada" @@ -618,6 +623,8 @@ es: submit_button: "Actualizar urna" show: location: "Ubicación" + booth: + shifts: "Asignar turnos" officials: edit: destroy: Eliminar condición de 'Cargo Público' diff --git a/config/routes.rb b/config/routes.rb index d151fdb6c..e3d3b5bcb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -273,7 +273,10 @@ Rails.application.routes.draw do get :search, on: :collection end - resources :booths + resources :booths do + resources :shifts + end + resources :questions end diff --git a/db/migrate/20170724190805_create_poll_shifts.rb b/db/migrate/20170724190805_create_poll_shifts.rb new file mode 100644 index 000000000..8bb6eafd7 --- /dev/null +++ b/db/migrate/20170724190805_create_poll_shifts.rb @@ -0,0 +1,15 @@ +class CreatePollShifts < ActiveRecord::Migration + def change + create_table :poll_shifts do |t| + t.integer :booth_id + t.integer :officer_id + t.date :date + + t.timestamps + end + + add_index :poll_shifts, :booth_id + add_index :poll_shifts, :officer_id + add_index :poll_shifts, [:booth_id, :officer_id] + end +end diff --git a/db/schema.rb b/db/schema.rb index 91a26adeb..4170c10f2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170719174326) do +ActiveRecord::Schema.define(version: 20170724190805) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -652,6 +652,18 @@ ActiveRecord::Schema.define(version: 20170719174326) do add_index "poll_questions", ["proposal_id"], name: "index_poll_questions_on_proposal_id", using: :btree add_index "poll_questions", ["tsv"], name: "index_poll_questions_on_tsv", using: :gin + create_table "poll_shifts", force: :cascade do |t| + t.integer "booth_id" + t.integer "officer_id" + t.date "date" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "poll_shifts", ["booth_id", "officer_id"], name: "index_poll_shifts_on_booth_id_and_officer_id", using: :btree + add_index "poll_shifts", ["booth_id"], name: "index_poll_shifts_on_booth_id", using: :btree + add_index "poll_shifts", ["officer_id"], name: "index_poll_shifts_on_officer_id", using: :btree + create_table "poll_voters", force: :cascade do |t| t.string "document_number" t.string "document_type" From bf192f3b585dba8c1265e3320c2b5966d8335a0d Mon Sep 17 00:00:00 2001 From: rgarcia Date: Fri, 4 Aug 2017 20:43:48 +0200 Subject: [PATCH 02/64] highlights shift's menu instead of booths --- app/views/admin/_menu.html.erb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/admin/_menu.html.erb b/app/views/admin/_menu.html.erb index 62638f3b7..b42e717b4 100644 --- a/app/views/admin/_menu.html.erb +++ b/app/views/admin/_menu.html.erb @@ -73,9 +73,13 @@ <%= link_to t('admin.menu.poll_officers'), admin_officers_path %> -
  • > +
  • > <%= link_to t('admin.menu.poll_booths'), admin_booths_path %>
  • + +
  • > + <%= link_to t('admin.menu.poll_shifts'), admin_booths_path %> +
  • <% end %> From 0aba196ba2a9f615b7996957ef7e46cd663bfc11 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Fri, 4 Aug 2017 20:44:04 +0200 Subject: [PATCH 03/64] adds specs for shifts --- spec/factories.rb | 11 ++++ spec/features/admin/poll/shifts_spec.rb | 88 +++++++++++++++++++++++++ spec/models/poll/poll_spec.rb | 14 ++++ spec/models/poll/shift_spec.rb | 61 +++++++++++++++++ 4 files changed, 174 insertions(+) create mode 100644 spec/features/admin/poll/shifts_spec.rb create mode 100644 spec/models/poll/shift_spec.rb diff --git a/spec/factories.rb b/spec/factories.rb index 24c0767d4..15599f30f 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -435,6 +435,11 @@ FactoryGirl.define do starts_at { 1.month.ago } ends_at { 1.month.from_now } + trait :current do + starts_at { 2.days.ago } + ends_at { 2.days.from_now } + end + trait :incoming do starts_at { 2.days.from_now } ends_at { 1.month.from_now } @@ -478,6 +483,12 @@ FactoryGirl.define do end end + factory :poll_shift, class: 'Poll::Shift' do + association :booth, factory: :poll_booth + association :officer, factory: :poll_officer + date Date.current + end + factory :poll_final_recount, class: 'Poll::FinalRecount' do association :officer_assignment, factory: [:poll_officer_assignment, :final] association :booth_assignment, factory: :poll_booth_assignment diff --git a/spec/features/admin/poll/shifts_spec.rb b/spec/features/admin/poll/shifts_spec.rb new file mode 100644 index 000000000..fd9b9f4ca --- /dev/null +++ b/spec/features/admin/poll/shifts_spec.rb @@ -0,0 +1,88 @@ +require 'rails_helper' + +feature 'Admin shifts' do + + background do + admin = create(:administrator) + login_as(admin.user) + end + + scenario "Show" do + poll = create(:poll) + officer = create(:poll_officer) + + booth1 = create(:poll_booth) + booth2 = create(:poll_booth) + + shift1 = create(:poll_shift, officer: officer, booth: booth1, date: Date.today) + shift2 = create(:poll_shift, officer: officer, booth: booth2, date: Date.tomorrow) + + visit new_admin_booth_shift_path(booth1) + + expect(page).to have_css(".shift", count: 1) + expect(page).to have_content I18n.l(Date.today, format: :long) + expect(page).to have_content officer.name + + visit new_admin_booth_shift_path(booth2) + + expect(page).to have_css(".shift", count: 1) + expect(page).to have_content I18n.l(Date.tomorrow, format: :long) + expect(page).to have_content officer.name + end + + scenario "Create" do + poll = create(:poll) + booth = create(:poll_booth) + officer = create(:poll_officer) + + visit admin_booths_path + + within("#booth_#{booth.id}") do + click_link "Manage shifts" + end + + select I18n.l(poll.starts_at.to_date, format: :long), from: 'shift_date' + select officer.name, from: 'shift_officer_id' + click_button "Add shift" + + expect(page).to have_content "Shift added" + + within("#shifts") do + expect(page).to have_css(".shift", count: 1) + expect(page).to have_content(I18n.l(poll.starts_at.to_date, format: :long)) + expect(page).to have_content(officer.name) + end + end + + scenario "Destroy" do + poll = create(:poll) + booth = create(:poll_booth) + officer = create(:poll_officer) + + shift = create(:poll_shift, officer: officer, booth: booth) + + visit admin_booths_path + + within("#booth_#{booth.id}") do + click_link "Manage shifts" + end + + expect(page).to have_css(".shift", count: 1) + within("#shift_#{shift.id}") do + click_link "Remove" + end + + expect(page).to have_content "Shift removed" + expect(page).to have_css(".shift", count: 0) + end + + scenario "Empty" do + poll = create(:poll) + booth = create(:poll_booth) + + visit new_admin_booth_shift_path(booth) + + expect(page).to have_content "This booth has no shifts" + end + +end diff --git a/spec/models/poll/poll_spec.rb b/spec/models/poll/poll_spec.rb index 61f9fce52..2eb78841b 100644 --- a/spec/models/poll/poll_spec.rb +++ b/spec/models/poll/poll_spec.rb @@ -62,6 +62,20 @@ describe :poll do end end + describe "#current_or_incoming" do + it "returns current or incoming polls" do + current = create(:poll, :current) + incoming = create(:poll, :incoming) + expired = create(:poll, :expired) + + current_or_incoming = Poll.current_or_incoming + + expect(current_or_incoming).to include(current) + expect(current_or_incoming).to include(incoming) + expect(current_or_incoming).to_not include(expired) + end + end + describe "#document_has_voted?" do it "returns true if Poll::Voter with document exists" do poll = create(:poll) diff --git a/spec/models/poll/shift_spec.rb b/spec/models/poll/shift_spec.rb new file mode 100644 index 000000000..e70b5f9a0 --- /dev/null +++ b/spec/models/poll/shift_spec.rb @@ -0,0 +1,61 @@ +require 'rails_helper' + +describe :shift do + let(:shift) { build(:poll_shift) } + + describe "validations" do + + it "should be valid" do + expect(shift).to be_valid + end + + it "should not be valid without a booth" do + shift.booth = nil + expect(shift).to_not be_valid + end + + it "should not be valid without an officer" do + shift.officer = nil + expect(shift).to_not be_valid + end + + it "should not be valid without a date" do + shift.date = nil + expect(shift).to_not be_valid + end + + end + + describe "officer_assignments" do + + it "should create corresponding officer_assignments" do + poll1 = create(:poll) + poll2 = create(:poll) + poll3 = create(:poll) + + booth = create(:poll_booth) + officer = create(:poll_officer) + + booth_assignment1 = create(:poll_booth_assignment, poll: poll1, booth: booth) + booth_assignment2 = create(:poll_booth_assignment, poll: poll2, booth: booth) + + shift = create(:poll_shift, booth: booth, officer: officer, date: Date.current) + + officer_assignments = Poll::OfficerAssignment.all + expect(officer_assignments.count).to eq(2) + + oa1 = officer_assignments.first + oa2 = officer_assignments.second + + expect(oa1.officer).to eq(officer) + expect(oa1.date).to eq(Date.current) + expect(oa1.booth_assignment).to eq(booth_assignment1) + + expect(oa2.officer).to eq(officer) + expect(oa2.date).to eq(Date.current) + expect(oa2.booth_assignment).to eq(booth_assignment2) + end + + end + +end From 9181610de94df7d4032271813dcc81dfb1d9ff32 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Fri, 4 Aug 2017 20:44:18 +0200 Subject: [PATCH 04/64] removes obsolete code --- .../poll/officer_assignments_controller.rb | 29 ------ .../officer_assignments/by_officer.html.erb | 39 -------- .../admin/poll/officer_assignments_spec.rb | 91 ------------------- 3 files changed, 159 deletions(-) delete mode 100644 spec/features/admin/poll/officer_assignments_spec.rb diff --git a/app/controllers/admin/poll/officer_assignments_controller.rb b/app/controllers/admin/poll/officer_assignments_controller.rb index 1f2a7ca2c..45c9a225a 100644 --- a/app/controllers/admin/poll/officer_assignments_controller.rb +++ b/app/controllers/admin/poll/officer_assignments_controller.rb @@ -32,35 +32,6 @@ class Admin::Poll::OfficerAssignmentsController < Admin::BaseController end end - def create - @officer_assignment = ::Poll::OfficerAssignment.new(booth_assignment: @booth_assignment, - officer_id: create_params[:officer_id], - date: create_params[:date]) - @officer_assignment.final = true if @officer_assignment.date > @booth_assignment.poll.ends_at.to_date - - if @officer_assignment.save - notice = t("admin.poll_officer_assignments.flash.create") - else - notice = t("admin.poll_officer_assignments.flash.error_create") - end - - redirect_params = { poll_id: create_params[:poll_id], officer_id: create_params[:officer_id] } - redirect_to by_officer_admin_poll_officer_assignments_path(redirect_params), notice: notice - end - - def destroy - @officer_assignment = ::Poll::OfficerAssignment.includes(:booth_assignment).find(params[:id]) - - if @officer_assignment.destroy - notice = t("admin.poll_officer_assignments.flash.destroy") - else - notice = t("admin.poll_officer_assignments.flash.error_destroy") - end - - redirect_params = { poll_id: @officer_assignment.poll_id, officer_id: @officer_assignment.officer_id } - redirect_to by_officer_admin_poll_officer_assignments_path(redirect_params), notice: notice - end - private def officer_assignment_params diff --git a/app/views/admin/poll/officer_assignments/by_officer.html.erb b/app/views/admin/poll/officer_assignments/by_officer.html.erb index 6e505040e..8cc6c0437 100644 --- a/app/views/admin/poll/officer_assignments/by_officer.html.erb +++ b/app/views/admin/poll/officer_assignments/by_officer.html.erb @@ -5,35 +5,6 @@

    <%= @officer.name %> - <%= @officer.email %>

    -<%= form_tag(admin_poll_officer_assignments_path(@poll), {id: "officer_assignment_form"}) do %> -
    - <%= t("admin.poll_officer_assignments.by_officer.new_assignment") %> -
    - - <%= select_tag :date, - poll_dates_select_options(@poll) + poll_final_recount_option(@poll), - { prompt: t("admin.poll_officer_assignments.by_officer.select_date"), - label: false } %> -
    - -
    - - <%= select_tag :booth_id, - poll_booths_select_options(@poll), - { prompt: t("admin.poll_officer_assignments.by_officer.select_booth"), - label: false } %> -
    - -
    - <%= hidden_field_tag :officer_id, @officer.id %> - <%= hidden_field_tag :poll_id, @poll.id %> - <%= submit_tag t("admin.poll_officer_assignments.by_officer.add_assignment"), - class: "button expanded hollow margin-top" %> -
    -
    -<% end %> - - <% if @officer_assignments.empty? %>
    <%= t("admin.poll_officer_assignments.by_officer.no_assignments") %> @@ -45,7 +16,6 @@ <%= t("admin.poll_officer_assignments.by_officer.date") %> <%= t("admin.poll_officer_assignments.by_officer.booth") %> - <%= t("admin.poll_officer_assignments.by_officer.assignment") %> @@ -53,12 +23,6 @@ <%= officer_assignment.final? ? t('polls.final_date') : l(officer_assignment.date.to_date) %> <%= booth_name_with_location(officer_assignment.booth_assignment.booth) %> - - <%= link_to t("admin.poll_officer_assignments.by_officer.remove_assignment"), - admin_poll_officer_assignment_path(@poll, officer_assignment), - method: :delete, - class: "button hollow alert" %> - <% end %> @@ -93,6 +57,3 @@ <% end %> - - - diff --git a/spec/features/admin/poll/officer_assignments_spec.rb b/spec/features/admin/poll/officer_assignments_spec.rb deleted file mode 100644 index 08cbd3f99..000000000 --- a/spec/features/admin/poll/officer_assignments_spec.rb +++ /dev/null @@ -1,91 +0,0 @@ -require 'rails_helper' - -feature 'Admin officer assignments in poll' do - - background do - admin = create(:administrator) - login_as(admin.user) - end - - scenario 'Assign officer to poll', :js do - booth_assignment = create(:poll_booth_assignment) - officer = create(:poll_officer) - - visit admin_poll_path(booth_assignment.poll) - within('#poll-resources') do - click_link 'Officers (0)' - end - - expect(page).to have_content 'There are no officers assigned to this poll' - - fill_in 'search-officers', with: officer.name - click_button 'Search' - - within('#search-officers-results') do - click_link 'Add shifts as officer' - end - - expect(page).to have_content 'This user has no officing shifts in this poll' - expect(page).to have_content officer.name - expect(page).to have_content booth_assignment.poll.name - - within('#officer_assignment_form') do - select I18n.l(booth_assignment.poll.ends_at.to_date, format: :long), from: 'date' - select "#{booth_assignment.booth.name} (#{booth_assignment.booth.location})", from: 'booth_id' - click_button 'Add shift' - end - - expect(page).to have_content 'Officing shift added' - expect(page).to_not have_content 'This user has no officing shifts in this poll' - - visit admin_poll_path(booth_assignment.poll) - within('#poll-resources') do - click_link 'Officers (1)' - end - - expect(page).to_not have_content 'There are no officers in this poll' - expect(page).to have_content officer.name - expect(page).to have_content officer.email - end - - scenario 'Remove officer assignment from poll' do - officer_assignment = create(:poll_officer_assignment) - poll = officer_assignment.booth_assignment.poll - booth = officer_assignment.booth_assignment.booth - officer = officer_assignment.officer - - visit by_officer_admin_poll_officer_assignments_path(poll, officer_id: officer.id) - - expect(page).to_not have_content 'This user has no officing shifts in this poll' - within("#poll_officer_assignment_#{officer_assignment.id}") do - expect(page).to have_content booth.name - click_link 'Remove' - end - - expect(page).to have_content 'Officing shift removed' - expect(page).to have_content 'This user has no officing shifts in this poll' - end - - scenario 'Index view shows recounts info for officer' do - booth_assignment = create(:poll_booth_assignment) - poll = booth_assignment.poll - officer = create(:poll_officer) - create(:poll_officer_assignment, - booth_assignment: booth_assignment, - officer: officer, - date: poll.starts_at) - final_officer_assignment = create(:poll_officer_assignment, :final, - booth_assignment: booth_assignment, - officer: officer, - date: poll.ends_at + 1.day) - create(:poll_final_recount, - booth_assignment: booth_assignment, - officer_assignment: final_officer_assignment, - date: poll.ends_at, - count: 9876) - - visit by_officer_admin_poll_officer_assignments_path(poll, officer_id: officer.id) - - within('#final_recount_list') { expect(page).to have_content('9876') } - end -end From de63a25978d60002625597f4827f33445b55ab5d Mon Sep 17 00:00:00 2001 From: "depfu[bot]" Date: Tue, 5 Sep 2017 09:35:36 +0000 Subject: [PATCH 05/64] Update invisible_captcha to version 0.9.3 --- Gemfile.lock | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a6437663e..2344911ff 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -199,7 +199,7 @@ GEM terminal-table (>= 1.5.1) initialjs-rails (0.2.0.5) railties (>= 3.1, < 6.0) - invisible_captcha (0.9.2) + invisible_captcha (0.9.3) rails (>= 3.2.0) jquery-fileupload-rails (0.4.7) actionpack (>= 3.1) @@ -251,7 +251,7 @@ GEM mime-types-data (3.2016.0521) mimemagic (0.3.2) mini_portile2 (2.2.0) - minitest (5.10.2) + minitest (5.10.3) mixlib-cli (1.7.0) mixlib-config (2.2.4) multi_json (1.12.1) @@ -430,7 +430,7 @@ GEM babel-source (>= 5.8.11) babel-transpiler sprockets (>= 3.0.0) - sprockets-rails (3.2.0) + sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) @@ -565,6 +565,5 @@ DEPENDENCIES web-console (~> 3.3.0) whenever (~> 0.9.7) - BUNDLED WITH 1.15.3 From c6b61b6ca556e0d8dbff80beb22e8665714eebdd Mon Sep 17 00:00:00 2001 From: decabeza Date: Tue, 5 Sep 2017 11:45:33 +0200 Subject: [PATCH 06/64] minimises section header space and main consul logo --- app/assets/images/help/help_icon_budgets.png | Bin 3129 -> 2273 bytes app/assets/images/help/help_icon_debates.png | Bin 2637 -> 1968 bytes .../help/help_icon_legislation_processes.png | Bin 2047 -> 1723 bytes app/assets/images/help/help_icon_polls.png | Bin 2586 -> 2051 bytes .../images/help/help_icon_proposals.png | Bin 3533 -> 2417 bytes app/assets/images/logo_header.png | Bin 1768 -> 1959 bytes app/assets/stylesheets/participation.scss | 13 +++---------- app/views/shared/_section_header.html.erb | 8 +++++--- 8 files changed, 8 insertions(+), 13 deletions(-) diff --git a/app/assets/images/help/help_icon_budgets.png b/app/assets/images/help/help_icon_budgets.png index f8a909d7e64900c8071ccbf0cf37ac4a5f6571c9..fc5e3022fc45e78cb6742678c93cc5e9ec580faf 100644 GIT binary patch delta 1465 zcmV;q1xEV07~v5iiBL{Q4GJ0x0000DNk~Le0000W0000W2nGNE0CReJ^sym10w6&{ zLO3-tI59XuG%_(UMK?J!HZ?dxIYBu@LNPf)MmLjs0vsSgLqa$;GB_|eK{PTkF-12y zGd49iLODS>L_#q+LPj@}wgP4(FfuSWVP-UCEih&=H7zt@F*GeXIW=P~V>UB1Wi~ls zVly;mlRyKIe{4FqN&o-^^+`lQRCwC#S6fJ9R}?+Di7~$F7-Pm)j1Hn!F-T1*B`C(J z8mJDX#X@TtL^_3`(tfmG{ht2yqhRS*Ezw4tOlPcZ=~O=kBurz`ksvx|)FM{Y_=v_w z9>y5$+QC4oH|B;BrXM|UxZK0J`>eh8+IycXIypIEe=l-~A^{8z4l;UAO-*Hcdwa}c zv9O(;9i~(&naky3ZnvA|R;^JZ^7K>T!a5&!D+S*c$ zjg7sBe>Eon|EyA}i~wn+eHRT*5KTCcJjUUQ-Q8W?=H}){>+9>ENu^RnN=ixqTfDRf z-f{c;`^vewxm%;7qmQPhroIJRa)~6mpD`IA4~~zIOXlb2KZKVz5SmiI-ydQkH#gUU zL+xQN2?VXv#2(q?2KmkB^(|cKes`T1khJLGn`Q zAiPRWGC5= ze+nQeDJeAj`}^-$t=1+=$IBYz$nfy+C$qD&3TTNR0K`Ug=|@IJItle<4$2}3QjH9` zj!fbQfPx}6o6TQwGz`&cN3tj*aSrvq$Bea)YqRAdPwYIkQ8men5ZyG}J zdau`;B$LSm+XY)3az2@ALoCoFKG1&^f2o~?SNAypPN!27r&nUsd4FkX>945!Dliwk zXg^Y$!#)?LkCy?&rmuN z;2QSY&=p0fl<$Jx3>S}9iTPrFmfBFL{ zOz+>o0Wsx#G(FHdH0BBe_}6Kmah0!O@OClK2+id5_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>q*m0{)=Dbo%zq>t4d+v*PDyNGZAnRq?1eNx-bz0v zX@r25Zl_*=GhzXU^&AES1rIAMETpKYD7nwh&PMMopb*q2PoAU=8#c&#um-r>qD6}w zqAO#TQOjICo;kz~G`?WL0!hc|>FIRy=1sYW)lfiTRSW<`@COA2IZRWG%{4F={wcaSuY zB%A@^QXneEAfzpt4ol&%<(_T>WUM}8B0EX_bC3?iRX{jXc-qR{Uz^ii^%+PtX^173 z({4N)d672?mUVBSs0!$Ut@aZyQFPr^V1LjSU~f*AS%Fb~Y$GgtpEq0HJzp z>%IjqQLU*ffZ&}_a&&a`-`tg6unUB%ZH~!gs#&{s?RTu%VGDsYt^s}J<>gt-f!3&c zpezAK3yX0J`rGp5%c~fa55IUq(Xavy%&aw5)?YC(F|BriFqs=-;#Y;f0iSa$HGd0o zckSA>)Z4djuTh_CUA;zBC>@crY_DG4U9_prEUBgnExzt(mq!Y08zyRoNjddJn~wK#NqYsKDb+ z@h5Jo@<99?ZB1SJ$y5o99t6UHhGa9Hs7%GBSgEh&=S~?(_##qje^Ni=l7E zHB7r|)vCPK*49vNbz@ReQhsIEDnx6G-oc%QhyEXQIuIR*4nzl{1JQv@A|U?=FaR@8 V@jQuJedquH002ovPDHLkV1hdYnezYu diff --git a/app/assets/images/help/help_icon_legislation_processes.png b/app/assets/images/help/help_icon_legislation_processes.png index 9dd93ad8c3410430e1b0cd7bbe2a7d3f0969461f..00872c247709b6ec241663b936f91391b80eb546 100644 GIT binary patch delta 908 zcmV;719SZU54#N^iBL{Q4GJ0x0000DNk~Le0000W0000W2nGNE0CReJ^sym20v|Il zLohitHaI~vGBGhlH#svlH8?^!K{-T1F*!m;HuGBGhlH#svl zH8?^!K{-T1F*!m;H&XTCM(| zKjd;b%;$4hE|*|58o}vwLNFK<29Qi9pW;FfFu15JXd7iR8QW+ypi-&C@K!>j(R@6Z z0Sr8oN~NM{BmfeLWJMD*W^1+D2L$vBS-Btv_SOIbI9Qo1%g$&^%H{H>e!u?$LH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ztyX}vq~24kTeq&0&HRxer;^5_n>K9{7C}UjBF*8$hlPbe1B7Wq z0xE(wpytkDvSxOPYHe+8v}4B(5oIJ< zvt|t)I&?^Y0uTU#9{>O>6&V>R?juJ?QdU+*v9Ynl6|LA;j@DsPYUxW}i2du=uNSf3 z$Hzx^@9Nd7q*kjj86lNQC6q_lmINSSnSUckjtEPe+Q6AYEwfuePznxt>eMMg5BLp0 zLAWgympPr^+14H37HyTG=Cb6 zG<4H-cc9{ol<}4bdJ^)jQ6M2Wf~~vf})e@i7Cp&Z2zAv=m$NG0tpBR zID$O>hqC@G+bge0000 diff --git a/app/assets/images/help/help_icon_proposals.png b/app/assets/images/help/help_icon_proposals.png index 05861d042f3b6dae4a1ca69a1060966cdc0ec7db..e41db1cf8fe1a5027b50d367773758d0b6ae0090 100644 GIT binary patch delta 1747 zcmV;^1}yo_8}Sk$iBL{Q4GJ0x0000DNk~Le0000W0000W2nGNE0CReJ^pPPb0fMng zxB&@Ia%pF2ZeeUhlK}%XlluW1Tsbo^LohisML0n;GBGhlH#svlH8?^!K{-T1F*!m; zHzFW-ZE#IZI!SJGbYX5|Wl2OmB6w|ZE@^3GIyo~iLohisL^we-GBGhlH#svlH8?^! zK{-T1F*!m;HWIAwYZ**^SXm4;jWjHo6H#aynEn{Ue zVl6Q-H(@O~WjAFlWiv5iF*9LdWHnB5JTG!&W;#S=bCW>>HGe%mAGrVk1%*jO zK~#9!>{dxkWK|S>RX{P%GsQdy!kiAGu)xrSfUUv;V?rWm_r}D95+yMqA+098vo$fs zO~-_`jk>T+D;hU4C4fL7AcT38F%-y5QAL&K{O~K))m6XHg>HPw%dg@6`_4W0-1DBw zVzCI@(c0Q7Jyj}|Fn^g$VrpticzJn=xVSixpPw(do>QaIh_0@##^K@Nil(Nf=74~J zt&58b>wA-vlj7v$M4X?Wi}LbvX}!ExU0t1ZKX-A3;pXNhHa9oL+}xb-^YasCvsrk0 zdWyBRwHr%IOLe28qj!CMeYg0#4BqysG!y|afLg7#K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^TRVo4=za8xpU{9!YHOg*nP7N+OlPfvRC1HJrWUm zjT~kdiYBppVl3Jg7Zju@wQOYL+iwzKc#`ag=mp+k?!duz=uPjtIp^ z5bUo^vj{&UDt}`;dzc29Cw~Vu+Tb$_7cTq_PPy~^`Ew=G9PF-nipe#drLE398rRv!!w1hv9Ym-VQ@8dCNrQMq${s+-mgeUA(2r92FJ8RZts#ejP-K!` z)+j@O5N08=S`~V+U`Eg$y_j+%A|gr=nNmj5+M%1&5nFn>A5t3`ova!320c+;UT)K{ zu5+mh>=qxQUkX;M4}bJ+H$krko|M=!j_*p?O)OZjK-{=-L#R#nI=Kr(TI}YlJue`u zbwEeu@LsIF`(?4i{r|E~sM#pdS!iaJ?5Ubs^7Mn0QF}_>b*9_ENK(YMQZa$hc+{VI zQdX^p35Jp3{HlP^OUzOPp_Y$a0I9SN!ZpAVMh^O>;fc+-qVOP z`wJR_jCC|MHT5W4eR|ze5tTKgsHjNk(|QX;cR_UYVgbE!<;un*M~-}r^!*kfI&B;@ z=-8HEBbAIIm+#DLHB~_9DQCpaH&|D%UY)H*Bm5oxS!)c0p6|>KaP#KP_JOcLa|Q^y z;Fs)V3B*?0!OoYF!H%$&r~AE@wVVZlrjhSBis9{ch}~dgFX9fM?GSny-vIX(wKRSI oIkOK)ACNvEeLz0M^`8I(01&Hw-a diff --git a/app/assets/images/logo_header.png b/app/assets/images/logo_header.png index 9bce3cef8f5bd52962f4cbda543b1b5a717f3907..c178ec7811199c2fd1f25f3d4a62d4f9465d74b1 100644 GIT binary patch delta 1202 zcmaFCyPSW67*mX+vy+9Xk%g&+qluBBp{u#2v6-oblcl4ji<6(q+L@zTl#R{s|1ee~)MNDavgP4>i|6-DwEXJfb*_7F_-twlW2Ll6( zsHcl#NX4x;vm-r310{~{)pJc*K&>`Klk(88Q1;xf8zES*Ok{5 zKbvEm{)|oMbk~Cw>XSq_IEbBKimX>?XWay1S?WvxGZGuY3_k9ZMx6oym0K77`?Ahd zkUhfeJ#P*F0>O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+Jn`*YZMobv?`M*G4zl zU+&Im=nM0^w(9pQ_0{UtDi!;y!y5D-%f`2zoOQCO>w5{SxmL9)k3w;TN;K~}1;hVS zq~7c>?cKm2@@#Y_1$Onr2*<3#7qN5P4Y zyE7#hpKfg2_~gRUbDNLe=jT@Cnp!fmezUo5xt-*`7v|4q>9QLKp5)MPwEE@|>(S56 zYP9v9TD9Si-DR7aZcZ=1(W=7m_1p`aQht86g^yQ%xA7@k#PQJP<8m9Nc)Q?d2Ug7K zOEFx`G9&k_IOB^K{y7Yn*Zxdq`XF>6-|6KC z_I{|3IiH<*xP<-HwP&V_TJ3XmTefPw2v5FnbVGihTFdjSN%rbWG5(RWlh+FU;hg4Y zQ2KzoMd0}4o8L@JU2G2a@jT+*HsPB8Q`;x5UK93Dc=(5f`?ud5wFsvQ&tEm~xVPBp zy}j`&`22>yzqss++pkx)?s?DpVC{zXdDd+4UtSiS-C93GhGC=WDm@N zJFs=RiJQG-&B_U^+Y6t&?q%lYi0|>~`<$!1(7!<4hCR4r3PUi*bdyOR-cH~beEeZ4 z-$S#5^PktIbKJett{-B(!B1zOckGMJ-zP4a$WmjtUcK`fvooK>SzYJ8I}6j3W6Bp~ z>sP&1(wO3S@9;9g`qdNpx@04Scs@Ou_{N6yaPU2~5KXt!SxObEjC<}~Z&)hl{F>td zufdv^OnRzw1kcnkESYoiH0Og}mwhs|XFZm0C~mT{**xvQbhpZRm-L;iYbN`-9p5v3 z6~lFzTO1E!-%1F{ZR0y)@-n|Cp6Tnf_8sCDuNPbH_)uWJIB3uI$wu52@lmVhx)%m# zzCCp~!}{a9gwhqQC41wZ<}Q^zHS6BebB|eeZ28o@DEoYjHp{8kDLD-5weMH*T(7=% zP-)t}d%=1!yZiJw92hkiSb^!A6T +
    <%= image_tag "help/help_icon_#{image}.png", alt: t("#{i18n_namespace}.icon_alt"), class: "align-top" %>

    <%= t("#{i18n_namespace}.title") %>

    -

    <%= t("#{i18n_namespace}.description") %>

    - <%= link_to t("#{i18n_namespace}.help"), "#section_help", class: "help-link" %> +

    + <%= t("#{i18n_namespace}.description") %>
    + <%= link_to t("#{i18n_namespace}.help"), "#section_help" %> +

    From 1d17e0cb58d67e361a10b2c69450d987028db3df Mon Sep 17 00:00:00 2001 From: decabeza Date: Mon, 4 Sep 2017 18:39:04 +0200 Subject: [PATCH 07/64] replace header text with back link --- app/views/legislation/processes/_header_full.html.erb | 2 +- config/locales/en/legislation.yml | 1 - config/locales/es/legislation.yml | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/views/legislation/processes/_header_full.html.erb b/app/views/legislation/processes/_header_full.html.erb index a50278c39..b6e9a23cd 100644 --- a/app/views/legislation/processes/_header_full.html.erb +++ b/app/views/legislation/processes/_header_full.html.erb @@ -1,7 +1,7 @@
    -

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

    + <%= back_link_to legislation_processes_path %>

    <%= process.title %>

    diff --git a/config/locales/en/legislation.yml b/config/locales/en/legislation.yml index 4c5350e8b..7c3b4a236 100644 --- a/config/locales/en/legislation.yml +++ b/config/locales/en/legislation.yml @@ -53,7 +53,6 @@ en: empty_questions: There aren't any questions participate: Participate in the debate header_full: - title: Participate description: Description more_info: More information and context index: diff --git a/config/locales/es/legislation.yml b/config/locales/es/legislation.yml index c8cca657e..454422046 100644 --- a/config/locales/es/legislation.yml +++ b/config/locales/es/legislation.yml @@ -53,7 +53,6 @@ es: empty_questions: No hay preguntas participate: Realiza tus aportaciones al debate previo participando en los siguientes temas. header_full: - title: Colabora en la elaboración de la normativa sobre description: En qué consiste more_info: Más información y contexto index: From da1f72ee7ce92b5372a56e819f03ce239ebf647e Mon Sep 17 00:00:00 2001 From: decabeza Date: Mon, 4 Sep 2017 18:39:58 +0200 Subject: [PATCH 08/64] improves legislation processes header layout --- .../stylesheets/legislation_process.scss | 39 +--------- .../legislation/processes/_header.html.erb | 4 +- .../processes/_header_full.html.erb | 4 +- .../legislation/processes/_key_dates.html.erb | 76 +++++++++---------- 4 files changed, 45 insertions(+), 78 deletions(-) diff --git a/app/assets/stylesheets/legislation_process.scss b/app/assets/stylesheets/legislation_process.scss index eda341185..8adcee4c6 100644 --- a/app/assets/stylesheets/legislation_process.scss +++ b/app/assets/stylesheets/legislation_process.scss @@ -25,11 +25,6 @@ $epigraph-line-height: rem-calc(22); // 02. Hero // ----------------- .legislation-hero { - padding-top: 1.5rem; - - @include breakpoint(medium) { - padding-top: 3.5rem; - } h4 { text-transform: uppercase; @@ -52,8 +47,8 @@ $epigraph-line-height: rem-calc(22); } .debate-add-info { - margin-top: 3rem; - padding-top: 4rem; + margin-top: $line-height; + padding-top: $line-height; border-top: 1px solid darken($border, 10%); @include breakpoint(medium) { @@ -72,28 +67,12 @@ $epigraph-line-height: rem-calc(22); } } - .half-gradient { - background: #e6e6e6; - background: linear-gradient(to bottom, #e6e6e6 0%, #e6e6e6 50%, #fff 50%); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e6e6e6', endColorstr='#fff', GradientType=0); - } - .text-center .button { background: $brand; margin-bottom: 0; } - .headline { - margin-bottom: 1rem; - - @include breakpoint(medium) { - margin-bottom: 4rem; - - } - } - .description { - margin-bottom: 1rem; p { font-size: $epigraph-font-size; @@ -150,25 +129,13 @@ $epigraph-line-height: rem-calc(22); .legislation-process-list { border-bottom: 1px solid $medium-gray; margin: 0 1rem 1rem; - padding-top: 4rem; - - @include breakpoint(medium) { - margin-left: 0; - } ul { - position: relative; - max-width: 75rem; - margin-left: auto; - margin-right: auto; + margin: 0 auto; list-style: none; padding-left: 0; margin-bottom: 0; - @include breakpoint(medium) { - padding-left: 1rem; - } - svg { position: absolute; top: 1.25rem; diff --git a/app/views/legislation/processes/_header.html.erb b/app/views/legislation/processes/_header.html.erb index a369f8c88..6ce35bb98 100644 --- a/app/views/legislation/processes/_header.html.erb +++ b/app/views/legislation/processes/_header.html.erb @@ -1,5 +1,5 @@ <% if header == :small %> -
    +

    <%= process.title %>

    @@ -23,7 +23,7 @@
    <% if process.description.present? || process.additional_info.present? %> -
    +
    diff --git a/app/views/legislation/processes/_header_full.html.erb b/app/views/legislation/processes/_header_full.html.erb index b6e9a23cd..8abf6b7b0 100644 --- a/app/views/legislation/processes/_header_full.html.erb +++ b/app/views/legislation/processes/_header_full.html.erb @@ -1,4 +1,4 @@ -
    +
    <%= back_link_to legislation_processes_path %> @@ -25,7 +25,7 @@
    <% if process.additional_info.present? %> -
    +
    <%= t('.more_info') %> diff --git a/app/views/legislation/processes/_key_dates.html.erb b/app/views/legislation/processes/_key_dates.html.erb index 375be7d51..f1fde827a 100644 --- a/app/views/legislation/processes/_key_dates.html.erb +++ b/app/views/legislation/processes/_key_dates.html.erb @@ -3,45 +3,45 @@

    <%= t("legislation.processes.shared.key_dates") %>

    + +
      + <% if process.debate_phase.enabled? %> +
    • > + <%= link_to debate_legislation_process_path(process) do %> +

      <%= t('legislation.processes.shared.debate_dates') %>

      +

      <%= format_date(process.debate_start_date) %> - <%= format_date(process.debate_end_date) %>

      + <% end %> +
    • + <% end %> + + <% if process.draft_publication.enabled? %> +
    • > + <%= link_to draft_publication_legislation_process_path(process) do %> +

      <%= t('legislation.processes.shared.draft_publication_date') %>

      +

      <%= format_date(process.draft_publication_date) %>

      + <% end %> +
    • + <% end %> + + <% if process.allegations_phase.enabled? %> +
    • > + <%= link_to allegations_legislation_process_path(process) do %> +

      <%= t('legislation.processes.shared.allegations_dates') %>

      +

      <%= format_date(process.allegations_start_date) %> - <%= format_date(process.allegations_end_date) %>

      + <% end %> +
    • + <% end %> + + <% if process.result_publication.enabled? %> +
    • > + <%= link_to result_publication_legislation_process_path(process) do %> +

      <%= t('legislation.processes.shared.result_publication_date') %>

      +

      <%= format_date(process.result_publication_date) %>

      + <% end %> +
    • + <% end %> +
    - -
      - <% if process.debate_phase.enabled? %> -
    • > - <%= link_to debate_legislation_process_path(process) do %> -

      <%= t('legislation.processes.shared.debate_dates') %>

      -

      <%= format_date(process.debate_start_date) %> - <%= format_date(process.debate_end_date) %>

      - <% end %> -
    • - <% end %> - - <% if process.draft_publication.enabled? %> -
    • > - <%= link_to draft_publication_legislation_process_path(process) do %> -

      <%= t('legislation.processes.shared.draft_publication_date') %>

      -

      <%= format_date(process.draft_publication_date) %>

      - <% end %> -
    • - <% end %> - - <% if process.allegations_phase.enabled? %> -
    • > - <%= link_to allegations_legislation_process_path(process) do %> -

      <%= t('legislation.processes.shared.allegations_dates') %>

      -

      <%= format_date(process.allegations_start_date) %> - <%= format_date(process.allegations_end_date) %>

      - <% end %> -
    • - <% end %> - - <% if process.result_publication.enabled? %> -
    • > - <%= link_to result_publication_legislation_process_path(process) do %> -

      <%= t('legislation.processes.shared.result_publication_date') %>

      -

      <%= format_date(process.result_publication_date) %>

      - <% end %> -
    • - <% end %> -
    From a15a75a4d6057359432c702cc0956d854320d037 Mon Sep 17 00:00:00 2001 From: decabeza Date: Mon, 4 Sep 2017 19:31:10 +0200 Subject: [PATCH 09/64] cleans legislation process scss --- .../stylesheets/legislation_process.scss | 227 +++++++----------- .../legislation/processes/_header.html.erb | 6 +- .../processes/_header_full.html.erb | 6 +- 3 files changed, 97 insertions(+), 142 deletions(-) diff --git a/app/assets/stylesheets/legislation_process.scss b/app/assets/stylesheets/legislation_process.scss index 8adcee4c6..2ec9f8ee9 100644 --- a/app/assets/stylesheets/legislation_process.scss +++ b/app/assets/stylesheets/legislation_process.scss @@ -13,32 +13,29 @@ // // 01. Utils -// ----------------- +// --------- + +$grey-heading: #e6e6e6; +$border-dark: darken($border, 10%); .grey-heading { - background: #e6e6e6; + background: $grey-heading; } -$epigraph-font-size: rem-calc(15); -$epigraph-line-height: rem-calc(22); - // 02. Hero -// ----------------- -.legislation-hero { +// -------- - h4 { - text-transform: uppercase; - } +.legislation-hero { ul { list-style: none; margin-left: 0; li::before { - vertical-align: text-bottom; - padding-right: 0.5rem; - content: '■'; color: #8aa8be; + content: '■'; + padding-right: $line-height / 4; + vertical-align: text-bottom; } } @@ -47,63 +44,33 @@ $epigraph-line-height: rem-calc(22); } .debate-add-info { + border-top: 1px solid $border-dark; margin-top: $line-height; padding-top: $line-height; - border-top: 1px solid darken($border, 10%); - @include breakpoint(medium) { - margin-bottom: 2rem; - } - - .debate-info-wrapper { - - h2 { - font-size: $lead-font-size; - - @include breakpoint(medium) { - float: left; - } - } - } } - .text-center .button { - background: $brand; - margin-bottom: 0; + .title { + font-weight: bold; + text-transform: uppercase; } .description { - p { - font-size: $epigraph-font-size; - line-height: $epigraph-line-height; - } - - ul { - font-size: $epigraph-font-size; - line-height: $epigraph-line-height; - } - li { - margin-bottom: 1rem; p { display: inline; - margin-bottom: 0; } } - - h4 { - font-size: $base-font-size; - } } .button-subscribe { - margin-top: 1rem; + margin-top: $line-height; @include breakpoint(medium) { + margin-top: $line-height * 2; padding: 0.5em 1em; - margin-top: 3rem; } h3 { @@ -111,8 +78,8 @@ $epigraph-line-height: rem-calc(22); } p { - margin-bottom: 0; font-size: $small-font-size; + margin-bottom: 0; } &:hover h3 { @@ -122,7 +89,8 @@ $epigraph-line-height: rem-calc(22); } // 03. Legislation process navigation -// ----------------- +// ---------------------------------- + .legislation-process-categories { position: relative; @@ -131,20 +99,11 @@ $epigraph-line-height: rem-calc(22); margin: 0 1rem 1rem; ul { - margin: 0 auto; + list-style: none; - padding-left: 0; + margin: 0 auto; margin-bottom: 0; - - svg { - position: absolute; - top: 1.25rem; - - @include breakpoint(1280px) { - transform: rotate(-6deg); - left: -1rem; - } - } + padding-left: 0; } li { @@ -154,6 +113,10 @@ $epigraph-line-height: rem-calc(22); transition: all 0.4s; border-bottom: 2px solid transparent; + @include breakpoint(medium) { + margin-left: $line-height * 2; + } + &:first-of-type { margin-left: 0; } @@ -164,29 +127,25 @@ $epigraph-line-height: rem-calc(22); border-bottom: 2px solid $brand; } - @media (min-width: 950px) { - margin: 0 0 0 3rem; - } - a, h4 { display: block; color: #6d6d6d; margin-bottom: 0; } + } - a { - &:hover, - &:active { - text-decoration: none; - } + a { + &:hover, + &:active { + text-decoration: none; + } - p { - margin-bottom: 0; + p { + margin-bottom: 0; - @include breakpoint(medium) { - margin-bottom: 1rem; - } + @include breakpoint(medium) { + margin-bottom: 1rem; } } } @@ -198,7 +157,8 @@ $epigraph-line-height: rem-calc(22); } // 04. Debate list -// ----------------- +// ---------------- + .debate-chooser { padding: 2rem 1rem; @@ -244,38 +204,43 @@ $epigraph-line-height: rem-calc(22); } // 05. Debate quiz -// ----------------- +// --------------- + .debate-questions { + .comments { - margin-top: 4rem; + margin-top: $line-height * 2.5; } .quiz-header { - margin-bottom: 2rem; + margin-bottom: $line-height; .quiz-title, .quiz-next { - padding: 1rem; - height: 6rem; + padding: $line-height; + + @include breakpoint(medium) { + height: $line-height * 4; + } } .quiz-title { background: #e5ecf2; .quiz-header-title { + font-size: $small-font-size; + font-weight: 700; margin-bottom: 0; text-transform: uppercase; - font-weight: 700; - font-size: $small-font-size; } } h4 a { color: $brand; - } - h4 a:hover { - text-decoration: none; + &:hover { + text-decoration: none; + } } .quiz-next-link { @@ -285,57 +250,49 @@ $epigraph-line-height: rem-calc(22); &:active { text-decoration: none; } + } - .quiz-next { - background: #ccdbe5; - font-weight: 700; - color: $brand; - font-size: $small-font-size; - text-align: right; - text-transform: uppercase; - transition: background 0.25s ease-out, background 0.25s ease-out; + .quiz-next { + background: #ccdbe5; + color: $brand; + font-size: $small-font-size; + font-weight: bold; + text-align: right; + text-transform: uppercase; + transition: background 0.25s ease-out, background 0.25s ease-out; - .icon-angle-right { - vertical-align: sub; - } + .icon-angle-right { + vertical-align: middle; + } - &:hover, - &:active { - text-decoration: none; - background: $brand; - color: #fff; - - .icon-angle-right { - color: #fff; - } - } + &:hover, + &:active { + background: $brand; + color: #fff; + text-decoration: none; } } } .quiz-question { - margin-bottom: 2rem; + margin-bottom: $line-height; } .debate-questions { position: relative; list-style: none; - .participation-not-allowed { - padding-bottom: 3rem; - } - .control { - position: relative; - display: inline-block; - color: #555; - cursor: pointer; background: #fff; border: 1px solid $border; - border-radius: 4px; - padding: 0.75rem 2.5rem; - margin-right: 1.5rem; - margin-bottom: 0.5rem; + border-radius: rem-calc(4); + color: #555; + cursor: pointer; + display: inline-block; + margin-bottom: $line-height / 2; + margin-right: $line-height; + padding: $line-height / 2 $line-height * 2; + position: relative; } .active { @@ -376,14 +333,15 @@ $epigraph-line-height: rem-calc(22); } // 06. Legislation draft -// ----------------- +// --------------------- + .debate-draft { padding: 10rem 2rem 15rem; display: block; background: #f2f2f2; button { - height: 90px; + height: rem-calc(90); h3 { margin-bottom: 0; @@ -397,7 +355,8 @@ $epigraph-line-height: rem-calc(22); } // 07. Legislation allegations -// ----------------- +// --------------------------- + .legislation-allegation { padding-top: 1rem; @@ -416,12 +375,12 @@ $epigraph-line-height: rem-calc(22); .button-circle { line-height: 0; padding: 0; - width: 30px; - height: 30px; + width: rem-calc(30); + height: rem-calc(30); border-radius: 50%; span { - padding-left: 1px; + padding-left: rem-calc(1); &::before { line-height: 1.55; @@ -547,7 +506,7 @@ $epigraph-line-height: rem-calc(22); .calc-comments { cursor: pointer; background: #f2f2f2; - width: 50px; + width: rem-calc(50); .draft-panel { .panel-title { @@ -700,7 +659,7 @@ $epigraph-line-height: rem-calc(22); .comments-on { .calc-index { - width: 50px; + width: rem-calc(50); background: #f2f2f2; cursor: pointer; @@ -764,11 +723,11 @@ $epigraph-line-height: rem-calc(22); .comments-box-container { position: absolute; - top: 230px; + top: rem-calc(230); } .comment-box { - width: 375px; + width: rem-calc(375); padding: 1rem; background: #f9f9f9; border: 1px solid $border; @@ -819,7 +778,7 @@ $epigraph-line-height: rem-calc(22); .participation-not-allowed { font-size: 0.875rem; - height: 50px; + height: rem-calc(50); padding: 0.85rem 0.75rem; top: -18px; } @@ -858,7 +817,7 @@ $epigraph-line-height: rem-calc(22); border-right: 1px solid #d0d0d0; border-left: 1px solid #d0d0d0; width: 100%; - height: 200px; + height: rem-calc(200); margin-bottom: 0.5rem; } diff --git a/app/views/legislation/processes/_header.html.erb b/app/views/legislation/processes/_header.html.erb index 6ce35bb98..6c18ea879 100644 --- a/app/views/legislation/processes/_header.html.erb +++ b/app/views/legislation/processes/_header.html.erb @@ -9,15 +9,13 @@
    <% if process.description.present? %> -

    <%= t('legislation.processes.header_full.description') %>

    +

    <%= t('legislation.processes.header_full.description') %> <%= markdown process.description %> <% end %>

    <% if process.additional_info.present? %>
    -
    - <%= markdown process.additional_info if process.additional_info %> -
    + <%= markdown process.additional_info if process.additional_info %>
    <% end %>
    diff --git a/app/views/legislation/processes/_header_full.html.erb b/app/views/legislation/processes/_header_full.html.erb index 8abf6b7b0..7a3e29550 100644 --- a/app/views/legislation/processes/_header_full.html.erb +++ b/app/views/legislation/processes/_header_full.html.erb @@ -11,15 +11,13 @@
    <% if process.description.present? %> -

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

    +

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

    <%= markdown process.description %> <% end %>
    <% if process.additional_info.present? %>
    -
    - <%= markdown process.additional_info if process.additional_info %> -
    + <%= markdown process.additional_info if process.additional_info %>
    <% end %>
    From 6d25a0c9f1018e98d55c38116171c1076b0a52ed Mon Sep 17 00:00:00 2001 From: "depfu[bot]" Date: Tue, 5 Sep 2017 10:10:45 +0000 Subject: [PATCH 10/64] Update savon to version 2.11.2 --- Gemfile.lock | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a6437663e..4ecf1b554 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -398,7 +398,7 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - savon (2.11.1) + savon (2.11.2) akami (~> 1.2) builder (>= 2.1.2) gyoku (~> 1.2) @@ -565,6 +565,5 @@ DEPENDENCIES web-console (~> 3.3.0) whenever (~> 0.9.7) - BUNDLED WITH 1.15.3 From 43c17c3fc76372972b9f513cbe16a0796cf09b66 Mon Sep 17 00:00:00 2001 From: taitus Date: Mon, 7 Aug 2017 12:51:49 +0200 Subject: [PATCH 11/64] Add communities and topics --- app/controllers/communities_controller.rb | 19 ++++++++ app/controllers/topics_controller.rb | 47 +++++++++++++++++++ app/models/community.rb | 6 +++ app/models/proposal.rb | 7 +++ app/models/topic.rb | 4 ++ .../admin/budget_investments/index.html.erb | 1 - app/views/admin/budgets/index.html.erb | 2 +- app/views/communities/show.html.erb | 17 +++++++ app/views/proposals/index.html.erb | 12 ++--- app/views/proposals/show.html.erb | 1 + app/views/topics/_form.html.erb | 15 ++++++ app/views/topics/_topics.html.erb | 16 +++++++ app/views/topics/edit.html.erb | 10 ++++ app/views/topics/new.html.erb | 12 +++++ app/views/topics/show.html.erb | 5 ++ config/routes.rb | 5 ++ db/migrate/20170804170049_create_community.rb | 7 +++ ...0170804171325_add_community_to_proposal.rb | 5 ++ db/migrate/20170807082243_create_topics.rb | 9 ++++ db/schema.rb | 20 +++++++- 20 files changed, 210 insertions(+), 10 deletions(-) create mode 100644 app/controllers/communities_controller.rb create mode 100644 app/controllers/topics_controller.rb create mode 100644 app/models/community.rb create mode 100644 app/models/topic.rb create mode 100644 app/views/communities/show.html.erb create mode 100644 app/views/topics/_form.html.erb create mode 100644 app/views/topics/_topics.html.erb create mode 100644 app/views/topics/edit.html.erb create mode 100644 app/views/topics/new.html.erb create mode 100644 app/views/topics/show.html.erb create mode 100644 db/migrate/20170804170049_create_community.rb create mode 100644 db/migrate/20170804171325_add_community_to_proposal.rb create mode 100644 db/migrate/20170807082243_create_topics.rb diff --git a/app/controllers/communities_controller.rb b/app/controllers/communities_controller.rb new file mode 100644 index 000000000..e4421281f --- /dev/null +++ b/app/controllers/communities_controller.rb @@ -0,0 +1,19 @@ +class CommunitiesController < ApplicationController + + before_action :set_community, :load_topics, only: :show + + skip_authorization_check + + def show + end + + private + + def set_community + @community = Community.find(params[:id]) + end + + def load_topics + @topics = @community.topics + end +end diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb new file mode 100644 index 000000000..b2d698e41 --- /dev/null +++ b/app/controllers/topics_controller.rb @@ -0,0 +1,47 @@ +class TopicsController < ApplicationController + + before_action :set_community + + skip_authorization_check + + def new + @topic = Topic.new + end + + def create + @topic = Topic.new(topic_params.merge(author: current_user, community_id: params[:community_id])) + + if @topic.save + redirect_to community_path(@community), notice: I18n.t('flash.actions.create.topic') + else + render :new + end + end + + def show + @topic = Topic.find(params[:id]) + end + + def edit + @topic = Topic.find(params[:id]) + end + + def update + @topic = Topic.find(params[:id]) + if @topic.update(topic_params) + redirect_to community_path(@community), notice: t('topic.update.notice') + else + render :edit + end + end + + private + + def topic_params + params.require(:topic).permit(:title, :community_id) + end + + def set_community + @community = Community.find(params[:community_id]) + end +end diff --git a/app/models/community.rb b/app/models/community.rb new file mode 100644 index 000000000..5d8d82b34 --- /dev/null +++ b/app/models/community.rb @@ -0,0 +1,6 @@ +class Community < ActiveRecord::Base + has_one :proposal + has_one :investment + has_many :topics + +end diff --git a/app/models/proposal.rb b/app/models/proposal.rb index 000c2d42d..ae4ed9682 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -23,6 +23,7 @@ class Proposal < ActiveRecord::Base belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id' belongs_to :geozone + belongs_to :community has_many :comments, as: :commentable has_many :proposal_notifications @@ -43,6 +44,7 @@ class Proposal < ActiveRecord::Base before_validation :set_responsible_name before_save :calculate_hot_score, :calculate_confidence_score + before_create :associate_community scope :for_render, -> { includes(:tags) } scope :sort_by_hot_score, -> { reorder(hot_score: :desc) } @@ -180,6 +182,11 @@ class Proposal < ActiveRecord::Base (voters + followers).uniq end + def associate_community + community = Community.create + self.community_id = community.id + end + protected def set_responsible_name diff --git a/app/models/topic.rb b/app/models/topic.rb new file mode 100644 index 000000000..04411ac91 --- /dev/null +++ b/app/models/topic.rb @@ -0,0 +1,4 @@ +class Topic < ActiveRecord::Base + belongs_to :community + belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id' +end diff --git a/app/views/admin/budget_investments/index.html.erb b/app/views/admin/budget_investments/index.html.erb index beb5eb856..e86402fd5 100644 --- a/app/views/admin/budget_investments/index.html.erb +++ b/app/views/admin/budget_investments/index.html.erb @@ -41,4 +41,3 @@
    <%= render '/admin/budget_investments/investments' %>
    - diff --git a/app/views/admin/budgets/index.html.erb b/app/views/admin/budgets/index.html.erb index 87aaa8c66..6d9c4aee7 100644 --- a/app/views/admin/budgets/index.html.erb +++ b/app/views/admin/budgets/index.html.erb @@ -41,4 +41,4 @@ -<%= paginate @budgets %> \ No newline at end of file +<%= paginate @budgets %> diff --git a/app/views/communities/show.html.erb b/app/views/communities/show.html.erb new file mode 100644 index 000000000..cb3f2334f --- /dev/null +++ b/app/views/communities/show.html.erb @@ -0,0 +1,17 @@ +Comunidad de usuarios +
    +<%= @community.proposal.title %> +
    +Participa en la comunidad de esta propuesta + + +
    +
    + <%= render "topics/topics", topics: @community.topics %> +
    +
    + +
    + Participa + <%= link_to t("topic.new"), new_community_topic_path(@community.id), class: 'button expanded' %> +
    diff --git a/app/views/proposals/index.html.erb b/app/views/proposals/index.html.erb index 072d88ccb..69a8df4a3 100644 --- a/app/views/proposals/index.html.erb +++ b/app/views/proposals/index.html.erb @@ -89,12 +89,12 @@
    diff --git a/app/views/proposals/show.html.erb b/app/views/proposals/show.html.erb index 523c0961d..05ef91fca 100644 --- a/app/views/proposals/show.html.erb +++ b/app/views/proposals/show.html.erb @@ -158,6 +158,7 @@ <% if current_user %> <%= render 'follows/follow_button', follow: find_or_build_follow(current_user, @proposal) %> <% end %> + <%= link_to t("community.show.access"), community_path(@proposal.community_id), class: 'button expanded' %>
    diff --git a/app/views/topics/_form.html.erb b/app/views/topics/_form.html.erb new file mode 100644 index 000000000..e0172219b --- /dev/null +++ b/app/views/topics/_form.html.erb @@ -0,0 +1,15 @@ +<%= form_for([@community, @topic]) do |f| %> + + <%= render 'shared/errors', resource: @topic %> + +
    +
    + <%= f.label :title, t("topic.form.topic_title") %> + <%= f.text_field :title %> +
    + +
    + <%= f.submit(class: "button", value: t("topic.#{action_name}.form.submit_button")) %> +
    +
    +<% end %> diff --git a/app/views/topics/_topics.html.erb b/app/views/topics/_topics.html.erb new file mode 100644 index 000000000..689178143 --- /dev/null +++ b/app/views/topics/_topics.html.erb @@ -0,0 +1,16 @@ +
    + Ordenar por: +
    +
    +<% if topics.any? %> + <% topics.each do |topic| %> +
    + <%= link_to topic.title, community_topic_path(@community, topic) %> + <% if topic.author == current_user %> + <%= link_to t("topic.edit"), edit_community_topic_path(@community.id, topic), class: 'button expanded' %> + <% end %> +
    + <% end %> +<% else %> + Crea el primer tema de la comunidad!!! +<% end %> diff --git a/app/views/topics/edit.html.erb b/app/views/topics/edit.html.erb new file mode 100644 index 000000000..7d6254258 --- /dev/null +++ b/app/views/topics/edit.html.erb @@ -0,0 +1,10 @@ +
    + +
    + <%= render "shared/back_link" %> + +

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

    + + <%= render "form" %> +
    +
    diff --git a/app/views/topics/new.html.erb b/app/views/topics/new.html.erb new file mode 100644 index 000000000..c6620a396 --- /dev/null +++ b/app/views/topics/new.html.erb @@ -0,0 +1,12 @@ +
    +
    +

    <%= t("topic.create") %>

    + + <%= render '/topics/form' %> + <%#= render '/topics/form', form_url: budget_investments_path(@budget) %> +
    +
    + Recomendaciones para crear un tema +
    + +
    diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb new file mode 100644 index 000000000..333b7b543 --- /dev/null +++ b/app/views/topics/show.html.erb @@ -0,0 +1,5 @@ +<%= render "shared/back_link" %> +
    +Comunidad: <%= @community.proposal.title %> +
    +<%= @topic.title %> diff --git a/config/routes.rb b/config/routes.rb index 46751fd48..00985071a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -156,6 +156,10 @@ Rails.application.routes.draw do resource :verification, controller: "verification", only: [:show] + resources :communities, only: [:show] do + resources :topics + end + scope module: :verification do resource :residence, controller: "residence", only: [:new, :create] resource :sms, controller: "sms", only: [:new, :create, :edit, :update] @@ -164,6 +168,7 @@ Rails.application.routes.draw do resource :letter, controller: "letter", only: [:new, :create, :show, :edit, :update] end + namespace :admin do root to: "dashboard#index" resources :organizations, only: :index do diff --git a/db/migrate/20170804170049_create_community.rb b/db/migrate/20170804170049_create_community.rb new file mode 100644 index 000000000..938b75efb --- /dev/null +++ b/db/migrate/20170804170049_create_community.rb @@ -0,0 +1,7 @@ +class CreateCommunity < ActiveRecord::Migration + def change + create_table :communities do |t| + t.timestamps null: false + end + end +end diff --git a/db/migrate/20170804171325_add_community_to_proposal.rb b/db/migrate/20170804171325_add_community_to_proposal.rb new file mode 100644 index 000000000..e18cd53c9 --- /dev/null +++ b/db/migrate/20170804171325_add_community_to_proposal.rb @@ -0,0 +1,5 @@ +class AddCommunityToProposal < ActiveRecord::Migration + def change + add_reference :proposals, :community, index: true, foreign_key: true + end +end diff --git a/db/migrate/20170807082243_create_topics.rb b/db/migrate/20170807082243_create_topics.rb new file mode 100644 index 000000000..3af567279 --- /dev/null +++ b/db/migrate/20170807082243_create_topics.rb @@ -0,0 +1,9 @@ +class CreateTopics < ActiveRecord::Migration + def change + create_table :topics do |t| + t.string :title, null: false + t.integer :author_id + t.references :community, index: true + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 60ae69a0c..086818b57 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170720092638) do +ActiveRecord::Schema.define(version: 20170807082243) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -236,6 +236,11 @@ ActiveRecord::Schema.define(version: 20170720092638) do add_index "comments", ["hidden_at"], name: "index_comments_on_hidden_at", using: :btree add_index "comments", ["user_id"], name: "index_comments_on_user_id", using: :btree + create_table "communities", force: :cascade do |t| + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "debates", force: :cascade do |t| t.string "title", limit: 80 t.text "description" @@ -749,11 +754,13 @@ ActiveRecord::Schema.define(version: 20170720092638) do t.datetime "retired_at" t.string "retired_reason" t.text "retired_explanation" + t.integer "community_id" end add_index "proposals", ["author_id", "hidden_at"], name: "index_proposals_on_author_id_and_hidden_at", using: :btree add_index "proposals", ["author_id"], name: "index_proposals_on_author_id", using: :btree add_index "proposals", ["cached_votes_up"], name: "index_proposals_on_cached_votes_up", using: :btree + add_index "proposals", ["community_id"], name: "index_proposals_on_community_id", using: :btree add_index "proposals", ["confidence_score"], name: "index_proposals_on_confidence_score", using: :btree add_index "proposals", ["geozone_id"], name: "index_proposals_on_geozone_id", using: :btree add_index "proposals", ["hidden_at"], name: "index_proposals_on_hidden_at", using: :btree @@ -883,6 +890,14 @@ ActiveRecord::Schema.define(version: 20170720092638) do add_index "tags", ["proposals_count"], name: "index_tags_on_proposals_count", using: :btree add_index "tags", ["spending_proposals_count"], name: "index_tags_on_spending_proposals_count", using: :btree + create_table "topics", force: :cascade do |t| + t.string "title", null: false + t.integer "author_id" + t.integer "community_id" + end + + add_index "topics", ["community_id"], name: "index_topics_on_community_id", using: :btree + create_table "users", force: :cascade do |t| t.string "email", default: "" t.string "encrypted_password", default: "", null: false @@ -936,7 +951,7 @@ ActiveRecord::Schema.define(version: 20170720092638) do t.boolean "email_digest", default: true t.boolean "email_on_direct_message", default: true t.boolean "official_position_badge", default: false - t.datetime "password_changed_at", default: '2017-06-22 11:21:30', null: false + t.datetime "password_changed_at", default: '2017-08-07 08:24:24', null: false t.boolean "created_from_signature", default: false t.integer "failed_email_digests_count", default: 0 t.text "former_users_data_log", default: "" @@ -1062,6 +1077,7 @@ ActiveRecord::Schema.define(version: 20170720092638) do add_foreign_key "poll_voters", "polls" add_foreign_key "poll_white_results", "poll_booth_assignments", column: "booth_assignment_id" add_foreign_key "poll_white_results", "poll_officer_assignments", column: "officer_assignment_id" + add_foreign_key "proposals", "communities" add_foreign_key "users", "geozones" add_foreign_key "valuators", "users" end From 579a174704f5206fad8292f78815c2b4b7cc8b05 Mon Sep 17 00:00:00 2001 From: Alessandro Cuoghi Date: Mon, 7 Aug 2017 13:33:20 +0200 Subject: [PATCH 12/64] Sidebar: Added button to access the community. Created community.yml. --- app/views/proposals/show.html.erb | 8 +++++++- config/locales/es/community.yml | 7 +++++++ db/schema.rb | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 config/locales/es/community.yml diff --git a/app/views/proposals/show.html.erb b/app/views/proposals/show.html.erb index 05ef91fca..e47dbc226 100644 --- a/app/views/proposals/show.html.erb +++ b/app/views/proposals/show.html.erb @@ -158,7 +158,13 @@ <% if current_user %> <%= render 'follows/follow_button', follow: find_or_build_follow(current_user, @proposal) %> <% end %> - <%= link_to t("community.show.access"), community_path(@proposal.community_id), class: 'button expanded' %> + + +

    <%= t("community.sidebar.title") %>

    +

    + <%= t("community.sidebar.description") %> +

    + <%= link_to t("community.sidebar.button_to_access"), community_path(@proposal.community_id), class: 'button hollow expanded' %>
    diff --git a/config/locales/es/community.yml b/config/locales/es/community.yml new file mode 100644 index 000000000..8c303c800 --- /dev/null +++ b/config/locales/es/community.yml @@ -0,0 +1,7 @@ +es: + community: + sidebar: + title: Comunidad + description: Partecipa a la comunidad de usuarios, da tu opinión. + button_to_access: Acceder a la comunidad + show: diff --git a/db/schema.rb b/db/schema.rb index 086818b57..7c29bccb9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -951,7 +951,7 @@ ActiveRecord::Schema.define(version: 20170807082243) do t.boolean "email_digest", default: true t.boolean "email_on_direct_message", default: true t.boolean "official_position_badge", default: false - t.datetime "password_changed_at", default: '2017-08-07 08:24:24', null: false + t.datetime "password_changed_at", default: '2017-08-07 11:14:09', null: false t.boolean "created_from_signature", default: false t.integer "failed_email_digests_count", default: 0 t.text "former_users_data_log", default: "" From c6e48946bd7a1f9c79d039d20cb497f6e068b94e Mon Sep 17 00:00:00 2001 From: taitus Date: Mon, 7 Aug 2017 13:42:12 +0200 Subject: [PATCH 13/64] Add timestamps to Topic. Add fields on topic list. --- app/controllers/topics_controller.rb | 1 + app/views/topics/_topics.html.erb | 4 ++++ app/views/topics/new.html.erb | 1 + db/migrate/20170807082243_create_topics.rb | 1 + db/schema.rb | 8 +++++--- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index b2d698e41..71794ffe7 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -1,4 +1,5 @@ class TopicsController < ApplicationController + # include CommentableActions before_action :set_community diff --git a/app/views/topics/_topics.html.erb b/app/views/topics/_topics.html.erb index 689178143..26ac9cac8 100644 --- a/app/views/topics/_topics.html.erb +++ b/app/views/topics/_topics.html.erb @@ -6,6 +6,10 @@ <% topics.each do |topic| %>
    <%= link_to topic.title, community_topic_path(@community, topic) %> +
    + <%= topic.author.name %> +
    + <%= I18n.l topic.created_at %> <% if topic.author == current_user %> <%= link_to t("topic.edit"), edit_community_topic_path(@community.id, topic), class: 'button expanded' %> <% end %> diff --git a/app/views/topics/new.html.erb b/app/views/topics/new.html.erb index c6620a396..d420e730f 100644 --- a/app/views/topics/new.html.erb +++ b/app/views/topics/new.html.erb @@ -1,5 +1,6 @@
    + <%= render "shared/back_link" %>

    <%= t("topic.create") %>

    <%= render '/topics/form' %> diff --git a/db/migrate/20170807082243_create_topics.rb b/db/migrate/20170807082243_create_topics.rb index 3af567279..5c554ee88 100644 --- a/db/migrate/20170807082243_create_topics.rb +++ b/db/migrate/20170807082243_create_topics.rb @@ -4,6 +4,7 @@ class CreateTopics < ActiveRecord::Migration t.string :title, null: false t.integer :author_id t.references :community, index: true + t.timestamps null: false end end end diff --git a/db/schema.rb b/db/schema.rb index 7c29bccb9..1dd51131d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -891,9 +891,11 @@ ActiveRecord::Schema.define(version: 20170807082243) do add_index "tags", ["spending_proposals_count"], name: "index_tags_on_spending_proposals_count", using: :btree create_table "topics", force: :cascade do |t| - t.string "title", null: false - t.integer "author_id" - t.integer "community_id" + t.string "title", null: false + t.integer "author_id" + t.integer "community_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end add_index "topics", ["community_id"], name: "index_topics_on_community_id", using: :btree From ebf62ef08dc4039ebe1d7c49f9c220a2b6a36158 Mon Sep 17 00:00:00 2001 From: Alessandro Cuoghi Date: Mon, 7 Aug 2017 13:43:57 +0200 Subject: [PATCH 14/64] Show: Created jumbo light and converted plain text to yml. --- app/views/communities/show.html.erb | 31 +++++++++++++++++------------ config/locales/es/community.yml | 3 +++ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/app/views/communities/show.html.erb b/app/views/communities/show.html.erb index cb3f2334f..363644e17 100644 --- a/app/views/communities/show.html.erb +++ b/app/views/communities/show.html.erb @@ -1,17 +1,22 @@ -Comunidad de usuarios -
    -<%= @community.proposal.title %> -
    -Participa en la comunidad de esta propuesta - - -
    -
    - <%= render "topics/topics", topics: @community.topics %> +
    +
    +
    +

    <%= t("community.show.title") %>

    +

    <%= @community.proposal.title %>

    +

    <%= t("community.show.description") %>

    +
    -
    - Participa - <%= link_to t("topic.new"), new_community_topic_path(@community.id), class: 'button expanded' %> +
    +
    +
    + <%= render "topics/topics", topics: @community.topics %> +
    +
    + +
    + Participa + <%= link_to t("topic.new"), new_community_topic_path(@community.id), class: 'button expanded' %> +
    diff --git a/config/locales/es/community.yml b/config/locales/es/community.yml index 8c303c800..fd5ce9e44 100644 --- a/config/locales/es/community.yml +++ b/config/locales/es/community.yml @@ -4,4 +4,7 @@ es: title: Comunidad description: Partecipa a la comunidad de usuarios, da tu opinión. button_to_access: Acceder a la comunidad + show: + title: Comunidad de usuarios + description: Participa en la comunidad de esta propuesta From 7cf932490d758dd0a5a4a7bd569d94755a238389 Mon Sep 17 00:00:00 2001 From: Alessandro Cuoghi Date: Mon, 7 Aug 2017 14:12:25 +0200 Subject: [PATCH 15/64] remove tag. --- app/views/topics/_topics.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/topics/_topics.html.erb b/app/views/topics/_topics.html.erb index 26ac9cac8..e25897b4d 100644 --- a/app/views/topics/_topics.html.erb +++ b/app/views/topics/_topics.html.erb @@ -1,7 +1,7 @@
    Ordenar por:
    -
    + <% if topics.any? %> <% topics.each do |topic| %>
    From bea393bcdec7b8b738079c103e37e6e74a2236fa Mon Sep 17 00:00:00 2001 From: taitus Date: Mon, 7 Aug 2017 15:05:36 +0200 Subject: [PATCH 16/64] Add comments to topics --- app/controllers/topics_controller.rb | 7 ++++++- app/models/comment.rb | 2 +- app/models/topic.rb | 5 +++++ app/views/topics/_comments.html.erb | 24 ++++++++++++++++++++++ app/views/topics/_topics.html.erb | 10 +++++---- app/views/topics/show.html.erb | 9 ++++++++ db/migrate/20170807082243_create_topics.rb | 2 ++ db/schema.rb | 9 +++++--- 8 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 app/views/topics/_comments.html.erb diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index 71794ffe7..18e967e95 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -1,8 +1,10 @@ class TopicsController < ApplicationController - # include CommentableActions + include CommentableActions before_action :set_community + has_orders %w{most_voted newest oldest}, only: :show + skip_authorization_check def new @@ -21,6 +23,9 @@ class TopicsController < ApplicationController def show @topic = Topic.find(params[:id]) + @commentable = @topic + @comment_tree = CommentTree.new(@commentable, params[:page], @current_order) + set_comment_flags(@comment_tree.comments) end def edit diff --git a/app/models/comment.rb b/app/models/comment.rb index 1db9809ee..8b68e11ad 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -3,7 +3,7 @@ class Comment < ActiveRecord::Base include HasPublicAuthor include Graphqlable - COMMENTABLE_TYPES = %w(Debate Proposal Budget::Investment Poll::Question Legislation::Question Legislation::Annotation).freeze + COMMENTABLE_TYPES = %w(Debate Proposal Budget::Investment Poll::Question Legislation::Question Legislation::Annotation Topic).freeze acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases diff --git a/app/models/topic.rb b/app/models/topic.rb index 04411ac91..6961e3f76 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -1,4 +1,9 @@ class Topic < ActiveRecord::Base + acts_as_paranoid column: :hidden_at + include ActsAsParanoidAliases + belongs_to :community belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id' + + has_many :comments, as: :commentable end diff --git a/app/views/topics/_comments.html.erb b/app/views/topics/_comments.html.erb new file mode 100644 index 000000000..ccab89847 --- /dev/null +++ b/app/views/topics/_comments.html.erb @@ -0,0 +1,24 @@ +<% cache [locale_and_user_status, @current_order, commentable_cache_key(@topic), @comment_tree.comments, @comment_tree.comment_authors, @topic.comments_count, @comment_flags] do %> +
    +
    + <%= render 'shared/wide_order_selector', i18n_namespace: "comments" %> + + <% if user_signed_in? %> + <%= render 'comments/form', {commentable: @topic, parent_id: nil, toggeable: false} %> + <% else %> +
    + +
    + <%= t("topics.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/topics/_topics.html.erb b/app/views/topics/_topics.html.erb index e25897b4d..7c28e0d9a 100644 --- a/app/views/topics/_topics.html.erb +++ b/app/views/topics/_topics.html.erb @@ -6,10 +6,12 @@ <% topics.each do |topic| %>
    <%= link_to topic.title, community_topic_path(@community, topic) %> -
    - <%= topic.author.name %> -
    - <%= I18n.l topic.created_at %> +

    + <%= link_to t("proposals.proposal.comments", count: topic.comments_count), community_topic_path(@community, topic, anchor: "comments") %> + <%= topic.author.name %> + <%= I18n.l topic.created_at %> +

    + <% if topic.author == current_user %> <%= link_to t("topic.edit"), edit_community_topic_path(@community.id, topic), class: 'button expanded' %> <% end %> diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb index 333b7b543..b44d3b7cf 100644 --- a/app/views/topics/show.html.erb +++ b/app/views/topics/show.html.erb @@ -3,3 +3,12 @@ Comunidad: <%= @community.proposal.title %>
    <%= @topic.title %> + +
    + <%#= render "proposals/filter_subnav" %> + <%#= render "proposals/notifications" %> + +
    + <%= render "topics/comments" %> +
    +
    diff --git a/db/migrate/20170807082243_create_topics.rb b/db/migrate/20170807082243_create_topics.rb index 5c554ee88..047a7507c 100644 --- a/db/migrate/20170807082243_create_topics.rb +++ b/db/migrate/20170807082243_create_topics.rb @@ -3,7 +3,9 @@ class CreateTopics < ActiveRecord::Migration create_table :topics do |t| t.string :title, null: false t.integer :author_id + t.integer "comments_count", default: 0 t.references :community, index: true + t.datetime :hidden_at, index: true t.timestamps null: false end end diff --git a/db/schema.rb b/db/schema.rb index 1dd51131d..09047efe1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -891,14 +891,17 @@ ActiveRecord::Schema.define(version: 20170807082243) do add_index "tags", ["spending_proposals_count"], name: "index_tags_on_spending_proposals_count", using: :btree create_table "topics", force: :cascade do |t| - t.string "title", null: false + t.string "title", null: false t.integer "author_id" + t.integer "comments_count", default: 0 t.integer "community_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "hidden_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end add_index "topics", ["community_id"], name: "index_topics_on_community_id", using: :btree + add_index "topics", ["hidden_at"], name: "index_topics_on_hidden_at", using: :btree create_table "users", force: :cascade do |t| t.string "email", default: "" From d8b43235555b0f6f2d8943c6d2342c7c25b1ccbf Mon Sep 17 00:00:00 2001 From: taitus Date: Mon, 7 Aug 2017 15:20:05 +0200 Subject: [PATCH 17/64] Add comments tab to topic show --- app/views/topics/_filter_subnav.html.erb | 14 ++++++++++++++ app/views/topics/show.html.erb | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 app/views/topics/_filter_subnav.html.erb diff --git a/app/views/topics/_filter_subnav.html.erb b/app/views/topics/_filter_subnav.html.erb new file mode 100644 index 000000000..4af1b4962 --- /dev/null +++ b/app/views/topics/_filter_subnav.html.erb @@ -0,0 +1,14 @@ +
    +
    +
      +
    • + <%= link_to "#tab-comments" do %> +

      + <%= t("topics.show.comments_tab") %> + (<%= @topic.comments_count %>) +

      + <% end %> +
    • +
    +
    +
    diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb index b44d3b7cf..599c62053 100644 --- a/app/views/topics/show.html.erb +++ b/app/views/topics/show.html.erb @@ -5,7 +5,7 @@ Comunidad: <%= @community.proposal.title %> <%= @topic.title %>
    - <%#= render "proposals/filter_subnav" %> + <%= render "topics/filter_subnav" %> <%#= render "proposals/notifications" %>
    From bc95b6f28d08c66a118d97c00c6bd9ea85564aab Mon Sep 17 00:00:00 2001 From: taitus Date: Mon, 7 Aug 2017 15:48:43 +0200 Subject: [PATCH 18/64] Add description as comment on topic. --- app/controllers/topics_controller.rb | 2 +- app/models/topic.rb | 8 ++++++++ app/views/topics/_form.html.erb | 2 ++ db/migrate/20170807082243_create_topics.rb | 1 + db/schema.rb | 9 +++++---- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index 18e967e95..eaa699c37 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -44,7 +44,7 @@ class TopicsController < ApplicationController private def topic_params - params.require(:topic).permit(:title, :community_id) + params.require(:topic).permit(:title, :community_id, :description_as_comment) end def set_community diff --git a/app/models/topic.rb b/app/models/topic.rb index 6961e3f76..6da411aab 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -6,4 +6,12 @@ class Topic < ActiveRecord::Base belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id' has_many :comments, as: :commentable + + after_create :associate_comment + + private + + def associate_comment + Comment.create(commentable: self, user: self.author, body: self.description_as_comment) + end end diff --git a/app/views/topics/_form.html.erb b/app/views/topics/_form.html.erb index e0172219b..192e11fff 100644 --- a/app/views/topics/_form.html.erb +++ b/app/views/topics/_form.html.erb @@ -6,6 +6,8 @@
    <%= f.label :title, t("topic.form.topic_title") %> <%= f.text_field :title %> + <%= f.label :description_as_comment, t("topic.form.topic_description_as_comment") %> + <%= f.text_area :description_as_comment, maxlength: Comment.body_max_length %>
    diff --git a/db/migrate/20170807082243_create_topics.rb b/db/migrate/20170807082243_create_topics.rb index 047a7507c..1352751cc 100644 --- a/db/migrate/20170807082243_create_topics.rb +++ b/db/migrate/20170807082243_create_topics.rb @@ -2,6 +2,7 @@ class CreateTopics < ActiveRecord::Migration def change create_table :topics do |t| t.string :title, null: false + t.text :description_as_comment t.integer :author_id t.integer "comments_count", default: 0 t.references :community, index: true diff --git a/db/schema.rb b/db/schema.rb index 09047efe1..77b9d5d44 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -891,13 +891,14 @@ ActiveRecord::Schema.define(version: 20170807082243) do add_index "tags", ["spending_proposals_count"], name: "index_tags_on_spending_proposals_count", using: :btree create_table "topics", force: :cascade do |t| - t.string "title", null: false + t.string "title", null: false + t.text "description_as_comment" t.integer "author_id" - t.integer "comments_count", default: 0 + t.integer "comments_count", default: 0 t.integer "community_id" t.datetime "hidden_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end add_index "topics", ["community_id"], name: "index_topics_on_community_id", using: :btree From 08f58b845d3f2400655f03cd9067f0f3a2c29b51 Mon Sep 17 00:00:00 2001 From: taitus Date: Mon, 7 Aug 2017 16:39:45 +0200 Subject: [PATCH 19/64] Add participants to community --- app/models/user.rb | 5 +++++ app/views/communities/show.html.erb | 7 +++++++ app/views/topics/show.html.erb | 1 - 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 60536195b..4d44456d6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -313,6 +313,11 @@ class User < ActiveRecord::Base follows.map{|follow| follow.followable.tags.map(&:name)}.flatten.compact.uniq end + def self.community_participants(community) + topics_ids = community.topics.pluck(:id) + User.joins(:comments).where("comments.commentable_id IN (?) and comments.commentable_type = 'Topic'", topics_ids) + end + private def clean_document_number diff --git a/app/views/communities/show.html.erb b/app/views/communities/show.html.erb index 363644e17..33eaf47d4 100644 --- a/app/views/communities/show.html.erb +++ b/app/views/communities/show.html.erb @@ -20,3 +20,10 @@ <%= link_to t("topic.new"), new_community_topic_path(@community.id), class: 'button expanded' %>
    + +
    + Participantes + <% User.community_participants(@community).each do |participant| %> + <%= link_to participant.name, user_path(participant)%> + <% end %> +
    diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb index 599c62053..0e62d5606 100644 --- a/app/views/topics/show.html.erb +++ b/app/views/topics/show.html.erb @@ -6,7 +6,6 @@ Comunidad: <%= @community.proposal.title %>
    <%= render "topics/filter_subnav" %> - <%#= render "proposals/notifications" %>
    <%= render "topics/comments" %> From b4cdca215dd2f24950237b396e2390d815ce0557 Mon Sep 17 00:00:00 2001 From: Alessandro Cuoghi Date: Mon, 7 Aug 2017 16:42:23 +0200 Subject: [PATCH 20/64] Added style show community. --- app/assets/stylesheets/application.scss | 1 + app/assets/stylesheets/community.scss | 50 +++++++++++++++++++++++++ app/views/topics/_form.html.erb | 9 ++--- app/views/topics/_topics.html.erb | 49 +++++++++++++++++------- app/views/topics/edit.html.erb | 14 +++++-- app/views/topics/new.html.erb | 13 +++++-- config/locales/es/community.yml | 14 +++++++ 7 files changed, 126 insertions(+), 24 deletions(-) create mode 100644 app/assets/stylesheets/community.scss diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 6db475365..19c73de32 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -9,6 +9,7 @@ @import 'pages'; @import 'legislation'; @import 'legislation_process'; +@import 'community'; @import 'custom'; @import 'c3'; @import 'annotator.min'; diff --git a/app/assets/stylesheets/community.scss b/app/assets/stylesheets/community.scss new file mode 100644 index 000000000..643f7b994 --- /dev/null +++ b/app/assets/stylesheets/community.scss @@ -0,0 +1,50 @@ +.communities-show{ + + .wide-order-selector{ + margin-top: 0; + } + + .panel{ + background: #fff; + border: 1px solid; + border-color: #e5e6e9 #dfe0e4 #d0d1d5; + border-radius: 0; + box-shadow: 0 1px 3px 0 #dee0e3; + margin-bottom: 0.75rem; + min-height:7rem; + padding: 0.75rem 0.75rem 0; + } + + .panel { + h3{ + font-weight: bold; + margin-top: $line-height / 2; + } + + a { + color: $text; + } + .nopadding{ + padding: 0; + } + .button{ + margin-top: $line-height; + } + + .topic-info{ + + color: #515151; + font-size: 0.875rem; + margin: 0.375rem 0 0; + + .icon-comments { + font-size: rem-calc(16); + vertical-align: top; + } + + a { + color: $text-medium; + } + } + } +} diff --git a/app/views/topics/_form.html.erb b/app/views/topics/_form.html.erb index 192e11fff..a5cc1532f 100644 --- a/app/views/topics/_form.html.erb +++ b/app/views/topics/_form.html.erb @@ -4,14 +4,13 @@
    - <%= f.label :title, t("topic.form.topic_title") %> - <%= f.text_field :title %> - <%= f.label :description_as_comment, t("topic.form.topic_description_as_comment") %> - <%= f.text_area :description_as_comment, maxlength: Comment.body_max_length %> + <%= f.label :title, t("community.topic.form.topic_title") %> + <%= f.text_field :title, label: false %>
    - <%= f.submit(class: "button", value: t("topic.#{action_name}.form.submit_button")) %> + <%= f.submit(class: "button", value: t("community.topic.form.submit_button")) %> + <%#= f.submit(class: "button", value: t("community.topic.#{action_name}.form.submit_button")) %>
    <% end %> diff --git a/app/views/topics/_topics.html.erb b/app/views/topics/_topics.html.erb index 7c28e0d9a..0e6709daf 100644 --- a/app/views/topics/_topics.html.erb +++ b/app/views/topics/_topics.html.erb @@ -1,20 +1,43 @@ -
    - Ordenar por: +
    +
    +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    <% if topics.any? %> <% topics.each do |topic| %> -
    - <%= link_to topic.title, community_topic_path(@community, topic) %> -

    - <%= link_to t("proposals.proposal.comments", count: topic.comments_count), community_topic_path(@community, topic, anchor: "comments") %> - <%= topic.author.name %> - <%= I18n.l topic.created_at %> -

    - - <% if topic.author == current_user %> - <%= link_to t("topic.edit"), edit_community_topic_path(@community.id, topic), class: 'button expanded' %> - <% end %> +
    +
    +

    <%= link_to topic.title, community_topic_path(@community, topic) %>

    +

    +   + <%= link_to t("proposals.proposal.comments", count: topic.comments_count), community_topic_path(@community, topic, anchor: "comments") %> +  •  + <%= I18n.l topic.created_at.to_date %> +  •  + <%= topic.author.name %> +

    +
    +
    + <% if topic.author == current_user %> + <%= link_to t("community.topic.edit_button"), edit_community_topic_path(@community.id, topic), class: 'button small hollow' %> + <% end %> +
    <% end %> <% else %> diff --git a/app/views/topics/edit.html.erb b/app/views/topics/edit.html.erb index 7d6254258..9f443b5d9 100644 --- a/app/views/topics/edit.html.erb +++ b/app/views/topics/edit.html.erb @@ -1,10 +1,18 @@
    -
    +
    <%= render "shared/back_link" %> -

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

    - <%= render "form" %>
    + +
    + +

    <%= t("community.sidebar.topic.recommendations_title") %>

    +
      +
    • <%= t("community.sidebar.topic.recommendation_one") %>
    • +
    • <%= t("community.sidebar.topic.recommendation_two") %>
    • +
    • <%= t("community.sidebar.topic..recommendation_three") %>
    • +
    +
    diff --git a/app/views/topics/new.html.erb b/app/views/topics/new.html.erb index d420e730f..475ad4872 100644 --- a/app/views/topics/new.html.erb +++ b/app/views/topics/new.html.erb @@ -1,13 +1,20 @@
    <%= render "shared/back_link" %> -

    <%= t("topic.create") %>

    +

    <%= t("community.topic.create") %>

    <%= render '/topics/form' %> <%#= render '/topics/form', form_url: budget_investments_path(@budget) %>
    -
    - Recomendaciones para crear un tema + +
    + +

    <%= t("community.sidebar.topic.recommendations_title") %>

    +
      +
    • <%= t("community.sidebar.topic.recommendation_one") %>
    • +
    • <%= t("community.sidebar.topic.recommendation_two") %>
    • +
    • <%= t("community.sidebar.topic..recommendation_three") %>
    • +
    diff --git a/config/locales/es/community.yml b/config/locales/es/community.yml index fd5ce9e44..958a9ce37 100644 --- a/config/locales/es/community.yml +++ b/config/locales/es/community.yml @@ -4,7 +4,21 @@ es: title: Comunidad description: Partecipa a la comunidad de usuarios, da tu opinión. button_to_access: Acceder a la comunidad + topic: + title: Participa + new_topic: Crea un tema + recommendations_title: Recomendaciones para crear un tema + recommendation_one: No escribas el título del tema o frases enteras en mayúsculas. En internet eso se considera gritar. Y a nadie le gusta que le griten. + recommendation_two: Cualquier tema o comentario que implique una acción ilegal será eliminada, también las que tengan la intención de sabotear los espacios del tema, todo lo demás está permitido. + recommendation_three: Disfruta de este espacio, de las voces que lo llenan, también es tuyo show: title: Comunidad de usuarios description: Participa en la comunidad de esta propuesta + + topic: + create: Crear un tema + edit_button: Editar + form: + topic_title: Titulo del tema + submit_button: Crear tema From 1dc3cd4bb386e03a7f0c1441f9d202508ee0ee6e Mon Sep 17 00:00:00 2001 From: taitus Date: Mon, 7 Aug 2017 18:20:57 +0200 Subject: [PATCH 21/64] Add paginate to topics --- app/controllers/communities_controller.rb | 2 +- app/views/communities/show.html.erb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/communities_controller.rb b/app/controllers/communities_controller.rb index e4421281f..b8d691aa7 100644 --- a/app/controllers/communities_controller.rb +++ b/app/controllers/communities_controller.rb @@ -14,6 +14,6 @@ class CommunitiesController < ApplicationController end def load_topics - @topics = @community.topics + @topics = @community.topics.page(params[:page]) end end diff --git a/app/views/communities/show.html.erb b/app/views/communities/show.html.erb index 33eaf47d4..ab7692f3b 100644 --- a/app/views/communities/show.html.erb +++ b/app/views/communities/show.html.erb @@ -11,8 +11,9 @@
    - <%= render "topics/topics", topics: @community.topics %> + <%= render "topics/topics", topics: @topics %>
    + <%= paginate @topics %>
    From a1d37fa6c4f9f513028f26f1ca9b35b01a951039 Mon Sep 17 00:00:00 2001 From: taitus Date: Mon, 7 Aug 2017 18:56:04 +0200 Subject: [PATCH 22/64] Add order on topic index. --- app/controllers/communities_controller.rb | 10 ++++++++-- app/models/topic.rb | 4 ++++ app/views/topics/_topics.html.erb | 22 +++------------------- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/app/controllers/communities_controller.rb b/app/controllers/communities_controller.rb index b8d691aa7..f28e03a05 100644 --- a/app/controllers/communities_controller.rb +++ b/app/controllers/communities_controller.rb @@ -1,6 +1,8 @@ class CommunitiesController < ApplicationController - before_action :set_community, :load_topics, only: :show + before_action :set_order, :set_community, :load_topics, only: :show + + has_orders %w{newest most_commented oldest}, only: :show skip_authorization_check @@ -9,11 +11,15 @@ class CommunitiesController < ApplicationController private + def set_order + @order = params[:order].present? ? params[:order] : "newest" + end + def set_community @community = Community.find(params[:id]) end def load_topics - @topics = @community.topics.page(params[:page]) + @topics = @community.topics.send("sort_by_#{@order}").page(params[:page]) end end diff --git a/app/models/topic.rb b/app/models/topic.rb index 6da411aab..4161a4dce 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -9,6 +9,10 @@ class Topic < ActiveRecord::Base after_create :associate_comment + scope :sort_by_newest, -> { order(created_at: :desc) } + scope :sort_by_oldest, -> { order(created_at: :asc) } + scope :sort_by_most_commented, -> { reorder(comments_count: :desc) } + private def associate_comment diff --git a/app/views/topics/_topics.html.erb b/app/views/topics/_topics.html.erb index 0e6709daf..48b878bec 100644 --- a/app/views/topics/_topics.html.erb +++ b/app/views/topics/_topics.html.erb @@ -1,22 +1,6 @@ -
    -
    -
    -
    -
    - -
    - -
    - -
    -
    -
    -
    +
    + Ordenar por: + <%= render 'shared/wide_order_selector', i18n_namespace: "topics" %>
    <% if topics.any? %> From 83683eb53f4df53c382228f4b6cc54942e8e35a2 Mon Sep 17 00:00:00 2001 From: Alessandro Cuoghi Date: Mon, 7 Aug 2017 19:10:00 +0200 Subject: [PATCH 23/64] Changed community.yml buttons. --- app/views/topics/_form.html.erb | 3 +-- config/locales/es/community.yml | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/views/topics/_form.html.erb b/app/views/topics/_form.html.erb index a5cc1532f..80daac2c0 100644 --- a/app/views/topics/_form.html.erb +++ b/app/views/topics/_form.html.erb @@ -9,8 +9,7 @@
    - <%= f.submit(class: "button", value: t("community.topic.form.submit_button")) %> - <%#= f.submit(class: "button", value: t("community.topic.#{action_name}.form.submit_button")) %> + <%= f.submit(class: "button", value: t("community.topic.form.#{action_name}.submit_button")) %>
    <% end %> diff --git a/config/locales/es/community.yml b/config/locales/es/community.yml index 958a9ce37..bfde5227b 100644 --- a/config/locales/es/community.yml +++ b/config/locales/es/community.yml @@ -21,4 +21,8 @@ es: edit_button: Editar form: topic_title: Titulo del tema - submit_button: Crear tema + topic_description_as_comment: Comentario inicial + new: + submit_button: Crear tema + edit: + submit_button: Editar tema From 11f6515e8494a19d15718dfb017c457eb2785a82 Mon Sep 17 00:00:00 2001 From: Alessandro Cuoghi Date: Tue, 8 Aug 2017 12:20:16 +0200 Subject: [PATCH 24/64] Style topic show. Fix tabs-panel. --- app/assets/stylesheets/community.scss | 31 ++++++++++++--------------- app/views/communities/show.html.erb | 30 ++++++++++++++++++++++---- app/views/topics/show.html.erb | 21 ++++++++++-------- 3 files changed, 52 insertions(+), 30 deletions(-) diff --git a/app/assets/stylesheets/community.scss b/app/assets/stylesheets/community.scss index 643f7b994..0c788a2fa 100644 --- a/app/assets/stylesheets/community.scss +++ b/app/assets/stylesheets/community.scss @@ -1,5 +1,5 @@ .communities-show{ - + .wide-order-selector{ margin-top: 0; } @@ -30,21 +30,18 @@ .button{ margin-top: $line-height; } - - .topic-info{ - - color: #515151; - font-size: 0.875rem; - margin: 0.375rem 0 0; - - .icon-comments { - font-size: rem-calc(16); - vertical-align: top; - } - - a { - color: $text-medium; - } - } + } +} + +.communities-participantes{ + .comment-body{ + display: inline-block; + float: left; + margin-right: $line-height; + } +} +.topic-show{ + p{ + margin-bottom: 0; } } diff --git a/app/views/communities/show.html.erb b/app/views/communities/show.html.erb index ab7692f3b..ea4fc8aae 100644 --- a/app/views/communities/show.html.erb +++ b/app/views/communities/show.html.erb @@ -22,9 +22,31 @@
    -
    - Participantes - <% User.community_participants(@community).each do |participant| %> - <%= link_to participant.name, user_path(participant)%> +
    +
      +
    • + <%= link_to "#tab-participantes" do %> +

      + Participantes + + (<%= @participants.count %>) +

      + <% end %> +
    • +
    + <% @participants.each do |participant| %> + +
    +
    + <%= image_tag("avatar_admin.png", size: 32, class: "admin-avatar float-left") %> +
    + + <%= link_to participant.name, user_path(participant)%> + +
    +
    +
    + + <%#= link_to participant.name, user_path(participant)%> <% end %>
    diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb index 0e62d5606..51fe661e2 100644 --- a/app/views/topics/show.html.erb +++ b/app/views/topics/show.html.erb @@ -1,13 +1,16 @@ -<%= render "shared/back_link" %> -
    -Comunidad: <%= @community.proposal.title %> -
    -<%= @topic.title %> +
    +
    + <%= render "shared/back_link" %> +
    +

    Comunidad: <%= @community.proposal.title %>

    +

    <%= @topic.title %>

    -
    - <%= render "topics/filter_subnav" %> +
    + <%= render "topics/filter_subnav" %> -
    - <%= render "topics/comments" %> +
    + <%= render "topics/comments" %> +
    +
    From e5fb90f954cb14ffd8eb7209aa8decaf602a5927 Mon Sep 17 00:00:00 2001 From: Alessandro Cuoghi Date: Tue, 8 Aug 2017 17:01:58 +0200 Subject: [PATCH 25/64] Renaming class. Topic show: Added author_info. --- app/assets/stylesheets/community.scss | 12 +++++++++++- app/assets/stylesheets/participation.scss | 7 +++++-- app/views/communities/show.html.erb | 2 +- app/views/topics/_comments.html.erb | 13 ++++++++----- app/views/topics/show.html.erb | 11 +++++++++-- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/app/assets/stylesheets/community.scss b/app/assets/stylesheets/community.scss index 0c788a2fa..13ff3bf60 100644 --- a/app/assets/stylesheets/community.scss +++ b/app/assets/stylesheets/community.scss @@ -33,15 +33,25 @@ } } -.communities-participantes{ +.communities-participants{ .comment-body{ display: inline-block; float: left; margin-right: $line-height; + margin-bottom: $line-height; } } .topic-show{ p{ margin-bottom: 0; } + ul li { + margin-bottom:0; + } + .comments{ + .first-comment{ + margin-top: $line-height; + margin-bottom: $line-height; + } + } } diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index 8d79eca55..84c223170 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -316,7 +316,9 @@ .debate-quiz, .budget-investment-show, .draft-panels, -.debate-questions { +.debate-questions, +.communities-show, +.topic-show { p { word-wrap: break-word; @@ -350,7 +352,8 @@ .debate-info, .proposal-info, .investment-project-info, - .budget-investment-show { + .budget-investment-show, + .topic-info { clear: both; color: $text-medium; font-size: $small-font-size; diff --git a/app/views/communities/show.html.erb b/app/views/communities/show.html.erb index ea4fc8aae..69bf729c0 100644 --- a/app/views/communities/show.html.erb +++ b/app/views/communities/show.html.erb @@ -22,7 +22,7 @@
    -
    +
    • <%= link_to "#tab-participantes" do %> diff --git a/app/views/topics/_comments.html.erb b/app/views/topics/_comments.html.erb index ccab89847..84d7b1ac3 100644 --- a/app/views/topics/_comments.html.erb +++ b/app/views/topics/_comments.html.erb @@ -1,13 +1,20 @@ <% cache [locale_and_user_status, @current_order, commentable_cache_key(@topic), @comment_tree.comments, @comment_tree.comment_authors, @topic.comments_count, @comment_flags] do %>
      +
      <%= render 'shared/wide_order_selector', i18n_namespace: "comments" %> + + <% @comment_tree.root_comments.each do |comment| %> + + <%= render 'comments/comment', comment: comment %> + <% end %> + + <%= paginate @comment_tree.root_comments %> <% if user_signed_in? %> <%= render 'comments/form', {commentable: @topic, parent_id: nil, toggeable: false} %> <% else %>
      -
      <%= t("topics.show.login_to_comment", signin: link_to(t("votes.signin"), new_user_session_path), @@ -15,10 +22,6 @@
      <% 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/topics/show.html.erb b/app/views/topics/show.html.erb index 51fe661e2..b5eb454fa 100644 --- a/app/views/topics/show.html.erb +++ b/app/views/topics/show.html.erb @@ -2,12 +2,19 @@
      <%= render "shared/back_link" %>
      -

      Comunidad: <%= @community.proposal.title %>

      +

      Comunidad de la propuesta: <%= @community.proposal.title %>

      <%= @topic.title %>

      +
      + <%= render '/shared/author_info', resource: @topic %> + +  •  + <%= l @topic.created_at.to_date %> +  •  +   +
      <%= render "topics/filter_subnav" %> -
      <%= render "topics/comments" %>
      From 322ecf4fd577cd53a5467b4c0b8a39b71852748f Mon Sep 17 00:00:00 2001 From: Alessandro Cuoghi Date: Tue, 8 Aug 2017 18:14:48 +0200 Subject: [PATCH 26/64] Changed some translations. --- app/assets/stylesheets/community.scss | 2 +- app/views/communities/show.html.erb | 19 +++++------ app/views/topics/_filter_subnav.html.erb | 4 +-- app/views/topics/_topics.html.erb | 2 +- app/views/topics/show.html.erb | 5 +-- config/locales/en/community.yml | 41 ++++++++++++++++++++++++ config/locales/es/community.yml | 11 +++++++ 7 files changed, 69 insertions(+), 15 deletions(-) create mode 100644 config/locales/en/community.yml diff --git a/app/assets/stylesheets/community.scss b/app/assets/stylesheets/community.scss index 13ff3bf60..55db691ad 100644 --- a/app/assets/stylesheets/community.scss +++ b/app/assets/stylesheets/community.scss @@ -33,7 +33,7 @@ } } -.communities-participants{ +.communities-participant{ .comment-body{ display: inline-block; float: left; diff --git a/app/views/communities/show.html.erb b/app/views/communities/show.html.erb index 69bf729c0..5485cf371 100644 --- a/app/views/communities/show.html.erb +++ b/app/views/communities/show.html.erb @@ -1,9 +1,11 @@ -
      -
      -
      -

      <%= t("community.show.title") %>

      -

      <%= @community.proposal.title %>

      -

      <%= t("community.show.description") %>

      +
      +
      +
      +
      +

      <%= t("community.show.title") %>

      +

      <%= @community.proposal.title %>

      +

      <%= t("community.show.description") %>

      +
      @@ -22,13 +24,12 @@
      -
      +
      • <%= link_to "#tab-participantes" do %>

        - Participantes - + <%= t("community.tab.participant") %> (<%= @participants.count %>)

        <% end %> diff --git a/app/views/topics/_filter_subnav.html.erb b/app/views/topics/_filter_subnav.html.erb index 4af1b4962..8b8c39d40 100644 --- a/app/views/topics/_filter_subnav.html.erb +++ b/app/views/topics/_filter_subnav.html.erb @@ -1,10 +1,10 @@
        -
          +
          • <%= link_to "#tab-comments" do %>

            - <%= t("topics.show.comments_tab") %> + <%= t("community.topic.show.tab.comments_tab") %> (<%= @topic.comments_count %>)

            <% end %> diff --git a/app/views/topics/_topics.html.erb b/app/views/topics/_topics.html.erb index 48b878bec..3df284461 100644 --- a/app/views/topics/_topics.html.erb +++ b/app/views/topics/_topics.html.erb @@ -25,5 +25,5 @@
        <% end %> <% else %> - Crea el primer tema de la comunidad!!! +

        <%= t("community.create_first_community_theme") %>

        <% end %> diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb index b5eb454fa..8525fe337 100644 --- a/app/views/topics/show.html.erb +++ b/app/views/topics/show.html.erb @@ -2,7 +2,8 @@
        <%= render "shared/back_link" %>
        -

        Comunidad de la propuesta: <%= @community.proposal.title %>

        + +

        <%= t("community.topic.show.community_of_the_proposal") %> <%= @community.proposal.title %>

        <%= @topic.title %>

        <%= render '/shared/author_info', resource: @topic %> @@ -13,7 +14,7 @@  
        -
        +
        <%= render "topics/filter_subnav" %>
        <%= render "topics/comments" %> diff --git a/config/locales/en/community.yml b/config/locales/en/community.yml new file mode 100644 index 000000000..fb6b98dd6 --- /dev/null +++ b/config/locales/en/community.yml @@ -0,0 +1,41 @@ +en: + community: + create_first_community_theme: Create the first community theme + join_the_community_of_users: Join the community of users, give your opinion. + tab: + participant: Participants + + sidebar: + title: Community + description: Join the community of users, give your opinion. + button_to_access: Access the community + + topic: + title: Participants + new_topic: Create topic + edit_topic: Edit theme + recommendations_title: Recommendations to create a theme + recommendation_one: Do not write the topic title or whole sentences in capital letters. On the internet that is considered shouting. And no one likes to be yelled at. + recommendation_two: Any topic or comment that implies an illegal action will be eliminated, also those that intend to sabotage the spaces of the subject, everything else is allowed. + recommendation_three: Enjoy this space, the voices that fill it, it's yours too + without_topics: Create the first community topic + + show: + title: User community + description: Participate in the community of this proposal + participants: Participants + + topic: + create: Create a theme + edit_button: Edit + form: + topic_title: Topic Title + topic_description_as_comment: Initial comment + new: + submit_button: Create theme + edit: + submit_button: Edit theme + show: + community_of_the_proposal: Community of the proposal + tab: + comments_tab: Comments diff --git a/config/locales/es/community.yml b/config/locales/es/community.yml index bfde5227b..b0d1f8236 100644 --- a/config/locales/es/community.yml +++ b/config/locales/es/community.yml @@ -1,5 +1,10 @@ es: community: + create_first_community_theme: Crea el primer tema de la comunidad + join_the_community_of_users: Partecipa a la comunidad de usuarios, da tu opinión. + tab: + participant: Participantes + sidebar: title: Comunidad description: Partecipa a la comunidad de usuarios, da tu opinión. @@ -11,10 +16,12 @@ es: recommendation_one: No escribas el título del tema o frases enteras en mayúsculas. En internet eso se considera gritar. Y a nadie le gusta que le griten. recommendation_two: Cualquier tema o comentario que implique una acción ilegal será eliminada, también las que tengan la intención de sabotear los espacios del tema, todo lo demás está permitido. recommendation_three: Disfruta de este espacio, de las voces que lo llenan, también es tuyo + without_topics: Crea el primer tema de la comunidad show: title: Comunidad de usuarios description: Participa en la comunidad de esta propuesta + paricipants: Participantes topic: create: Crear un tema @@ -26,3 +33,7 @@ es: submit_button: Crear tema edit: submit_button: Editar tema + show: + community_of_the_proposal: Comunidad de la propuesta + tab: + comments_tab: Comentarios From 35f6ce4b86f7fbeca563b02528f73f19d52756da Mon Sep 17 00:00:00 2001 From: Alessandro Cuoghi Date: Wed, 9 Aug 2017 17:07:48 +0200 Subject: [PATCH 27/64] Translate button editar. Activated translations into wide_order_selector. --- app/views/communities/show.html.erb | 21 +++++++++++---------- app/views/topics/_topics.html.erb | 11 ++++++----- config/locales/es/community.yml | 4 +++- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/app/views/communities/show.html.erb b/app/views/communities/show.html.erb index 5485cf371..d8b495855 100644 --- a/app/views/communities/show.html.erb +++ b/app/views/communities/show.html.erb @@ -8,19 +8,20 @@
        -
        -
        -
        -
        - <%= render "topics/topics", topics: @topics %> +
        +
        +
        + <%= render "topics/topics", topics: @topics %> +
        + <%= paginate @topics %>
        - <%= paginate @topics %> -
        -
        - Participa - <%= link_to t("topic.new"), new_community_topic_path(@community.id), class: 'button expanded' %> +
        diff --git a/app/views/topics/_topics.html.erb b/app/views/topics/_topics.html.erb index 3df284461..96a7fbdd8 100644 --- a/app/views/topics/_topics.html.erb +++ b/app/views/topics/_topics.html.erb @@ -1,9 +1,10 @@ -
        - Ordenar por: - <%= render 'shared/wide_order_selector', i18n_namespace: "topics" %> -
        - <% if topics.any? %> +
        +
        + <%= render 'shared/wide_order_selector', i18n_namespace: "comments" %> +
        +
        + <% topics.each do |topic| %>
        diff --git a/config/locales/es/community.yml b/config/locales/es/community.yml index b0d1f8236..c82f6c83f 100644 --- a/config/locales/es/community.yml +++ b/config/locales/es/community.yml @@ -25,6 +25,7 @@ es: topic: create: Crear un tema + edit_button: Editar form: topic_title: Titulo del tema @@ -32,7 +33,8 @@ es: new: submit_button: Crear tema edit: - submit_button: Editar tema + submit_button: Guardar cambios + show: community_of_the_proposal: Comunidad de la propuesta tab: From a68c2304084bb8e808fc6e6f1d6924d49bf0a097 Mon Sep 17 00:00:00 2001 From: Alessandro Cuoghi Date: Wed, 9 Aug 2017 17:18:44 +0200 Subject: [PATCH 28/64] Added tag is-author in tab Participants --- app/views/communities/show.html.erb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/views/communities/show.html.erb b/app/views/communities/show.html.erb index d8b495855..041e1776f 100644 --- a/app/views/communities/show.html.erb +++ b/app/views/communities/show.html.erb @@ -45,6 +45,10 @@ <%= link_to participant.name, user_path(participant)%> +  •  + + <%= t("comments.comment.author") %> +
        From 1c1ac4c1f7185ec59c3d17acdcc449599871367b Mon Sep 17 00:00:00 2001 From: Alessandro Cuoghi Date: Wed, 9 Aug 2017 17:27:35 +0200 Subject: [PATCH 29/64] Added translate (most commented) into wide-order-selector --- config/locales/en/general.yml | 1 + config/locales/es/general.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml index d6d4fe39a..9248fe457 100644 --- a/config/locales/en/general.yml +++ b/config/locales/en/general.yml @@ -64,6 +64,7 @@ en: most_voted: Most voted newest: Newest first oldest: Oldest first + most_commented: Most commented select_order: Sort by show: return_to_commentable: 'Go back to ' diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml index 585ce736a..392a6dbfa 100644 --- a/config/locales/es/general.yml +++ b/config/locales/es/general.yml @@ -64,6 +64,7 @@ es: most_voted: Más votados newest: Más nuevos primero oldest: Más antiguos primero + most_commented: Más comentados select_order: Ordenar por show: return_to_commentable: 'Volver a ' From 1e60bc5cc23212b44834a93aa06407e3c6c06320 Mon Sep 17 00:00:00 2001 From: Alessandro Cuoghi Date: Wed, 9 Aug 2017 18:24:15 +0200 Subject: [PATCH 30/64] Remove some css. Pass scss-lint --- app/assets/stylesheets/community.scss | 62 +++++++++++++-------------- app/views/communities/show.html.erb | 11 ++++- app/views/topics/_topics.html.erb | 4 +- 3 files changed, 42 insertions(+), 35 deletions(-) diff --git a/app/assets/stylesheets/community.scss b/app/assets/stylesheets/community.scss index 55db691ad..96e5d0b75 100644 --- a/app/assets/stylesheets/community.scss +++ b/app/assets/stylesheets/community.scss @@ -1,55 +1,55 @@ -.communities-show{ +.communities-show { - .wide-order-selector{ + .wide-order-selector { margin-top: 0; } - .panel{ - background: #fff; - border: 1px solid; - border-color: #e5e6e9 #dfe0e4 #d0d1d5; - border-radius: 0; - box-shadow: 0 1px 3px 0 #dee0e3; - margin-bottom: 0.75rem; - min-height:7rem; - padding: 0.75rem 0.75rem 0; + .panel { + min-height: 7rem; + margin: 0.375rem 0; + + .button { + margin-top: $line-height; + } } - .panel { - h3{ - font-weight: bold; - margin-top: $line-height / 2; - } + //Participations.scss line 412 + .btn-new-theme-small { - a { - color: $text; - } - .nopadding{ - padding: 0; - } - .button{ - margin-top: $line-height; + h2 { + border-top: 2px solid $brand; + display: inline-block; + font-size: rem-calc(16); + margin: -1px 0 rem-calc(12); + padding-top: rem-calc(6); + text-transform: uppercase; } } } -.communities-participant{ - .comment-body{ +.communities-participant { + + .comment-body { display: inline-block; float: left; margin-right: $line-height; margin-bottom: $line-height; } } -.topic-show{ - p{ + +.topic-show { + + p { margin-bottom: 0; } + ul li { - margin-bottom:0; + margin-bottom: 0; } - .comments{ - .first-comment{ + + .comments { + + .first-comment { margin-top: $line-height; margin-bottom: $line-height; } diff --git a/app/views/communities/show.html.erb b/app/views/communities/show.html.erb index 041e1776f..40f14b2a2 100644 --- a/app/views/communities/show.html.erb +++ b/app/views/communities/show.html.erb @@ -10,6 +10,13 @@
        + +
        + +

        <%= t("community.sidebar.topic.title") %>

        + <%= link_to t("community.sidebar.topic.new_topic"), new_community_topic_path(@community.id), class: 'button expanded' %> +
        +
        <%= render "topics/topics", topics: @topics %> @@ -17,7 +24,7 @@ <%= paginate @topics %>
        -
        diff --git a/app/views/topics/_topics.html.erb b/app/views/topics/_topics.html.erb index 96a7fbdd8..075c8dd82 100644 --- a/app/views/topics/_topics.html.erb +++ b/app/views/topics/_topics.html.erb @@ -7,7 +7,7 @@ <% topics.each do |topic| %>
        -
        +

        <%= link_to topic.title, community_topic_path(@community, topic) %>

          @@ -18,7 +18,7 @@ <%= topic.author.name %>

        -
        +
        <% if topic.author == current_user %> <%= link_to t("community.topic.edit_button"), edit_community_topic_path(@community.id, topic), class: 'button small hollow' %> <% end %> From 82053046f82d2fee43c1de2a584e50cb8bb05181 Mon Sep 17 00:00:00 2001 From: Alessandro Cuoghi Date: Wed, 9 Aug 2017 18:28:40 +0200 Subject: [PATCH 31/64] Changed column into wide-order-selector. --- app/views/shared/_wide_order_selector.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/shared/_wide_order_selector.html.erb b/app/views/shared/_wide_order_selector.html.erb index d6cda44e6..47144198d 100644 --- a/app/views/shared/_wide_order_selector.html.erb +++ b/app/views/shared/_wide_order_selector.html.erb @@ -5,12 +5,12 @@
        -
        +
        -
        +