1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-30 00:00:13 +01:00
VILLASweb/app/templates/components/widget-image.hbs
Markus Grigull 7c4d67c163 Add image widget and file upload
File upload is in image widget edit dialog
Add ember-uploader package
2017-01-25 19:36:23 +01:00

51 lines
1.4 KiB
Handlebars

{{#if widget.widgetData.path}}
<img src={{concat url "/" widget.widgetData.path}} width="100%" />
{{/if}}
{{#if isShowingModal}}
{{#modal-dialog attachment="middle center" translucentOverlay=true}}
<h1>Image</h1>
<form class="form-widget-image" {{action 'submitModal' on='submit'}} >
<table>
<tr>
<td>
<label for="name">Name</label>
</td>
<td>
{{input id='name' placeholder='Enter widget name' value=name}}
</td>
</tr>
<tr>
<td>
<label for="image">Image</label>
</td>
<td>
<select onchange={{action "selectImage" value="target.value"}}>
{{#each widget.visualization.project.owner.files as |imageFile|}}
<option value={{imageFile.name}} selected={{eq imageFile.name image}}>{{imageFile.name}}</option>
{{/each}}
</select>
</td>
</tr>
<tr>
<td>
</td>
<td>
{{file-upload files=uploadFiles}} <button {{action 'upload'}}>Upload</button>
</td>
</tr>
<tr>
<td colspan="2">
<button {{action 'cancelModal'}}>Cancel</button>
<button type="submit">Save</button>
</td>
</tr>
</table>
</form>
{{#if errorMessage}}
<p><b>Error:</b> {{errorMessage}}</p>
{{/if}}
{{/modal-dialog}}
{{/if}}