-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add centers, extra user fields and term customizer modules (#6)
* Add centers, extra user fields and term customizer modules * Lint * Registration spec * Account spec * Lock ChromeDriver to 119.0.6045.105
- Loading branch information
Showing
22 changed files
with
818 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ on: | |
pull_request: | ||
|
||
env: | ||
RUBY_VERSION: 3.0.2 | ||
RUBY_VERSION: 3.0.6 | ||
NODE_VERSION: 16.9.1 | ||
|
||
jobs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.0.2 | ||
3.0.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# frozen_string_literal: true | ||
|
||
require "active_support/concern" | ||
|
||
module Decidim | ||
module AccountFormOverride | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
def map_model(model) | ||
map_model_centers(model) | ||
map_model_extra_user_fields(model) | ||
end | ||
|
||
private | ||
|
||
def map_model_centers(model) | ||
self.center_id = model.center.try(:id) | ||
self.scope_id = model.scope.try(:id) | ||
end | ||
|
||
def map_model_extra_user_fields(model) | ||
extended_data = model.extended_data.with_indifferent_access | ||
|
||
self.country = extended_data[:country] | ||
self.postal_code = extended_data[:postal_code] | ||
self.date_of_birth = Date.parse(extended_data[:date_of_birth]) if extended_data[:date_of_birth].present? | ||
self.gender = extended_data[:gender] | ||
self.phone_number = extended_data[:phone_number] | ||
self.location = extended_data[:location] | ||
self.profession = extended_data[:profession] | ||
self.document_id = extended_data[:document_id] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
Rails.application.config.to_prepare do | ||
Decidim::RegistrationForm.include(Decidim::AccountFormOverride) | ||
Decidim::OmniauthRegistrationForm.include(Decidim::AccountFormOverride) | ||
Decidim::AccountForm.include(Decidim::AccountFormOverride) | ||
end |
12 changes: 12 additions & 0 deletions
12
...20231213130434_add_extra_user_fields_to_decidim_organization.decidim_extra_user_fields.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
# This migration comes from decidim_extra_user_fields (originally 20221024121407) | ||
|
||
class AddExtraUserFieldsToDecidimOrganization < ActiveRecord::Migration[6.0] | ||
def up | ||
add_column :decidim_organizations, :extra_user_fields, :jsonb, default: { "enabled" => false } | ||
end | ||
|
||
def down | ||
remove_column :decidim_organizations, :extra_user_fields, :jsonb | ||
end | ||
end |
10 changes: 10 additions & 0 deletions
10
...20231213130435_create_decidim_term_customizer_translation_sets.decidim_term_customizer.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
# This migration comes from decidim_term_customizer (originally 20190217132503) | ||
|
||
class CreateDecidimTermCustomizerTranslationSets < ActiveRecord::Migration[5.2] | ||
def change | ||
create_table :decidim_term_customizer_translation_sets do |t| | ||
t.jsonb :name | ||
end | ||
end | ||
end |
19 changes: 19 additions & 0 deletions
19
...ate/20231213130436_create_decidim_term_customizer_translations.decidim_term_customizer.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
# This migration comes from decidim_term_customizer (originally 20190217132654) | ||
|
||
class CreateDecidimTermCustomizerTranslations < ActiveRecord::Migration[5.2] | ||
def change | ||
create_table :decidim_term_customizer_translations do |t| | ||
t.string :locale | ||
t.string :key | ||
t.text :value | ||
|
||
t.references( | ||
:translation_set, | ||
null: false, | ||
foreign_key: { to_table: :decidim_term_customizer_translation_sets }, | ||
index: { name: "decidim_term_customizer_translation_translation_set" } | ||
) | ||
end | ||
end | ||
end |
18 changes: 18 additions & 0 deletions
18
...rate/20231213130437_create_decidim_term_customizer_constraints.decidim_term_customizer.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# frozen_string_literal: true | ||
# This migration comes from decidim_term_customizer (originally 20190217132726) | ||
|
||
class CreateDecidimTermCustomizerConstraints < ActiveRecord::Migration[5.2] | ||
def change | ||
create_table :decidim_term_customizer_constraints do |t| | ||
t.references :decidim_organization, null: false, foreign_key: true, index: { name: "decidim_term_customizer_constraint_organization" } | ||
t.references :subject, polymorphic: true, index: { name: "decidim_term_customizer_constraint_subject" } | ||
|
||
t.references( | ||
:translation_set, | ||
null: false, | ||
foreign_key: { to_table: :decidim_term_customizer_translation_sets }, | ||
index: { name: "decidim_term_customizer_constraint_translation_set" } | ||
) | ||
end | ||
end | ||
end |
14 changes: 14 additions & 0 deletions
14
db/migrate/20231213131628_create_decidim_centers_centers.decidim_centers.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
# This migration comes from decidim_centers (originally 20231129114029) | ||
|
||
class CreateDecidimCentersCenters < ActiveRecord::Migration[6.1] | ||
def change | ||
create_table :decidim_centers_centers do |t| | ||
t.references :decidim_organization, foreign_key: true, index: true | ||
t.jsonb :title, null: false | ||
t.datetime :deleted_at | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
13 changes: 13 additions & 0 deletions
13
db/migrate/20231213131629_create_decidim_centers_center_users.decidim_centers.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
# This migration comes from decidim_centers (originally 20231130125631) | ||
|
||
class CreateDecidimCentersCenterUsers < ActiveRecord::Migration[6.1] | ||
def change | ||
create_table :decidim_centers_center_users do |t| | ||
t.references :decidim_centers_center, foreign_key: true, index: { name: "index_decidim_center_users_on_decidim_center_id" } | ||
t.references :decidim_user, foreign_key: true, index: { name: "index_decidim_center_users_on_decidim_user_id" } | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
13 changes: 13 additions & 0 deletions
13
db/migrate/20231213131630_create_decidim_centers_scope_users.decidim_centers.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
# This migration comes from decidim_centers (originally 20231205153627) | ||
|
||
class CreateDecidimCentersScopeUsers < ActiveRecord::Migration[6.1] | ||
def change | ||
create_table :decidim_centers_scope_users do |t| | ||
t.references :decidim_scope, foreign_key: true, index: { name: "index_decidim_scope_users_on_decidim_scope_id" } | ||
t.references :decidim_user, foreign_key: true, index: { name: "index_decidim_scope_users_on_decidim_user_id" } | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
Oops, something went wrong.