-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/3.4.1' into v3.0
- Loading branch information
Showing
8 changed files
with
152 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 12 additions & 4 deletions
16
ressources/views/quotes/partials/moderationButtons.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,27 @@ | ||
<!-- Approve --> | ||
<div class="col-xs-1"> | ||
<span class="badge quote-moderation" data-id="{{{ $quote->id }}}" data-url="{{{ URL::route('admin.quotes.moderate', [$quote->id, 'approve']) }}}" data-decision="approve"><i class="fa fa-thumbs-up"></i></span> | ||
<span class="badge quote-moderation" data-id="{{{ $quote->id }}}" data-url="{{{ URL::route('admin.quotes.moderate', [$quote->id, 'approve']) }}}" data-decision="approve"> | ||
<i class="fa fa-thumbs-up"></i> | ||
</span> | ||
</div> | ||
|
||
<!-- Unapprove --> | ||
<div class="col-xs-1"> | ||
<span class="badge quote-moderation" data-id="{{{ $quote->id }}}" data-url="{{{ URL::route('admin.quotes.moderate', [$quote->id, 'unapprove']) }}}" data-decision="unapprove"><i class="fa fa-thumbs-down"></i></span> | ||
<span class="badge quote-moderation" data-id="{{{ $quote->id }}}" data-url="{{{ URL::route('admin.quotes.moderate', [$quote->id, 'unapprove']) }}}" data-decision="unapprove"> | ||
<i class="fa fa-thumbs-down"></i> | ||
</span> | ||
</div> | ||
|
||
<!-- Edit --> | ||
<div class="col-xs-1"> | ||
<a href="{{ URL::route('admin.quotes.edit', array($quote->id)); }}" class="badge"><i class="fa fa-pencil-square-o"></i></a> | ||
<a href="{{ URL::route('admin.quotes.edit', array($quote->id)); }}" class="badge admin__quote__edit-button"> | ||
<i class="fa fa-pencil-square-o"></i> | ||
</a> | ||
</div> | ||
|
||
<!-- Alert sad content --> | ||
<div class="col-xs-1"> | ||
<span class="badge quote-moderation" data-id="{{{ $quote->id }}}" data-url="{{{ URL::route('admin.quotes.moderate', [$quote->id, 'alert']) }}}" data-decision="alert"><i class="fa fa-warning"></i></span> | ||
<span class="badge quote-moderation" data-id="{{{ $quote->id }}}" data-url="{{{ URL::route('admin.quotes.moderate', [$quote->id, 'alert']) }}}" data-decision="alert"> | ||
<i class="fa fa-warning"></i> | ||
</span> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
use TeenQuotes\AdminPanel\Helpers\Moderation; | ||
use TeenQuotes\Quotes\Models\Quote; | ||
|
||
class EditWaitingQuoteCest { | ||
|
||
/** | ||
* The admin user | ||
* @var \TeenQuotes\Users\Models\User | ||
*/ | ||
private $admin; | ||
|
||
/** | ||
* @var \FunctionalTester | ||
*/ | ||
private $tester; | ||
|
||
/** | ||
* The number of quotes created, by approved type | ||
* @var array | ||
*/ | ||
private $nbQuotes; | ||
|
||
/** | ||
* Quotes that are waiting to be published | ||
* @var array | ||
*/ | ||
private $waitingQuotes; | ||
|
||
public function _before(FunctionalTester $I) | ||
{ | ||
$this->tester = $I; | ||
|
||
$this->nbQuotes = [ | ||
'pending' => 7, | ||
'waiting' => 26, | ||
]; | ||
|
||
$I->createSomePublishedQuotes(); | ||
$this->waitingQuotes = $I->createSomeWaitingQuotes(['nb_quotes' => $this->nbQuotes['waiting']]); | ||
$I->createSomePendingQuotes(['nb_quotes' => $this->nbQuotes['pending']]); | ||
|
||
$this->admin = $I->logANewUser(['security_level' => 1]); | ||
} | ||
|
||
public function editQuoteWaitingForModeration(FunctionalTester $I) | ||
{ | ||
$I->am("a Teen Quotes' administrator"); | ||
$I->wantTo('edit and publish a quote waiting to be moderated'); | ||
|
||
// Go to the admin panel | ||
$I->navigateToTheAdminPanel(); | ||
|
||
$quote = $this->waitingQuotes[0]; | ||
$I->seeModerationButtonsForQuote($quote); | ||
|
||
// Click the edit button and fill the form | ||
$newContent = str_repeat('abc', 20); | ||
$this->editContentOfQuote($quote, $newContent); | ||
} | ||
|
||
private function editContentOfQuote(Quote $quote, $newContent) | ||
{ | ||
$this->tester->clickEditButtonFor($quote); | ||
$this->tester->fillNewContentWaitingQuoteForm($newContent); | ||
$this->tester->seeSuccessFlashMessage('The quote has been edited and approved!'); | ||
$this->tester->seeQuoteIsPending($quote); | ||
$this->tester->seeAuthorOfQuoteHasBeenWarnedOfApproval($quote); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters