diff --git a/partials/builder/columns/events.htm b/partials/builder/columns/events.htm index c957765..8c3e7e2 100644 --- a/partials/builder/columns/events.htm +++ b/partials/builder/columns/events.htm @@ -15,6 +15,15 @@ {% set month_day_year_and_time = "M d, Y - g:i A" %} {% set sort_order = column.reverse_order ? 'desc' : 'asc' %} +{% if column.show_specific_items %} + {% set events = collect() %} + {% for event in column.specific_items %} + {% if event.item is not empty %} + {% do events.push(event.item) %} + {% endif %} + {% endfor %} +{% endif %} + {% if column.show == 'upcoming' %} {% set events = events.whereDate('date', '>=', today) %} {% endif %} @@ -24,21 +33,39 @@ {% endif %} {% if column.sort_by == 'title' %} - {% set events = events.orderBy('title', sort_order) %} - {% set older_events = older_events.orderBy('title', sort_order) %} + {% if column.show_specific_items %} + {% if sort_order == 'asc' %} + {% set events = events.sortBy('title') %} + {% else %} + {% set events = events.sortBy('title')|reverse %} + {% endif %} + {% else %} + {% set events = events.orderBy('title', sort_order) %} + {% set older_events = older_events.orderBy('title', sort_order) %} + {% endif %} {% endif %} {% if column.sort_by == 'date' %} - {% set events = events.orderBy('date', sort_order) %} - {% set older_events = older_events.orderBy('title', sort_order) %} + {% if column.show_specific_items %} + {% if sort_order == 'asc' %} + {% set events = events.sortBy('date') %} + {% else %} + {% set events = events.sortBy('date')|reverse %} + {% endif %} + {% else %} + {% set events = events.orderBy('date', sort_order) %} + {% set older_events = older_events.orderBy('date', sort_order) %} + {% endif %} {% endif %} {% if column.enable_pagination %} {% set events = events.paginateCustom(column.per_page, 'events_column') %} {% set older_events = older_events.paginateCustom(column.per_page, 'older_events_column') %} {% else %} - {% set events = events.limit(column.limit).get() %} - {% set older_events = older_events.limit(column.limit).get() %} + {% if not column.show_specific_items %} + {% set events = events.limit(column.limit).get() %} + {% set older_events = older_events.limit(column.limit).get() %} + {% endif %} {% endif %} {% if (column.show_older_events and column.show == 'upcoming') %} diff --git a/partials/builder/columns/posts.htm b/partials/builder/columns/posts.htm index 48717a6..7df0e60 100644 --- a/partials/builder/columns/posts.htm +++ b/partials/builder/columns/posts.htm @@ -3,34 +3,62 @@ == {% set sort_order = column.reverse_order ? 'desc' : 'asc' %} +{% if column.show_specific_items %} + {% set posts = collect() %} + {% for post in column.specific_items %} + {% if post.item is not empty %} + {% do posts.push(post.item) %} + {% endif %} + {% endfor %} +{% endif %} + {% if column.filter_by_category %} {% set posts = posts.whereRelation('categories', 'id', column.post_category_filter.id) %} {% endif %} {% if column.sort_by == 'title' %} - {% set posts = posts.orderBy('title', sort_order) %} + {% if column.show_specific_items %} + {% if sort_order == 'asc' %} + {% set posts = posts.sortBy('title') %} + {% else %} + {% set posts = posts.sortBy('title')|reverse %} + {% endif %} + {% else %} + {% set posts = posts.orderBy('title', sort_order) %} + {% endif %} {% endif %} {% if column.sort_by == 'date' %} - {% set posts = posts.orderBy('published_at_date', sort_order) %} + {% if column.show_specific_items %} + {% if sort_order == 'asc' %} + {% set posts = posts.sortBy('published_at_date') %} + {% else %} + {% set posts = posts.sortBy('published_at_date')|reverse %} + {% endif %} + {% else %} + {% set posts = posts.orderBy('published_at_date', sort_order) %} + {% endif %} {% endif %} {% if column.enable_pagination %} - {% set posts = posts.paginateCustom(column.per_page, "posts_column") %} + {% set posts = posts.paginateCustom(column.limit, "posts") %} {% else %} - {% set posts = posts.limit(column.limit).get() %} + {% if not column.show_specific_items %} + {% set posts = posts.limit(column.limit).get() %} + {% endif %} {% endif %} -{% partial 'builder/globals/shop_alerts' %} -
+
{% for post in posts %} -
4 ? "-12 col-lg-3" }} mb-4"> +
+ {% if post.image|length %} {{ post.title }} + {% endif %}

