From 8274be206addee9142b2e3d04ca04d1f2d79799c Mon Sep 17 00:00:00 2001 From: wonknu10 Date: Fri, 24 Mar 2017 13:30:57 +0100 Subject: [PATCH 1/9] fix: abe tag w key containing hyphen donesn't work to allow hyphen inside key attributes eval() call use 'obj[key]' synthaxe instead of 'obj.key' synthaxe --- src/cli/cms/editor/handlebars/compileAbe.js | 4 ++-- src/server/controllers/editor.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cli/cms/editor/handlebars/compileAbe.js b/src/cli/cms/editor/handlebars/compileAbe.js index a2008b8b..41bf5c80 100755 --- a/src/cli/cms/editor/handlebars/compileAbe.js +++ b/src/cli/cms/editor/handlebars/compileAbe.js @@ -25,7 +25,7 @@ export default function compileAbe(){ // hash.key = hash.key.replace(/\{\{@index\}\}/, '[{{@index}}]') hash.key = hash.key.replace(/\{\{@index\}\}/, `[${arguments[0].data.index}]`) try{ - value = content ? eval(`content.${hash.dictionnary}[${arguments[0].data.index}].${key}`) : hash.key + value = content ? eval(`content["${hash.dictionnary}"][${arguments[0].data.index}]["${key}"]`) : hash.key // value = content ? content[hash['dictionnary']][arguments[0].data.index][key] : hash.key } catch(e){ @@ -50,7 +50,7 @@ export default function compileAbe(){ hash = arguments[0].hash if(content) { try { - value = eval('content.' + hash.key) + value = eval(`content["${hash.key}"]`) }catch(e) { value = '' } diff --git a/src/server/controllers/editor.js b/src/server/controllers/editor.js index 1ba174ae..ab769a55 100755 --- a/src/server/controllers/editor.js +++ b/src/server/controllers/editor.js @@ -19,18 +19,18 @@ function add(obj, json, text, util) { key = getDataIdWithNoSlash(key) try { - obj.value = eval('json[key][index].' + prop) + obj.value = eval(`json[key][index]["${prop}"]`) } catch(e) { try { - eval(`json[key][index].${prop} = ` + JSON.stringify(value)) + eval(`json[key][index]["${prop}"] = ` + JSON.stringify(value)) }catch(e) { // no value found inside json OKEY } } }else { try { - obj.value = eval(`json.${getDataIdWithNoSlash(obj.key)}`) + obj.value = eval(`json["${getDataIdWithNoSlash(obj.key)}"]`) } catch(e) { // no value found inside json OKEY } @@ -79,7 +79,7 @@ function addToForm(match, text, json, util, arrayBlock, keyArray = null, i = 0) }else if(util.dontHaveKey(obj.key) && cmsData.regex.isSingleAbe(v, text)) { realKey = obj.key//.replace(/\./g, '-') try { - obj.value = eval(`json.${getDataIdWithNoSlash(realKey)}`) + obj.value = eval(`json["${getDataIdWithNoSlash(realKey)}"]`) }catch(e) { obj.value = null } From c5ebc689d6381334634e6502543b1885953cb953 Mon Sep 17 00:00:00 2001 From: gregorybesson Date: Fri, 24 Mar 2017 18:02:50 +0100 Subject: [PATCH 2/9] enhancement: The republish all button only appear when necessary. --- .travis.yml | 1 + src/server/public/abecms/libs/slider-home.js | 1 - src/server/routes/get-main.js | 2 + src/server/views/partials/header-menu.html | 2 + .../views/partials/right-file-list.html | 55 ++++++++----------- 5 files changed, 27 insertions(+), 34 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5098a968..cefb4fe6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,7 @@ before_install: - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -y libappindicator1 fonts-liberation; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo dpkg -i google-chrome*.deb; fi + - if [ "$TRAVIS_OS_NAME" == "osx" ]; brew install homebrew/science/opencv; fi install: - npm install - npm run install-selenium diff --git a/src/server/public/abecms/libs/slider-home.js b/src/server/public/abecms/libs/slider-home.js index e945a265..a4577be1 100644 --- a/src/server/public/abecms/libs/slider-home.js +++ b/src/server/public/abecms/libs/slider-home.js @@ -1,5 +1,4 @@ var tweets = twitterFetcher.fetch({ - // "profile": {"screenName": 'rihanna'}, "profile": {"screenName": 'abe_cms'}, "domId": 'tweets-slider', "maxTweets": 10, diff --git a/src/server/routes/get-main.js b/src/server/routes/get-main.js index 9ba7ccb1..018e3a19 100644 --- a/src/server/routes/get-main.js +++ b/src/server/routes/get-main.js @@ -23,6 +23,7 @@ function renderAbeAdmin(EditorVariables, obj, filePath) { files: []//Manager.instance.getList() } + manager.nbPosts = Manager.instance.getList().length manager.list = Manager.instance.getStructureAndTemplates() manager.editConfig = EditorVariables.express.req.app.get('config') manager.config = JSON.stringify(config) @@ -128,6 +129,7 @@ var route = function(req, res, next) { folderPath = path.dirname(filePath) EditorVariables.isHome = false + EditorVariables.isEditor = true var filePathTest = cmsData.revision.getDocumentRevision(filePath) if(typeof filePathTest !== 'undefined' && filePathTest !== null) { jsonPath = filePathTest.path diff --git a/src/server/views/partials/header-menu.html b/src/server/views/partials/header-menu.html index 69289379..b9f04cf7 100644 --- a/src/server/views/partials/header-menu.html +++ b/src/server/views/partials/header-menu.html @@ -9,11 +9,13 @@ - - - - - - - - - - - {{#each @root.config.users.workflow}} - - {{/each}} - - - - - {{#each manager.home.files}} - {{listPage this @index @root.text}} + + + + + + + + {{#each @root.config.users.workflow}} + {{/each}} - - + actions + + + + {{#each manager.home.files}} + {{listPage this @index @root.text}} + {{/each}} + +