Skip to content

Commit

Permalink
Removed hash from Plugin Store URLs using Vue Router’s history mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamindavid committed Nov 24, 2017
1 parent c8e4d2c commit 1f13422
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
11 changes: 1 addition & 10 deletions src/config/cproutes/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,6 @@
'utilities' => 'utilities',
'utilities/<id:[\w\-]+>' => 'utilities/show-utility',
'plugin-store' => 'plugin-store',
'plugin-store/all-plugins' => 'plugin-store/all-plugins',
'plugin-store/categories/<categoryId:\d+>' => 'plugin-store/category',
'plugin-store/developer/<developerId:\d+>' => 'plugin-store/developer',
'plugin-store/install' => 'pluginstore/install',
'plugin-store/cart' => 'plugin-store/cart',
'plugin-store/vue' => 'plugin-store/vue',
'plugin-store/vue/<slug:([^\/]+)?>' => 'plugin-store/vue-plugin',
'plugin-store/account' => 'plugin-store/account',
'plugin-store/callback' => 'plugin-store/callback',
'plugin-store/<slug:([^\/]+)?>' => 'plugin-store/plugin',
'plugin-store/<slug:([^\/]+)?>/license' => 'plugin-store/plugin-license',
'plugin-store/<url:(.*)>' => 'plugin-store',
];
3 changes: 3 additions & 0 deletions src/controllers/PluginStoreController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ public function init()
*/
public function actionIndex()
{
$vueRouterBase = '/'.Craft::$app->getConfig()->getGeneral()->cpTrigger.'/plugin-store/';

Craft::$app->getView()->registerJsFile('https://js.stripe.com/v3/');
Craft::$app->getView()->registerJs('window.craftApiEndpoint = "'.Craft::$app->getPluginStore()->craftApiEndpoint.'";', View::POS_BEGIN);
Craft::$app->getView()->registerJs('window.stripeApiKey = "'.Craft::$app->getPluginStore()->stripeApiKey.'";', View::POS_BEGIN);
Craft::$app->getView()->registerJs('window.enableCraftId = "'.Craft::$app->getPluginStore()->enableCraftId.'";', View::POS_BEGIN);
Craft::$app->getView()->registerJs('window.vueRouterBase = "'.$vueRouterBase.'";', View::POS_BEGIN);
Craft::$app->getView()->registerAssetBundle(PluginStoreAsset::class);

return $this->renderTemplate('plugin-store/_index', [
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/pluginstore/dist/js/main.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/web/assets/pluginstore/src/js/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import Tests from '../Tests';
Vue.use(Router);

export default new Router({
base: window.vueRouterBase,
mode: 'history',
routes: [
{
path: '/',
Expand Down

0 comments on commit 1f13422

Please sign in to comment.