From 926abe65ceb9bffb9b01cf9c48523a176e337296 Mon Sep 17 00:00:00 2001 From: Ransom Date: Mon, 1 Oct 2018 10:53:02 -0400 Subject: [PATCH] Adjsuted plugin handle --- CHANGELOG.md | 9 +++-- composer.json | 8 ++--- src/BulkEdit.php | 9 ----- .../dist/js/BulkEditModal.js | 6 ++-- .../bulkeditscreen/BulkEditScreenAsset.php | 2 +- src/controllers/BulkEditController.php | 33 +++++++------------ src/queue/jobs/SaveBulkEditJob.php | 2 +- src/translations/en/bulk-edit.php | 8 ----- 8 files changed, 24 insertions(+), 53 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cfef2db..2a4840c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,8 @@ # Bulk Edit Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). - -## 1.0.0 - 2018-07-12 +## 1.0.1 - 2018-10-01 +### Changed +- Adjusted plugin handle +## 1.0.0 - 2018-10-01 ### Added - Initial release diff --git a/composer.json b/composer.json index b7cbc16..f9019d1 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "venveo/craft-bulkedit", "description": "Bulk edit entries", "type": "craft-plugin", - "version": "1.0.0", + "version": "1.0.1", "keywords": [ "craft", "cms", @@ -11,8 +11,8 @@ "bulk edit" ], "support": { - "docs": "https://github.com/venveo/bulk-edit/blob/master/README.md", - "issues": "https://github.com/venveo/bulk-edit/issues" + "docs": "https://github.com/venveo/craft-bulkedit/blob/master/README.md", + "issues": "https://github.com/venveo/craft-bulkedit/issues" }, "license": "MIT", "authors": [ @@ -31,7 +31,7 @@ }, "extra": { "name": "Bulk Edit", - "handle": "bulkedit", + "handle": "venveo-bulk-edit", "hasCpSettings": false, "hasCpSection": false, "changelogUrl": "https://raw.githubusercontent.com/venveo/craft-bulkedit/master/CHANGELOG.md", diff --git a/src/BulkEdit.php b/src/BulkEdit.php index b81f0f3..b9a6e4d 100644 --- a/src/BulkEdit.php +++ b/src/BulkEdit.php @@ -20,15 +20,6 @@ use yii\base\Event; /** - * Craft plugins are very much like little applications in and of themselves. We’ve made - * it as simple as we can, but the training wheels are off. A little prior knowledge is - * going to be required to write a plugin. - * - * For the purposes of the plugin docs, we’re going to assume that you know PHP and SQL, - * as well as some semi-advanced concepts like object-oriented programming and PHP namespaces. - * - * https://craftcms.com/docs/plugins/introduction - * * @author Venveo * @package BulkEdit * @since 1.0.0 diff --git a/src/assetbundles/bulkeditelementaction/dist/js/BulkEditModal.js b/src/assetbundles/bulkeditelementaction/dist/js/BulkEditModal.js index 8237db0..5f5a016 100644 --- a/src/assetbundles/bulkeditelementaction/dist/js/BulkEditModal.js +++ b/src/assetbundles/bulkeditelementaction/dist/js/BulkEditModal.js @@ -54,7 +54,7 @@ Craft.BulkEditModal = Garnish.Modal.extend( }, loadFieldEditor: function(fieldIds) { - Craft.postActionRequest('bulkedit/bulk-edit/get-edit-screen', { + Craft.postActionRequest('venveo-bulk-edit/bulk-edit/get-edit-screen', { elementIds: this.elementIds, siteId: this.siteId, requestId: this.requestId, @@ -102,7 +102,7 @@ Craft.BulkEditModal = Garnish.Modal.extend( this._initSpinner(); this.requestId++; - Craft.postActionRequest('bulkedit/bulk-edit/get-fields', {elementIds: elementIds, requestId: this.requestId}, function(response, textStatus) { + Craft.postActionRequest('venveo-bulk-edit/bulk-edit/get-fields', {elementIds: elementIds, requestId: this.requestId}, function(response, textStatus) { if (textStatus === 'success') { if (response.success) { if (response.requestId != this.requestId) { @@ -160,7 +160,7 @@ Craft.BulkEditModal = Garnish.Modal.extend( this.$container.find('.submit').attr('disabled', 'disabled'); this.$container.find('.submit').addClass('disabled') const formValues = this.$container.find('#bulk-edit-values-modal').serializeArray(); - Craft.postActionRequest('bulkedit/bulk-edit/save-context', formValues, function(response) { + Craft.postActionRequest('venveo-bulk-edit/bulk-edit/save-context', formValues, function(response) { this.hide(); }.bind(this)); }, diff --git a/src/assetbundles/bulkeditscreen/BulkEditScreenAsset.php b/src/assetbundles/bulkeditscreen/BulkEditScreenAsset.php index d39e81e..02ce7de 100644 --- a/src/assetbundles/bulkeditscreen/BulkEditScreenAsset.php +++ b/src/assetbundles/bulkeditscreen/BulkEditScreenAsset.php @@ -16,7 +16,7 @@ class BulkEditScreenAsset extends AssetBundle public function init() { // define the path that your publishable resources live - $this->sourcePath = "@venveo/bulkedit/assetbundles/bulkeditscreen/dist"; + $this->sourcePath = '@venveo/bulkedit/assetbundles/bulkeditscreen/dist'; // define the dependencies $this->depends = [ diff --git a/src/controllers/BulkEditController.php b/src/controllers/BulkEditController.php index 9b78932..31f7217 100644 --- a/src/controllers/BulkEditController.php +++ b/src/controllers/BulkEditController.php @@ -10,27 +10,18 @@ namespace venveo\bulkedit\controllers; -use craft\elements\Entry; -use craft\models\EntryType; -use craft\records\FieldLayout; +use Craft; use craft\records\Element; use craft\records\Field; -use craft\records\FieldLayoutField; -use craft\records\FieldLayoutTab; -use craft\records\Section; -use craft\records\Section_SiteSettings; +use craft\web\Controller; use craft\web\Response; use venveo\bulkedit\assetbundles\bulkeditscreen\BulkEditScreenAsset; -use venveo\bulkedit\BulkEdit as Plugin; - -use Craft; -use craft\web\Controller; use venveo\bulkedit\BulkEdit; +use venveo\bulkedit\BulkEdit as Plugin; use venveo\bulkedit\queue\jobs\SaveBulkEditJob; use venveo\bulkedit\records\EditContext; use venveo\bulkedit\records\History; use venveo\bulkedit\services\BulkEdit as BulkEditService; -use yii\db\Transaction; use yii\web\BadRequestHttpException; /** @@ -64,7 +55,7 @@ public function actionGetFields(): Response $service = Plugin::$plugin->bulkEdit; $layouts = $service->getFieldLayoutsForElementIds($elementIds); $view = \Craft::$app->getView(); - $modalHtml = $view->renderTemplate('bulkedit/elementactions/BulkEdit/_fields', [ + $modalHtml = $view->renderTemplate('venveo-bulk-edit/elementactions/BulkEdit/_fields', [ 'layouts' => $layouts, 'bulkedit' => $service, 'elementIds' => $elementIds, @@ -85,7 +76,8 @@ public function actionGetFields(): Response return $this->asJson($responseData); } - public function actionGetEditScreen(): Response { + public function actionGetEditScreen(): Response + { $this->requireLogin(); $this->requirePostRequest(); $this->requireAcceptsJson(); @@ -130,9 +122,7 @@ public function actionGetEditScreen(): Response { $baseEntry = null; $view = \Craft::$app->getView(); -// $baseElements = BulkEdit::$plugin->bulkEdit->getBaseElementForFieldIds($fieldIds); - - $modalHtml = $view->renderTemplate('bulkedit/elementactions/BulkEdit/_edit', [ + $modalHtml = $view->renderTemplate('venveo-bulk-edit/elementactions/BulkEdit/_edit', [ 'fields' => $fieldModels, 'elementIds' => $elementIds, 'baseElement' => $baseEntry, @@ -148,7 +138,6 @@ public function actionGetEditScreen(): Response { $responseData['footHtml'] = $view->getBodyHtml(); return $this->asJson($responseData); - } public function actionSaveContext(): Response @@ -166,8 +155,8 @@ public function actionSaveContext(): Response $values = Craft::$app->getRequest()->getBodyParam('fields', []); $keyedFieldValues = []; - foreach($values as $handle => $value) { - foreach($fields as $field) { + foreach ($values as $handle => $value) { + foreach ($fields as $field) { if ($field->handle === $handle) { $fieldId = $field->id; } @@ -186,8 +175,8 @@ public function actionSaveContext(): Response $context->save(); $rows = []; - foreach($elementIds as $elementId) { - foreach($fieldIds as $fieldId) { + foreach ($elementIds as $elementId) { + foreach ($fieldIds as $fieldId) { $rows[] = [ 'pending', $context->id, diff --git a/src/queue/jobs/SaveBulkEditJob.php b/src/queue/jobs/SaveBulkEditJob.php index f0b2312..e59be72 100644 --- a/src/queue/jobs/SaveBulkEditJob.php +++ b/src/queue/jobs/SaveBulkEditJob.php @@ -74,6 +74,6 @@ public function execute($queue = null) protected function defaultDescription(): string { - return Craft::t('bulkedit', 'Bulk Edit in progress by {name}', ['name' => $this->context->owner->firstName]); + return Craft::t('venveo-bulk-edit', 'Bulk Edit in progress by {name}', ['name' => $this->context->owner->firstName]); } } diff --git a/src/translations/en/bulk-edit.php b/src/translations/en/bulk-edit.php index 8e8bc2f..92d37e0 100644 --- a/src/translations/en/bulk-edit.php +++ b/src/translations/en/bulk-edit.php @@ -9,17 +9,9 @@ */ /** - * Bulk Edit en Translation - * - * Returns an array with the string to be translated (as passed to `Craft::t('bulk-edit', '...')`) as - * the key, and the translation as the value. - * - * http://www.yiiframework.com/doc-2.0/guide-tutorial-i18n.html - * * @author Venveo * @package BulkEdit * @since 1.0.0 */ return [ - 'Bulk Edit plugin loaded' => 'Bulk Edit plugin loaded', ];