Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@kohanajs/mod-cms

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kohanajs/mod-cms - npm Package Compare versions

Comparing version 7.0.2 to 7.1.0

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

## [7.1.0](https://gitlab.com/kohana-js/proposals/level0/mod-cms/compare/v7.0.2...v7.1.0) (2022-03-24)
### Features
* original tags ([2c99ee0](https://gitlab.com/kohana-js/proposals/level0/mod-cms/commit/2c99ee084d2c2a24eaf78879cbfd49ad80e3dea6))
### [7.0.2](https://gitlab.com/kohana-js/proposals/level0/mod-cms/compare/v7.0.1...v7.0.2) (2022-03-24)

@@ -7,0 +14,0 @@

15

classes/controller/admin/Page.js

@@ -9,2 +9,3 @@ const { ControllerAdmin } = require('@kohanajs/mod-admin');

const Tag = ORM.require('Tag');
const TagType = ORM.require('TagType');

@@ -19,3 +20,2 @@ class ControllerAdminPage extends ControllerAdmin {

['tag', `${KohanaJS.config.cms.databasePath}/www/tag.sqlite`],
['language', `${KohanaJS.config.cms.databasePath}/www/language.sqlite`]
]),

@@ -41,2 +41,13 @@ database: 'draft',

//collect tags and write to original
const database = this.state.get(ControllerMixinDatabase.DATABASES).get('content');
await instance.eagerLoad({with:['PageTag']}, {database});
const databaseTag = this.state.get(ControllerMixinDatabase.DATABASES).get('tag');
const tagTypes = await ORM.readAll(TagType, {database:databaseTag, asArray:true});
const tagTypeMap = new Map(tagTypes.map(it => [it.id, it.name]));
const tags = await ORM.readBy(Tag, 'id', instance.page_tags.map(it => it.tag_id), {database: databaseTag, asArray:true });
original.tags = tags.map(tag => HelperPageText.getOriginal(tag, {_id: tag.id, _type_id: tag.tag_type_id, _type:tagTypeMap.get(tag.tag_type_id)}));
instance.original = JSON.stringify(original);

@@ -293,2 +304,2 @@ await instance.write();

module.exports = ControllerAdminPage;
module.exports = ControllerAdminPage;
class HelperPageText{
static getOriginal(page){
return JSON.parse(page.original || `{"attributes":{}, "values":{}, "items":{}}`);
static getOriginal(page, attributes={}){
if(!page.original){
return {"attributes":{}, "values":{}, "items":{}}
}
const original = JSON.parse(page.original);
Object.assign(original.attributes, attributes);
return original;
}

@@ -108,5 +115,13 @@

tokens : this.flattenTokens(original, languageCode, masterLanguageCode),
blocks:[]
}
blocks:[],
tags: {}
};
(original.tags || []).forEach(tag => {
const tagToken = this.flattenTokens(tag, languageCode, masterLanguageCode);
result.tags[tagToken._type] ||= [];
result.tags[tagToken._type].push(tagToken);
})
if(!original.blocks)return result;

@@ -113,0 +128,0 @@

2

package.json
{
"name": "@kohanajs/mod-cms",
"version": "7.0.2",
"version": "7.1.0",
"description": "The CMS module for KohanaJS",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc