change wording on user settings page

fixes #10244

test plan:
  1. login
  2. click on Settings link at the top right
  3. verify page title says User Settings
  4. verify wording changed in breadcrumb
  5. verify wording changed in header
  6. click Edit Settings link and verify
     link hides
  7. verify button says Update Settings
  8. verify delete link says Delete My Account
  9. click the Cancel link
  10. verify Edit Settings link shows again
  11. click Edit Settings, edit a setting
      click Update Settings link
  12. verify Update Settings button shows
      after a new page load

Change-Id: Id200db687d79f24cceca8c2f93a720903b76471f
Reviewed-on: https://gerrit.instructure.com/13321
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
This commit is contained in:
Jake Sorce 2012-08-29 10:53:36 -06:00
parent 8518334c4e
commit 93b78549e9
5 changed files with 19 additions and 18 deletions

View File

@ -52,7 +52,7 @@ class ProfileController < ApplicationController
known_user = @user_data[:common_contexts].present?
if @user_data[:known_user] # if you can message them, you can see the profile
add_crumb(t('crumbs.profile_frd', "%{user}'s profile", :user => @user.short_name), user_profile_path(@user))
add_crumb(t('crumbs.settings_frd', "%{user}'s settings", :user => @user.short_name), user_profile_path(@user))
return render :action => :show
else
return render :action => :unauthorized
@ -101,7 +101,7 @@ class ProfileController < ApplicationController
@active_tab = "profile_settings"
respond_to do |format|
format.html do
add_crumb(t(:crumb, "%{user}'s profile", :user => @user.short_name), settings_profile_path )
add_crumb(t(:crumb, "%{user}'s settings", :user => @user.short_name), settings_profile_path )
render :action => "profile"
end
format.json do
@ -220,7 +220,7 @@ class ProfileController < ApplicationController
end
end
unless pseudonymed
flash[:notice] = t('notices.updated_profile', "Profile successfully updated")
flash[:notice] = t('notices.updated_profile', "Settings successfully updated")
format.html { redirect_to user_profile_url(@current_user) }
format.json { render :json => @user.to_json(:methods => :avatar_url, :include => {:communication_channel => {:only => [:id, :path]}, :pseudonym => {:only => [:id, :unique_id]} }) }
end

View File

@ -1,5 +1,5 @@
<% content_for :page_title do %>
<%= join_title t(:page_title, "Profile Settings"), @user.name %>
<%= join_title t(:page_title, "User Settings"), @user.name %>
<% end %>
<% content_for :right_side do %>
@ -7,7 +7,7 @@
<%= render :partial => "ways_to_contact" %>
<div class="rs-margin-lr">
<hr />
<a href="#" class="edit_profile_link button button-sidebar-wide"><%= image_tag "edit.png" %> <%= t('links.edit_settings', "Edit Settings") %></a>
<a href="#" class="edit_settings_link button button-sidebar-wide"><%= image_tag "edit.png" %> <%= t('links.edit_settings', "Edit Settings") %></a>
<% mfa_settings = @user.mfa_settings %>
<% if mfa_settings != :disabled %>
<a href="<%= otp_login_path %>" class="button button-sidebar-wide"><%= image_tag "lock.png" %> <%= @user.otp_secret_key ? t('links.reconfigure_mfa', "Reconfigure Multi-Factor Authentication") : t('links.configure_mfa', "Set Up Multi-Factor Authentication") %></a>
@ -27,7 +27,7 @@
<%= avatar_image(@user) %>
</a>
<% end %>
<h2 style="padding-top: 0.3em;"><%= t('headers.users_profile', "%{user}'s Profile", :user => @user.short_name) %></h2>
<h2 style="padding-top: 0.3em;"><%= t('headers.users_profile', "%{user}'s Settings", :user => @user.short_name) %></h2>
<div class="clear"></div>
<% form_for @user, :url => profile_path, :html => {:id => "update_profile_form", :style => "margin-bottom: 20px;"} do |f| %>
<table class="profile_table">
@ -135,8 +135,8 @@
</tr>
<tr class="edit_data_row" style="display: none;">
<td colspan="2">
<p><a style="font-size: 0.9em" href="<%= user_delete_url(@user.id) %>" class="admin"><%= t('links.delete_profile', "Delete My Profile") %> </a></p>
<button type="submit" class="button"><%= t('buttons.update_profile', "Update Profile") %></button>
<p><a style="font-size: 0.9em" href="<%= user_delete_url(@user.id) %>" class="admin"><%= t('links.delete_account', "Delete My Account") %> </a></p>
<button type="submit" class="button"><%= t('buttons.update_settings', "Update Settings") %></button>
<button type="button" class="cancel_button button-secondary"><%= t('#buttons.cancel', "Cancel") %></button>
</td>
</tr>

