About dialog

https://fedorahosted.org/freeipa/ticket/4018
This commit is contained in:
Petr Vobornik 2013-11-07 14:37:57 +01:00 committed by Martin Kosek
parent e8c3db4295
commit 0b428b8326
5 changed files with 44 additions and 0 deletions

View File

@ -67,6 +67,7 @@ define([
on(this.app_widget, 'profile-click', lang.hitch(this, this.on_profile));
on(this.app_widget, 'logout-click', lang.hitch(this, this.on_logout));
on(this.app_widget, 'password-reset-click', lang.hitch(this, this.on_password_reset));
on(this.app_widget, 'about-click', lang.hitch(this, this.on_about));
on(this.menu, 'selected', lang.hitch(this, this.on_menu_select));
on(this.router, 'facet-show', lang.hitch(this, this.on_facet_show));
@ -184,6 +185,11 @@ define([
IPA.password_selfservice();
},
on_about: function() {
var dialog = IPA.about_dialog();
dialog.open();
},
on_phase_error: function(error) {
window.console.error(error);

View File

@ -1076,6 +1076,28 @@ IPA.message_dialog = function(spec) {
return that;
};
IPA.about_dialog = function(spec) {
spec = spec || {};
spec.name = spec.name || 'version_dialog';
var product = 'FreeIPA';
var version = 'Unknown';
var msg = text.get('@i18n:dialogs.about_message', '${product}, version: ${version}');
if (IPA.env) {
product = IPA.env.product_name || product;
version = IPA.env.version;
}
msg = msg.replace('${product}', product);
msg = msg.replace('${version}', version);
spec.message = spec.message || msg;
spec.title = spec.title || text.get('@i18n:dialogs.about_title', 'About');
var that = IPA.message_dialog(spec);
return that;
};
/**
* Confirmation dialog
*

View File

@ -193,6 +193,8 @@ define(['dojo/_base/declare',
this.emit('logout-click');
} else if (item.name == 'password_reset') {
this.emit('password-reset-click');
} else if (item.name == 'about') {
this.emit('about-click');
}
},
@ -216,6 +218,14 @@ define(['dojo/_base/declare',
{
'class': 'divider'
},
{
name: 'about',
label: 'About',
icon: 'fa-question'
},
{
'class': 'divider'
},
{
name: 'logout',
label: 'Logout',

View File

@ -52,6 +52,7 @@
"show_results": "Show Results"
},
"buttons": {
"about": "About",
"add": "Add",
"add_and_add_another": "Add and Add Another",
"add_and_close": "Add and Close",
@ -98,6 +99,8 @@
"dirty_title": "Unsaved Changes",
"edit_title": "Edit ${entity}",
"hide_details": "Hide details",
"about_title": "About",
"about_message": "${product}, version: ${version}",
"prospective": "Prospective",
"redirection": "Redirection",
"remove_empty": "Select entries to be removed.",

View File

@ -185,6 +185,7 @@ class i18n_messages(Command):
"show_results": _("Show Results"),
},
"buttons": {
"about": _("About"),
"add": _("Add"),
"add_and_add_another": _("Add and Add Another"),
"add_and_close": _("Add and Close"),
@ -231,6 +232,8 @@ class i18n_messages(Command):
"dirty_title": _("Unsaved Changes"),
"edit_title": _("Edit ${entity}"),
"hide_details": _("Hide details"),
"about_title": _("About"),
"about_message": _("${product}, version: ${version}"),
"prospective": _("Prospective"),
"redirection": _("Redirection"),
"remove_empty": _("Select entries to be removed."),