Unverified Commit cd8fd8b9 authored by Viral Solani's avatar Viral Solani Committed by GitHub

Merge pull request #148 from indranshastri/master

Changes for admin pannel javascript 
parents 26ec1dc7 ffa83bfd
This diff is collapsed.
This diff is collapsed.
......@@ -89,8 +89,8 @@
@section('after-scripts')
{{ Html::script('js/backend/access/roles/script.js') }}
<script type="text/javascript">
$(document).ready(function() {
Backend.Access.init();
Backend.Utils.documentReady(function(){
Backend.Roles.init("rolecreate")
});
</script>
@endsection
......@@ -74,10 +74,10 @@
@endsection
@section('after-scripts')
{{ Html::script('js/backend/access/roles/script.js') }}
<script type="text/javascript">
$(document).ready(function() {
Backend.Access.init();
Backend.Utils.documentReady(function(){
Backend.Roles.init("edit")
});
</script>
@endsection
\ No newline at end of file
......@@ -179,15 +179,18 @@
@endsection
@section('after-scripts')
{{ Html::script('js/backend/access/users/script.js') }}
<script type="text/javascript">
Backend.Utils.documentReady(function(){
csrf = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
Backend.Access.selectors.getPremissionURL = "{{ route('admin.get.permission') }}";
Backend.Access.init("create");
Backend.Users.selectors.getPremissionURL = "{{ route('admin.get.permission') }}";
Backend.Users.init("create");
});
window.onload = function () {
Backend.Users.windowloadhandler();
};
</script>
@endsection
......@@ -109,18 +109,19 @@
Backend.DataTableSearch.init(dataTable);
Backend.Access.selectors.Areyousure = "{{ trans('strings.backend.general.are_you_sure') }}";
Backend.Access.selectors.delete_user_confirm = "{{ trans('strings.backend.access.users.delete_user_confirm') }}";
Backend.Access.selectors.continue = "{{ trans('strings.backend.general.continue') }}";
Backend.Access.selectors.cancel ="{{ trans('buttons.general.cancel') }}";
Backend.Access.selectors.restore_user_confirm ="{{ trans('strings.backend.access.users.restore_user_confirm') }}";
Backend.UserDeleted.selectors.Areyousure = "{{ trans('strings.backend.general.are_you_sure') }}";
Backend.UserDeleted.selectors.delete_user_confirm = "{{ trans('strings.backend.access.users.delete_user_confirm') }}";
Backend.UserDeleted.selectors.continue = "{{ trans('strings.backend.general.continue') }}";
Backend.UserDeleted.selectors.cancel ="{{ trans('buttons.general.cancel') }}";
Backend.UserDeleted.selectors.restore_user_confirm ="{{ trans('strings.backend.access.users.restore_user_confirm') }}";
})();
window.onload = function(){
Backend.Access.windowloadhandler();
Backend.UserDeleted.windowloadhandler();
}
</script>
......
......@@ -104,7 +104,7 @@
@if (count($role->permissions) > 0)
<blockquote class="small">
@foreach ($role->permissions as $perm)
{{$perm->display_name}}
{{$perm->display_name}}<br/>
@endforeach
</blockquote>
@else
......@@ -164,114 +164,15 @@
@endsection
@section('after-scripts')
{{ 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 () {
$.ajax({
type: "POST",
url: "{{ route('admin.get.permission') }}",
dataType: "JSON",
data: {role_id: $(this).val()},
success: function (response) {
var p = response.permissions;
var q = response.rolePermissions;
var qAll = response.allPermissions;
$('.get-available-permissions').html('');
if (p.length == 0) {
('.get-available-permissions').html('<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"';
}
}
$('<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>').appendTo('.get-available-permissions');
}
}
$('#available-permissions').removeClass('hidden');
}
});
});
});
*/
Backend.Utils.documentReady(function(){
csrf = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
Backend.Access.selectors.getPremissionURL = "{{ route('admin.get.permission') }}";
Backend.Access.init("edit");
/*
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);
}
});
*/
Backend.Users.selectors.getPremissionURL = "{{ route('admin.get.permission') }}";
Backend.Users.init("edit");
});
window.onload = function () {
Backend.Users.windowloadhandler();
};
</script>
@endsection
......@@ -125,27 +125,10 @@
@section("after-scripts")
<script type="text/javascript">
Backend.Blog.init();
//For Blog datetimepicker for publish_datetime
$('#datetimepicker1').datetimepicker();
//changing slug on blur event
$("#name").on('blur',function()
{
url = $(this).val();
console.log(url);
if(url !== '')
{
$.ajax({
type:"POST",
url : "{{route('admin.generate.slug')}}",
data : {text:url },
success : function(data) {
$('#slug').val( "{{url('/')}}" + '/' + data);
}
});
}
});
Backend.Blog.selectors.GenerateSlugUrl = "{{route('admin.generate.slug')}}";
Backend.Blog.selectors.SlugUrl = "{{url('/')}}";
Backend.Blog.init();
</script>
@endsection
\ No newline at end of file
......@@ -243,6 +243,17 @@
@section('after-scripts')
<script src='/js/backend/bootstrap-tabcollapse.js'></script>
<script>
(function(){
Backend.Utils.csrf = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
Backend.Settings.selectors.RouteURL = "{{ route('admin.removeIcon', -1) }}";
Backend.Settings.init();
})();
window.load = function(){
}
/*
var route = "{{ route('admin.removeIcon', -1) }}";
var data_id = $('#setting').data('id');
......@@ -281,7 +292,8 @@
}
});
});
*/
$('#myTab').tabCollapse({
tabsClass: 'hidden-sm hidden-xs',
accordionClass: 'visible-sm visible-xs'
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment