@retikolo/drag-drop-content-types 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/admin/src/index.js +0 -20
- package/admin/src/pages/Settings/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,14 @@ Go to `Settings` -> `Drag Drop Content Type` -> `Configuration`:
|
|
|
36
36
|
* Specify how the rank field and the corresponding title field are called in your content types. Default value are `rank` and `title`.
|
|
37
37
|
* 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))
|
|
38
38
|
* You will be rewared with the drag-dropable menu in the list view of all content types having the specified fields.
|
|
39
|
+
* (Recommendation: Add "Default sort attribute" `rank`, "Default sort order" `ASC` and remove the `rank` attribute from the view using "Configure the view" button.)
|
|
40
|
+
|
|
41
|
+
### In your frontend
|
|
42
|
+
Assuming you go with the default settings, you can make a request on the following url to get the ordered items:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
http://localhost:1337/api/foo?sort=rank:asc
|
|
46
|
+
```
|
|
39
47
|
|
|
40
48
|
## 🤝 Contribute
|
|
41
|
-
Feel free to fork and make pull requests to this plugin. All
|
|
49
|
+
Feel free to fork and make pull requests to this plugin. All input is welcome!
|
package/admin/src/index.js
CHANGED
|
@@ -44,26 +44,6 @@ export default {
|
|
|
44
44
|
name: "sort-component",
|
|
45
45
|
Component: SortModal,
|
|
46
46
|
});
|
|
47
|
-
|
|
48
|
-
app.registerHook('Admin/CM/pages/ListView/inject-column-in-table', ({ displayedHeaders, layout }) => {
|
|
49
|
-
return {
|
|
50
|
-
layout,
|
|
51
|
-
displayedHeaders: [
|
|
52
|
-
...displayedHeaders,
|
|
53
|
-
{
|
|
54
|
-
key: '__locale_key__', // Needed for the table
|
|
55
|
-
fieldSchema: { type: 'string' }, // Schema of the attribute
|
|
56
|
-
metadatas: {
|
|
57
|
-
label: 'Raboo', // Label of the header,
|
|
58
|
-
sortable: true | false // Define if the column is sortable
|
|
59
|
-
}, // Metadatas for the label
|
|
60
|
-
// Name of the key in the data we will display
|
|
61
|
-
name: 'locales',
|
|
62
|
-
// Custom renderer: props => Object.keys(props).map(key => <p key={key}>key</p>)
|
|
63
|
-
},
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
47
|
},
|
|
68
48
|
|
|
69
49
|
async registerTrads({ locales }) {
|
|
@@ -104,7 +104,7 @@ const Settings = () => {
|
|
|
104
104
|
</button>
|
|
105
105
|
</Tooltip>
|
|
106
106
|
} />
|
|
107
|
-
</Box
|
|
107
|
+
</Box>
|
|
108
108
|
</GridItem>
|
|
109
109
|
<GridItem col={6} s={12}>
|
|
110
110
|
<Box padding={0}>
|
|
@@ -131,7 +131,7 @@ const Settings = () => {
|
|
|
131
131
|
</button>
|
|
132
132
|
</Tooltip>
|
|
133
133
|
} />
|
|
134
|
-
</Box
|
|
134
|
+
</Box>
|
|
135
135
|
</GridItem>
|
|
136
136
|
</Grid>
|
|
137
137
|
</Stack>
|
package/package.json
CHANGED