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
86b59510
Commit
86b59510
authored
Feb 23, 2018
by
cygnet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes for show and hiiden on user page
parent
8652f11c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
192 additions
and
114 deletions
+192
-114
.gitignore
.gitignore
+0
-1
script.js
public/js/backend/access/users/script.js
+21
-17
admin.js
public/js/backend/admin.js
+170
-94
webpack.mix.js
webpack.mix.js
+1
-2
No files found.
.gitignore
View file @
86b59510
...
@@ -24,7 +24,6 @@ yarn-error.log
...
@@ -24,7 +24,6 @@ yarn-error.log
phpunit.txt
phpunit.txt
public/css
public/css
public/js/*.js
public/js/*.js
public/js/plugins
public/js/plugins
public/js/skins
public/js/skins
public/js/themes
public/js/themes
...
...
public/js/backend/access/users/script.js
View file @
86b59510
$
(
function
()
{
window
.
onload
=
function
()
{
$
(
"
.show-permissions
"
).
click
(
function
(
e
)
{
document
.
querySelectorAll
(
"
.show-permissions
"
).
forEach
(
function
(
element
){
e
.
preventDefault
();
element
.
onclick
=
function
(
event
){
var
$this
=
$
(
this
);
event
.
preventDefault
();
var
role
=
$this
.
data
(
'
role
'
);
var
$this
=
this
;
var
permissions
=
$
(
"
.permission-list[data-role='
"
+
role
+
"
']
"
);
var
role
=
$this
.
getAttribute
(
"
data-role
"
);
var
hideText
=
$this
.
find
(
'
.hide-text
'
);
var
showText
=
$this
.
find
(
'
.show-text
'
);
var
permissions
=
document
.
querySelector
(
"
.permission-list[data-role='
"
+
role
+
"
']
"
);
// console.log(permissions); // for debugging
var
hideText
=
$this
.
querySelector
(
'
.hide-text
'
);
var
showText
=
$this
.
querySelector
(
'
.show-text
'
);
// show permission list
// show permission list
permissions
.
toggleClass
(
'
hidden
'
);
Backend
.
Utils
.
toggleClass
(
permissions
,
'
hidden
'
);
// toggle the text Show/Hide for the link
// toggle the text Show/Hide for the link
hideText
.
toggleClass
(
'
hidden
'
);
Backend
.
Utils
.
toggleClass
(
hideText
,
'
hidden
'
);
showText
.
toggleClass
(
'
hidden
'
);
Backend
.
Utils
.
toggleClass
(
showText
,
'
hidden
'
);
};
});
});
});
};
public/js/backend/admin.js
View file @
86b59510
var
Backend
=
{
//common functionalities for all the javascript featueres
var
Backend
=
{};
// common variable used in all the files of the backend
(
function
()
{
Backend
=
{
Utils
:{
toggleClass
:
function
(
element
,
className
){
if
(
element
.
classList
)
{
element
.
classList
.
toggle
(
className
);
}
else
{
var
classes
=
element
.
className
.
split
(
'
'
);
var
existingIndex
=
classes
.
indexOf
(
className
);
if
(
existingIndex
>=
0
)
classes
.
splice
(
existingIndex
,
1
);
else
classes
.
push
(
className
);
element
.
className
=
classes
.
join
(
'
'
);
}
}
},
/**
/**
* Pages
* Pages
...
@@ -20,21 +42,24 @@ var Backend = {
...
@@ -20,21 +42,24 @@ var Backend = {
Access
:
Access
:
{
{
selectors
:
{
selectors
:
{
select2
:
jQuery
(
"
.select2
"
),
select2
:
$
(
"
.select2
"
),
},
},
init
:
function
()
init
:
function
()
{
{
this
.
setSelectors
();
this
.
addHandlers
();
this
.
addHandlers
();
},
},
setSelectors
:
function
(){
this
.
selectors
.
select2
=
$
(
"
.select2
"
);
},
addHandlers
:
function
()
addHandlers
:
function
()
{
{
this
.
selectors
.
select2
.
select2
();
this
.
selectors
.
select2
.
select2
();
}
}
},
},
/**
/**
* Blog
* Blog
*
*
...
@@ -42,18 +67,24 @@ var Backend = {
...
@@ -42,18 +67,24 @@ var Backend = {
Blog
:
Blog
:
{
{
selectors
:
{
selectors
:
{
tags
:
jQuery
(
"
.tags
"
),
tags
:
document
.
querySelector
(
"
.tags
"
),
categories
:
jQuery
(
"
.categories
"
),
categories
:
document
.
querySelector
(
"
.categories
"
),
toDisplay
:
jQuery
(
"
.toDisplay
"
),
toDisplay
:
document
.
querySelector
(
"
.toDisplay
"
),
status
:
jQuery
(
"
.status
"
),
status
:
document
.
querySelector
(
"
.status
"
),
},
},
init
:
function
()
init
:
function
()
{
{
this
.
setSelectors
();
this
.
addHandlers
();
this
.
addHandlers
();
Backend
.
tinyMCE
.
init
();
Backend
.
tinyMCE
.
init
();
},
},
setSelectors
:
function
(){
tags
=
document
.
querySelector
(
"
.tags
"
);
categories
=
document
.
querySelector
(
"
.categories
"
);
toDisplay
=
document
.
querySelector
(
"
.toDisplay
"
);
status
=
document
.
querySelector
(
"
.status
"
);
},
addHandlers
:
function
()
addHandlers
:
function
()
{
{
this
.
selectors
.
tags
.
select2
({
this
.
selectors
.
tags
.
select2
({
...
@@ -117,7 +148,7 @@ var Backend = {
...
@@ -117,7 +148,7 @@ var Backend = {
emailTemplate
:
{
emailTemplate
:
{
selectors
:
{
selectors
:
{
emailtemplateSelection
:
jQuery
(
"
.select2
"
)
emailtemplateSelection
:
document
.
querySelector
(
"
.select2
"
)
},
},
init
:
function
()
{
init
:
function
()
{
...
@@ -147,8 +178,10 @@ var Backend = {
...
@@ -147,8 +178,10 @@ var Backend = {
// ! Backend.emailTemplate.showPreview
// ! Backend.emailTemplate.showPreview
showPreview
:
function
(
event
)
{
showPreview
:
function
(
event
)
{
jQuery
(
"
.modal-body
"
).
html
(
tinyMCE
.
get
(
'
txtBody
'
).
getContent
());
$
(
"
.model-wrapper
"
).
modal
(
'
show
'
);
document
.
querySelector
(
"
.modal-body
"
).
innerHTML
=
tinyMCE
.
get
(
'
txtBody
'
).
getContent
();
document
.
querySelector
(
"
.modal-body
"
).
modal
(
'
show
'
);
},
},
},
},
...
@@ -173,22 +206,22 @@ var Backend = {
...
@@ -173,22 +206,22 @@ var Backend = {
}
}
},
},
/**
/**
* Profile
* Profile
*
*
*/
*/
Profile
:
Profile
:
{
{
selectors
:
{
state
:
jQuery
(
"
.st
"
),
cities
:
jQuery
(
"
.ct
"
),
},
init
:
function
()
init
:
function
()
{
{
this
.
setSelectors
();
this
.
addHandlers
();
this
.
addHandlers
();
},
},
setSelectors
:
function
(){
this
.
selectors
.
state
=
document
.
querySelector
(
"
.st
"
);
this
.
selectors
.
cities
=
document
.
querySelector
(
"
.ct
"
);
},
addHandlers
:
function
()
addHandlers
:
function
()
{
{
this
.
selectors
.
state
.
select2
();
this
.
selectors
.
state
.
select2
();
...
@@ -196,72 +229,115 @@ var Backend = {
...
@@ -196,72 +229,115 @@ var Backend = {
}
}
},
},
DataTableSearch
:
{
/**
* for all datatables
*
*/
DataTableSearch
:
{
//functionalities related to datable search at all the places
selector
:{
},
init
:
function
(
dataTable
)
{
init
:
function
(
dataTable
)
{
// Header All search columns
this
.
setSelectors
();
$
(
"
div.dataTables_filter input
"
).
unbind
();
this
.
addHandlers
();
$
(
"
div.dataTables_filter input
"
).
keypress
(
function
(
e
)
{
},
if
(
e
.
keyCode
==
13
)
setSelectors
:
function
(){
{
this
.
selector
.
searchInput
=
document
.
querySelector
(
"
div.dataTables_filter input
"
);
this
.
selector
.
columnSearchInput
=
document
.
querySelectorAll
(
"
.search-input-text
"
);
this
.
selector
.
columnSelectInput
=
document
.
querySelectorAll
(
'
search-input-select
'
);
this
.
selector
.
restButton
=
document
.
querySelectorAll
(
'
.reset-data
'
);
this
.
setSelectors
.
copyButton
=
document
.
getElementById
(
"
copyButton
"
);
this
.
setSelectors
.
csvButton
=
document
.
getElementById
(
"
csvButton
"
);
this
.
setSelectors
.
excelButton
=
document
.
getElementById
(
"
excelButton
"
);
this
.
setSelectors
.
pdfButton
=
document
.
getElementById
(
"
pdfButton
"
);
this
.
setSelectors
.
printButton
=
document
.
getElementById
(
"
printButton
"
);
},
cloneElement
:
function
(
element
,
callback
){
var
clone
=
element
.
cloneNode
();
while
(
element
.
firstChild
)
{
clone
.
appendChild
(
element
.
lastChild
);
}
element
.
parentNode
.
replaceChild
(
clone
,
element
);
Backend
.
DataTableSearch
.
setSelectors
();
callback
(
this
.
selector
.
searchInput
);
},
addHandlers
:
function
(){
// get the datatable search input and on its key press check if we hit enter then search with datatable
this
.
cloneElement
(
this
.
selector
.
searchInput
,
function
(
element
){
//cloning done to remove any binding of the events
element
.
onkeypress
=
function
(
event
){
if
(
event
.
keyCode
==
13
){
dataTable
.
fnFilter
(
this
.
value
);
dataTable
.
fnFilter
(
this
.
value
);
}
}
});
};
});
// to remove all the listinerers
// Individual columns search
$
(
'
.search-input-text
'
).
on
(
'
keypress
'
,
function
(
e
)
{
// for text boxes
// for text boxes
if
(
e
.
keyCode
==
13
)
//column input search if search box on the column of the datatable given with enter then search with datatable
{
if
(
this
.
selector
.
columnSearchInput
.
length
>
0
){
var
i
=
$
(
this
).
attr
(
'
data-column
'
);
// getting column index
this
.
selector
.
columnSearchInput
.
forEach
(
function
(
element
){
var
v
=
$
(
this
).
val
();
// getting search input value
element
.
onkeypress
=
function
(
event
){
if
(
event
.
keyCode
==
13
){
var
i
=
element
.
getAttribute
(
"
data-column
"
)
// getting column index
var
v
=
element
.
value
;
// getting search input value
dataTable
.
api
().
columns
(
i
).
search
(
v
).
draw
();
dataTable
.
api
().
columns
(
i
).
search
(
v
).
draw
();
}
}
};
});
});
}
// Individual columns search
// Individual columns search
$
(
'
.search-input-select
'
).
on
(
'
change
'
,
function
(
e
)
{
if
(
this
.
selector
.
columnSelectInput
.
length
>>
0
){
// for dropdown
this
.
selector
.
columnSelectInput
.
forEach
(
function
(
element
){
var
i
=
$
(
this
).
attr
(
'
data-column
'
);
// getting column index
element
.
onchange
=
function
(
event
){
var
v
=
$
(
this
).
val
();
// getting search input value
var
i
=
element
.
getAttribute
(
"
data-column
"
);
// getting column index
var
v
=
element
.
value
;
// getting search input value
dataTable
.
api
().
columns
(
i
).
search
(
v
).
draw
();
dataTable
.
api
().
columns
(
i
).
search
(
v
).
draw
();
};
});
});
}
// Individual columns reset
// Individual columns reset
$
(
'
.reset-data
'
).
on
(
'
click
'
,
function
(
e
)
{
if
(
this
.
selector
.
restButton
.
length
>>
0
){
var
textbox
=
$
(
this
).
prev
(
'
input
'
);
// Getting closest input field
this
.
selector
.
restButton
.
forEach
(
function
(
element
){
var
i
=
textbox
.
attr
(
'
data-column
'
);
// Getting column index
element
.
onclick
=
function
(
event
){
$
(
this
).
prev
(
'
input
'
).
val
(
''
);
// Blank the serch value
var
inputelement
=
this
.
previousElementSibling
;
var
i
=
inputelement
.
getAttribute
(
"
data-column
"
);
inputelement
.
value
=
""
;
dataTable
.
api
().
columns
(
i
).
search
(
""
).
draw
();
dataTable
.
api
().
columns
(
i
).
search
(
""
).
draw
();
};
});
});
}
//Copy button
this
.
setSelectors
.
copyButton
.
onclick
=
function
(
element
){
$
(
'
#copyButton
'
).
click
(
function
(){
document
.
querySelector
(
"
.copyButton
"
).
click
();
$
(
'
.copyButton
'
).
trigger
(
'
click
'
);
};
});
this
.
setSelectors
.
csvButton
.
onclick
=
function
(
element
){
//Download csv
document
.
querySelector
(
"
.csvButton
"
).
click
();
$
(
'
#csvButton
'
).
click
(
function
(){
};
$
(
'
.csvButton
'
).
trigger
(
'
click
'
);
this
.
setSelectors
.
excelButton
.
onclick
=
function
(
element
){
});
document
.
querySelector
(
"
.excelButton
"
).
click
();
//Download excelButton
};
$
(
'
#excelButton
'
).
click
(
function
(){
this
.
setSelectors
.
pdfButton
.
onclick
=
function
(
element
){
$
(
'
.excelButton
'
).
trigger
(
'
click
'
);
document
.
querySelector
(
"
.pdfButton
"
).
click
();
});
};
//Download pdf
this
.
setSelectors
.
printButton
.
onclick
=
function
(
element
){
$
(
'
#pdfButton
'
).
click
(
function
(){
document
.
querySelector
(
"
.printButton
"
).
click
();
$
(
'
.pdfButton
'
).
trigger
(
'
click
'
);
};
});
}
//Download printButton
$
(
'
#printButton
'
).
click
(
function
(){
$
(
'
.printButton
'
).
trigger
(
'
click
'
);
});
var
id
=
$
(
'
.table-responsive .dataTables_filter
'
).
attr
(
'
id
'
);
$
(
'
#
'
+
id
+
'
label
'
).
append
(
'
<a class="reset-data" id="input-sm-reset" href="javascript:void(0)"><i class="fa fa-times"></i></a>
'
);
$
(
document
).
on
(
'
click
'
,
"
#
"
+
id
+
"
label #input-sm-reset
"
,
function
(){
dataTable
.
fnFilter
(
''
);
});
},
}
}
}
};
\ No newline at end of file
})();
webpack.mix.js
View file @
86b59510
...
@@ -43,8 +43,7 @@ mix.sass('resources/assets/sass/frontend/app.scss', 'public/css/frontend.css')
...
@@ -43,8 +43,7 @@ mix.sass('resources/assets/sass/frontend/app.scss', 'public/css/frontend.css')
"
public/js/bootstrap-datetimepicker.min.js
"
,
"
public/js/bootstrap-datetimepicker.min.js
"
,
"
public/js/backend/custom-file-input.js
"
,
"
public/js/backend/custom-file-input.js
"
,
"
public/js/backend/notification.js
"
,
"
public/js/backend/notification.js
"
,
//"public/js/backend/admin.js"
"
public/js/backend/admin.js
"
"
public/js/backend/mainbackend.js
"
],
'
public/js/backend-custom.js
'
)
],
'
public/js/backend-custom.js
'
)
//Datatable js
//Datatable js
.
scripts
([
.
scripts
([
...
...
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