Browse Source

enable rejecting tweets

master
Aaron Parecki 6 years ago
parent
commit
1581bb83e3
No known key found for this signature in database GPG Key ID: 276C2817346D6056
5 changed files with 62 additions and 7 deletions
  1. +19
    -0
      app/Http/Controllers/DashboardController.php
  2. +22
    -3
      public/js/app.js
  3. +14
    -3
      resources/assets/js/components/Scorecard.vue
  4. +5
    -1
      resources/assets/js/components/TweetQueue.vue
  5. +2
    -0
      routes/web.php

+ 19
- 0
app/Http/Controllers/DashboardController.php View File

@ -65,6 +65,25 @@ class DashboardController extends Controller
return response()->json(['result'=>'ok']);
}
public function reject_tweet(Request $request) {
$tweet = Tweet::where('id', $request->input('tweet_id'))->first();
if($tweet) {
$tweet->processed = 1;
$tweet->m1_transit_line_id = null;
$tweet->m1_non_trimet = null;
$tweet->m2_transit_center_id = null;
$tweet->m2_with_other_team = 0;
$tweet->m3_complete = null;
$tweet->m4_complete = null;
$tweet->m5_complete = null;
$tweet->m5_tip = null;
$tweet->m6_complete = null;
$tweet->m7_document_id = null;
$tweet->save();
}
return response()->json(['result'=>'ok']);
}
public function load_dropdowns() {
$documents = DB::table('m7_documents')->orderBy('id')->get();
$transit_centers = DB::table('transit_centers')->orderBy('name')->get();

+ 22
- 3
public/js/app.js View File

@ -46599,6 +46599,10 @@ module.exports = {
status: 'unclaimed'
}, function (response) {});
this.tweet = {};
this.show = false;
},
rejectTweet: function rejectTweet() {
this.tweet = {};
this.show = false;
}
@ -46657,7 +46661,8 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
"update:show": function($event) {
_vm.show = $event
},
"dismiss": _vm.dismissTweet
"dismiss": _vm.dismissTweet,
"reject": _vm.rejectTweet
}
})], 1)])])
},staticRenderFns: []}
@ -46815,6 +46820,9 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
staticClass: "btn btn-danger",
attrs: {
"type": "button"
},
on: {
"click": _vm.rejectTweet
}
}, [_vm._v("Reject")])])]), _vm._v(" "), _c('div', {
staticClass: "col-md-4"
@ -47271,14 +47279,25 @@ module.exports = {
}
},
methods: {
dismiss: function dismiss() {
this.$emit('dismiss');
clearState: function clearState() {
this.selectedDocument = false;
this.selectedTransitCenter = false;
this.selectedTransitLine = false;
this.selectedNonTrimetLine = '';
this.selectedPhotoHasAnotherTeam = false;
this.replyText = '';
},
dismiss: function dismiss() {
this.clearState();
this.$emit('dismiss');
},
rejectTweet: function rejectTweet() {
$.post("/dashboard/reject-tweet", {
tweet_id: this.tweet.tweet_id
}, function () {
this.clearState();
this.$emit('reject');
}.bind(this));
}
},
watch: {

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

@ -39,7 +39,7 @@
<div class="tweet-actions">
<button type="button" class="btn btn-success" :disabled="isAcceptDisabled">Accept</button>
<button type="button" class="btn btn-danger">Reject</button>
<button type="button" class="btn btn-danger" v-on:click="rejectTweet">Reject</button>
</div>
</div>
@ -206,14 +206,25 @@ module.exports = {
}
},
methods: {
dismiss() {
this.$emit('dismiss');
clearState() {
this.selectedDocument = false;
this.selectedTransitCenter = false;
this.selectedTransitLine = false;
this.selectedNonTrimetLine = '';
this.selectedPhotoHasAnotherTeam = false;
this.replyText = '';
},
dismiss() {
this.clearState();
this.$emit('dismiss');
},
rejectTweet() {
$.post("/dashboard/reject-tweet", {
tweet_id: this.tweet.tweet_id
}, function() {
this.clearState();
this.$emit('reject');
}.bind(this));
}
},
watch: {

+ 5
- 1
resources/assets/js/components/TweetQueue.vue View File

@ -18,7 +18,7 @@
</div>
</div>
<div class="col-xs-8 col-md-8">
<scorecard :show.sync="show" :tweet="tweet" v-on:dismiss="dismissTweet"></scorecard>
<scorecard :show.sync="show" :tweet="tweet" v-on:dismiss="dismissTweet" v-on:reject="rejectTweet"></scorecard>
</div>
</div>
</div>
@ -116,6 +116,10 @@ module.exports = {
}, function(response){
});
this.tweet = {};
this.show = false;
},
rejectTweet() {
this.tweet = {};
this.show = false;
}

+ 2
- 0
routes/web.php View File

@ -22,6 +22,8 @@ Route::get('/dashboard/queue', 'DashboardController@queue')->name('queue');
Route::get('/dashboard/ping', 'DashboardController@ping');
Route::get('/dashboard/dropdowns', 'DashboardController@load_dropdowns');
Route::post('/dashboard/claim-tweet', 'DashboardController@claim_tweet');
Route::post('/dashboard/reject-tweet', 'DashboardController@reject_tweet');
Route::post('/dashboard/score-tweet', 'DashboardController@score_tweet');
Route::get('/teams', 'TeamController@index')->name('teams');
Route::post('/teams/new', 'TeamController@create_team');

Loading…
Cancel
Save