blob: bc5c27e042f8238dff6ff4413223a9f3d9e9c170 [file] [log] [blame]
Matteo Scandolo4208f112016-08-10 17:02:02 -07001'use strict';
2
3angular.module('xos.UITutorial', [
4 'ngResource',
5 'ngCookies',
6 'ui.router',
7 'xos.helpers'
8])
9.config(($stateProvider) => {
10 $stateProvider
11 .state('shell', {
12 url: '/',
13 template: '<js-shell></js-shell>'
14 });
15})
16.config(function($httpProvider){
17 $httpProvider.interceptors.push('NoHyperlinks');
18})
19.directive('jsShell', function(){
20 return {
21 restrict: 'E',
22 scope: {},
23 bindToController: true,
24 controllerAs: 'vm',
25 templateUrl: 'templates/js-shell.tpl.html',
Matteo Scandolo86f3f282016-08-11 11:21:33 -070026 controller: function(ExploreCmd){
Matteo Scandolo4208f112016-08-10 17:02:02 -070027 var history = new Josh.History({ key: 'helloworld.history'});
28 var shell = Josh.Shell({history: history});
29
Matteo Scandolo86f3f282016-08-11 11:21:33 -070030 shell.onNewPrompt(function(done) {
31 done('[ngXosLib] $ ');
Matteo Scandolo4208f112016-08-10 17:02:02 -070032 });
33
Matteo Scandolo86f3f282016-08-11 11:21:33 -070034 shell.setCommandHandler('explore', {
Matteo Scandolo4208f112016-08-10 17:02:02 -070035 exec: (cmd, args, done) => {
Matteo Scandolo86f3f282016-08-11 11:21:33 -070036 ExploreCmd.setup(shell);
37 done();
Matteo Scandolo4208f112016-08-10 17:02:02 -070038 }
39 });
40
Matteo Scandolo86f3f282016-08-11 11:21:33 -070041
42
Matteo Scandolo4208f112016-08-10 17:02:02 -070043 shell.activate();
44 }
45 };
46});