From f1090fdf4106af8e3fb7eb1fdc552812f0c24290 Mon Sep 17 00:00:00 2001 From: Pauline Bessoles <52420208+paulinebessoles@users.noreply.github.com> Date: Thu, 5 Oct 2023 17:22:55 +0200 Subject: [PATCH] fix: Remove no longer needed meetings controller overrides (#68) * Remove deprecated controller override and update overload file * Remove calendar file --- OVERLOADS.md | 42 +---- .../meetings/directory/meetings_controller.rb | 95 ----------- .../decidim/meetings/meetings_controller.rb | 158 ------------------ docs/CONTRIBUTING.md | 3 +- 4 files changed, 8 insertions(+), 290 deletions(-) delete mode 100644 app/controllers/decidim/meetings/directory/meetings_controller.rb delete mode 100644 app/controllers/decidim/meetings/meetings_controller.rb diff --git a/OVERLOADS.md b/OVERLOADS.md index bcc57e46..0cb89b3a 100644 --- a/OVERLOADS.md +++ b/OVERLOADS.md @@ -1,36 +1,26 @@ # Overrides -## Fix date display on meeting show view -When updating decidim date format from french to american format, date on meeting show view doesn't change -* `app/cells/decidim/author/date.erb` -```html - <%= l creation_date.to_date, format: :decidim_short %> -``` - -## Fix meetings orders in indexes -* `app/controllers/decidim/meetings/meetings_controller.rb` -* `app/controllers/decidim/meetings/directory/meetings_controller.rb` - - -## Load decidim-awesome assets only if dependencie is present -* `app/views/layouts/decidim/_head.html.erb:33` - ## Fix geocoded proposals * `app/controllers/decidim/proposals/proposals_controller.rb:44` ```ruby @all_geocoded_proposals = @base_query.geocoded.where.not(latitude: Float::NAN, longitude: Float::NAN) ``` -## Fix meetings registration serializer -* `app/serializers/decidim/meetings/registration_serializer.rb` ## Fix UserAnswersSerializer for CSV exports * `lib/decidim/forms/user_answers_serializer.rb` + ## 28c8d74 - Add basic tests to reference package (#1), 2021-07-26 * `lib/extends/commands/decidim/admin/create_participatory_space_private_user_extends.rb` * `lib/extends/commands/decidim/admin/impersonate_user_extends.rb` + ## cd5c2cc - Backport fix/user answers serializer (#11), 2021-09-30 * `lib/decidim/forms/user_answers_serializer.rb` * `app/cells/decidim/tos_page/sticky_form.erb` + +## Update layout for budgets view +* `app/views/decidim/budgets/projects/index.html.erb` + Delete filters on budget view, 2023-07-10 + 459d4d9 - Sign In cleanup, 2020-10-08 * `app/extends/devise/OmniauthCallbacksControllerExtend.rb` @@ -123,20 +113,6 @@ f510f63 - Remove order reminder from Sidekiq configuration and comment REDIS_URL * `lib/omniauth/strategies/nyc.rb` 7a005e1 - Merge branch 'develop', 2021-12-03 -## Fix metrics issue in admin dashboard - - **app/stylesheets/decidim/vizzs/_areachart.scss** -```scss - .area{ - fill: rgba($primary, .2);; - } -``` - -## Add FC Connect SSO - - **app/views/decidim/devise/shared/_omniauth_buttons.html.erb** -```ruby -<% if provider.match?("france") %> -``` - * `app/views/decidim/scopes/picker.html.erb` c76437f - Modify cancel button behaviour to match close button, 2022-02-08 @@ -151,7 +127,3 @@ de6d804 - fix multipart object tagging (#40) (#41), 2021-12-24 * `lib/tasks/restore_dump.rake` 705e0ad - Run rubocop, 2021-12-01 - -## Update layout for budgets view - * `app/views/decidim/budgets/projects/index.html.erb` - Delete filters on budget view, 2023-07-10 \ No newline at end of file diff --git a/app/controllers/decidim/meetings/directory/meetings_controller.rb b/app/controllers/decidim/meetings/directory/meetings_controller.rb deleted file mode 100644 index 9ddbca11..00000000 --- a/app/controllers/decidim/meetings/directory/meetings_controller.rb +++ /dev/null @@ -1,95 +0,0 @@ -# frozen_string_literal: true - -module Decidim - module Meetings - module Directory - # Exposes the meeting resource so users can view them - class MeetingsController < Decidim::Meetings::Directory::ApplicationController - layout "layouts/decidim/application" - - include FilterResource - include Filterable - include Paginable - - helper Decidim::WidgetUrlsHelper - helper Decidim::FiltersHelper - helper Decidim::Meetings::MapHelper - helper Decidim::ResourceHelper - - helper_method :meetings, :search - - def calendar - render plain: CalendarRenderer.for(current_organization), content_type: "type/calendar" - end - - private - - def meetings - is_past_meetings = params.dig("filter", "date")&.include?("past") - @meetings ||= paginate(search.results.order(start_time: is_past_meetings ? :desc : :asc)) - end - - def default_search_params - { - scope: Meeting.not_hidden.visible_meeting_for(current_user) - } - end - - def search_klass - ::Decidim::Meetings::Directory::MeetingSearch - end - - def default_filter_params - { - date: "upcoming", - search_text: "", - activity: "all", - scope_id: default_filter_scope_params, - space: default_filter_space_params, - type: default_filter_type_params, - origin: default_filter_origin_params, - category_id: default_filter_category_params - } - end - - def default_filter_category_params - participatory_spaces = current_organization.public_participatory_spaces - list_of_ps = [] - participatory_spaces.flat_map do |current_participatory_space| - next unless current_participatory_space.respond_to?(:categories) - - key_point = current_participatory_space.class.name.gsub("::", "__") + current_participatory_space.id.to_s - - list_of_ps.push(key_point) - list_of_ps += current_participatory_space.categories.pluck(:id).map(&:to_s) - end - - ["all"] + list_of_ps - end - - def default_filter_space_params - %w(all) + current_organization.public_participatory_spaces.collect(&:model_name).uniq.collect(&:name).collect(&:underscore) - end - - def default_filter_scope_params - %w(all global) + current_organization.scopes.pluck(:id).map(&:to_s) - end - - def context_params - { component: meeting_components, organization: current_organization, current_user: current_user } - end - - def meeting_components - @meeting_components ||= Decidim::Component - .where(manifest_name: "meetings") - .where(participatory_space: participatory_spaces) - .published - end - - def participatory_spaces - @participatory_spaces ||= current_organization.public_participatory_spaces - end - end - end - end -end diff --git a/app/controllers/decidim/meetings/meetings_controller.rb b/app/controllers/decidim/meetings/meetings_controller.rb deleted file mode 100644 index 8673190c..00000000 --- a/app/controllers/decidim/meetings/meetings_controller.rb +++ /dev/null @@ -1,158 +0,0 @@ -# frozen_string_literal: true - -module Decidim - module Meetings - # Exposes the meeting resource so users can view them - class MeetingsController < Decidim::Meetings::ApplicationController - include FilterResource - include Filterable - include Flaggable - include Withdrawable - include FormFactory - include Paginable - - helper Decidim::WidgetUrlsHelper - helper Decidim::ResourceVersionsHelper - - helper_method :meetings, :meeting, :registration, :search - - def new - enforce_permission_to :create, :meeting - - @form = meeting_form.instance - end - - def create - enforce_permission_to :create, :meeting - - @form = meeting_form.from_params(params, current_component: current_component) - - CreateMeeting.call(@form) do - on(:ok) do |meeting| - flash[:notice] = I18n.t("meetings.create.success", scope: "decidim.meetings") - redirect_to meeting_path(meeting) - end - - on(:invalid) do - flash.now[:alert] = I18n.t("meetings.create.invalid", scope: "decidim.meetings") - render action: "new" - end - end - end - - def index - return unless search.results.blank? && params.dig("filter", "date") != %w(past) - - @past_meetings = search_klass.new(search_params.merge(date: %w(past))) - - if @past_meetings.results.present? - params[:filter] ||= {} - params[:filter][:date] = %w(past) - @forced_past_meetings = true - @search = @past_meetings - end - end - - def show - raise ActionController::RoutingError, "Not Found" unless meeting - - return if meeting.current_user_can_visit_meeting?(current_user) - - flash[:alert] = I18n.t("meeting.not_allowed", scope: "decidim.meetings") - redirect_to(ResourceLocatorPresenter.new(meeting).index) - end - - def edit - enforce_permission_to :update, :meeting, meeting: meeting - - @form = meeting_form.from_model(meeting) - end - - def update - enforce_permission_to :update, :meeting, meeting: meeting - - @form = meeting_form.from_params(params) - - UpdateMeeting.call(@form, current_user, meeting) do - on(:ok) do |meeting| - flash[:notice] = I18n.t("meetings.update.success", scope: "decidim.meetings") - redirect_to Decidim::ResourceLocatorPresenter.new(meeting).path - end - - on(:invalid) do - flash.now[:alert] = I18n.t("meetings.update.invalid", scope: "decidim.meetings") - render :edit - end - end - end - - def withdraw - enforce_permission_to :withdraw, :meeting, meeting: meeting - - WithdrawMeeting.call(@meeting, current_user) do - on(:ok) do - flash[:notice] = I18n.t("meetings.withdraw.success", scope: "decidim") - redirect_to Decidim::ResourceLocatorPresenter.new(@meeting).path - end - on(:invalid) do - flash[:alert] = I18n.t("meetings.withdraw.error", scope: "decidim") - redirect_to Decidim::ResourceLocatorPresenter.new(@meeting).path - end - end - end - - private - - def meeting - @meeting ||= Meeting.not_hidden.where(component: current_component).find_by(id: params[:id]) - end - - def meetings - is_past_meetings = params.dig("filter", "date")&.include?("past") - @meetings ||= paginate(search.results.order(start_time: is_past_meetings ? :desc : :asc)) - end - - def registration - @registration ||= meeting.registrations.find_by(user: current_user) - end - - def search_klass - MeetingSearch - end - - def meeting_form - form(Decidim::Meetings::MeetingForm) - end - - def default_filter_params - { - search_text: "", - date: "upcoming", - activity: "all", - scope_id: default_filter_scope_params, - category_id: default_filter_category_params, - state: nil, - origin: default_filter_origin_params, - type: default_filter_type_params - } - end - - def default_filter_origin_params - filter_origin_params = %w(citizens) - filter_origin_params << "official" - filter_origin_params << "user_group" if current_organization.user_groups_enabled? - filter_origin_params - end - - def default_filter_type_params - %w(all) + Decidim::Meetings::Meeting::TYPE_OF_MEETING - end - - def default_search_params - { - scope: Meeting.not_hidden.visible_meeting_for(current_user) - } - end - end - end -end diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index e200f8e2..c548969e 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -1,5 +1,4 @@ -<<<<<<< HEAD - # How to contribute to the Decidim of the New York City +# How to contribute to the Decidim of the New York City We're really glad you're reading this, you might be interested by the code source of the New York City Decidim application.