Giter Site home page Giter Site logo

joshinat0r / cockpitcms-moderation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pauloamgomes/cockpitcms-moderation

0.0 0.0 0.0 17 KB

Moderation Addon for Cockpit CMS

License: MIT License

PHP 47.97% CSS 3.79% JavaScript 3.47% Hack 44.77%

cockpitcms-moderation's Introduction

Cockpit CMS Moderation Addon

This addon extends Cockpit CMS core functionality by introducing the possibility to have moderation of collections. It means that its possible to create collections with a status (Unpublished, Draft or Published) affecting the way that entries are retrieved:

  • Unpublished - Any collection entry in unpublished state will be filtered out.
  • Draft - Any collection entry in Draft that doesn't have a previous revision in published status will be also filtered out. If there is a previous revision with published status the revision will be returned instead. However on a scenario that we have a published > unpublished > draft sequence no entry will be returned.
  • Published - They are always returned.

Installation

  1. Confirm that you have Cockpit CMS (Next branch) installed and working.
  2. Download zip and extract to 'your-cockpit-docroot/addons' (e.g. cockpitcms/addons/Moderation, the addon folder name must be Moderation)
  3. Edit one collection and confirm that you have a new field type (Moderation).
  4. Access addon settings page (http://your-cockpit-site/settings/moderation) and confirm that page loads.

Configuration

To use the main functionality of the addon no extra configuration is required. To use the preview mode (Draft entries will be also returned) is required to configure an API key on the addon settings page. You can use the moderation api key in your requests like:

http://your-cockpit-site/api/collections/get/<name>?token=<api-key>&previewToken=<moderation-api-key>

Permissions

There is only one permission (manage) that can be used to manage addon settings page.

Usage

Add a new field to your collection of type Moderation:

Moderation Field

And when editing a collection that is using that field a moderation section will be displaye in the sidebar:

Draft mode Change status

You can name whatever you want for your moderation field, e.g. status, moderation, etc.. But you need to keep in mind if you change the field later you may need to manually update all existing collection entries.

Demo

Moderation Addon

Force drafts for a specific user group

If you want to deny a user group the right to publish/unpublish entries, then provide moderation.forceDraft for the group in question.

Groups with this var wont get a dropdown for the moderation status, they get the fake-entry-aside.php-view in the sidebar.

'groups' => [
  'contributor' => [
    ...
    '$vars' => [
      'moderation.forceDraft' => true
    ],
    ...
  ]
],

Copyright and license

Copyright 2018 pauloamgomes under the MIT license.

cockpitcms-moderation's People

Contributors

pauloamgomes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.