UI clean-up

This commit is contained in:
chouseknecht
2013-06-24 11:43:10 -04:00
parent 956b076e5b
commit 85ab582155
11 changed files with 53 additions and 26 deletions

View File

@@ -465,21 +465,21 @@
/* form displayed in modal window */ /* form displayed in modal window */
.modal .form-horizontal .control-label { .horizontal-narrow .control-label {
float: left; float: left;
width: 80px; width: 80px;
padding-top: 5px; padding-top: 5px;
text-align: right; text-align: right;
} }
.modal .form-horizontal .controls { .horizontal-narrow .controls {
*display: inline-block; *display: inline-block;
*padding-left: 20px; *padding-left: 20px;
margin-left: 100px; margin-left: 100px;
*margin-left: 0; *margin-left: 0;
} }
.modal .form-horizontal .controls:first-child { .horizontal-narrow .controls:first-child {
*padding-left: 100px; *padding-left: 100px;
} }
@@ -490,10 +490,11 @@
/* overrides to TB modal */ /* overrides to TB modal */
.modal-header { .modal-header {
padding: 10px 10; padding: 15px 10px;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
background-color: #36454F; /* background-color: #A9A9A9; #/
color: #A9A9A9; /*color: #36454F;*/
color: #2078be;
-webkit-border-top-left-radius: 3px; -webkit-border-top-left-radius: 3px;
-moz-border-top-left-radius: 3px; -moz-border-top-left-radius: 3px;
border-top-left-radius: 3px; border-top-left-radius: 3px;
@@ -514,7 +515,7 @@
.modal-header h3 { .modal-header h3 {
font-size: 22px; font-size: 22px;
font-weight: normal; font-weight: bold;
margin: 0; margin: 0;
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
} }

View File

@@ -218,6 +218,14 @@ function CredentialsAdd ($scope, $rootScope, $compile, $location, $log, $routePa
scope[form.name + '_form'][associated].$setValidity('awpassmatch', true); scope[form.name + '_form'][associated].$setValidity('awpassmatch', true);
} }
} }
// Click clear button
scope.clear = function(fld, associated) {
scope[fld] = '';
scope[associated] = '';
scope[form.name + '_form'][associated].$setValidity('awpassmatch', true);
}
} }
CredentialsAdd.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'CredentialForm', 'GenerateForm', CredentialsAdd.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'CredentialForm', 'GenerateForm',

View File

