Skip to content

Commit

Permalink
New version
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorybesson committed Mar 16, 2017
1 parent 3aab94d commit 2928daf
Show file tree
Hide file tree
Showing 34 changed files with 532 additions and 216 deletions.
2 changes: 1 addition & 1 deletion src/cli/cms/editor/handlebars/listPage.js
Expand Up @@ -23,7 +23,7 @@ export default function listPage(file, index, text) {
res += `<td align="center">
${file.abe_meta.template}
</td>`
}else {
} else {
res += '<td align="center"></td>'
}

Expand Down
4 changes: 3 additions & 1 deletion src/cli/index.js
Expand Up @@ -14,7 +14,8 @@ import {
moduloIf,
attrAbe,
ifIn,
ifCond
ifCond,
isAuthorized
} from './cms/templates/index'

import {
Expand Down Expand Up @@ -63,6 +64,7 @@ export {
Handlebars,
clc,
printInput,
isAuthorized,
abeImport,
math,
Create,
Expand Down
19 changes: 4 additions & 15 deletions src/server/app.js
Expand Up @@ -31,6 +31,7 @@ import {
listPage,
ifIn,
ifCond,
isAuthorized,
moduloIf,
attrAbe,
folders,
Expand Down Expand Up @@ -70,7 +71,8 @@ var html = exphbs.create({
folders: folders,
printConfig: printConfig,
ifIn: ifIn,
ifCond: ifCond
ifCond: ifCond,
isAuthorized: isAuthorized
}
})

Expand All @@ -93,11 +95,7 @@ app.use(cookieParser())
app.use(passport.initialize())
app.use(passport.session())
app.use(bodyParser.urlencoded({limit: '1gb', extended: true, parameterLimit: 10000 }))
app.use(csrf({
cookie: {
secure: config.cookie.secure
}
}))
app.use(csrf({cookie: {secure: config.cookie.secure}}))
app.use(function(req, res, next) {
if (req.url.indexOf('/abe/') > -1 ) {
res.locals._csrf = req.csrfToken()
Expand All @@ -106,15 +104,6 @@ app.use(function(req, res, next) {
})

app.use(bodyParser.json({limit: '1gb'}))
// app.use(function (req, res, next) {
// crypto.randomBytes(Math.ceil(6), function(err, buffer){
// res.locals.nonce = buffer
// .toString('hex')
// .slice(0,12)
// })
// //res.locals.nonce = uuid.v4()
// next()
// })

if(config.security === true){
app.use(helmet())
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/server/public/abecms/image/logo.png
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 11 additions & 2 deletions src/server/public/abecms/scripts/template-engine.js
Expand Up @@ -99,6 +99,7 @@ class Engine {
$(document).ready(() => {
if (document.querySelector('#navigation-list') != null) {
this.table = $('#navigation-list').DataTable( {
'lengthChange': false,
'pageLength': 50,
'processing': true,
'serverSide': true,
Expand All @@ -113,7 +114,9 @@ class Engine {
localStorage.setItem( 'DataTables_' + settings.sInstance, JSON.stringify(data) )
},
stateLoadCallback: function(settings) {
return JSON.parse( localStorage.getItem( 'DataTables_' + settings.sInstance ) )
let params = JSON.parse( localStorage.getItem( 'DataTables_' + settings.sInstance ))
$('#abeSearch').val(params.search.search)
return params
},
'createdRow': function (row, data, index) {
var actions = '<div class="row icons-action">'
Expand Down Expand Up @@ -162,7 +165,10 @@ class Engine {
.css( 'display', processing ? 'block' : 'none' )
.css( {top:'150px'})
})

$('#navigation-list')
.on('draw.dt', function ( e, settings, data ) {
$('#navigation-list_filter').css('display','none')
})
$('#navigation-list')
.on('preXhr.dt', function ( e, settings, data ) {
if(settings.jqXHR) {
Expand Down Expand Up @@ -258,4 +264,7 @@ window.abe = {

document.addEventListener('DOMContentLoaded', function() {
if(document.querySelector('#page-template')) engine.inject()
$('#abeSearch').on( 'keyup', function () {
engine.table.search( this.value ).draw();
});
})
39 changes: 38 additions & 1 deletion src/server/routes/get-home.js
@@ -1,5 +1,42 @@
import pkg from '../../../package'
import {
config,
Page,
cmsData,
cmsTemplates,
coreUtils,
abeExtend,
Manager,
User
} from '../../cli'

var route = function(req, res, next) {
res.redirect('/abe/editor')
var manager = {}
manager.home = {files: []}
manager.list = Manager.instance.getStructureAndTemplates()
manager.config = JSON.stringify(config)

var isHome = true
var jsonPath = null
var linkPath = null
var template = null
var fileName = null
var folderPath = null

var EditorVariables = {
user: res.user,
slugs: Manager.instance.getSlugs(),
filename: fileName,
folderPath: folderPath,
abeUrl: '/abe/editor/',
isHome: isHome,
config: config,
Locales: coreUtils.locales.instance.i18n,
abeVersion: pkg.version,
manager: manager
}

res.render('../views/template-home', EditorVariables)
}

export default route
4 changes: 3 additions & 1 deletion src/server/routes/get-main.js
Expand Up @@ -72,8 +72,10 @@ function renderAbeAdmin(EditorVariables, obj, filePath) {
if (filePath != null && filePath.indexOf('.json') > -1) {
EditorVariables.express.res.set('Content-Type', 'application/json')
EditorVariables.express.res.send(JSON.stringify(_json))
}else {
}else if(EditorVariables.pageHtml != ''){
EditorVariables.express.res.render(config.abeEngine, EditorVariables)
} else {
EditorVariables.express.res.render('../views/template-manager', EditorVariables)
}
}

Expand Down
30 changes: 19 additions & 11 deletions src/server/routes/get-reference.js
Expand Up @@ -9,20 +9,28 @@ import {
} from '../../cli'

var route = function(req, res){
var resHtml = ''
var manager = {}
manager.home = {files: []}
manager.list = Manager.instance.getStructureAndTemplates()
manager.config = JSON.stringify(config)

var page = path.join(__dirname + '/../views/list-references.html')
if (coreUtils.file.exist(page)) {
resHtml = fs.readFileSync(page, 'utf8')
}

var template = Handlebars.compile(resHtml, {noEscape: true})
var tmp = template({
var isHome = true
var jsonPath = null
var linkPath = null
var template = null
var fileName = null
var folderPath = null

var EditorVariables = {
user: res.user,
slugs: Manager.instance.getSlugs(),
abeUrl: '/abe/editor/',
Locales: coreUtils.locales.instance.i18n,
manager: manager,
config: JSON.stringify(config),
reference: Manager.instance.getReferences()
})

return res.send(tmp)
}
res.render('../views/list-references.html', EditorVariables)
}

export default route
29 changes: 19 additions & 10 deletions src/server/routes/get-structure.js
Expand Up @@ -9,21 +9,30 @@ import {
} from '../../cli'

var route = function(req, res){
var resHtml = ''
var manager = {}
manager.home = {files: []}
manager.list = Manager.instance.getStructureAndTemplates()
manager.config = JSON.stringify(config)

var page = path.join(__dirname + '/../views/list-structure.html')
if (coreUtils.file.exist(page)) {
resHtml = fs.readFileSync(page, 'utf8')
}

var isHome = true
var jsonPath = null
var linkPath = null
var template = null
var fileName = null
var folderPath = null
var structure = Manager.instance.getStructureAndTemplates().structure
structure = JSON.stringify(structure).replace(new RegExp(config.root, 'g'), '')
var template = Handlebars.compile(resHtml, {noEscape: true})
var tmp = template({

var EditorVariables = {
user: res.user,
slugs: Manager.instance.getSlugs(),
abeUrl: '/abe/editor/',
Locales: coreUtils.locales.instance.i18n,
manager: manager,
config: JSON.stringify(config),
structure: structure
})
return res.send(tmp)
}
res.render('../views/list-structure.html', EditorVariables)
}

export default route
36 changes: 30 additions & 6 deletions src/server/sass/modules/_bootstrap-extend.scss
@@ -1,3 +1,22 @@
.navbar {
margin-bottom: 0;
border-radius: 0;
background-color: #3C3C3C;
border-color: #3C3C3C;
}

.navbar-brand {
padding: 8px 15px;
}

.navbar-inverse .navbar-nav li a {
color: #fff;
}

.navbar-nav .dropdown-menu {
background-color: #000;
}

.page-header {
padding-bottom: 5px;
margin: 20px 0 6px 10px;
Expand All @@ -10,12 +29,12 @@
}

.btn-primary{
color: #fff;
background-color: #47b8e0;
border-color: #47b8e0;
transition: background 250ms ease-in;
color: #fff;
background-color: #47b8e0;
border-color: #47b8e0;
transition: background 250ms ease-in;
outline: none !important;
}
}

.btn-primary:hover, .btn-primary:focus {
background-color: #3999BB;
Expand All @@ -41,10 +60,15 @@
}

h1 {
margin-top: 0;
margin-bottom: 10px;
}

h1 small {
font-family: "Helvetica Neue", Helvetica, sans-serif;
font-weight: 600;
color: #000;
}

.panel-default {
margin-top: 10px;
}
Expand Down
9 changes: 6 additions & 3 deletions src/server/sass/modules/_common.scss
@@ -1,15 +1,18 @@
html,
body{
overflow: auto;
/*overflow: auto;*/
height: 100%;
}

html,
.abe-body{
overflow: hidden;
/*overflow: hidden;*/
}

.container-main{
height: calc(100% - 55px);
}

.container-main,
.container-main > .row,
.half-view,
.half-view > form{
Expand Down
7 changes: 6 additions & 1 deletion src/server/sass/modules/_editor-menu.scss
Expand Up @@ -52,7 +52,12 @@
border-color: #F95655;
}
.btn-save {
margin-right: 4px;
background-color: #6CC788;
padding-left: 7px;
padding-right: 7px;
}
.btn-publish {
background-color: #2196F3;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/server/sass/modules/_editor-ruler.scss
Expand Up @@ -3,7 +3,7 @@ body{
}

body.engine-open .ruler{
width: 5px;
width: 1px;
}

.ruler{
Expand Down

0 comments on commit 2928daf

Please sign in to comment.