Skip to content

Commit

Permalink
refactoring: kill abe-util
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaslabbe committed Oct 5, 2016
1 parent 91e0588 commit 3925ecf
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/cli/cms/Page.js
Expand Up @@ -2,7 +2,7 @@ import Handlebars from 'handlebars'
import fse from 'fs-extra'

import {
Util,
cmsEditor,
fileUtils,
abeEngine,
cmsData,
Expand Down Expand Up @@ -49,7 +49,7 @@ export default class Page {
this.template = template
this.HbsTemplatePath = fileUtils.getTemplatePath('hbs/'+templateId+'.hbs')

let util = new Util()
let util = new cmsEditor.form()

abeEngine.instance.content = json

Expand Down Expand Up @@ -161,7 +161,7 @@ export default class Page {

_updateAbeAsAttribute() {
var match
let util = new Util()
let util = new cmsEditor.form()

while (match = this.abeAsAttributePattern.exec(this.template)) { // While regexp match {{attribut}}, ex: link, image ...
if(cmsData.regex.isSingleAbe(match[0], this.template)){
Expand All @@ -181,7 +181,7 @@ export default class Page {

_updateAbeAsTag() {
var match
let util = new Util()
let util = new cmsEditor.form()

while (match = this.abePattern.exec(this.template)) {
var getattr = cmsData.regex.getAttr(match, 'key').replace(/\./g, '-')
Expand All @@ -207,7 +207,7 @@ export default class Page {
Array.prototype.forEach.call(blocks, (block) => {
var key = block.match(/#each (.*)\}\}/)
key = key[1]
let util = new Util()
let util = new cmsEditor.form()
var match

if(!this._onlyHTML) {
Expand Down
2 changes: 1 addition & 1 deletion src/cli/core/utils/abe-utils.js → src/cli/cms/editor/form.js 100755 → 100644
@@ -1,6 +1,6 @@
import extend from 'extend'

export default class Utils {
export default class Form {

constructor() {
this._form = {
Expand Down
2 changes: 2 additions & 0 deletions src/cli/cms/editor/index.js
@@ -1,5 +1,6 @@
import Handlebars from 'handlebars'
import HandlebarsIntl from 'handlebars-intl'
import form from './form'

/* Handlebar abe */
import abeEngine from './handlebars/abeEngine'
Expand Down Expand Up @@ -27,6 +28,7 @@ Handlebars.registerHelper('printInput', printInput)
HandlebarsIntl.registerWith(Handlebars)

export {
form,
abeEngine,
abeImport,
compileAbe,
Expand Down
4 changes: 2 additions & 2 deletions src/cli/cms/templates/template.js
Expand Up @@ -2,7 +2,7 @@ import fse from 'fs-extra'
import {Promise} from 'es6-promise'
import path from 'path'
import {
Util
cmsEditor
,config
,fileUtils
,cmsData
Expand Down Expand Up @@ -221,7 +221,7 @@ export function recurseWhereVariables (where) {
}

export function execRequestColumns(tpl) {
let util = new Util()
let util = new cmsEditor.form()
var ar = []
var matches = cmsData.regex.getTagAbeTypeRequest(tpl)
Array.prototype.forEach.call(matches, (match) => {
Expand Down
4 changes: 2 additions & 2 deletions src/cli/index.js
Expand Up @@ -3,7 +3,6 @@ import moment from 'moment'
import fse from 'fs-extra'
import clc from 'cli-color'

import Util from './core/utils/abe-utils'
import handlebarsHelperSlugify from 'handlebars-helper-slugify'

import {
Expand Down Expand Up @@ -53,6 +52,7 @@ import Hooks from './extend/abe-hooks'
import Plugins from './extend/abe-plugins'

import * as cmsData from './cms/data'
import * as cmsEditor from './cms/editor'
import * as cmsOperations from './cms/operations'
import * as cmsTemplate from './cms/templates'
import * as coreUtils from './core/utils'
Expand All @@ -62,12 +62,12 @@ export {
,cmsOperations
,cmsTemplate
,coreUtils
,cmsEditor

,moment
,fse
,Handlebars
,clc
,Util
,slugify
,cleanSlug
,FileParser
Expand Down
4 changes: 2 additions & 2 deletions src/server/controllers/editor.js
Expand Up @@ -2,7 +2,7 @@ import {Promise} from 'es6-promise'

import {
cmsData,
Util,
cmsEditor,
fileUtils,
abeEngine,
cmsTemplate,
Expand Down Expand Up @@ -217,7 +217,7 @@ function orderBlock(util) {

export function editor(fileName, jsonPath, documentLink) {
let p = new Promise((resolve) => {
var util = new Util()
var util = new cmsEditor.form()
var arrayBlock = []
var text
var json
Expand Down

0 comments on commit 3925ecf

Please sign in to comment.