@kohanajs/mod-cms
Advanced tools
Comparing version 9.2.0 to 9.3.0
@@ -5,2 +5,9 @@ # Changelog | ||
## [9.3.0](https://gitlab.com/kohana-js/proposals/level0/mod-cms/compare/v9.2.0...v9.3.0) (2022-07-27) | ||
### Features | ||
* auto slug ([361b091](https://gitlab.com/kohana-js/proposals/level0/mod-cms/commit/361b0918bb8aaeec74391745ad4c7f522b6d148d)) | ||
## [9.2.0](https://gitlab.com/kohana-js/proposals/level0/mod-cms/compare/v9.1.0...v9.2.0) (2022-07-27) | ||
@@ -7,0 +14,0 @@ |
@@ -40,3 +40,3 @@ const path = require('path'); | ||
page.live_weight = livePage.weight; | ||
page.synced = page.original === livePage.original; | ||
page.synced = page.original === livePage.original && page.slug === livePage.slug; | ||
} | ||
@@ -43,0 +43,0 @@ }); |
@@ -58,2 +58,13 @@ const { ControllerAdmin } = require('@kohanajs/mod-admin'); | ||
const database = this.state.get(ControllerMixinDatabase.DATABASES).get('draft'); | ||
//auto slug | ||
if($_POST[':slug'] === String(instance.id)){ | ||
const slug = $_POST[':name'].toLowerCase().replace(/ /g, '-').replace(/[^\w-]+/g, ''); | ||
console.log(slug); | ||
const slugExist = await ORM.readBy(Page, 'slug', [slug], {database, asArray:false}); | ||
instance.slug = slugExist ? (slug + instance.id) : slug; | ||
} | ||
const original = HelperPageText.getOriginal(instance); | ||
@@ -66,3 +77,2 @@ //update original | ||
//collect tags and write to original | ||
const database = this.state.get(ControllerMixinDatabase.DATABASES).get('content'); | ||
await instance.eagerLoad({with:['PageTag']}, {database}); | ||
@@ -159,3 +169,3 @@ | ||
templateData.published = !!livePage; | ||
templateData.sync = page.original === livePage?.original; | ||
templateData.sync = page.original === livePage?.original && page.slug === livePage.slug; | ||
templateData.page_type = page.page_type; | ||
@@ -162,0 +172,0 @@ templateData.tags = tags; |
{ | ||
"name": "@kohanajs/mod-cms", | ||
"version": "9.2.0", | ||
"version": "9.3.0", | ||
"description": "The CMS module for KohanaJS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103045
1356