diff --git a/partials/builder/columns/products.htm b/partials/builder/columns/products.htm index 3ff877f..f37f03b 100644 --- a/partials/builder/columns/products.htm +++ b/partials/builder/columns/products.htm @@ -3,34 +3,63 @@ == {% set sort_order = column.reverse_order ? 'desc' : 'asc' %} +{% if column.show_specific_items %} + {% set products = collect() %} + {% for product in column.specific_items %} + {% if product.item is not empty %} + {% do products.push(product.item) %} + {% endif %} + {% endfor %} +{% endif %} + {% if column.filter_by_category %} {% set products = products.whereRelation('categories', 'id', column.product_category_filter.id) %} {% endif %} {% if column.sort_by == 'title' %} - {% set products = products.orderBy('title', sort_order) %} + {% if column.show_specific_items %} + {% if sort_order == 'asc' %} + {% set products = products.sortBy('title') %} + {% else %} + {% set products = products.sortBy('title')|reverse %} + {% endif %} + {% else %} + {% set products = products.orderBy('title', sort_order) %} + {% endif %} {% endif %} {% if column.sort_by == 'date' %} - {% set products = products.orderBy('published_at_date', sort_order) %} + {% if column.show_specific_items %} + {% if sort_order == 'asc' %} + {% set products = products.sortBy('published_at_date') %} + {% else %} + {% set products = products.sortBy('published_at_date')|reverse %} + {% endif %} + {% else %} + {% set products = products.orderBy('published_at_date', sort_order) %} + {% endif %} {% endif %} {% if column.enable_pagination %} {% set products = products.paginateCustom(column.per_page, "products_column") %} {% else %} - {% set products = products.limit(column.limit).get() %} + {% if not column.show_specific_items %} + {% set products = products.limit(column.limit).get() %} + {% endif %} {% endif %} {% partial 'builder/globals/shop_alerts' %} -
+
{% for product in products %} -
4 ? "-12 col-lg-3" }} mb-4"> +
- {{ product.title }} + {% if product.images|length %} + {{ product.title }} + {% endif %}

{{ product.title }}

{{ settings.currency_symbol_placement == 'before' ? settings.currency_symbol }}{{ product.price }}{{ settings.currency_symbol_placement == 'after' ? settings.currency_symbol }} diff --git a/partials/builder/sections/events.htm b/partials/builder/sections/events.htm index 23ee518..828de02 100644 --- a/partials/builder/sections/events.htm +++ b/partials/builder/sections/events.htm @@ -18,6 +18,15 @@ {% set month_day_and_time = "M d - g:i A" %} {% set month_day_year_and_time = "M d, Y - g:i A" %} {% set sort_order = section.reverse_order ? 'desc' : 'asc' %} + + {% if section.show_specific_items %} + {% set events = collect() %} + {% for event in section.specific_items %} + {% if event.item is not empty %} + {% do events.push(event.item) %} + {% endif %} + {% endfor %} + {% endif %} {% if section.show == 'upcoming' %} {% set events = events.whereDate('date', '>=', today) %} @@ -28,21 +37,39 @@ {% endif %} {% if section.sort_by == 'title' %} - {% set events = events.orderBy('title', sort_order) %} - {% set older_events = older_events.orderBy('title', sort_order) %} + {% if section.show_specific_items %} + {% if sort_order == 'asc' %} + {% set events = events.sortBy('title') %} + {% else %} + {% set events = events.sortBy('title')|reverse %} + {% endif %} + {% else %} + {% set events = events.orderBy('title', sort_order) %} + {% set older_events = older_events.orderBy('title', sort_order) %} + {% endif %} {% endif %} {% if section.sort_by == 'date' %} - {% set events = events.orderBy('date', sort_order) %} - {% set older_events = older_events.orderBy('date', sort_order) %} + {% if section.show_specific_items %} + {% if sort_order == 'asc' %} + {% set events = events.sortBy('date') %} + {% else %} + {% set events = events.sortBy('date')|reverse %} + {% endif %} + {% else %} + {% set events = events.orderBy('date', sort_order) %} + {% set older_events = older_events.orderBy('date', sort_order) %} + {% endif %} {% endif %} {% if section.enable_pagination %} - {% set events = events.paginateCustom(section.per_page, 'events') %} - {% set older_events = older_events.paginateCustom(section.per_page, 'older_events') %} + {% set events = events.paginateCustom(section.limit, 'events') %} + {% set older_events = older_events.paginateCustom(section.limit, 'older_events') %} {% else %} - {% set events = events.limit(section.limit).get() %} - {% set older_events = older_events.limit(section.limit).get() %} + {% if not section.show_specific_items %} + {% set events = events.limit(section.limit).get() %} + {% set older_events = older_events.limit(section.limit).get() %} + {% endif %} {% endif %}
- {{ section.image_description }} + {{ heroImageAlt }}
{% endif %} diff --git a/partials/builder/sections/posts.htm b/partials/builder/sections/posts.htm index cc23f95..bacd88a 100644 --- a/partials/builder/sections/posts.htm +++ b/partials/builder/sections/posts.htm @@ -8,22 +8,49 @@ {% set sort_order = section.reverse_order ? 'desc' : 'asc' %} + {% if section.show_specific_items %} + {% set posts = collect() %} + {% for post in section.specific_items %} + {% if post.item is not empty %} + {% do posts.push(post.item) %} + {% endif %} + {% endfor %} + {% endif %} + {% if section.filter_by_category %} {% set posts = posts.whereRelation('categories', 'id', section.post_category_filter.id) %} {% endif %} {% if section.sort_by == 'title' %} - {% set posts = posts.orderBy('title', sort_order) %} + {% if section.show_specific_items %} + {% if sort_order == 'asc' %} + {% set posts = posts.sortBy('title') %} + {% else %} + {% set posts = posts.sortBy('title')|reverse %} + {% endif %} + {% else %} + {% set posts = posts.orderBy('title', sort_order) %} + {% endif %} {% endif %} {% if section.sort_by == 'date' %} - {% set posts = posts.orderBy('published_at_date', sort_order) %} + {% if section.show_specific_items %} + {% if sort_order == 'asc' %} + {% set posts = posts.sortBy('published_at_date') %} + {% else %} + {% set posts = posts.sortBy('published_at_date')|reverse %} + {% endif %} + {% else %} + {% set posts = posts.orderBy('published_at_date', sort_order) %} + {% endif %} {% endif %} {% if section.enable_pagination %} - {% set posts = posts.paginateCustom(section.per_page, "posts") %} + {% set posts = posts.paginateCustom(section.limit, "posts") %} {% else %} - {% set posts = posts.limit(section.limit).get() %} + {% if not section.show_specific_items %} + {% set posts = posts.limit(section.limit).get() %} + {% endif %} {% endif %}
-
+
{% for post in posts %} -
4 ? "-12 col-lg-3" }} mb-4"> +
- - {{ post.title }} - + {% if post.image|length %} + + {{ post.title }} + + {% endif %}

