Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-adminpanel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
laravel-adminpanel
Commits
191e8a27
Unverified
Commit
191e8a27
authored
Mar 31, 2018
by
Vipul Basapati
Committed by
GitHub
Mar 31, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #196 from bvipul/develop
Refactoring Menu Module
parents
f38b5d08
a0f1a12f
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
245 additions
and
189 deletions
+245
-189
README.md
README.md
+1
-1
composer.lock
composer.lock
+19
-19
admin.js
public/js/backend/admin.js
+221
-1
app.blade.php
resources/views/backend/layouts/app.blade.php
+1
-0
form.blade.php
resources/views/backend/menus/form.blade.php
+2
-168
webpack.mix.js
webpack.mix.js
+1
-0
No files found.
README.md
View file @
191e8a27
...
@@ -93,7 +93,7 @@ You can now access the server at http://localhost:8000
...
@@ -93,7 +93,7 @@ You can now access the server at http://localhost:8000
npm install
npm install
npm run development
npm run development
php artisan key:generate
php artisan key:generate
php artisan jwt:
generate
php artisan jwt:
secret
php artisan vendor:publish --tag=lfm_public
php artisan vendor:publish --tag=lfm_public
## Logging In
## Logging In
...
...
composer.lock
View file @
191e8a27
...
@@ -199,12 +199,12 @@
...
@@ -199,12 +199,12 @@
"source": {
"source": {
"type": "git",
"type": "git",
"url": "https://github.com/creativeorange/gravatar.git",
"url": "https://github.com/creativeorange/gravatar.git",
"reference": "
a0e84f0c8e8922ad151168d6ebd8db6a1b2d8cd2
"
"reference": "
9affd46be10f1ebb11d5d9f03440f804c09f2b59
"
},
},
"dist": {
"dist": {
"type": "zip",
"type": "zip",
"url": "https://api.github.com/repos/creativeorange/gravatar/zipball/
a0e84f0c8e8922ad151168d6ebd8db6a1b2d8cd2
",
"url": "https://api.github.com/repos/creativeorange/gravatar/zipball/
9affd46be10f1ebb11d5d9f03440f804c09f2b59
",
"reference": "
a0e84f0c8e8922ad151168d6ebd8db6a1b2d8cd2
",
"reference": "
9affd46be10f1ebb11d5d9f03440f804c09f2b59
",
"shasum": ""
"shasum": ""
},
},
"require": {
"require": {
...
@@ -1414,16 +1414,16 @@
...
@@ -1414,16 +1414,16 @@
},
},
{
{
"name": "laravel/framework",
"name": "laravel/framework",
"version": "v5.6.1
1
",
"version": "v5.6.1
2
",
"source": {
"source": {
"type": "git",
"type": "git",
"url": "https://github.com/laravel/framework.git",
"url": "https://github.com/laravel/framework.git",
"reference": "
195ba6a67bdad2a23105c7ab410cd43e0f20bb73
"
"reference": "
82d8165d1ea86bdd81ddfa1db9343fa19e7d1450
"
},
},
"dist": {
"dist": {
"type": "zip",
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/
195ba6a67bdad2a23105c7ab410cd43e0f20bb73
",
"url": "https://api.github.com/repos/laravel/framework/zipball/
82d8165d1ea86bdd81ddfa1db9343fa19e7d1450
",
"reference": "
195ba6a67bdad2a23105c7ab410cd43e0f20bb73
",
"reference": "
82d8165d1ea86bdd81ddfa1db9343fa19e7d1450
",
"shasum": ""
"shasum": ""
},
},
"require": {
"require": {
...
@@ -1432,7 +1432,7 @@
...
@@ -1432,7 +1432,7 @@
"erusev/parsedown": "~1.7",
"erusev/parsedown": "~1.7",
"ext-mbstring": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
"ext-openssl": "*",
"league/flysystem": "
~1.0
",
"league/flysystem": "
^1.0.8
",
"monolog/monolog": "~1.12",
"monolog/monolog": "~1.12",
"nesbot/carbon": "^1.24.1",
"nesbot/carbon": "^1.24.1",
"php": "^7.1.3",
"php": "^7.1.3",
...
@@ -1548,7 +1548,7 @@
...
@@ -1548,7 +1548,7 @@
"framework",
"framework",
"laravel"
"laravel"
],
],
"time": "2018-03-
09T16:53:27
+00:00"
"time": "2018-03-
14T17:29:38
+00:00"
},
},
{
{
"name": "laravel/socialite",
"name": "laravel/socialite",
...
@@ -3935,16 +3935,16 @@
...
@@ -3935,16 +3935,16 @@
"packages-dev": [
"packages-dev": [
{
{
"name": "barryvdh/laravel-debugbar",
"name": "barryvdh/laravel-debugbar",
"version": "v3.1.
3
",
"version": "v3.1.
4
",
"source": {
"source": {
"type": "git",
"type": "git",
"url": "https://github.com/barryvdh/laravel-debugbar.git",
"url": "https://github.com/barryvdh/laravel-debugbar.git",
"reference": "
664fa434e26febf04d60df0368303cf0fe14f63a
"
"reference": "
7a91480cc6e597caed5117a3c5d685f06d35c5a1
"
},
},
"dist": {
"dist": {
"type": "zip",
"type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/
664fa434e26febf04d60df0368303cf0fe14f63a
",
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/
7a91480cc6e597caed5117a3c5d685f06d35c5a1
",
"reference": "
664fa434e26febf04d60df0368303cf0fe14f63a
",
"reference": "
7a91480cc6e597caed5117a3c5d685f06d35c5a1
",
"shasum": ""
"shasum": ""
},
},
"require": {
"require": {
...
@@ -3999,7 +3999,7 @@
...
@@ -3999,7 +3999,7 @@
"profiler",
"profiler",
"webprofiler"
"webprofiler"
],
],
"time": "2018-0
2-25T13:31:58
+00:00"
"time": "2018-0
3-06T08:35:31
+00:00"
},
},
{
{
"name": "bvipul/generator",
"name": "bvipul/generator",
...
@@ -4352,16 +4352,16 @@
...
@@ -4352,16 +4352,16 @@
},
},
{
{
"name": "laravel/browser-kit-testing",
"name": "laravel/browser-kit-testing",
"version": "v4.0.
0
",
"version": "v4.0.
1
",
"source": {
"source": {
"type": "git",
"type": "git",
"url": "https://github.com/laravel/browser-kit-testing.git",
"url": "https://github.com/laravel/browser-kit-testing.git",
"reference": "
3ea22c4da537ca8af83746d583360e8e00081a01
"
"reference": "
d70283fd29ee9ec09d07a9c94cc5518b569cfeaf
"
},
},
"dist": {
"dist": {
"type": "zip",
"type": "zip",
"url": "https://api.github.com/repos/laravel/browser-kit-testing/zipball/
3ea22c4da537ca8af83746d583360e8e00081a01
",
"url": "https://api.github.com/repos/laravel/browser-kit-testing/zipball/
d70283fd29ee9ec09d07a9c94cc5518b569cfeaf
",
"reference": "
3ea22c4da537ca8af83746d583360e8e00081a01
",
"reference": "
d70283fd29ee9ec09d07a9c94cc5518b569cfeaf
",
"shasum": ""
"shasum": ""
},
},
"require": {
"require": {
...
@@ -4396,7 +4396,7 @@
...
@@ -4396,7 +4396,7 @@
"laravel",
"laravel",
"testing"
"testing"
],
],
"time": "2018-0
2-08T16:44:18
+00:00"
"time": "2018-0
3-13T18:07:36
+00:00"
},
},
{
{
"name": "maximebf/debugbar",
"name": "maximebf/debugbar",
...
...
public/js/backend/admin.js
View file @
191e8a27
This diff is collapsed.
Click to expand it.
resources/views/backend/layouts/app.blade.php
View file @
191e8a27
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
</script>
</script>
</head>
</head>
<body
class=
"skin-{{ config('backend.theme') }} {{ config('backend.layout') }}"
>
<body
class=
"skin-{{ config('backend.theme') }} {{ config('backend.layout') }}"
>
<div
class=
"loading"
style=
"display:none"
></div>
@include('includes.partials.logged-in-as')
@include('includes.partials.logged-in-as')
<div
class=
"wrapper"
>
<div
class=
"wrapper"
>
...
...
resources/views/backend/menus/form.blade.php
View file @
191e8a27
...
@@ -56,173 +56,7 @@
...
@@ -56,173 +56,7 @@
@section("after-scripts")
@section("after-scripts")
{{ Html::script('js/nestable2/jquery.nestable.js') }}
{{ Html::script('js/nestable2/jquery.nestable.js') }}
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
var
formName
=
'
_add_custom_url_form
'
;
Backend
.
Menu
.
selectors
.
formUrl
=
"
{{route('admin.menus.getform')}}
"
;
var
lastId
=
null
;
Backend
.
Menu
.
init
();
$
(
'
#menu-items
'
).
nestable
({
callback
:
function
(
l
,
e
){
$
(
"
.menu-items-field
"
).
val
(
JSON
.
stringify
(
$
(
l
).
nestable
(
'
serialise
'
)));
},
json
:
$
(
"
.menu-items-field
"
).
val
(),
includeContent
:
true
,
scroll
:
false
,
maxDepth
:
10
});
$
(
"
.show-modal
"
).
click
(
function
(){
$
(
"
#showMenuModal
"
).
find
(
"
.modal-dialog .modal-content .modal-header .modal-title
"
).
html
(
$
(
this
).
attr
(
"
data-header
"
));
formName
=
$
(
this
).
attr
(
"
data-form
"
);
$
(
"
#showMenuModal
"
).
modal
(
"
show
"
);
setTimeout
(
function
()
{
$
(
document
).
find
(
"
#showMenuModal .view-permission-block
"
).
remove
();
$
(
document
).
find
(
"
#menu-add-custom-url
"
).
removeClass
(
"
hidden
"
);
},
500
);
});
$
(
"
#showMenuModal
"
).
on
(
'
show.bs.modal
'
,
function
()
{
$
.
get
(
"
{{ route('admin.menus.getform') }}/
"
+
formName
,
function
(
data
,
status
){
if
(
status
==
"
success
"
)
{
$
(
"
#showMenuModal
"
).
find
(
"
.modal-dialog .modal-content .modal-body
"
).
html
(
data
);
}
else
{
$
(
"
#showMenuModal
"
).
find
(
"
.modal-dialog .modal-content .modal-body
"
).
html
(
"
Something went wrong! Please try again later.
"
);
}
});
});
var
getNewId
=
function
(
str
)
{
var
arr
=
str
.
match
(
/"id":
[
0-9
]
+/gi
);
if
(
arr
)
{
$
.
each
(
arr
,
function
(
index
,
item
)
{
arr
[
index
]
=
parseInt
(
item
.
replace
(
'
"id":
'
,
''
));
});
return
Math
.
max
.
apply
(
Math
,
arr
)
+
1
;
}
return
1
;
}
var
addMenuItem
=
function
(
obj
)
{
$
(
'
#menu-items
'
).
nestable
(
'
add
'
,
{
"
id
"
:
getNewId
(
$
(
"
.menu-items-field
"
).
val
()),
"
content
"
:
obj
.
name
,
"
name
"
:
obj
.
name
,
"
url
"
:
obj
.
url
,
"
url_type
"
:
obj
.
url_type
,
"
open_in_new_tab
"
:
obj
.
open_in_new_tab
,
"
icon
"
:
obj
.
icon
,
"
view_permission_id
"
:
obj
.
view_permission_id
});
$
(
"
.menu-items-field
"
).
val
(
JSON
.
stringify
(
$
(
'
#menu-items
'
).
nestable
(
'
serialise
'
)));
}
var
editMenuItem
=
function
(
obj
)
{
var
newObject
=
{
"
id
"
:
obj
.
id
,
"
content
"
:
obj
.
name
,
"
name
"
:
obj
.
name
,
"
url
"
:
obj
.
url
,
"
url_type
"
:
obj
.
url_type
,
"
open_in_new_tab
"
:
obj
.
open_in_new_tab
,
"
icon
"
:
obj
.
icon
,
"
view_permission_id
"
:
obj
.
view_permission_id
};
var
menuItems
=
$
(
"
#menu-items
"
).
nestable
(
'
serialise
'
);
var
itemData
;
$
.
each
(
menuItems
,
function
(
index
,
item
){
itemData
=
findItemById
(
item
,
id
);
if
(
itemData
)
{
return
false
;
}
});
if
(
itemData
.
children
)
{
newObject
.
children
=
itemData
.
children
;
}
$
(
'
#menu-items
'
).
nestable
(
'
replace
'
,
newObject
);
$
(
"
.menu-items-field
"
).
val
(
JSON
.
stringify
(
$
(
'
#menu-items
'
).
nestable
(
'
serialise
'
)));
}
$
(
document
).
on
(
"
submit
"
,
"
#menu-add-custom-url
"
,
function
(
e
){
e
.
preventDefault
();
var
formData
=
$
(
this
).
serializeArray
().
reduce
(
function
(
obj
,
item
)
{
obj
[
item
.
name
]
=
item
.
value
;
return
obj
;
},
{});
if
(
formData
.
name
.
length
>
0
)
{
if
(
formData
.
id
.
length
>
0
)
{
editMenuItem
(
formData
);
}
else
{
addMenuItem
(
formData
);
}
$
(
"
#showMenuModal
"
).
modal
(
"
hide
"
);
}
});
$
(
document
).
on
(
"
click
"
,
"
.add-module-to-menu
"
,
function
(){
var
dataObj
=
{
id
:
$
(
this
).
attr
(
"
data-id
"
),
name
:
$
(
this
).
attr
(
"
data-name
"
),
url
:
$
(
this
).
attr
(
"
data-url
"
),
url_type
:
$
(
this
).
attr
(
"
data-url_type
"
),
open_in_new_tab
:
$
(
this
).
attr
(
"
data-open_in_new_tab
"
),
view_permission_id
:
$
(
this
).
attr
(
"
data-view_permission_id
"
),
}
addMenuItem
(
dataObj
);
});
var
findItemById
=
function
(
item
,
id
)
{
if
(
item
.
id
==
id
)
{
return
item
;
}
var
found
=
false
;
var
foundItem
;
if
(
item
.
children
){
$
.
each
(
item
.
children
,
function
(
index
,
childItem
){
foundItem
=
findItemById
(
childItem
,
id
);
if
(
foundItem
)
{
console
.
log
(
foundItem
);
found
=
true
;
return
false
;
}
});
}
if
(
found
)
{
return
foundItem
;
}
return
null
;
};
$
(
document
).
ready
(
function
(){
$
(
document
).
on
(
"
click
"
,
"
.edit-menu-item
"
,
function
()
{
id
=
$
(
this
).
parents
(
"
.dd-item
"
).
first
().
attr
(
"
data-id
"
);
$
(
"
#showMenuModal
"
).
modal
(
"
show
"
);
var
menuItems
=
$
(
"
#menu-items
"
).
nestable
(
'
serialise
'
);
var
itemData
;
$
.
each
(
menuItems
,
function
(
index
,
item
){
itemData
=
findItemById
(
item
,
id
);
//console.log(itemData);
if
(
itemData
)
{
return
false
;
}
});
if
(
itemData
.
id
!=
undefined
&&
itemData
.
id
==
id
)
{
setTimeout
(
function
()
{
$
(
"
#showMenuModal
"
).
find
(
"
.modal-dialog .modal-content .modal-header .modal-title
"
).
html
(
"
Edit:
"
+
itemData
.
name
);
$
(
document
).
find
(
"
#showMenuModal .mi-id
"
).
val
(
itemData
.
id
);
$
(
document
).
find
(
"
#showMenuModal .mi-name
"
).
val
(
itemData
.
name
);
$
(
document
).
find
(
"
#showMenuModal .mi-url
"
).
val
(
itemData
.
url
);
$
(
document
).
find
(
"
#showMenuModal .mi-url_type_
"
+
itemData
.
url_type
).
prop
(
"
checked
"
,
true
);
if
(
itemData
.
open_in_new_tab
==
1
)
{
$
(
document
).
find
(
"
#showMenuModal .mi-open_in_new_tab
"
).
prop
(
"
checked
"
,
true
);
}
$
(
document
).
find
(
"
#showMenuModal .mi-icon
"
).
val
(
itemData
.
icon
);
if
(
itemData
.
view_permission_id
)
{
$
(
document
).
find
(
"
#showMenuModal .mi-view_permission_id
"
).
val
(
itemData
.
view_permission_id
);
}
else
{
$
(
document
).
find
(
"
#showMenuModal .view-permission-block
"
).
remove
();
}
$
(
document
).
find
(
"
#menu-add-custom-url
"
).
removeClass
(
"
hidden
"
);
},
500
);
return
;
}
});
$
(
document
).
on
(
"
click
"
,
"
.remove-menu-item
"
,
function
()
{
$
(
"
#menu-items
"
).
nestable
(
'
remove
'
,
$
(
this
).
parents
(
"
.dd-item
"
).
first
().
attr
(
"
data-id
"
));
$
(
"
.menu-items-field
"
).
val
(
JSON
.
stringify
(
$
(
"
#menu-items
"
).
nestable
(
'
serialise
'
)));
});
});
</script>
</script>
@endsection
@endsection
webpack.mix.js
View file @
191e8a27
...
@@ -21,6 +21,7 @@ mix.sass('resources/assets/sass/frontend/app.scss', 'public/css/frontend.css')
...
@@ -21,6 +21,7 @@ mix.sass('resources/assets/sass/frontend/app.scss', 'public/css/frontend.css')
'
public/js/select2/select2.css
'
,
'
public/js/select2/select2.css
'
,
'
public/css/bootstrap.min.css
'
,
'
public/css/bootstrap.min.css
'
,
'
public/css/custom-style.css
'
,
'
public/css/custom-style.css
'
,
'
public/css/loader.css
'
,
'
public/css/bootstrap-datetimepicker.min.css
'
'
public/css/bootstrap-datetimepicker.min.css
'
],
'
public/css/backend-custom.css
'
)
],
'
public/css/backend-custom.css
'
)
.
js
([
.
js
([
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment