Skip to content

Commit

Permalink
#284: update class to meaningful name.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Mulholland committed Apr 24, 2018
1 parent 4a84113 commit a62d6ba
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 21 deletions.
44 changes: 38 additions & 6 deletions src/main/menu.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {openFile, saveFileAs, saveFile, importDataPackage} from './file.js'
import {showUrlDialog} from './url.js'
import {createWindowTab, focusMainWindow} from './windows.js'
import {importExcel} from './excel.js'
import {showKeyboardHelp} from './help.js'
Expand Down Expand Up @@ -34,11 +35,10 @@ class AppMenu {
// label: 'Open Google Sheet...',
// enabled: false
}, {
label: 'Open Data Package...',
enabled: true,
click() {
importDataPackage()
}
label: 'Open Data Package',
submenu: this.openDataPackageSubMenu,
enabled: true
}, {
// Placeholder for future feature
// }, {
// label: 'Open Recent',
Expand All @@ -59,7 +59,7 @@ class AppMenu {
// }, {
// label: 'Settings',
// enabled: false
}, {
// }, {
type: 'separator'
}, {
label: 'Save',
Expand Down Expand Up @@ -393,6 +393,23 @@ class AppMenu {
return option
}

buildOpenDataPackageMenu() {
this.openDataPackageSubMenu = [{
label: 'Zip File...',
enabled: true,
click() {
importDataPackage()
}
}, {
label: 'URL...',
enabled: true,
click() {
// downloadDataPackageJson()
showUrlDialog()
}
}]
}

updateMenuForDarwin() {
const webContents = this.webContents
if (process.platform === 'darwin') {
Expand Down Expand Up @@ -487,6 +504,7 @@ class AppMenu {
constructor() {
this.initContainers()
this.buildAllMenusForFileFormats()
this.buildOpenDataPackageMenu()
this.initTemplate()
this.updateMenuForDarwin()
this.updateMenuForNonDarwin()
Expand All @@ -506,6 +524,20 @@ export function getSubMenuFromMenu(menuLabel, subMenuLabel) {
return subMenu
}

export function enableSubMenuItemsFromMenuObject(menu, labels) {
for (const label of labels) {
const subMenu = menu.submenu.items.find(x => x.label === label)
subMenu.enabled = true
}
}

export function disableSubMenuItemsFromMenuObject(menu, labels) {
for (const label of labels) {
const subMenu = menu.submenu.items.find(x => x.label === label)
subMenu.enabled = false
}
}

export function clickLabelsOnMenu(args) {
let menu = Menu.getApplicationMenu().items.find(x => x.label === args[0])
menu.click()
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/SelectWorksheet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</option>
</select>
</p>
<div class="well">
<div class="submit-container">
<button id="submit" class="btn btn-default" @click.prevent="submit">Open Sheet</button> <button id="cancel" class="btn btn-default" @click.prevent="cancel">Cancel</button>
</div>
</form>
Expand Down
28 changes: 14 additions & 14 deletions static/css/select-worksheet.styl
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
body, html
margin 0
padding 0
font-family 'Helvetica Neue', Helvetica, Arial, sans-serif
margin 0
padding 0
font-family 'Helvetica Neue', Helvetica, Arial, sans-serif

.well
position absolute
bottom 0
width 100%
margin 0 0 0 -15px
text-align right
border-radius 0
border-bottom 0
padding 7px
.submit-container
position absolute
bottom 0
width 100%
margin 0 0 0 -15px
text-align right
border-radius 0
border-bottom 0
padding 7px

#worksheets
margin 7px
width 95%
margin 7px
width 95%

0 comments on commit a62d6ba

Please sign in to comment.