Skip to content

Commit

Permalink
Add support for having expanding collection regions. Fixes #888
Browse files Browse the repository at this point in the history
  • Loading branch information
filipmatsman committed Jan 18, 2020
1 parent 041ba54 commit b489d5e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions core/Piranha.Manager.Core/Models/Content/RegionMeta.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ public class RegionMeta : ContentMeta
/// </summary>
public bool IsCollection { get; set; }

/// <summary>
/// Gets/sets if the items ion the collection should be expanded
/// </summary>
public bool Expanded { get; set; }

/// <summary>
/// Gets/sets how the region should be display (content/full/setting)
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions core/Piranha.Manager.Core/Services/PageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ private PageEditModel Transform(DynamicPage page, bool isDraft)
Description = regionType.Description,
Placeholder = regionType.ListTitlePlaceholder,
IsCollection = regionType.Collection,
Expanded = regionType.ListExpand,
Icon = regionType.Icon,
Display = regionType.Display.ToString().ToLower()
}
Expand Down
1 change: 1 addition & 0 deletions core/Piranha.Manager.Core/Services/PostService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ private PostEditModel Transform(DynamicPost post, bool isDraft)
Description = regionType.Description,
Placeholder = regionType.ListTitlePlaceholder,
IsCollection = regionType.Collection,
Expanded = regionType.ListExpand,
Icon = regionType.Icon,
Display = regionType.Display.ToString().ToLower()
}
Expand Down
1 change: 1 addition & 0 deletions core/Piranha.Manager.Core/Services/SiteService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ private SiteContentEditModel Transform(DynamicSiteContent site)
Description = regionType.Description,
Placeholder = regionType.ListTitlePlaceholder,
IsCollection = regionType.Collection,
Expanded = regionType.ListExpand,
Icon = regionType.Icon,
Display = regionType.Display.ToString().ToLower()
}
Expand Down
4 changes: 2 additions & 2 deletions core/Piranha.Manager/assets/src/js/components/region.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Vue.component("region", {
" <div :id='model.meta.uid' class='accordion sortable' :class='model.items.length !== 0 ? \"mb-3\" : \"\"'>" +
" <div class='card' :key='item.uid' v-for='(item, index) in model.items'>" +
" <div class='card-header'>" +
" <a href='#' data-toggle='collapse' :data-target='\"#body\" + item.uid'>" +
" <a href='#' :data-toggle='!model.meta.expanded ? \"collapse\" : false' :data-target='\"#body\" + item.uid'>" +
" <div class='handle'>" +
" <i class='fas fa-ellipsis-v'></i>" +
" </div>" +
Expand All @@ -71,7 +71,7 @@ Vue.component("region", {
" <a v-on:click.prevent='removeItem(item)' href='#' class='danger'><i class='fas fa-trash'></i></a>" +
" </span>" +
" </div>" +
" <div :id='\"body\" + item.uid' class='collapse' :data-parent='\"#\" + model.meta.uid'>" +
" <div :id='\"body\" + item.uid' :class='{ \"collapse\" : !model.meta.expanded}' :data-parent='\"#\" + model.meta.uid'>" +
" <div class='card-body'>" +
" <div class='row'>" +
" <div class='form-group' :class='{ \"col-sm-6\": field.meta.isHalfWidth, \"col-sm-12\": !field.meta.isHalfWidth }' v-for='field in item.fields'>" +
Expand Down

0 comments on commit b489d5e

Please sign in to comment.