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
63ac3c8e
Commit
63ac3c8e
authored
Feb 28, 2018
by
cygnet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
formatted admin js
parent
1810d16a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
98 deletions
+98
-98
admin.js
public/js/backend/admin.js
+98
-98
No files found.
public/js/backend/admin.js
View file @
63ac3c8e
...
@@ -26,7 +26,7 @@ var Backend = {}; // common variable used in all the files of the backend
...
@@ -26,7 +26,7 @@ var Backend = {}; // common variable used in all the files of the backend
element
.
classList
.
add
(
className
);
element
.
classList
.
add
(
className
);
else
else
element
.
className
+=
'
'
+
className
;
element
.
className
+=
'
'
+
className
;
},
},
removeClass
:
function
(
el
,
className
)
{
removeClass
:
function
(
el
,
className
)
{
if
(
el
.
classList
)
if
(
el
.
classList
)
el
.
classList
.
remove
(
className
);
el
.
classList
.
remove
(
className
);
...
@@ -87,7 +87,7 @@ var Backend = {}; // common variable used in all the files of the backend
...
@@ -87,7 +87,7 @@ var Backend = {}; // common variable used in all the files of the backend
return
urljson
;
return
urljson
;
},
},
},
},
/**
/**
...
@@ -104,33 +104,33 @@ var Backend = {}; // common variable used in all the files of the backend
...
@@ -104,33 +104,33 @@ var Backend = {}; // common variable used in all the files of the backend
/**
/**
* Roles management
* Roles management
*/
*/
Roles
:{
Roles
:
{
selectors
:{
selectors
:
{
associated
:
document
.
querySelector
(
"
select[name='associated_permissions']
"
),
associated
:
document
.
querySelector
(
"
select[name='associated_permissions']
"
),
associated_container
:
document
.
getElementById
(
"
#available-permissions
"
),
associated_container
:
document
.
getElementById
(
"
#available-permissions
"
),
},
},
init
(
page
){
init
(
page
)
{
this
.
setSelectors
();
this
.
setSelectors
();
this
.
setRolepermission
(
page
);
this
.
setRolepermission
(
page
);
this
.
addHandlers
();
this
.
addHandlers
();
},
},
setSelectors
:
function
()
{
setSelectors
:
function
()
{
this
.
selectors
.
associated
=
document
.
querySelector
(
"
select[name='associated_permissions']
"
);
this
.
selectors
.
associated
=
document
.
querySelector
(
"
select[name='associated_permissions']
"
);
this
.
selectors
.
associated_container
=
document
.
getElementById
(
"
available-permissions
"
);
this
.
selectors
.
associated_container
=
document
.
getElementById
(
"
available-permissions
"
);
},
},
addHandlers
:
function
()
{
addHandlers
:
function
()
{
var
associated
=
this
.
selectors
.
associated
;
var
associated
=
this
.
selectors
.
associated
;
var
associated_container
=
this
.
selectors
.
associated_container
;
var
associated_container
=
this
.
selectors
.
associated_container
;
if
(
associated_container
!=
null
)
if
(
associated_container
!=
null
)
if
(
associated
.
value
==
"
custom
"
)
if
(
associated
.
value
==
"
custom
"
)
Backend
.
Utils
.
removeClass
(
associated_container
,
"
hidden
"
);
Backend
.
Utils
.
removeClass
(
associated_container
,
"
hidden
"
);
else
else
Backend
.
Utils
.
addClass
(
associated_container
,
'
hidden
'
);
Backend
.
Utils
.
addClass
(
associated_container
,
'
hidden
'
);
associated
.
onchange
=
function
(
event
)
{
associated
.
onchange
=
function
(
event
)
{
if
(
associated_container
!=
null
)
if
(
associated_container
!=
null
)
if
(
associated
.
value
==
"
custom
"
)
if
(
associated
.
value
==
"
custom
"
)
Backend
.
Utils
.
removeClass
(
associated_container
,
"
hidden
"
);
Backend
.
Utils
.
removeClass
(
associated_container
,
"
hidden
"
);
...
@@ -138,35 +138,35 @@ var Backend = {}; // common variable used in all the files of the backend
...
@@ -138,35 +138,35 @@ var Backend = {}; // common variable used in all the files of the backend
Backend
.
Utils
.
addClass
(
associated_container
,
'
hidden
'
);
Backend
.
Utils
.
addClass
(
associated_container
,
'
hidden
'
);
};
};
},
},
setRolepermission
:
function
(
page
){
setRolepermission
:
function
(
page
)
{
Backend
.
Users
.
setSelectors
();
Backend
.
Users
.
setSelectors
();
Backend
.
Users
.
addHandlers
(
page
);
Backend
.
Users
.
addHandlers
(
page
);
}
}
},
},
/**
/**
* Users management
* Users management
*
*
*/
*/
Users
:
Users
:
{
{
selectors
:
{
selectors
:
{
select2
:
$
(
"
.select2
"
),
select2
:
$
(
"
.select2
"
),
getPremissionURL
:
""
,
getPremissionURL
:
""
,
showPermission
:
document
.
querySelectorAll
(
"
.show-permissions
"
)
showPermission
:
document
.
querySelectorAll
(
"
.show-permissions
"
)
},
},
init
:
function
(
page
)
{
init
:
function
(
page
)
{
this
.
setSelectors
();
this
.
setSelectors
();
this
.
addHandlers
(
page
);
this
.
addHandlers
(
page
);
},
},
setSelectors
:
function
()
{
setSelectors
:
function
()
{
this
.
selectors
.
select2
=
$
(
"
.select2
"
);
this
.
selectors
.
select2
=
$
(
"
.select2
"
);
this
.
selectors
.
getRoleForPermissions
=
document
.
querySelectorAll
(
"
.get-role-for-permissions
"
);
this
.
selectors
.
getRoleForPermissions
=
document
.
querySelectorAll
(
"
.get-role-for-permissions
"
);
this
.
selectors
.
getAvailabelPermissions
=
document
.
querySelector
(
"
.get-available-permissions
"
);
this
.
selectors
.
getAvailabelPermissions
=
document
.
querySelector
(
"
.get-available-permissions
"
);
this
.
selectors
.
Role3
=
document
.
getElementById
(
"
role-3
"
);
this
.
selectors
.
Role3
=
document
.
getElementById
(
"
role-3
"
);
this
.
showPermission
=
document
.
querySelectorAll
(
"
.show-permissions
"
);
this
.
showPermission
=
document
.
querySelectorAll
(
"
.show-permissions
"
);
},
},
addHandlers
:
function
(
page
)
{
addHandlers
:
function
(
page
)
{
/**
/**
* This function is used to get clicked element role id and return required result
* This function is used to get clicked element role id and return required result
*/
*/
...
@@ -222,8 +222,8 @@ var Backend = {}; // common variable used in all the files of the backend
...
@@ -222,8 +222,8 @@ var Backend = {}; // common variable used in all the files of the backend
this
.
selectors
.
select2
.
select2
();
this
.
selectors
.
select2
.
select2
();
},
},
windowloadhandler
:
function
()
{
windowloadhandler
:
function
()
{
// scripts to be handeled on user create and edit when window is laoaded
// scripts to be handeled on user create and edit when window is laoaded
Backend
.
Users
.
selectors
.
showPermission
.
forEach
(
function
(
element
)
{
Backend
.
Users
.
selectors
.
showPermission
.
forEach
(
function
(
element
)
{
element
.
onclick
=
function
(
event
)
{
element
.
onclick
=
function
(
event
)
{
...
@@ -244,14 +244,14 @@ var Backend = {}; // common variable used in all the files of the backend
...
@@ -244,14 +244,14 @@ var Backend = {}; // common variable used in all the files of the backend
};
};
});
});
}
}
},
},
/**
/**
* Users delete page
* Users delete page
*
*
*/
*/
UserDeleted
:
{
UserDeleted
:
{
selectors
:{
selectors
:
{
AlldeletePerms
:
document
.
querySelectorAll
(
"
a[name='delete_user_perm']
"
),
AlldeletePerms
:
document
.
querySelectorAll
(
"
a[name='delete_user_perm']
"
),
AllrestorePerms
:
document
.
querySelectorAll
(
"
a[name='restore_user']
"
),
AllrestorePerms
:
document
.
querySelectorAll
(
"
a[name='restore_user']
"
),
Areyousure
:
""
,
Areyousure
:
""
,
...
@@ -260,63 +260,63 @@ var Backend = {}; // common variable used in all the files of the backend
...
@@ -260,63 +260,63 @@ var Backend = {}; // common variable used in all the files of the backend
cancel
:
""
,
cancel
:
""
,
restore_user_confirm
:
""
,
restore_user_confirm
:
""
,
},
},
setSelectors
:
function
()
{
setSelectors
:
function
()
{
this
.
selectors
.
AlldeletePerms
=
document
.
querySelectorAll
(
"
a[name='delete_user_perm']
"
);
this
.
selectors
.
AlldeletePerms
=
document
.
querySelectorAll
(
"
a[name='delete_user_perm']
"
);
this
.
selectors
.
AllrestorePerms
=
document
.
querySelectorAll
(
"
a[name='restore_user']
"
);
this
.
selectors
.
AllrestorePerms
=
document
.
querySelectorAll
(
"
a[name='restore_user']
"
);
},
},
windowloadhandler
:
function
()
{
windowloadhandler
:
function
()
{
this
.
setSelectors
();
this
.
setSelectors
();
/*
/*
deleted page showing the swal when click on peremenenant delition
deleted page showing the swal when click on peremenenant delition
*/
*/
this
.
selectors
.
AlldeletePerms
.
forEach
(
function
(
element
)
{
this
.
selectors
.
AlldeletePerms
.
forEach
(
function
(
element
)
{
element
.
onclick
=
function
(
event
)
{
element
.
onclick
=
function
(
event
)
{
event
.
preventDefault
();
event
.
preventDefault
();
var
linkURL
=
this
.
getAttribute
(
"
href
"
);
var
linkURL
=
this
.
getAttribute
(
"
href
"
);
swal
({
swal
({
title
:
Backend
.
UserDeleted
.
selectors
.
Areyousure
,
title
:
Backend
.
UserDeleted
.
selectors
.
Areyousure
,
text
:
Backend
.
UserDeleted
.
selectors
.
delete_user_confirm
,
text
:
Backend
.
UserDeleted
.
selectors
.
delete_user_confirm
,
type
:
"
warning
"
,
type
:
"
warning
"
,
showCancelButton
:
true
,
showCancelButton
:
true
,
confirmButtonColor
:
"
#DD6B55
"
,
confirmButtonColor
:
"
#DD6B55
"
,
confirmButtonText
:
Backend
.
UserDeleted
.
selectors
.
continue
,
confirmButtonText
:
Backend
.
UserDeleted
.
selectors
.
continue
,
cancelButtonText
:
Backend
.
UserDeleted
.
selectors
.
cancel
,
cancelButtonText
:
Backend
.
UserDeleted
.
selectors
.
cancel
,
closeOnConfirm
:
false
closeOnConfirm
:
false
},
function
(
isConfirmed
)
{
},
function
(
isConfirmed
)
{
if
(
isConfirmed
)
{
if
(
isConfirmed
)
{
window
.
location
.
href
=
linkURL
;
window
.
location
.
href
=
linkURL
;
}
}
});
});
};
};
});
});
/**
/**
* deleted user page handeler for user restore
* deleted user page handeler for user restore
*/
*/
this
.
selectors
.
AllrestorePerms
.
forEach
(
function
(
element
)
{
this
.
selectors
.
AllrestorePerms
.
forEach
(
function
(
element
)
{
element
.
onclick
=
function
(
event
,
element
)
{
element
.
onclick
=
function
(
event
,
element
)
{
event
.
preventDefault
();
event
.
preventDefault
();
var
linkURL
=
this
.
getAttribute
(
"
href
"
);
var
linkURL
=
this
.
getAttribute
(
"
href
"
);
swal
({
swal
({
title
:
Backend
.
UserDeleted
.
selectors
.
Areyousure
,
title
:
Backend
.
UserDeleted
.
selectors
.
Areyousure
,
text
:
Backend
.
UserDeleted
.
selectors
.
restore_user_confirm
,
text
:
Backend
.
UserDeleted
.
selectors
.
restore_user_confirm
,
type
:
"
warning
"
,
type
:
"
warning
"
,
showCancelButton
:
true
,
showCancelButton
:
true
,
confirmButtonColor
:
"
#DD6B55
"
,
confirmButtonColor
:
"
#DD6B55
"
,
confirmButtonText
:
Backend
.
UserDeleted
.
selectors
.
continue
,
confirmButtonText
:
Backend
.
UserDeleted
.
selectors
.
continue
,
cancelButtonText
:
Backend
.
UserDeleted
.
selectors
.
cancel
,
cancelButtonText
:
Backend
.
UserDeleted
.
selectors
.
cancel
,
closeOnConfirm
:
false
closeOnConfirm
:
false
},
function
(
isConfirmed
)
{
},
function
(
isConfirmed
)
{
if
(
isConfirmed
)
{
if
(
isConfirmed
)
{
window
.
location
.
href
=
linkURL
;
window
.
location
.
href
=
linkURL
;
}
}
});
});
};
};
});
});
}
}
},
},
/**
/**
* Blog
* Blog
...
...
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