From 29487b719669bfc850ca53ca69563fb294189dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Orze=C5=82?= Date: Fri, 9 Oct 2015 10:52:00 +0200 Subject: [PATCH] Fix #5 Blueprints for admin and other fixes --- blueprints.yaml | 15 --- blueprints/asset/file.yaml | 70 -------------- blueprints/blog.yaml | 33 ++++--- blueprints/default.yaml | 157 ------------------------------- blueprints/form.yaml | 2 - blueprints/item.yaml | 40 -------- blueprints/modular.yaml | 27 ------ blueprints/modular/features.yaml | 7 -- templates/blog.html.twig | 76 ++++++++------- 9 files changed, 58 insertions(+), 369 deletions(-) delete mode 100644 blueprints/asset/file.yaml delete mode 100644 blueprints/default.yaml delete mode 100644 blueprints/form.yaml delete mode 100644 blueprints/item.yaml delete mode 100644 blueprints/modular.yaml delete mode 100644 blueprints/modular/features.yaml diff --git a/blueprints.yaml b/blueprints.yaml index 901f04a..4c0d342 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -11,18 +11,3 @@ demo: http://demo.getgrav.org/deliver-skeleton/ keywords: deliver, theme, modern, fast, responsive, html5, css3 bugs: https://github.com/getgrav/grav-theme-deliver/issues license: MIT - -form: - validation: loose - fields: - dropdown.enabled: - type: toggle - label: Dropdown in navbar - highlight: 1 - default: 0 - options: - 1: Enabled - 0: Disabled - validate: - type: bool - diff --git a/blueprints/asset/file.yaml b/blueprints/asset/file.yaml deleted file mode 100644 index e1f5005..0000000 --- a/blueprints/asset/file.yaml +++ /dev/null @@ -1,70 +0,0 @@ -media: - video: - mp4: video/mp4 - mov: video/quicktime - m4v: video/x-m4v - swf: video/x-flv - - image: - jpg: image/jpeg - jpeg: image/jpeg - png: image/png - gif: image/gif - - file: - txt: text/plain - doc: application/msword - html: text/html - pdf: application/pdf - zip: application/zip - gz: application/gzip - -form: - key: filename - fields: - upload: - type: upload - label: Upload - allow: - @media.*.keys - accept: - @media.*.values - - filename: - type: text - label: Filename - - type: - type: hidden - default: video - - name: - type: unset - - description: - type: textarea - label: Description - - url: - type: unset - - path: - type: unset - - thumb: - type: unset - - width: - type: text - label: Width - - height: - type: text - label: Height - - mime: - type: hidden - default: 'application/octet-stream' - - modified: - type: unset diff --git a/blueprints/blog.yaml b/blueprints/blog.yaml index eb50e4d..b5937f9 100644 --- a/blueprints/blog.yaml +++ b/blueprints/blog.yaml @@ -1,8 +1,19 @@ title: Blog -@extends: default +@extends: + type: default + context: blueprints://pages child_type: item + +title: Default + +rules: + slug: + pattern: "[a-z][a-z0-9_\-]+" + min: 2 + max: 80 + form: fields: tabs: @@ -10,6 +21,12 @@ form: active: 1 fields: + advanced: + fields: + overrides: + fields: + header.child_type: + default: item blog: type: tab title: Blog List @@ -28,9 +45,8 @@ form: default: 5 validate: required: true - pattern: "[1-9][0-9]*" - validate: type: int + min: 1 header.content.order.by: type: select @@ -52,16 +68,9 @@ form: header.content.pagination: type: toggle - label: Order + label: Pagination + highlight: 1 default: 1 options: 1: Enabled 0: Disabled - - header.pagination: - type: hidden - default: true - - header.blog_url: - type: hidden - default: '' diff --git a/blueprints/default.yaml b/blueprints/default.yaml deleted file mode 100644 index 43743af..0000000 --- a/blueprints/default.yaml +++ /dev/null @@ -1,157 +0,0 @@ -title: Default - -rules: - slug: - pattern: "[a-z][a-z0-9_\-]+" - min: 2 - max: 80 - -form: - fields: - type: - type: hidden - label: Page Type - default: default - - tabs: - type: tabs - active: 1 - - fields: - content: - type: tab - title: Content - - fields: - route: - type: select - label: Parent - @data-options: '\Grav\Common\Page\Pages::parents' - @data-default: '\Grav\Plugin\admin::route' - options: - '': '- Root -' - - order: - type: text - label: Ordering - validate: - type: int - min: 0 - - folder: - type: text - label: Folder - validate: - type: slug -# required: true - - header.title: - type: text - label: Title - validate: - required: true - - content: - type: textarea - label: Content - - header.process: - type: checkboxes - label: Process - default: [markdown: true, twig: true] - options: - markdown: Markdown - twig: Twig - use: keys - - - meta: - type: tab - title: Meta - - fields: - header.description: - type: textarea - label: Description - validate: - max: 120 - - header.keywords: - type: text - label: Keywords - validate: - max: 120 - - header.robots: - type: checkboxes - label: Robots - options: - noindex: No index - nofollow: No follow - use: keys - - overrides: - type: tab - title: Overrides - - fields: - header.menu: - type: text - label: Menu - - header.slug: - type: text - label: Alias - validate: - rule: slug - - header.cache_enable: - type: toggle - label: Caching - highlight: 1 - options: - '': Global - 1: Enabled - 0: Disabled - validate: - type: bool - - header.routable: - type: toggle - label: Access by URL - highlight: 1 - default: '' - options: - '': Global - 1: Enabled - 0: Disabled - validate: - type: bool - - header.child_type: - type: select - label: Default Child Type - default: default - @data-options: '\Grav\Common\Page\Pages::types' - - header.order_by: - type: hidden - - header.order_manual: - type: hidden - validate: - type: commalist - - media: - type: tab - title: Media - - fields: - files: - type: spacer - title: Files - - media: - type: list - add: Add file - @import: 'medium/file' diff --git a/blueprints/form.yaml b/blueprints/form.yaml deleted file mode 100644 index a3434a1..0000000 --- a/blueprints/form.yaml +++ /dev/null @@ -1,2 +0,0 @@ -title: Nopad -@extends: default diff --git a/blueprints/item.yaml b/blueprints/item.yaml deleted file mode 100644 index 35e7ae9..0000000 --- a/blueprints/item.yaml +++ /dev/null @@ -1,40 +0,0 @@ -title: Item -@extends: default - -form: - fields: - tabs: - - fields: - blog: - type: tab - title: Blog Item - - fields: - header.date: - type: datetime - label: Date - - header.taxonomy.category: - type: text - label: Category - default: blog - - header.taxonomy.tag: - type: checkboxes - label: Tags - options: - demo: demo - grav: grav - matias: matias - apple: apple - sample: sample - - header.username: - type: text - label: Author - - header.blog_url: - type: text - label: Blog URL - default: diff --git a/blueprints/modular.yaml b/blueprints/modular.yaml deleted file mode 100644 index d0011b4..0000000 --- a/blueprints/modular.yaml +++ /dev/null @@ -1,27 +0,0 @@ -title: Modular -@extends: default - -form: - fields: - tabs: - type: tabs - active: 1 - - fields: - content: - fields: - header.modular: - type: select - label: 'Modular page' - default: 0 - options: - 0: 'False' - 1: 'True' - validate: - type: bool - - header.order_manual: - type: text - label: Manual ordering - validate: - type: commalist diff --git a/blueprints/modular/features.yaml b/blueprints/modular/features.yaml deleted file mode 100644 index 5ad7a04..0000000 --- a/blueprints/modular/features.yaml +++ /dev/null @@ -1,7 +0,0 @@ -title: Features -@extends: default - -form: - fields: - tabs: - type: tabs diff --git a/templates/blog.html.twig b/templates/blog.html.twig index 6bc0d2e..b97553d 100644 --- a/templates/blog.html.twig +++ b/templates/blog.html.twig @@ -1,48 +1,46 @@ {% embed 'partials/base.html.twig' %} - {% set collection = page.collection() %} - {% set base_url = page.url %} - {% set feed_url = base_url %} +{% set collection = page.collection() %} +{% set base_url = page.url %} +{% set feed_url = base_url %} - {% if base_url == '/' %} - {% set base_url = '' %} - {% endif %} +{% if base_url == '/' %} +{% set base_url = '' %} +{% endif %} - {% if base_url == base_url_relative %} - {% set feed_url = base_url~'/'~page.slug %} - {% endif %} - - {% block content %} - {% set blog_image = page.media.images|first %} - - {% if blog_image %} -
- {% else %} -
+{% if base_url == base_url_relative %} +{% set feed_url = base_url~'/'~page.slug %} +{% endif %} + +{% block content %} +{% set blog_image = page.media.images|first %} + +{% if blog_image %} +
+ {% else %} +
{% endif %} - {{ page.content }} + {{ page.content }} +
+ + {% if config.plugins.breadcrumbs.enabled %} + {% include 'partials/breadcrumbs.html.twig' %} + {% endif %} + +
+
+ {% for child in collection %} + {% include 'partials/blog_item.html.twig' with {'page':child, 'truncate':true} %} + {% endfor %} + + {% if config.plugins.pagination.enabled and collection.params.pagination %} + {% include 'partials/pagination.html.twig' with {'pagination':collection.params.pagination} %} + {% endif %}
- - {% if config.plugins.breadcrumbs.enabled %} - {% include 'partials/breadcrumbs.html.twig' %} - {% endif %} - -
-
- {% for child in collection %} - {% include 'partials/blog_item.html.twig' with {'page':child, 'truncate':true} %} - {% endfor %} - - {% if config.plugins.pagination.enabled and collection.params.pagination %} - {% include 'pagination.html.twig' with {'pagination':collection.params.pagination} %} - {% endif %} -
- + +
{% endblock %} -{% endembed %} - - + {% endembed %}