Move plugins to manifest, pin Docker version, add Makefile
- Add plugins.txt listing all plugins for reproducible installs - Add Makefile with setup/start/stop/install-plugins targets - Remove user/plugins/ from git tracking - Pin Docker image to 1.7.49.5-ls244 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
# v1.0.4
|
||||
## 2/15/2018
|
||||
|
||||
1. [](#new)
|
||||
* Update styles for Grav Admin v1.7.
|
||||
|
||||
# v1.0.3
|
||||
## 2/15/2018
|
||||
|
||||
1. [](#new)
|
||||
* Add column margin to media actions.
|
||||
* Add border-radius to media actions.
|
||||
|
||||
# v1.0.2
|
||||
## 2/14/2018
|
||||
|
||||
1. [](#new)
|
||||
* Update bugs URL.
|
||||
* Update addAction signature
|
||||
|
||||
# v1.0.1
|
||||
## 2/7/2018
|
||||
|
||||
1. [](#new)
|
||||
* Show alert dialog for sample actions.
|
||||
* Update sample action log message.
|
||||
|
||||
# v1.0.0
|
||||
## 1/24/2018
|
||||
|
||||
1. [](#Initial)
|
||||
*
|
||||
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 TwelveTone LLC
|
||||
|
||||
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.
|
||||
@@ -1,34 +0,0 @@
|
||||
# Admin Media Actions Plugin
|
||||
|
||||
The **Admin Media Actions** Plugin is for [Grav CMS](http://github.com/getgrav/grav). A plugin which adds an API for adding actions items to media items in the media bin.
|
||||
|
||||
## Installation
|
||||
|
||||
Installing the Admin Media Actions plugin can be done in one of two ways. The GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method enables you to do so via a zip file.
|
||||
|
||||
### GPM Installation (Preferred)
|
||||
|
||||
The simplest way to install this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm) through your system's terminal (also called the command line). From the root of your Grav install type:
|
||||
|
||||
bin/gpm install admin-media-actions
|
||||
|
||||
This will install the Admin Media Actions plugin into your `/user/plugins` directory within Grav. Its files can be found under `/your/site/grav/user/plugins/admin-media-actions`.
|
||||
|
||||
### Manual Installation
|
||||
|
||||
To install this plugin, just download the zip version of this repository and unzip it under `/your/site/grav/user/plugins`. Then, rename the folder to `admin-media-actions`. You can find these files on [GitHub](https://github.com) or via [GetGrav.org](http://getgrav.org/downloads/plugins#extras).
|
||||
|
||||
You should now have all the plugin files under
|
||||
|
||||
/your/site/grav/user/plugins/admin-media-actions
|
||||
|
||||
> NOTE: This plugin is a modular component for Grav which requires [Grav](http://github.com/getgrav/grav) and the [Admin](https://github.com/getgrav/grav-plugin-admin) plugin to operate.
|
||||
|
||||
## Usage
|
||||
|
||||
See online [documentation](https://www.twelvetone.tv/docs/developer-tools/grav-plugins/grav-admin-media-actions-plugin)
|
||||
|
||||
## Credits
|
||||
|
||||
A big thanks to David Szabo and his development on the grav-plugin-admin-addon-media-rename for some clever approaches
|
||||
on tapping into the Grav architecture.
|
||||
@@ -1,227 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 TwelveTone LLC
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Grav\Plugin;
|
||||
|
||||
use Grav\Common\Plugin;
|
||||
|
||||
/**
|
||||
* Class AdminMediaActionsPlugin
|
||||
* @package Grav\Plugin
|
||||
*/
|
||||
class AdminMediaActionsPlugin extends Plugin
|
||||
{
|
||||
|
||||
const ROUTE = '/admin-media-actions';
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return [
|
||||
'onPluginsInitialized' => ['onPluginsInitialized', 0]
|
||||
];
|
||||
}
|
||||
|
||||
public function getPath()
|
||||
{
|
||||
return '/' . trim($this->grav['admin']->base, '/') . '/' . trim(self::ROUTE, '/');
|
||||
}
|
||||
|
||||
public function buildBaseUrl()
|
||||
{
|
||||
$ret = rtrim($this->grav['uri']->rootUrl(false), '/') . '/' . trim($this->getPath(), '/');
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function onPluginsInitialized()
|
||||
{
|
||||
if (!$this->isAdmin() || !$this->grav['user']->authenticated) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Register the media actions service
|
||||
$this->grav['media-actions'] = function ($c) {
|
||||
return new MediaActionsController();
|
||||
};
|
||||
|
||||
// Ignore requests to the plugin URL
|
||||
if ($this->grav['uri']->path() == $this->getPath()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->config->get('plugins.admin-media-actions.show_samples')) {
|
||||
// Sample Actions
|
||||
$this->grav['media-actions']->addAction("SampleAction1", "Sample Action 1", "play-circle", function ($page, $mediaName, $payload) {
|
||||
return [
|
||||
"path" => $page->path(),
|
||||
"route" => $page->route(),
|
||||
"mediaName" => $mediaName,
|
||||
];
|
||||
});
|
||||
$this->grav['media-actions']->addAction("SampleAction2", "Sample Action 2", "play-circle", function ($page, $mediaName, $payload) {
|
||||
return [
|
||||
"path" => $page->path(),
|
||||
"route" => $page->route(),
|
||||
"mediaName" => $mediaName,
|
||||
];
|
||||
});
|
||||
$this->grav['media-actions']->addAction("SampleAction3", "Sample Action 3", "play-circle", function ($page, $mediaName, $payload) {
|
||||
return [
|
||||
"path" => $page->path(),
|
||||
"route" => $page->route(),
|
||||
"mediaName" => $mediaName,
|
||||
];
|
||||
});
|
||||
|
||||
$this->grav['media-actions']->addAction("SampleForm", "Sample Form", "list", function ($page, $mediaName, $payload) {
|
||||
return "ok";
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$this->enable([
|
||||
'onAdminTwigTemplatePaths' => ['onAdminTwigTemplatePaths', 0],
|
||||
'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0],
|
||||
'onPagesInitialized' => ['onTwigExtensions', 0],
|
||||
'onAdminTaskExecute' => ['onAdminTaskExecute', 0],
|
||||
]);
|
||||
}
|
||||
|
||||
public function onAdminTaskExecute($e)
|
||||
{
|
||||
$method = $e['method'];
|
||||
switch ($method) {
|
||||
case "taskMedia-action":
|
||||
|
||||
$page = $this->grav['admin']->page(false);
|
||||
//$route = $page->route();
|
||||
|
||||
$actionId = $_POST['action_id'];
|
||||
$media_name = $_POST['media_name'];
|
||||
$payload = json_decode($_POST['payload'], true);
|
||||
|
||||
$handler = $this->grav['media-actions']->getHandlerForAction($actionId);
|
||||
if ($handler) {
|
||||
$json = $handler($page, $media_name, $payload);
|
||||
die("{\"result\":" . json_encode($json) . "}");
|
||||
} else {
|
||||
die("{\"result\":{\"error\":true}}");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function onAdminTwigTemplatePaths()
|
||||
{
|
||||
// $event['paths'] = __DIR__ . '/themes/grav/templates';
|
||||
}
|
||||
|
||||
public function onTwigTemplatePaths()
|
||||
{
|
||||
$this->grav['twig']->twig_paths[] = __DIR__ . '/templates';
|
||||
}
|
||||
|
||||
public function onTwigExtensions()
|
||||
{
|
||||
$page = $this->grav['admin']->page(true);
|
||||
if (!$page) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->config->get('plugins.admin-media-actions.show_samples')) {
|
||||
$this->grav['assets']->addJs('plugin://admin-media-actions/assets/samples/sample_actions.js', -1000, false);
|
||||
$this->grav['assets']->addJs('plugin://admin-media-actions/assets/samples/sample_form_action.js', -1000, false);
|
||||
}
|
||||
|
||||
$oCopy = [];
|
||||
foreach ($this->grav['media-actions']->actions as $action) {
|
||||
$oCopy[] = [
|
||||
'actionId' => $action['actionId'],
|
||||
'icon' => $action['icon'],
|
||||
'caption' => $action['caption'],
|
||||
];
|
||||
}
|
||||
$this->grav['assets']->addInlineJs('const MEDIA_ACTIONS = ' . json_encode($oCopy) . ';', -1000, false);
|
||||
|
||||
$taskUrl = $this->buildBaseUrl() . $page->route() . '/task:media-action';
|
||||
$this->grav['assets']->addInlineJs('const MEDIA_ACTION_TASK_URL = ' . json_encode($taskUrl) . ';', -1000, false);
|
||||
|
||||
$this->grav['assets']->addJs('plugin://admin-media-actions/assets/admin-media-actions.js', -1000, false);
|
||||
$this->grav['assets']->addCss('plugin://admin-media-actions/assets/admin-media-actions.css', -1000, false);
|
||||
}
|
||||
|
||||
public function outputError($msg)
|
||||
{
|
||||
header('HTTP/1.1 400 Bad Request');
|
||||
die(json_encode(['error' => ['msg' => $msg]]));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class MediaActionsController
|
||||
{
|
||||
public $actions = [];
|
||||
|
||||
/**
|
||||
* @param $actionId A unique id for the action. Must be a valid Javascript function name.
|
||||
* This can also be an array containing keys of the same parameter names.
|
||||
*
|
||||
* @param $caption The caption for the action. Used for the tooltip.
|
||||
* @param $icon The font-awesome icon name. The 'fa-' prefix is optional.
|
||||
* @param $handler A handler for the action. (page, mediaName, payload) => object.
|
||||
*/
|
||||
function addAction($actionId, $caption = null, $icon = null, $handler = null)
|
||||
{
|
||||
if (is_array($actionId)) {
|
||||
if (isset($actionId['caption'])) {
|
||||
$caption = $actionId['caption'];
|
||||
}
|
||||
if (isset($actionId['icon'])) {
|
||||
$icon = $actionId['icon'];
|
||||
}
|
||||
if (isset($actionId['handler'])) {
|
||||
$handler = $actionId['handler'];
|
||||
}
|
||||
// do this last...
|
||||
$actionId = $actionId['actionId'];
|
||||
}
|
||||
$this->actions[$actionId] = [
|
||||
'handler' => $handler,
|
||||
'caption' => $caption,
|
||||
'icon' => $icon,
|
||||
'actionId' => $actionId,
|
||||
];
|
||||
}
|
||||
|
||||
function getHandlerForAction($actionId)
|
||||
{
|
||||
if (isset($this->actions[$actionId])) {
|
||||
return $this->actions[$actionId]['handler'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2018 TwelveTone LLC
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
enabled: true
|
||||
show_samples: false
|
||||
@@ -1,62 +0,0 @@
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 TwelveTone LLC
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
span[data-dz-name] {
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.dz-rename:hover:after {
|
||||
color: #0082ba;
|
||||
}
|
||||
|
||||
/*.dropzone .dz-preview:hover .dz-rename {*/
|
||||
/*display: block;*/
|
||||
/*}*/
|
||||
|
||||
.dropzone .dz-preview:hover .dz-media-action {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.dz-media-action {
|
||||
display: none;
|
||||
position: absolute;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
cursor: pointer;
|
||||
background: #e1e1e1;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
body.ga-theme-17x .dz-media-action {
|
||||
background: #f2f2f2;
|
||||
}
|
||||
|
||||
.dz-media-action i {
|
||||
color: #737c81;
|
||||
}
|
||||
|
||||
.dz-media-action i:hover {
|
||||
color: #0082ba;
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 TwelveTone LLC
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
// MEDIA_ACTIONS must be set
|
||||
// MEDIA_ACTION_TASK_URL must be set
|
||||
|
||||
|
||||
function _onMediaAction(actionId, mediaName, dz) {
|
||||
let fn = "onMediaAction_" + actionId;
|
||||
if (typeof window[fn] === 'function') {
|
||||
window[fn].apply(null, [actionId, mediaName, dz]);
|
||||
} else {
|
||||
submitMediaAction(actionId, mediaName, "");
|
||||
}
|
||||
}
|
||||
|
||||
function submitMediaAction(actionId, mediaName, payload = "", callback = null, modal = null) {
|
||||
if (modal) {
|
||||
$('.loading', modal).removeClass('hidden');
|
||||
$('.button', modal).addClass('hidden');
|
||||
}
|
||||
var data = new FormData();
|
||||
data.append('admin-nonce', GravAdmin.config.admin_nonce);
|
||||
data.append("action_id", actionId);
|
||||
data.append("media_name", mediaName);
|
||||
data.append("payload", JSON.stringify(payload));
|
||||
fetch(MEDIA_ACTION_TASK_URL, {method: 'POST', body: data, credentials: 'same-origin'})
|
||||
.then(res => res.json())
|
||||
.then(result => {
|
||||
if (modal) {
|
||||
if (!result.error) {
|
||||
modal.close();
|
||||
}
|
||||
}
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Check for new media every 1000 ms and add actions
|
||||
setInterval(function () {
|
||||
const size = 25; // The action icon size
|
||||
const maxRows = 5;
|
||||
const colMargin = 2;
|
||||
|
||||
$('.dz-preview').each(function (i, dz) {
|
||||
if (!dz._actions) {
|
||||
dz._actions = true;
|
||||
let actionsIndex = 3; //TODO hardcoded to standard action count
|
||||
//let top = 72; //TODO get max top of children (they are not in order)
|
||||
//let top = actionsCount * size - size; // the standard icons ar off by 1 pixel!?
|
||||
|
||||
const that = this;
|
||||
MEDIA_ACTIONS.forEach(function (item) {
|
||||
actionsIndex++;
|
||||
let faIcon = item.icon;
|
||||
if (!faIcon) {
|
||||
faIcon = "fa-play-circle";
|
||||
}
|
||||
if (!faIcon.startsWith('fa-')) {
|
||||
faIcon = 'fa-' + faIcon;
|
||||
}
|
||||
const ele = document.createElement('a');
|
||||
ele.className = 'dz-media-action';
|
||||
ele.style.top = (Math.floor(actionsIndex % maxRows) * size - (Math.floor(actionsIndex % maxRows)) - 1) + 'px';
|
||||
let right;
|
||||
const col = Math.floor(actionsIndex / maxRows);
|
||||
if (col === 0) {
|
||||
right = -size;
|
||||
} else {
|
||||
right = -((1 + Math.floor((actionsIndex) / maxRows)) * size) - (col * colMargin);
|
||||
}
|
||||
ele.style.right = right + 'px';
|
||||
ele.href = 'javascript:undefined;';
|
||||
ele.title = item.caption;
|
||||
ele.innerText = "";//item.caption;
|
||||
const nameEle = $(dz).find('[data-dz-name]');
|
||||
ele._file_name = nameEle.text();
|
||||
ele._dz_preview = dz;
|
||||
$(that).append(ele);
|
||||
const i = document.createElement("i");
|
||||
ele.appendChild(i);
|
||||
i.className = 'fa fa-fw ' + faIcon;
|
||||
ele.addEventListener('click', () => _onMediaAction(item.actionId, nameEle.text(), dz));
|
||||
|
||||
//Invisible div to maintain hover when the mouseover is on the column margin
|
||||
const ele2 = document.createElement('div');
|
||||
ele2.className = 'dz-media-action';
|
||||
ele2.style.background = 'transparent';
|
||||
ele2.style.right = (right + colMargin) + "px";
|
||||
ele2.style.top = ele.style.top;
|
||||
$(ele2).insertBefore(ele);
|
||||
});
|
||||
dz.style.marginRight = 15 + Math.floor(actionsIndex / maxRows) * (size + colMargin) + "px";
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 TwelveTone LLC
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
function onMediaAction_SampleAction1(actionId, mediaName, mediaElement) {
|
||||
console.log(`Media action ${actionId} was selected.`);
|
||||
alert(`Media action ${actionId} was selected.`);
|
||||
submitMediaAction(actionId, mediaName, `${actionId} was selected`, function (result) {
|
||||
console.log(result);
|
||||
});
|
||||
}
|
||||
|
||||
function onMediaAction_SampleAction2(actionId, mediaName, mediaElement) {
|
||||
console.log(`Media action ${actionId} was selected.`);
|
||||
alert(`Media action ${actionId} was selected.`);
|
||||
submitMediaAction(actionId, mediaName, `${actionId} was selected`, function (result) {
|
||||
console.log(result);
|
||||
});
|
||||
}
|
||||
|
||||
function onMediaAction_SampleAction3(actionId, mediaName, mediaElement) {
|
||||
console.log(`Media action ${actionId} was selected.`);
|
||||
alert(`Media action ${actionId} was selected.`);
|
||||
submitMediaAction(actionId, mediaName, `${actionId} was selected`, function (result) {
|
||||
console.log(result);
|
||||
});
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 TwelveTone LLC
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
// Sample Form Action
|
||||
|
||||
function onMediaAction_SampleForm(actionId, mediaName, mediaElement) {
|
||||
alert("This is a sample form.");
|
||||
submitMediaAction(actionId, mediaName, '{"key1":"value1", "key2":"value2"}');
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2018 TwelveTone LLC
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
name: Admin Media Actions
|
||||
version: 1.0.4
|
||||
description: A plugin that extends Grav with an API for adding actions to media items in the page media bin. This plugin is required by other plugins that add media actions.
|
||||
icon: plug
|
||||
author:
|
||||
name: TwelveTone LLC
|
||||
email: info@twelvetone.tv
|
||||
homepage: https://www.twelvetone.tv/docs/developer-tools/grav-plugins/grav-admin-media-actions-plugin
|
||||
keywords: grav, plugin, admin, media, action
|
||||
bugs: https://github.com/Flamenco/grav-admin-media-actions/issues
|
||||
docs: https://www.twelvetone.tv/docs/developer-tools/grav-plugins/grav-admin-media-actions-plugin
|
||||
license: MIT
|
||||
|
||||
dependencies:
|
||||
- { name: grav, version: '>=1.0.0' }
|
||||
- { name: admin, version: '>=1.0.0' }
|
||||
|
||||
form:
|
||||
validation: strict
|
||||
fields:
|
||||
enabled:
|
||||
type: toggle
|
||||
label: Plugin status
|
||||
highlight: 1
|
||||
default: 0
|
||||
options:
|
||||
1: Enabled
|
||||
0: Disabled
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
show_samples:
|
||||
type: toggle
|
||||
label: Show sample actions
|
||||
description: For testing purposes, several actions will be added to each media item.
|
||||
highlight: 0
|
||||
default: 0
|
||||
options:
|
||||
1: Enabled
|
||||
0: Disabled
|
||||
validate:
|
||||
type: bool
|
||||
@@ -1,17 +0,0 @@
|
||||
plugins {
|
||||
id("com.github.hierynomus.license").version("0.14.0")
|
||||
}
|
||||
apply plugin:'java'
|
||||
|
||||
sourceSets {
|
||||
grav {
|
||||
resources {
|
||||
srcDirs += "."
|
||||
include "**/*.yaml"
|
||||
include "**/*.php"
|
||||
include "**/*.css"
|
||||
include "**/*.js"
|
||||
include "**/*.twig"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<!--A generic form dialog that contains a loading indicator, submit button, and message -->
|
||||
<div class="remodal" data-remodal-id="modal-admin-media-actions" data-remodal-options="hashTracking: false">
|
||||
<form method="post" onsubmit='return false;'>
|
||||
{% for field in fields %}
|
||||
{% if field.type %}
|
||||
{% set value = data.value(field.name) %}
|
||||
<div class="block block-{{field.type}}">
|
||||
{% include ["forms/fields/#{field.type}/#{field.type}.html.twig", 'forms/fields/text/text.html.twig'] %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
<div class="block page-media-info hidden">
|
||||
<div class="form-field grid">{{ "Page Info" }}</div>
|
||||
</div>
|
||||
|
||||
<div class="block non-page-media-info hidden">
|
||||
<div class="form-field grid">{{ "Non-Page Info" }}</div>
|
||||
</div>
|
||||
|
||||
<div class="button-bar">
|
||||
<div class="loading">
|
||||
{{ "Moving" }}... <i class="fa fa-spinner fa-spin"></i>
|
||||
</div>
|
||||
|
||||
<button class="button primary" style="visibility: hidden">{{ "PLUGIN_ADMIN.CONTINUE"|tu }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
Reference in New Issue
Block a user