Skip to content

Commit

Permalink
feat: Add module emitter (#633)
Browse files Browse the repository at this point in the history
* feat: Addition of the emitter module

* fix: Fix failing specs
  • Loading branch information
AyakorK authored Nov 22, 2024
1 parent 1bcf06d commit 56c0a4f
Show file tree
Hide file tree
Showing 13 changed files with 1,103 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ gem "decidim-category_enhanced", "~> 0.0.1"
gem "decidim-cleaner"
gem "decidim-custom_proposal_states", git: "https://github.com/alecslupu-pfa/decidim-module-custom_proposal_states", branch: DECIDIM_BRANCH
gem "decidim-decidim_awesome", git: "https://github.com/decidim-ice/decidim-module-decidim_awesome", branch: DECIDIM_BRANCH
gem "decidim-emitter", git: "https://github.com/OpenSourcePolitics/decidim-module-emitter.git"
gem "decidim-extended_socio_demographic_authorization_handler", git: "https://github.com/OpenSourcePolitics/decidim-module-extended_socio_demographic_authorization_handler.git",
branch: DECIDIM_BRANCH
gem "decidim-extra_user_fields", git: "https://github.com/OpenSourcePolitics/decidim-module-extra_user_fields.git", branch: "temp/twilio-compatibility-0.27"
Expand Down
9 changes: 9 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ GIT
decidim-core (>= 0.27.0)
deface (~> 1.5)

GIT
remote: https://github.com/OpenSourcePolitics/decidim-module-emitter.git
revision: 8633ea56b422eecfe7d8730c89f191387f860e55
specs:
decidim-emitter (0.1.0)
decidim-core (~> 0.27.0)
decidim-participatory_processes (~> 0.27.0)

GIT
remote: https://github.com/OpenSourcePolitics/decidim-module-extended_socio_demographic_authorization_handler.git
revision: adec5e66cd07b5e5fdce5562453a7e8d6de88013
Expand Down Expand Up @@ -1179,6 +1187,7 @@ DEPENDENCIES
decidim-custom_proposal_states!
decidim-decidim_awesome!
decidim-dev (~> 0.27.0)
decidim-emitter!
decidim-extended_socio_demographic_authorization_handler!
decidim-extra_user_fields!
decidim-friendly_signup!
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
<div class="card">
<div class="card-divider">
<h2 class="card-title"><%= t(".title") %></h2>
</div>

<div class="card-section">
<div class="row column">
<%= form.translated :text_field, :title, autofocus: true %>
</div>

<div class="row column">
<%= form.translated :text_field, :subtitle %>
</div>

<div class="row column">
<%= form.number_field :weight %>
</div>

<div class="row">
<div class="columns xlarge-6 slug">
<%= form.text_field :slug %>
<p class="help-text">
<%== t(".slug_help", url: decidim_form_slug_url(:processes, form.object.slug)) %>
</p>
</div>

<div class="columns xlarge-6">
<%= form.text_field :hashtag %>
</div>
</div>

<div class="row column">
<%= form.translated :editor, :short_description %>
</div>

<div class="row column">
<%= form.translated :editor, :description, toolbar: :full, lines: 25 %>
</div>

<div class="row column">
<%= form.translated :editor, :announcement %>
<p class="help-text"><%== t(".announcement_help") %></p>
</div>
</div>

<% if Decidim::Map.available?(:geocoding) %>
<div class="row column">
<%= form.text_field :address %>
<p class="help-text"><%== t(".address_help") %></p>
</div>
<% end %>

<div class="card-divider">
<h2 class="card-title"><%= t(".duration") %></h2>
</div>

<div class="card-section">
<div class="row">
<div class="columns xlarge-6">
<%= form.date_field :start_date %>
</div>

<div class="columns xlarge-6">
<%= form.date_field :end_date %>
</div>
</div>
</div>

<div class="card-divider">
<h2 class="card-title"><%= t(".images") %></h2>
</div>

<div class="card-section">
<div class="row">
<div class="columns xlarge-6">
<%= form.upload :hero_image %>
</div>

<div class="columns xlarge-6">
<%= form.upload :banner_image %>
</div>
</div>
</div>

<div class="card-divider">
<h2 class="card-title"><%= t(".metadata") %></h2>
</div>

<div class="card-section">
<div class="row">
<div class="columns xlarge-6">
<%= form.translated :text_field, :developer_group %>
</div>

<div class="columns xlarge-6">
<%= form.translated :text_field, :local_area %>
</div>
</div>

<div class="row column">
<%= form.translated :text_field, :meta_scope %>
</div>

<div class="row column">
<%= form.translated :text_field, :target %>
</div>

<div class="row column">
<%= form.translated :text_field, :participatory_scope %>
</div>

<div class="row column">
<%= form.translated :text_field, :participatory_structure %>
</div>
</div>

<div class="card-divider">
<h2 class="card-title"><%= t(".filters") %></h2>
</div>

<div class="card-section">
<div class="row column">
<%= form.check_box :scopes_enabled %>
</div>

<div class="row column">
<%= scopes_picker_field form, :scope_id, root: nil %>

<div class="row" id="scope-depth ">
<%= form.collection_select :scope_type_max_depth_id,
organization_scope_depths,
:id,
:name,
scope_type_depth_select_options,
scope_type_depth_select_html_options %>
<p class="help-text">
<%== t(".scope_type_max_depth_help") %>
</p>
</div>
</div>

<div class="row column">
<%= form.areas_select :area_id,
areas_for_select(current_organization),
selected: current_participatory_process.try(:decidim_area_id),
include_blank: t(".select_an_area") %>
</div>
</div>

<div class="card-divider">
<h2 class="card-title"><%= t(".visbility") %></h2>
</div>

<div class="card-section">
<div class="row column">
<% if process_groups_for_select %>
<%= form.select :participatory_process_group_id,
process_groups_for_select,
include_blank: t(".select_process_group") %>
<% end %>
</div>

<div class="row column">
<%= form.check_box :private_space %>
</div>
<div class="row column">
<%= form.check_box :promoted %>
</div>
</div>

<div class="card-divider">
<h2 class="card-title"><%= t(".emitter") %></h2>
</div>

<div class="card-section">
<div class="row column">
<%= form.select :emitter_select, options_for_select(emitter_options), { :include_blank => true, label: t(".emitter_logo_select") }, class: "select-emitter" %>
</div>
<div class="row column select-emitter-image"></div>
<label class="row column"> <%= t(".emitter_new") %> </label>
<div class="row column">
<%= form.text_field :emitter_name_image, label: t(".emitter_name") %>
</div>
<div class="row column">
<%= form.upload :emitter_image, label: t(".emitter_logo"), help_i18n_scope: "decidim.admin.forms.file_help.emitter" %>
</div>
<% if form.object.emitter_name.present? %>
<div class="row column">
<%= form.text_field :emitter_read_name, { :readonly => true, :label => t(".emitter_now") } %>
</div>
<% end %>
</div>

<div class="card-divider">
<h2 class="card-title"><%= t(".related_processes") %></h2>
</div>

<div class="card-section">
<div class="row column">
<%= form.select(
:related_process_ids,
@form.processes.order(title: :asc).map{|process| [translated_attribute(process.title), process.id]},
{ include_blank: true },
{ multiple: true, class: "chosen-select" }
) %>
</div>
</div>

<div class="card-divider">
<h2 class="card-title"><%= t(".other") %></h2>
</div>

<div class="card-section">
<div class="row column">
<%= form.check_box :show_statistics %>
</div>

<div class="row column">
<%= form.check_box :show_metrics %>
</div>

<% if @form.participatory_process_types_for_select.present? %>
<div class="row column">
<%= form.select(
:participatory_process_type_id,
@form.participatory_process_types_for_select,
include_blank: t(".select_participatory_process_type")
) %>
</div>
<% end %>
</div>
</div>

<%= javascript_pack_tag "decidim_participatory_processes_admin" %>
1 change: 1 addition & 0 deletions config/i18n-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ ignore_missing:
- decidim.term_customizer.admin.actions.*
- decidim.term_customizer.admin.add_translations.index.*
- decidim.term_customizer.admin.models.translations.fields.*
- decidim.participatory_processes.admin.participatory_processes.form.*

# Consider these keys used:
ignore_unused:
Expand Down
2 changes: 2 additions & 0 deletions config/initializers/half_signup.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

return unless defined?(Decidim::HalfSignup)

Decidim::HalfSignup.configure do |config|
config.show_tos_page_after_signup = Rails.application.secrets.dig(:decidim, :half_signup, :show_tos_page_after_signup)
config.auth_code_length = 4
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This migration comes from decidim_emitter (originally 20240417082337)
class AddEmitterToDecidimParticipatoryProcess < ActiveRecord::Migration[6.1]
def up
# Ensure that the column is a string and check if it exists
add_column :decidim_participatory_processes, :emitter, :string, if_not_exists: true
change_column :decidim_participatory_processes, :emitter, :string

add_column :decidim_participatory_processes, :emitter_name, :text, if_not_exists: true
end

def down
remove_column :decidim_participatory_processes, :emitter_name, if_exists: true
end
end
4 changes: 3 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2024_10_28_094242) do
ActiveRecord::Schema.define(version: 2024_11_18_114335) do

# These are extensions that must be enabled in order to support this database
enable_extension "ltree"
Expand Down Expand Up @@ -1518,6 +1518,8 @@
t.float "longitude"
t.boolean "display_linked_assemblies", default: false
t.bigint "decidim_participatory_process_type_id"
t.string "emitter"
t.text "emitter_name"
t.index ["decidim_area_id"], name: "index_decidim_participatory_processes_on_decidim_area_id"
t.index ["decidim_organization_id", "slug"], name: "index_unique_process_slug_and_organization", unique: true
t.index ["decidim_organization_id"], name: "index_decidim_processes_on_decidim_organization_id"
Expand Down
1 change: 1 addition & 0 deletions spec/factories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require "decidim/proposals/test/factories"
require "decidim/budgets/test/factories"
require "decidim/debates/test/factories"
require "decidim/emitter/test/factories"
require "decidim/meetings/test/factories"
require "decidim/accountability/test/factories"
require "decidim/system/test/factories"
Expand Down
Loading

0 comments on commit 56c0a4f

Please sign in to comment.