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/animate.css/source/fading_exits/fadeOut.css',
'node_modules/codemirror/lib/codemirror.css', 'node_modules/codemirror/lib/codemirror.css',
'node_modules/codemirror/theme/ttcn.css', 'node_modules/codemirror/theme/ttcn.css',
'node_modules/jquery-datetimepicker/jquery.datetimepicker.css',
'temp/css/**/*.css' 'temp/css/**/*.css'
], ],
dest: 'temp/css/main.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/javascript/javascript.js',
'node_modules/codemirror/mode/markdown/markdown.js', 'node_modules/codemirror/mode/markdown/markdown.js',
'node_modules/codemirror/mode/sass/sass.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() { $(document).on('ready pjax:success', function() {
// Starts the perfect scroolbar plugin // Starts the perfect scroolbar plugin
$('.scroll').perfectScrollbar(); $('.scroll').perfectScrollbar();
$('.datetimepicker').datetimepicker({
format: 'Y-m-d H:i:s+00:00'
});
// Log out the user sending bad credentials to the server // Log out the user sending bad credentials to the server
$("#logout").click(function(event) { $("#logout").click(function(event) {

View File

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

View File

@ -33,6 +33,7 @@ type frontmatter struct {
Title string Title string
Content interface{} Content interface{}
Type string Type string
HTMLType string
Parent *frontmatter Parent *frontmatter
} }
@ -129,6 +130,15 @@ func handleFlatValues(content interface{}, parent *frontmatter, name string) *fr
c.Type = "string" 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" { if parent.Type == "array" {
c.Name = parent.Name + "[]" c.Name = parent.Name + "[]"
c.Title = content.(string) c.Title = content.(string)

View File

@ -21,6 +21,7 @@
"codemirror": "^5.6.0", "codemirror": "^5.6.0",
"font-awesome": "^4.4.0", "font-awesome": "^4.4.0",
"jquery": "^2.1.4", "jquery": "^2.1.4",
"jquery-datetimepicker": "^2.4.0",
"jquery-serializejson": "^2.5.0", "jquery-serializejson": "^2.5.0",
"normalize.css": "^3.0.3", "normalize.css": "^3.0.3",
"noty": "^2.3.6", "noty": "^2.3.6",

View File

@ -16,6 +16,8 @@
</label> </label>
{{ end }} {{ end }}
{{ if eq $value.Parent.Type "array" }}<div id="{{ $value.Name }}-{{ $key }}" data-type="array-item">{{ 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" }} {{ 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 }} <div class="actions"><button class="delete"><i class="fa fa-minus"></i></button></div></div>{{ end }} {{ end }} {{ end }} {{ end }}