From cd65d720ad3b3154964d62a20c1d0189ad111d0a Mon Sep 17 00:00:00 2001 From: Waheed Ahmed Date: Thu, 14 Dec 2017 16:42:19 +0500 Subject: [PATCH] Add save button with profile visibility dropdown. When a learner changes this dropdown from Full to Limited or vice versa, nothing happens. This creates confusion, to fix that add save button. LEARNER-3239 --- common/test/acceptance/pages/lms/learner_profile.py | 3 ++- lms/static/sass/features/_learner-profile.scss | 9 +++++++++ lms/templates/fields/field_dropdown.underscore | 6 ++++++ .../learner_profile/js/views/learner_profile_fields.js | 9 +++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/common/test/acceptance/pages/lms/learner_profile.py b/common/test/acceptance/pages/lms/learner_profile.py index 91d1d6e255..3b20ca47d5 100644 --- a/common/test/acceptance/pages/lms/learner_profile.py +++ b/common/test/acceptance/pages/lms/learner_profile.py @@ -144,8 +144,9 @@ class LearnerProfilePage(FieldsMixin, PageObject): if privacy != self.privacy: query = self.q(css=PROFILE_VISIBILITY_INPUT) - select_option_by_value(query, privacy, focus_out=True) + select_option_by_value(query, privacy) EmptyPromise(lambda: privacy == self.privacy, 'Privacy is set to {}'.format(privacy)).fulfill() + self.q(css='.btn-change-privacy').first.click() self.wait_for_ajax() if privacy == 'all_users': diff --git a/lms/static/sass/features/_learner-profile.scss b/lms/static/sass/features/_learner-profile.scss index 9e7a4a00bb..5c48fa5871 100644 --- a/lms/static/sass/features/_learner-profile.scss +++ b/lms/static/sass/features/_learner-profile.scss @@ -282,6 +282,15 @@ max-width: calc(100% - 40px); min-width: auto; } + + .btn-change-privacy { + @extend %btn-primary-blue; + + padding-top: 4px; + padding-bottom: 5px; + background-image: none; + box-shadow: none; + } } .u-field-title { diff --git a/lms/templates/fields/field_dropdown.underscore b/lms/templates/fields/field_dropdown.underscore index 48826683a1..906d2bb53e 100644 --- a/lms/templates/fields/field_dropdown.underscore +++ b/lms/templates/fields/field_dropdown.underscore @@ -40,6 +40,12 @@ <% } %> +<% if (editable != 'never' && id === 'account_privacy') { %> + +<% } %> + <%- message %> diff --git a/openedx/features/learner_profile/static/learner_profile/js/views/learner_profile_fields.js b/openedx/features/learner_profile/static/learner_profile/js/views/learner_profile_fields.js index ae72da3015..28c24ab37b 100644 --- a/openedx/features/learner_profile/static/learner_profile/js/views/learner_profile_fields.js +++ b/openedx/features/learner_profile/static/learner_profile/js/views/learner_profile_fields.js @@ -18,6 +18,11 @@ LearnerProfileFieldViews.AccountPrivacyFieldView = FieldViews.DropdownFieldView.extend({ + events: { + 'click button.btn-change-privacy': 'finishEditing', + 'change select': 'showSaveButton' + }, + render: function() { this._super(); this.showNotificationMessage(); @@ -57,6 +62,10 @@ this.$('.u-field-value select').val('private'); this.disableField(true); } + }, + + showSaveButton: function() { + $('.btn-change-privacy').removeClass('hidden'); } });