{{ post.title }} diff --git a/partials/builder/sections/products.htm b/partials/builder/sections/products.htm index 7b1e081..e21059b 100644 --- a/partials/builder/sections/products.htm +++ b/partials/builder/sections/products.htm @@ -8,22 +8,49 @@ {% set sort_order = section.reverse_order ? 'desc' : 'asc' %} + {% if section.show_specific_items %} + {% set products = collect() %} + {% for product in section.specific_items %} + {% if product.item is not empty %} + {% do products.push(product.item) %} + {% endif %} + {% endfor %} + {% endif %} + {% if section.filter_by_category %} {% set products = products.whereRelation('categories', 'id', section.product_category_filter.id) %} {% endif %} {% if section.sort_by == 'title' %} - {% set products = products.orderBy('title', sort_order) %} + {% if section.show_specific_items %} + {% if sort_order == 'asc' %} + {% set products = products.sortBy('title') %} + {% else %} + {% set products = products.sortBy('title')|reverse %} + {% endif %} + {% else %} + {% set products = products.orderBy('title', sort_order) %} + {% endif %} {% endif %} {% if section.sort_by == 'date' %} - {% set products = products.orderBy('published_at_date', sort_order) %} + {% if section.show_specific_items %} + {% if sort_order == 'asc' %} + {% set products = products.sortBy('published_at_date') %} + {% else %} + {% set products = products.sortBy('published_at_date')|reverse %} + {% endif %} + {% else %} + {% set products = products.orderBy('published_at_date', sort_order) %} + {% endif %} {% endif %} {% if section.enable_pagination %} - {% set products = products.paginateCustom(section.per_page, "products") %} + {% set products = products.paginateCustom(section.limit, "products") %} {% else %} - {% set products = products.limit(section.limit).get() %} + {% if not section.show_specific_items %} + {% set products = products.limit(section.limit).get() %} + {% endif %} {% endif %}
{% partial 'builder/globals/shop_alerts' %} -
+
{% for product in products %} -
4 ? "-12 col-lg-3" }} mb-4"> +
- {{ product.title }} + {% if product.images|length %} + {{ product.title }} + {% endif %}

{{ product.title }}

{{ settings.currency_symbol_placement == 'before' ? settings.currency_symbol }}{{ product.price }}{{ settings.currency_symbol_placement == 'after' ? settings.currency_symbol }} diff --git a/seeds/blueprints/content/mixins/builder/blog/blog_common.yaml b/seeds/blueprints/content/mixins/builder/blog/blog_common.yaml index dad4ad1..62b1f1d 100644 --- a/seeds/blueprints/content/mixins/builder/blog/blog_common.yaml +++ b/seeds/blueprints/content/mixins/builder/blog/blog_common.yaml @@ -16,13 +16,13 @@ fields: type: number span: right label: Post Limit - commentAbove: How many posts would you like to show? Min of 3. + commentAbove: How many posts would you like to show? Also used for pagination. default: 3 - min: 3 + min: 1 tab: General trigger: - action: disable - field: enable_pagination + action: disable|empty + field: show_specific_items condition: checked filter_by_category: type: switch @@ -30,6 +30,10 @@ fields: cssClass: mt-3 label: Filter By Category comment: Filter posts by a specific category + trigger: + action: disable|empty + field: show_specific_items + condition: checked reverse_order: type: switch span: right @@ -51,6 +55,45 @@ fields: action: show field: filter_by_category condition: checked + specific_items_mixin: + type: mixin + tab: General + source: Content\SpecificItems + specific_items_columns: + type: dropdown + label: Number of Columns + default: value[3] + commentAbove: Choose the number of columns you would like for the specific items you chose. Min of 1, Max of 4. + span: right + options: + 12: One Column + 6: Two Columns + 4: Three Columns + 3: Four Columns + trigger: + action: show + field: show_specific_items + condition: checked + specific_items: + type: repeater + label: Specific Items + commentAbove: Add items to show for this block. + span: full + tab: General + showDuplicate: false + showReorder: false + prompt: Add a Post + form: + fields: + item: + label: Post + type: entries + maxItems: 1 + source: Blog\Posts + trigger: + action: show + field: show_specific_items + condition: checked pagination: type: mixin tab: General diff --git a/seeds/blueprints/content/mixins/builder/events/events_common.yaml b/seeds/blueprints/content/mixins/builder/events/events_common.yaml index a8b8fc8..1d80cff 100644 --- a/seeds/blueprints/content/mixins/builder/events/events_common.yaml +++ b/seeds/blueprints/content/mixins/builder/events/events_common.yaml @@ -12,6 +12,10 @@ fields: options: upcoming: Upcoming Events all: All Events + trigger: + action: fill[all] + field: show_specific_items + condition: checked sort_by: type: dropdown span: right @@ -43,13 +47,13 @@ fields: type: number span: full label: Event Limit - commentAbove: How many events would you like to show? Min of 3. Applies to all events (old and new). + commentAbove: How many events would you like to show? Also used for pagination. default: 3 - min: 3 + min: 1 tab: General trigger: - action: disable - field: enable_pagination + action: disable|empty + field: show_specific_items condition: checked older_events_title: type: text @@ -73,6 +77,30 @@ fields: action: show field: show_older_events condition: checked + specific_items_mixin: + type: mixin + tab: General + source: Content\SpecificItems + specific_items: + type: repeater + label: Specific Items + commentAbove: Add items to show for this block. + span: full + tab: General + showDuplicate: false + showReorder: false + prompt: Add an Event + form: + fields: + item: + label: Event + type: entries + maxItems: 1 + source: Content\Event + trigger: + action: show + field: show_specific_items + condition: checked pagination: type: mixin tab: General diff --git a/seeds/blueprints/content/mixins/builder/general_options/pagination.yaml b/seeds/blueprints/content/mixins/builder/general_options/pagination.yaml index c8bdfbb..02ffce5 100644 --- a/seeds/blueprints/content/mixins/builder/general_options/pagination.yaml +++ b/seeds/blueprints/content/mixins/builder/general_options/pagination.yaml @@ -13,14 +13,7 @@ fields: comment: Enable Pagination for this block. Also disables the limit. Applies to all content (old and new). span: left tab: General - per_page: - type: number - label: Items Per Page - commentAbove: How many items should show per page - default: 4 - span: right - min: 1 trigger: - action: show - field: enable_pagination + action: disable|empty + field: show_specific_items condition: checked \ No newline at end of file diff --git a/seeds/blueprints/content/mixins/builder/general_options/specific_items.yaml b/seeds/blueprints/content/mixins/builder/general_options/specific_items.yaml new file mode 100644 index 0000000..9475524 --- /dev/null +++ b/seeds/blueprints/content/mixins/builder/general_options/specific_items.yaml @@ -0,0 +1,20 @@ +uuid: f20ade7d-a7fc-11ed-bd1e-79654f973810 +handle: Content\SpecificItems +type: mixin +name: Pagination + +fields: + hr_specific_items: + type: ruler + tab: General + show_specific_items: + type: switch + label: Show Specific Items + comment: Pick items you want to show for this block + span: left + tab: General + trigger: + action: disable|empty + field: show + condition: value[upcoming] + \ No newline at end of file diff --git a/seeds/blueprints/content/mixins/builder/hero/hero.yaml b/seeds/blueprints/content/mixins/builder/hero/hero.yaml index f981324..104ac9e 100644 --- a/seeds/blueprints/content/mixins/builder/hero/hero.yaml +++ b/seeds/blueprints/content/mixins/builder/hero/hero.yaml @@ -12,6 +12,15 @@ fields: type: text span: full tab: General + image_type: + label: Image Type + commentAbove: Choose which type of image you would like to display. Add your own image or pick from a image category. + type: dropdown + tab: General + options: + media_library: Media Library Image + product_category_image: Product Category Image + blog_category_image: Blog Category Image image: label: Image type: mediafinder @@ -20,12 +29,40 @@ fields: mode: image maxItems: 1 tab: General + trigger: + action: show + field: image_type + condition: value[media_library] image_description: label: Image Description type: text commentAbove: The Description of the image. Use for SEO purposes. span: right tab: General + trigger: + action: show + field: image_type + condition: value[media_library] + blog_category: + type: entries + source: Blog\Categories + tab: General + maxItems: 1 + label: Blog Category + trigger: + action: show + field: image_type + condition: value[blog_category_image] + product_category: + type: entries + source: Content\Product\Category + tab: General + maxItems: 1 + label: Product Category + trigger: + action: show + field: image_type + condition: value[product_category_image] position: label: Position type: dropdown diff --git a/seeds/blueprints/content/mixins/builder/products/products_common.yaml b/seeds/blueprints/content/mixins/builder/products/products_common.yaml index b85880d..094a11f 100644 --- a/seeds/blueprints/content/mixins/builder/products/products_common.yaml +++ b/seeds/blueprints/content/mixins/builder/products/products_common.yaml @@ -16,13 +16,13 @@ fields: type: number span: right label: Product Limit - commentAbove: How many products would you like to show? Min of 3. + commentAbove: How many posts would you like to show? Also used for pagination. default: 3 - min: 3 + min: 1 tab: General trigger: - action: disable - field: enable_pagination + action: disable|empty + field: show_specific_items condition: checked filter_by_category: type: switch @@ -30,6 +30,10 @@ fields: cssClass: mt-3 label: Filter By Category comment: Filter products by a specific category + trigger: + action: disable|empty + field: show_specific_items + condition: checked reverse_order: type: switch span: right @@ -51,6 +55,45 @@ fields: action: show field: filter_by_category condition: checked + specific_items_mixin: + type: mixin + tab: General + source: Content\SpecificItems + specific_items_columns: + type: dropdown + label: Number of Columns + default: value[3] + commentAbove: Choose the number of columns you would like for the specific items you chose. Min of 1, Max of 4. + span: right + options: + 12: One Column + 6: Two Columns + 4: Three Columns + 3: Four Columns + trigger: + action: show + field: show_specific_items + condition: checked + specific_items: + type: repeater + label: Specific Items + commentAbove: Add items to show for this block. + span: full + tab: General + showDuplicate: false + showReorder: false + prompt: Add a Product + form: + fields: + item: + label: Product + type: entries + maxItems: 1 + source: Content\Product + trigger: + action: show + field: show_specific_items + condition: checked pagination: type: mixin tab: General diff --git a/version.yaml b/version.yaml index 6cfa37b..9b599a0 100644 --- a/version.yaml +++ b/version.yaml @@ -61,4 +61,5 @@ v5.0.3: Moved all assets to the assets partial for easy asset management. v5.0.4: Hide currency if shop is disabled v5.0.5: Hide currency if shop is disabled v5.1.0: Add multi-level page support -v6.0.0: Added the pagefinder widget. Added a blog with post authors and categories. Removed Categories pages since they can be created in the builder (More flexible). \ No newline at end of file +v6.0.0: Added the pagefinder widget. Added a blog with post authors and categories. Removed Categories pages since they can be created in the builder (More flexible). +v6.1.0: Added ability to select specific records for the Posts, Products, and Events blocks in the builder. \ No newline at end of file