diff --git a/public/app/components.js b/public/app/components.js index 8c8018e7ac3af92a6081dae17a72bf368c1fa1dd..28a429c13b8dc56f8323ca53f0d776079fd82c58 100644 --- a/public/app/components.js +++ b/public/app/components.js @@ -101,19 +101,23 @@ var components = function () { </template> <!-- FALLBACK - DISPLAY --> <template v-else> - <div class="form-group flex-grow"> - <input class="form-control flex-grow" v-model="val.value" type="text" v-on:keyup="methods.trigger_change_on_enter"/> + <div class="form-group flex-grow"> + <input + class="form-control flex-grow" v-model="val.value" type="text" + v-on:keyup="methods.trigger_change_on_enter"/> </div> </template> - <template v-if="schema.properties[name] && schema.properties[name].input === 'link' " > + <template v-if="schema.properties[name] && schema.properties[name].input === 'link' " > <div class="form-group"> <form class="form-inline" v-on:submit.prevent="methods.linkProp(val)" v-if="!val.id"> - <button class="btn btn-outline-primary" type="submit"> - </button> + <button class="btn btn-outline-primary" type="submit"> + <i class="fa fa-link"></i> + </button> <select class="custom-select" v-model="val.selection"> - <option value="" disabled>Select or create new property</option> + <option value="" :selected="true">Select or create new property</option> <template v-for="(link_item, link_id) in context.entities"> {{link_id}} <option @@ -123,21 +127,23 @@ var components = function () { </template> </select> </form> - <form - class="form-inline" + <form class="form-inline" v-on:submit.prevent="methods.linkToNew(val)" v-if="!val.id && schema.properties[name] && schema.properties[name].type && schema.properties[name].type.filter(t => {return (schema.types[t] && schema.types[t].create)}).length > 0"> - <button class="btn btn-outline-primary" type="submit" text="Link to a new contextual item">New</button> - <select - class="custom-select" - v-model="val.new_type" - v-for="type in schema.properties[name].type.filter(type => {return (schema.types[type] && schema.types[type].create)})"> - <option> {{ type }} </option> - </select> + <div class="form-group"> + <button + class="btn btn-outline-primary" + type="submit" text="Link to a new contextual item">New</button> + <select + class="custom-select" + v-model="val.new_type"> + <option v-for="type in schema.properties[name].type.filter(type => {return (schema.types[type] && schema.types[type].create)})">{{ type }}</option> + </select> + </div> </form> </div> </template> - </div> + </div> ` }); diff --git a/public/app/methods.js b/public/app/methods.js index 9acc14823947959ae2d706380d9d0b83b58bd41f..8009c1f294e68eaffd8ceeb283324b1239cd8ddc 100644 --- a/public/app/methods.js +++ b/public/app/methods.js @@ -62,8 +62,9 @@ var methods = { vm.changed += 1; vm.save_context(); }, - "removeProp": (item, prop_name) => { + "removeProp": function(item, prop_name) { delete item.properties[prop_name]; + //TODO: Emit changes to the parent so it can re-render the prop vm.changed += 1; vm.save_context(); }, @@ -140,6 +141,7 @@ var methods = { window.location = '?path=' + path + '&dataset_path=' + path; }, "removeItem": (id) => { + //TODO: Add if confirm before deleting. delete vm.context.entities[id]; vm.changed += 1; vm.save_context(); diff --git a/views/index.ejs b/views/index.ejs index 47a9e93c0f0846740f6df4229459e3302a9cfe1f..3f4f8baddf345457a79b50818965ce4adc5acbb1 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -103,7 +103,7 @@ </div> <div class="row"> <div class="col-lg-2"> - <ul class="list-group"> + <ul class="list-group" > <span id="dirlist"> <li class="list-group-item"> <h4 class="list-group-item-heading">Directories</h4>