new updates

pull/48/head
Henrique Dias 2016-01-31 22:14:17 +00:00
parent f66f5af562
commit 94a71a6eb3
22 changed files with 548 additions and 910 deletions

View File

@ -9,29 +9,14 @@ module.exports = function(grunt) {
grunt.initConfig({
watch: {
sass: {
files: ['assets/src/sass/**/*.scss'],
tasks: ['sass', 'concat', 'cssmin']
files: ['assets/src/css/**/*.css'],
tasks: ['concat', 'cssmin']
},
js: {
files: ['assets/src/js/**/*.js'],
tasks: ['uglify:main']
},
},
sass: {
dist: {
options: {
style: 'expanded',
sourcemap: 'none'
},
files: [{
expand: true,
cwd: 'assets/src/sass',
src: ['**/*.scss'],
dest: 'temp/css',
ext: '.css'
}]
}
},
concat: {
css: {
src: ['node_modules/normalize.css/normalize.css',
@ -39,10 +24,8 @@ module.exports = function(grunt) {
'node_modules/animate.css/source/_base.css',
'node_modules/animate.css/source/bouncing_entrances/bounceInRight.css',
'node_modules/animate.css/source/fading_exits/fadeOut.css',
'node_modules/codemirror/lib/codemirror.css',
'node_modules/codemirror/theme/ttcn.css',
'node_modules/jquery-datetimepicker/jquery.datetimepicker.css',
'temp/css/**/*.css'
'assets/src/css/main.css'
],
dest: 'temp/css/main.css',
},
@ -80,12 +63,6 @@ module.exports = function(grunt) {
'node_modules/noty/js/noty/packaged/jquery.noty.packaged.min.js',
'node_modules/jquery-pjax/jquery.pjax.js',
'node_modules/jquery-serializejson/jquery.serializejson.min.js',
'node_modules/codemirror/lib/codemirror.js',
'node_modules/codemirror/mode/css/css.js',
'node_modules/codemirror/mode/javascript/javascript.js',
'node_modules/codemirror/mode/markdown/markdown.js',
'node_modules/codemirror/mode/sass/sass.js',
'node_modules/codemirror/mode/htmlmixed/htmlmixed.js',
'node_modules/jquery-datetimepicker/jquery.datetimepicker.js'
]
}
@ -99,4 +76,4 @@ module.exports = function(grunt) {
});
grunt.registerTask('default', ['copy', 'sass', 'concat', 'cssmin', 'uglify']);
};
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

351
assets/src/css/main.css Normal file
View File

@ -0,0 +1,351 @@
body {
font-family: 'Roboto', sans-serif;
color: #212121;
height: 100%;
width: 100%;
}
code {
border-radius: .2em;
}
img {
max-width: 100%;
}
#content {
padding-top: 3em;
}
.full {
position: fixed;
height: calc(100% - 3em);
width: 100%;
}
h2 {
margin: .83em 0;
}
header {
color: #fff;
background-color: #37474f;
padding: .67em 0;
}
header h1 {
margin: 0;
}
.container {
margin: 0 auto;
width: 95%;
max-width: 800px;
}
.hidden {
display: none;
}
.left {
text-align: left;
}
.right {
text-align: right;
}
/* NAVIGATION */
body > nav {
position: fixed;
top: 0;
left: 0;
height: 3em;
width: 100%;
background-color: #2196F3;
padding: 0 1em;
box-sizing: border-box;
z-index: 999;
color: #eee;
}
body > nav ul {
margin: 0;
padding: 0;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
body > nav ul li {
list-style-type: none;
display: inline-block;
vertical-align: middle;
}
body > nav ul li:last-child {
margin-left: auto;
}
body > nav img {
height: 2em;
}
body > nav ul li a {
padding: .5em;
line-height: 2em;
display: block;
text-decoration: none;
color: inherit;
transition: .5s ease background-color;
}
body > nav ul li a:hover {
background-color: rgba(255, 255, 255, 0.57);
}
/* NOFICATIONS */
#noty_topRight_layout_container {
font-family: sans-serif;
top: 4em !important;
right: 1em !important;
position: fixed !important;
width: 310px;
height: auto;
margin: 0;
padding: 0;
list-style-type: none;
z-index: 10000000;
}
#noty_topRight_layout_container li {
overflow: hidden;
margin: 0 0 .25em;
}
.noty_bar {
color: #fff;
background-color: #cfd8dc;
border-radius: .3em;
}
.noty_message {
font-size: .75em;
font-weight: bold;
line-height: 1.2em;
text-align: left;
padding: 1em;
width: auto;
position: relative;
}
.noty_text {
display: block;
box-sizing: border-box;
margin-left: 3em;
top: 1em;
}
.noty_icon {
position: absolute;
left: 0;
top: 0;
box-sizing: border-box;
height: 100%;
padding: 1em;
background-color: rgba(0, 0, 0, .1);
border-top-left-radius: .3em;
border-bottom-left-radius: .3em;
text-align: center;
}
.noty_icon .fa {
width: 1em !important;
}
.noty_type_success {
background-color: #00c853;
}
.noty_type_error {
background-color: #ff5252;
}
.noty_type_warning {
background-color: #ffd600;
}
.noty_type_information {
background-color: #448aff;
}
/* EDITOR */
.editor h1 textarea {
width: 100%;
border: 0;
font-size: 2em;
font-weight: 400;
resize: none;
overflow: hidden;
line-height: 1em;
height: 1em;
}
button.add,
button.delete,
button.rename {
border-radius: 0.2em;
border: 0;
color: #fff;
font-weight: normal;
}
button.add {
background-color: #8BC34A;
}
button.delete {
background-color: #F44336;
}
button.rename {
background-color: #1565C0;
}
.block > .actions,
fieldset > .actions {
position: absolute;
top: 0.5em;
right: 0.5em;
}
.blocks {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.block,
fieldset {
background-color: #EAEAEA;
padding: 0.6em;
box-sizing: border-box;
margin: 0 0 1em;
position: relative;
flex-basis: 49%;
border: 0;
}
.block label,
fieldset label,
fieldset h3 {
font-weight: bold;
display: block;
margin-top: 0;
font-size: 1em;
}
.block textarea {
width: 100%;
resize: vertical;
background-color: inherit;
border: 0;
}
.block input,
fieldset input {
border: 0;
outline: 0;
background-color: transparent;
width: 100%;
}
fieldset input {
width: calc(100% - 1.57em);
margin: 0.5em 0;
}
.editor.complete .block[data-content="title"] {
display: none;
}
/* TOGGLER, SOURCE AND PREVIEW */
.editor .content {
border-radius: 0.5em;
border: 1px solid #d8d8d8;
background-color: #f7f7f7;
}
.editor .content nav a {
padding: 1em 1em;
line-height: 3em;
cursor: pointer;
font-size: 1em;
}
.ace_editor {
margin: 0;
}
.ace_gutter {
background-color: #f7f7f7 !important;
}
/* BROWSE */
.browse a {
color: inherit;
text-decoration: none;
}
.browse table {
width: 100%;
}
.browse .actions {
background-color: #455a64;
color: #fff;
padding: 1.5em 0;
}
.browse .actions .container {
margin: 0 auto;
display: flex;
}
.browse .actions .fa {
vertical-align: middle;
}
.browse .actions .go-right {
margin-left: auto;
position: relative;
}
.browse tr {
line-height: 2em;
border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}
.browse #new-file {
display: none;
position: absolute;
right: 0;
top: 2.5em;
background-color: #263238;
color: rgba(255, 255, 255, .5);
border-radius: .5em;
padding: 1em;
width: 182%;
}

