Skip to content

Commit 4ec47b3

Browse files
authored
Merge branch 'master' into widgets-files
2 parents ceccb5c + df48575 commit 4ec47b3

5 files changed

Lines changed: 47 additions & 43 deletions

File tree

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "solid-ui",
3-
"version": "0.12.8-0",
3+
"version": "0.13.0",
44
"description": "UI library for writing Solid read-write-web applications",
55
"main": "./lib/index.js",
66
"files": [

src/acl-control.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -567,16 +567,18 @@ UI.aclControl.ACLControlBox5 = function (subject, dom, noun, kb, callback) {
567567
})
568568
try {
569569
kb.fetcher.putBack(targetACLDoc)
570+
.then(function () {
571+
statusBlock.textContent = ' (Now editing specific access for this ' + noun + ')'
572+
bottomRightCell.removeChild(editPlease)
573+
renderBox()
574+
})
570575
} catch (e) {
571576
let msg = ' Error writing back access control file! ' + e
572577
console.error(msg)
573578
statusBlock.textContent += msg
574579
return
575580
}
576-
kb.fetcher.requested[targetACLDoc.uri] = 'done' // cheat - say cache is now in sync
577-
statusBlock.textContent = ' (Now editing specific access for this ' + noun + ')'
578-
bottomRightCell.removeChild(editPlease)
579-
renderBox()
581+
// kb.fetcher.requested[targetACLDoc.uri] = 'done' // cheat - say cache is now in sync
580582
})
581583
} // defaults.length
582584
} else { // Not using defaults
@@ -593,8 +595,9 @@ UI.aclControl.ACLControlBox5 = function (subject, dom, noun, kb, callback) {
593595
kb.fetcher.delete(targetACLDoc.uri)
594596
.then(function () {
595597
statusBlock.textContent = ' The sharing for this ' + noun + ' is now the default.'
596-
bottomRow.removeChild(useDefault)
598+
bottomRightCell.removeChild(useDefault)
597599
box.style.cssText = 'color: #777;'
600+
bottomLeftCell.innerHTML = ''
598601
renderBox()
599602
})
600603
.catch(function (e) {

src/create.js

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -144,42 +144,43 @@ function newThingUI (context, thePanes) {
144144
)
145145
} // makeNewAppInstance
146146

147-
var iconArray = []
148-
for (var pn in thePanes) {
149-
var pane = thePanes[pn]
150-
if (pane.mintNew) {
151-
var icon = context.div.appendChild(dom.createElement('img'))
152-
icon.setAttribute('src', pane.icon)
153-
var noun = pane.mintClass ? UI.utils.label(pane.mintClass) : (pane.name + ' @@')
154-
icon.setAttribute('title', 'Make new ' + noun)
155-
icon.setAttribute('style', iconStyle + 'display: none;')
156-
iconArray.push(icon)
157-
var foo = function (pane, icon, noun) {
158-
var iconEle = icon
159-
var thisPane = pane
160-
var thisNoun = noun
161-
if (!icon.disabled) {
162-
icon.addEventListener('click', function (e) {
163-
selectTool(iconEle)
164-
var options = {
165-
event: e,
166-
folder: context.folder,
167-
iconEle: iconEle,
168-
pane: thisPane,
169-
noun: thisNoun,
170-
noIndexHTML: true, // do NOT @@ for now write a HTML file
171-
div: context.div,
172-
me: context.me,
173-
dom: context.dom,
174-
refreshTarget: context.refreshTarget
175-
}
176-
makeNewAppInstance(options)
177-
})
178-
}
179-
} // foo
180-
foo(pane, icon, noun)
147+
const iconArray = []
148+
const mintingPanes = Object.values(thePanes).filter(pane => pane.mintNew)
149+
const mintingClassMap = mintingPanes.reduce((classMap, pane) => {
150+
if (pane.mintClass) {
151+
classMap[pane.mintClass] = (classMap[pane.mintClass] || 0) + 1
181152
}
182-
}
153+
return classMap
154+
}, {})
155+
mintingPanes.forEach(pane => {
156+
const icon = context.div.appendChild(dom.createElement('img'))
157+
icon.setAttribute('src', pane.icon)
158+
const noun = pane.mintClass
159+
? (mintingClassMap[pane.mintClass] > 1
160+
? `${UI.utils.label(pane.mintClass)} (using ${pane.name} pane)`
161+
: UI.utils.label(pane.mintClass))
162+
: (pane.name + ' @@')
163+
icon.setAttribute('title', 'Make new ' + noun)
164+
icon.setAttribute('style', iconStyle + 'display: none;')
165+
iconArray.push(icon)
166+
if (!icon.disabled) {
167+
icon.addEventListener('click', function (e) {
168+
selectTool(icon)
169+
makeNewAppInstance({
170+
event: e,
171+
folder: context.folder,
172+
iconEle: icon,
173+
pane,
174+
noun,
175+
noIndexHTML: true, // do NOT @@ for now write a HTML file
176+
div: context.div,
177+
me: context.me,
178+
dom: context.dom,
179+
refreshTarget: context.refreshTarget
180+
})
181+
})
182+
}
183+
})
183184

184185
var styleTheIcons = function (style) {
185186
for (var i = 0; i < iconArray.length; i++) {

src/widgets/dragAndDrop.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ function uploadFiles (fetcher, files, fileBase, imageBase, successHandler) {
173173
}
174174
}
175175
var folderName = theFile.type.startsWith('image/') ? imageBase || fileBase : fileBase
176-
var destURI = folderName + '/' + encodeURIComponent(theFile.name) + suffix
176+
var destURI = folderName + (folderName.endsWith('/') ? '' : '/') + encodeURIComponent(theFile.name) + suffix
177177

178178
fetcher.webOperation('PUT', destURI, { data: data, contentType: contentType })
179179
.then(response => {

0 commit comments

Comments
 (0)