[Kimchi-devel] [PATCH 3/3] Use action verb as the main button's label
Hongliang Wang
hlwang at linux.vnet.ibm.com
Thu May 15 03:30:29 UTC 2014
On 05/15/2014 04:39 AM, Crístian Viana wrote:
> Currently, most modal dialogs use their respective action verb as the
> main button's labels. For example, the submit button in the dialog
> "Create network" has the label "Create". But that does not happen
> consistently in all dialogs. For example, when editing a guest, the
> dialog's submit button is labeled "Save" instead of "Edit".
It's an interesting topic here. Take edit template for example. The flow is:
List templates =>
Select a template to edit by clicking the "*Edit*" Button =>
Edit template window is open, and user changes some fields. =>
Click the "*Save*" (Or "Submit") Button to save (or submit) changes.
Notice that "Edit" means the user is about to edit the template, so
"Edit'" Button should trigger a pop-up window to allow user to change
some fields.
And "Save" Button is for saving user's changes to server. So I think
it's reasonable to use these 2 labels for these 2 different purposes.
>
> Change some buttons' labels to reflect their dialog's action verbs.
> Also, remove the translation entries which are not used anymore.
>
> Signed-off-by: Crístian Viana <vianac at linux.vnet.ibm.com>
> ---
> po/en_US.po | 3 ---
> po/kimchi.pot | 3 ---
> po/pt_BR.po | 3 ---
> po/zh_CN.po | 3 ---
> ui/js/src/kimchi.guest_edit_main.js | 8 ++++----
> ui/js/src/kimchi.repository_edit_main.js | 6 +++---
> ui/js/src/kimchi.template_edit_main.js | 2 +-
> ui/pages/guest-edit.html.tmpl | 4 ++--
> ui/pages/repository-edit.html.tmpl | 4 ++--
> ui/pages/template-edit.html.tmpl | 2 +-
> 10 files changed, 13 insertions(+), 25 deletions(-)
>
> diff --git a/po/en_US.po b/po/en_US.po
> index 5c3d5d8..485ab25 100644
> --- a/po/en_US.po
> +++ b/po/en_US.po
> @@ -946,9 +946,6 @@ msgstr "Network"
> msgid "Type"
> msgstr "Type"
>
> -msgid "Save"
> -msgstr "Save"
> -
> msgid "Detach"
> msgstr ""
>
> diff --git a/po/kimchi.pot b/po/kimchi.pot
> index 89e6567..76f6f8b 100755
> --- a/po/kimchi.pot
> +++ b/po/kimchi.pot
> @@ -946,9 +946,6 @@ msgstr ""
> msgid "Type"
> msgstr ""
>
> -msgid "Save"
> -msgstr ""
> -
> msgid "Detach"
> msgstr ""
>
> diff --git a/po/pt_BR.po b/po/pt_BR.po
> index b0058c4..9526973 100644
> --- a/po/pt_BR.po
> +++ b/po/pt_BR.po
> @@ -1040,9 +1040,6 @@ msgstr "Redes"
> msgid "Type"
> msgstr "Tipo"
>
> -msgid "Save"
> -msgstr "Salvar"
> -
> msgid "Detach"
> msgstr "Remover"
>
> diff --git a/po/zh_CN.po b/po/zh_CN.po
> index 2b6ac17..e39d7a9 100644
> --- a/po/zh_CN.po
> +++ b/po/zh_CN.po
> @@ -966,9 +966,6 @@ msgstr "网络"
> msgid "Type"
> msgstr "类型"
>
> -msgid "Save"
> -msgstr "保存"
> -
> msgid "Detach"
> msgstr "卸载"
>
> diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
> index 0236e2d..e5e7698 100644
> --- a/ui/js/src/kimchi.guest_edit_main.js
> +++ b/ui/js/src/kimchi.guest_edit_main.js
> @@ -30,7 +30,7 @@ kimchi.guest_edit_main = function() {
> });
>
> var guestEditForm = $('#form-guest-edit-general');
> - var saveButton = $('#guest-edit-button-save');
> + var submitButton = $('#guest-edit-button');
Let me explain the naming rule of #guest-edit-button-save. It follows
name space style like Java package mechanism.
guest-: It's within the scope of guest page
edit-: It's within the scope of guest edit window
button-: It's a button within the scope of guest edit window
save: It's a button named save
So please remain the original ID string of the button. If we will
introduce another button in the future, we can simply name it
"#guest-edit-button-newid".
>
> var refreshCDROMs = function() {
> kimchi.listVMStorages({
> @@ -203,7 +203,7 @@ kimchi.guest_edit_main = function() {
> kimchi.retrieveVM(kimchi.selectedGuest, initContent);
>
> var submitForm = function(event) {
> - $(saveButton).prop('disabled', true);
> + $(submitButton).prop('disabled', true);
> var data=$('#form-guest-edit-general').serializeObject();
> if(data['memory']!=undefined) {
> data['memory'] = Number(data['memory']);
> @@ -217,12 +217,12 @@ kimchi.guest_edit_main = function() {
> kimchi.window.close();
> }, function(err) {
> kimchi.message.error(err.responseJSON.reason);
> - $(saveButton).prop('disabled', false);
> + $(submitButton).prop('disabled', false);
> });
>
> event.preventDefault();
> };
>
> $(guestEditForm).on('submit', submitForm);
> - $(saveButton).on('click', submitForm);
> + $(submitButton).on('click', submitForm);
> };
> diff --git a/ui/js/src/kimchi.repository_edit_main.js b/ui/js/src/kimchi.repository_edit_main.js
> index 26d6c66..ce45514 100644
> --- a/ui/js/src/kimchi.repository_edit_main.js
> +++ b/ui/js/src/kimchi.repository_edit_main.js
> @@ -19,7 +19,7 @@ kimchi.repository_edit_main = function() {
>
> var editForm = $('#form-repository-edit');
>
> - var saveButton = $('#repository-edit-button-save');
> + var submitButton = $('#repository-edit-button');
>
> if(kimchi.host.capabilities['repo_mngt_tool']=="yum") {
> editForm.find('input.deb').prop('disabled', true);
> @@ -33,7 +33,7 @@ kimchi.repository_edit_main = function() {
>
> $('input', editForm).on('input propertychange', function(event) {
> if($(this).val() !== '') {
> - $(saveButton).prop('disabled', false);
> + $(submitButton).prop('disabled', false);
> }
> });
> });
> @@ -71,5 +71,5 @@ kimchi.repository_edit_main = function() {
> };
>
> $(editForm).on('submit', editRepository);
> - $(saveButton).on('click', editRepository);
> + $(submitButton).on('click', editRepository);
> };
> diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js
> index f0f4718..8f0a150 100644
> --- a/ui/js/src/kimchi.template_edit_main.js
> +++ b/ui/js/src/kimchi.template_edit_main.js
> @@ -133,7 +133,7 @@ kimchi.template_edit_main = function() {
> }
> });
>
> - $('#tmpl-edit-button-save').on('click', function() {
> + $('#tmpl-edit-button').on('click', function() {
> var editableFields = [ 'name', 'cpus', 'memory', 'storagepool', 'disks', 'graphics'];
> var data = {};
> $.each(editableFields, function(i, field) {
> diff --git a/ui/pages/guest-edit.html.tmpl b/ui/pages/guest-edit.html.tmpl
> index 96d907e..75ef19d 100644
> --- a/ui/pages/guest-edit.html.tmpl
> +++ b/ui/pages/guest-edit.html.tmpl
> @@ -116,8 +116,8 @@
> </div>
> <footer>
> <div id="action-button-container" class="btn-group">
> - <button id="guest-edit-button-save" class="btn-normal">
> - <span class="text">$_("Save")</span>
> + <button id="guest-edit-button" class="btn-normal">
> + <span class="text">$_("Edit")</span>
> </button>
> </div>
> </footer>
> diff --git a/ui/pages/repository-edit.html.tmpl b/ui/pages/repository-edit.html.tmpl
> index fbef4f3..d2dff59 100644
> --- a/ui/pages/repository-edit.html.tmpl
> +++ b/ui/pages/repository-edit.html.tmpl
> @@ -103,8 +103,8 @@
> </div>
> <footer>
> <div class="btn-group">
> - <button type="submit" id="repository-edit-button-save" class="btn-normal">
> - <span class="text">$_("Save")</span>
> + <button type="submit" id="repository-edit-button" class="btn-normal">
> + <span class="text">$_("Edit")</span>
> </button>
> </div>
> </footer>
> diff --git a/ui/pages/template-edit.html.tmpl b/ui/pages/template-edit.html.tmpl
> index 434d938..c4fe54a 100644
> --- a/ui/pages/template-edit.html.tmpl
> +++ b/ui/pages/template-edit.html.tmpl
> @@ -142,7 +142,7 @@
> <footer>
> <div class="btn-group">
> <a id="tmpl-edit-button-cancel" class="btn-normal" href="javascript:void(0);"><span class="text">$_("Cancel")</span></a>
> - <a id="tmpl-edit-button-save" class="btn-normal" href="javascript:void(0);"><span class="text">$_("Save")</span></a>
> + <a id="tmpl-edit-button" class="btn-normal" href="javascript:void(0);"><span class="text">$_("Edit")</span></a>
> </div>
> </footer>
> </div>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20140515/d66ede7a/attachment.html>
More information about the Kimchi-devel
mailing list