Skip to content

Commit

Permalink
fixing issues in boardgame app
Browse files Browse the repository at this point in the history
  • Loading branch information
Fake51 committed Mar 28, 2018
1 parent 990cd73 commit ae13185
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/models/boardgames_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ public function fetchActivityData()

public function createBoardgame(RequestVars $post)
{
if (!$post->name || !$post->owner || !$post->barcode) {
if (!$post->name || !$post->owner) {
throw new Exception('Missing data for boardgame creation');
}

Expand All @@ -439,6 +439,7 @@ public function createBoardgame(RequestVars $post)
$boardgame->barcode = $post->barcode;
$boardgame->designergame = intval($post->designergame);
$boardgame->comment = isset($post->comment) ? $post->comment : '';
$boardgame->bgg_id = isset($post->bgg_id) ? intval($post->bgg_id) : 0;

$boardgame->insert();

Expand Down
3 changes: 3 additions & 0 deletions include/templates/boardgames/overview.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ $this->includeCSS('bscafe.css');?>
<label for="gc-barcode">Stregkode</label>
<input type="text" id="gc-barcode" name="barcode" placeholder="Stregkode..."/>

<label for="gc-bgg-id">BGG ID</label>
<input type="text" id="gc-bgg-id" name="bgg_id" placeholder="BGG ID..."/>

<label for="gc-designergame">Fastaval</label>
<input type="checkbox" id="gc-designergame" name="designergame" value="1"/>

Expand Down
4 changes: 4 additions & 0 deletions public/js/bscafe.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ var BSCafe = (function ($, window) {
barcodeString = module.elements.$gcBarcode.val(),
designergameValue = module.elements.$gcDesignergame.prop('checked'),
commentString = module.elements.$gcComment.val(),
bggId = module.elements.$gcBggId.val(),
gameRegistered = function (data) {
var game = {
id: parseInt(data.id, 10),
Expand All @@ -531,6 +532,7 @@ var BSCafe = (function ($, window) {
module.elements.$gcOwner.val('');
module.elements.$gcBarcode.val('');
module.elements.$gcComment.val('');
module.elements.$gcBggId.val('');
module.elements.$gcDesignergame.prop('checked', false);

module.elements.$gamesTab.addClass('auto-highlight');
Expand All @@ -552,6 +554,7 @@ var BSCafe = (function ($, window) {
barcode: barcodeString,
designergame: designergameValue ? 1 : 0,
comment: commentString,
bgg_id: bggId,
},
success: gameRegistered,
error: function () {
Expand Down Expand Up @@ -846,6 +849,7 @@ var BSCafe = (function ($, window) {
module.elements.$gcBarcode = $('#gc-barcode');
module.elements.$gcDesignergame = $('#gc-designergame');
module.elements.$gcComment = $('#gc-comment');
module.elements.$gcBggId = $('#gc-bgg-id');
module.elements.$borrowingComment = $('#borrowing-comment');
module.elements.$inPlayList = $('div.in-play-list ul');
module.elements.$actionPane = $('div.action-pane');
Expand Down

0 comments on commit ae13185

Please sign in to comment.