Commit b5b3732069d413e925798f851087d42c551aaf57
Add ability to toggle web viewer visibility
Anders Rune Jensen committed on 8/23/2018, 10:12:21 PMParent: 524d5d76eee7c4a6fe025dce8868ccffd56074ef
Files changed
about/html/edit.js | changed |
about/html/edit.js | ||
---|---|---|
@@ -15,11 +15,12 @@ | ||
15 | 15 … | exports.needs = nest({ |
16 | 16 … | 'about.obs': { |
17 | 17 … | name: 'first', |
18 | 18 … | imageUrl: 'first', |
19 | - description: 'first' | |
19 … | + description: 'first', | |
20 … | + latestValue: 'first', | |
21 … | + groupedValues: 'first' | |
20 | 22 … | }, |
21 | - 'about.obs.groupedValues': 'first', | |
22 | 23 … | 'blob.sync.url': 'first', |
23 | 24 … | 'keys.sync.id': 'first', |
24 | 25 … | 'message.html.confirm': 'first', |
25 | 26 … | 'message.html.markdown': 'first', |
@@ -65,12 +66,17 @@ | ||
65 | 66 … | }) |
66 | 67 … | ) |
67 | 68 … | var names = dictToCollection(namesRecord) |
68 | 69 … | |
70 … | + var publicWebHosting = Struct({ | |
71 … | + current: api.about.obs.latestValue(id, 'publicWebHosting'), | |
72 … | + new: Value() | |
73 … | + }) | |
74 … | + | |
69 | 75 … | var lightbox = hyperlightbox() |
70 | 76 … | |
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() | |
73 | 79 … | }) |
74 | 80 … | |
75 | 81 … | var avatarSrc = computed([avatar], avatar => { |
76 | 82 … | if (avatar.new.link) return api.blob.sync.url(avatar.new.link) |
@@ -133,8 +139,19 @@ | ||
133 | 139 … | 'ev-keyup': e => name.new.set(e.target.value) |
134 | 140 … | }) |
135 | 141 … | ]) |
136 | 142 … | ]), |
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 … | + ]), | |
137 | 154 … | when(isPossibleUpdate, h('section.action', [ |
138 | 155 … | h('button.cancel', { 'ev-click': clearNewSelections }, 'cancel'), |
139 | 156 … | h('button.confirm', { 'ev-click': handleUpdateClick }, 'confirm changes') |
140 | 157 … | ])) |
@@ -214,8 +231,9 @@ | ||
214 | 231 … | } |
215 | 232 … | |
216 | 233 … | if (newName) msg.name = newName |
217 | 234 … | if (newAvatar.link) msg.image = newAvatar |
235 … | + if (publicWebHosting.new() != publicWebHosting.current()) msg.publicWebHosting = publicWebHosting.new() | |
218 | 236 … | |
219 | 237 … | api.message.html.confirm(msg, (err, data) => { |
220 | 238 … | if (err) return console.error(err) |
221 | 239 … |
Built with git-ssb-web