diff options
| -rw-r--r-- | site/db.json | 4 | ||||
| -rw-r--r-- | site/index.js | 8 | ||||
| -rw-r--r-- | themes/okadmin/public/css/main.css | 39 | ||||
| -rw-r--r-- | themes/okadmin/public/js/app.js | 11 | ||||
| -rw-r--r-- | themes/okadmin/templates/index.liquid | 2 | ||||
| -rw-r--r-- | themes/okadmin/templates/partials/flash.liquid | 9 | ||||
| -rw-r--r-- | themes/okadmin/templates/partials/inputs.liquid | 4 | ||||
| -rw-r--r-- | themes/okadmin/templates/resource.liquid | 2 |
8 files changed, 58 insertions, 21 deletions
diff --git a/site/db.json b/site/db.json index c07e321..d2e882a 100644 --- a/site/db.json +++ b/site/db.json @@ -28,7 +28,7 @@ "caption": "CURABITUR BLANDIT TEMPUS PORTTITOR 4" } ], - "__index": 1 + "__index": "0" } ], "page": [ @@ -47,4 +47,4 @@ "__index": 0 } ] -} +}
\ No newline at end of file diff --git a/site/index.js b/site/index.js index a59e74e..dace900 100644 --- a/site/index.js +++ b/site/index.js @@ -15,15 +15,15 @@ var app = okcms.createApp({ id: {type: 'string', id: true}, title: {type: 'string'}, shortname: {type: 'string'}, - description: {type: 'text'}, - video: {type: 'video'}, - images: {type: 'captioned-image-list'}, category: {type: 'enum', options: [ 'retail', 'advertising', 'experiential', 'content'] - } + }, + description: {type: 'text'}, + video: {type: 'video'}, + images: {type: 'captioned-image-list'}, } }, diff --git a/themes/okadmin/public/css/main.css b/themes/okadmin/public/css/main.css index 3762fd4..67271bc 100644 --- a/themes/okadmin/public/css/main.css +++ b/themes/okadmin/public/css/main.css @@ -109,7 +109,7 @@ h2 { pointer-events: none; } - /* Makes the button look like a link */ +/* Makes the button look like a link */ .main.index .resource-category button { background: none !important; height: 1.5em; @@ -117,6 +117,8 @@ h2 { padding: 0 !important; font: inherit; cursor: pointer; + font-family: Monaco, monospace; + text-transform: uppercase; } .main.index .resource-category .btn { @@ -134,7 +136,7 @@ h2 { } .main.index .resource-category .btn:hover { - border-bottom: 3px solid rgba(0, 0, 0, 0.25); + border-bottom: 1px solid rgba(0, 0, 0, 0.25); } .main.index .resource-category .btn { @@ -203,6 +205,12 @@ label { padding: 0 0.5em; margin-bottom: 1em; } +.main.resource form input[name=id] { + width: 15em; +} +button, input[type=submit] { + cursor: pointer; +} .main.resource form .group { display: block; float: left; @@ -280,18 +288,26 @@ label { background: #ddd; clear: left; text-align: left; - padding: 10px; - width: 15em; + float: left; + margin-right: 1em; position: relative; + overflow: hidden; + cursor: pointer; } .add-image-button:hover { background: #def; } +.main.resource form .add-image-button button { + margin: 0; + pointer-events: none; + width: 100%; height: 100%; +} .add-image-button input[type=file] { opacity: 0; position: absolute; top: 0; left: 0; width: 100%; height: 100%; + margin: 0; padding: 0; cursor: pointer; } li.image-element:hover .remove-image { @@ -314,13 +330,20 @@ li.image-element .remove-image:hover { } -.errors { +.success, .errors { background: white; - padding: 10px; - width: 100%; + padding: 9px 8px 7px; + width: 50%; line-height: 1.4em; + border: 1px solid; + margin: 1em; + border-radius: 2px; +} + +.success { + color: green; } -.errors .message { +.errors { color: red; } diff --git a/themes/okadmin/public/js/app.js b/themes/okadmin/public/js/app.js index 1ab9956..91a8e1a 100644 --- a/themes/okadmin/public/js/app.js +++ b/themes/okadmin/public/js/app.js @@ -28,7 +28,7 @@ var OKAdmin = function(){ $(".captioned-image-list ol").disableSelection() // delete image - $(document).on("click", ".remove-image", function(){ + $(document).on("mousedown", ".remove-image", function(){ if (confirm("Delete this image?")) { $(this).parent().remove() } @@ -50,7 +50,14 @@ var OKAdmin = function(){ })) // fix post indexing in list-driven inputs - $(".main.resource form").submit(function(){ + $(".main.resource form").submit(function(e){ + var $id = $("[name=id]") + if ($id.length && ! $id.val()) { + alert("Please enter an ID") + $id.focus() + e.preventDefault() + return + } $(".image-element").each(function(index){ $(this).find("input,textarea").each(function(){ var field = $(this).attr("name").replace(/\[[0-9]*\]/, "[" + index + "]") diff --git a/themes/okadmin/templates/index.liquid b/themes/okadmin/templates/index.liquid index 0672613..10903b9 100644 --- a/themes/okadmin/templates/index.liquid +++ b/themes/okadmin/templates/index.liquid @@ -26,7 +26,7 @@ <a class="btn cancel-btn" href="#">cancel</a> <button type="submit" class="btn save-btn" href="#">save</button> - <a class="btn edit-btn active" href="#">edit</a> + <a class="btn edit-btn active" href="#">sort</a> <a class="btn add-btn active" href="{{resource.type}}/new/">+</a> </nav> </footer> diff --git a/themes/okadmin/templates/partials/flash.liquid b/themes/okadmin/templates/partials/flash.liquid index 1980ab5..e51a86b 100644 --- a/themes/okadmin/templates/partials/flash.liquid +++ b/themes/okadmin/templates/partials/flash.liquid @@ -1,8 +1,15 @@ +{% if success.length > 0 %} <div class="success"> + <div class="message">Changes saved.</div> + <!-- {% for info in success %} <div class="message">{{info.action}}</div> {% endfor %} + --> </div> +{% endif %} + +{% if errors.length > 0 %} <div class="errors"> {% for error in errors %} <div class="error"> @@ -10,4 +17,4 @@ </div> {% endfor %} </div> - +{% endif %}
\ No newline at end of file diff --git a/themes/okadmin/templates/partials/inputs.liquid b/themes/okadmin/templates/partials/inputs.liquid index 99258f3..b9cf7a3 100644 --- a/themes/okadmin/templates/partials/inputs.liquid +++ b/themes/okadmin/templates/partials/inputs.liquid @@ -29,7 +29,7 @@ {% endif %} name="{{name}}"> {% for option in spec.options %} - <option value="{{option}}" {% if option == spec.value %}selected{% endif %}>{{option}}</option> + <option value="{{option}}" {% if option == spec.value %}selected{% endif %}>{{option | capitalize}}</option> {% endfor %} </select> {% elsif type == 'video' %} @@ -56,7 +56,7 @@ </ol> <div class="add-image-button"> <input id="file" type="file" accept="image/*" multiple> - <span>+ Add images</span> + <button>+ Add images</button> </div> <input id="add-image-url" type="text" placeholder="+ Add URL"> <script type="text/html" id="captioned-image-template"> diff --git a/themes/okadmin/templates/resource.liquid b/themes/okadmin/templates/resource.liquid index 8078778..abc59e9 100644 --- a/themes/okadmin/templates/resource.liquid +++ b/themes/okadmin/templates/resource.liquid @@ -16,7 +16,7 @@ </form> <form action="." method="POST" id="delete_form"> <input type="hidden" name="_method" value="DELETE"> - <button type="submit">Delete</button> + <button type="submit">Delete Record</button> </form> </section> |
