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
0241a481
Commit
0241a481
authored
Feb 26, 2018
by
cygnet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes done for deleted user and edit user page to convert them in javascript
parent
97c1c00f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
163 additions
and
73 deletions
+163
-73
admin.js
public/js/backend/admin.js
+11
-2
deleted.blade.php
resources/views/backend/access/users/deleted.blade.php
+86
-70
edit.blade.php
resources/views/backend/access/users/edit.blade.php
+66
-1
No files found.
public/js/backend/admin.js
View file @
0241a481
...
...
@@ -279,20 +279,29 @@ var Backend = {}; // common variable used in all the files of the backend
*/
Profile
:
{
selectors
:{
},
init
:
function
()
{
this
.
setSelectors
();
this
.
addHandlers
();
},
setSelectors
:
function
(){
this
.
selectors
.
state
=
document
.
querySelector
(
"
.st
"
);
this
.
selectors
.
cities
=
document
.
querySelector
(
"
.ct
"
);
},
addHandlers
:
function
()
{
if
(
this
.
selectors
.
state
!=
null
){
this
.
selectors
.
state
.
select2
();
}
if
(
this
.
selectors
.
cities
!=
null
){
this
.
selectors
.
cities
.
select2
();
}
}
},
/**
...
...
resources/views/backend/access/users/deleted.blade.php
View file @
0241a481
...
...
@@ -68,7 +68,13 @@
{{-- For DataTables --}}
{{ Html::script(mix('js/dataTable.js')) }}
<script>
$(function() {
(function () {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="
csrf
-
token
"]').attr('content')
}
});
var dataTable = $('#users-table').dataTable({
processing: true,
serverSide: true,
...
...
@@ -103,10 +109,16 @@
Backend.DataTableSearch.init(dataTable);
$("
body
").on("
click
", "
a
[
name
=
'delete_user_perm'
]
", function(e) {
e.preventDefault();
var linkURL = $(this).attr("
href
");
})();
window.onload = function(){
document.querySelectorAll("
a
[
name
=
'delete_user_perm'
]
").forEach(function(element){
element.onclick = function(event){
event.preventDefault();
var linkURL = event.target.getAttribute("
href
");
swal({
title: "
{{
trans
(
'strings.backend.general.are_you_sure'
)
}}
",
text: "
{{
trans
(
'strings.backend.access.users.delete_user_confirm'
)
}}
",
...
...
@@ -121,11 +133,13 @@
window
.
location
.
href
=
linkURL
;
}
});
});
}
})
$
(
"body"
)
.
on
(
"click"
,
"a[name='restore_user']"
,
function
(
e
)
{
e
.
preventDefault
();
var
linkURL
=
$
(
this
)
.
attr
(
"href"
);
document
.
querySelectorAll
(
"a[name='restore_user']"
)
.
forEach
(
function
(
element
){
element
.
onclick
=
function
(
event
){
event
.
preventDefault
();
var
linkURL
=
event
.
target
.
getAttribute
(
"href"
);
swal
({
title
:
"{{ trans('strings.backend.general.are_you_sure') }}"
,
...
...
@@ -141,7 +155,9 @@
window
.
location
.
href
=
linkURL
;
}
});
});
});
}
})
};
</
script
>
@
endsection
resources/views/backend/access/users/edit.blade.php
View file @
0241a481
...
...
@@ -167,12 +167,15 @@
{{ Html::script('js/backend/access/users/script.js') }}
<script type="
text
/
javascript
">
/*
jQuery(document).ready(function() {
Backend.Access.init();
/**
* This function is used to get clicked element role id and return required result
*/
jQuery('.get-role-for-permissions').click(function () {
/* jQuery('.get-role-for-permissions').click(function () {
$.ajax({
type: "
POST
",
url: "
{{
route
(
'admin.get.permission'
)
}}
",
...
...
@@ -205,5 +208,67 @@
});
});
*/
Backend.Utils.documentReady(function(){
Backend.Access.init();
csrf = $('meta[name="
csrf
-
token
"]').attr('content');
/**
* This function is used to get clicked element role id and return required result
*/
document.querySelectorAll("
.
get
-
role
-
for
-
permissions
").forEach(function(element){
element.onclick =function(event){
callback = {
success:function(request){
console.log("
request
",request,request.status);
if (request.status >= 200 && request.status < 400) {
// Success!
var response = JSON.parse(request.responseText);
var p = response.permissions;
var q = response.rolePermissions;
var qAll = response.allPermissions;
document.querySelector("
.
get
-
available
-
permissions
").innerHTML = "";
htmlstring = "";
if (p.length == 0) {
document.querySelector("
.
get
-
available
-
permissions
").innerHTML = '<p>There are no available permissions.</p>';
} else {
for (var key in p) {
var addChecked = '';
if (qAll == 1 && q.length == 0) {
addChecked = 'checked="
checked
"';
} else {
if (typeof q[key] !== "
undefined
") {
addChecked = 'checked="
checked
"';
}
}
htmlstring += '<label class="
control
control
--
checkbox
"> <input type="
checkbox
" name="
permissions
[
' + key + '
]
" value="
' + key + '
" id="
perm_
' + key + '
" ' + addChecked + ' /> <label for="
perm_
' + key + '
">' + p[key] + '</label> <div class="
control__indicator
"></div> </label> <br>';
}
}
document.querySelector("
.
get
-
available
-
permissions
").innerHTML = htmlstring;
Backend.Utils.removeClass(document.getElementById("
available
-
permissions
"),'hidden');
} else {
// We reached our target server, but it returned an error
console.log("
errror
in
request
");
document.querySelector("
.
get
-
available
-
permissions
").innerHTML = '<p>There are no available permissions.</p>';
}
},
error:function(){
console.log("
errror
");
document.querySelector("
.
get
-
available
-
permissions
").innerHTML = '<p>There are no available permissions.</p>';
}
};
Backend.Utils.ajaxrequest("
{{
route
(
'admin.get.permission'
)
}}
","
post
",{role_id: event.target.value ,"
_tocken
":csrf},csrf,callback);
}
});
});
</script>
@endsection
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