Skip to content

Commit

Permalink
add decidim templates gem (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
HHassig authored Jul 3, 2024
1 parent 49a324c commit 6cf0c61
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ gem "decidim", "0.28.1"
# gem "decidim-design", "0.28.1"
# gem "decidim-elections", "0.28.1"
# gem "decidim-initiatives", "0.28.1"
# gem "decidim-templates", "0.28.1"
gem "decidim-templates", "0.28.1"

gem "decidim-decidim_awesome", git: "https://github.com/decidim-ice/decidim-module-decidim_awesome", branch: "develop"

Expand Down
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,7 @@ DEPENDENCIES
decidim (= 0.28.1)
decidim-decidim_awesome!
decidim-dev (= 0.28.1)
decidim-templates (= 0.28.1)
figaro (~> 1.2)
letter_opener_web (~> 2.0)
listen (~> 3.1)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true
# This migration comes from decidim_templates (originally 20200518093819)

class CreateDecidimTemplates < ActiveRecord::Migration[5.2]
def change
create_table :decidim_templates_templates do |t|
t.integer :decidim_organization_id, null: false, index: { name: "index_decidim_templates_organization" }
t.references :templatable, polymorphic: true, index: { name: "index_decidim_templates_templatable" }
t.jsonb :name, null: false
t.jsonb :description
t.timestamps
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true
# This migration comes from decidim_templates (originally 20221006055954)

class AddFieldValuesAndTargetToDecidimTemplates < ActiveRecord::Migration[6.0]
class Template < ApplicationRecord
self.table_name = :decidim_templates_templates
end

def change
add_column :decidim_templates_templates, :field_values, :json, default: {}
add_column :decidim_templates_templates, :target, :string

reversible do |direction|
direction.up do
# rubocop:disable Rails/SkipsModelValidations
Template.where(templatable_type: "Decidim::Forms::Questionnaire").update_all(target: "questionnaire")
Template.where(templatable_type: "Decidim::Organization").update_all(target: "user_block")
# rubocop:enable Rails/SkipsModelValidations
end
end
end
end
16 changes: 15 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6cf0c61

Please sign in to comment.