1
assets/src/css/main.min.css vendored Normal file
View File

@ -0,0 +1 @@
.full,body{width:100%}.full,body>nav{position:fixed}.noty_icon,body>nav{left:0;box-sizing:border-box}.block,.noty_icon,.noty_text,body>nav,fieldset{box-sizing:border-box}.browse .actions .fa,body>nav ul li{vertical-align:middle}body{font-family:Roboto,sans-serif;color:#212121;height:100%}code{border-radius:.2em}img{max-width:100%}#content{padding-top:3em}.full{height:calc(100% - 3em)}h2{margin:.83em 0}header{color:#fff;background-color:#37474f;padding:.67em 0}header h1{margin:0}.container{margin:0 auto;width:95%;max-width:800px}.hidden{display:none}.left{text-align:left}.right{text-align:right}body>nav{top:0;height:3em;width:100%;background-color:#2196F3;padding:0 1em;z-index:999;color:#eee}body>nav ul{margin:0;padding:0;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex}body>nav ul li{list-style-type:none;display:inline-block}body>nav ul li:last-child{margin-left:auto}body>nav img{height:2em}body>nav ul li a{padding:.5em;line-height:2em;display:block;text-decoration:none;color:inherit;transition:.5s ease background-color}body>nav ul li a:hover{background-color:rgba(255,255,255,.57)}#noty_topRight_layout_container{font-family:sans-serif;top:4em!important;right:1em!important;position:fixed!important;width:310px;height:auto;margin:0;padding:0;list-style-type:none;z-index:10000000}#noty_topRight_layout_container li{overflow:hidden;margin:0 0 .25em}.noty_bar{color:#fff;background-color:#cfd8dc;border-radius:.3em}.noty_message{font-size:.75em;font-weight:700;line-height:1.2em;text-align:left;padding:1em;width:auto;position:relative}.noty_text{display:block;margin-left:3em;top:1em}.noty_icon{position:absolute;top:0;height:100%;padding:1em;background-color:rgba(0,0,0,.1);border-top-left-radius:.3em;border-bottom-left-radius:.3em;text-align:center}.noty_icon .fa{width:1em!important}.noty_type_success{background-color:#00c853}.noty_type_error{background-color:#ff5252}.noty_type_warning{background-color:#ffd600}.noty_type_information{background-color:#448aff}.editor h1 textarea{width:100%;border:0;font-size:2em;font-weight:400;resize:none;overflow:hidden;line-height:1em;height:1em}button.add,button.delete,button.rename{border-radius:.2em;border:0;color:#fff;font-weight:400}button.add{background-color:#8BC34A}button.delete{background-color:#F44336}button.rename{background-color:#1565C0}.block>.actions,fieldset>.actions{position:absolute;top:.5em;right:.5em}.blocks{display:flex;flex-wrap:wrap;justify-content:space-between}.block,fieldset{background-color:#EAEAEA;padding:.6em;margin:0 0 1em;position:relative;flex-basis:49%;border:0}.block label,fieldset h3,fieldset label{font-weight:700;display:block;margin-top:0;font-size:1em}.block textarea{width:100%;resize:vertical;background-color:inherit;border:0}.block input,fieldset input{border:0;outline:0;background-color:transparent;width:100%}fieldset input{width:calc(100% - 1.57em);margin:.5em 0}.editor.complete .block[data-content=title]{display:none}.editor .content{border-radius:.5em;border:1px solid #d8d8d8;background-color:#f7f7f7}.editor .content nav a{padding:1em;line-height:3em;cursor:pointer;font-size:1em}.ace_editor{margin:0}.ace_gutter{background-color:#f7f7f7!important}.browse a{color:inherit;text-decoration:none}.browse table{width:100%}.browse .actions{background-color:#455a64;color:#fff;padding:1.5em 0}.browse .actions .container{margin:0 auto;display:flex}.browse .actions .go-right{margin-left:auto;position:relative}.browse tr{line-height:2em;border-bottom:1px solid rgba(0,0,0,.03)}.browse #new-file{display:none;position:absolute;right:0;top:2.5em;background-color:#263238;color:rgba(255,255,255,.5);border-radius:.5em;padding:1em;width:182%}

View File

@ -4,7 +4,7 @@ $(document).ready(function() {
$(document).on('ready pjax:success', function() {
// Starts the perfect scroolbar plugin
$('.scroll').perfectScrollbar();
//$('.scroll').perfectScrollbar();
$('.datetimepicker').datetimepicker({
format: 'Y-m-d H:i:s+00:00'
});
@ -191,7 +191,25 @@ $(document).on('ready pjax:success', function() {
// If it's editor page
if ($(".editor")[0]) {
editor = false;
function autoGrow(element) {
this.style.height = "5px";
this.style.height = (this.scrollHeight) + "px";
}
$('textarea').keyup(autoGrow);
$("textarea").each(autoGrow);
var editor = ace.edit("source-area");
editor.getSession().setMode("ace/mode/markdown");
editor.setOptions({
wrap: true,
maxLines: Infinity,
theme: "ace/theme/github",
showPrintMargin: false,
fontSize: "1em"
});
preview = $("#preview-area");
textarea = $("#content-area");
@ -253,29 +271,43 @@ $(document).on('ready pjax:success', function() {
// Adds one more field to the current group
$("body").on('click', '.add', function(event) {
event.preventDefault();
defaultId = "new-admin-item-123";
if ($("#new-admin-item-123").length) {
if ($("#" + defaultId).length) {
return false;
}
title = $(this).parent().parent();
fieldset = title.parent();
fieldset = $(this).parent().parent();
type = fieldset.data("type");
name = fieldset.attr("id");
if (title.is('h1')) {
fieldset = $('.frontmatter .container');
fieldset.prepend('<div id="ghost-admin-item-123"></div>');
title = $('#ghost-admin-item-123');
// Main add button, below the title
if (fieldset.is('div') && fieldset.hasClass("frontmatter")) {
fieldset = $('.blocks');
fieldset.prepend('<div class="block" id="' + defaultId + '"></div>');
title = $("#" + defaultId);
type = "object";
}
if (type == "array") {
name = name + "[]";
input = name;
input = input.replace(/\[/, '\\[');
input = input.replace(/\]/, '\\]');
input = '#' + input;
fieldset.append('<div id="' + name + '-' + $(input).length + '" data-type="array-item"><input name="' + name + ':auto" id="' + name + '"></input><span class="actions"> <button class="delete">&#8722;</button></span></div></div>');
}
/*
/* WHAT IS THIS FOR?
if (title.is('h2')) {
type = "object"
}
if (type == "object") {
title.after('<input id="new-admin-item-123" placeholder="Write the field name and press enter..."></input>');
fieldset.after('<input id="new-admin-item-123" placeholder="Write the field name and press enter..."></input>');
element = $("#new-admin-item-123");
if (!document.cookie.replace(/(?:(?:^|.*;\s*)placeholdertip\s*\=\s*([^;]*).*$)|^.*$/, "$1")) {
@ -339,15 +371,7 @@ $(document).on('ready pjax:success', function() {
});
}
if (type == "array") {
name = name + "[]";
input = name;
input = input.replace(/\[/, '\\[');
input = input.replace(/\]/, '\\]');
input = '#' + input;
title.after('<div id="' + name + '-' + $(input).length + '" data-type="array-item"><input name="' + name + ':auto" id="' + name + '"></input></div>');
}
*/
return false;
});
@ -410,4 +434,4 @@ $(document).on('ready pjax:success', function() {
});
}
}
});
});

View File

@ -1,45 +0,0 @@
.browse a {
color : inherit;
text-decoration: none;
}
.browse table {
width: 100%;
}
.browse .actions {
background-color: #455a64;
color : #fff;
padding : 1.5em 0;
}
.browse .actions .container {
margin : 0 auto;
display: flex;
}
.browse .actions .fa {
vertical-align: middle;
}
.browse .actions .go-right {
margin-left: auto;
position : relative;
}
.browse tr {
line-height : 2em;
border-bottom: 1px solid rgba(0,0,0,0.03);
}
.browse #new-file {
display : none;
position : absolute;
right : 0;
top : 2.5em;
background-color: #263238;
color : rgba(255,255,255,.5);
border-radius : .5em;
padding : 1em;
width : 182%;
}

View File

@ -1,206 +0,0 @@
/* EDITOR GENERAL STYLES */
.editor .frontmatter {
overflow-y : auto;
overflow-x : hidden;
color : #37474f;
box-sizing : border-box;
background-color: #ddd;
}
.editor .frontmatter h2 {
margin-top: 0;
}
.editor #content-area {
display: none;
}
.editor #preview-area,
.editor .CodeMirror {
position : relative;
box-sizing: border-box;
height : 100%;
width : 100%;
border : 0;
padding : 1.5em 10%;
font-size : 1.05em;
}
.editor .CodeMirror {
padding: 0;
}
.editor #preview-area *:first-child {
margin-top: 0;
}
.editor h3 {
font-size : 1em;
margin : 0 0 .25em;
font-weight: bold;
}
.toolbar {
position : fixed;
bottom : 0;
right : 0;
width : 100%;
background-color: #455a64;
height : 3em;
display : flex;
padding : .5em 1em;
box-sizing : border-box;
z-index : 999;
}
.toolbar .left {
margin-right: auto;
}
.toolbar input {
margin-left: 1em !important;
}
/* EDITOR FRONTMATTER ONLY STYLES */
.frontmatter-only .box,
.content-only .box {
height: calc(100% - 6em);
}
.frontmatter-only .frontmatter {
width: 100%;
}
.frontmatter-only input {
background-color: rgba(255,255,255,0.4);
color : #aaa;
}
.frontmatter-only label {
width: 100%;
}
.frontmatter-only input:focus {
color: #555;
}
.frontmatter-only .toolbar input,
.frontmatter-only .toolbar input:focus {
color: #fff;
}
.frontmatter-only fieldset {
border-top: 1px solid rgba(0,0,0,.1);
}
.frontmatter-only fieldset:first-child {
border-bottom: 1px solid rgba(0,0,0,.1);
}
.frontmatter-only h3 {
font-size: 1.5em;
}
.frontmatter-only h1,
.frontmatter-only h3,
.frontmatter-only label {
position: relative !important;
}
input::-webkit-input-placeholder,
input:-moz-placeholder,
input::-moz-placeholder,
input:-ms-input-placeholder {
color: #fff;
}
/* EDITOR CONTENT ONLY STYLES */
.editor.content-only #content-area,
.editor.content-only #preview-area {
padding: 0;
}
/* EDITOR FULL STYLES */
.editor.complete .frontmatter {
position : fixed;
left : 0;
top : 3em;
width : 25%;
padding : 1.5em 1em;
background-color: #37474f;
color : #ddd;
height : calc(100% - 3em);
}
.editor.complete .container {
position : fixed;
top : 3em;
right : 0;
width : 75%;
max-width: none;
height : calc(100% - 6em);
margin : 0;
}
.editor.complete .toolbar {
width: 75%;
}
.editor.complete .CodeMirror {
width : auto;
margin : 1.5em 10%;
height : calc(100% - 3em);
box-sizing: border-box;
}
@media screen and (max-width: 1000px) {
.editor.complete .frontmatter {
width: 35%;
}
.editor.complete .container {
width: 65%;
}
.editor.complete .toolbar {
width: 65%;
}
.hideable {
display: none;
}
}
@media screen and (max-width: 800px) {
.editor.complete .frontmatter,
.editor.complete .container {
position: static;
width : 100%;
display : block;
top : 0;
height : auto;
}
.editor.complete .full {
height: calc(100% - 6em);
}
.editor.complete .toolbar {
width: 100%;
}
.editor.complete #preview-area {
padding: 1.5em 1em;
}
.editor.complete .CodeMirror {
margin: 1.5em 1em;
}
}
@media screen and (max-width: 530px) {
nav {
overflow : hidden;
text-align: center;
}
}

View File

@ -1,142 +0,0 @@
/* FORMS ELEMENTS */
pre {
background-color: #ddd;
padding : .2em;
line-height : 1.5em;
border-radius : .5em;
}
input,
textarea {
width : 100%;
background-color: rgba(0, 0, 0, 0.25);
color : rgba(255, 255, 255, 0.3);
border : 0;
border-radius : 5px;
padding : .5em 1em;
box-sizing : border-box;
margin : .5em 0;
line-height : 1.25em;
transition : .5s ease-out all;
}
input:focus {
color : rgba(255, 255, 255, 0.7);
border : 0;
outline: 0;
}
textarea {
transition: none;
resize : vertical;
min-height: 4em;
}
label {
width : 10.5em;
display: inline-block;
margin : .1em 0 0;
}
fieldset {
border : 0;
margin : 1em 0 0;
padding : 1em 0 0;
border-top: 1px solid rgba(255, 255, 255, 0.25);
}
fieldset:first-child {
border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}
input[type="file"] {
display: none;
}
button,
input[type="submit"] {
border : 0;
color : #fff;
margin : 0;
padding : .5em 1em;
border-radius : 10px;
font-size : .9em;
width : auto;
line-height : 1em;
background-color: #bbb;
transition : .3s ease all;
}
button,
input[type="submit"],
button:active,
input[type="submit"]:active,
button:hover,
input[type="submit"]:hover,
button:focus,
input[type="submit"]:focus {
outline: 0;
}
button:hover,
input[type="submit"]:hover,
button:active,
input[type="submit"]:active,
button:focus,
input[type="submit"]:focus {
background-color: #999;
color : #fff;
}
button.default,
input[type="submit"].default {
background-color: #2196f3;
}
button.default:hover,
input[type="submit"].default:hover,
button.default:active,
input[type="submit"].default:active {
background-color: #1e88e5;
}
button.add,
button.delete {
vertical-align: middle;
border-radius : 50%;
height : 1.5em;
width : 1.5em;
font-size : .7rem;
padding : 0;
}
button.add {
background-color: #00c853;
}
button.delete {
background-color: #ff5252;
}
.editor .actions {
opacity : 0;
transition: .2s ease-in-out opacity;
}
div[data-type="array-item"] {
position: relative;
}
label:hover > .actions,
h1:hover > .actions,
h2:hover > .actions,
h3:hover > .actions,
div[data-type="array-item"]:hover .actions {
opacity: .7;
}
input[data-parent-type="array"] + .actions {
position: absolute;
top : 1em;
right : .5em;
}

View File

@ -1,49 +0,0 @@
nav {
position : fixed;
top : 0;
left : 0;
height : 3em;
width : 100%;
background-color: #263238;
padding : 0 1em;
box-sizing : border-box;
z-index : 999;
color : #eee;
}
nav ul {
margin : 0;
padding: 0;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
nav ul li {
list-style-type: none;
display : inline-block;
vertical-align : middle;
}
nav ul li:last-child {
margin-left: auto;
}
nav img {
height: 2em;
}
nav ul li a {
padding : .5em;
line-height : 2em;
display : block;
text-decoration: none;
color : inherit;
transition : .5s ease background-color;
}
nav ul li a:hover {
background-color: rgba(255, 255, 255, 0.57);
}

View File

@ -1,77 +0,0 @@
#noty_topRight_layout_container {
font-family : sans-serif;
top : 4em !important;
right : 1em !important;
position : fixed !important;
width : 310px;
height : auto;
margin : 0;
padding : 0;
list-style-type: none;
z-index : 10000000;
}
#noty_topRight_layout_container li {
overflow: hidden;
margin : 0 0 .25em;
}
.noty_bar {
color : #fff;
background-color: #cfd8dc;
border-radius : .3em;
}
.noty_message {
font-size : .75em;
font-weight: bold;
line-height: 1.2em;
text-align : left;
padding : 1em;
width : auto;
position : relative;
}
.noty_text {
display : block;
box-sizing : border-box;
margin-left: 3em;
top : 1em;
}
.noty_icon {
position : absolute;
left : 0;
top : 0;
box-sizing : border-box;
height : 100%;
padding : 1em;
background-color : rgba(0,0,0,.1);
border-top-left-radius : .3em;
border-bottom-left-radius: .3em;
text-align : center;
}
.noty_icon .fa {
width: 1em !important;
}
.noty_type_alert {
}
.noty_type_success {
background-color: #00c853;
}
.noty_type_error {
background-color: #ff5252;
}
.noty_type_warning {
background-color: #ffd600;
}
.noty_type_information {
background-color: #448aff;
}

