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

Add implemented label #153

Merged
merged 1 commit into from Jan 23, 2018
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
13 changes: 13 additions & 0 deletions app/Http/Controllers/ForumController.php
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,19 @@ public function suggestionTopic($slug, $id)
return Redirect::route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])->with(Toastr::info('Label Change Has Been Applied', 'Info', ['options']));
}

public function implementedTopic($slug, $id)
{
$topic = Topic::findOrFail($id);
if ($topic->implemented == 0) {
$topic->implemented = "1";
} else {
$topic->implemented = "0";
}
$topic->save();

return Redirect::route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])->with(Toastr::info('Label Change Has Been Applied', 'Info', ['options']));
}

public function likePost($postId)
{
$post = Post::findOrFail($postId);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddImplementedToTopicsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('topics', function (Blueprint $table) {
$table->boolean("implemented")->default(0)->after("suggestion");
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('topics', function (Blueprint $table) {
//
});
}
}
1 change: 1 addition & 0 deletions resources/views/forum/display.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
@if($t->invalid == "1") <span class='label label-sm label-warning'>INVALID</span> @endif
@if($t->bug == "1") <span class='label label-sm label-danger'>BUG</span> @endif
@if($t->suggestion == "1") <span class='label label-sm label-primary'>SUGGESTION</span> @endif
@if($t->implemented == "1") <span class='label label-sm label-success'>IMPLEMENTED</span> @endif
</td>
<td class="f-display-topic-started"><a href="{{ route('profil', ['username' => $t->first_post_user_username, 'id' => $t->first_post_user_id]) }}">{{ $t->first_post_user_username }}</a></td>
<td class="f-display-topic-stats">
Expand Down
5 changes: 5 additions & 0 deletions resources/views/forum/topic.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@
@else
<a href="{{ route('forum_suggestion', ['slug' => $topic->slug, 'id' => $topic->id, ])}}" class='label label-sm label-primary'>Remove SUGGESTION</a>
@endif
@if($topic->implemented == "0")
<a href="{{ route('forum_implemented', ['slug' => $topic->slug, 'id' => $topic->id, ])}}" class='label label-sm label-success'>Add IMPLEMENTED</a>
@else
<a href="{{ route('forum_implemented', ['slug' => $topic->slug, 'id' => $topic->id, ])}}" class='label label-sm label-success'>Remove IMPLEMENTED</a>
@endif
@endif
</center>

Expand Down
1 change: 1 addition & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
Route::get('/topic/{slug}.{id}/invalid', 'ForumController@invalidTopic')->name('forum_invalid');
Route::get('/topic/{slug}.{id}/bug', 'ForumController@bugTopic')->name('forum_bug');
Route::get('/topic/{slug}.{id}/suggestion', 'ForumController@suggestionTopic')->name('forum_suggestion');
Route::get('/topic/{slug}.{id}/implemented', 'ForumController@implementedTopic')->name('forum_implemented');

// Like - Dislike System
Route::any('/like/post/{postId}', 'ForumController@likePost')->name('like');
Expand Down