Skip to content

Commit

Permalink
Added export button to lists (#22)
Browse files Browse the repository at this point in the history
* added export button to lists

* fixed style-ci and travis php memory_limit
  • Loading branch information
wachterjohannes authored and alexander-schranz committed Mar 1, 2018
1 parent c9d8c48 commit a733dc5
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 6 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ matrix:
- CODE_COVERAGE="--coverage-clover=coverage.clover"

before_install:
- phpenv config-add Tests/travis.php.ini
- composer self-update

install:
Expand Down
1 change: 1 addition & 0 deletions Admin/CommentAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
class CommentAdmin extends Admin
{
const COMMENT_SECURITY_CONTEXT = 'sulu.comment.comments';

const THREAD_SECURITY_CONTEXT = 'sulu.comment.threads';

/**
Expand Down
2 changes: 2 additions & 0 deletions Controller/CommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,11 @@ public function postTriggerAction($id, Request $request)
switch ($action) {
case 'unpublish':
$commentManager->unpublish($comment);

break;
case 'publish':
$commentManager->publish($comment);

break;
default:
throw new RestException('Unrecognized action: ' . $action);
Expand Down
4 changes: 2 additions & 2 deletions Controller/WebsiteCommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function cgetCommentsAction($threadId, Request $request)
$page ? 20 : null
);

if ($request->getRequestFormat() === 'json') {
if ('json' === $request->getRequestFormat()) {
return $this->handleView($this->view($comments));
}

Expand Down Expand Up @@ -101,7 +101,7 @@ public function postCommentsAction($threadId, Request $request)

$this->get('doctrine.orm.entity_manager')->flush();

if ($request->getRequestFormat() === 'json') {
if ('json' === $request->getRequestFormat()) {
return $this->handleView($this->view($comment));
}

Expand Down
2 changes: 1 addition & 1 deletion Entity/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function unpublish()
*/
public function isPublished()
{
return $this->state === self::STATE_PUBLISHED;
return self::STATE_PUBLISHED === $this->state;
}

/**
Expand Down
1 change: 1 addition & 0 deletions Entity/CommentInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
interface CommentInterface
{
const STATE_UNPUBLISHED = 0;

const STATE_PUBLISHED = 1;

/**
Expand Down
4 changes: 4 additions & 0 deletions Events/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,23 @@
final class Events
{
const PRE_PERSIST_EVENT = 'sulu_comment.pre_persist';

const POST_PERSIST_EVENT = 'sulu_comment.post_persist';

const PRE_DELETE_EVENT = 'sulu_comment.pre_delete';

const POST_DELETE_EVENT = 'sulu_comment.post_delete';

const PRE_UPDATE_EVENT = 'sulu_comment.pre_update';

const PUBLISH_EVENT = 'sulu_comment.publish';

const UNPUBLISH_EVENT = 'sulu_comment.unpublish';

const THREAD_PRE_UPDATE_EVENT = 'sulu_comment.thread.pre_update';

const THREAD_PRE_DELETE_EVENT = 'sulu_comment.thread.pre_delete';

const THREAD_POST_DELETE_EVENT = 'sulu_comment.thread.post_delete';

/**
Expand Down
2 changes: 1 addition & 1 deletion Resources/public/dist/components/comments/list/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Resources/public/dist/components/threads/list/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Resources/public/js/components/comments/list/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ define([
);
}.bind(this)
}
},
export: {
options: {
url: '/admin/api/comments.csv'
}
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions Resources/public/js/components/threads/list/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ define([
);
}.bind(this)
}
},
export: {
options: {
url: '/admin/api/threads.csv'
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function registerBundles()
parent::registerBundles()
);

if ($this->getContext() !== self::CONTEXT_ADMIN) {
if (self::CONTEXT_ADMIN !== $this->getContext()) {
$bundles[] = new \FOS\RestBundle\FOSRestBundle();
}

Expand Down
1 change: 1 addition & 0 deletions Tests/travis.php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
memory_limit = 4G

0 comments on commit a733dc5

Please sign in to comment.