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
bbdb73f9
Commit
bbdb73f9
authored
Feb 28, 2018
by
Viral Solani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- minor refactoring
- remove unwanted files
parent
cd8fd8b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
173 additions
and
450 deletions
+173
-450
admin.js
public/js/backend/admin.js
+173
-173
admin_old.js
public/js/backend/admin_old.js
+0
-277
No files found.
public/js/backend/admin.js
View file @
bbdb73f9
//common functionalities for all the javascript featueres
//common functionalities for all the javascript featueres
var
Backend
=
{};
// common variable used in all the files of the backend
var
Backend
=
{};
// common variable used in all the files of the backend
(
function
()
{
(
function
(){
Backend
=
{
Backend
=
{
Utils
:
{
Utils
:
{
...
@@ -59,7 +59,7 @@ var Backend = {}; // common variable used in all the files of the backend
...
@@ -59,7 +59,7 @@ var Backend = {}; // common variable used in all the files of the backend
data
=
this
.
jsontoformdata
(
data
);
data
=
this
.
jsontoformdata
(
data
);
}
}
// when request is in the ready state change the details or perform success function
// when request is in the ready state change the details or perform success function
request
.
onreadystatechange
=
function
()
{
request
.
onreadystatechange
=
function
()
{
if
(
request
.
readyState
===
XMLHttpRequest
.
DONE
)
{
if
(
request
.
readyState
===
XMLHttpRequest
.
DONE
)
{
// Everything is good, the response was received.
// Everything is good, the response was received.
...
@@ -87,7 +87,6 @@ var Backend = {}; // common variable used in all the files of the backend
...
@@ -87,7 +87,6 @@ var Backend = {}; // common variable used in all the files of the backend
return
urljson
;
return
urljson
;
},
},
},
},
/**
/**
...
@@ -95,16 +94,17 @@ var Backend = {}; // common variable used in all the files of the backend
...
@@ -95,16 +94,17 @@ var Backend = {}; // common variable used in all the files of the backend
*
*
*/
*/
Pages
:
Pages
:
{
{
init
:
function
()
{
init
:
function
()
{
Backend
.
tinyMCE
.
init
();
Backend
.
tinyMCE
.
init
();
},
},
},
},
/**
/**
* 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
"
),
...
@@ -149,108 +149,110 @@ var Backend = {}; // common variable used in all the files of the backend
...
@@ -149,108 +149,110 @@ var Backend = {}; // common variable used in all the files of the backend
*
*
*/
*/
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
*/
*/
this
.
selectors
.
getRoleForPermissions
.
forEach
(
function
(
element
)
{
this
.
selectors
.
getRoleForPermissions
.
forEach
(
function
(
element
)
{
element
.
onclick
=
function
(
event
)
{
element
.
onclick
=
function
(
event
)
{
callback
=
{
callback
=
{
success
:
function
(
request
)
{
success
:
function
(
request
)
{
if
(
request
.
status
>=
200
&&
request
.
status
<
400
)
{
if
(
request
.
status
>=
200
&&
request
.
status
<
400
)
{
// Success!
// Success!
var
response
=
JSON
.
parse
(
request
.
responseText
);
var
response
=
JSON
.
parse
(
request
.
responseText
);
var
permissions
=
response
.
permissions
;
var
permissions
=
response
.
permissions
;
var
rolePermissions
=
response
.
rolePermissions
;
var
rolePermissions
=
response
.
rolePermissions
;
var
allPermisssions
=
response
.
allPermissions
;
var
allPermisssions
=
response
.
allPermissions
;
Backend
.
Users
.
selectors
.
getAvailabelPermissions
.
innerHTML
=
""
;
Backend
.
Users
.
selectors
.
getAvailabelPermissions
.
innerHTML
=
""
;
htmlstring
=
""
;
htmlstring
=
""
;
if
(
permissions
.
length
==
0
)
{
if
(
permissions
.
length
==
0
)
{
Backend
.
Users
.
selectors
.
getAvailabelPermissions
.
innerHTML
=
'
<p>There are no available permissions.</p>
'
;
Backend
.
Users
.
selectors
.
getAvailabelPermissions
.
innerHTML
=
'
<p>There are no available permissions.</p>
'
;
}
else
{
}
else
{
for
(
var
key
in
permissions
)
{
for
(
var
key
in
permissions
)
{
var
addChecked
=
''
;
var
addChecked
=
''
;
if
(
allPermisssions
==
1
&&
rolePermissions
.
length
==
0
)
{
if
(
allPermisssions
==
1
&&
rolePermissions
.
length
==
0
)
{
addChecked
=
'
checked="checked"
'
;
}
else
{
if
(
typeof
rolePermissions
[
key
]
!==
"
undefined
"
)
{
addChecked
=
'
checked="checked"
'
;
addChecked
=
'
checked="checked"
'
;
}
else
{
if
(
typeof
rolePermissions
[
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
+
'
">
'
+
permissions
[
key
]
+
'
</label> <div class="control__indicator"></div> </label> <br>
'
;
}
}
htmlstring
+=
'
<label class="control control--checkbox"> <input type="checkbox" name="permissions[
'
+
key
+
'
]" value="
'
+
key
+
'
" id="perm_
'
+
key
+
'
"
'
+
addChecked
+
'
/> <label for="perm_
'
+
key
+
'
">
'
+
permissions
[
key
]
+
'
</label> <div class="control__indicator"></div> </label> <br>
'
;
}
}
Backend
.
Users
.
selectors
.
getAvailabelPermissions
.
innerHTML
=
htmlstring
;
Backend
.
Utils
.
removeClass
(
document
.
getElementById
(
"
available-permissions
"
),
'
hidden
'
);
}
else
{
// We reached our target server, but it returned an error
Backend
.
Users
.
selectors
.
getAvailabelPermissions
.
innerHTML
=
'
<p>There are no available permissions.</p>
'
;
}
}
},
Backend
.
Users
.
selectors
.
getAvailabelPermissions
.
innerHTML
=
htmlstring
;
error
:
function
()
{
Backend
.
Utils
.
removeClass
(
document
.
getElementById
(
"
available-permissions
"
),
'
hidden
'
);
}
else
{
// We reached our target server, but it returned an error
Backend
.
Users
.
selectors
.
getAvailabelPermissions
.
innerHTML
=
'
<p>There are no available permissions.</p>
'
;
Backend
.
Users
.
selectors
.
getAvailabelPermissions
.
innerHTML
=
'
<p>There are no available permissions.</p>
'
;
}
}
};
},
error
:
function
()
{
Backend
.
Users
.
selectors
.
getAvailabelPermissions
.
innerHTML
=
'
<p>There are no available permissions.</p>
'
;
}
};
Backend
.
Utils
.
ajaxrequest
(
Backend
.
Users
.
selectors
.
getPremissionURL
,
"
post
"
,
{
role_id
:
event
.
target
.
value
},
Backend
.
Utils
.
csrf
,
callback
);
Backend
.
Utils
.
ajaxrequest
(
Backend
.
Users
.
selectors
.
getPremissionURL
,
"
post
"
,
{
role_id
:
event
.
target
.
value
},
Backend
.
Utils
.
csrf
,
callback
);
}
});
if
(
page
==
"
create
"
)
{
Backend
.
Users
.
selectors
.
Role3
.
click
();
}
}
});
if
(
page
==
"
create
"
)
{
Backend
.
Users
.
selectors
.
Role3
.
click
();
}
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
)
{
event
.
preventDefault
();
event
.
preventDefault
();
var
$this
=
this
;
var
$this
=
this
;
var
role
=
$this
.
getAttribute
(
"
data-role
"
);
var
role
=
$this
.
getAttribute
(
"
data-role
"
);
var
permissions
=
document
.
querySelector
(
"
.permission-list[data-role='
"
+
role
+
"
']
"
);
var
permissions
=
document
.
querySelector
(
"
.permission-list[data-role='
"
+
role
+
"
']
"
);
var
hideText
=
$this
.
querySelector
(
'
.hide-text
'
);
var
hideText
=
$this
.
querySelector
(
'
.hide-text
'
);
var
showText
=
$this
.
querySelector
(
'
.show-text
'
);
var
showText
=
$this
.
querySelector
(
'
.show-text
'
);
// show permission list
// show permission list
Backend
.
Utils
.
toggleClass
(
permissions
,
'
hidden
'
);
Backend
.
Utils
.
toggleClass
(
permissions
,
'
hidden
'
);
// toggle the text Show/Hide for the link
Backend
.
Utils
.
toggleClass
(
hideText
,
'
hidden
'
);
Backend
.
Utils
.
toggleClass
(
showText
,
'
hidden
'
);
};
});
}
},
// toggle the text Show/Hide for the link
Backend
.
Utils
.
toggleClass
(
hideText
,
'
hidden
'
);
Backend
.
Utils
.
toggleClass
(
showText
,
'
hidden
'
);
};
});
}
},
/**
/**
* 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']
"
),
...
@@ -323,64 +325,65 @@ var Backend = {}; // common variable used in all the files of the backend
...
@@ -323,64 +325,65 @@ var Backend = {}; // common variable used in all the files of the backend
*
*
*/
*/
Blog
:
Blog
:
{
{
selectors
:
{
selectors
:
{
tags
:
jQuery
(
"
.tags
"
),
tags
:
jQuery
(
"
.tags
"
),
categories
:
jQuery
(
"
.categories
"
),
categories
:
jQuery
(
"
.categories
"
),
toDisplay
:
jQuery
(
"
.toDisplay
"
),
toDisplay
:
jQuery
(
"
.toDisplay
"
),
status
:
jQuery
(
"
.status
"
),
status
:
jQuery
(
"
.status
"
),
datetimepicker1
:
jQuery
(
"
#datetimepicker1
"
),
datetimepicker1
:
jQuery
(
"
#datetimepicker1
"
),
GenerateSlugUrl
:
""
,
GenerateSlugUrl
:
""
,
name
:
document
.
getElementById
(
"
name
"
),
name
:
document
.
getElementById
(
"
name
"
),
SlugUrl
:
""
,
SlugUrl
:
""
,
slug
:
document
.
getElementById
(
"
slug
"
),
slug
:
document
.
getElementById
(
"
slug
"
),
},
},
init
:
function
()
{
this
.
addHandlers
();
Backend
.
tinyMCE
.
init
();
},
addHandlers
:
function
()
{
this
.
selectors
.
tags
.
select2
({
tags
:
true
,
});
this
.
selectors
.
categories
.
select2
();
this
.
selectors
.
toDisplay
.
select2
();
this
.
selectors
.
status
.
select2
();
//For Blog datetimepicker for publish_datetime
init
:
function
()
{
this
.
selectors
.
datetimepicker1
.
datetimepicker
();
this
.
addHandlers
();
Backend
.
tinyMCE
.
init
();
},
// For generating the Slug //changing slug on blur event
addHandlers
:
function
()
{
this
.
selectors
.
name
.
onblur
=
function
(
event
)
{
url
=
event
.
target
.
value
;
if
(
url
!==
''
)
{
callback
=
{
success
:
function
(
request
)
{
if
(
request
.
status
>=
200
&&
request
.
status
<
400
)
{
// Success!
response
=
request
.
responseText
;
Backend
.
Blog
.
selectors
.
slug
.
value
=
Backend
.
Blog
.
selectors
.
SlugUrl
+
'
/
'
+
response
;
}
},
error
:
function
(
request
)
{
this
.
selectors
.
tags
.
select2
({
tags
:
true
,
});
this
.
selectors
.
categories
.
select2
();
this
.
selectors
.
toDisplay
.
select2
();
this
.
selectors
.
status
.
select2
();
//For Blog datetimepicker for publish_datetime
this
.
selectors
.
datetimepicker1
.
datetimepicker
();
// For generating the Slug //changing slug on blur event
this
.
selectors
.
name
.
onblur
=
function
(
event
)
{
url
=
event
.
target
.
value
;
if
(
url
!==
''
)
{
callback
=
{
success
:
function
(
request
)
{
if
(
request
.
status
>=
200
&&
request
.
status
<
400
)
{
// Success!
response
=
request
.
responseText
;
Backend
.
Blog
.
selectors
.
slug
.
value
=
Backend
.
Blog
.
selectors
.
SlugUrl
+
'
/
'
+
response
;
}
}
};
},
Backend
.
Utils
.
ajaxrequest
(
Backend
.
Blog
.
selectors
.
GenerateSlugUrl
,
"
post
"
,
{
text
:
url
},
Backend
.
Utils
.
csrf
,
callback
);
error
:
function
(
request
)
{
}
};
}
}
},
};
Backend
.
Utils
.
ajaxrequest
(
Backend
.
Blog
.
selectors
.
GenerateSlugUrl
,
"
post
"
,
{
text
:
url
},
Backend
.
Utils
.
csrf
,
callback
);
}
};
}
},
/**
/**
* Tiny MCE
* Tiny MCE
*/
*/
tinyMCE
:
{
tinyMCE
:
{
init
:
function
()
{
init
:
function
()
{
tinymce
.
init
({
tinymce
.
init
({
path_absolute
:
"
/
"
,
path_absolute
:
"
/
"
,
...
@@ -426,7 +429,8 @@ var Backend = {}; // common variable used in all the files of the backend
...
@@ -426,7 +429,8 @@ var Backend = {}; // common variable used in all the files of the backend
}
}
},
},
emailTemplate
:
{
emailTemplate
:
{
selectors
:
{
selectors
:
{
emailtemplateSelection
:
document
.
querySelector
(
"
.select2
"
)
emailtemplateSelection
:
document
.
querySelector
(
"
.select2
"
)
...
@@ -472,7 +476,7 @@ var Backend = {}; // common variable used in all the files of the backend
...
@@ -472,7 +476,7 @@ var Backend = {}; // common variable used in all the files of the backend
*
*
*/
*/
Faq
:
Faq
:
{
{
selectors
:
selectors
:
{
{
},
},
...
@@ -484,43 +488,43 @@ var Backend = {}; // common variable used in all the files of the backend
...
@@ -484,43 +488,43 @@ var Backend = {}; // common variable used in all the files of the backend
addHandlers
:
function
()
{
addHandlers
:
function
()
{
}
}
},
},
/**
/**
* Profile
* Profile
*
*
*/
*/
Profile
:
Profile
:
{
{
selectors
:
{
selectors
:
{
},
init
:
function
()
{
this
.
setSelectors
();
this
.
addHandlers
();
},
setSelectors
:
function
()
{
this
.
selectors
.
state
=
document
.
querySelector
(
"
.st
"
);
},
this
.
selectors
.
cities
=
document
.
querySelector
(
"
.ct
"
);
init
:
function
()
{
},
this
.
setSelectors
();
addHandlers
:
function
()
{
this
.
addHandlers
();
if
(
this
.
selectors
.
state
!=
null
)
{
},
this
.
selectors
.
state
.
select2
();
setSelectors
:
function
()
{
}
if
(
this
.
selectors
.
cities
!=
null
)
{
this
.
selectors
.
cities
.
select2
();
}
}
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
();
}
}
},
/**
/**
* for all datatables
* for all datatables
*
*
*/
*/
DataTableSearch
:
{
//functionalities related to datable search at all the places
DataTableSearch
:
{
//functionalities related to datable search at all the places
selector
:
{
selector
:
{
},
},
...
@@ -559,10 +563,10 @@ var Backend = {}; // common variable used in all the files of the backend
...
@@ -559,10 +563,10 @@ var Backend = {}; // common variable used in all the files of the backend
dataTable
.
fnFilter
(
this
.
value
);
dataTable
.
fnFilter
(
this
.
value
);
}
}
};
};
});
// to remove all the listinerers
});
// to remove all the listinerers
// for text boxes
// for text boxes
//column input search if search box on the column of the datatable given with enter then search with datatable
//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
)
{
if
(
this
.
selector
.
columnSearchInput
.
length
>
0
)
{
this
.
selector
.
columnSearchInput
.
forEach
(
function
(
element
)
{
this
.
selector
.
columnSearchInput
.
forEach
(
function
(
element
)
{
element
.
onkeypress
=
function
(
event
)
{
element
.
onkeypress
=
function
(
event
)
{
...
@@ -618,7 +622,8 @@ var Backend = {}; // common variable used in all the files of the backend
...
@@ -618,7 +622,8 @@ var Backend = {}; // common variable used in all the files of the backend
},
},
Settings
:
{
Settings
:
{
selectors
:
{
selectors
:
{
RouteURL
:
""
,
RouteURL
:
""
,
setting
:
document
.
getElementById
(
"
setting
"
)
setting
:
document
.
getElementById
(
"
setting
"
)
...
@@ -678,12 +683,7 @@ var Backend = {}; // common variable used in all the files of the backend
...
@@ -678,12 +683,7 @@ var Backend = {}; // common variable used in all the files of the backend
}
}
}
}
};
};
})();
})();
...
...
public/js/backend/admin_old.js
deleted
100755 → 0
View file @
cd8fd8b9
var
Backend
=
{
/**
* Pages
*
*/
Pages
:
{
init
:
function
()
{
Backend
.
tinyMCE
.
init
();
},
},
/**
* Access management
*
*/
Access
:
{
selectors
:
{
select2
:
jQuery
(
"
.select2
"
),
},
init
:
function
()
{
this
.
addHandlers
();
},
addHandlers
:
function
()
{
this
.
selectors
.
select2
.
select2
();
}
},
/**
* Blog
*
*/
Blog
:
{
selectors
:
{
tags
:
jQuery
(
"
.tags
"
),
categories
:
jQuery
(
"
.categories
"
),
toDisplay
:
jQuery
(
"
.toDisplay
"
),
status
:
jQuery
(
"
.status
"
),
},
init
:
function
()
{
this
.
addHandlers
();
Backend
.
tinyMCE
.
init
();
},
addHandlers
:
function
()
{
this
.
selectors
.
tags
.
select2
({
tags
:
true
,
});
this
.
selectors
.
categories
.
select2
();
this
.
selectors
.
toDisplay
.
select2
();
this
.
selectors
.
status
.
select2
();
}
},
/**
* Tiny MCE
*/
tinyMCE
:
{
init
:
function
()
{
tinymce
.
init
({
path_absolute
:
"
/
"
,
selector
:
'
textarea
'
,
height
:
200
,
width
:
725
,
theme
:
'
modern
'
,
plugins
:
[
'
advlist autolink lists link image charmap print preview hr anchor pagebreak
'
,
'
searchreplace wordcount visualblocks visualchars code fullscreen
'
,
'
insertdatetime nonbreaking save table contextmenu directionality
'
,
'
emoticons template paste textcolor colorpicker textpattern imagetools codesample toc
'
],
toolbar1
:
'
undo redo | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image
'
,
// toolbar2: 'print preview media | forecolor backcolor emoticons | codesample',
image_advtab
:
true
,
relative_urls
:
false
,
file_browser_callback
:
function
(
field_name
,
url
,
type
,
win
)
{
var
x
=
window
.
innerWidth
||
document
.
documentElement
.
clientWidth
||
document
.
getElementsByTagName
(
'
body
'
)[
0
].
clientWidth
;
var
y
=
window
.
innerHeight
||
document
.
documentElement
.
clientHeight
||
document
.
getElementsByTagName
(
'
body
'
)[
0
].
clientHeight
;
var
cmsURL
=
"
/
"
+
'
laravel-filemanager?field_name=
'
+
field_name
;
if
(
type
==
'
image
'
)
{
cmsURL
=
cmsURL
+
"
&type=Images
"
;
}
else
{
cmsURL
=
cmsURL
+
"
&type=Files
"
;
}
tinyMCE
.
activeEditor
.
windowManager
.
open
({
file
:
cmsURL
,
title
:
'
Filemanager
'
,
width
:
x
*
0.8
,
height
:
y
*
0.8
,
resizable
:
"
yes
"
,
close_previous
:
"
no
"
});
},
content_css
:
[
'
//fonts.googleapis.com/css?family=Lato:300,300i,400,400i
'
,
'
//www.tinymce.com/css/codepen.min.css
'
]
});
}
},
emailTemplate
:
{
selectors
:
{
emailtemplateSelection
:
jQuery
(
"
.select2
"
)
},
init
:
function
()
{
Backend
.
emailTemplate
.
addHandlers
();
Backend
.
tinyMCE
.
init
();
},
// ! Backend.emailTemplate.addHandlers
addHandlers
:
function
()
{
// to add placeholder in to active textarea
$
(
"
#addPlaceHolder
"
).
on
(
'
click
'
,
function
(
event
)
{
Backend
.
emailTemplate
.
addPlaceHolder
(
event
);
});
$
(
"
#showPreview
"
).
on
(
'
click
'
,
function
(
event
)
{
Backend
.
emailTemplate
.
showPreview
(
event
);
});
this
.
selectors
.
emailtemplateSelection
.
select2
();
},
// ! Backend.emailTemplate.addPlaceHolder
addPlaceHolder
:
function
(
event
)
{
var
placeHolder
=
$
(
'
#placeHolder
'
).
val
();
if
(
placeHolder
!=
''
)
{
tinymce
.
activeEditor
.
execCommand
(
'
mceInsertContent
'
,
false
,
"
[
"
+
$
(
'
#placeHolder :selected
'
).
text
()
+
"
]
"
);
}
},
// ! Backend.emailTemplate.showPreview
showPreview
:
function
(
event
)
{
jQuery
(
"
.modal-body
"
).
html
(
tinyMCE
.
get
(
'
txtBody
'
).
getContent
());
$
(
"
.model-wrapper
"
).
modal
(
'
show
'
);
},
},
/**
* Faq
*
*/
Faq
:
{
selectors
:
{
},
init
:
function
()
{
// this.addHandlers();
Backend
.
tinyMCE
.
init
();
},
addHandlers
:
function
()
{
}
},
/**
* Profile
*
*/
Profile
:
{
selectors
:
{
state
:
jQuery
(
"
.st
"
),
cities
:
jQuery
(
"
.ct
"
),
},
init
:
function
()
{
this
.
addHandlers
();
},
addHandlers
:
function
()
{
this
.
selectors
.
state
.
select2
();
this
.
selectors
.
cities
.
select2
();
}
},
DataTableSearch
:
{
//selector for datatable filters inputs
Selectors
:{
searchInputFiled
:
document
.
querySelector
(
"
div.dataTables_filter input
"
),
},
//function used for initialize the search inputs given on the datatable
init
:
function
(
dataTable
)
{
// Header All search columns
$
(
"
div.dataTables_filter input
"
).
unbind
();
$
(
"
div.dataTables_filter input
"
).
keypress
(
function
(
e
)
{
if
(
e
.
keyCode
==
13
)
{
dataTable
.
fnFilter
(
this
.
value
);
}
});
// Individual columns search
$
(
'
.search-input-text
'
).
on
(
'
keypress
'
,
function
(
e
)
{
// for text boxes
if
(
e
.
keyCode
==
13
)
{
var
i
=
$
(
this
).
attr
(
'
data-column
'
);
// getting column index
var
v
=
$
(
this
).
val
();
// getting search input value
dataTable
.
api
().
columns
(
i
).
search
(
v
).
draw
();
}
});
// Individual columns search
$
(
'
.search-input-select
'
).
on
(
'
change
'
,
function
(
e
)
{
// for dropdown
var
i
=
$
(
this
).
attr
(
'
data-column
'
);
// getting column index
var
v
=
$
(
this
).
val
();
// getting search input value
dataTable
.
api
().
columns
(
i
).
search
(
v
).
draw
();
});
// Individual columns reset
$
(
'
.reset-data
'
).
on
(
'
click
'
,
function
(
e
)
{
var
textbox
=
$
(
this
).
prev
(
'
input
'
);
// Getting closest input field
var
i
=
textbox
.
attr
(
'
data-column
'
);
// Getting column index
$
(
this
).
prev
(
'
input
'
).
val
(
''
);
// Blank the serch value
dataTable
.
api
().
columns
(
i
).
search
(
""
).
draw
();
});
//Copy button
$
(
'
#copyButton
'
).
click
(
function
(){
$
(
'
.copyButton
'
).
trigger
(
'
click
'
);
});
//Download csv
$
(
'
#csvButton
'
).
click
(
function
(){
$
(
'
.csvButton
'
).
trigger
(
'
click
'
);
});
//Download excelButton
$
(
'
#excelButton
'
).
click
(
function
(){
$
(
'
.excelButton
'
).
trigger
(
'
click
'
);
});
//Download pdf
$
(
'
#pdfButton
'
).
click
(
function
(){
$
(
'
.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
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