Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

Commit

Permalink
Open route.js file if no component found
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchell-garcia committed May 3, 2016
1 parent 4dcca10 commit c4d14b9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions EmberComponentSplitView.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ class EmberComponentSplitViewCommand(sublime_plugin.WindowCommand):
# @return {String} newFile - the file to open
def findCompanionPodStructure(self):
if 'hbs' in self.reference_file_type:
companion_file = self.reference_file_path + '/component.js'
if 'components' in self.reference_file_path:
companion_file = self.reference_file_path + '/component.js'
else:
companion_file = self.reference_file_path + '/route.js'
else:
companion_file = self.reference_file_path + '/template.hbs'

Expand All @@ -18,8 +21,12 @@ def findCompanionFolderStucture(self):
base_path = self.reference_file_path.rsplit('/app/', 1)[0] + '/app/'

if 'hbs' in self.reference_file_type:
companion_file_name = self.reference_file_name.rsplit('.', 1)[0] + '.js'
companion_file = base_path + 'components/' + self.reference_file_location + '/' + companion_file_name
if 'components' in self.reference_file_path:
companion_file_name = self.reference_file_name.rsplit('.', 1)[0] + '.js'
companion_file = base_path + 'components/' + self.reference_file_location + '/' + companion_file_name
else:
companion_file_name = self.reference_file_name.rsplit('.', 1)[0] + '.js'
companion_file = base_path + 'routes/' + self.reference_file_location + '/' + companion_file_name
else:
companion_file_name = self.reference_file_name.rsplit('.', 1)[0] + '.hbs'
companion_file = base_path + 'templates/' + self.reference_file_location + '/' + companion_file_name
Expand Down

0 comments on commit c4d14b9

Please # to comment.