From 641453858c4248a8bb88fce051b0ebb72237f815 Mon Sep 17 00:00:00 2001 From: Daniel Hladek Date: Fri, 2 Oct 2020 19:14:55 +0200 Subject: [PATCH] gitsyncrepolink --- themes/mytheme/blueprints.yaml | 76 +++++++++ themes/mytheme/templates/README.html.twig | 23 +-- .../partials/git_sync_repo_link.html.twig | 147 ++++++++++++++++++ .../git_sync_repo_link_note.html.twig | 7 + 4 files changed, 244 insertions(+), 9 deletions(-) create mode 100644 themes/mytheme/templates/partials/git_sync_repo_link.html.twig create mode 100644 themes/mytheme/templates/partials/git_sync_repo_link_note.html.twig diff --git a/themes/mytheme/blueprints.yaml b/themes/mytheme/blueprints.yaml index 8d5400cd..16912645 100644 --- a/themes/mytheme/blueprints.yaml +++ b/themes/mytheme/blueprints.yaml @@ -16,3 +16,79 @@ license: MIT dependencies: - { name: grav, version: '>=1.6.0' } + - git-sync +form: + validation: loose + fields: + tabs: + type: tabs + active: 1 + fields: + gitsynclink_options: + type: tab + title: 'Git Sync Link' + fields: + gitsyncsetup: + type: section + title: Setup + underline: true + display_of_git_sync_repo_link: + type: select + size: medium + classes: fancy + label: 'Location of Git Sync Link' + default: menu + options: + menu: Menu + page: 'Page (visible when ''Chromeless'')' + footer: Footer + none: None + type_of_git_sync_repo_link: + type: select + size: medium + label: 'Type of Git Sync Link' + default: view + options: + view: 'View Git Repository' + edit: 'View/Edit Page in Git Repository' + gitsyncoptions: + type: section + title: Appearance + underline: true + custom_git_sync_repo_link_icon: + type: input.text + size: small + label: 'Custom Font Awesome Icon' + description: 'Short name, e.g. ''code-fork''.' + validate: + type: text + custom_git_sync_repo_link_text: + type: input.text + size: long + label: 'Custom Link Text' + description: 'Link text, e.g. ''View Page in GitHub'' or ''View Page as Markdown''.' + validate: + type: text + git_sync_edit_note_text: + type: input.text + size: medium + label: 'Text before Page Link' + description: 'The text before Git Sync Link located on a Page, e.g. ''Have a suggestion or correction?'' or ''Want to reuse this open content?''.' + custom_git_sync_repo_presentation_link_text: + type: input.text + size: long + label: 'Custom Presentation Link Text' + description: 'Link text for embedded Presentations, e.g. ''View Slides in GitHub'' or ''View Slides as Markdown''.' + validate: + type: text + gitsyncadvanced: + type: section + title: Advanced + underline: true + git_sync_repo_link: + type: input.url + label: 'Custom Git Repository Tree URL' + help: 'Enter the URL that leads to the pages folder of your Git Repository.' + description: 'URL path to pages folder for ''View/Edit Page in Git Repository'' option, but with ''/pages'' and everything following it removed. For example, ''https://github.com/paulhibbitts/demo-grav-course-hub/tree/master''.' + validate: + type: URL diff --git a/themes/mytheme/templates/README.html.twig b/themes/mytheme/templates/README.html.twig index 61491b28..f626d6b5 100644 --- a/themes/mytheme/templates/README.html.twig +++ b/themes/mytheme/templates/README.html.twig @@ -42,7 +42,21 @@ {% endif %} {% endif %} + + {% if page.taxonomy.tag|length > 0 %} + {% set taglist = [] %} + {% for tag in page.taxonomy.tag %} + {% set taglist = taglist|merge([''~tag~'']) %} + {% endfor %} +
+ {{ taglist|join(', ') }} +
+ {% endif %} + {% if theme_var('display_of_git_sync_repo_link') == 'page' and not (grav.uri.param('summaryonly') or grav.uri.param('onlysummary')) %} +

{% include 'partials/git_sync_repo_link_note.html.twig' %}

+ {% endif %} +
{{ page.content }} {% if not page.header.hide_mediasummary %} @@ -54,15 +68,6 @@
- {% if page.taxonomy.tag|length > 0 %} - {% set taglist = [] %} - {% for tag in page.taxonomy.tag %} - {% set taglist = taglist|merge([''~tag~'']) %} - {% endfor %} -
- {{ taglist|join(', ') }} -
- {% endif %} {% if config.plugins.relatedpages.enabled and related_pages|length > 0 %}