Skip to content

Commit 559c4e1

Browse files
authored
Core 941 update visual presentation of items on my profile (#1633)
* Style name as link Making a separate edit button for it is tricky due to the way the "editable" component works. * Render emails as details elements * Enable other login options as details and restyle Add an email button * Name editor has pencil icon with "edit name" label * Fix logout button
1 parent 9af9860 commit 559c4e1

File tree

6 files changed

+67
-53
lines changed

6 files changed

+67
-53
lines changed

app/assets/javascripts/profile/authentication.coffee

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,4 @@ OX.Profile.Authentication = {
101101
klass = SPECIAL_TYPES[$(el).data('provider')] or AuthenticationOption
102102
new klass(el)
103103

104-
$('#enable-other-sign-in').click (e) ->
105-
e.preventDefault()
106-
$(this).hide()
107-
$('.row.other-sign-in').slideToggle()
108-
109-
110104
}

app/assets/javascripts/profile/email.coffee

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class Email
1111
@id = this.$el.attr('data-id')
1212
this.$el.find('.searchable').change(@saveSearchable)
1313
this.$el.find('.resend-confirmation').click(@sendVerification)
14-
this.$el.find('.email, .unconfirmed-warning').click(@toggleProperties)
1514
@update()
1615

1716
update: ->
@@ -22,10 +21,6 @@ class Email
2221
else
2322
delBtn.on('click', @confirmDelete)
2423

25-
toggleProperties: ->
26-
this.$el.toggleClass('expanded')
27-
this.$el.find('button').attr('aria-expanded', this.$el.hasClass('expanded'))
28-
2924
toggleSpinner: (show) ->
3025
this.$el.find('.spinner').toggle(_.isBoolean(show) and show)
3126

@@ -102,7 +97,7 @@ OX.Profile.Email = {
10297
@addEmail.hide()
10398
email = $('#email-template').children().clone().addClass('new')
10499
$('#add-an-email-editable').append(email)
105-
input = $(email).find('.email .value')
100+
input = $(email).find('summary .value')
106101
input.editable(
107102
url: BASE_URL
108103
params: (params) ->

app/assets/javascripts/profile/name.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class OX.Profile.Name
55
@editable: (el, attribs) ->
66
el.editable(
77
value: attribs,
8-
success: (response) -> $(@).html(response.full_name)
8+
success: (response) -> $(@).find('.text-content').html(response.full_name)
99
validate: (attrs) ->
1010
if not attrs.first_name and not attrs.last_name
1111
OX.I18n.name.first_last_name_blank

app/assets/stylesheets/profile.scss

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ $font-path: '/accounts/fonts';
5555
margin-top: 20px;
5656
}
5757

58+
#name {
59+
.glyphicon {
60+
margin-left: 2rem;
61+
};
62+
}
63+
5864
.category {
5965
text-align: right;
6066
font-weight: bold;
@@ -71,6 +77,11 @@ $font-path: '/accounts/fonts';
7177
}
7278
}
7379

80+
button.editable {
81+
background-color: transparent;
82+
border: 0;
83+
}
84+
7485
.info {
7586
@media(max-width: 767px) {
7687
margin-left: 15px;
@@ -113,6 +124,9 @@ $font-path: '/accounts/fonts';
113124
}
114125

115126
.email-entry {
127+
&:not(.new) summary {
128+
display: list-item;
129+
}
116130
&:first-child {
117131
.alert { margin-top: 0; }
118132
}
@@ -133,7 +147,6 @@ $font-path: '/accounts/fonts';
133147
top: 15px;
134148
}
135149
.controls {
136-
display: none;
137150
overflow: hidden;
138151
margin-left: 20px;
139152
margin-top: 4px;
@@ -161,12 +174,6 @@ $font-path: '/accounts/fonts';
161174
}
162175
}
163176
}
164-
&.expanded,
165-
&[aria-expanded="true"] {
166-
.controls {
167-
display: block;
168-
}
169-
}
170177

171178
.resend-confirmation {
172179
margin-left: 7px;
@@ -198,6 +205,9 @@ $font-path: '/accounts/fonts';
198205
}
199206

200207
#add-an-email {
208+
background-color: transparent;
209+
border: thin solid gray;
210+
border-radius: 0.3rem;
201211
margin-top: 10px;
202212
display: block;
203213
}
@@ -246,6 +256,10 @@ $font-path: '/accounts/fonts';
246256
}
247257
}
248258

259+
#enable-other-sign-in {
260+
display: list-item;
261+
}
262+
249263
.enabled-providers {
250264
.mod-holder .add { display: none; }
251265
.mod-holder .add--newflow { display: none; }
@@ -258,6 +272,15 @@ $font-path: '/accounts/fonts';
258272
}
259273

