some updates related to #28

pull/31/head
Henrique Dias 2015-10-24 10:54:10 +01:00
parent 8affc3136f
commit a7fcdfa430
9 changed files with 48 additions and 21 deletions

View File

@ -41,6 +41,7 @@ module.exports = function(grunt) {
'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'
],
dest: 'temp/css/main.css',
@ -84,7 +85,8 @@ module.exports = function(grunt) {
'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/codemirror/mode/htmlmixed/htmlmixed.js',
'node_modules/jquery-datetimepicker/jquery.datetimepicker.js'
]
}
},

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

View File

@ -5,6 +5,9 @@ $(document).ready(function() {
$(document).on('ready pjax:success', function() {
// Starts the perfect scroolbar plugin
$('.scroll').perfectScrollbar();
$('.datetimepicker').datetimepicker({
format: 'Y-m-d H:i:s+00:00'
});
// Log out the user sending bad credentials to the server
$("#logout").click(function(event) {

View File

@ -6,7 +6,8 @@ pre {
border-radius : .5em;
}
input {
input,
textarea {
width : 100%;
background-color: rgba(0, 0, 0, 0.25);
color : rgba(255, 255, 255, 0.3);
@ -25,6 +26,12 @@ input:focus {
outline: 0;
}
textarea {
transition: none;
resize : vertical;
min-height: 4em;
}
label {
width : 10.5em;
display: inline-block;

View File

@ -29,11 +29,12 @@ func Pretty(content []byte) (interface{}, error) {
}
type frontmatter struct {
Name string
Title string
Content interface{}
Type string
Parent *frontmatter
Name string
Title string
Content interface{}
Type string
HTMLType string
Parent *frontmatter
}
func rawToPretty(config interface{}, parent *frontmatter) interface{} {
@ -129,6 +130,15 @@ func handleFlatValues(content interface{}, parent *frontmatter, name string) *fr
c.Type = "string"
}
switch strings.ToLower(name) {
case "description":
c.HTMLType = "textarea"
case "date", "publishdate":
c.HTMLType = "datetime"
default:
c.HTMLType = "text"
}
if parent.Type == "array" {
c.Name = parent.Name + "[]"
c.Title = content.(string)

View File

@ -21,6 +21,7 @@
"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",

View File

@ -16,6 +16,8 @@
</label>
{{ end }}
{{ if eq $value.Parent.Type "array" }}<div id="{{ $value.Name }}-{{ $key }}" data-type="array-item">{{ end }}
<input name="{{ $value.Name }}:{{ $value.Type }}" id="{{ $value.Name }}" value="{{ $value.Content }}" data-parent-type="{{ $value.Parent.Type }}"></input>
{{ 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 }}