Skip to content

Strapi plugin that provides a drag and droppable menu for ordering content types in a somewhat userfriendly way.

Notifications You must be signed in to change notification settings

Robinrrr/strapi-drag-drop-content-type-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Strapi plugin drag-drop-content-types

drag-drop-preview

⚠ Important

This plugin might NOT behave like you expect. Since Strapi does not allow to fully access all page components, the content itself cannot be drag-and-dropped. Instead this plugin adds a panel, which allow sort content via drag-and-drop. This is not a very intuitive way, but might be better than nothing...

⏳ Installation

# with npm
npm i @retikolo/drag-drop-content-types
# with yarn
yarn add @retikolo/drag-drop-content-types

🔧 Configuration

In your config

  1. Add this to your config/plugins.js file (create it, if it doesn't exist yet):
module.exports = {
  // ...
  'drag-drop-content-types': {
    enabled: true
  }
}
  1. Run npm run build and (re)start the app

In the app

Go to Settings -> Drag Drop Content Type -> Configuration:

  • Specify how the rank field and the corresponding title field are called in your content types. Default value are rank and title.
  • Add the specified fields to your content type. With the default values this would be title (Text (Type: Short Text)) and rank (Number (Number format: integer))
  • You will be rewared with the drag-dropable menu in the list view of all content types having the specified fields.
  • (Recommendation: Add "Default sort attribute" rank, "Default sort order" ASC and remove the rank attribute from the view using "Configure the view" button.)

In your frontend

Assuming you go with the default settings, you can make a request on the following url to get the ordered items:

http://localhost:1337/api/foo?sort=rank:asc

🤝 Contribute

Feel free to fork and make pull requests to this plugin. All input is welcome!

About

Strapi plugin that provides a drag and droppable menu for ordering content types in a somewhat userfriendly way.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%