View File

@ -31,6 +31,8 @@ define([
'compiled/jquery.rails_flash_notifications'
], function(INST, I18n, $, BackoffPoller) {
var $edit_settings_link = $(".edit_settings_link");
var $profile_table = $(".profile_table"),
$update_profile_form = $("#update_profile_form"),
$default_email_id = $("#default_email_id"),
@ -61,14 +63,16 @@ define([
return 'continue';
});
$(".edit_profile_link").click(function(event) {
$edit_settings_link.click(function(event) {
$(this).hide();
$profile_table.addClass('editing')
.find(".edit_data_row").show().end()
.find(":text:first").focus().select();
return false;
return false;
});
$profile_table.find(".cancel_button").click(function(event) {
$edit_settings_link.show();
$profile_table
.removeClass('editing')
.find(".change_password_row,.edit_data_row,.more_options_row").hide().end()
@ -152,7 +156,7 @@ define([
},
error: function(data) {
$update_profile_form.loadingImage('remove').formErrors(data.errors || data);
$(".edit_profile_link").click();
$edit_settings_link.click();
}
})
.find(".more_options_link").click(function() {

View File

@ -734,11 +734,11 @@ shared_examples_for "all selenium tests" do
# can pass in either an element or a forms css
def submit_form(form)
submit_button_css = 'button[type="submit"]'
form.is_a?(Selenium::WebDriver::Element) ? form.find_element(:css, submit_button_css).click : f(form + ' ' + submit_button_css).click
form.is_a?(Selenium::WebDriver::Element) ? form.find_element(:css, submit_button_css).click : f("#{form} #{submit_button_css}").click
end
def submit_dialog(dialog, submit_button_css = '.submit_button')
dialog.is_a?(Selenium::WebDriver::Element) ? dialog.find_element(:css, submit_button_css).click : f(dialog + ' ' + submit_button_css).click
dialog.is_a?(Selenium::WebDriver::Element) ? dialog.find_element(:css, submit_button_css).click : f("#{dialog} #{submit_button_css}").click
end
def check_image(element)

View File

@ -1,12 +1,10 @@
# coding: utf-8
require File.expand_path(File.dirname(__FILE__) + '/common')
describe "profile" do
it_should_behave_like "in-process server selenium tests"
def click_edit
f('.edit_profile_link').click
f('.edit_settings_link').click
edit_form = f('#update_profile_form')
keep_trying_until { edit_form.should be_displayed }
edit_form
@ -16,7 +14,7 @@ describe "profile" do
f('#unregistered_service_skype > a').click
skype_dialog = f('#unregistered_service_skype_dialog')
skype_dialog.find_element(:id, 'user_service_user_name').send_keys("jakesorce")
submit_dialog('#unregistered_service_skype_dialog', '.button')
submit_dialog(skype_dialog, '.button')
wait_for_ajaximations
f('#registered_services').should include_text("Skype")
end
@ -38,7 +36,6 @@ describe "profile" do
user_with_pseudonym({:active_user => true})
login_as
get '/profile/settings'
old_password = 'oldpassword'
wrong_old_password = 'wrongoldpassword'
new_password = 'newpassword'
edit_form = click_edit