Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master'
Browse files Browse the repository at this point in the history
Conflicts:
	src/cli/helpers/abe-sql.js
  • Loading branch information
nicolaslabbe committed Sep 30, 2016
2 parents 4a024d6 + edfbd4f commit 89a46a2
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 69 deletions.
30 changes: 15 additions & 15 deletions .eslintrc.json
Expand Up @@ -9,32 +9,32 @@
},
"rules": {
"indent": [
"error",
2,
2
],
"linebreak-style": [
"error",
2,
"unix"
],
"quotes": [
"warn",
1,
"single"
],
"semi": [
"error",
2,
"never"
],
"no-console":0,
"no-unused-vars":["warn"],
"no-undef":["warn"],
"no-redeclare":["warn"],
"no-unreachable":["warn"],
"no-mixed-spaces-and-tabs":["warn"],
"no-self-assign":["warn"],
"no-cond-assign":["warn"],
"no-case-declarations":["warn"],
"no-dupe-class-members":["warn"],
"no-empty":["warn"],
"valid-typeof":["warn"]
"no-unused-vars":[1],
"no-undef":[1],
"no-redeclare":[1],
"no-unreachable":[1],
"no-mixed-spaces-and-tabs":[1],
"no-self-assign":[1],
"no-cond-assign":[1],
"no-case-declarations":[1],
"no-dupe-class-members":[1],
"no-empty":[1],
"valid-typeof":[1]
}
}
3 changes: 2 additions & 1 deletion .npmignore
@@ -1,2 +1,3 @@
src/
test/
test/
.travis.yml
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -2,6 +2,7 @@
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/AdFabConnect/abejs/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/AdFabConnect/abejs/)
[![Coverage Status](https://coveralls.io/repos/github/AdFabConnect/abejs/badge.svg?branch=master)](https://coveralls.io/github/AdFabConnect/abejs?branch=master)
[![Dependency Status](https://www.versioneye.com/user/projects/57ea4badbd6fa600316f9f6c/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/57ea4badbd6fa600316f9f6c)
[![Inline docs](http://inch-ci.org/github/adfabconnect/abejs.svg?branch=master)](http://inch-ci.org/github/github/adfabconnect/abejs)
[![Latest Stable Version](https://img.shields.io/npm/v/abe-cli.svg)](https://www.npmjs.com/package/abe-cli)
[![Total Downloads](https://img.shields.io/npm/dt/abe-cli.svg)](https://www.npmjs.com/package/abe-cli)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/AdFabConnect/abejs/master/LICENSE)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -8,7 +8,7 @@
"url": "git://github.com/AdFabConnect/abejs.git"
},
"scripts": {
"lint": "eslint src",
"lint": "eslint src --fix",
"test": "mocha --compilers js:babel-register --require babel-polyfill",
"test-cov": "istanbul cover _mocha -- --compilers js:babel-register --require babel-polyfill",
"test-coveralls": "istanbul cover _mocha --report lcovonly -- --compilers js:babel-register --require babel-polyfill -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
Expand Down
21 changes: 14 additions & 7 deletions src/cli/controllers/Save.js
Expand Up @@ -109,8 +109,8 @@ export function save(url, tplPath, json = null, text = '', type = '', previousSa
}else {
date = new Date(date)
}
Util.addMetas(tpl, json, type, {}, date, realType)
}
Util.addMetas(tpl, json, type, {}, date, realType)

if(typeof text === 'undefined' || text === null || text === '') {
text = getTemplate(fullTpl)
Expand All @@ -125,10 +125,14 @@ export function save(url, tplPath, json = null, text = '', type = '', previousSa
var valuesAreEmpty = true
json[prop].forEach(function (element) {
for(var p in element) {
if(element[p] !== '') valuesAreEmpty = false
if(element[p] !== ''){
valuesAreEmpty = false
}
}
})
if(valuesAreEmpty) delete json[prop]
if(valuesAreEmpty){
delete json[prop]
}
}
}

Expand All @@ -151,12 +155,12 @@ export function save(url, tplPath, json = null, text = '', type = '', previousSa

obj.json.content[meta].complete = checkRequired(text, obj.json.content)

var res = saveJsonAndHtml(tpl.replace(/^\/+/, ''), obj, text, type)
var res = saveJsonAndHtml(tpl.replace(/^\/+/, ''), obj, text)
if (isRejectedDoc) {
res.reject = fileAttr.delete(url).replace(path.join(config.root, config.draft.url), '')
}

obj = Hooks.instance.trigger('afterSave', obj)
Hooks.instance.trigger('afterSave', obj)

FileParser.copySiteAssets()

Expand Down Expand Up @@ -199,8 +203,11 @@ export function saveJson(url, json) {

var eachRecursive = function (obj) {
for (var k in obj) {
if (typeof obj[k] === 'object' && obj[k] !== null) eachRecursive(obj[k])
else if (typeof obj[k] !== 'undefined' && obj[k] !== null) obj[k] = xss(obj[k].toString().replace(/"/g, '"'), { 'whiteList': config.htmlWhiteList })
if (typeof obj[k] === 'object' && obj[k] !== null){
eachRecursive(obj[k])
} else if (typeof obj[k] !== 'undefined' && obj[k] !== null){
obj[k] = xss(obj[k].toString().replace(/"/g, '"'), { 'whiteList': config.htmlWhiteList })
}
}
}

Expand Down
4 changes: 0 additions & 4 deletions src/cli/helpers/abe-config.js
Expand Up @@ -3,10 +3,6 @@ import clc from 'cli-color'
import extend from 'extend'

import {abeConfig, abeConfigLocal} from '../config'
import {
cli,
log
} from '../'

var result = extend(true, abeConfig, abeConfigLocal)
result.root = result.root.replace(/\/$/, '')
Expand Down
2 changes: 1 addition & 1 deletion src/cli/helpers/abe-logs.js
Expand Up @@ -5,7 +5,7 @@ import mkdirp from 'mkdirp'
import fs from 'fs'
import clc from 'cli-color'
import path from 'path'
import {config, cli, fileUtils} from '../'
import {config, fileUtils} from '../'

export default class Logs {

Expand Down
1 change: 0 additions & 1 deletion src/cli/helpers/abe-plugins.js
Expand Up @@ -8,7 +8,6 @@ import {
config,
fileUtils,
folderUtils,
cli,
log
} from '../'

Expand Down
4 changes: 2 additions & 2 deletions src/cli/helpers/abe-sql.js
Expand Up @@ -316,8 +316,8 @@ export default class Sql {
}

static execQuery(pathQuery, match, jsonPage) {
var res = []
var files = []
var res
var files
var request = Sql.handleSqlRequest(getAttr(match, 'source'), jsonPage)

files = Sql.executeFromClause(request.from, pathQuery)
Expand Down
25 changes: 0 additions & 25 deletions src/cli/helpers/cli-utils.js

This file was deleted.

2 changes: 0 additions & 2 deletions src/cli/helpers/file-utils.js
Expand Up @@ -4,8 +4,6 @@ import mkdirp from 'mkdirp'
import moment from 'moment'
import path from 'path'
import {
cli,
log,
fileAttr,
FileParser,
config
Expand Down
2 changes: 0 additions & 2 deletions src/cli/index.js
Expand Up @@ -40,7 +40,6 @@ import FileParser from './helpers/file-parser'
import Create from './Create'
import fileUtils from './helpers/file-utils'
import config from './helpers/abe-config'
import cli from './helpers/cli-utils'
import log from './helpers/abe-logs'
import removeDuplicateAttr from './helpers/abe-remove-duplicate-attr'
import abeCreate from './helpers/abe-create'
Expand Down Expand Up @@ -94,7 +93,6 @@ export {
,getEnclosingTags
,escapeTextToRegex
,config
,cli
,getTemplate
,log
,removeDuplicateAttr
Expand Down
1 change: 0 additions & 1 deletion src/server/controllers/index.js
Expand Up @@ -39,7 +39,6 @@ import {
fileUtils,
folderUtils,
config,
cli,
log,
Page,
Locales,
Expand Down
1 change: 0 additions & 1 deletion src/server/helpers/abe-locale.js
Expand Up @@ -4,7 +4,6 @@ import clc from 'cli-color'
import path from 'path'

import {
cli,
FileParser,
fileUtils,
config,
Expand Down
1 change: 0 additions & 1 deletion src/server/middlewares/website.js
Expand Up @@ -18,7 +18,6 @@ import {
fileUtils,
folderUtils,
config,
cli,
log,
Page,
Locales,
Expand Down
10 changes: 5 additions & 5 deletions src/server/public/scripts/modules/EditorAutocomplete.js
Expand Up @@ -124,7 +124,7 @@ export default class EditorAutocomplete {
}

_select(target) {
var val = JSON.parse(target.getAttribute('data-value').replace(/&quote;/g, "'"))
var val = JSON.parse(target.getAttribute('data-value').replace(/&quote;/g, '\''))
var maxLength = this._currentInput.getAttribute('data-maxlength')
if(typeof maxLength !== 'undefined' && maxLength !== null && maxLength !== '') {
maxLength = parseInt(maxLength)
Expand All @@ -137,7 +137,7 @@ export default class EditorAutocomplete {
var div = document.createElement('div')
div.classList.add('autocomplete-result')
div.setAttribute('data-parent-id', this._currentInput.getAttribute('data-id'))
div.setAttribute('value', target.getAttribute('data-value').replace(/&quote;/g, "'"))
div.setAttribute('value', target.getAttribute('data-value').replace(/&quote;/g, '\''))
div.innerHTML = `${this._deep_value_array(val, display)}`

var resWrapper = this._divWrapper.parentNode.querySelector('.autocomplete-result-wrapper')
Expand Down Expand Up @@ -217,7 +217,7 @@ export default class EditorAutocomplete {
}else {
this._previousValue = val
}
var dataVal = target.getAttribute('data-value').replace(/&quote;/g, "'")
var dataVal = target.getAttribute('data-value').replace(/&quote;/g, '\'')

if (dataVal.indexOf('http') === 0) {
this._ajax(
Expand All @@ -231,7 +231,7 @@ export default class EditorAutocomplete {
this._showAutocomplete(JSON.parse(responseText), target, val)
})
}else {
var sources = JSON.parse(target.getAttribute('data-value').replace(/&quote;/g, "'"))
var sources = JSON.parse(target.getAttribute('data-value').replace(/&quote;/g, '\''))
this._showAutocomplete(sources, target, val)
}
}else {
Expand Down Expand Up @@ -329,7 +329,7 @@ export default class EditorAutocomplete {
_deep_value_array(obj, path) {

if(path.indexOf('.') === -1) {
return (typeof obj[path] !== 'undefined' && obj[path] !== null) ? obj[path].replace(/&quote;/g, "'") : null
return (typeof obj[path] !== 'undefined' && obj[path] !== null) ? obj[path].replace(/&quote;/g, '\'') : null
}

var pathSplit = path.split('.')
Expand Down

0 comments on commit 89a46a2

Please sign in to comment.