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

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 scope = view.inject(InventoryList, { mode: mode }); // Inject our view
scope.selected = [];
$rootScope.flashMessage = null;
if (scope.PostRefreshRemove) {
scope.PostRefreshRemove();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -522,7 +522,9 @@ angular.module('FormGenerator', ['GeneratorHelpers'])
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";
var field;