diff options
author | Phil Hughes <me@iamphill.com> | 2018-07-25 07:37:07 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-07-25 07:37:07 +0000 |
commit | 0cdaf2cc81114693f7b7d55a75ff0089263791f8 (patch) | |
tree | ad07ad7a44fca7dac399e5bc1d88c2cef405deb6 | |
parent | 83a6438002b35a87276f91d2f8a2307b00c327db (diff) | |
parent | e4e824c169ad1ef4e789812ef29c67b599f6244d (diff) | |
download | gitlab-ce-0cdaf2cc81114693f7b7d55a75ff0089263791f8.tar.gz |
Merge branch 'replace-snake-case-css-classes' into 'master'
Replace author_link snake case in stylesheets, specs, and helpers
Closes #30921
See merge request gitlab-org/gitlab-ce!20797
19 files changed, 36 insertions, 33 deletions
diff --git a/app/assets/javascripts/issue_show/components/edited.vue b/app/assets/javascripts/issue_show/components/edited.vue index 5ff5b1630b1..05cd976f196 100644 --- a/app/assets/javascripts/issue_show/components/edited.vue +++ b/app/assets/javascripts/issue_show/components/edited.vue @@ -46,7 +46,7 @@ by <a :href="updatedByPath" - class="author_link" + class="author-link" > <span>{{ updatedByName }}</span> </a> diff --git a/app/assets/javascripts/notes/components/note_edited_text.vue b/app/assets/javascripts/notes/components/note_edited_text.vue index 391bb2ae179..d848335022f 100644 --- a/app/assets/javascripts/notes/components/note_edited_text.vue +++ b/app/assets/javascripts/notes/components/note_edited_text.vue @@ -42,7 +42,7 @@ export default { by <a :href="editedBy.path" - class="js-vue-author author_link"> + class="js-vue-author author-link"> {{ editedBy.name }} </a> </template> diff --git a/app/assets/javascripts/sidebar/components/assignees/assignees.vue b/app/assets/javascripts/sidebar/components/assignees/assignees.vue index d22a1e1ac66..dd155c133ce 100644 --- a/app/assets/javascripts/sidebar/components/assignees/assignees.vue +++ b/app/assets/javascripts/sidebar/components/assignees/assignees.vue @@ -187,7 +187,7 @@ export default { <template v-else-if="hasOneUser"> <a :href="assigneeUrl(firstUser)" - class="author_link bold" + class="author-link bold" > <img :alt="assigneeAlt(firstUser)" diff --git a/app/assets/javascripts/sidebar/components/participants/participants.vue b/app/assets/javascripts/sidebar/components/participants/participants.vue index 33dd6c981b6..56d57f6aac8 100644 --- a/app/assets/javascripts/sidebar/components/participants/participants.vue +++ b/app/assets/javascripts/sidebar/components/participants/participants.vue @@ -120,7 +120,7 @@ > <a :href="participant.web_url" - class="author_link" + class="author-link" > <user-avatar-image :lazy="true" diff --git a/app/assets/javascripts/users_select.js b/app/assets/javascripts/users_select.js index e3d7645040d..e19bbbacf4d 100644 --- a/app/assets/javascripts/users_select.js +++ b/app/assets/javascripts/users_select.js @@ -206,8 +206,8 @@ function UsersSelect(currentUser, els, options = {}) { return $collapsedSidebar.html(collapsedAssigneeTemplate(user)); }); }; - collapsedAssigneeTemplate = _.template('<% if( avatar ) { %> <a class="author_link" href="/<%- username %>"> <img width="24" class="avatar avatar-inline s24" alt="" src="<%- avatar %>"> </a> <% } else { %> <i class="fa fa-user"></i> <% } %>'); - assigneeTemplate = _.template('<% if (username) { %> <a class="author_link bold" href="/<%- username %>"> <% if( avatar ) { %> <img width="32" class="avatar avatar-inline s32" alt="" src="<%- avatar %>"> <% } %> <span class="author"><%- name %></span> <span class="username"> @<%- username %> </span> </a> <% } else { %> <span class="no-value assign-yourself"> No assignee - <a href="#" class="js-assign-yourself"> assign yourself </a> </span> <% } %>'); + collapsedAssigneeTemplate = _.template('<% if( avatar ) { %> <a class="author-link" href="/<%- username %>"> <img width="24" class="avatar avatar-inline s24" alt="" src="<%- avatar %>"> </a> <% } else { %> <i class="fa fa-user"></i> <% } %>'); + assigneeTemplate = _.template('<% if (username) { %> <a class="author-link bold" href="/<%- username %>"> <% if( avatar ) { %> <img width="32" class="avatar avatar-inline s32" alt="" src="<%- avatar %>"> <% } %> <span class="author"><%- name %></span> <span class="username"> @<%- username %> </span> </a> <% } else { %> <span class="no-value assign-yourself"> No assignee - <a href="#" class="js-assign-yourself"> assign yourself </a> </span> <% } %>'); return $dropdown.glDropdown({ showMenuAbove: showMenuAbove, data: function(term, callback) { diff --git a/app/assets/stylesheets/framework/common.scss b/app/assets/stylesheets/framework/common.scss index 218e37602dd..637587de597 100644 --- a/app/assets/stylesheets/framework/common.scss +++ b/app/assets/stylesheets/framework/common.scss @@ -113,8 +113,6 @@ hr { .item-title { font-weight: $gl-font-weight-bold; } -/** FLASH message **/ -.author_link, .author-link { color: $gl-link-color; } diff --git a/app/assets/stylesheets/framework/lists.scss b/app/assets/stylesheets/framework/lists.scss index d54490c87c6..4b67eab05b3 100644 --- a/app/assets/stylesheets/framework/lists.scss +++ b/app/assets/stylesheets/framework/lists.scss @@ -259,7 +259,7 @@ ul.controls { margin-right: 0; } - .author_link { + .author-link { .avatar-inline { margin-left: 0; margin-right: 0; @@ -270,7 +270,7 @@ ul.controls { .issuable-pipeline-broken a, .issuable-pipeline-status a, - .author_link { + .author-link { display: flex; } } diff --git a/app/assets/stylesheets/pages/detail_page.scss b/app/assets/stylesheets/pages/detail_page.scss index 2e007c52592..37ed5ae674a 100644 --- a/app/assets/stylesheets/pages/detail_page.scss +++ b/app/assets/stylesheets/pages/detail_page.scss @@ -10,7 +10,7 @@ } .issue_created_ago, - .author_link { + .author-link { white-space: nowrap; } diff --git a/app/assets/stylesheets/pages/issuable.scss b/app/assets/stylesheets/pages/issuable.scss index f9fd9f1ab8b..e6aa41d5201 100644 --- a/app/assets/stylesheets/pages/issuable.scss +++ b/app/assets/stylesheets/pages/issuable.scss @@ -197,7 +197,7 @@ } &.assignee { - .author_link { + .author-link { display: block; padding-left: 42px; position: relative; @@ -486,7 +486,7 @@ padding-bottom: 0; margin-bottom: 10px; - .author_link { + .author-link { padding-left: 0; .avatar { @@ -595,7 +595,7 @@ margin: 16px 0 0; font-size: 85%; - .author_link { + .author-link { color: $gray-darkest; } } @@ -620,7 +620,7 @@ padding-right: 0; } - .author_link { + .author-link { display: block; } diff --git a/app/assets/stylesheets/pages/issues.scss b/app/assets/stylesheets/pages/issues.scss index 19fb99bfa93..212e5979273 100644 --- a/app/assets/stylesheets/pages/issues.scss +++ b/app/assets/stylesheets/pages/issues.scss @@ -12,7 +12,7 @@ } .issuable-meta { - .author_link { + .author-link { display: inline-block; } diff --git a/app/assets/stylesheets/pages/notes.scss b/app/assets/stylesheets/pages/notes.scss index 32d14049067..fc92a37fb96 100644 --- a/app/assets/stylesheets/pages/notes.scss +++ b/app/assets/stylesheets/pages/notes.scss @@ -403,7 +403,7 @@ ul.notes { } } - .author_link { + .author-link { color: $gl-text-color; } } diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 221f1aa9dd8..aaf9dff43ee 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -63,10 +63,10 @@ module ProjectsHelper author_html = author_html.html_safe if opts[:name] - link_to(author_html, user_path(author), class: "author_link #{"#{opts[:extra_class]}" if opts[:extra_class]} #{"#{opts[:mobile_classes]}" if opts[:mobile_classes]}").html_safe + link_to(author_html, user_path(author), class: "author-link #{"#{opts[:extra_class]}" if opts[:extra_class]} #{"#{opts[:mobile_classes]}" if opts[:mobile_classes]}").html_safe else title = opts[:title].sub(":name", sanitize(author.name)) - link_to(author_html, user_path(author), class: "author_link has-tooltip", title: title, data: { container: 'body' }).html_safe + link_to(author_html, user_path(author), class: "author-link has-tooltip", title: title, data: { container: 'body' }).html_safe end end diff --git a/app/views/shared/notes/_notes_with_form.html.haml b/app/views/shared/notes/_notes_with_form.html.haml index e0832fd9136..9dd1c24fdfa 100644 --- a/app/views/shared/notes/_notes_with_form.html.haml +++ b/app/views/shared/notes/_notes_with_form.html.haml @@ -13,7 +13,7 @@ .flash-container.timeline-content .timeline-icon.d-none.d-sm-none.d-md-block - %a.author_link{ href: user_path(current_user) } + %a.author-link{ href: user_path(current_user) } = image_tag avatar_icon_for_user(current_user), alt: current_user.to_reference, class: 'avatar s40' .timeline-content.timeline-content-form = render "shared/notes/form", view: diff_view, supports_autocomplete: autocomplete diff --git a/changelogs/unreleased/replace-snake-case-css-classes.yml b/changelogs/unreleased/replace-snake-case-css-classes.yml new file mode 100644 index 00000000000..28ec5ee097f --- /dev/null +++ b/changelogs/unreleased/replace-snake-case-css-classes.yml @@ -0,0 +1,5 @@ +--- +title: Replace author_link snake case in stylesheets, specs, and helpers +merge_request: 20797 +author: George Tsiolis +type: other diff --git a/spec/features/issues/update_issues_spec.rb b/spec/features/issues/update_issues_spec.rb index 845a7c5fc42..fd8629ae504 100644 --- a/spec/features/issues/update_issues_spec.rb +++ b/spec/features/issues/update_issues_spec.rb @@ -49,7 +49,7 @@ describe 'Multiple issue updating from issues#index', :js do click_update_issues_button page.within('.issue .controls') do - expect(find('.author_link')["title"]).to have_content(user.name) + expect(find('.author-link')["title"]).to have_content(user.name) end end @@ -63,7 +63,7 @@ describe 'Multiple issue updating from issues#index', :js do click_link 'Unassigned' click_update_issues_button - expect(find('.issue:first-child .controls')).not_to have_css('.author_link') + expect(find('.issue:first-child .controls')).not_to have_css('.author-link') end end diff --git a/spec/features/merge_requests/user_mass_updates_spec.rb b/spec/features/merge_requests/user_mass_updates_spec.rb index bb327159cb0..cb6603d3f50 100644 --- a/spec/features/merge_requests/user_mass_updates_spec.rb +++ b/spec/features/merge_requests/user_mass_updates_spec.rb @@ -47,7 +47,7 @@ describe 'Merge requests > User mass updates', :js do change_assignee(user.name) page.within('.merge-request .controls') do - expect(find('.author_link')["title"]).to have_content(user.name) + expect(find('.author-link')["title"]).to have_content(user.name) end end end @@ -62,7 +62,7 @@ describe 'Merge requests > User mass updates', :js do it 'removes assignee from the merge request' do change_assignee('Unassigned') - expect(find('.merge-request .controls')).not_to have_css('.author_link') + expect(find('.merge-request .controls')).not_to have_css('.author-link') end end end diff --git a/spec/javascripts/issue_show/components/app_spec.js b/spec/javascripts/issue_show/components/app_spec.js index eb5e0bddb74..36328382448 100644 --- a/spec/javascripts/issue_show/components/app_spec.js +++ b/spec/javascripts/issue_show/components/app_spec.js @@ -76,7 +76,7 @@ describe('Issuable output', () => { expect(vm.$el.querySelector('.wiki').innerHTML).toContain('<p>this is a description!</p>'); expect(vm.$el.querySelector('.js-task-list-field').value).toContain('this is a description'); expect(formatText(editedText.innerText)).toMatch(/Edited[\s\S]+?by Some User/); - expect(editedText.querySelector('.author_link').href).toMatch(/\/some_user$/); + expect(editedText.querySelector('.author-link').href).toMatch(/\/some_user$/); expect(editedText.querySelector('time')).toBeTruthy(); }) .then(() => { @@ -90,7 +90,7 @@ describe('Issuable output', () => { expect(vm.$el.querySelector('.js-task-list-field').value).toContain('42'); expect(vm.$el.querySelector('.edited-text')).toBeTruthy(); expect(formatText(vm.$el.querySelector('.edited-text').innerText)).toMatch(/Edited[\s\S]+?by Other User/); - expect(editedText.querySelector('.author_link').href).toMatch(/\/other_user$/); + expect(editedText.querySelector('.author-link').href).toMatch(/\/other_user$/); expect(editedText.querySelector('time')).toBeTruthy(); }) .then(done) diff --git a/spec/javascripts/issue_show/components/edited_spec.js b/spec/javascripts/issue_show/components/edited_spec.js index 2061def699b..7f09db837bb 100644 --- a/spec/javascripts/issue_show/components/edited_spec.js +++ b/spec/javascripts/issue_show/components/edited_spec.js @@ -18,7 +18,7 @@ describe('edited', () => { }).$mount(); expect(formatText(editedComponent.$el.innerText)).toMatch(/Edited[\s\S]+?by Some User/); - expect(editedComponent.$el.querySelector('.author_link').href).toMatch(/\/some_user$/); + expect(editedComponent.$el.querySelector('.author-link').href).toMatch(/\/some_user$/); expect(editedComponent.$el.querySelector('time')).toBeTruthy(); }); @@ -31,7 +31,7 @@ describe('edited', () => { }).$mount(); expect(formatText(editedComponent.$el.innerText)).toMatch(/Edited by Some User/); - expect(editedComponent.$el.querySelector('.author_link').href).toMatch(/\/some_user$/); + expect(editedComponent.$el.querySelector('.author-link').href).toMatch(/\/some_user$/); expect(editedComponent.$el.querySelector('time')).toBeFalsy(); }); @@ -43,7 +43,7 @@ describe('edited', () => { }).$mount(); expect(formatText(editedComponent.$el.innerText)).not.toMatch(/by Some User/); - expect(editedComponent.$el.querySelector('.author_link')).toBeFalsy(); + expect(editedComponent.$el.querySelector('.author-link')).toBeFalsy(); expect(editedComponent.$el.querySelector('time')).toBeTruthy(); }); diff --git a/spec/javascripts/sidebar/assignees_spec.js b/spec/javascripts/sidebar/assignees_spec.js index 4e4343812bd..843e7002180 100644 --- a/spec/javascripts/sidebar/assignees_spec.js +++ b/spec/javascripts/sidebar/assignees_spec.js @@ -102,13 +102,13 @@ describe('Assignee component', () => { }, }).$mount(); - expect(component.$el.querySelector('.author_link')).not.toBeNull(); + expect(component.$el.querySelector('.author-link')).not.toBeNull(); // The image - expect(component.$el.querySelector('.author_link img').getAttribute('src')).toEqual(UsersMock.user.avatar); + expect(component.$el.querySelector('.author-link img').getAttribute('src')).toEqual(UsersMock.user.avatar); // Author name - expect(component.$el.querySelector('.author_link .author').innerText.trim()).toEqual(UsersMock.user.name); + expect(component.$el.querySelector('.author-link .author').innerText.trim()).toEqual(UsersMock.user.name); // Username - expect(component.$el.querySelector('.author_link .username').innerText.trim()).toEqual(`@${UsersMock.user.username}`); + expect(component.$el.querySelector('.author-link .username').innerText.trim()).toEqual(`@${UsersMock.user.username}`); }); it('has the root url present in the assigneeUrl method', () => { |