git ssb

16+

Dominic / patchbay



Commit b5b3732069d413e925798f851087d42c551aaf57

Add ability to toggle web viewer visibility

Anders Rune Jensen committed on 8/23/2018, 10:12:21 PM
Parent: 524d5d76eee7c4a6fe025dce8868ccffd56074ef

Files changed

about/html/edit.jschanged
about/html/edit.jsView
@@ -15,11 +15,12 @@
1515 exports.needs = nest({
1616 'about.obs': {
1717 name: 'first',
1818 imageUrl: 'first',
19- description: 'first'
19 + description: 'first',
20 + latestValue: 'first',
21 + groupedValues: 'first'
2022 },
21- 'about.obs.groupedValues': 'first',
2223 'blob.sync.url': 'first',
2324 'keys.sync.id': 'first',
2425 'message.html.confirm': 'first',
2526 'message.html.markdown': 'first',
@@ -65,12 +66,17 @@
6566 })
6667 )
6768 var names = dictToCollection(namesRecord)
6869
70 + var publicWebHosting = Struct({
71 + current: api.about.obs.latestValue(id, 'publicWebHosting'),
72 + new: Value()
73 + })
74 +
6975 var lightbox = hyperlightbox()
7076
71- var isPossibleUpdate = computed([name.new, avatar.new], (name, avatar) => {
72- return name || avatar.link
77 + var isPossibleUpdate = computed([name.new, avatar.new, publicWebHosting.new], (name, avatar, publicWebHostingValue) => {
78 + return name || avatar.link || publicWebHostingValue != publicWebHosting.current()
7379 })
7480
7581 var avatarSrc = computed([avatar], avatar => {
7682 if (avatar.new.link) return api.blob.sync.url(avatar.new.link)
@@ -133,8 +139,19 @@
133139 'ev-keyup': e => name.new.set(e.target.value)
134140 })
135141 ])
136142 ]),
143 + h('section.viewer', [
144 + h('header', 'Public viewers'),
145 + h('section', [
146 + h('span', 'Show my posts on public viewers'),
147 + h('input', {
148 + type: 'checkbox',
149 + checked: publicWebHosting.current,
150 + 'ev-change': e => publicWebHosting.new.set(e.target.checked)
151 + })
152 + ]),
153 + ]),
137154 when(isPossibleUpdate, h('section.action', [
138155 h('button.cancel', { 'ev-click': clearNewSelections }, 'cancel'),
139156 h('button.confirm', { 'ev-click': handleUpdateClick }, 'confirm changes')
140157 ]))
@@ -214,8 +231,9 @@
214231 }
215232
216233 if (newName) msg.name = newName
217234 if (newAvatar.link) msg.image = newAvatar
235 + if (publicWebHosting.new() != publicWebHosting.current()) msg.publicWebHosting = publicWebHosting.new()
218236
219237 api.message.html.confirm(msg, (err, data) => {
220238 if (err) return console.error(err)
221239

Built with git-ssb-web