Skip to content

Commit

Permalink
Merge pull request #103 from cazwazacz/cazwazacz/webdev-938_update-gr…
Browse files Browse the repository at this point in the history
…oups-show

[WEBDEV-938] Remove date and create Layings card for Group show page
  • Loading branch information
mattrayner committed Nov 2, 2018
2 parents b3c9734 + 296814b commit 675008e
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 294 deletions.
24 changes: 12 additions & 12 deletions app/serializers/page_serializer/groups_show_page_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def title
def content
[].tap do |components|
components << ComponentSerializer::SectionComponentSerializer.new(components: section_primary_components, type: 'primary').to_h
components << ComponentSerializer::SectionComponentSerializer.new(components: section_literals, type: 'section').to_h
components << ComponentSerializer::SectionComponentSerializer.new(components: section_components, type: 'section').to_h
end
end

Expand All @@ -38,21 +38,21 @@ def heading_content
hash[:subheading_content] = 'groups.groups'
hash[:subheading_data] = { link: groups_path }
hash[:heading_content] = title
hash[:context_content] = @group.date_range
end
end

def section_literals
[].tap do |component|
component << if @group.is_a?(Parliament::Grom::Decorator::LayingBody)
ComponentSerializer::ParagraphComponentSerializer.new(
content: [{
content: 'groups.subsidiary-resources.layings',
link: group_made_available_availability_types_layings_path(@group.try(:graph_id))
}]
).to_h
end
def list_components
section_components = []

if @group.is_a?(Parliament::Grom::Decorator::LayingBody)
section_components << CardFactory.new(heading_text: 'groups.subsidiary-resources.layings-title', heading_url: group_made_available_availability_types_layings_path(@group.try(:graph_id))).build_card
end

section_components
end

def section_components
[ComponentSerializer::ListComponentSerializer.new(display: 'generic', display_data: [display_data(component: 'list', variant: 'block')], components: list_components).to_h]
end
end
end
22 changes: 16 additions & 6 deletions spec/fixtures/controllers/groups_controller/show/fixture.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,26 @@ main-components:
link: "/groups"
heading:
content: groupName - 1
context:
content: 12 May 2010 to present
- name: section__section
data:
components:
- name: paragraph
- name: list__generic
data:
- content: groups.subsidiary-resources.layings
data:
link: "/groups/7dSvuueH/made-available/availability-types/layings"
type: ol
display:
name: partials__display
data:
- component: list
variant: block
components:
- name: card__generic
data:
heading:
name: heading
data:
content: groups.subsidiary-resources.layings-title
size: 2
link: "/groups/7dSvuueH/made-available/availability-types/layings"
footer-components:
- name: footer
data:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,26 @@ main-components:
link: "/groups"
heading:
content: groupName - 1
context:
content: 12 May 2010 to present
- name: section__section
data:
components:
- name: paragraph
- name: list__generic
data:
- content: groups.subsidiary-resources.layings
data:
link: "/groups/7dSvuueH/made-available/availability-types/layings"
type: ol
display:
name: partials__display
data:
- component: list
variant: block
components:
- name: card__generic
data:
heading:
name: heading
data:
content: groups.subsidiary-resources.layings-title
size: 2
link: "/groups/7dSvuueH/made-available/availability-types/layings"
footer-components:
- name: footer
data:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,18 @@ main-components:
link: "/groups"
heading:
content: groupName - 1
context:
content: 12 May 2010 to present
- name: section__section
data:
components:
-
- name: list__generic
data:
type: ol
display:
name: partials__display
data:
- component: list
variant: block
components: []
footer-components:
- name: footer
data:
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,26 @@ main-components:
link: "/groups"
heading:
content: "[Name unavailable]"
context:
content: 12 May 2010 to present
- name: section__section
data:
components:
- name: paragraph
- name: list__generic
data:
- content: groups.subsidiary-resources.layings
data:
link: "/groups/7dSvuueH/made-available/availability-types/layings"
type: ol
display:
name: partials__display
data:
- component: list
variant: block
components:
- name: card__generic
data:
heading:
name: heading
data:
content: groups.subsidiary-resources.layings-title
size: 2
link: "/groups/7dSvuueH/made-available/availability-types/layings"
footer-components:
- name: footer
data:
Expand Down
Loading

0 comments on commit 675008e

Please sign in to comment.