-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Participatory process groups content blocks (#12)
* Upgrade Decidim version to 0.23 * Fix rubocop offenses * Validate blueprints image file size using upload_maximum_file_size setting for organization * Add migration to add a reference in blueprints table to content blocks * Add association with content blocks to Blueprint model and factory * Allow passing the content block to SaveBlueprints command from form * Include content_block in BluePrintForm * Manage blueprints belonging to content block * Register navigation map content block for participatory process groups homepage * Include content block in tests for blueprints * Add test for ContentBlockBlueprints query * Add tests to check that blueprints association with content blocks * Use different classes and title for navigation block in groups landing page * Fix title display in navigation_map cell * Include content block association in seeds file * Remove console insertion in cell * Add test for groups_navigation_map cell
- Loading branch information
1 parent
ee6f2f0
commit 5199551
Showing
25 changed files
with
207 additions
and
23 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
app/cells/decidim/navigation_maps/content_blocks/groups_navigation_map/title.erb
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,3 @@ | ||
<% if translated_title.present? %> | ||
<h2 class="section-heading"><%= decidim_sanitize translated_title %></h2> | ||
<% end %> |
21 changes: 21 additions & 0 deletions
21
app/cells/decidim/navigation_maps/content_blocks/groups_navigation_map_cell.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,21 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim | ||
module NavigationMaps | ||
module ContentBlocks | ||
class GroupsNavigationMapCell < NavigationMapCell | ||
def section_classes | ||
"section home-section" | ||
end | ||
|
||
def wrapper_classes | ||
nil | ||
end | ||
|
||
def row_classes | ||
"row column" | ||
end | ||
end | ||
end | ||
end | ||
end |
6 changes: 3 additions & 3 deletions
6
app/cells/decidim/navigation_maps/content_blocks/navigation_map/show.erb
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
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
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
20 changes: 20 additions & 0 deletions
20
app/queries/decidim/navigation_maps/content_block_blueprints.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,20 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim | ||
module NavigationMaps | ||
# This query finds the published blueprints for a content block | ||
class ContentBlockBlueprints < Rectify::Query | ||
def initialize(content_block) | ||
@content_block = content_block | ||
end | ||
|
||
def query | ||
Decidim::NavigationMaps::Blueprint.where(content_block: @content_block) | ||
end | ||
|
||
private | ||
|
||
attr_reader :content_block | ||
end | ||
end | ||
end |
12 changes: 12 additions & 0 deletions
12
db/migrate/20201105130724_add_reference_to_content_block_to_blueprints_table.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 | ||
|
||
class AddReferenceToContentBlockToBlueprintsTable < ActiveRecord::Migration[5.2] | ||
def change | ||
add_reference( | ||
:decidim_navigation_maps_blueprints, | ||
:decidim_content_block, | ||
foreign_key: true, | ||
index: { name: "decidim_navigation_maps_constraint_content_block" } | ||
) | ||
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
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
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,38 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
module Decidim::NavigationMaps::ContentBlocks | ||
describe GroupsNavigationMapCell, type: :cell do | ||
subject { cell(group_content_block.cell, group_content_block).call } | ||
|
||
let(:organization) { create(:organization) } | ||
let(:group_content_block) do | ||
create( | ||
:content_block, | ||
organization: organization, | ||
manifest_name: :navigation_map, | ||
scope_name: :participatory_process_group_homepage | ||
) | ||
end | ||
let(:organization_homepage_content_block) do | ||
create( | ||
:content_block, | ||
organization: organization, | ||
manifest_name: :navigation_map, | ||
scope_name: :homepage | ||
) | ||
end | ||
let!(:group_blueprint) { create(:blueprint, organization: organization, content_block: group_content_block) } | ||
let!(:organization_homepage_blueprint) { create(:blueprint, organization: organization, content_block: organization_homepage_content_block) } | ||
|
||
controller Decidim::PagesController | ||
|
||
context "when there are blueprints in the content block" do | ||
it "contains the map" do | ||
expect(subject.to_s).to include(group_blueprint.image.url) | ||
expect(subject.to_s).not_to include(organization_homepage_blueprint.image.url) | ||
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
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
Oops, something went wrong.