@@ -23,6 +23,7 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Res
var mode = (paths[0] == 'inventories') ? 'edit' : 'select'; // if base path 'users', we're here to add/edit users var mode = (paths[0] == 'inventories') ? 'edit' : 'select'; // if base path 'users', we're here to add/edit users
var scope = view.inject(InventoryList, { mode: mode }); // Inject our view var scope = view.inject(InventoryList, { mode: mode }); // Inject our view
scope.selected = []; scope.selected = [];
$rootScope.flashMessage = null;
if (scope.PostRefreshRemove) { if (scope.PostRefreshRemove) {
scope.PostRefreshRemove(); scope.PostRefreshRemove();

View File

@@ -23,6 +23,7 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
var view = GenerateList; var view = GenerateList;
var base = $location.path().replace(/^\//,'').split('/')[0]; var base = $location.path().replace(/^\//,'').split('/')[0];
var scope = view.inject(list, { mode: 'edit' }); var scope = view.inject(list, { mode: 'edit' });
$rootScope.flashMessage = null;
scope.selected = []; scope.selected = [];
if (scope.RemovePostRefresh) { if (scope.RemovePostRefresh) {

View File

@@ -23,6 +23,7 @@ function JobTemplatesList ($scope, $rootScope, $location, $log, $routeParams, Re
var base = $location.path().replace(/^\//,'').split('/')[0]; var base = $location.path().replace(/^\//,'').split('/')[0];
var mode = (base == 'job_templates') ? 'edit' : 'select'; var mode = (base == 'job_templates') ? 'edit' : 'select';
var scope = view.inject(list, { mode: mode }); var scope = view.inject(list, { mode: mode });
$rootScope.flashMessage = null;
scope.selected = []; scope.selected = [];
if (scope.PostRefreshRemove) { if (scope.PostRefreshRemove) {

View File

@@ -20,6 +20,7 @@ function JobsListCtrl ($scope, $rootScope, $location, $log, $routeParams, Rest,
var view = GenerateList; var view = GenerateList;
var base = $location.path().replace(/^\//,'').split('/')[0]; var base = $location.path().replace(/^\//,'').split('/')[0];
var scope = view.inject(list, { mode: 'edit' }); var scope = view.inject(list, { mode: 'edit' });
$rootScope.flashMessage = null;
scope.selected = []; scope.selected = [];
if (scope.PostRefreshRemove) { if (scope.PostRefreshRemove) {

View File

@@ -23,6 +23,7 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
var mode = (base == 'projects') ? 'edit' : 'select'; var mode = (base == 'projects') ? 'edit' : 'select';
var scope = view.inject(list, { mode: mode }); var scope = view.inject(list, { mode: mode });
scope.selected = []; scope.selected = [];
$rootScope.flashMessage = null;
if (scope.PostRefreshRemove) { if (scope.PostRefreshRemove) {
scope.PostRefreshRemove(); scope.PostRefreshRemove();
@@ -181,6 +182,7 @@ function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParam
Rest.setUrl(url); Rest.setUrl(url);
Rest.post(data) Rest.post(data)
.success( function(data, status, headers, config) { .success( function(data, status, headers, config) {
$rootScope.flashMessage = "New project successfully created!";
(base == 'projects') ? ReturnToCaller() : ReturnToCaller(1); (base == 'projects') ? ReturnToCaller() : ReturnToCaller(1);
}) })
.error( function(data, status, headers, config) { .error( function(data, status, headers, config) {
@@ -268,6 +270,7 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara
// Save changes to the parent // Save changes to the parent
scope.formSave = function() { scope.formSave = function() {
$rootScope.flashMessage = null;
var params = {}; var params = {};
for (var fld in form.fields) { for (var fld in form.fields) {
params[fld] = scope[fld]; params[fld] = scope[fld];
@@ -285,6 +288,7 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara
// Reset the form // Reset the form
scope.formReset = function() { scope.formReset = function() {
$rootScope.flashMessage = null;
generator.reset(); generator.reset();
for (var fld in master) { for (var fld in master) {
scope[fld] = master[fld]; scope[fld] = master[fld];
@@ -293,36 +297,38 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara
// Related set: Add button // Related set: Add button
scope.add = function(set) { scope.add = function(set) {
$rootScope.flashMessage = null;
$location.path('/' + base + '/' + $routeParams.id + '/' + set); $location.path('/' + base + '/' + $routeParams.id + '/' + set);
}; };
// Related set: Edit button // Related set: Edit button
scope.edit = function(set, id, name) { scope.edit = function(set, id, name) {
$rootScope.flashMessage = null;
$location.path('/' + base + '/' + $routeParams.id + '/' + set + '/' + id); $location.path('/' + base + '/' + $routeParams.id + '/' + set + '/' + id);
}; };
// Related set: Delete button // Related set: Delete button
scope['delete'] = function(set, itm_id, name, title) { scope['delete'] = function(set, itm_id, name, title) {
var action = function() { var action = function() {
var url = GetBasePath('projects') + id + '/' + set + '/'; var url = GetBasePath('projects') + id + '/' + set + '/';
Rest.setUrl(url); $rootScope.flashMessage = null;
Rest.post({ id: itm_id, disassociate: 1 }) Rest.setUrl(url);
.success( function(data, status, headers, config) { Rest.post({ id: itm_id, disassociate: 1 })
$('#prompt-modal').modal('hide'); .success( function(data, status, headers, config) {
scope.search(form.related[set].iterator); $('#prompt-modal').modal('hide');
}) scope.search(form.related[set].iterator);
.error( function(data, status, headers, config) { })
$('#prompt-modal').modal('hide'); .error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, null, $('#prompt-modal').modal('hide');
{ hdr: 'Error!', msg: 'Call to ' + url + ' failed. POST returned status: ' + status }); ProcessErrors(scope, data, status, null,
}); { hdr: 'Error!', msg: 'Call to ' + url + ' failed. POST returned status: ' + status });
}; });
};
Prompt({ hdr: 'Delete', Prompt({ hdr: 'Delete',
body: 'Are you sure you want to remove ' + name + ' from ' + scope.name + ' ' + title + '?', body: 'Are you sure you want to remove ' + name + ' from ' + scope.name + ' ' + title + '?',
action: action action: action
}); });
} }
} }

View File

@@ -182,6 +182,7 @@ function TeamsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams,
var form = TeamForm; var form = TeamForm;
var generator = GenerateForm; var generator = GenerateForm;
var scope = generator.inject(form, {mode: 'add', related: false}); var scope = generator.inject(form, {mode: 'add', related: false});
$rootScope.flashMessage = null;
generator.reset(); generator.reset();
LoadBreadCrumbs(); LoadBreadCrumbs();
TeamLookUpOrganizationInit({ scope: scope }); TeamLookUpOrganizationInit({ scope: scope });
@@ -195,6 +196,7 @@ function TeamsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams,
} }
Rest.post(data) Rest.post(data)
.success( function(data, status, headers, config) { .success( function(data, status, headers, config) {
$rootScope.flashMessage = "New team successfully created!";
$location.path('/teams/' + data.id); $location.path('/teams/' + data.id);
}) })
.error( function(data, status, headers, config) { .error( function(data, status, headers, config) {
@@ -286,6 +288,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
// Save changes to the parent // Save changes to the parent
scope.formSave = function() { scope.formSave = function() {
$rootScope.flashMessage = null;
Rest.setUrl(defaultUrl + $routeParams.id +'/'); Rest.setUrl(defaultUrl + $routeParams.id +'/');
var data = {} var data = {}
for (var fld in form.fields) { for (var fld in form.fields) {
@@ -304,6 +307,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
// Cancel // Cancel
scope.formReset = function() { scope.formReset = function() {
$rootScope.flashMessage = null;
generator.reset(); generator.reset();
for (var fld in master) { for (var fld in master) {
scope[fld] = master[fld]; scope[fld] = master[fld];

View File

@@ -281,6 +281,7 @@ function UsersEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
// Save changes to the parent // Save changes to the parent
scope.formSave = function() { scope.formSave = function() {
$rootScope.flashMessage = null;
Rest.setUrl(defaultUrl + id + '/'); Rest.setUrl(defaultUrl + id + '/');
var data = {} var data = {}
for (var fld in form.fields) { for (var fld in form.fields) {

View File

@@ -12,6 +12,7 @@ angular.module('JobEventFormDefinition', [])
editTitle: '{{ id }} - {{ event }}', //Legend in edit mode editTitle: '{{ id }} - {{ event }}', //Legend in edit mode
name: 'job_events', name: 'job_events',
"class": 'horizontal-narrow',
well: false, well: false,
fields: { fields: {

View File

@@ -522,7 +522,9 @@ angular.module('FormGenerator', ['GeneratorHelpers'])
html += "<div class=\"well\">\n"; html += "<div class=\"well\">\n";
} }
html += "<form class=\"form-horizontal\" name=\"" + this.form.name + '_form" id="' + this.form.name + '" novalidate>' + "\n"; html += "<form class=\"form-horizontal";
html += (this.form['class']) ? ' ' + this.form.class : '';
html += "\" name=\"" + this.form.name + '_form" id="' + this.form.name + '" novalidate>' + "\n";
html += "<div ng-show=\"flashMessage != null && flashMessage != undefined\" class=\"alert alert-info\">{{ flashMessage }}</div>\n"; html += "<div ng-show=\"flashMessage != null && flashMessage != undefined\" class=\"alert alert-info\">{{ flashMessage }}</div>\n";
var field; var field;