adding edit apps

release-neutralino
HerrHase 2 years ago
parent 24be1e9f6a
commit 582a28b97b

@ -0,0 +1 @@
{"accessToken":"EHaQCy2SuKGiKfHUqEC-1ATx1fyv-_RFI1hX_l_v5HdRywxp","port":40609}

@ -36,6 +36,22 @@ class AppsStore extends PouchdbHandler {
})
}
/**
*
* @param {object} data
* @return {object}
*
*/
update(data) {
console.log(data)
return this.db.put(data)
.then((response) => {
return response
}).catch((error) => {
console.log(error)
})
}
/**
* find one app by id
*
@ -47,6 +63,7 @@ class AppsStore extends PouchdbHandler {
const query = {
'fields': [
'_id',
'_rev',
'name',
'command',
'description',

@ -11,6 +11,9 @@
<form class="form" novalidate method="post" onsubmit={ (event) => ( state.validator.submit(event) ) }>
<div class="sidebar__body">
<input type="hidden" if={ state.current._id } name="_id" value="{ state.current._id }" />
<input type="hidden" if={ state.current._rev } name="_rev" value="{ state.current._rev }" />
<!-- name -->
<div class="field-group">
<label class="field-label">
@ -49,7 +52,7 @@
<div class="field-group">
<label class="field-label">
description
<textarea class="field-text" name="description">{ state.current.description ? state.current.description : '' }</textarea>
<textarea class="field-text" name="description" value="{ state.current.description ? state.current.description : '' }"></textarea>
</label>
</div>
@ -171,6 +174,8 @@
// receive from extensions database
Neutralino.events.on('pouchdb.apps.readyOne', (event) => {
this.reset()
this.state.current = event.detail
tagsStore.trigger('update', this.state.current.tags)
@ -227,7 +232,11 @@
data.thumbnail = this.state.current.thumbnail
// send to extensions database
if (data._id) {
Neutralino.extensions.dispatch('js.neutralino.pouchdb', 'pouchdb.apps.create', data)
} else {
Neutralino.extensions.dispatch('js.neutralino.pouchdb', 'pouchdb.apps.update', data)
}
},
/**
@ -236,7 +245,7 @@
* @param object event
*
*/
async handleSelectMedia(event)
async handleSelectThumbnail(event)
{
const entry = await Neutralino.os.showOpenDialog('', {
'multiSelections': false,
@ -251,7 +260,7 @@
const data = await Neutralino.filesystem.readBinaryFile(entry[0])
// adding as blob
this.state.current.media = _arrayBufferToBase64(data)
this.state.current.thumbnail = _arrayBufferToBase64(data)
this.update()
},

@ -7,8 +7,6 @@
*
*/
import * as riot from 'riot'
export default {
state: {

@ -145,7 +145,7 @@
let styles = false
if (app.media) {
if (app.thumbnail) {
styles = "background-image: url('data:image/jpg;base64," + app.thumbnail + "')"
}

Loading…
Cancel
Save