Skip to content
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

Fix: Spelling mistake of $date['id']; references to unlock instead of mod; varchar length #59

Merged
merged 3 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ASP/frontend/modules/gamedata/Gamedata.php
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ public function postAddMod()
{
case 'add':
$pdo->insert('game_mod', $data);
$date['id'] = $pdo->lastInsertId('id');
$data['id'] = $pdo->lastInsertId('id');
$data['success'] = true;
$data['mode'] = 'add';
$data['status_badge'] = ($data['authorized']) ? 'success' : 'important';
Expand All @@ -632,4 +632,4 @@ public function postAddMod()
die;
}
}
}
}
64 changes: 32 additions & 32 deletions src/ASP/frontend/modules/gamedata/js/game_mods.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
}

/**
* nameRegex : specifies the characters allowed in an unlock name
* nameRegex : specifies the characters allowed in a mod name
*/
$.validator.addMethod("nameRegex", function(value, element) {
return this.optional(element) || /^[a-z0-9_]+$/i.test(value);
}, "Unlock name must contain only letters, numbers, or underscores.");
}, "Mod name must contain only letters, numbers, or underscores.");

// Data Table
var Table = $(".mws-datatable-fn").DataTable({
Expand All @@ -40,12 +40,12 @@
rules: {
shortName: {
required: true,
maxlength: 32,
maxlength: 24,
nameRegex: true
},
longName: {
required: true,
maxlength: 64
maxlength: 48
}
},
invalidHandler: function (form, validator) {
Expand Down Expand Up @@ -113,7 +113,7 @@
// noinspection JSJQueryEfficiency
$("#mws-validate").ajaxForm({
data: { ajax: true },
beforeSubmit: function ()
beforeSubmit: function ()
{
$('#mws-validate-error').hide();
$('#jui-message').attr('class', 'alert loading').html("Submitting form data...").slideDown(200);
Expand All @@ -124,36 +124,36 @@
// Parse the JSON response
var result = jQuery.parseJSON(response);
if (result.success === true) {
var id = result.id;
var rowNode;

if (result.mode === 'add') {
// Add award to table
//noinspection JSUnresolvedFunction
rowNode = Table.row.add([
result.id,
result.name,
result.longname,
'<span id="status-' + id + '" class="badge badge-' + result.status_badge + '}">' + result.status_text + '</span>',
'<span class="btn-group"> \
<a id="edit-' + id + '" href="#" rel="tooltip" title="Edit Details" class="btn btn-small"><i class="icon-pencil"></i></a> \
</span>'
]).draw().node();

$( rowNode ).attr('id', 'tr-unlock-' + id);
}
else if (result.mode === 'edit') {
selectedRowNode.find('td:eq(0)').html(result.id);
selectedRowNode.find('td:eq(1)').html(result.name);
selectedRowNode.find('td:eq(2)').html(result.longname);
$('span#status-' + id).attr('class', 'badge badge-' + result.status_badge).html(result.status_text);
}

var id = result.id;
var rowNode;
if (result.mode === 'add') {
// Add mod to table
//noinspection JSUnresolvedFunction
rowNode = Table.row.add([
result.id,
result.name,
result.longname,
'<span id="status-' + id + '" class="badge badge-' + result.status_badge + '}">' + result.status_text + '</span>',
'<span class="btn-group"> \
<a id="edit-' + id + '" href="#" rel="tooltip" title="Edit Details" class="btn btn-small"><i class="icon-pencil"></i></a> \
</span>'
]).draw().node();

$(rowNode).attr('id', 'tr-mod-' + id);
}
else if (result.mode === 'edit') {
selectedRowNode.find('td:eq(0)').html(result.id);
selectedRowNode.find('td:eq(1)').html(result.name);
selectedRowNode.find('td:eq(2)').html(result.longname);
$('span#status-' + id).attr('class', 'badge badge-' + result.status_badge).html(result.status_text);
}
// Close dialog
$("#editor-form").dialog("close");
}
else {
$('#jui-message').attr('class', 'alert error').html(result.message);
$('#jui-message').attr('class', 'alert error').html(result.message);
}
},
error: function(request, status, error) {
Expand Down Expand Up @@ -232,4 +232,4 @@

});

}) (jQuery, window, document);
}) (jQuery, window, document);