From 391a5d826147512ef206859c272eacd3970a6f9b Mon Sep 17 00:00:00 2001 From: Seong Jae Lee Date: Sun, 9 Nov 2014 22:06:22 -0800 Subject: [PATCH] Add a feature to set the directory from the settings panel --- lib/notational-velocity-view.coffee | 44 ++++++++++++++--------------- lib/notational-velocity.coffee | 3 ++ 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/lib/notational-velocity-view.coffee b/lib/notational-velocity-view.coffee index 7625a7d..149d469 100644 --- a/lib/notational-velocity-view.coffee +++ b/lib/notational-velocity-view.coffee @@ -14,8 +14,8 @@ class NotationalVelocityView extends SelectListView loadData: -> @data = [] - # TODO: remove this temporary hard-coded path - directory = '/Users/seongjae/github/notational-velocity/testdata' + # directory = '/Users/seongjae/github/notational-velocity/testdata' + directory = atom.config.get('notational-velocity.directory') for filename in fs.readdirSync(directory) filepath = path.join(directory, filename) @@ -58,38 +58,38 @@ class NotationalVelocityView extends SelectListView @div "#{content}", class: 'secondary-line' confirmed: (item) -> - console.log 'confirmed #{item}' + # console.log 'confirmed #{item}' atom.workspaceView.open(item.filepath) destroy: -> - console.log 'destroy' + # console.log 'destroy' @cancel() @remove() attach: -> - console.log 'attach' + # console.log 'attach' @storeFocusedElement() atom.workspaceView.append(this) @focusFilterEditor() - cancel: -> - console.log 'cancel' - super + # cancel: -> + # console.log 'cancel' + # super - cancelled: -> - console.log 'cancelled' - super + # cancelled: -> + # console.log 'cancelled' + # super - setItems: (items=[]) -> - console.log 'setItems' - super(items) + # setItems: (items=[]) -> + # console.log 'setItems' + # super(items) - populateList: -> - console.log 'populateList' - super + # populateList: -> + # console.log 'populateList' + # super - selectItemView: (view) -> - console.log 'selectItemView' - super(view) - return unless view.length - console.log @list.indexOf(@list.find('.selected')) + # selectItemView: (view) -> + # console.log 'selectItemView' + # super(view) + # return unless view.length + # console.log @list.indexOf(@list.find('.selected')) diff --git a/lib/notational-velocity.coffee b/lib/notational-velocity.coffee index fb959f7..323cfac 100644 --- a/lib/notational-velocity.coffee +++ b/lib/notational-velocity.coffee @@ -1,4 +1,7 @@ module.exports = + configDefaults: + directory: '/' + notationalVelocityView: null activate: (state) ->