(Grav GitSync) Automatic Commit from RealStickman

This commit is contained in:
RealStickman 2023-01-13 11:19:01 +01:00 committed by GitSync
parent ce8943fdd6
commit ac56d471e9
54 changed files with 697 additions and 65 deletions

View File

@ -1,3 +1,10 @@
# v1.10.38
## 01/02/2023
1. [](#new)
* Update copyright dates
* Keep version number in sync with Grav version
# v1.10.37.1 # v1.10.37.1
## 10/08/2022 ## 10/08/2022

View File

@ -1,7 +1,7 @@
name: Admin Panel name: Admin Panel
slug: admin slug: admin
type: plugin type: plugin
version: 1.10.37.1 version: 1.10.38
description: Adds an advanced administration panel to manage your site description: Adds an advanced administration panel to manage your site
icon: empire icon: empire
author: author:

View File

@ -1,5 +1,12 @@
<?php <?php
/**
* @package Grav\Plugin\Admin
*
* @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Plugin\Admin; namespace Grav\Plugin\Admin;
use DateTime; use DateTime;

View File

@ -1,5 +1,12 @@
<?php <?php
/**
* @package Grav\Plugin\Admin
*
* @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Plugin\Admin; namespace Grav\Plugin\Admin;
use Grav\Common\Cache; use Grav\Common\Cache;

View File

@ -1,5 +1,12 @@
<?php <?php
/**
* @package Grav\Plugin\Admin
*
* @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Plugin\Admin; namespace Grav\Plugin\Admin;
use Grav\Common\Backup\Backups; use Grav\Common\Backup\Backups;

View File

@ -3,7 +3,7 @@
/** /**
* @package Grav\Plugin\Admin * @package Grav\Plugin\Admin
* *
* @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details. * @license MIT License; see LICENSE file for details.
*/ */

View File

@ -1,5 +1,12 @@
<?php <?php
/**
* @package Grav\Plugin\Admin
*
* @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
declare(strict_types=1); declare(strict_types=1);
namespace Grav\Plugin\Admin; namespace Grav\Plugin\Admin;

View File

@ -1,5 +1,12 @@
<?php <?php
/**
* @package Grav\Plugin\Admin
*
* @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
declare(strict_types=1); declare(strict_types=1);
namespace Grav\Plugin\Admin\Controllers; namespace Grav\Plugin\Admin\Controllers;

View File

@ -3,7 +3,7 @@
/** /**
* @package Grav\Plugin\Admin * @package Grav\Plugin\Admin
* *
* @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details. * @license MIT License; see LICENSE file for details.
*/ */

View File

@ -3,7 +3,7 @@
/** /**
* @package Grav\Plugin\Admin * @package Grav\Plugin\Admin
* *
* @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details. * @license MIT License; see LICENSE file for details.
*/ */

View File

@ -1,5 +1,12 @@
<?php <?php
/**
* @package Grav\Plugin\Admin
*
* @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Plugin\Admin; namespace Grav\Plugin\Admin;
use Grav\Common\Cache; use Grav\Common\Cache;

View File

@ -1,5 +1,12 @@
<?php <?php
/**
* @package Grav\Plugin\Admin
*
* @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Plugin\Admin; namespace Grav\Plugin\Admin;
use Grav\Common\Config\Config; use Grav\Common\Config\Config;

View File

@ -1,5 +1,12 @@
<?php <?php
/**
* @package Grav\Plugin\Admin
*
* @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Plugin\Admin; namespace Grav\Plugin\Admin;
use Grav\Common\Grav; use Grav\Common\Grav;

View File

@ -3,7 +3,7 @@
/** /**
* @package Grav\Plugin\Admin * @package Grav\Plugin\Admin
* *
* @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details. * @license MIT License; see LICENSE file for details.
*/ */

View File

@ -1,4 +1,12 @@
<?php <?php
/**
* @package Grav\Plugin\Admin
*
* @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Plugin\Admin; namespace Grav\Plugin\Admin;
use ScssPhp\ScssPhp\Compiler; use ScssPhp\ScssPhp\Compiler;

View File

@ -1,5 +1,12 @@
<?php <?php
/**
* @package Grav\Plugin\Admin
*
* @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Plugin\Admin; namespace Grav\Plugin\Admin;
class ScssList class ScssList

View File

@ -1,5 +1,12 @@
<?php <?php
/**
* @package Grav\Plugin\Admin
*
* @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Plugin\Admin; namespace Grav\Plugin\Admin;
/** /**

View File

@ -1,5 +1,12 @@
<?php <?php
/**
* @package Grav\Plugin\Admin
*
* @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Plugin\Admin\Twig; namespace Grav\Plugin\Admin\Twig;
use Grav\Common\Data\Data; use Grav\Common\Data\Data;

View File

@ -1,5 +1,12 @@
<?php <?php
/**
* @package Grav\Plugin\Admin
*
* @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Plugin\Admin; namespace Grav\Plugin\Admin;
use Grav\Common\Grav; use Grav\Common\Grav;

View File

@ -1,6 +1,13 @@
<?php <?php
namespace Grav\Plugin\Admin; namespace Grav\Plugin\Admin;
/**
* @package Grav\Plugin\Admin
*
* @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
use Grav\Common\Filesystem\Folder; use Grav\Common\Filesystem\Folder;
use Grav\Common\Grav; use Grav\Common\Grav;
use Grav\Framework\File\File; use Grav\Framework\File\File;

View File

@ -1,3 +1,21 @@
# v1.6.1
## 01/02/2023
1. [](#improved)
* Improved FlexObjects default blueprint
# v1.6.0
## 12/28/2022
1. [](#new)
* Added new "FlexObjects" basic plugin type [#77](https://github.com/getgrav/grav-plugin-devtools/pull/77)
1. [](#improved)
* Improvements for Tailwind CSS theme + AlpineJS [#74](https://github.com/getgrav/grav-plugin-devtools/pull/74)
* Updated `languages.yaml` [#76](https://github.com/getgrav/grav-plugin-devtools/pull/76)
* Updated links + default branch [#72](https://github.com/getgrav/grav-plugin-devtools/pull/72)
1. [](#bugfix)
* Various PSR Fixes [#71](https://github.com/getgrav/grav-plugin-devtools/pull/71)
# v1.5.4 # v1.5.4
## 10/26/2021 ## 10/26/2021

View File

@ -1,7 +1,7 @@
name: DevTools name: DevTools
slug: devtools slug: devtools
type: plugin type: plugin
version: 1.5.4 version: 1.6.1
description: Plugin and Theme scaffolding utilities description: Plugin and Theme scaffolding utilities
icon: cogs icon: cogs
author: author:

View File

@ -128,7 +128,7 @@ class DevToolsCommand extends ConsoleCommand
if ($template === 'inheritance') { if ($template === 'inheritance') {
$parent_theme = $this->component['extends']; $parent_theme = $this->component['extends'];
$yaml_file = $this->locator->findResource('themes://' . $parent_theme) . '/' . $parent_theme . '.yaml'; $yaml_file = $this->locator->findResource('themes://' . $parent_theme) . '/' . $parent_theme . '.yaml';
$this->component['config'] = file_get_contents($yaml_file);; $this->component['config'] = file_get_contents($yaml_file);
} }
if (isset($source_theme)) { if (isset($source_theme)) {
@ -156,8 +156,8 @@ class DevToolsCommand extends ConsoleCommand
// Do some filename renaming // Do some filename renaming
$base_old_filename = $component_folder . '/' . $current_theme; $base_old_filename = $component_folder . '/' . $current_theme;
$base_new_filename = $component_folder . '/' . $new_theme; $base_new_filename = $component_folder . '/' . $new_theme;
@rename( $base_old_filename . '.php', $base_new_filename . '.php'); @rename($base_old_filename . '.php', $base_new_filename . '.php');
@rename( $base_old_filename . '.yaml', $base_new_filename . '.yaml'); @rename($base_old_filename . '.yaml', $base_new_filename . '.yaml');
$camelized_current = $this->inflector::camelize($current_theme); $camelized_current = $this->inflector::camelize($current_theme);
$camelized_new = $this->inflector::camelize($name); $camelized_new = $this->inflector::camelize($name);
@ -211,7 +211,6 @@ class DevToolsCommand extends ConsoleCommand
} }
echo $source_theme; echo $source_theme;
} else { } else {
/** /**
* Use components folder and twig processing * Use components folder and twig processing
@ -233,7 +232,7 @@ class DevToolsCommand extends ConsoleCommand
$templates = Folder::all($component_folder); $templates = Folder::all($component_folder);
try { try {
foreach($templates as $templateFile) { foreach ($templates as $templateFile) {
if (Utils::endsWith($templateFile, '.twig') && !Utils::endsWith($templateFile, '.html.twig')) { if (Utils::endsWith($templateFile, '.twig') && !Utils::endsWith($templateFile, '.html.twig')) {
$content = $this->twig->processTemplate($templateFile); $content = $this->twig->processTemplate($templateFile);
$file = File::instance($component_folder . DS . str_replace('.twig', '', $templateFile)); $file = File::instance($component_folder . DS . str_replace('.twig', '', $templateFile));
@ -259,6 +258,20 @@ class DevToolsCommand extends ConsoleCommand
$bpname = $this->inflector::hyphenize($this->component['bpname']); $bpname = $this->inflector::hyphenize($this->component['bpname']);
rename($component_folder . DS . $type . '.yaml', $component_folder . DS . $bpname . '.yaml'); rename($component_folder . DS . $type . '.yaml', $component_folder . DS . $bpname . '.yaml');
} }
if ($this->component['flex_name']) {
$flex_classes_folder = $component_folder . DS . 'classes' . DS . 'Flex' . DS . 'Types';
$flex_name = strtolower($this->inflector::underscorize($this->component['flex_name']));
$flex_name_camel = $this->inflector::camelize($this->component['flex_name']);
rename($flex_classes_folder . DS . 'flex_name',$flex_classes_folder . DS . $flex_name_camel);
rename($flex_classes_folder . DS . $flex_name_camel . DS . 'Object' . '.php',$flex_classes_folder . DS . $flex_name_camel . DS . $flex_name_camel . 'Object' . '.php');
rename($flex_classes_folder . DS . $flex_name_camel . DS . 'Collection' . '.php',$flex_classes_folder . DS . $flex_name_camel . DS . $flex_name_camel . 'Collection' . '.php');
rename($component_folder . DS . 'blueprints' . DS . 'flex-objects' . DS . $type . '.yaml', $component_folder . DS . 'blueprints' . DS . 'flex-objects' . DS . $flex_name . '.yaml');
}
} }
$this->output->writeln(''); $this->output->writeln('');
@ -318,13 +331,13 @@ class DevToolsCommand extends ConsoleCommand
break; break;
case 'description': case 'description':
if($value === null || trim($value) === '') { if ($value === null || trim($value) === '') {
throw new \RuntimeException('Description cannot be empty'); throw new \RuntimeException('Description cannot be empty');
} }
break; break;
case 'themename': case 'themename':
if($value === null || trim($value) === '') { if ($value === null || trim($value) === '') {
throw new \RuntimeException('Theme Name cannot be empty'); throw new \RuntimeException('Theme Name cannot be empty');
} }

View File

@ -3,6 +3,7 @@
namespace Grav\Plugin\Console; namespace Grav\Plugin\Console;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Question\Question;
require_once(__DIR__ . '/../classes/DevToolsCommand.php'); require_once(__DIR__ . '/../classes/DevToolsCommand.php');
@ -35,7 +36,7 @@ class NewPluginCommand extends DevToolsCommand
) )
->addOption( ->addOption(
'dev', 'dev',
null, null,
InputOption::VALUE_OPTIONAL, InputOption::VALUE_OPTIONAL,
'The name/username of the developer' 'The name/username of the developer'
) )
@ -136,11 +137,32 @@ class NewPluginCommand extends DevToolsCommand
$this->component['author']['email'] = $io->askQuestion($question); $this->component['author']['email'] = $io->askQuestion($question);
} }
$this->component['template'] = 'blank'; $question = new ChoiceQuestion(
'Please choose an option',
['blank' => 'Basic Plugin',
'flex' => 'Basic Plugin prepared for custom Flex Objects'
]
);
$this->component['template'] = $io->askQuestion($question);
if ($this->component['template'] === 'flex') {
$question = new Question('Enter Flex Object Name');
$question->setValidator(function ($value) {
return $this->validate('name', $value);
});
$this->component['flex_name'] = $io->askQuestion($question);
$question = new ChoiceQuestion('Please choose a storage type', [
'simple' => 'Basic Storage (1 file for all objects) - no media support',
'file' => 'File Storage (1 file per object)',
'folder' => 'Folder Storage (1 folder per object)'
]);
$this->component['flex_storage'] = $io->askQuestion($question);
}
$this->createComponent(); $this->createComponent();
return 0; return 0;
} }
} }

View File

@ -5,7 +5,7 @@
**This README.md file should be modified to describe the features, installation, configuration, and general usage of the plugin.** **This README.md file should be modified to describe the features, installation, configuration, and general usage of the plugin.**
The **{{ component_title }}** Plugin is an extension for [Grav CMS](http://github.com/getgrav/grav). {{ component.description }} The **{{ component_title }}** Plugin is an extension for [Grav CMS](https://github.com/getgrav/grav). {{ component.description }}
## Installation ## Installation
@ -13,7 +13,7 @@ Installing the {{ component_title }} plugin can be done in one of three ways: Th
### GPM Installation (Preferred) ### GPM Installation (Preferred)
To install the plugin via the [GPM](http://learn.getgrav.org/advanced/grav-gpm), through your system's terminal (also called the command line), navigate to the root of your Grav-installation, and enter: To install the plugin via the [GPM](https://learn.getgrav.org/cli-console/grav-cli-gpm), through your system's terminal (also called the command line), navigate to the root of your Grav-installation, and enter:
bin/gpm install {{ component_hyphenated }} bin/gpm install {{ component_hyphenated }}
@ -21,13 +21,13 @@ This will install the {{ component_title }} plugin into your `/user/plugins`-dir
### Manual Installation ### Manual Installation
To install the plugin manually, download the zip-version of this repository and unzip it under `/your/site/grav/user/plugins`. Then rename the folder to `{{ component_hyphenated }}`. You can find these files on [GitHub](https://github.com/{{ developer_hyphenated }}/grav-plugin-{{ component_hyphenated }}) or via [GetGrav.org](http://getgrav.org/downloads/plugins#extras). To install the plugin manually, download the zip-version of this repository and unzip it under `/your/site/grav/user/plugins`. Then rename the folder to `{{ component_hyphenated }}`. You can find these files on [GitHub](https://github.com/{{ developer_hyphenated }}/grav-plugin-{{ component_hyphenated }}) or via [GetGrav.org](https://getgrav.org/downloads/plugins).
You should now have all the plugin files under You should now have all the plugin files under
/your/site/grav/user/plugins/{{ component_hyphenated }} /your/site/grav/user/plugins/{{ component_hyphenated }}
> NOTE: This plugin is a modular component for Grav which may require other plugins to operate, please see its [blueprints.yaml-file on GitHub](https://github.com/{{ developer_hyphenated }}/grav-plugin-{{ component_hyphenated }}/blob/master/blueprints.yaml). > NOTE: This plugin is a modular component for Grav which may require other plugins to operate, please see its [blueprints.yaml-file on GitHub](https://github.com/{{ developer_hyphenated }}/grav-plugin-{{ component_hyphenated }}/blob/main/blueprints.yaml).
### Admin Plugin ### Admin Plugin

View File

@ -0,0 +1,5 @@
# v0.1.0
## {{ "now"|date("m/d/Y") }}
1. [](#new)
* ChangeLog started...

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) {{ "now"|date("Y") }} {{ component.author.name }}
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,59 @@
{% set component_title = (component.name|titleize) %}
{% set component_hyphenated = (component.name|hyphenize) %}
{% set developer_hyphenated = (component.author.githubid|hyphenize) %}
# {{ component_title }} Plugin
**This README.md file should be modified to describe the features, installation, configuration, and general usage of the plugin.**
The **{{ component_title }}** Plugin is an extension for [Grav CMS](https://github.com/getgrav/grav). {{ component.description }}
## Installation
Installing the {{ component_title }} plugin can be done in one of three ways: The GPM (Grav Package Manager) installation method lets you quickly install the plugin with a simple terminal command, the manual method lets you do so via a zip file, and the admin method lets you do so via the Admin Plugin.
### GPM Installation (Preferred)
To install the plugin via the [GPM](https://learn.getgrav.org/cli-console/grav-cli-gpm), through your system's terminal (also called the command line), navigate to the root of your Grav-installation, and enter:
bin/gpm install {{ component_hyphenated }}
This will install the {{ component_title }} plugin into your `/user/plugins`-directory within Grav. Its files can be found under `/your/site/grav/user/plugins/{{ component_hyphenated }}`.
### Manual Installation
To install the plugin manually, download the zip-version of this repository and unzip it under `/your/site/grav/user/plugins`. Then rename the folder to `{{ component_hyphenated }}`. You can find these files on [GitHub](https://github.com/{{ developer_hyphenated }}/grav-plugin-{{ component_hyphenated }}) or via [GetGrav.org](https://getgrav.org/downloads/plugins).
You should now have all the plugin files under
/your/site/grav/user/plugins/{{ component_hyphenated }}
> NOTE: This plugin is a modular component for Grav which may require other plugins to operate, please see its [blueprints.yaml-file on GitHub](https://github.com/{{ developer_hyphenated }}/grav-plugin-{{ component_hyphenated }}/blob/main/blueprints.yaml).
### Admin Plugin
If you use the Admin Plugin, you can install the plugin directly by browsing the `Plugins`-menu and clicking on the `Add` button.
## Configuration
Before configuring this plugin, you should copy the `user/plugins/{{ component_hyphenated }}/{{ component_hyphenated }}.yaml` to `user/config/plugins/{{ component_hyphenated }}.yaml` and only edit that copy.
Here is the default configuration and an explanation of available options:
```yaml
enabled: true
```
Note that if you use the Admin Plugin, a file with your configuration named {{component_hyphenated}}.yaml will be saved in the `user/config/plugins/`-folder once the configuration is saved in the Admin.
## Usage
**Describe how to use the plugin.**
## Credits
**Did you incorporate third-party code? Want to thank somebody?**
## To Do
- [ ] Future plans, if any

View File

@ -0,0 +1,37 @@
{% set githubid = component.author.githubid ?: component.author.name|hyphenize -%}
name: {{ component.name|titleize }}
slug: {{ component.name|hyphenize }}
type: plugin
version: 0.1.0
description: {{ component.description }}
icon: plug
author:
name: {{ component.author.name }}
email: {{ component.author.email }}
homepage: https://github.com/{{ githubid }}/grav-plugin-{{ component.name|hyphenize }}
demo: http://demo.yoursite.com
keywords: grav, plugin, etc
bugs: https://github.com/{{ githubid }}/grav-plugin-{{ component.name|hyphenize }}/issues
docs: https://github.com/{{ githubid }}/grav-plugin-{{ component.name|hyphenize }}/blob/develop/README.md
license: MIT
dependencies:
- { name: grav, version: '>=1.6.0' }
form:
validation: loose
fields:
enabled:
type: toggle
label: PLUGIN_ADMIN.PLUGIN_STATUS
highlight: 1
default: 0
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
text_var:
type: text
label: PLUGIN_{{ component.name|underscorize|upper }}.TEXT_VARIABLE
help: PLUGIN_{{ component.name|underscorize|upper }}.TEXT_VARIABLE_HELP

View File

@ -0,0 +1,132 @@
title: '{{ component.flex_name|capitalize }}'
description: '{{ component.flex_name|capitalize }}'
type: flex-objects
# Flex Configuration
config:
# Administration Configuration
admin:
# Admin router (optional)
router:
path: '/{{ component.flex_name|lower|underscorize }}'
# Admin menu (optional)
menu:
list:
route: '/{{ component.flex_name|lower|underscorize }}'
title: '{{ component.flex_name|capitalize }}'
icon: fa-address-card-o
# Authorization to collection admin
authorize: ['admin.{{ component.flex_name|lower|underscorize }}.list', 'admin.super']
# Priority -10 .. 10 (highest goes up)
priority: 2
# Admin template type / folder
template: default
# Permissions
permissions:
# Primary permissions
admin.{{ component.flex_name|lower|underscorize }}:
type: crudpl
label: '{{ component.flex_name|capitalize }}'
# List view
list:
title: name
fields:
published:
field:
type: toggle
label: Published
width: 8
name:
link: edit
description:
# Edit View
edit:
title:
template: '{{ object.title }}'
# Preview View
preview:
enabled: false
route:
#template: '/plugins/flex-objects/directory:contacts'
# Data Export
export:
enabled: true
method: 'jsonSerialize'
formatter:
class: 'Grav\Framework\File\Formatter\YamlFormatter'
filename: '{{ component.flex_name|lower|underscorize }}'
# Site Configuration
site:
templates:
collection:
# Lookup for the template layout files for collections of objects
paths:
- 'flex/{TYPE}/collection/{LAYOUT}{EXT}'
object:
# Lookup for the template layout files for objects
paths:
- 'flex/{TYPE}/object/{LAYOUT}{EXT}'
defaults:
# Default template {TYPE}; overridden by filename of this blueprint if template folder exists
type: '{{ component.flex_name|lower|underscorize }}'
# Default template {LAYOUT}; can be overridden in render calls (usually Twig in templates)
layout: default
# Data Configuration
data:
# Object class to be used, allowing custom methods for the object
object: 'Grav\Plugin\{{ component.name|camelize }}\Flex\Types\{{ component.flex_name|camelize }}\{{ component.flex_name|camelize }}Object'
# Collection class to be used, allowing custom methods for the collections
collection: 'Grav\Plugin\{{ component.name|camelize }}\Flex\Types\{{ component.flex_name|camelize }}\{{ component.flex_name|camelize }}Collection'
# Index class to be used, works as a quick database-like lookup index
index: 'Grav\Common\Flex\Types\Generic\GenericIndex'
storage:
# Storage class, use single file storage (does not support images and assets)
class: 'Grav\Framework\Flex\Storage\{{ component.flex_storage|capitalize }}Storage'
options:
formatter:
# File formatter class, in this case the file is stored in markdown
class: 'Grav\Framework\File\Formatter\JsonFormatter'
# JSON file where all the objects will be stored
folder: user-data://{{ component.flex_name|underscorize }}
search:
# Search options
options:
contains: 1
# Fields to be searched
fields:
- name
- description
form:
validation: loose
fields:
published:
type: toggle
label: Published
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
validate:
type: bool
required: true
name:
type: text
label: Name
validate:
required: true
description:
type: text
label: Description
validate:
required: true

View File

@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
/**
* @package Grav\Common\Flex
*
* @copyright Copyright (c) 2015 - 2021 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Plugin\{{ component.name|camelize }}\Flex\Types\{{ component.flex_name|camelize }};
use Grav\Common\Flex\Types\Generic\GenericCollection;
/**
* Class {{ component.flex_name|camelize }}Collection
* @package Grav\Common\Flex\Generic
*
* @extends FlexCollection<string,GenericObject>
*/
class {{ component.flex_name|camelize }}Collection extends GenericCollection
{
}

View File

@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
/**
* @package Grav\Common\Flex
*
* @copyright Copyright (c) 2015 - 2021 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Plugin\{{ component.name|camelize }}\Flex\Types\{{ component.flex_name|camelize }};
use Grav\Common\Flex\Types\Generic\GenericObject;
/**
* Class {{ component.flex_name|camelize }}Object
* @package Grav\Common\Flex\Generic
*
* @extends FlexObject<string,GenericObject>
*/
class {{ component.flex_name|camelize }}Object extends GenericObject
{
}

View File

@ -0,0 +1,30 @@
{% set githubid = component.author.githubid ?: component.author.name|hyphenize -%}
{
"name": "{{ githubid|lower }}/{{ component.name|hyphenize }}",
"type": "grav-plugin",
"description": "{{ component.description }}",
"keywords": ["plugin"],
"homepage": "https://github.com/{{ githubid }}/grav-plugin-{{ component.name|hyphenize }}",
"license": "MIT",
"authors": [
{
"name": "{{ component.author.name }}",
"email": "{{ component.author.email }}",
"role": "Developer"
}
],
"require": {
"php": ">=7.1.3"
},
"autoload": {
"psr-4": {
"Grav\\Plugin\\{{ component.name|camelize }}\\": "classes/"
},
"classmap": ["{{ component.name|hyphenize }}.php"]
},
"config": {
"platform": {
"php": "7.1.3"
}
}
}

View File

@ -0,0 +1,4 @@
en:
PLUGIN_{{ component.name|underscorize|upper }}:
TEXT_VARIABLE: Text Variable
TEXT_VARIABLE_HELP: Text to add to the top of a page

View File

@ -0,0 +1,76 @@
<?php
namespace Grav\Plugin;
use Composer\Autoload\ClassLoader;
use Grav\Common\Plugin;
use Grav\Events\FlexRegisterEvent;
/**
* Class {{ component.name|camelize }}Plugin
* @package Grav\Plugin
*/
class {{ component.name|camelize }}Plugin extends Plugin
{
public $features = [
'blueprints' => 0,
];
/**
* @return array
*
* The getSubscribedEvents() gives the core a list of events
* that the plugin wants to listen to. The key of each
* array section is the event that the plugin listens to
* and the value (in the form of an array) contains the
* callable (or function) as well as the priority. The
* higher the number the higher the priority.
*/
public static function getSubscribedEvents(): array
{
return [
'onPluginsInitialized' => [
// Uncomment following line when plugin requires Grav < 1.7
// ['autoload', 100000],
['onPluginsInitialized', 0]
],
FlexRegisterEvent::class => [['onRegisterFlex', 0]],
];
}
/**
* Composer autoload
*
* @return ClassLoader
*/
public function autoload(): ClassLoader
{
return require __DIR__ . '/vendor/autoload.php';
}
/**
* Initialize the plugin
*/
public function onPluginsInitialized(): void
{
// Don't proceed if we are in the admin plugin
if ($this->isAdmin()) {
return;
}
// Enable the main events we are interested in
$this->enable([
// Put your main events here
]);
}
public function onRegisterFlex($event): void
{
$flex = $event->flex;
$flex->addDirectoryType(
'{{ component.flex_name|lower|underscorize }}',
'blueprints://flex-objects/{{ component.flex_name|lower|underscorize }}.yaml'
);
}
}

View File

@ -0,0 +1,2 @@
enabled: true
text_var: Custom Text added by the **{{ component.name|titleize }}** plugin (disable plugin to remove)

View File

@ -0,0 +1,5 @@
import Alpine from 'alpinejs'
window.Alpine = Alpine
Alpine.start()

View File

@ -6,25 +6,20 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"build": "postcss css/site.css -o dist/css/site.css --verbose", "build": "npx mix",
"watch": "postcss css/site.css -o dist/css/site.css --watch --verbose", "watch": "npx mix watch",
"prod" : "postcss css/site.css -o dist/css/site.min.css --env production --verbose" "prod": "npx mix -p"
}, },
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"@tailwindcss/forms": "^0.5.0",
"@tailwindcss/typography": "^0.5.2",
"alpinejs": "^2.8.2", "alpinejs": "^2.8.2",
"tailwindcss": "^2.1.2", "browser-sync": "^2.27.7",
"@tailwindcss/forms": "^0.3.2", "browser-sync-webpack-plugin": "^2.3.0",
"@tailwindcss/typography": "^0.4.0", "laravel-mix": "^6.0.43",
"tailwindcss-debug-screens": "^2.0.0", "mix-tailwindcss": "^1.3.0",
"autoprefixer": "^10.2.5", "tailwindcss": "^3.0.18",
"precss": "^4.0.0", "tailwindcss-debug-screens": "^2.2.1"
"cssnano": "^4.1.11",
"postcss": "^8.2.9",
"postcss-cli": "^8.3.1",
"postcss-import": "^14.0.1",
"postcss-nested": "^5.0.5",
"postcss-hexrgba": "^2.0.1",
"postcss-color-function": "^4.1.0"
} }
} }

