-
Notifications
You must be signed in to change notification settings - Fork 309
Delete slide button in the Table #303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a27fe50
deleteIcon
0fbb53e
deleteSlide-Addition
fe4d12c
trailingCommaAdd
1dc2384
Update apps/table.html
akhil-rana 3b71d82
Update apps/table.html
akhil-rana 2ac3607
Update apps/table.html
akhil-rana e2fa49e
Update apps/table.html
akhil-rana bf758ef
Update apps/table.html
akhil-rana 8824dbc
Update apps/table.html
akhil-rana ba1f4f7
Merge branch 'develop' into deleteSlide
akhil-rana 60afa88
fix-comma
d30a566
Delete_According_to_User_Permissions
16690f0
Merge branch 'develop' into deleteSlide
akhil-rana File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -222,6 +222,26 @@ <h3 class="text-center h3 mb-0">Available Slides</h3> | |
|
||
</div> | ||
|
||
|
||
<!--Delete Modal --> | ||
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteModalLabel" aria-hidden="true"> | ||
<div class="modal-dialog" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title" id="deleteModalLabel">Delete confirmation</h5> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body" id="confirmDeleteContent"></div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button> | ||
<button type="button" id='confirmDelete' data-dismiss="modal" class="btn btn-danger">Yes</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="text-center text-white bg-dark p-3" style="position: static;bottom: 0;width: 100%;"> | ||
<p class="p">Copyright © 2020 caMicroscope</p> | ||
</div> | ||
|
@@ -306,8 +326,9 @@ <h3 class="text-center h3 mb-0">Available Slides</h3> | |
else if (!d[key]) rs.push('') | ||
else rs.push(d[key]) | ||
}); | ||
const btn = `<button class="btn btn-success" data-id='${rs[0]}' onclick='openView(this)'>Open</button>` | ||
const btn = `<div id='open-delete'> <button class="btn btn-success" data-id='${rs[0]}' onclick='openView(this)'>Open</button> <button type='button' class='btn btn-danger DelButton' id='deleteBtn' data-id='${rs[0]}' data-name='${rs[1]}' onclick='deleteSld(this)' data-toggle='modal'> <i class='fas fa-trash-alt' ></i> </button></div>` | ||
rs.push(btn); | ||
checkUserPermissions(); | ||
return rs; | ||
}); | ||
} else { | ||
|
@@ -459,7 +480,42 @@ <h3 class="text-center h3 mb-0">Available Slides</h3> | |
alert('No Data Id'); | ||
} | ||
} | ||
//window.addEventListener('resize', ()=>{$('#datatables').stacktable()}); | ||
|
||
$(document).ready(function(){ | ||
checkUserPermissions(); | ||
$('#deleteModal').on('hidden.bs.modal', function (e) { | ||
initialize(); | ||
}); | ||
}); | ||
function checkUserPermissions(){ | ||
let userType=getUserType(); | ||
let permissions; | ||
getUserPermissions(userType).then(function(response){ | ||
return response.json(); | ||
}).then(function(data) { | ||
// console.log(data); | ||
permissions = data; | ||
if(permissions.slide.delete == true) | ||
$(".DelButton").css("display","block"); | ||
}); | ||
} | ||
function deleteSld(e) { | ||
const oid = e.dataset.id; | ||
const oname = e.dataset.name; | ||
const store = new Store('../data/'); | ||
if (oid) { | ||
$('#confirmDeleteContent').html(`Are you sure you want to delete the slide ${oname} with id ${oid} ?`); | ||
$('#deleteModal').modal('toggle'); | ||
akhil-rana marked this conversation as resolved.
Show resolved
Hide resolved
|
||
$("#confirmDelete").unbind( "click" ); | ||
$("#confirmDelete").click(function(){ | ||
store.deleteSlide(oid); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Akhil I have implemented the same but here it returns a promise so, you can check if data.result.ok is 1 then initialize the table. |
||
}); | ||
} else { | ||
alert('No Data Id'); | ||
} | ||
} | ||
|
||
|
||
document.addEventListener('DOMContentLoaded', initialize); | ||
</script> | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.