260274
.other-sign-in {
275+
summary {
276+
display: list-item;
277+
margin-top: -3rem;
278+
margin-bottom: 0.5rem;
279+
}
280+
281+
.controls {
282+
padding-left: 1.6rem;
283+
}
261284
.authentication {
262285
.mod-holder {
263286
.edit { display: none; }
@@ -268,9 +291,4 @@ $font-path: '/accounts/fonts';
268291
}
269292
}
270293

271-
.row.other-sign-in {
272-
display: none;
273-
}
274-
275-
276294
}

app/helpers/profile_helper.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ def email_entry(value:, id:, is_verified:, is_searchable:)
8282

8383
(
8484
<<-SNIPPET
85-
<div class="email-entry editable-click #{'verified' if is_verified}" data-id="#{id}">
86-
<button type="button" class="email" aria-expanded="false">
85+
<details class="email-entry editable-click #{'verified' if is_verified}" data-id="#{id}">
86+
<summary>
8787
<span class="value">#{value}</span>
88-
</button>
89-
#{unconfirmed_link}
88+
#{unconfirmed_link}
89+
</summary>
9090
<div class="controls">
9191
<div class='resend-confirmation'>
9292
<i class='fa fa-envelope-o'></i>
@@ -100,7 +100,7 @@ def email_entry(value:, id:, is_verified:, is_searchable:)
100100
</div>
101101
</div>
102102
<i class="spinner fa fa-spinner fa-spin fa-lg" style="display:none"></i>
103-
</div>
103+
</details>
104104
SNIPPET
105105
).html_safe
106106
end

app/views/newflow/base/profile_newflow.html.erb

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
display: none;
2424
}
2525

26-
a, #enable-other-sign-in, #add-an-email, .resend-confirmation input[type=submit] {
26+
a,
27+
#enable-other-sign-in,
28+
#add-an-email,
29+
button.editable,
30+
.resend-confirmation input[type=submit] {
2731
color: #027eb5 !important;
2832
}
2933

@@ -123,6 +127,7 @@
123127
I18n.t(:"legacy.users.edit.sign_out"),
124128
newflow_logout_path,
125129
class: 'sign-out',
130+
method: :get,
126131
data: {
127132
'ga-category': 'Logout',
128133
'ga-action': 'Click',
@@ -138,7 +143,13 @@
138143
<%= I18n.t(:"legacy.users.edit.name") %>
139144
</div>
140145
<div class="col-sm-10 info">
141-
<button href="#" id="name" class="editable" data-type="profile_name"><%= current_user.full_name %></button>
146+
<button type="button" id="name"
147+
class="editable"
148+
data-type="profile_name"
149+
>
150+
<span class="text-content"><%= current_user.full_name %></span>
151+
<span class="glyphicon glyphicon-pencil" aria-label="edit name"></span>
152+
</button>
142153
</div>
143154
</div>
144155

@@ -196,30 +207,26 @@
196207
<%= newflow_way_to_login(provider: provider, has_authentication: true, current_providers: current_providers) %>
197208
<% end %>
198209
</div>
199-
<% if other_available_providers.any? %>
200-
<div class="col-sm-offset-2 info col-sm-10">
201-
<button id="enable-other-sign-in"><%= I18n.t(:"student_profile.enable_other_sign_in_options") %></button>
202-
</div>
203-
<% end %>
204-
205210
</div>
206211

207-
<div class="row other-sign-in">
208-
<div class="col-sm-2 category">
209-
<%= I18n.t(:"student_profile.other_sign_in_options_html").html_safe %>
210-
</div>
211-
<div class="col-sm-10 info providers">
212-
<% other_available_providers.each do |provider| %>
213-
<%=
214-
newflow_way_to_login(
215-
provider: provider,
216-
has_authentication: false,
217-
current_providers: current_providers
218-
)
219-
%>
220-
<% end %>
212+
<% if other_available_providers.any? %>
213+
<div class="row other-sign-in">
214+
<details class="col-sm-10 col-sm-offset-2 info providers">
215+
<summary><%= I18n.t(:"student_profile.enable_other_sign_in_options") %></summary>
216+
<div class="controls">
217+
<% other_available_providers.each do |provider| %>
218+
<%=
219+
newflow_way_to_login(
220+
provider: provider,
221+
has_authentication: false,
222+
current_providers: current_providers
223+
)
224+
%>
225+
<% end %>
226+
<div>
227+
</details>
221228
</div>
222-
</div>
229+
<% end %>
223230

224231
<hr>
225232
<div class="row">

0 commit comments

Comments
 (0)