View File

@ -1,11 +0,0 @@
module.exports = {
plugins: {
'postcss-import': {},
'precss': {},
'tailwindcss': {},
'postcss-nested': {},
'autoprefixer': {},
...process.env.NODE_ENV === 'production'
? {'cssnano': {}} : {}
},
}

View File

@ -1,7 +1,7 @@
const { colors } = require('tailwindcss/defaultTheme'); const colors = require('tailwindcss/colors');
module.exports = { module.exports = {
purge: [ content: [
'../../config/**/*.yaml', '../../config/**/*.yaml',
'../../pages/**/*.md', '../../pages/**/*.md',
'./blueprints/**/*.yaml', './blueprints/**/*.yaml',
@ -62,9 +62,9 @@ module.exports = {
extend: {}, extend: {},
}, },
plugins: [ plugins: [
require('@tailwindcss/typography'),
require('@tailwindcss/forms'), require('@tailwindcss/forms'),
require('tailwindcss-debug-screens'), require('@tailwindcss/typography'),
require('tailwindcss-debug-screens')
], ],
important: false, important: false,
} }

View File

@ -15,10 +15,11 @@
{% endblock head %} {% endblock head %}
{% block stylesheets %} {% block stylesheets %}
{% do assets.addCss('theme://dist/css/app' ~ extension ~ '.css', 98) %} {% do assets.addCss('theme://dist/css/site' ~ extension ~ '.css', 98) %}
{% endblock %} {% endblock %}
{% block javascripts %} {% block javascripts %}
{% do assets.addJs('theme://dist/js/main' ~ extension ~ '.js', 98) %}
{% endblock %} {% endblock %}
{% block assets deferred %} {% block assets deferred %}

View File

@ -0,0 +1,17 @@
let mix = require('laravel-mix');
require('mix-tailwindcss');
const extension = mix.inProduction() ? '.min' : '';
mix.js('js/main.js', `js/main${extension}.js`)
.css('css/site.css', `css/site${extension}.css`)
.tailwind()
.setPublicPath('dist')
.version()
// .browserSync({
// proxy: 'http://domain.test',
// files: [
// './dist/mix-manifest.json',
// '../../pages/**/*.md'
// ]
// })

View File

@ -1,3 +1,7 @@
en: en:
PLUGIN_DEVTOOLS: PLUGIN_DEVTOOLS:
COLLISION_CHECK: Online Name Collision Check COLLISION_CHECK: Online Name Collision Check
fr:
PLUGIN_DEVTOOLS:
COLLISION_CHECK: Vérification en ligne de collision de noms

View File

@ -1,3 +1,10 @@
# v1.3.3
## 01/04/2023
1. [](#improved)
* Save `post-save` action to session
* Set default `post-save` action to `edit` for create and edit
# v1.3.2 # v1.3.2
## 12/02/2022 ## 12/02/2022

View File

@ -3,7 +3,7 @@
{% set originalValue = value %} {% set originalValue = value %}
{% set value = (value is null ? field.default : value) %} {% set value = (value is null ? field.default : value) %}
{% set isNew = key ? false : true %} {% set isNew = key ? false : true %}
{% set savedOption = grav.session.post_entries_save|default('create-new') %} {% set savedOption = grav.session.post_entries_save|default('edit') %}
{% if isNew %} {% if isNew %}
{% set options = {'create-new':'PLUGIN_FLEX_OBJECTS.ACTION.CREATE_NEW', 'edit':'PLUGIN_FLEX_OBJECTS.ACTION.EDIT_ITEM', 'list':'PLUGIN_FLEX_OBJECTS.ACTION.LIST_ITEMS'} %} {% set options = {'create-new':'PLUGIN_FLEX_OBJECTS.ACTION.CREATE_NEW', 'edit':'PLUGIN_FLEX_OBJECTS.ACTION.EDIT_ITEM', 'list':'PLUGIN_FLEX_OBJECTS.ACTION.LIST_ITEMS'} %}
@ -12,7 +12,6 @@
{% endif %} {% endif %}
{% block input %} {% block input %}
{% set savedOption = not isNew and savedOption == 'create-new' ? 'edit' : savedOption %}
{% for key, text in options %} {% for key, text in options %}
{% set id = field.id|default(field.name) ~ '-' ~ key %} {% set id = field.id|default(field.name) ~ '-' ~ key %}

View File

@ -1,7 +1,7 @@
name: Flex Objects name: Flex Objects
slug: flex-objects slug: flex-objects
type: plugin type: plugin
version: 1.3.2 version: 1.3.3
description: Flex Objects plugin allows you to manage Flex Objects in Grav Admin. description: Flex Objects plugin allows you to manage Flex Objects in Grav Admin.
icon: list-alt icon: list-alt
author: author:

View File

@ -907,6 +907,7 @@ class AdminController
// Set route to point to the current page. // Set route to point to the current page.
if (!$this->redirect) { if (!$this->redirect) {
$postAction = $request->getParsedBody()['_post_entries_save'] ?? 'edit'; $postAction = $request->getParsedBody()['_post_entries_save'] ?? 'edit';
$this->grav['session']->post_entries_save = $postAction;
if ($postAction === 'create-new') { if ($postAction === 'create-new') {
// Create another. // Create another.
$route = $this->referrerRoute->withGravParam('action', null)->withGravParam('', 'add'); $route = $this->referrerRoute->withGravParam('action', null)->withGravParam('', 'add');

View File

@ -1,3 +1,9 @@
# v7.1.2
## 01/08/2023
1. [](#bugfix)
* Fixes issue with multiplication type BasicCaptcha Math Captcha [#587](https://github.com/getgrav/grav-plugin-form/issues/587)
# v7.1.1 # v7.1.1
## 11/29/2022 ## 11/29/2022

View File

@ -1,7 +1,7 @@
name: Form name: Form
slug: form slug: form
type: plugin type: plugin
version: 7.1.1 version: 7.1.2
description: Enables forms handling and processing description: Enables forms handling and processing
icon: check-square icon: check-square
author: author:

View File

@ -32,20 +32,20 @@ class BasicCaptcha
// calculator // calculator
if ($operator === '-') { if ($operator === '-') {
if ($first_num < $second_num) { if ($first_num < $second_num) {
$result = "$second_num-$first_num"; $result = "$second_num - $first_num";
$captcha_code = $second_num-$first_num; $captcha_code = $second_num - $first_num;
} else { } else {
$result = "$first_num-$second_num"; $result = "$first_num-$second_num";
$captcha_code = $first_num - $second_num; $captcha_code = $first_num - $second_num;
} }
} elseif ($operator === '*') { } elseif ($operator === '*') {
$result = "{$first_num}x{$second_num}"; $result = "{$first_num} x {$second_num}";
$captcha_code = $first_num - $second_num; $captcha_code = $first_num * $second_num;
} elseif ($operator === '/') { } elseif ($operator === '/') {
$result = "$first_num/ second_num"; $result = "$first_num / second_num";
$captcha_code = $first_num / $second_num; $captcha_code = $first_num / $second_num;
} elseif ($operator === '+') { } elseif ($operator === '+') {
$result = "$first_num+$second_num"; $result = "$first_num + $second_num";
$captcha_code = $first_num + $second_num; $captcha_code = $first_num + $second_num;
} }
} else { } else {

View File

@ -1,3 +1,10 @@
# v3.7.2
## 01/02/2023
1. [](#new)
* Added new `onBeforeSessionStart()` event to store redirect + messages when session is regenerated during login
* Requires Grav `1.7.38` for new event availability
# v3.7.1 # v3.7.1
## 06/14/2022 ## 06/14/2022

View File

@ -1,7 +1,7 @@
name: Login name: Login
slug: login slug: login
type: plugin type: plugin
version: 3.7.1 version: 3.7.2
testing: false testing: false
description: Enables user authentication and login screen. description: Enables user authentication and login screen.
icon: sign-in icon: sign-in
@ -15,7 +15,7 @@ bugs: https://github.com/getgrav/grav-plugin-login/issues
license: MIT license: MIT
dependencies: dependencies:
- { name: grav, version: '>=1.7.32' } - { name: grav, version: '>=1.7.38' }
- { name: form, version: '>=6.0.0' } - { name: form, version: '>=6.0.0' }
- { name: email, version: '>=3.1.6' } - { name: email, version: '>=3.1.6' }

View File

@ -23,6 +23,7 @@ use Grav\Common\User\Interfaces\UserCollectionInterface;
use Grav\Common\User\Interfaces\UserInterface; use Grav\Common\User\Interfaces\UserInterface;
use Grav\Common\Utils; use Grav\Common\Utils;
use Grav\Common\Uri; use Grav\Common\Uri;
use Grav\Events\BeforeSessionStartEvent;
use Grav\Events\PluginsLoadedEvent; use Grav\Events\PluginsLoadedEvent;
use Grav\Events\SessionStartEvent; use Grav\Events\SessionStartEvent;
use Grav\Framework\Flex\Interfaces\FlexCollectionInterface; use Grav\Framework\Flex\Interfaces\FlexCollectionInterface;
@ -62,6 +63,9 @@ class LoginPlugin extends Plugin
/** @var Invitation|null */ /** @var Invitation|null */
protected $invitation; protected $invitation;
protected $temp_redirect;
protected $temp_messages;
/** /**
* @return array * @return array
*/ */
@ -70,6 +74,7 @@ class LoginPlugin extends Plugin
return [ return [
PluginsLoadedEvent::class => [['onPluginsLoaded', 10]], PluginsLoadedEvent::class => [['onPluginsLoaded', 10]],
SessionStartEvent::class => ['onSessionStart', 0], SessionStartEvent::class => ['onSessionStart', 0],
BeforeSessionStartEvent::class => ['onBeforeSessionStart', 0],
PageAuthorizeEvent::class => ['onPageAuthorizeEvent', -10000], PageAuthorizeEvent::class => ['onPageAuthorizeEvent', -10000],
'onPluginsInitialized' => [['initializeSession', 10000], ['initializeLogin', 1000]], 'onPluginsInitialized' => [['initializeSession', 10000], ['initializeLogin', 1000]],
'onTask.login.login' => ['loginController', 0], 'onTask.login.login' => ['loginController', 0],
@ -124,6 +129,18 @@ class LoginPlugin extends Plugin
}; };
} }
/**
* @param BeforeSessionStartEvent $event
* @return void
*/
public function onBeforeSessionStart(BeforeSessionStartEvent $event): void
{
$session = $event->session;
$this->temp_redirect = $session->redirect_after_login ?? null;
$this->temp_messages = $session->messages;
}
/** /**
* @param SessionStartEvent $event * @param SessionStartEvent $event
* @return void * @return void
@ -132,6 +149,15 @@ class LoginPlugin extends Plugin
{ {
$session = $event->session; $session = $event->session;
if (isset($this->temp_redirect)) {
$session->redirect_after_login = $this->temp_redirect;
unset($this->temp_redirect);
}
if (isset($this->temp_messages)) {
$session->messages = $this->temp_messages;
unset($this->temp_messages);
}
$user = $session->user ?? null; $user = $session->user ?? null;
if ($user && $user->exists() && ($this->config()['session_user_sync'] ?? false)) { if ($user && $user->exists() && ($this->config()['session_user_sync'] ?? false)) {
// User is stored into the filesystem. // User is stored into the filesystem.