Skip to content

Commit

Permalink
Include comment action in all models with components and related comp…
Browse files Browse the repository at this point in the history
…onent
  • Loading branch information
entantoencuanto committed May 21, 2021
1 parent 423fec1 commit 9082c75
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 9 deletions.
2 changes: 2 additions & 0 deletions decidim-accountability/config/locales/en.yml
Expand Up @@ -205,6 +205,8 @@ en:
label: Status
components:
accountability:
actions:
comment: Comment
name: Accountability
settings:
global:
Expand Down
Expand Up @@ -14,11 +14,15 @@
raise StandardError, "Can't remove this component" if Decidim::Accountability::Result.where(component: instance).any?
end

# These actions permissions can be configured in the admin panel
component.actions = %w(comment)

component.register_resource(:result) do |resource|
resource.model_class_name = "Decidim::Accountability::Result"
resource.template = "decidim/accountability/results/linked_results"
resource.card = "decidim/accountability/result"
resource.searchable = false
resource.actions = %w(comment)
end

component.settings(:global) do |settings|
Expand Down
2 changes: 2 additions & 0 deletions decidim-blogs/config/locales/en.yml
Expand Up @@ -60,6 +60,8 @@ en:
read_more: Read more
components:
blogs:
actions:
comment: Comment
name: Blog
settings:
global:
Expand Down
4 changes: 2 additions & 2 deletions decidim-blogs/lib/decidim/blogs/component.rb
Expand Up @@ -18,7 +18,7 @@
Decidim::Blogs::Post.where(component: components).count
end

component.actions = %w(endorse vote create withdraw amend)
component.actions = %w(endorse vote create withdraw amend comment)

component.settings(:global) do |settings|
settings.attribute :announcement, type: :text, translated: true, editor: true
Expand All @@ -36,7 +36,7 @@
component.register_resource(:blogpost) do |resource|
resource.model_class_name = "Decidim::Blogs::Post"
resource.card = "decidim/blogs/post"
resource.actions = %w(endorse vote amend)
resource.actions = %w(endorse vote amend comment)
resource.searchable = true
end

Expand Down
1 change: 1 addition & 0 deletions decidim-budgets/config/locales/en.yml
Expand Up @@ -234,6 +234,7 @@ en:
components:
budgets:
actions:
comment: Comment
vote: Vote
name: Budgets
settings:
Expand Down
4 changes: 2 additions & 2 deletions decidim-budgets/lib/decidim/budgets/component.rb
Expand Up @@ -16,7 +16,7 @@

component.query_type = "Decidim::Budgets::BudgetsType"

component.actions = %(vote)
component.actions = %(vote comment)

component.on(:before_destroy) do |instance|
raise StandardError, "Can't remove this component" if Decidim::Budgets::Budget.where(component: instance).any?
Expand All @@ -32,7 +32,7 @@
resource.model_class_name = "Decidim::Budgets::Project"
resource.template = "decidim/budgets/projects/linked_projects"
resource.card = "decidim/budgets/project"
resource.actions = %(vote)
resource.actions = %(vote comment)
resource.searchable = true
end

Expand Down
1 change: 1 addition & 0 deletions decidim-debates/config/locales/en.yml
Expand Up @@ -28,6 +28,7 @@ en:
components:
debates:
actions:
comment: Comment
create: Create
endorse: Endorse
name: Debates
Expand Down
4 changes: 2 additions & 2 deletions decidim-debates/lib/decidim/debates/component.rb
Expand Up @@ -52,10 +52,10 @@
resource.card = "decidim/debates/debate"
resource.reported_content_cell = "decidim/debates/reported_content"
resource.searchable = true
resource.actions = %w(create endorse)
resource.actions = %w(create endorse comment)
end

component.actions = %w(create endorse)
component.actions = %w(create endorse comment)

component.exports :comments do |exports|
exports.collection do |component_instance|
Expand Down
1 change: 1 addition & 0 deletions decidim-meetings/config/locales/en.yml
Expand Up @@ -83,6 +83,7 @@ en:
components:
meetings:
actions:
comment: Comment
join: Join
name: Meetings
settings:
Expand Down
4 changes: 2 additions & 2 deletions decidim-meetings/lib/decidim/meetings/component.rb
Expand Up @@ -20,7 +20,7 @@
resource.template = "decidim/meetings/meetings/linked_meetings"
resource.card = "decidim/meetings/meeting"
resource.reported_content_cell = "decidim/meetings/reported_content"
resource.actions = %w(join)
resource.actions = %w(join comment)
resource.searchable = true
end

Expand Down Expand Up @@ -60,7 +60,7 @@
exports.serializer Decidim::Comments::CommentSerializer
end

component.actions = %w(join)
component.actions = %w(join comment)

component.settings(:global) do |settings|
settings.attribute :scopes_enabled, type: :boolean, default: false
Expand Down
2 changes: 2 additions & 0 deletions decidim-sortitions/config/locales/en.yml
Expand Up @@ -20,6 +20,8 @@ en:
decidim:
components:
sortitions:
actions:
comment: Comment
name: Sortitions
settings:
global:
Expand Down
3 changes: 2 additions & 1 deletion decidim-sortitions/lib/decidim/sortitions/component.rb
Expand Up @@ -13,7 +13,7 @@
end

# These actions permissions can be configured in the admin panel
component.actions = %w()
component.actions = %w(comment)

component.settings(:global) do |settings|
settings.attribute :comments_enabled, type: :boolean, default: true
Expand All @@ -25,6 +25,7 @@
resource.model_class_name = "Decidim::Sortitions::Sortition"
resource.template = "decidim/sortitions/sortitions/linked_sortitions"
resource.card = "decidim/sortitions/sortition"
resource.actions = %w(comment)
end

component.register_stat :sortitions_count, primary: true, priority: Decidim::StatsRegistry::HIGH_PRIORITY do |components, start_at, end_at|
Expand Down

0 comments on commit 9082c75

Please sign in to comment.