View File

@ -1,147 +0,0 @@
/* perfect-scrollbar v0.6.5 */
.ps-container {
-ms-touch-action: none;
overflow : hidden !important;
}
.ps-container.ps-active-x > .ps-scrollbar-x-rail,
.ps-container.ps-active-y > .ps-scrollbar-y-rail {
display: block;
}
.ps-container.ps-in-scrolling {
pointer-events: none;
}
.ps-container.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail {
background-color: #eee;
opacity : .9;
}
.ps-container.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail > .ps-scrollbar-x {
background-color: #999;
}
.ps-container.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail {
background-color: #eee;
opacity : .9;
}
.ps-container.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail > .ps-scrollbar-y {
background-color: #999;
}
.ps-container > .ps-scrollbar-x-rail {
display : none;
position : absolute;
/* please don't change 'position' */
-webkit-border-radius: 4px;
-moz-border-radius : 4px;
-ms-border-radius : 4px;
border-radius : 4px;
opacity : 0;
-webkit-transition : background-color .2s linear, opacity .2s linear;
-moz-transition : background-color .2s linear, opacity .2s linear;
-o-transition : background-color .2s linear, opacity .2s linear;
transition : background-color .2s linear, opacity .2s linear;
bottom : 3px;
/* there must be 'bottom' for ps-scrollbar-x-rail */
height : 8px;
}
.ps-container > .ps-scrollbar-x-rail > .ps-scrollbar-x {
position : absolute;
/* please don't change 'position' */
background-color : #aaa;
-webkit-border-radius: 4px;
-moz-border-radius : 4px;
-ms-border-radius : 4px;
border-radius : 4px;
-webkit-transition : background-color .2s linear;
-moz-transition : background-color .2s linear;
-o-transition : background-color .2s linear;
transition : background-color .2s linear;
bottom : 0;
/* there must be 'bottom' for ps-scrollbar-x */
height : 8px;
}
.ps-container > .ps-scrollbar-y-rail {
display : none;
position : absolute;
/* please don't change 'position' */
-webkit-border-radius: 4px;
-moz-border-radius : 4px;
-ms-border-radius : 4px;
border-radius : 4px;
opacity : 0;
-webkit-transition : background-color .2s linear, opacity .2s linear;
-moz-transition : background-color .2s linear, opacity .2s linear;
-o-transition : background-color .2s linear, opacity .2s linear;
transition : background-color .2s linear, opacity .2s linear;
right : 3px;
/* there must be 'right' for ps-scrollbar-y-rail */
width : 8px;
}
.ps-container > .ps-scrollbar-y-rail > .ps-scrollbar-y {
position : absolute;
/* please don't change 'position' */
background-color : #aaa;
-webkit-border-radius: 4px;
-moz-border-radius : 4px;
-ms-border-radius : 4px;
border-radius : 4px;
-webkit-transition : background-color .2s linear;
-moz-transition : background-color .2s linear;
-o-transition : background-color .2s linear;
transition : background-color .2s linear;
right : 0;
/* there must be 'right' for ps-scrollbar-y */
width : 8px;
}
.ps-container:hover.ps-in-scrolling {
pointer-events: none;
}
.ps-container:hover.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail {
background-color: #eee;
opacity : .9;
}
.ps-container:hover.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail > .ps-scrollbar-x {
background-color: #999;
}
.ps-container:hover.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail {
background-color: #eee;
opacity : .9;
}
.ps-container:hover.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail > .ps-scrollbar-y {
background-color: #999;
}
.ps-container:hover > .ps-scrollbar-x-rail,
.ps-container:hover > .ps-scrollbar-y-rail {
opacity: .6;
}
.ps-container:hover > .ps-scrollbar-x-rail:hover {
background-color: #eee;
opacity : .9;
}
.ps-container:hover > .ps-scrollbar-x-rail:hover > .ps-scrollbar-x {
background-color: #999;
}
.ps-container:hover > .ps-scrollbar-y-rail:hover {
background-color: #eee;
opacity : .9;
}
.ps-container:hover > .ps-scrollbar-y-rail:hover > .ps-scrollbar-y {
background-color: #999;
}

