Skip to content

Commit

Permalink
Merge pull request #2 from danieltott/fix/use-cpurl
Browse files Browse the repository at this point in the history
Fix - use cpUrl
  • Loading branch information
danieltott authored Mar 17, 2021
2 parents cd24f49 + adf2f19 commit 7b5dc94
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ 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.1.0 - 2021-03-17

### Fixed

- Use `cpUrl` for correct admin links (#1)

## 1.0.0 - 2021-03-16

### Added

- Initial release
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "danieltott/craft-sidebar-admin-links",
"description": "Add links from Settings directly to the sidebar for admin users",
"type": "craft-plugin",
"version": "1.0.0",
"version": "1.1.0",
"keywords": [
"craft",
"cms",
Expand Down
4 changes: 4 additions & 0 deletions src/SidebarAdminLinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
use craft\base\Plugin;
use craft\services\Plugins;
use craft\events\PluginEvent;
use craft\web\View;
use craft\helpers\UrlHelper;

use yii\base\Event;

Expand Down Expand Up @@ -98,6 +100,8 @@ public function init()
\Craft::$app->user->identity->admin &&
Craft::$app->getConfig()->general->allowAdminChanges) {
$this->view->registerAssetBundle("danieltott\\sidebaradminlinks\\assetbundles\\sidebaradminlinks\\SidebarAdminLinksAsset");
$cpUrl = UrlHelper::cpUrl();
$this->view->registerJs('sidebarEnhancer.init("' . $cpUrl . '");', View::POS_END);
}
}

Expand Down
33 changes: 15 additions & 18 deletions src/assetbundles/sidebaradminlinks/dist/js/sidebaradminlinks.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7b5dc94

Please sign in to comment.