Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Commit 414397e

Browse files
committed
update
- add fw option for js components, so we can add more fw easily - add `css_fw` to view composer - add `URL::has()` to marcos - some cleanup
1 parent 3c60801 commit 414397e

27 files changed

+55
-44
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,10 @@ return [
120120

121121
/*
122122
* css farmework for admin pages
123+
* ex.
124+
* MIX_SM_FRAMEWORK=bulma
123125
*/
124-
'framework' => 'bulma',
126+
'framework'=> env('MIX_SM_FRAMEWORK'),
125127
];
126128
```
127129

src/Controllers/BaseController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ public function __construct()
1919
}
2020

2121
$this->cache = app('cache');
22-
$fw = config('simpleMenu.framework');
23-
$this->adminPath = "SimpleMenu::admin.{$fw}";
22+
$css_fw = config('simpleMenu.framework');
23+
$this->adminPath = "SimpleMenu::admin.$css_fw";
2424
$this->templatePath = config('simpleMenu.templatePath');
2525
$this->crud_prefix = config('simpleMenu.crud_prefix');
26-
2726
$this->userModel = app(config('simpleMenu.userModel'));
2827
}
2928
}

src/SimpleMenuServiceProvider.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ protected function macros()
9797

9898
return request()->url() == route($route_name);
9999
});
100+
101+
URL::macro('has', function ($needle) {
102+
return str_contains($this->current(), $needle);
103+
});
100104
}
101105

102106
/**
@@ -109,6 +113,10 @@ protected function viewComp()
109113
view()->composer('SimpleMenu::admin.*', function ($view) {
110114
$view->with(['crud_prefix' => config('simpleMenu.crud_prefix')]);
111115
});
116+
117+
view()->composer('SimpleMenu::admin.*', function ($view) {
118+
$view->with(['css_fw' => config('simpleMenu.framework')]);
119+
});
112120
}
113121

114122
/**

src/config/simpleMenu.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@
8484

8585
/*
8686
* css farmework for admin pages
87+
* ex.
88+
* MIX_SM_FRAMEWORK=bulma
8789
*/
88-
'framework' => 'bulma',
90+
'framework'=> env('MIX_SM_FRAMEWORK'),
8991
];

src/resources/assets/js/comps.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ $.ajaxSetup({
55
}
66
})
77

8-
Vue.component('PageComp', require('./components/page-comp.vue'))
9-
Vue.component('MenuComp', require('./components/menu-comp.vue'))
10-
Vue.component('IndexComp', require('./components/index-comp.vue'))
8+
Vue.component('PageComp', require('./' + process.env.MIX_SM_FRAMEWORK + '/page-comp.vue'))
9+
Vue.component('MenuComp', require('./' + process.env.MIX_SM_FRAMEWORK + '/menu-comp.vue'))
10+
Vue.component('IndexComp', require('./' + process.env.MIX_SM_FRAMEWORK + '/index-comp.vue'))

0 commit comments

Comments
 (0)