View File

@ -1,68 +0,0 @@
@import "navigation";
@import "scrollbar";
@import "notifications";
@import 'editor';
@import 'forms';
@import "browse";
body {
font-family: 'Roboto', sans-serif;
color : #212121;
height : 100%;
width : 100%;
}
code {
border-radius: .2em;
}
img {
max-width: 100%;
}
#content {
position: fixed;
top : 3em;
left : 0;
width : 100%;
height : calc(100% - 3em);
overflow: hidden;
}
.full {
position: fixed;
height : calc(100% - 3em);
width : 100%;
}
h2 {
margin: .83em 0;
}
header {
color : #fff;
background-color: #37474f;
padding : .67em 0;
}
header h1 {
margin: 0;
}
.container {
margin : 1.5em auto;
width : 80%;
max-width: 800px;
}
.hidden {
display: none;
}
.left {
text-align: left;
}
.right {
text-align: right;
}

View File

@ -72,7 +72,7 @@ func GET(w http.ResponseWriter, r *http.Request, c *config.Config, filename stri
// Parses the page content and the frontmatter
page.Content = strings.TrimSpace(string(file.Content()))
page.FrontMatter, err = frontmatter.Pretty(file.FrontMatter())
page.FrontMatter, page.Name, err = frontmatter.Pretty(file.FrontMatter())
page.Class = "complete"
} else {
// The editor will handle only content
@ -86,9 +86,9 @@ func GET(w http.ResponseWriter, r *http.Request, c *config.Config, filename stri
// Checks if the file already has the frontmatter rune and parses it
if hasFrontMatterRune(file) {
page.FrontMatter, err = frontmatter.Pretty(file)
page.FrontMatter, _, err = frontmatter.Pretty(file)
} else {
page.FrontMatter, err = frontmatter.Pretty(appendFrontMatterRune(file, page.Mode))
page.FrontMatter, _, err = frontmatter.Pretty(appendFrontMatterRune(file, page.Mode))
}
// Check if there were any errors

View File

@ -12,20 +12,22 @@ import (
const mainName = "#MAIN#"
var mainTitle = ""
// Pretty creates a new FrontMatter object
func Pretty(content []byte) (interface{}, error) {
func Pretty(content []byte) (interface{}, string, error) {
frontType := parser.DetectFrontMatter(rune(content[0]))
front, err := frontType.Parse(content)
if err != nil {
return []string{}, err
return []string{}, mainTitle, err
}
object := new(frontmatter)
object.Type = "object"
object.Name = mainName
return rawToPretty(front, object), nil
return rawToPretty(front, object), mainTitle, nil
}
type frontmatter struct {
@ -62,6 +64,10 @@ func rawToPretty(config interface{}, parent *frontmatter) interface{} {
} else if utils.IsSlice(element) {
arrays = append(arrays, handleArrays(element, parent, name))
} else {
if name == "title" && parent.Name == mainName {
mainTitle = element.(string)
}
fields = append(fields, handleFlatValues(element, parent, name))
}
}

View File

@ -1,6 +1,6 @@
//go:generate go get github.com/jteeuwen/go-bindata
//go:generate go install github.com/jteeuwen/go-bindata/go-bindata
//go:generate go-bindata -pkg assets -o assets/assets.go templates/ assets/css/ assets/js/ assets/fonts/
//go:generate go-bindata -debug -pkg assets -o assets/assets.go templates/ assets/css/ assets/js/ assets/fonts/
package hugo

View File

@ -18,14 +18,12 @@
},
"dependencies": {
"animate.css": "^3.4.0",
"codemirror": "^5.6.0",
"font-awesome": "^4.4.0",
"jquery": "^2.1.4",
"jquery-datetimepicker": "^2.4.0",
"jquery-serializejson": "^2.5.0",
"normalize.css": "^3.0.3",
"noty": "^2.3.6",
"perfect-scrollbar": "^0.6.4",
"showdown": "^1.2.3"
},
"devDependencies": {

View File

@ -12,14 +12,17 @@
<link rel="stylesheet" href="/admin/assets/css/main.min.css">
{{ if and (Defined . "Config")}}{{ if not (eq .Config.Styles "") }}<link rel="stylesheet" href="{{ .Config.Styles }}">{{ end }}{{ end }}
{{ if and (Defined . "User") }}{{ if not (eq .User.Styles "") }}<link rel="stylesheet" href="{{ .User.Styles }}">{{ end }}{{ end }}
<script src="/admin/assets/js/plugins.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.3/ace.js"></script>
<script src="/admin/assets/js/app.min.js"></script>
</head>
<body>
<nav>
<ul>
<li><a href="/"><i class="fa fa-home fa-lg"></i> Home</a></li>
<li><a href="/"><i class="fa fa-home fa-lg"></i> Go to website</a></li>
<li><a data-pjax href="/admin/browse/content/"><i class="fa fa-newspaper-o"></i> Content</a></li>
<li><a data-pjax href="/admin/browse/"><i class="fa fa-folder-o"></i> Browse</a></li>
<li><a data-pjax href="/admin/settings/"><i class="fa fa-cog"></i> Settings</a></li>

View File

@ -1,11 +1,7 @@
{{ define "content" }}{{ $path := .Path }}
<div class="full scroll">
<header>
<div class="container">
<h1>{{ $path }}</h1>
</div>
</header>
<div class="container">
<h1>{{ $path }}</h1>
<main class="browse">
<div class="actions">
@ -14,7 +10,7 @@
<div class="go-right">
<input type="file" value="Upload" multiple>
<button id="upload">Upload <i class="fa fa-cloud-upload"></i></button>
<button class="default new">New <i class="fa fa-plus"></i></button>
<button class="default new">New &#43;</button>
<div id="new-file">
Write the name of the new file. If you want to use an archetype, add ':archetype' in the end, replacing 'archetype' by its name.
<input id="new-file-name" type="text">
@ -23,44 +19,44 @@
</div>
</div>
<div class="container">
<table>
<tr>
<th class="left">
{{if and (eq .Sort "name") (ne .Order "desc")}}
<a data-pjax href="?sort=name&order=desc">Name <i class="fa fa-arrow-up"></i></a> {{else if and (eq .Sort "name") (ne .Order "asc")}}
<a data-pjax href="?sort=name&order=asc">Name <i class="fa fa-arrow-down"></i></a> {{else}}
<a data-pjax href="?sort=name&order=asc">Name</a> {{end}}
</th>
<th class="right hideable">
{{if and (eq .Sort "size") (ne .Order "desc")}}
<a data-pjax href="?sort=size&order=desc">Size <i class="fa fa-arrow-up"></i></a> {{else if and (eq .Sort "size") (ne .Order "asc")}}
<a data-pjax href="?sort=size&order=asc">Size <i class="fa fa-arrow-down"></i></a> {{else}}
<a data-pjax href="?sort=size&order=asc">Size</a> {{end}}
</th>
<th class="hideable right">
{{if and (eq .Sort "time") (ne .Order "desc")}}
<a href="?sort=time&order=desc">Modified <i class="fa fa-arrow-up"></i></a> {{else if and (eq .Sort "time") (ne .Order "asc")}}
<a href="?sort=time&order=asc">Modified <i class="fa fa-arrow-down"></i></a> {{else}}
<a href="?sort=time&order=asc">Modified</a> {{end}}
</th>
<th class="right"></th>
</tr>
{{range .Items}}
<tr>
<td>
{{if .IsDir}}
<i class="fa fa-folder"></i> <a data-pjax href="{{.URL}}">{{.Name}}</a> {{else}} {{ if CanBeEdited .URL }}
<i class="fa fa-file"></i> <a data-pjax class="file" href="/admin/edit{{ $path }}{{.URL}}">{{.Name}}</a> {{ else }}
<i class="fa fa-file"></i> {{.Name}} {{ end }} {{ end }}
</td>
<td class="right hideable">{{.HumanSize}}</td>
<td class="right hideable">{{.HumanModTime "01/02/2006 3:04:05 PM -0700"}}</td>
<td class="right"><button data-file="/admin/browse{{ $path }}{{.URL}}" data-message="File deleted." class="delete"><i class="fa fa-times"></i></button></td>
</tr>
{{end}}
</table>
</div>
<table>
<tr>
<th class="left">
{{if and (eq .Sort "name") (ne .Order "desc")}}
<a data-pjax href="?sort=name&order=desc">Name <i class="fa fa-arrow-up"></i></a> {{else if and (eq .Sort "name") (ne .Order "asc")}}
<a data-pjax href="?sort=name&order=asc">Name <i class="fa fa-arrow-down"></i></a> {{else}}
<a data-pjax href="?sort=name&order=asc">Name</a> {{end}}
</th>
<th class="right hideable">
{{if and (eq .Sort "size") (ne .Order "desc")}}
<a data-pjax href="?sort=size&order=desc">Size <i class="fa fa-arrow-up"></i></a> {{else if and (eq .Sort "size") (ne .Order "asc")}}
<a data-pjax href="?sort=size&order=asc">Size <i class="fa fa-arrow-down"></i></a> {{else}}
<a data-pjax href="?sort=size&order=asc">Size</a> {{end}}
</th>
<th class="hideable right">
{{if and (eq .Sort "time") (ne .Order "desc")}}
<a href="?sort=time&order=desc">Modified <i class="fa fa-arrow-up"></i></a> {{else if and (eq .Sort "time") (ne .Order "asc")}}
<a href="?sort=time&order=asc">Modified <i class="fa fa-arrow-down"></i></a> {{else}}
<a href="?sort=time&order=asc">Modified</a> {{end}}
</th>
<th class="right"></th>
<th class="right"></th>
</tr>
{{range .Items}}
<tr>
<td>
{{if .IsDir}}
<i class="fa fa-folder"></i> <a data-pjax href="{{.URL}}">{{.Name}}</a> {{else}} {{ if CanBeEdited .URL }}
<i class="fa fa-file"></i> <a data-pjax class="file" href="/admin/edit{{ $path }}{{.URL}}">{{.Name}}</a> {{ else }}
<i class="fa fa-file"></i> {{.Name}} {{ end }} {{ end }}
</td>
<td class="right hideable">{{.HumanSize}}</td>
<td class="right hideable">{{.HumanModTime "01/02/2006 3:04:05 PM"}}</td>
<td class="right"><button data-file="/admin/browse{{ $path }}{{.URL}}" data-message="File renamed." class="rename">&#9998;</button></td>
<td class="right"><button data-file="/admin/browse{{ $path }}{{.URL}}" data-message="File deleted." class="delete">&#10006;</button></td>
</tr>
{{end}}
</table>
</main>
</div>
{{ end }}

View File

@ -2,57 +2,59 @@
<div class="editor {{ .Class }}">
<form method="POST" action="">
<div class="full box scroll">
<div class="container">
<main>
{{ if not (eq .Class "complete") }}
<header>
<div class="container">
<h1>{{ .Name }}{{ if eq .Class "frontmatter-only" }}
<span class="actions">
<button class="add"><i class="fa fa-plus"></i></button>
</span>{{ end }}
</h1>
</div>
</header>
{{ end }} {{ if eq .Class "frontmatter-only" }}
<div class="frontmatter">
<div class="container">
{{ template "frontmatter" .FrontMatter }}
</div>
</div>
{{ else if eq .Class "content-only" }}
<div class="container">
<textarea id="content-area" name="content" class="scroll" data-mode="{{ .Mode }}">{{ .Content }}</textarea>
<div id="preview-area" class="scroll hidden"></div>
</div>
{{ else }}
<div class="container">
<textarea id="content-area" name="content" class="scroll" data-mode="{{ .Mode }}">{{ .Content }}</textarea>
<div id="preview-area" class="scroll hidden"></div>
</div>
<div class="frontmatter scroll">
<h2>Metadata
<h1>{{ .Name }}{{ if eq .Class "frontmatter-only" }}
<span class="actions">
<button class="add"><i class="fa fa-plus"></i></button>
</span>
</h2>
<button class="add">&#43;</button>
</span>{{ end }}
</h1>
{{ end }} {{ if eq .Class "frontmatter-only" }}
<div class="frontmatter blocks">
{{ template "frontmatter" .FrontMatter }}
</div>
{{ else if eq .Class "content-only" }}
<textarea id="content-area" name="content" class="scroll" data-mode="{{ .Mode }}">{{ .Content }}</textarea>
<div id="preview-area" class="scroll hidden"></div>
{{ else }}
<div class="frontmatter">
<h1><textarea>{{ .Name }}</textarea></h1>
<p class="actions">
<button class="add">Add field</button>
</p>
<div class="blocks">
{{ template "frontmatter" .FrontMatter }}
</div>
</div>
<div class="content">
<nav>
<a id="see-source"><i class="fa fa-code"></i> Source</a>
<a id="see-preview"><i class="fa fa-eye"></i> Preview</a>
</nav>
<textarea id="source-area" name="content" data-mode="{{ .Mode }}">{{ .Content }}</textarea>
<div id="preview-area"></div>
</div>
{{ end }}
</main>
</div>
<div class="toolbar">
{{ if or (eq .Mode "markdown") (eq .Class "complete") }}
<button id="preview" class="left">Preview</button>
{{ else }}
<span class="left"></span>
{{ end }}
<input type="submit" data-type="{{ .Class }}" data-message="{{ if eq .Class "frontmatter-only" }}The fields were put on their way.{{ else if eq .Class "content-only" }}Every byte was saved.{{ else }}Post saved with pomp and circumstance.{{ end }}"
data-regenerate="false" value="Save"> {{ if and (eq .Class "complete") ( .IsPost ) }}
<input type="submit" data-type="{{ .Class }}" data-message="Post scheduled." data-schedule="true" value="Schedule"> {{ end }}
<input type="submit" data-type="{{ .Class }}" data-message="{{ if eq .Class "frontmatter-only" }}Saved and regenerated.{{ else if eq .Class "content-only" }}Done. What do you want more?{{ else }}Post published. Go and share it!{{ end }}" data-regenerate="true"
class="default" value="Publish">
<div class="toolbar">
{{ if or (eq .Mode "markdown") (eq .Class "complete") }}
<button id="preview" class="left">Preview</button>
{{ else }}
<span class="left"></span>
{{ end }}
<input type="submit" data-type="{{ .Class }}" data-message="{{ if eq .Class "frontmatter-only" }}The fields were put on their way.{{ else if eq .Class "content-only" }}Every byte was saved.{{ else }}Post saved with pomp and circumstance.{{ end }}"
data-regenerate="false" value="Save"> {{ if and (eq .Class "complete") ( .IsPost ) }}
<input type="submit" data-type="{{ .Class }}" data-message="Post scheduled." data-schedule="true" value="Schedule"> {{ end }}
<input type="submit" data-type="{{ .Class }}" data-message="{{ if eq .Class "frontmatter-only" }}Saved and regenerated.{{ else if eq .Class "content-only" }}Done. What do you want more?{{ else }}Post published. Go and share it!{{ end }}" data-regenerate="true"
class="default" value="Publish">
</div>
</div>
</form>
</div>

View File

@ -1,23 +1,44 @@
{{ define "frontmatter" }} {{ range $key, $value := . }} {{ if or (eq $value.Type "object") (eq $value.Type "array") }}
<fieldset id="{{ $value.Name }}" data-type="{{ $value.Type }}">
<h3>{{ SplitCapitalize $value.Title }}
{{ define "frontmatter" }}
{{ range $key, $value := . }}
{{ if or (eq $value.Type "object") (eq $value.Type "array") }}
<fieldset id="{{ $value.Name }}" data-type="{{ $value.Type }}">
<h3>{{ SplitCapitalize $value.Title }}</h3>
<span class="actions">
<button class="add"><i class="fa fa-plus"></i></button>
<button class="delete"><i class="fa fa-minus"></i></button>
<button class="add">&#43;</button>
<button class="delete">&#8722;</button>
</span>
</h3>
{{ template "frontmatter" $value.Content }}
</fieldset>
{{ else }} {{ if not (eq $value.Parent.Type "array") }}
<label for="{{ $value.Name }}">{{ SplitCapitalize $value.Title }}
<span class="actions">
<button class="delete"><i class="fa fa-minus"></i></button>
</span>
</label>
{{ template "frontmatter" $value.Content }}
</fieldset>
{{ else }}
{{ if not (eq $value.Parent.Type "array") }}
<div class="block" id="block-{{ $value.Name }}" data-content="{{ $value.Name }}">
<label for="{{ $value.Name }}">{{ SplitCapitalize $value.Title }}</label>
<span class="actions">
<button class="delete">&#8722;</button>
</span>
{{ end }}
{{ if eq $value.Parent.Type "array" }}
<div id="{{ $value.Name }}-{{ $key }}" data-type="array-item">
{{ end }}
{{ if eq $value.HTMLType "textarea" }}
<textarea class="scroll" name="{{ $value.Name }}:{{ $value.Type }}" id="{{ $value.Name }}" data-parent-type="{{ $value.Parent.Type }}">{{ $value.Content }}</textarea>
{{ else if eq $value.HTMLType "datetime" }}
<input name="{{ $value.Name }}:{{ $value.Type }}" id="{{ $value.Name }}" value="{{ $value.Content }}" type="text" data-parent-type="{{ $value.Parent.Type }}"></input>
{{ else }}
<input name="{{ $value.Name }}:{{ $value.Type }}" id="{{ $value.Name }}" value="{{ $value.Content }}" type="{{ $value.HTMLType }}" data-parent-type="{{ $value.Parent.Type }}"></input>
{{ end }}
{{ if not (eq $value.Parent.Type "array") }}</div>{{ end }}
{{ if eq $value.Parent.Type "array" }}
<span class="actions"><button class="delete">&#8722;</button></span></div>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ if eq $value.Parent.Type "array" }}<div id="{{ $value.Name }}-{{ $key }}" data-type="array-item">{{ end }}
{{ if eq $value.HTMLType "textarea" }}<textarea class="scroll" name="{{ $value.Name }}:{{ $value.Type }}" id="{{ $value.Name }}" data-parent-type="{{ $value.Parent.Type }}">{{ $value.Content }}</textarea>
{{ else if eq $value.HTMLType "datetime" }}<input class="datetimepicker" name="{{ $value.Name }}:{{ $value.Type }}" id="{{ $value.Name }}" value="{{ $value.Content }}" type="text" data-parent-type="{{ $value.Parent.Type }}"></input>
{{ else }}<input name="{{ $value.Name }}:{{ $value.Type }}" id="{{ $value.Name }}" value="{{ $value.Content }}" type="{{ $value.HTMLType }}" data-parent-type="{{ $value.Parent.Type }}"></input>{{ end }}
{{ if eq $value.Parent.Type "array" }}
<div class="actions"><button class="delete"><i class="fa fa-minus"></i></button></div></div>{{ end }} {{ end }} {{ end }} {{ end }}