Browse Source

fix queue management when loading/unloading scoreboard interface

master
Aaron Parecki 6 years ago
parent
commit
017cad621e
No known key found for this signature in database GPG Key ID: 276C2817346D6056
3 changed files with 28 additions and 46 deletions
  1. +16
    -30
      public/js/app.js
  2. +3
    -1
      resources/assets/js/components/Scorecard.vue
  3. +9
    -15
      resources/assets/js/components/TweetQueue.vue

+ 16
- 30
public/js/app.js View File

@ -46550,29 +46550,23 @@ module.exports = {
removeTweetFromQueue: function removeTweetFromQueue(tweet_id) {
var queueIndex = this.findTweetInQueue(tweet_id);
if (queueIndex !== false) {
console.log("Removing item at index " + queueIndex);
var removed = this.queue.splice(queueIndex, 1);
return removed[0];
}
},
clickedTweet: function clickedTweet(event) {
var tweet_id;
if ($(event.target).data('tweet-id')) {
tweet_id = $(event.target).data('tweet-id');
} else {
tweet_id = $(event.target).parents(".tweet").data('tweet-id');
}
var tweet_data = this.removeTweetFromQueue(tweet_id);
clickedTweet: function clickedTweet(tweet_index) {
// var tweet_data = this.removeTweetFromQueue(tweet_id);
var tweet_data = this.queue[tweet_index];
var tweet_id = tweet_data.tweet_id;
if (tweet_data) {
console.log(tweet_data);
// Mark this as claimed
$.post('/dashboard/claim-tweet', {
tweet_id: tweet_id
}, function (response) {});
this.removeTweetFromQueue(tweet_id);
// Load in the scorecard viewer
this.tweet = tweet_data;
this.show = true;
@ -46581,7 +46575,7 @@ module.exports = {
}
},
dismissTweet: function dismissTweet() {
console.log('caught event');
this.queue.push(this.tweet);
// Mark as un-claimed
$.post('/dashboard/claim-tweet', {
@ -46615,20 +46609,16 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
staticClass: "panel-heading"
}, [_vm._v("Queue")]), _vm._v(" "), _c('div', {
staticClass: "panel-body tweet-queue"
}, _vm._l((_vm.queue), function(tweet) {
}, _vm._l((_vm.queue), function(tweet, index) {
return _c('div', {
staticClass: "tweet",
attrs: {
"data-tweet-id": tweet.tweet_id
},
on: {
"click": _vm.clickedTweet
"click": function($event) {
_vm.clickedTweet(index)
}
}
}, [_c('div', {
staticClass: "mission",
attrs: {
"data-mission-id": tweet.mission_id
}
staticClass: "mission"
}, [_vm._v(_vm._s(tweet.mission))]), _vm._v(" "), _c('div', {
staticClass: "profile"
}, [_c('img', {
@ -46707,13 +46697,7 @@ module.exports = Component.exports
/***/ (function(module, exports, __webpack_require__) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.show),
expression: "show"
}],
return (_vm.show) ? _c('div', {
staticClass: "panel panel-default scorecard"
}, [_c('div', {
staticClass: "panel-heading"
@ -46777,7 +46761,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
staticClass: "multi-photo-clear"
})]], 2) : _vm._e()])]), _vm._v(" "), _c('div', {
staticClass: "col-md-4"
}, [_c('div', [_vm._v(_vm._s(_vm.tweet.mission))])])])])])
}, [_c('div', [_vm._v(_vm._s(_vm.tweet.mission))])])])])]) : _vm._e()
},staticRenderFns: []}
module.exports.render._withStripped = true
if (false) {
@ -46791,6 +46775,8 @@ if (false) {
/* 61 */
/***/ (function(module, exports) {
//
//
//
//
//

+ 3
- 1
resources/assets/js/components/Scorecard.vue View File

@ -1,5 +1,5 @@
<template>
<div class="panel panel-default scorecard" v-show="show">
<div class="panel panel-default scorecard" v-if="show">
<div class="panel-heading">
<div class="team">
<span class="team-icon" :style="'background-color: #'+tweet.team_color"></span>
@ -45,6 +45,8 @@
</div>
</div>

+ 9
- 15
resources/assets/js/components/TweetQueue.vue View File

@ -6,8 +6,8 @@
<div class="panel-heading">Queue</div>
<div class="panel-body tweet-queue">
<div v-for="tweet in queue" v-on:click="clickedTweet" class="tweet" :data-tweet-id="tweet.tweet_id">
<div class="mission" :data-mission-id="tweet.mission_id">{{ tweet.mission }}</div>
<div v-for="(tweet, index) in queue" v-on:click="clickedTweet(index)" class="tweet">
<div class="mission">{{ tweet.mission }}</div>
<div class="profile">
<img :src="tweet.player_photo" :style="'border-color: #'+tweet.team_color">
<span>@{{ tweet.player_username }}</span>
@ -64,30 +64,24 @@ module.exports = {
removeTweetFromQueue(tweet_id) {
var queueIndex = this.findTweetInQueue(tweet_id);
if(queueIndex !== false) {
console.log("Removing item at index "+queueIndex);
var removed = this.queue.splice(queueIndex, 1);
return removed[0];
}
},
clickedTweet(event) {
var tweet_id;
if($(event.target).data('tweet-id')) {
tweet_id = $(event.target).data('tweet-id')
} else {
tweet_id = $(event.target).parents(".tweet").data('tweet-id');
}
var tweet_data = this.removeTweetFromQueue(tweet_id);
clickedTweet(tweet_index) {
// var tweet_data = this.removeTweetFromQueue(tweet_id);
var tweet_data = this.queue[tweet_index];
var tweet_id = tweet_data.tweet_id;
if(tweet_data) {
console.log(tweet_data);
// Mark this as claimed
$.post('/dashboard/claim-tweet', {
tweet_id: tweet_id
}, function(response) {
});
this.removeTweetFromQueue(tweet_id);
// Load in the scorecard viewer
this.tweet = tweet_data;
this.show = true;
@ -97,7 +91,7 @@ module.exports = {
}
},
dismissTweet() {
console.log('caught event')
this.queue.push(this.tweet);
// Mark as un-claimed
$.post('/dashboard/claim-tweet', {

Loading…
Cancel
Save