From 6d075a940b30c186e8b668316c5f51fbcb47e78e Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 9 Apr 2015 01:58:58 -0400 Subject: input fields and such --- examples/index.js | 1 + themes/okadmin/public/css/main.css | 3 ++ themes/okadmin/public/js/app.js | 10 ++++++- themes/okadmin/templates/partials/inputs.liquid | 40 +++++++++++++++++-------- 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/examples/index.js b/examples/index.js index f234cc1..1a5fbbe 100644 --- a/examples/index.js +++ b/examples/index.js @@ -16,6 +16,7 @@ var app = okcms.createApp({ description: {type: 'text'}, color: {type: 'enum', options: ["red","blue","green"]}, video: {type: 'video'}, + images: {type: 'images'}, } }, diff --git a/themes/okadmin/public/css/main.css b/themes/okadmin/public/css/main.css index 63dea45..0cb732e 100644 --- a/themes/okadmin/public/css/main.css +++ b/themes/okadmin/public/css/main.css @@ -201,6 +201,9 @@ label { margin-top: 1.0em; } +.template { + display: none; +} .disabled { display: none; } diff --git a/themes/okadmin/public/js/app.js b/themes/okadmin/public/js/app.js index 8e99ad8..84c0f53 100644 --- a/themes/okadmin/public/js/app.js +++ b/themes/okadmin/public/js/app.js @@ -2,6 +2,11 @@ var OKAdmin = function(){ OKUpload.bind() OKUpload.add = function(data){ + var url = data[0].extra.location + var imageTemplate = $("#image-template").html() + var $el = $(imageTemplate) + $el.find("url").val(url) + $(".images").append($el) console.log(data) } @@ -17,7 +22,10 @@ var OKAdmin = function(){ $el.parent().find(".video-thumb").val( media.thumbnail ) }) }) - + + $("form").submit(function(){ + $(".template").remove() + }) } $(function(){ diff --git a/themes/okadmin/templates/partials/inputs.liquid b/themes/okadmin/templates/partials/inputs.liquid index 8eb0fa5..e79ff14 100644 --- a/themes/okadmin/templates/partials/inputs.liquid +++ b/themes/okadmin/templates/partials/inputs.liquid @@ -18,16 +18,6 @@ disabled="true" {% endif %} name="{{name}}">{{spec.value}} - {% elsif type == 'video' %} -
- - - - - - - -
{% elsif type == 'enum' %} - {% elsif type == 'uri' %} -
- + {% elsif type == 'video' %} +
+ + + + + + + +
+ {% elsif type == 'images' %} +
+ {% for image in spec.value %} +
+ + + +
+ {% endfor %}
+ + {% else %}

Admin template doesn't support '{{type}}' properties!

{% endif %} -- cgit v1.2.3-70-g09d2