Skip to content

Commit

Permalink
removed extraneous code
Browse files Browse the repository at this point in the history
  • Loading branch information
Meleeman01 committed Jun 25, 2019
1 parent fc42284 commit 4b6df33
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions laravel/resources/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,6 @@ $(document).ready(function()

});

//A variable here to store previous form data.
var prevData = [];
$('.user-roles input').each(function()
{
if($(this).prop('checked'))
{
prevData.push($(this).value());
}
});

// Display save / cancel buttons when changing user roles
$('.user-roles input').on('change', function()
{
Expand All @@ -68,7 +58,6 @@ $(document).ready(function()

$('.save-roles').on('click', function()
{
prevData = [];
var user = $('.user-id').value();
var role = $('.user-role').value();
var csrf = $('.csrf-token').value();
Expand Down Expand Up @@ -96,23 +85,7 @@ $(document).ready(function()

$('.cancel-roles').on('click', function()
{
$('.user-role').value($('.user-role').data('role'));
$('.buttons').attr('style', false);

//pull data array from earlier and assign the values based on prevData
$('.user-roles input').each(function(self)
{
self = $(this);
self.prop('checked',false);

prevData.forEach(function(el)
{
if (self.value() === el)
{
self.prop('checked',true);
}
});
});
window.history.back();
});

$('.save-upload').on('click', function()
Expand Down

0 comments on commit 4b6df33

Please sign in to comment.