diff --git a/altrpnjs/.gitignore b/altrpnjs/.gitignore index 4c3557ae9..160bca67a 100644 --- a/altrpnjs/.gitignore +++ b/altrpnjs/.gitignore @@ -5,7 +5,6 @@ coverage .DS_STORE .env tmp -views/templates .env-prod #bundles @@ -15,3 +14,4 @@ app/AltrpModels/ app/AltrpControllers/ app/AltrpPlugins/ start/altrp-routes/ +/resources/views/altrp diff --git a/altrpnjs/app/Controllers/Http/TemplatesController.ts b/altrpnjs/app/Controllers/Http/TemplatesController.ts index f926303cb..9a855a7a9 100644 --- a/altrpnjs/app/Controllers/Http/TemplatesController.ts +++ b/altrpnjs/app/Controllers/Http/TemplatesController.ts @@ -8,6 +8,7 @@ import PagesTemplate from "App/Models/PagesTemplate"; import Category from "App/Models/Category"; import CategoryObject from "App/Models/CategoryObject"; import filtration from "../../../helpers/filtration"; +import TemplateGenerator from "App/Generators/TemplateGenerator"; export default class TemplatesController { public async index({ request }) { @@ -30,6 +31,7 @@ export default class TemplatesController { .preload("user") .preload("currentArea") .whereNotNull('guid') + .whereNull('deleted_at') .where("type", "template") .preload("categories") .whereHas("currentArea", (query) => { @@ -141,8 +143,8 @@ export default class TemplatesController { } } } - - // await TemplateFactory.createMany(100) + let templateGenerator = new TemplateGenerator() + await templateGenerator.run(template) return { message: "Success", redirect: true, @@ -170,7 +172,9 @@ export default class TemplatesController { public async delete({ params }) { const template = await Template.query().where("id", parseInt(params.id)).firstOrFail(); - template.delete() + let templateGenerator = new TemplateGenerator() + await templateGenerator.deleteFile(template) + await template.delete() return { success: true } @@ -207,6 +211,8 @@ export default class TemplatesController { await template.save() + let templateGenerator = new TemplateGenerator() + await templateGenerator.run(template) return { currentTemplate: template, prevVersions: prevVersions, diff --git a/altrpnjs/app/Controllers/Http/admin/AdminController.ts b/altrpnjs/app/Controllers/Http/admin/AdminController.ts index 1b5e9ad11..992afb6c7 100644 --- a/altrpnjs/app/Controllers/Http/admin/AdminController.ts +++ b/altrpnjs/app/Controllers/Http/admin/AdminController.ts @@ -7,6 +7,10 @@ import Application from '@ioc:Adonis/Core/Application' import sharp from "sharp"; import FAVICONS_SIZES from "../../../../helpers/const/FAVICONS_SIZES"; import Drive from '@ioc:Adonis/Core/Drive' +import Template from "App/Models/Template"; +import TemplateGenerator from "App/Generators/TemplateGenerator"; +import PageGenerator from "App/Generators/PageGenerator"; +import Page from "App/Models/Page"; export default class AdminController { @@ -18,6 +22,8 @@ export default class AdminController { // const step = 10 const modelGenerator = new ModelGenerator() const controllerGenerator = new ControllerGenerator() + const templateGenerator = new TemplateGenerator() + const pageGenerator = new PageGenerator() for (let model of models){ if(model.name.toLowerCase() === 'user' || model.name.toLowerCase() === 'media'){ @@ -35,12 +41,15 @@ export default class AdminController { } await controllerGenerator.run(controller) } - await Promise.all(models.map(async model=>{ - if(! model.altrp_controller){ - console.log(model.name); - } - })) - return response.json({success: true,}) + const templates = await Template.query().where('type', 'template').whereNull('deleted_at').select('*') + for (let template of templates) { + await templateGenerator.run(template) + } + const pages = await Page.query().whereNull('deleted_at').select('*') + for (let page of pages) { + await pageGenerator.run(page) + } + return response.json({success: true,}) } diff --git a/altrpnjs/app/Controllers/Http/admin/CategoriesController.ts b/altrpnjs/app/Controllers/Http/admin/CategoriesController.ts index eb0bfad11..22a2c5a1b 100644 --- a/altrpnjs/app/Controllers/Http/admin/CategoriesController.ts +++ b/altrpnjs/app/Controllers/Http/admin/CategoriesController.ts @@ -11,10 +11,9 @@ export default class CategoriesController { } let categories = await query .orderBy('title', ) - return response.json({ - categories, - pageCount: 0, - }) + return response.json( + categories + ) } public async create({request, response}) { diff --git a/altrpnjs/app/Controllers/Http/admin/PagesController.ts b/altrpnjs/app/Controllers/Http/admin/PagesController.ts index f7a5ff839..64e27ade0 100644 --- a/altrpnjs/app/Controllers/Http/admin/PagesController.ts +++ b/altrpnjs/app/Controllers/Http/admin/PagesController.ts @@ -5,6 +5,7 @@ import Template from "App/Models/Template"; import PagesTemplate from "App/Models/PagesTemplate"; import Category from "App/Models/Category"; import CategoryObject from "App/Models/CategoryObject"; +import PageGenerator from "App/Generators/PageGenerator"; export default class PagesController { public async create({auth, request, response}) { @@ -81,7 +82,8 @@ export default class PagesController { res.success = true res.page = page page.parseRoles(request.input('roles')); - + const pageGenerator = new PageGenerator() + await pageGenerator.run(page) await page.save() return res @@ -202,9 +204,9 @@ export default class PagesController { page[input] = body[input] } }) - await page.save() - + const pageGenerator = new PageGenerator() + await pageGenerator.run(page) if(request.input("categories")) { await page.related("categories").detach() diff --git a/altrpnjs/app/Generators/BaseGenerator.ts b/altrpnjs/app/Generators/BaseGenerator.ts index a0268a8d9..61b05af04 100644 --- a/altrpnjs/app/Generators/BaseGenerator.ts +++ b/altrpnjs/app/Generators/BaseGenerator.ts @@ -1,9 +1,11 @@ import * as mustache from 'mustache' import fs from 'fs' +import Application from "@ioc:Adonis/Core/Application"; +import path from "path"; export abstract class BaseGenerator{ private fileName: string; - private directory: string; + protected directory: string; private stubFilePath: string; protected addFile(fileName: string):this { @@ -30,13 +32,25 @@ export abstract class BaseGenerator{ content = mustache.render(content, vars) if(! fs.existsSync(this.directory)){ - fs.mkdirSync(this.directory) + fs.mkdirSync(this.directory, {recursive:true}) } fs.writeFileSync(this.getFullFileName(), content) return } private getFullFileName():string{ - return `${this.directory}/${this.fileName}` + return path.join(this.directory,this.fileName) + } + + static async generateCssFile(fileName:string, content:string):Promise{ + if(fileName.indexOf('.css') !== fileName.length - 4){ + fileName += '.css' + } + fileName = Application.publicPath(`altrp/css/${fileName}`) + if(! fs.existsSync(Application.publicPath(`altrp/css/`))){ + fs.mkdirSync(Application.publicPath(`altrp/css/`), {recursive:true}) + } + fs.writeFileSync(fileName, content) + return } } diff --git a/altrpnjs/app/Generators/ModelGenerator.ts b/altrpnjs/app/Generators/ModelGenerator.ts index 8274b431a..4cbe1e8ef 100644 --- a/altrpnjs/app/Generators/ModelGenerator.ts +++ b/altrpnjs/app/Generators/ModelGenerator.ts @@ -23,11 +23,11 @@ export default class ModelGenerator extends BaseGenerator { public async deleteFiles(model: Model): Promise { let fileName = this.getFilename(model) if (fs.existsSync(ModelGenerator.directory + fileName)) { - fs.unlinkSync(ModelGenerator.directory + fileName); + fs.rmSync(ModelGenerator.directory + fileName); } fileName =`${model.name}Controller${ModelGenerator.ext}` if (fs.existsSync(ControllerGenerator.directory + fileName)) { - fs.unlinkSync(ControllerGenerator.directory + fileName); + fs.rmSync(ControllerGenerator.directory + fileName); } return } diff --git a/altrpnjs/app/Generators/PageGenerator.ts b/altrpnjs/app/Generators/PageGenerator.ts new file mode 100644 index 000000000..bfe052dc1 --- /dev/null +++ b/altrpnjs/app/Generators/PageGenerator.ts @@ -0,0 +1,46 @@ +import fs from 'fs' +import {BaseGenerator} from "./BaseGenerator"; +import Application from "@ioc:Adonis/Core/Application"; +import app_path from "../../helpers/app_path"; +import Page from "App/Models/Page"; + +export default class PageGenerator extends BaseGenerator { + + public static directory = Application.resourcesPath('/views/altrp/pages') + public static template = app_path(`altrp-templates/views/Page.stub`) + + + async deleteFile(page: Page): Promise { + let fileName = this.getFilename(page) + if (fs.existsSync(PageGenerator.directory + fileName)) { + fs.rmSync(PageGenerator.directory + fileName); + } + } + + getFilename(page):string{ + return page.guid + '.edge' + } + + async run(page: Page) { + if(! page){ + return + } + + + let fileName = this.getFilename(page) + if (!page.guid ) { + console.error(`Page ${page.id} render error. Need more data`); + return + } + let children_content = await page.getChildrenContent() + let all_styles = await page.getAllStyles() + return await this.addFile(fileName) + .destinationDir(PageGenerator.directory) + .stub(PageGenerator.template) + .apply({ + children_content, + all_styles, + }) + + } +} diff --git a/altrpnjs/app/Generators/TemplateGenerator.ts b/altrpnjs/app/Generators/TemplateGenerator.ts new file mode 100644 index 000000000..1f9b93fd1 --- /dev/null +++ b/altrpnjs/app/Generators/TemplateGenerator.ts @@ -0,0 +1,68 @@ +import { parse } from 'node-html-parser' +import fs from 'fs' +import {BaseGenerator} from './BaseGenerator'; +import Application from '@ioc:Adonis/Core/Application'; +import app_path from '../../helpers/app_path'; +import Template from 'App/Models/Template'; +import path from 'path'; +import * as _ from 'lodash' +import Logger from '@ioc:Adonis/Core/Logger' + +export default class TemplateGenerator extends BaseGenerator { + + public static directory = '/views/altrp/templates' + public static template = app_path(`altrp-templates/views/Template.stub`) + + + async deleteFile(template: Template): Promise { + if (fs.existsSync(path.join(this.getDirectory(template),this.getFilename(template)))) { + fs.rmSync(path.join(this.getDirectory(template),this.getFilename(template))); + } + } + + getDirectory(template:Template){ + return Application.resourcesPath(`${TemplateGenerator.directory}/${template.currentArea?.name}`) + } + + getFilename(template:Template):string{ + return template.guid + '.edge' + } + + async run(template: Template) { + if(! template){ + return + } + await template.load('currentArea') + + const styles = JSON.parse(template.styles) + + let all_styles = _.get(styles, 'all_styles', []) + // + all_styles = all_styles.join('') + all_styles = parse(all_styles) + if(template.guid){ + await BaseGenerator.generateCssFile(template.guid, all_styles.textContent) + } + let fileName = this.getFilename(template) + if (! template.currentArea?.name) { + console.error(`Template ${template.id} render error. Need Area name`); + Logger.warn(`Try Render Template without area (id: ${template.id})`) + return + } + if (!template.guid ) { + console.error(`Template ${template.id} render error. Need guid`); + Logger.warn(`Try Render Template without guid (id: ${template.id})`) + return + } + let children_content = await template.getChildrenContent() + return await this.addFile(fileName) + .destinationDir(this.getDirectory(template)) + .stub(TemplateGenerator.template) + .apply({ + children_content, + all_styles:'', + area_name: template.currentArea?.name, + }) + + } +} diff --git a/altrpnjs/app/Middleware/AltrpRouting.ts b/altrpnjs/app/Middleware/AltrpRouting.ts index 918b3167f..2ca6ff9a7 100644 --- a/altrpnjs/app/Middleware/AltrpRouting.ts +++ b/altrpnjs/app/Middleware/AltrpRouting.ts @@ -1,3 +1,4 @@ +import {minify} from'html-minifier' import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext' import Page from 'App/Models/Page'; import Edge from '../../helpers/edge'; @@ -19,7 +20,7 @@ import validGuid from "../../helpers/validGuid"; import Template from "App/Models/Template"; import data_set from "../../helpers/data_set"; import DEFAULT_REACT_ELEMENTS from "../../helpers/const/DEFAULT_REACT_ELEMENTS"; -// import getCurrentDevice from "../../helpers/getCurrentDevice"; +import getCurrentDevice from "../../helpers/getCurrentDevice"; // import Ws from "App/Services/Ws"; export default class AltrpRouting { @@ -41,7 +42,7 @@ export default class AltrpRouting { return _.get(this.__altrp_global__, path, _default) } - public async handle({request, response, view, auth}: HttpContextContract, next: () => Promise) { + public async handle({request, response, view, auth, params}: HttpContextContract, next: () => Promise) { /** * Игнорим все запросы кроме get */ @@ -103,6 +104,7 @@ export default class AltrpRouting { if (page) { const pages = await page.getPagesForFrontend(); + if (!await page.allowedForUser(this)) { return response.redirect(page.redirect || '/') } @@ -111,21 +113,15 @@ export default class AltrpRouting { await page.load('model'); const altrp_settings = await page.getPageSettings(this) - const pageAreas = await page.getAreas(); - //@ts-ignore - const preload_content:any = renderResult({ - protocol: request.protocol(), - host: request.host(), - originalUrl: url, - json: { - altrp_settings, - page: pageAreas, - altrpImageLazy: get_altrp_setting('altrp_image_lazy', 'none'), - altrpSkeletonColor: get_altrp_setting('altrp_skeleton_color', '#ccc'), - altrpSkeletonHighlightColor: get_altrp_setting('altrp_skeleton_highlight_color', '#d0d0d0'), - current_user: auth.user || {is_guest: true} - } - }) + const pageAreas = await page.getAreas(true); + + // _.set(areas, '1.template.styles', null) + // console.log(_.get(pageAreas, '1.template.styles')) + // @ts-ignore + const user: User = auth.user + let is_admin = user && await user.isAdmin(); + const altrpElementsLists = await this.extractElementsNames(pageAreas); + let model_data = {} if (page.model) { try { @@ -146,23 +142,88 @@ export default class AltrpRouting { } } let title = replaceContentWithData(page.title, model_data) + const datasources= {} + const context = prepareContext({ title, model_data, altrpRouting: this }) - preload_content.content = replaceContentWithData(preload_content.content, context) const _frontend_route = page.serialize() + const altrpContext = { + ...params, + ...model_data, + altrpdata: datasources, + altrpuser: user.toObject(), + altrppage:{ + title, + url, + params: request.qs() + } + } + try { + _.set(page, 'templates', []) + _.set(_frontend_route, 'templates', []) + let res = await view.render(`altrp/pages/${page.guid}`, + Edge({ + hAltrp: Env.get('PATH_ENV') === 'production' ? '/modules/front-app/h-altrp.js' : 'http://localhost:3001/src/bundle.h-altrp.js', + url: Env.get('PATH_ENV') === 'production' ? '/modules/front-app/front-app.js' : 'http://localhost:3001/src/bundle.front-app.js', + title: replaceContentWithData(page.title || 'Altrp', context), + is_admin, + pages, + csrfToken: request.csrfToken, + page_areas: pageAreas, + page_id: page.id, + altrpElementsLists, + elements_list: altrpElementsLists, + model_data, + fonts: this.getFonts(), + altrp_settings, + _frontend_route, + altrpContext, + route_args: pageMatch.params, + datasources, + device: getCurrentDevice(request), + _altrp: { + version: getLatestVersion() + }, + }) + ) + // res = minify(res, { + // collapseWhitespace:true, + // minifyCSS: true, + // minifyJS: true, + // }) + return response.send(res) + } catch (e) { + console.error(`Error to View Custom Page: ${e.message} + ${e.stack} + `); + } + //@ts-ignore + const preload_content:any = renderResult({ + protocol: request.protocol(), + host: request.host(), + originalUrl: url, + json: { + altrp_settings, + page: pageAreas, + altrpImageLazy: get_altrp_setting('altrp_image_lazy', 'none'), + altrpSkeletonColor: get_altrp_setting('altrp_skeleton_color', '#ccc'), + altrpSkeletonHighlightColor: get_altrp_setting('altrp_skeleton_highlight_color', '#d0d0d0'), + current_user: auth.user || {is_guest: true} + } + }) + + preload_content.content = replaceContentWithData(preload_content.content, context) + _frontend_route.title = title - // @ts-ignore - const user: User = auth.user - let is_admin = user && await user.isAdmin(); - const altrpElementsLists = await this.extractElementsNames(pageAreas); - const v = await view.render('front-app', Edge({ + const v = await view.render('front-app', + Edge({ hAltrp: Env.get('PATH_ENV') === 'production' ? '/modules/front-app/h-altrp.js' : 'http://localhost:3001/src/bundle.h-altrp.js', url: Env.get('PATH_ENV') === 'production' ? '/modules/front-app/front-app.js' : 'http://localhost:3001/src/bundle.front-app.js', page: pageAreas, @@ -180,10 +241,11 @@ export default class AltrpRouting { altrp_settings, _frontend_route, route_args: pageMatch.params, - altrp: { + _altrp: { version: getLatestVersion() }, - })) + }) + ) return response.send(v) } response.status(404) diff --git a/altrpnjs/app/Models/Category.ts b/altrpnjs/app/Models/Category.ts index 1b5b5577c..db4a519ef 100644 --- a/altrpnjs/app/Models/Category.ts +++ b/altrpnjs/app/Models/Category.ts @@ -1,5 +1,4 @@ import {BaseModel, column, computed} from "@ioc:Adonis/Lucid/Orm" -import { DateTime } from 'luxon' export default class Category extends BaseModel { @@ -33,9 +32,5 @@ export default class Category extends BaseModel { return this.guid } - @column.dateTime({ autoCreate: true }) - public createdAt: DateTime - @column.dateTime({ autoCreate: true, autoUpdate: true }) - public updatedAt: DateTime } diff --git a/altrpnjs/app/Models/Page.ts b/altrpnjs/app/Models/Page.ts index db60a89cc..ddd2a6513 100644 --- a/altrpnjs/app/Models/Page.ts +++ b/altrpnjs/app/Models/Page.ts @@ -22,13 +22,14 @@ import Database from "@ioc:Adonis/Lucid/Database" import Logger from "@ioc:Adonis/Core/Logger" import AltrpRouting from "App/Middleware/AltrpRouting" import User from "App/Models/User"; -import { isString } from "lodash"; +import {isString} from "lodash"; import PageRole from "App/Models/PageRole"; import Role from "App/Models/Role"; import Template from "App/Models/Template"; import Category from "App/Models/Category"; import PageDatasource from "App/Models/PageDatasource"; import mbParseJSON from "../../helpers/mbParseJSON"; +import RootElementRenderer from "App/Renderers/RootElement"; export default class Page extends BaseModel { @column({isPrimary: true}) @@ -138,7 +139,7 @@ export default class Page extends BaseModel { }) public categories: ManyToMany - public async getAreas() { + public async getAreas(deleteContent) { // const all_site_templates = Template.query().where("all_site", true).preload("currentArea") const data: { @@ -184,7 +185,18 @@ export default class Page extends BaseModel { settings: [], templates: popups }) - + if(deleteContent){ + _.set(headerTemplate, 'html_content', null) + _.set(contentTemplate, 'html_content', null) + _.set(footerTemplate, 'html_content', null) + _.set(headerTemplate, 'styles', null) + _.set(contentTemplate, 'styles', null) + _.set(footerTemplate, 'styles', null) + popups.forEach(t=>{ + _.set(t, 'html_content', null) + _.set(t, 'styles', null) + }) + } return data } @@ -226,11 +238,12 @@ export default class Page extends BaseModel { foreignKey: "page_id" }) public pageDatasources: HasMany + /** * Привязывает набор ролей к сттанице, удаляя старые связи */ - public attachRoles( roles ) { - if ( !this.id ) { + public attachRoles(roles) { + if (!this.id) { return; } @@ -245,13 +258,13 @@ export default class Page extends BaseModel { @column.dateTime({autoCreate: true}) public createdAt: DateTime - @column.dateTime({ autoCreate: true, autoUpdate:true }) + @column.dateTime({autoCreate: true, autoUpdate: true}) public updatedAt: DateTime @column.dateTime() public deleted_at: DateTime - async getPageSettings(altrpRouting: AltrpRouting):Promise { + async getPageSettings(altrpRouting: AltrpRouting): Promise { const altrpSettings: any = altrpRouting.__altrp_global__.altrpSettings altrpSettings.action_components = [] altrpSettings.libsToLoad = [] @@ -260,7 +273,7 @@ export default class Page extends BaseModel { if (!this.id) { return altrpSettings } - const fonts:string[] = [] + const fonts: string[] = [] const areas = await this.getAreas() const json_areas = JSON.stringify(areas) if (json_areas.indexOf('altrptime') !== -1) { @@ -279,7 +292,7 @@ export default class Page extends BaseModel { { let root_element = data_get(template, 'data') - if(_.isString(root_element)) { + if (_.isString(root_element)) { root_element = mbParseJSON(root_element) } if (root_element) { @@ -296,10 +309,10 @@ export default class Page extends BaseModel { /** * get font from element settings */ - if(! empty(data_get(element, 'settings.__altrpFonts__'))) { + if (!empty(data_get(element, 'settings.__altrpFonts__'))) { const _fonts = _.values(data_get(element, 'settings.__altrpFonts__')) - _fonts.forEach(font =>{ - if(fonts.indexOf(font) === -1){ + _fonts.forEach(font => { + if (fonts.indexOf(font) === -1) { fonts.push(font) } }) @@ -313,7 +326,7 @@ export default class Page extends BaseModel { return } - let actions:any = [] + let actions: any = [] for (let actionName of ACTIONS_NAMES) { { actions = _.concat(actions, data_get(element, 'settings.' + actionName, [])) @@ -341,15 +354,15 @@ export default class Page extends BaseModel { altrpSettings.altrpMenus = _.uniq(altrpSettings.altrpMenus) altrpSettings.altrpMenus = (await Promise.all(altrpSettings.altrpMenus - .map(async (menuGuid) => await Menu.query().where('guid', menuGuid).select('*').first() - ))).filter(menu => menu) + .map(async (menuGuid) => await Menu.query().where('guid', menuGuid).select('*').first() + ))).filter(menu => menu) altrpRouting.setGlobal('fonts', fonts) return altrpSettings } - async allowedForUser(altrpRouting:AltrpRouting) { + async allowedForUser(altrpRouting: AltrpRouting) { const currentUser: User | null = data_get(altrpRouting, '__altrp_global__.currentUser') @@ -390,21 +403,71 @@ export default class Page extends BaseModel { }) } - async getPagesForFrontend():Promise { + async getPagesForFrontend(): Promise { - let pages:Page[] = [this] - let page:Page|null = this + let pages: Page[] = [this] + let page: Page | null = this try { - while( page && page.parent_page_id ){ - page = await Page.find( page.parent_page_id ) - if( page ){ - pages.push( page ) + while (page && page.parent_page_id) { + page = await Page.find(page.parent_page_id) + if (page) { + pages.push(page) } } - } catch( e ){ - Logger.error( e.message ) + } catch (e) { + Logger.error(e.message) } return pages } + + async getAllStyles() { + + let styles = '' + // let contentStyles = data_get(await Template.getTemplate(this.id, 'content'), 'styles') + // let headerStyles = data_get(await Template.getTemplate(this.id, 'header'), 'styles') + // if (headerStyles) { + // headerStyles = JSON.parse(headerStyles) + // headerStyles = _.get(headerStyles, 'all_styles', []) + // styles += headerStyles.join('') + // } + // if (contentStyles) { + // contentStyles = JSON.parse(contentStyles) + // contentStyles = _.get(contentStyles, 'all_styles', []) + // styles += contentStyles.join('') + // } + return styles + } + + async getChildrenContent() { + let contentGuid = data_get(await Template.getTemplate(this.id, 'content'), 'guid') + let footerGuid = data_get(await Template.getTemplate(this.id, 'footer'), 'guid') + let headerGuid = data_get(await Template.getTemplate(this.id, 'header'), 'guid') + + return `
+ ${headerGuid ? `@include('altrp/templates/header/${headerGuid}')` : ''} +
+
+ ${contentGuid ? `@include('altrp/templates/content/${contentGuid}')` : ''} +
+ + ${headerGuid ? `` : ''} + ${contentGuid ? `` : ''} + ${footerGuid ? `` : ''} + ` + /* + return `
+ ${await (new RootElementRenderer(headerData)).render()} +
+
+ ${await (new RootElementRenderer(contentData)).render()} +
+ + ` + */ + } } diff --git a/altrpnjs/app/Models/Template.ts b/altrpnjs/app/Models/Template.ts index b609adce6..fea6e4161 100644 --- a/altrpnjs/app/Models/Template.ts +++ b/altrpnjs/app/Models/Template.ts @@ -16,6 +16,7 @@ import TemplateSetting from "App/Models/TemplateSetting"; import empty from "../../helpers/empty"; import PagesTemplate from "App/Models/PagesTemplate"; import Category from "App/Models/Category"; +import RootElementRenderer from "App/Renderers/RootElement"; export default class Template extends BaseModel { @@ -119,7 +120,7 @@ export default class Template extends BaseModel { /** * Получить объект шаблона по параметрам */ - static async getTemplate(pageId, templateType = 'content',): Promise