diff --git a/lib/browser/app.js b/lib/browser/app.js index d2f59291..7acc2759 100644 --- a/lib/browser/app.js +++ b/lib/browser/app.js @@ -36,10 +36,10 @@ require('./browser/modules/image-writer'); require('./browser/modules/path'); require('./browser/modules/notifier'); require('./browser/modules/analytics'); -require('./browser/controllers/finish'); require('./browser/controllers/navigation'); require('./browser/components/progress-button/progress-button'); require('./browser/components/drive-selector'); +require('./browser/pages/finish/finish'); const app = angular.module('Etcher', [ 'ui.router', @@ -55,12 +55,14 @@ const app = angular.module('Etcher', [ 'Etcher.analytics', // Controllers - 'Etcher.controllers.finish', 'Etcher.controllers.navigation', // Components 'Etcher.Components.ProgressButton', - 'Etcher.Components.DriveSelector' + 'Etcher.Components.DriveSelector', + + // Pages + 'Etcher.Pages.Finish' ]); app.config(function($stateProvider, $urlRouterProvider) { @@ -72,11 +74,6 @@ app.config(function($stateProvider, $urlRouterProvider) { controller: 'AppController as app', templateUrl: './partials/main.html' }) - .state('success', { - url: '/success', - controller: 'FinishController as finish', - templateUrl: './partials/success.html' - }) .state('settings', { url: '/settings', controller: 'SettingsController as settings', diff --git a/lib/browser/controllers/finish.js b/lib/browser/pages/finish/controllers/finish.js similarity index 67% rename from lib/browser/controllers/finish.js rename to lib/browser/pages/finish/controllers/finish.js index 6875b305..21d145ce 100644 --- a/lib/browser/controllers/finish.js +++ b/lib/browser/pages/finish/controllers/finish.js @@ -16,29 +16,7 @@ 'use strict'; -/** - * @module Etcher.controllers.finish - */ - -const angular = require('angular'); - -require('angular-ui-router'); -require('../modules/selection-state'); -require('../modules/image-writer'); -require('../modules/analytics'); -const finish = angular.module('Etcher.controllers.finish', [ - 'ui.router', - 'Etcher.selection-state', - 'Etcher.image-writer', - 'Etcher.analytics' -]); - -finish.controller('FinishController', function( - $state, - SelectionStateService, - ImageWriterService, - AnalyticsService -) { +module.exports = function($state, SelectionStateService, ImageWriterService, AnalyticsService) { /** * @summary Restart the burning process @@ -58,4 +36,4 @@ finish.controller('FinishController', function( $state.go('main'); }; -}); +}; diff --git a/lib/browser/pages/finish/finish.js b/lib/browser/pages/finish/finish.js new file mode 100644 index 00000000..7d12b936 --- /dev/null +++ b/lib/browser/pages/finish/finish.js @@ -0,0 +1,53 @@ +/* + * Copyright 2016 Resin.io + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +'use strict'; + +/** + * @module Etcher.Pages.Finish + * + * The finish page represents the application state where + * the the burn/validation has completed. + * + * Its purpose is to display success or failure information, + * as well as the "next steps". + */ + +const angular = require('angular'); +require('angular-ui-router'); +require('../../modules/selection-state'); +require('../../modules/image-writer'); +require('../../modules/settings'); +require('../../modules/analytics'); + +const FinishPage = angular.module('Etcher.Pages.Finish', [ + 'ui.router', + 'Etcher.selection-state', + 'Etcher.image-writer', + 'Etcher.settings', + 'Etcher.analytics' +]); + +FinishPage.controller('FinishController', require('./controllers/finish')); + +FinishPage.config(function($stateProvider) { + $stateProvider + .state('success', { + url: '/success', + controller: 'FinishController as finish', + templateUrl: './browser/pages/finish/templates/success.tpl.html' + }); +}); diff --git a/lib/partials/success.html b/lib/browser/pages/finish/templates/success.tpl.html similarity index 100% rename from lib/partials/success.html rename to lib/browser/pages/finish/templates/success.tpl.html