On 9/27/2011 4:01 PM, Endi Sukma Dewata wrote:
The adder dialog has been modified to show a confirmation message
after each successful addition.
Ticket #1786
Rebased on top of 286 (because 286 needs to go to ipa-2-1 branch).
--
Endi S. Dewata
From 62ace18cde62f8515990f22e1b6e68a71f2a7af5 Mon Sep 17 00:00:00 2001
From: Endi S. Dewata <edew...@redhat.com>
Date: Tue, 27 Sep 2011 09:28:14 -0500
Subject: [PATCH] Added confirmation when adding multiple entries.
The adder dialog has been modified to show a confirmation message
after each successful addition.
Ticket #1786
---
install/ui/aci.js | 2 +-
install/ui/add.js | 9 +++++++++
install/ui/dialog.js | 16 +++++++++++++---
install/ui/dns.js | 8 ++++++++
install/ui/host.js | 2 +-
install/ui/ipa.css | 33 +++++++++++++++++++++------------
install/ui/policy.js | 2 +-
install/ui/service.js | 2 +-
install/ui/test/data/ipa_init.json | 1 +
ipalib/plugins/internal.py | 1 +
10 files changed, 57 insertions(+), 19 deletions(-)
diff --git a/install/ui/aci.js b/install/ui/aci.js
index 80d5798b2d680976532e2a3cc6deb5983e36a174..8d2cbea12cd7e8d1a39287af98684ee7dda4e415 100644
--- a/install/ui/aci.js
+++ b/install/ui/aci.js
@@ -63,7 +63,7 @@ IPA.entity_factories.permission = function() {
facet_group: 'privilege'
}).
adder_dialog({
- height: 400,
+ height: 450,
sections: [
{
name: 'general',
diff --git a/install/ui/add.js b/install/ui/add.js
index 21707df13a553586e7610a42fd038aecdad344ff..1d229fd57fe0ceddbeae8a1a22e8858f6e2f2b3a 100644
--- a/install/ui/add.js
+++ b/install/ui/add.js
@@ -112,6 +112,7 @@ IPA.add_dialog = function (spec) {
/*dialog initialization*/
that.add_button(IPA.messages.buttons.add, function() {
+ that.hide_message();
that.add(
function(data, text_status, xhr) {
var facet = IPA.current_entity.get_facet();
@@ -123,8 +124,14 @@ IPA.add_dialog = function (spec) {
});
that.add_button(IPA.messages.buttons.add_and_add_another, function() {
+ that.hide_message();
that.add(
function(data, text_status, xhr) {
+ var label = that.entity.metadata.label_singular;
+ var message = IPA.messages.dialogs.add_confirmation;
+ message = message.replace('${entity}', label);
+ that.show_message(message);
+
var facet = IPA.current_entity.get_facet();
var table = facet.table;
table.refresh();
@@ -134,6 +141,7 @@ IPA.add_dialog = function (spec) {
});
that.add_button(IPA.messages.buttons.add_and_edit, function() {
+ that.hide_message();
that.add(
function(data, text_status, xhr) {
that.close();
@@ -144,6 +152,7 @@ IPA.add_dialog = function (spec) {
});
that.add_button(IPA.messages.buttons.cancel, function() {
+ that.hide_message();
that.close();
});
diff --git a/install/ui/dialog.js b/install/ui/dialog.js
index 50bb194b3e42df12449c9920d089bae6a6f16a1d..f788ec150ea68713afd89eb9324a0840228f6932 100644
--- a/install/ui/dialog.js
+++ b/install/ui/dialog.js
@@ -80,11 +80,8 @@ IPA.dialog = function(spec) {
};
that.add_field = function(field) {
- field.dialog = that;
-
var section = that.get_section();
section.add_field(field);
-
return field;
};
@@ -145,6 +142,11 @@ IPA.dialog = function(spec) {
*/
that.create = function() {
+ that.message_container = $('<div/>', {
+ style: 'display: none',
+ 'class': 'dialog-message ui-state-highlight ui-corner-all'
+ }).appendTo(that.container);
+
var sections = that.sections.values;
for (var i=0; i<sections.length; i++) {
var section = sections[i];
@@ -159,6 +161,14 @@ IPA.dialog = function(spec) {
};
+ that.show_message = function(message) {
+ that.message_container.text(message);
+ that.message_container.css('display', '');
+ };
+
+ that.hide_message = function() {
+ that.message_container.css('display', 'none');
+ };
/**
* Open dialog
diff --git a/install/ui/dns.js b/install/ui/dns.js
index 0115a311e9378b429a54dc89e24dfb4558d62c14..b2310bf6ac54b8832dda06306dea6d047e927ada 100644
--- a/install/ui/dns.js
+++ b/install/ui/dns.js
@@ -231,6 +231,9 @@ IPA.dnszone_details_facet = function(spec) {
return that;
};
+// TODO: Remove the custom create() by moving the fields into sections.
+// The idnsname and name_from_ip should be moved into a custom section.
+// The idnssoamname, idnssoarname, and force into a standard section.
IPA.dnszone_adder_dialog = function(spec) {
spec = spec || {};
@@ -241,6 +244,11 @@ IPA.dnszone_adder_dialog = function(spec) {
that.container.addClass('dnszone-adder-dialog');
+ that.message_container = $('<div/>', {
+ style: 'display: none',
+ 'class': 'dialog-message ui-state-highlight ui-corner-all'
+ }).appendTo(that.container);
+
var table = $('<table/>').appendTo(that.container);
var field = that.get_field('idnsname');
diff --git a/install/ui/host.js b/install/ui/host.js
index 01b366e5e9a3152efbb417442f46da51703b3bbf..3e06dd57a24ad106d9dd0b107af0a503da9e6967 100644
--- a/install/ui/host.js
+++ b/install/ui/host.js
@@ -120,7 +120,7 @@ IPA.entity_factories.host = function () {
standard_association_facets().
adder_dialog({
factory: IPA.host_adder_dialog,
- height: 250,
+ height: 300,
sections: [
{
factory: IPA.host_fqdn_section,
diff --git a/install/ui/ipa.css b/install/ui/ipa.css
index 5befe499fa939994c01228ae2de5472a8ed062ee..52df3a1af731f98356c7cb85958be5943da0f517 100644
--- a/install/ui/ipa.css
+++ b/install/ui/ipa.css
@@ -272,7 +272,7 @@ div.tabs {
.tabs1 > .ui-tabs-nav li {
-moz-border-radius: 0 !important;
- -webkit-border-radius: 0 !important;
+ -webkit-border-radius: 0 !important;
background-image: url("Mainnav-offtab.png");
margin: 0 0.4em 0 0;
border-width: 0;
@@ -289,7 +289,7 @@ div.tabs {
.tabs1 > .ui-tabs-nav > li > a {
-moz-border-radius: 0 !important;
- -webkit-border-radius: 0 !important;
+ -webkit-border-radius: 0 !important;
font-family: "Overpass Bold","Liberation Sans", Arial, sans-serif;
min-width: 5em;
height: 20px;
@@ -629,7 +629,7 @@ span.main-nav-off > a:visited {
float: right;
width: 215px;
-moz-border-radius: 15px !important;
- -webkit-border-radius: 15px !important;
+ -webkit-border-radius: 15px !important;
border-radius: 15px !important;
border: 1px solid #9f9e9e;
background: url("search-bg.png");
@@ -653,10 +653,10 @@ span.main-nav-off > a:visited {
.search-controls {
-moz-border-radius: .7em .7em 0 0;
- -webkit-border-radius: .7em .7em 0 0;
+ -webkit-border-radius: .7em .7em 0 0;
height:2.5em;
background: -moz-linear-gradient(top, #eeeeee, #dfdfdf);
- background: -webkit-gradient(linear, left top, left bottom, from(#eeeeee), to(#dfdfdf));
+ background: -webkit-gradient(linear, left top, left bottom, from(#eeeeee), to(#dfdfdf));
position: relative;
padding: 1em 1.5em;
margin-top: .8em;
@@ -913,6 +913,15 @@ a, .ui-widget-content a {
}
*/
+.dialog-message {
+ margin: 5px 5px 10px;
+ padding: 10px;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+ text-align: center;
+}
+
.ui-widget input, .ui-widget select,
.ui-widget textarea, .ui-widget button {
font-family: "Liberation Sans", Arial, sans-serif;
@@ -922,13 +931,13 @@ a, .ui-widget-content a {
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default, #content .ui-state-default {
-moz-border-radius: .3em;
- -webkit-border-radius: .3em;
- background: -moz-linear-gradient(top, #959595, #5e5e5e);
- background: -webkit-gradient(linear, left top, left bottom, from(#959595), to(#5e5e5e));
- border: 1px solid #777777;
- color: #fff;
- font-weight: normal;
- padding: 0.4em 1em;
+ -webkit-border-radius: .3em;
+ background: -moz-linear-gradient(top, #959595, #5e5e5e);
+ background: -webkit-gradient(linear, left top, left bottom, from(#959595), to(#5e5e5e));
+ border: 1px solid #777777;
+ color: #fff;
+ font-weight: normal;
+ padding: 0.4em 1em;
}
[title=">>"] {
diff --git a/install/ui/policy.js b/install/ui/policy.js
index ac9eb20f71d0e6765aaa069fbae27304018511a4..ecda339bbb2d7616fd955a8697385c9d69d7cac1 100644
--- a/install/ui/policy.js
+++ b/install/ui/policy.js
@@ -52,7 +52,7 @@ IPA.entity_factories.pwpolicy = function() {
other_field: 'cn'
},
'cospriority'],
- height: 250
+ height: 300
}).
build();
};
diff --git a/install/ui/service.js b/install/ui/service.js
index f8e95f897c65b22c9a77f48b2d232bacf60e5607..7dab017c2dc3d9b4b8f4903113802b6a74f7cb82 100644
--- a/install/ui/service.js
+++ b/install/ui/service.js
@@ -71,7 +71,7 @@ IPA.entity_factories.service = function() {
standard_association_facets().
adder_dialog({
factory: IPA.service_add_dialog,
- height: 300
+ height: 350
}).
build();
};
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 96339a8490c96ece4a9ebb7ff50906a98fe453e6..5de6525edef0a4057729fe1d5a53139dae78efd6 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -16761,6 +16761,7 @@
"to_top": "Back to Top"
},
"dialogs": {
+ "add_confirmation": "${entity} successfully added",
"add_title": "Add ${entity}",
"available": "Available",
"batch_error_message": "Some operations failed.",
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index b87fa27a38785f9a8034dafafd02f3ddda900173..b973e5f637e849523f4ab75d418f1166749592ee 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -156,6 +156,7 @@ class i18n_messages(Command):
"to_top": _("Back to Top")
},
"dialogs": {
+ "add_confirmation": _("${entity} successfully added"),
"add_title": _("Add ${entity}"),
"available": _("Available"),
"batch_error_message": _("Some operations failed."),
--
1.7.5.1
_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel