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

Commit f8042e1

Browse files
committed
v3.0.1
...
1 parent 1bca875 commit f8042e1

File tree

8 files changed

+254
-17
lines changed

8 files changed

+254
-17
lines changed

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,11 @@
99
> - Menu Nested Set
1010
> - https://github.com/gazsp/baum
1111
12-
- Javascript
13-
+ [jQuery](https://jquery.com/) (cdn)
14-
+ [select2](https://select2.github.io/) (cdn)
15-
+ [tinymce](https://www.tinymce.com/) (cdn)
16-
+ [Vue](https://vuejs.org/)
17-
+ [vuedraggable](https://github.com/SortableJS/Vue.Draggable)
18-
+ [notification-component](https://github.com/ctf0/Notification-Component)
19-
2012
## Installation
2113

2214
- `composer require ctf0/simple-menu`
2315

24-
- add the service provider & facade to `config/app.php`
25-
26-
- all the package dependencies "serviceProvider & aliases" are registerd with the package.
16+
- (Laravel < 5.5) add the service provider & facade to `config/app.php`
2717

2818
```php
2919
'providers' => [
@@ -41,6 +31,14 @@
4131
- for simpleMenu [Wiki](https://github.com/ctf0/simple-menu/wiki/Publish)
4232
- also check the **Dependencies** packages for "configuration/options/migrations".
4333

34+
- install JS dependencies
35+
36+
```bash
37+
yarn add vue vuemit vuedraggable
38+
# or
39+
npm install vue vuemit vuedraggable
40+
```
41+
4442
## Config
4543
**config/simpleMenu.php**
4644
```php

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"gazsp/baum": "^1.1",
2222
"mcamara/laravel-localization": "^1.2",
2323
"spatie/laravel-permission": "^2.5",
24-
"spatie/laravel-translatable": "^2.0"
24+
"spatie/laravel-translatable": "^2.0",
25+
"ctf0/package-changelog": "^1.0"
2526
},
2627
"autoload": {
2728
"psr-4": {
@@ -36,7 +37,8 @@
3637
"aliases": {
3738
"SimpleMenu": "ctf0\\SimpleMenu\\Facade\\SimpleMenu"
3839
}
39-
}
40+
},
41+
"changeLog": "logs"
4042
},
4143
"config": {
4244
"sort-packages": true

logs/v3.0.1.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- update readme & wiki for better understanding
2+
- add notif component & styles
3+
- add changelog feature so now you can track what changes are made to the package

src/SimpleMenu.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,10 @@ protected function createCaches()
8181
*/
8282
protected static function create_LFD($dir)
8383
{
84-
$file_name = substr(strrchr($dir, '/'), 1);
85-
$dir_only = str_replace($file_name, '', $dir);
84+
$dir_name = dirname($dir);
8685

87-
if (!File::exists($dir_only)) {
88-
return File::makeDirectory($dir_only, 0755, true);
86+
if (!File::exists($dir_name)) {
87+
return File::makeDirectory($dir_name, 0755, true);
8988
}
9089
}
9190
}

src/SimpleMenuServiceProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class SimpleMenuServiceProvider extends ServiceProvider
1818
{
1919
protected $packagesSP = [
2020
\Baum\Providers\BaumServiceProvider::class,
21+
\ctf0\PackageChangeLog\PackageChangeLogServiceProvider::class,
2122
];
2223

2324
/**
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
<template>
2+
<div>
3+
<!-- single -->
4+
<transition name="slide-fade" v-if="self_show">
5+
<div :class="classObj(self_type)" class="item">
6+
7+
<button class="delete" @click="self_show = false"></button>
8+
<div class="media">
9+
<div class="media-left" v-if="self_icon">
10+
<figure class="icon is-large">
11+
<i class="material-icons">{{ getIcon(self_type) }}</i>
12+
</figure>
13+
</div>
14+
<div class="media-content">
15+
<h4 class="title">
16+
<strong>{{ self_title }}</strong>
17+
</h4>
18+
<p class="subtitle">{{ self_body }}</p>
19+
</div>
20+
</div>
21+
22+
</div>
23+
</transition>
24+
25+
<!-- events -->
26+
<template v-if="!self_title">
27+
<span id="close_all" class="tag is-dark is-medium"
28+
v-if="checkForGroup()" @click="closeAll()">
29+
Close All
30+
<button class="delete"></button>
31+
</span>
32+
33+
<transition-group name="slide-fade" tag="ul">
34+
<li v-for="(one,index) in notif_group" :key="index"
35+
class="item" :class="classObj(one.type)"
36+
v-if="IsVisible(index)">
37+
38+
<button class="delete" @click="closeNotif(index)"></button>
39+
<div class="media">
40+
<div class="media-left" v-if="one.icon">
41+
<figure class="icon is-large">
42+
<i class="material-icons">{{ getIcon(one.type) }}</i>
43+
</figure>
44+
</div>
45+
<div class="media-content">
46+
<h4 class="title">
47+
<strong>{{ one.title }}</strong>
48+
</h4>
49+
<p class="subtitle">{{ one.body }}</p>
50+
</div>
51+
</div>
52+
53+
</li>
54+
</transition-group>
55+
</template>
56+
</div>
57+
</template>
58+
59+
<style scoped>
60+
@import url(https://fonts.googleapis.com/icon?family=Material+Icons);
61+
62+
/*animation*/
63+
.slide-fade-enter-active,
64+
.slide-fade-leave-active {
65+
transition: all 0.3s ease;
66+
}
67+
.slide-fade-enter,
68+
.slide-fade-leave-to {
69+
opacity: 0;
70+
transform: translateX(10px);
71+
}
72+
73+
/*notiifcation card*/
74+
.item {
75+
width: 330px;
76+
}
77+
.material-icons {
78+
font-size: 3rem;
79+
}
80+
.media-left {
81+
align-self: center;
82+
position: relative;
83+
margin-right: 1.25rem;
84+
}
85+
86+
.has-shadow {
87+
box-shadow: 0 2px 4px rgba(0,0,0,0.12), 0 0 6px rgba(0,0,0,0.04);
88+
}
89+
.notification {
90+
padding: 1.25rem;
91+
margin-bottom: 10px;
92+
}
93+
94+
#close_all {
95+
background-color: rgba(54, 54, 54, 0.9);
96+
cursor: pointer;
97+
position: fixed;
98+
z-index: 1;
99+
top: 1rem;
100+
right: 1rem;
101+
}
102+
#close_all:hover{
103+
background-color: rgb(54, 54, 54);
104+
}
105+
</style>
106+
107+
<script>
108+
export default {
109+
props: {
110+
title: '',
111+
body: '',
112+
icon: {
113+
default: true
114+
},
115+
type: {default: 'info'},
116+
duration: null
117+
},
118+
119+
data() {
120+
return {
121+
notif_group: [],
122+
self_title: this.title,
123+
self_body: this.body,
124+
self_type: this.type,
125+
self_icon: Boolean(this.icon),
126+
self_duration: this.duration,
127+
self_show: false
128+
}
129+
},
130+
131+
created() {
132+
this.checkProp()
133+
134+
EventHub.listen('showNotif', (data) => {
135+
this.collectData(data)
136+
})
137+
},
138+
139+
methods: {
140+
checkForGroup() {
141+
return this.notif_group.length > 1 &&
142+
this.notif_group.filter((item) => item.show == true).length > 1
143+
},
144+
closeAll() {
145+
this.notif_group.map((item) => {
146+
item.show = false
147+
item.duration = null
148+
})
149+
},
150+
checkProp() {
151+
if (this.self_title) {
152+
this.self_show = true
153+
}
154+
155+
if (this.self_duration !== undefined) {
156+
setTimeout(() => {
157+
this.self_show = false
158+
}, this.self_duration * 1000)
159+
}
160+
},
161+
collectData(data) {
162+
this.notif_group.push({
163+
title: data.title,
164+
body: data.body,
165+
type: data.type,
166+
icon: data.icon == null ? true : false,
167+
duration: data.duration,
168+
onClose: data.onClose,
169+
show: true
170+
})
171+
},
172+
IsVisible(index) {
173+
let dur = this.notif_group[index].duration
174+
175+
if (dur !== undefined) {
176+
setTimeout(() => {
177+
this.closeNotif(index)
178+
}, dur * 1000)
179+
}
180+
181+
return this.notif_group[index].show
182+
},
183+
closeNotif(index) {
184+
this.notif_group[index].show = false
185+
186+
if (typeof this.notif_group[index].onClose != 'undefined' && typeof this.notif_group[index].onClose === 'function') {
187+
this.notif_group[index].onClose()
188+
}
189+
},
190+
classObj(type) {
191+
return `notification has-shadow is-${type}`
192+
},
193+
getIcon(type) {
194+
switch (type) {
195+
case 'primary':
196+
return 'track_changes'
197+
case 'success':
198+
return 'check_circle'
199+
case 'info':
200+
return 'live_help'
201+
case 'warning':
202+
return 'power_settings_new'
203+
case 'danger':
204+
return 'add_alert'
205+
default:
206+
return 'error'
207+
}
208+
}
209+
}
210+
}
211+
</script>

src/resources/assets/js/comps.js

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

8+
window.Vue = require('vue')
9+
810
Vue.component('PageComp', require('./' + process.env.MIX_SM_FRAMEWORK + '/page-comp.vue'))
911
Vue.component('MenuComp', require('./' + process.env.MIX_SM_FRAMEWORK + '/menu-comp.vue'))
1012
Vue.component('IndexComp', require('./' + process.env.MIX_SM_FRAMEWORK + '/index-comp.vue'))
13+
Vue.component('MyNotification', require('./' + process.env.MIX_SM_FRAMEWORK + '/notifs.vue'))

src/resources/assets/sass/style.scss

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
// notifications
2+
.notif-container {
3+
padding: 0 0 4rem;
4+
position: fixed;
5+
top: 4rem;
6+
right: 1rem;
7+
bottom: 0;
8+
z-index: 100;
9+
overflow: scroll;
10+
}
11+
112
// select2
213
.select2 {
314
width: 100% !important;
@@ -14,12 +25,15 @@
1425
right: 0;
1526
z-index: 1;
1627
opacity: 0.3;
28+
1729
&:hover {
1830
opacity: 1;
1931
}
32+
2033
&:after {
2134
display: none !important;
2235
}
36+
2337
select {
2438
padding: 0.40rem 0.5rem 0.5rem !important;
2539
font-weight: bold;
@@ -33,6 +47,7 @@
3347
.mce-path {
3448
display: none !important;
3549
}
50+
3651
div.mce-edit-area {
3752
border-right-width: 1px !important;
3853
}
@@ -43,19 +58,24 @@ div.mce-edit-area {
4358
padding-left: 1em;
4459
margin-bottom: 0.5em !important;
4560
}
61+
4662
.menu-list {
4763
line-height: inherit;
4864
}
65+
4966
.dragArea {
5067
min-height: 25px;
5168
display: block;
5269
}
70+
5371
.notification > .delete {
5472
top: 0.45em;
5573
}
74+
5675
.ghost {
5776
opacity: 1;
5877
}
78+
5979
.is-white {
6080
color: white;
6181
}

0 commit comments

Comments
 (0)