Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #35 from macartur/fix_add_action_bug
Browse files Browse the repository at this point in the history
Fix add_action_menu bug
  • Loading branch information
beraldoleal authored Apr 11, 2018
2 parents e902611 + d7ce783 commit 3317bcf
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions src/components/kytos/misc/ActionMenu.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<div>
<div class="k-action-menu" v-hotkey="keymap" v-show="show">
<div class="k-action-menu" v-show="show">
<span v-for="item in keymap" v-hotkey = "item" v-show="false"></span>
<div class="k-input-wrap">
<k-input :action="searchValue" :value="search" icon="search" id="k-action-menu-input" placeholder="Search for actions"></k-input>
</div>
Expand Down Expand Up @@ -70,35 +71,28 @@ export default {
*/
add_action_menu_item(options){
var found = false
for(var i in this.items){if(options.name === this.items[i].name) found = true}
if(found === false) this.items.push(options)
for(var i in this.items){if(options.name == this.items[i].name) found = true}
if(found == false){ this.items.push(options) }
},
/**
* Method to register all listeners used by this component.
*/
register_listeners(){
this.$kytos.$on('addActionMenuItem', this.add_action_menu_item)
},
/**
* Method to return all shortkeys registereds
*
*/
keys(){
var all_keys = {'ctrl+space': this.toggle, 'esc': this.hide}
$.each(this.items, function(index, value){
if(value.action !== undefined){
all_keys[value.shortkey] = value.action
}
})
return all_keys
}
},
mounted() {
this.register_listeners()
},
computed: {
keymap () {
return this.keys()
var keys = [{'ctrl+space': this.toggle, 'esc': this.hide }]
$.each(this.items, function(index, item){
var key = {}
key[item.shortkey] = item.action
keys.push(key)
})
return keys
},
actionItems() {
var self=this;
Expand Down

0 comments on commit 3317bcf

Please sign in to comment.