summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-04-09 03:01:24 -0400
committerJules Laplace <jules@okfoc.us>2015-04-09 03:01:24 -0400
commitec9b5312490c537a533a92344a2455fc5c6450a3 (patch)
treef89cc62dab6e94a1382d714f33664eff150da879
parentb67050b4072616502abc5f5d30a60e4cceb6d6e9 (diff)
rearranging werkz
-rw-r--r--examples/db.json4
-rw-r--r--themes/okadmin/public/css/main.css1
-rw-r--r--themes/okadmin/public/js/app.js9
-rw-r--r--themes/okadmin/templates/partials/inputs.liquid4
4 files changed, 16 insertions, 2 deletions
diff --git a/examples/db.json b/examples/db.json
index cede8bc..148391a 100644
--- a/examples/db.json
+++ b/examples/db.json
@@ -11,6 +11,10 @@
{
"uri": "cool",
"caption": "cool"
+ },
+ {
+ "uri": "https://ltho.s3.amazonaws.com/5f4c3351-9434-446a-883b-aa4bffce8da3.png",
+ "caption": "errrr"
}
],
"video": {
diff --git a/themes/okadmin/public/css/main.css b/themes/okadmin/public/css/main.css
index 982d6ad..a1e20a0 100644
--- a/themes/okadmin/public/css/main.css
+++ b/themes/okadmin/public/css/main.css
@@ -211,6 +211,7 @@ label {
list-style-type: none;
display: block;
clear: both;
+ height: 10em;
}
.main.resource form img {
width: 10em;
diff --git a/themes/okadmin/public/js/app.js b/themes/okadmin/public/js/app.js
index b2d1dc2..3370485 100644
--- a/themes/okadmin/public/js/app.js
+++ b/themes/okadmin/public/js/app.js
@@ -31,6 +31,15 @@ var OKAdmin = function(){
$(this).parent().remove()
}
})
+
+ $("form").submit(function(){
+ $(".image-element").each(function(index){
+ $(this).find("input,textarea").each(function(){
+ var field = $(this).attr("name").replace(/\[\]/, "[" + index + "]")
+ $(this).attr("name", field)
+ })
+ })
+ })
}
$(function(){
diff --git a/themes/okadmin/templates/partials/inputs.liquid b/themes/okadmin/templates/partials/inputs.liquid
index 72a4a1c..d8207ab 100644
--- a/themes/okadmin/templates/partials/inputs.liquid
+++ b/themes/okadmin/templates/partials/inputs.liquid
@@ -43,8 +43,8 @@
<ol>
{% for image in spec.value %}
<li class="image-element">
- <input type="hidden" name="{{name}}[uri]" value="{{image.uri}}">
- <textarea class="caption" name="{{name}}[caption]">{{image.caption}}</textarea>
+ <input type="hidden" name="{{name}}[][uri]" value="{{image.uri}}">
+ <textarea class="caption" name="{{name}}[][caption]">{{image.caption}}</textarea>
<img src="{{image.uri}}" alt="{{image.caption}}">
<button class="remove-image">♲</button>
</li>