Replaced dimmers with modal to correct the submission loading visuals.

This commit is contained in:
Clinton Alexander 2016-07-12 12:43:37 +01:00
parent 65fac338ca
commit 6de6696783
8 changed files with 22 additions and 18 deletions

View File

@ -18,6 +18,9 @@
<span class="header item"><a href="#/">Home</a></span> <span class="header item"><a href="#/">Home</a></span>
</div> </div>
<div class="ui container"> <div class="ui container">
<div id="loading" class="ui modal">
<div class="ui text loader">Loading</div>
</div>
<div ng-view></div> <div ng-view></div>
</div> </div>
</body> </body>

View File

@ -8,8 +8,8 @@ define([
'Deal' 'Deal'
], (angular, maskedInput, semantic, nodeApi, Deal) => { ], (angular, maskedInput, semantic, nodeApi, Deal) => {
angular.module('irsViewer').controller('CreateDealController', function CreateDealController($http, $scope, $location, nodeService) { angular.module('irsViewer').controller('CreateDealController', function CreateDealController($http, $scope, $location, nodeService) {
semantic.init(); semantic.init($scope, nodeService.isLoading);
$scope.isLoading = nodeService.isLoading;
$scope.deal = nodeService.newDeal(); $scope.deal = nodeService.newDeal();
$scope.createDeal = () => { $scope.createDeal = () => {
nodeService.createDeal(new Deal($scope.deal)) nodeService.createDeal(new Deal($scope.deal))

View File

@ -2,9 +2,7 @@
define(['angular', 'utils/semantic', 'services/NodeApi'], (angular, semantic, nodeApi) => { define(['angular', 'utils/semantic', 'services/NodeApi'], (angular, semantic, nodeApi) => {
angular.module('irsViewer').controller('DealController', function DealController($http, $scope, $routeParams, nodeService) { angular.module('irsViewer').controller('DealController', function DealController($http, $scope, $routeParams, nodeService) {
semantic.init(); semantic.init($scope, nodeService.isLoading);
$scope.isLoading = nodeService.isLoading;
nodeService.getDeal($routeParams.dealId).then((deal) => $scope.deal = deal); nodeService.getDeal($routeParams.dealId).then((deal) => $scope.deal = deal);
}); });

View File

@ -1,12 +1,13 @@
'use strict'; 'use strict';
define(['angular', 'services/NodeApi'], (angular, nodeApi) => { define(['angular', 'utils/semantic', 'services/NodeApi'], (angular, semantic, nodeApi) => {
angular.module('irsViewer').controller('HomeController', function HomeController($http, $scope, nodeService) { angular.module('irsViewer').controller('HomeController', function HomeController($http, $scope, nodeService) {
semantic.addLoadingModal($scope, nodeService.isLoading);
let handleHttpFail = (resp) => { let handleHttpFail = (resp) => {
$scope.httpError = resp.data $scope.httpError = resp.data
} }
$scope.isLoading = nodeService.isLoading;
$scope.infoMsg = ""; $scope.infoMsg = "";
$scope.errorText = ""; $scope.errorText = "";
$scope.date = { "year": "...", "month": "...", "day": "..." }; $scope.date = { "year": "...", "month": "...", "day": "..." };

View File

@ -76,6 +76,7 @@ define(['angular', 'lodash'], (angular, _) => {
} }
this.isLoading = () => { this.isLoading = () => {
console.log("IS LOADING");
return _.reduce(Object.keys(curLoading), (last, key) => { return _.reduce(Object.keys(curLoading), (last, key) => {
return (last || curLoading[key]); return (last || curLoading[key]);
}, false); }, false);

View File

@ -2,10 +2,21 @@
define(['jquery', 'semantic'], ($, semantic) => { define(['jquery', 'semantic'], ($, semantic) => {
return { return {
init: () => { init: function($scope, loadingFunc) {
$('.ui.accordion').accordion(); $('.ui.accordion').accordion();
$('.ui.dropdown').dropdown(); $('.ui.dropdown').dropdown();
$('.ui.sticky').sticky(); $('.ui.sticky').sticky();
this.addLoadingModal($scope, loadingFunc);
},
addLoadingModal: ($scope, loadingFunc) => {
$scope.$watch(loadingFunc, (newVal) => {
if(newVal === true) {
$('#loading').modal('setting', 'closable', false).modal('show');
} else {
$('#loading').modal('hide');
}
});
} }
}; };
}); });

View File

@ -1,8 +1,5 @@
<div class="ui container"> <div class="ui container">
<div class="ui negative message" id="form-error" ng-show="formError">{{formError}}</div> <div class="ui negative message" id="form-error" ng-show="formError">{{formError}}</div>
<div class="ui active dimmer" ng-show="isLoading()">
<div class="ui text loader">Loading</div>
</div>
<h2>New Deal</h2> <h2>New Deal</h2>
<form id="deal-form" class="ui form" ng-submit="createDeal()"> <form id="deal-form" class="ui form" ng-submit="createDeal()">
<div id="irscolumns" class="ui grid"> <div id="irscolumns" class="ui grid">

View File

@ -1,11 +1,4 @@
<div class="ui container"> <div class="ui container">
<div class="ui active dimmer" ng-show="isLoading()">
<div class="ui text loader">Loading</div>
</div>
<!-- Todo: Deals should have common data at the top and interchangable green/red
buyer and seller -->
<!-- All fields of the deal can be found from the JSON returned by the IRS demo API.
All fields can be represented in some way -->
<div class="ui grid"> <div class="ui grid">
<div class="sixteen wide column" id="common"> <div class="sixteen wide column" id="common">
<table class="ui striped table"> <table class="ui striped table">