diff --git a/src/Page/RecipeCategoryPage.php b/src/Page/RecipeCategoryPage.php index 793291a..d4973b0 100644 --- a/src/Page/RecipeCategoryPage.php +++ b/src/Page/RecipeCategoryPage.php @@ -70,6 +70,10 @@ public function getCMSFields(): FieldList ->setTitle(_t(__CLASS__ . '.RecipesPerPage', 'Recipes Per Page')), 'Content' ); + + $fields->dataFieldByName('Content') + ->setTitle('Summary') + ->setRows(5); }); $fields = parent::getCMSFields(); diff --git a/src/Page/RecipeLanding.php b/src/Page/RecipeLanding.php index 5632279..66cfa39 100644 --- a/src/Page/RecipeLanding.php +++ b/src/Page/RecipeLanding.php @@ -72,6 +72,10 @@ class RecipeLanding extends \Page public function getCMSFields(): FieldList { $this->beforeUpdateCMSFields(function (FieldList $fields) { + $fields->dataFieldByName('Content') + ->setTitle('Summary') + ->setRows(5); + if ($this->ID) { $config = GridFieldConfig_RelationEditor::create() ->addComponent(new GridFieldOrderableRows('SortOrder')) diff --git a/src/Page/RecipePage.php b/src/Page/RecipePage.php index 703ec81..feec9bf 100644 --- a/src/Page/RecipePage.php +++ b/src/Page/RecipePage.php @@ -100,6 +100,16 @@ class RecipePage extends \Page 'Image', ]; + /** + * @var array + * @config + */ + private static $cascade_duplicates = [ + 'Image', + 'Ingredients', + 'Directions', + ]; + /** * @var array */ diff --git a/templates/Dynamic/RecipeBook/Page/Layout/RecipeCategoryPage.ss b/templates/Dynamic/RecipeBook/Page/Layout/RecipeCategoryPage.ss index 1c38a3a..546c64f 100644 --- a/templates/Dynamic/RecipeBook/Page/Layout/RecipeCategoryPage.ss +++ b/templates/Dynamic/RecipeBook/Page/Layout/RecipeCategoryPage.ss @@ -1,83 +1,72 @@ -
-
- <% loop $paginatedList %> -
-
- - <% if $Image %> - $Image.Title - <% else %> - - <% end_if %> - <% if $Servings || $PrepTime || $CookTime || $Difficulty %> -
-
+
+ +
+
+

$Title

+ <% if $Content %> +

$Content

+ <% end_if %> +
+
+ + + <% if $RecipeList.Sort('Title') %> +
+ <% loop $RecipeList.Sort('Title') %> +
+
+ + <% if $Image %> + $Image.Title + <% else %> + No Image + <% end_if %> + +
+ <% if $PrimaryCategory %> +

$PrimaryCategory.Title

+ <% end_if %> +
+ $Title +
+
<% if $PrepTime %> -
- - Prep Time: $PrepTime +
+ Prep: $PrepTime
<% end_if %> <% if $CookTime %> -
- - Cook Time: $CookTime +
+ Cook: $CookTime
<% end_if %> <% if $Servings %> -
- - Servings: $Servings -
- <% end_if %> - <% if $Difficulty %> -
- - Difficulty: $Difficulty +
+ Servings: $Servings
<% end_if %>
+ <% if $Summary %> +

$Summary.LimitCharacters(100)

+ <% end_if %>
- <% end_if %> - -
-
-

$Title

-
- +
+ <% end_loop %> +
+ <% else %> +
+
+

No recipes found in this category.

- <% end_loop %> -
+ <% end_if %>
-<% if $paginatedList.MoreThanOnePage %> - -<% end_if %> \ No newline at end of file + +
+ $ElementalArea +
\ No newline at end of file diff --git a/templates/Dynamic/RecipeBook/Page/Layout/RecipeLanding.ss b/templates/Dynamic/RecipeBook/Page/Layout/RecipeLanding.ss index 15b67a7..cc713c6 100644 --- a/templates/Dynamic/RecipeBook/Page/Layout/RecipeLanding.ss +++ b/templates/Dynamic/RecipeBook/Page/Layout/RecipeLanding.ss @@ -1,50 +1,75 @@ -
-
- <% loop $paginatedList %> -
- <% if $CategoryImage %> - - <% else %> - +<% base_tag %> +
+ +
+
+

$Title

+ <% if $Content %> +

$Content

<% end_if %> -
-

$Title

- <% if $Content %>

$Content

<% end_if %> +
+
+ + + <% loop $Children %> +
+ +
+

$Title

-
- View All + + + <% loop $RecipeList.Limit(3).Sort('Title') %> +
+
+ + <% if $Image %> + $Image.Title + <% else %> + No Image + <% end_if %> + +
+ <% if $PrimaryCategory %> +

$PrimaryCategory.Title

+ <% end_if %> +
+ $Title +
+
+ <% if $PrepTime %> +
+ Prep: $PrepTime +
+ <% end_if %> + <% if $CookTime %> +
+ Cook: $CookTime +
+ <% end_if %> + <% if $Servings %> +
+ Servings: $Servings +
+ <% end_if %> +
+
+ +
+
+ <% end_loop %> + + +
<% end_loop %> -
-<% if $paginatedList.MoreThanOnePage %> - -<% end_if %> \ No newline at end of file + +
+ $ElementalArea +
\ No newline at end of file diff --git a/templates/Dynamic/RecipeBook/Page/Layout/RecipePage.ss b/templates/Dynamic/RecipeBook/Page/Layout/RecipePage.ss index 491a3f1..8b0d757 100644 --- a/templates/Dynamic/RecipeBook/Page/Layout/RecipePage.ss +++ b/templates/Dynamic/RecipeBook/Page/Layout/RecipePage.ss @@ -9,6 +9,9 @@
+ <% if $PrimaryCategory %> +

$PrimaryCategory.Title

+ <% end_if %>

$Title

@@ -71,12 +74,14 @@

Instructions

- <% loop $Directions.Sort('Sort') %> -
- $Pos. - $Title -
- <% end_loop %> +
    + <% loop $Directions.Sort('Sort') %> +
  • + $Pos. + $Title +
  • + <% end_loop %> +