Commit 388f69b0 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Merge remote-tracking branch 'origin/master' into gitlab-ci-yaml-updates

# Conflicts:
#	spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
parents 9a271d80 29ac9f64
...@@ -45,6 +45,7 @@ v 8.5.3 ...@@ -45,6 +45,7 @@ v 8.5.3
- Sort starred projects on dashboard based on last activity by default - Sort starred projects on dashboard based on last activity by default
- Show commit message in JIRA mention comment - Show commit message in JIRA mention comment
- Makes issue page and merge request page usable on mobile browsers. - Makes issue page and merge request page usable on mobile browsers.
- Improved UI for profile settings
v 8.5.2 v 8.5.2
- Fix sidebar overlapping content when screen width was below 1200px - Fix sidebar overlapping content when screen width was below 1200px
......
...@@ -220,17 +220,17 @@ $ -> ...@@ -220,17 +220,17 @@ $ ->
.off 'breakpoint:change' .off 'breakpoint:change'
.on 'breakpoint:change', (e, breakpoint) -> .on 'breakpoint:change', (e, breakpoint) ->
if breakpoint is 'sm' or breakpoint is 'xs' if breakpoint is 'sm' or breakpoint is 'xs'
$gutterIcon = $('aside .gutter-toggle').find('i') $gutterIcon = $('.js-sidebar-toggle').find('i')
if $gutterIcon.hasClass('fa-angle-double-right') if $gutterIcon.hasClass('fa-angle-double-right')
$gutterIcon.closest('a').trigger('click') $gutterIcon.closest('a').trigger('click')
$(document) $(document)
.off 'click', 'aside .gutter-toggle' .off 'click', '.js-sidebar-toggle'
.on 'click', 'aside .gutter-toggle', (e, triggered) -> .on 'click', '.js-sidebar-toggle', (e, triggered) ->
e.preventDefault() e.preventDefault()
$this = $(this) $this = $(this)
$thisIcon = $this.find 'i' $thisIcon = $this.find 'i'
$allGutterToggleIcons = $('.gutter-toggle i') $allGutterToggleIcons = $('.js-sidebar-toggle i')
if $thisIcon.hasClass('fa-angle-double-right') if $thisIcon.hasClass('fa-angle-double-right')
$allGutterToggleIcons $allGutterToggleIcons
.removeClass('fa-angle-double-right') .removeClass('fa-angle-double-right')
......
...@@ -189,7 +189,7 @@ class @MergeRequestTabs ...@@ -189,7 +189,7 @@ class @MergeRequestTabs
$('.container-fluid').removeClass('container-limited') $('.container-fluid').removeClass('container-limited')
shrinkView: -> shrinkView: ->
$gutterIcon = $('.gutter-toggle i') $gutterIcon = $('.js-sidebar-toggle i')
# Wait until listeners are set # Wait until listeners are set
setTimeout( -> setTimeout( ->
...@@ -197,4 +197,3 @@ class @MergeRequestTabs ...@@ -197,4 +197,3 @@ class @MergeRequestTabs
if $gutterIcon.is('.fa-angle-double-right') if $gutterIcon.is('.fa-angle-double-right')
$gutterIcon.closest('a').trigger('click',[true]) $gutterIcon.closest('a').trigger('click',[true])
, 0) , 0)
...@@ -30,6 +30,9 @@ class @Notes ...@@ -30,6 +30,9 @@ class @Notes
$(document).on "ajax:success", ".js-main-target-form", @addNote $(document).on "ajax:success", ".js-main-target-form", @addNote
$(document).on "ajax:success", ".js-discussion-note-form", @addDiscussionNote $(document).on "ajax:success", ".js-discussion-note-form", @addDiscussionNote
# catch note ajax errors
$(document).on "ajax:error", ".js-main-target-form", @addNoteError
# change note in UI after update # change note in UI after update
$(document).on "ajax:success", "form.edit-note", @updateNote $(document).on "ajax:success", "form.edit-note", @updateNote
...@@ -51,6 +54,9 @@ class @Notes ...@@ -51,6 +54,9 @@ class @Notes
$(document).on "ajax:complete", ".js-main-target-form", @reenableTargetFormSubmitButton $(document).on "ajax:complete", ".js-main-target-form", @reenableTargetFormSubmitButton
$(document).on "ajax:success", ".js-main-target-form", @resetMainTargetForm $(document).on "ajax:success", ".js-main-target-form", @resetMainTargetForm
# reset main target form when clicking discard
$(document).on "click", ".js-note-discard", @resetMainTargetForm
# update the file name when an attachment is selected # update the file name when an attachment is selected
$(document).on "change", ".js-note-attachment-input", @updateFormAttachment $(document).on "change", ".js-note-attachment-input", @updateFormAttachment
...@@ -85,6 +91,7 @@ class @Notes ...@@ -85,6 +91,7 @@ class @Notes
$(document).off "keyup", ".js-note-text" $(document).off "keyup", ".js-note-text"
$(document).off "click", ".js-note-target-reopen" $(document).off "click", ".js-note-target-reopen"
$(document).off "click", ".js-note-target-close" $(document).off "click", ".js-note-target-close"
$(document).off "click", ".js-note-discard"
$('.note .js-task-list-container').taskList('disable') $('.note .js-task-list-container').taskList('disable')
$(document).off 'tasklist:changed', '.note .js-task-list-container' $(document).off 'tasklist:changed', '.note .js-task-list-container'
...@@ -219,7 +226,7 @@ class @Notes ...@@ -219,7 +226,7 @@ class @Notes
Resets text and preview. Resets text and preview.
Resets buttons. Resets buttons.
### ###
resetMainTargetForm: -> resetMainTargetForm: (e) =>
form = $(".js-main-target-form") form = $(".js-main-target-form")
# remove validation errors # remove validation errors
...@@ -231,6 +238,8 @@ class @Notes ...@@ -231,6 +238,8 @@ class @Notes
form.find(".js-note-text").data("autosave").reset() form.find(".js-note-text").data("autosave").reset()
@updateTargetButtons(e)
reenableTargetFormSubmitButton: -> reenableTargetFormSubmitButton: ->
form = $(".js-main-target-form") form = $(".js-main-target-form")
...@@ -274,8 +283,10 @@ class @Notes ...@@ -274,8 +283,10 @@ class @Notes
form.removeClass "js-new-note-form" form.removeClass "js-new-note-form"
form.find('.div-dropzone').remove() form.find('.div-dropzone').remove()
# hide discard button
form.find('.js-note-discard').hide()
# setup preview buttons # setup preview buttons
form.find(".js-md-write-button, .js-md-preview-button").tooltip placement: "left"
previewButton = form.find(".js-md-preview-button") previewButton = form.find(".js-md-preview-button")
textarea = form.find(".js-note-text") textarea = form.find(".js-note-text")
...@@ -309,6 +320,10 @@ class @Notes ...@@ -309,6 +320,10 @@ class @Notes
addNote: (xhr, note, status) => addNote: (xhr, note, status) =>
@renderNote(note) @renderNote(note)
addNoteError: (xhr, note, status) =>
flash = new Flash('Your comment could not be submitted! Please check your network connection and try again.', 'alert')
flash.pinTo('.md-area')
### ###
Called in response to the new note form being submitted Called in response to the new note form being submitted
...@@ -469,6 +484,11 @@ class @Notes ...@@ -469,6 +484,11 @@ class @Notes
form.find("#note_line_code").val dataHolder.data("lineCode") form.find("#note_line_code").val dataHolder.data("lineCode")
form.find("#note_noteable_type").val dataHolder.data("noteableType") form.find("#note_noteable_type").val dataHolder.data("noteableType")
form.find("#note_noteable_id").val dataHolder.data("noteableId") form.find("#note_noteable_id").val dataHolder.data("noteableId")
form.find('.js-note-discard')
.show()
.removeClass('js-note-discard')
.addClass('js-close-discussion-note-form')
.text(form.find('.js-close-discussion-note-form').data('cancel-text'))
@setupNoteForm form @setupNoteForm form
form.find(".js-note-text").focus() form.find(".js-note-text").focus()
form.addClass "js-discussion-note-form" form.addClass "js-discussion-note-form"
...@@ -568,21 +588,52 @@ class @Notes ...@@ -568,21 +588,52 @@ class @Notes
updateCloseButton: (e) => updateCloseButton: (e) =>
textarea = $(e.target) textarea = $(e.target)
form = textarea.parents('form') form = textarea.parents('form')
form.find('.js-note-target-close').text('Close') closebtn = form.find('.js-note-target-close')
closebtn.text(closebtn.data('original-text'))
updateTargetButtons: (e) => updateTargetButtons: (e) =>
textarea = $(e.target) textarea = $(e.target)
form = textarea.parents('form') form = textarea.parents('form')
reopenbtn = form.find('.js-note-target-reopen')
closebtn = form.find('.js-note-target-close')
discardbtn = form.find('.js-note-discard')
if textarea.val().trim().length > 0 if textarea.val().trim().length > 0
form.find('.js-note-target-reopen').text('Comment & reopen') reopentext = reopenbtn.data('alternative-text')
form.find('.js-note-target-close').text('Comment & close') closetext = closebtn.data('alternative-text')
form.find('.js-note-target-reopen').addClass('btn-comment-and-reopen')
form.find('.js-note-target-close').addClass('btn-comment-and-close') if reopenbtn.text() isnt reopentext
reopenbtn.text(reopentext)
if closebtn.text() isnt closetext
closebtn.text(closetext)
if reopenbtn.is(':not(.btn-comment-and-reopen)')
reopenbtn.addClass('btn-comment-and-reopen')
if closebtn.is(':not(.btn-comment-and-close)')
closebtn.addClass('btn-comment-and-close')
if discardbtn.is(':hidden')
discardbtn.show()
else else
form.find('.js-note-target-reopen').text('Reopen') reopentext = reopenbtn.data('original-text')
form.find('.js-note-target-close').text('Close') closetext = closebtn.data('original-text')
form.find('.js-note-target-reopen').removeClass('btn-comment-and-reopen')
form.find('.js-note-target-close').removeClass('btn-comment-and-close') if reopenbtn.text() isnt reopentext
reopenbtn.text(reopentext)
if closebtn.text() isnt closetext
closebtn.text(closetext)
if reopenbtn.is(':not(.btn-comment-and-reopen)')
reopenbtn.removeClass('btn-comment-and-reopen')
if closebtn.is(':not(.btn-comment-and-close)')
closebtn.removeClass('btn-comment-and-close')
if discardbtn.is(':visible')
discardbtn.hide()
initTaskList: -> initTaskList: ->
@enableTaskList() @enableTaskList()
......
...@@ -4,12 +4,13 @@ class @Profile ...@@ -4,12 +4,13 @@ class @Profile
$('.js-preferences-form').on 'change.preference', 'input[type=radio]', -> $('.js-preferences-form').on 'change.preference', 'input[type=radio]', ->
$(this).parents('form').submit() $(this).parents('form').submit()
$('.update-username form').on 'ajax:before', -> $('.update-username').on 'ajax:before', ->
$('.loading-gif').show() $('.loading-username').show()
$(this).find('.update-success').hide() $(this).find('.update-success').hide()
$(this).find('.update-failed').hide() $(this).find('.update-failed').hide()
$('.update-username form').on 'ajax:complete', -> $('.update-username').on 'ajax:complete', ->
$('.loading-username').hide()
$(this).find('.btn-save').enable() $(this).find('.btn-save').enable()
$(this).find('.loading-gif').hide() $(this).find('.loading-gif').hide()
......
...@@ -12,11 +12,13 @@ ...@@ -12,11 +12,13 @@
.prepend-top-default { margin-top: $gl-padding !important; } .prepend-top-default { margin-top: $gl-padding !important; }
.prepend-top-20 { margin-top:20px } .prepend-top-20 { margin-top:20px }
.prepend-left-10 { margin-left:10px } .prepend-left-10 { margin-left:10px }
.prepend-left-default { margin-left:$gl-padding } .prepend-left-default { margin-left: $gl-padding; }
.prepend-left-20 { margin-left:20px } .prepend-left-20 { margin-left:20px }
.append-right-5 { margin-right: 5px } .append-right-5 { margin-right: 5px }
.append-right-10 { margin-right:10px } .append-right-10 { margin-right:10px }
.append-right-default { margin-right: $gl-padding; }
.append-right-20 { margin-right:20px } .append-right-20 { margin-right:20px }
.append-bottom-0 { margin-bottom:0 }
.append-bottom-10 { margin-bottom:10px } .append-bottom-10 { margin-bottom:10px }
.append-bottom-15 { margin-bottom:15px } .append-bottom-15 { margin-bottom:15px }
.append-bottom-20 { margin-bottom:20px } .append-bottom-20 { margin-bottom:20px }
......
...@@ -34,13 +34,15 @@ $error-exclamation-point: #E62958; ...@@ -34,13 +34,15 @@ $error-exclamation-point: #E62958;
$border-radius-default: 3px; $border-radius-default: 3px;
$list-title-color: #333333; $list-title-color: #333333;
$list-text-color: #555555; $list-text-color: #555555;
$profile-settings-link-color: $md-link-color;
$btn-transparent-color: #8F8F8F; $btn-transparent-color: #8F8F8F;
$ssh-key-icon-color: #8F8F8F; $ssh-key-icon-color: #8F8F8F;
$ssh-key-icon-size: 18px; $ssh-key-icon-size: 18px;
$provider-btn-group-border: #E5E5E5;
$provider-btn-not-active-color: #4688F1;
/* /*
* Color schema * Color schema
*/ */
...@@ -70,7 +72,7 @@ $orange-light: rgba(252, 109, 38, 0.80); ...@@ -70,7 +72,7 @@ $orange-light: rgba(252, 109, 38, 0.80);
$orange-normal: #E75E40; $orange-normal: #E75E40;
$orange-dark: #CE5237; $orange-dark: #CE5237;
$red-light: #F43263; $red-light: #F06559;
$red-normal: #E52C5A; $red-normal: #E52C5A;
$red-dark: #D22852; $red-dark: #D22852;
...@@ -94,7 +96,7 @@ $border-orange-light: #fc6d26; ...@@ -94,7 +96,7 @@ $border-orange-light: #fc6d26;
$border-orange-normal: #CE5237; $border-orange-normal: #CE5237;
$border-orange-dark: #C14E35; $border-orange-dark: #C14E35;
$border-red-light: #E52C5A; $border-red-light: #F24F41;
$border-red-normal: #D22852; $border-red-normal: #D22852;
$border-red-dark: #CA264F; $border-red-dark: #CA264F;
......
.account-page { .profile-avatar-form-option {
fieldset { hr {
margin-bottom: 15px; margin: 10px 0;
padding-bottom: 15px;
} }
} }
...@@ -20,7 +19,7 @@ ...@@ -20,7 +19,7 @@
.account-btn-link, .account-btn-link,
.profile-settings-sidebar a { .profile-settings-sidebar a {
color: $profile-settings-link-color; color: $md-link-color;
} }
.oauth-buttons { .oauth-buttons {
...@@ -172,6 +171,47 @@ ...@@ -172,6 +171,47 @@
.profile-settings-content { .profile-settings-content {
a { a {
color: $profile-settings-link-color; color: $md-link-color;
}
}
.change-username-title {
color: $gl-warning;
}
.remove-account-title {
color: $gl-danger;
}
.provider-btn-group {
display: inline-block;
margin-right: 10px;
border: 1px solid $provider-btn-group-border;
border-radius: 3px;
&:last-child {
margin-right: 0;
}
}
.provider-btn-image {
display: inline-block;
padding: 5px 10px;
border-right: 1px solid $provider-btn-group-border;
> img {
width: 20px;
}
}
.provider-btn {
display: inline-block;
padding: 5px 10px;
margin-left: -3px;
line-height: 22px;
background-color: $gray-light;
&.not-active {
color: $provider-btn-not-active-color;
} }
} }
...@@ -5,109 +5,107 @@ ...@@ -5,109 +5,107 @@
.alert.alert-info .alert.alert-info
Some options are unavailable for LDAP accounts Some options are unavailable for LDAP accounts
.account-page.prepend-top-default .row.prepend-top-default
.panel.panel-default.update-token .col-lg-3.profile-settings-sidebar
.panel-heading %h4.prepend-top-0
Reset Private token Private Token
.panel-body
= form_for @user, url: reset_private_token_profile_path, method: :put do |f|
.data
%p %p
Your private token is used to access application resources without authentication. Your private token is used to access application resources without authentication.
%br .col-lg-9
It can be used for atom feeds or the API. = form_for @user, url: reset_private_token_profile_path, method: :put, html: {class: "private-token"} do |f|
%span.cred
Keep it secret!
%p.cgray %p.cgray
- if current_user.private_token - if current_user.private_token
= label_tag "token", "Private token", class: "label-light"
= text_field_tag "token", current_user.private_token, class: "form-control" = text_field_tag "token", current_user.private_token, class: "form-control"
- else - else
%span You don`t have one yet. Click generate to fix it. %span You don`t have one yet. Click generate to fix it.
%p.help-block
.form-actions It can be used for atom feeds or the API. Keep it secret!
.prepend-top-default
- if current_user.private_token - if current_user.private_token
= f.submit 'Reset private token', data: { confirm: "Are you sure?" }, class: "btn btn-default" = f.submit 'Reset private token', data: { confirm: "Are you sure?" }, class: "btn btn-default"
- else - else
= f.submit 'Generate', class: "btn btn-default" = f.submit 'Generate', class: "btn btn-default"
%hr
.panel.panel-default .row.prepend-top-default
.panel-heading .col-lg-3.profile-settings-sidebar
%h4.prepend-top-0
Two-factor Authentication Two-factor Authentication
.panel-body
- if current_user.two_factor_enabled?
.pull-right
= link_to 'Disable Two-factor Authentication', profile_two_factor_auth_path, method: :delete, class: 'btn btn-close btn-sm',
data: { confirm: 'Are you sure?' }
%p.text-success
%strong
Two-factor Authentication is enabled
%p
If you lose your recovery codes you can
%strong
= succeed ',' do
= link_to 'generate new ones', codes_profile_two_factor_auth_path, method: :post, data: { confirm: 'Are you sure?' }
invalidating all previous codes.
- else
%p %p
Increase your account's security by enabling two-factor authentication (2FA). Increase your account's security by enabling two-factor authentication (2FA).
.col-lg-9
%p %p
Each time you log in you’ll be required to provide your username and Status: #{current_user.two_factor_enabled? ? 'enabled' : 'disabled'}
password as usual, plus a randomly-generated code from your phone. - if !current_user.two_factor_enabled?
%p
.form-actions Download the Google Authenticator application from App Store for iOS or Google Play for Android and scan this code.
= link_to 'Enable Two-factor Authentication', new_profile_two_factor_auth_path, class: 'btn btn-success' More information is available in the #{link_to('documentation', help_page_path('profile', 'two_factor_authentication'))}.
.append-bottom-10
- if button_based_providers.any? = link_to 'Enable two-factor authentication', new_profile_two_factor_auth_path, class: 'btn btn-success'
.panel.panel-default - else
.panel-heading = link_to 'Disable Two-factor Authentication', profile_two_factor_auth_path, method: :delete, class: 'btn btn-danger',
data: { confirm: 'Are you sure?' }
%hr
- if button_based_providers.any?
.row.prepend-top-default
.col-lg-3.profile-settings-sidebar
%h4.prepend-top-0
Social sign-in
%p
Activate signin with one of the following services
.col-lg-9
%label.label-light
Connected Accounts Connected Accounts
.panel-body
.oauth-buttons.append-bottom-10
%p Click on icon to activate signin with one of the following services %p Click on icon to activate signin with one of the following services
- button_based_providers.each do |provider| - button_based_providers.each do |provider|
.btn-group .provider-btn-group
= link_to provider_image_tag(provider), user_omniauth_authorize_path(provider), method: :post, class: "btn btn-lg #{'active' if auth_active?(provider)}", "data-no-turbolink" => "true" .provider-btn-image
= provider_image_tag(provider)
- if auth_active?(provider) - if auth_active?(provider)
= link_to unlink_profile_account_path(provider: provider), method: :delete, class: 'btn btn-lg' do = link_to unlink_profile_account_path(provider: provider), method: :delete, class: 'provider-btn' do
= icon('close') Disconnect
- else
- if current_user.can_change_username? = link_to user_omniauth_authorize_path(provider), method: :post, class: "provider-btn #{'not-active' if !auth_active?(provider)}", "data-no-turbolink" => "true" do
.panel.panel-warning.update-username Connect
.panel-heading %hr
Change Username - if current_user.can_change_username?
.panel-body .row.prepend-top-default
= form_for @user, url: update_username_profile_path, method: :put, remote: true do |f| .col-lg-3.profile-settings-sidebar
%h4.prepend-top-0.change-username-title
Change username
%p %p
Changing your username will change path to all personal projects! Changing your username will change path to all personal projects!
%div .col-lg-9
= form_for @user, url: update_username_profile_path, method: :put, remote: true, html: {class: "update-username"} do |f|
.form-group
= f.label :username, "Path", class: "label-light"
.input-group .input-group
.input-group-addon .input-group-addon
= "#{root_url}u/" = "#{root_url}u/"
= f.text_field :username, required: true, class: 'form-control' = f.text_field :username, required: true, class: 'form-control'
  .help-block
.loading-gif.hide Current path:
%p = "#{root_url}u/#{current_user.username}"
= icon('spinner spin') .prepend-top-default
Saving new username = f.button class: "btn btn-warning", type: "submit" do
.form-actions = icon "spinner spin", class: "hidden loading-username"
= f.submit 'Save username', class: "btn btn-warning" Update username
%hr
- if signup_enabled? - if signup_enabled?
.panel.panel-danger.remove-account .row.prepend-top-default
.panel-heading .col-lg-3.profile-settings-sidebar
%h4.prepend-top-0.remove-account-title
Remove account Remove account
.panel-body .col-lg-9
- if @user.can_be_removed? - if @user.can_be_removed?
%p Deleting an account has the following effects: %p
Deleting an account has the following effects:
%ul %ul
%li All user content like authored issues, snippets, comments will be removed %li All user content like authored issues, snippets, comments will be removed
- rp = current_user.personal_projects.count - rp = current_user.personal_projects.count
- unless rp.zero? - unless rp.zero?
%li #{pluralize rp, 'personal project'} will be removed and cannot be restored %li #{pluralize rp, 'personal project'} will be removed and cannot be restored
.form-actions
= link_to 'Delete account', user_registration_path, data: { confirm: "REMOVE #{current_user.name}? Are you sure?" }, method: :delete, class: "btn btn-remove" = link_to 'Delete account', user_registration_path, data: { confirm: "REMOVE #{current_user.name}? Are you sure?" }, method: :delete, class: "btn btn-remove"
- else - else
- if @user.solo_owned_groups.present? - if @user.solo_owned_groups.present?
...@@ -116,3 +114,4 @@ ...@@ -116,3 +114,4 @@
%strong #{@user.solo_owned_groups.map(&:name).join(', ')} %strong #{@user.solo_owned_groups.map(&:name).join(', ')}
%p %p
You must transfer ownership or delete these groups before you can delete your account. You must transfer ownership or delete these groups before you can delete your account.
.append-bottom-default
- page_title 'Two-factor Authentication', 'Account' - page_title 'Two-factor Authentication', 'Account'
%h2.page-title Two-factor Authentication (2FA) .row.prepend-top-default
%p .col-lg-3
Download the Google Authenticator application from App Store for iOS or Google %h4.prepend-top-0
Play for Android and scan this code. Two-factor Authentication (2FA)
%p
Increase your account's security by enabling two-factor authentication (2FA).
.col-lg-9
%p
Status: #{current_user.two_factor_enabled? ? 'enabled' : 'disabled'}
%p
Download the Google Authenticator application from App Store for iOS or Google Play for Android and scan this code.
More information is available in the #{link_to('documentation', help_page_path('profile', 'two_factor_authentication'))}. More information is available in the #{link_to('documentation', help_page_path('profile', 'two_factor_authentication'))}.
.row.append-bottom-10
%hr .col-md-3
= raw @qr_code
= form_tag profile_two_factor_auth_path, method: :post, class: 'form-horizontal two-factor-new' do |f| .col-md-9
.account-well
%p.prepend-top-0.append-bottom-0
Can't scan the code?
%p.prepend-top-0.append-bottom-0
To add the entry manually, provide the following details to the application on your phone.
%p.prepend-top-0.append-bottom-0
Account:
= current_user.email
%p.prepend-top-0.append-bottom-0
Key:
= current_user.otp_secret.scan(/.{4}/).join(' ')
%p.two-factor-new-manual-content
Time based: Yes
= form_tag profile_two_factor_auth_path, method: :post do |f|
- if @error - if @error
.alert.alert-danger .alert.alert-danger
= @error = @error
.form-group .form-group
.col-lg-2.col-lg-offset-2 = label_tag :pin_code, nil, class: "label-light"
= raw @qr_code = text_field_tag :pin_code, nil, class: "form-control", required: true
.col-lg-7.col-lg-offset-1.manual-instructions .prepend-top-default
%h3 Can't scan the code? = submit_tag 'Enable two-factor authentication', class: 'btn btn-success'
%p
To add the entry manually, provide the following details to the
application on your phone.
%dl
%dt Account
%dd= current_user.email
%dl
%dt Key
%dd= current_user.otp_secret.scan(/.{4}/).join(' ')
%dl
%dt Time based
%dd Yes
.form-group
= label_tag :pin_code, nil, class: "control-label"
.col-lg-10
= text_field_tag :pin_code, nil, class: "form-control", required: true, autofocus: true
.form-actions
= submit_tag 'Submit', class: 'btn btn-success'
= link_to 'Configure it later', skip_profile_two_factor_auth_path, :method => :patch, class: 'btn btn-cancel' if two_factor_skippable? = link_to 'Configure it later', skip_profile_two_factor_auth_path, :method => :patch, class: 'btn btn-cancel' if two_factor_skippable?
- content_for :note_actions do - content_for :note_actions do
- if can?(current_user, :update_issue, @issue) - if can?(current_user, :update_issue, @issue)
= link_to 'Reopen issue', issue_path(@issue, issue: {state_event: :reopen}, status_only: true, format: 'json'), data: {no_turbolink: true}, class: "btn btn-nr btn-grouped btn-reopen btn-comment js-note-target-reopen #{issue_button_visibility(@issue, false)}", title: 'Reopen issue' = link_to 'Reopen issue', issue_path(@issue, issue: {state_event: :reopen}, status_only: true, format: 'json'), data: {no_turbolink: true, original_text: "Reopen issue", alternative_text: "Comment & reopen issue"}, class: "btn btn-nr btn-grouped btn-reopen btn-comment js-note-target-reopen #{issue_button_visibility(@issue, false)}", title: 'Reopen issue'
= link_to 'Close issue', issue_path(@issue, issue: {state_event: :close}, status_only: true, format: 'json'), data: {no_turbolink: true}, class: "btn btn-nr btn-grouped btn-close btn-comment js-note-target-close #{issue_button_visibility(@issue, true)}", title: 'Close issue' = link_to 'Close issue', issue_path(@issue, issue: {state_event: :close}, status_only: true, format: 'json'), data: {no_turbolink: true, original_text: "Close issue", alternative_text: "Comment & close issue"}, class: "btn btn-nr btn-grouped btn-close btn-comment js-note-target-close #{issue_button_visibility(@issue, true)}", title: 'Close issue'
#notes #notes
= render 'projects/notes/notes_with_form' = render 'projects/notes/notes_with_form'
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
%span.hidden-sm.hidden-md.hidden-lg %span.hidden-sm.hidden-md.hidden-lg
= icon('circle-o') = icon('circle-o')
%a.btn.btn-default.pull-right.hidden-sm.hidden-md.hidden-lg.gutter-toggle{ href: "#" } %a.btn.btn-default.pull-right.visible-xs-block.gutter-toggle.js-sidebar-toggle{ href: "#" }
= icon('angle-double-left') = icon('angle-double-left')
.issue-meta .issue-meta
......
- content_for :note_actions do - content_for :note_actions do
- if can?(current_user, :update_merge_request, @merge_request) - if can?(current_user, :update_merge_request, @merge_request)
- if @merge_request.open? - if @merge_request.open?
= link_to 'Close', merge_request_path(@merge_request, merge_request: {state_event: :close }), method: :put, class: "btn btn-nr btn-comment btn-grouped btn-close close-mr-link js-note-target-close", title: "Close merge request" = link_to 'Close merge request', merge_request_path(@merge_request, merge_request: {state_event: :close }), method: :put, class: "btn btn-nr btn-comment btn-grouped btn-close close-mr-link js-note-target-close", title: "Close merge request", data: {original_text: "Close merge request", alternative_text: "Comment & close merge request"}
- if @merge_request.closed? - if @merge_request.closed?
= link_to 'Reopen', merge_request_path(@merge_request, merge_request: {state_event: :reopen }), method: :put, class: "btn btn-nr btn-comment btn-grouped btn-reopen reopen-mr-link js-note-target-reopen", title: "Reopen merge request" = link_to 'Reopen merge request', merge_request_path(@merge_request, merge_request: {state_event: :reopen }), method: :put, class: "btn btn-nr btn-comment btn-grouped btn-reopen reopen-mr-link js-note-target-reopen", title: "Reopen merge request", data: {original_text: "Reopen merge request", alternative_text: "Comment & reopen merge request"}
#notes= render "projects/notes/notes_with_form" #notes= render "projects/notes/notes_with_form"
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
= @merge_request.state_human_name = @merge_request.state_human_name
%span.hidden-sm.hidden-md.hidden-lg %span.hidden-sm.hidden-md.hidden-lg
= icon(@merge_request.state_icon_name) = icon(@merge_request.state_icon_name)
%a.btn.btn-default.pull-right.hidden-sm.hidden-md.hidden-lg.gutter-toggle{ href: "#" } %a.btn.btn-default.pull-right.visible-xs-block.gutter-toggle.js-sidebar-toggle{ href: "#" }
= icon('angle-double-left') = icon('angle-double-left')
.issue-meta .issue-meta
%strong.identifier %strong.identifier
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
.error-alert .error-alert
.note-form-actions.clearfix .note-form-actions.clearfix
= f.submit 'Add Comment', class: "btn btn-nr btn-create comment-btn btn-grouped js-comment-button" = f.submit 'Comment', class: "btn btn-nr btn-create comment-btn btn-grouped js-comment-button"
= yield(:note_actions) = yield(:note_actions)
%a.btn.btn-nr.btn-cancel.js-close-discussion-note-form Cancel %a.btn.btn-cancel.js-note-discard{role: "button", data: {cancel_text: "Cancel"}}
Discard draft
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
of of
= issuables_count(issuable) = issuables_count(issuable)
%span.pull-right %span.pull-right
%a.gutter-toggle{href: '#'} %a.gutter-toggle.js-sidebar-toggle{href: '#'}
= sidebar_gutter_toggle_icon = sidebar_gutter_toggle_icon
.issuable-nav.hide-collapsed.pull-right.btn-group{role: 'group', "aria-label" => '...'} .issuable-nav.hide-collapsed.pull-right.btn-group{role: 'group', "aria-label" => '...'}
- if prev_issuable = prev_issuable_for(issuable) - if prev_issuable = prev_issuable_for(issuable)
......
...@@ -99,9 +99,9 @@ class Spinach::Features::Profile < Spinach::FeatureSteps ...@@ -99,9 +99,9 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end end
step 'I reset my token' do step 'I reset my token' do
page.within '.update-token' do page.within '.private-token' do
@old_token = @user.private_token @old_token = @user.private_token
click_button "Reset" click_button "Reset private token"
end end
end end
......
...@@ -79,7 +79,7 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps ...@@ -79,7 +79,7 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps
step 'I leave comment with a single emoji' do step 'I leave comment with a single emoji' do
page.within('.js-main-target-form') do page.within('.js-main-target-form') do
fill_in 'note[note]', with: ':smile:' fill_in 'note[note]', with: ':smile:'
click_button 'Add Comment' click_button 'Comment'
end end
end end
......
...@@ -268,7 +268,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps ...@@ -268,7 +268,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
step 'I leave a comment with code block' do step 'I leave a comment with code block' do
page.within(".js-main-target-form") do page.within(".js-main-target-form") do
fill_in "note[note]", with: "```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```" fill_in "note[note]", with: "```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```"
click_button "Add Comment" click_button "Comment"
sleep 0.05 sleep 0.05
end end
end end
......
...@@ -419,7 +419,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -419,7 +419,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
page.within(".js-discussion-note-form") do page.within(".js-discussion-note-form") do
fill_in "note_note", with: "Line is correct" fill_in "note_note", with: "Line is correct"
click_button "Add Comment" click_button "Comment"
end end
page.within ".files [id^=diff]:nth-child(2) .note-body > .note-text" do page.within ".files [id^=diff]:nth-child(2) .note-body > .note-text" do
...@@ -432,7 +432,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -432,7 +432,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
page.within(".js-discussion-note-form") do page.within(".js-discussion-note-form") do
fill_in "note_note", with: "Line is wrong on here" fill_in "note_note", with: "Line is wrong on here"
click_button "Add Comment" click_button "Comment"
end end
end end
...@@ -528,7 +528,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -528,7 +528,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
def leave_comment(message) def leave_comment(message)
page.within(".js-discussion-note-form", visible: true) do page.within(".js-discussion-note-form", visible: true) do
fill_in "note_note", with: message fill_in "note_note", with: message
click_button "Add Comment" click_button "Comment"
end end
page.within(".notes_holder", visible: true) do page.within(".notes_holder", visible: true) do
expect(page).to have_content message expect(page).to have_content message
......
...@@ -77,7 +77,7 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps ...@@ -77,7 +77,7 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps
step 'I leave a comment like "Good snippet!"' do step 'I leave a comment like "Good snippet!"' do
page.within('.js-main-target-form') do page.within('.js-main-target-form') do
fill_in "note_note", with: "Good snippet!" fill_in "note_note", with: "Good snippet!"
click_button "Add Comment" click_button "Comment"
end end
end end
......
...@@ -361,7 +361,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps ...@@ -361,7 +361,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end end
step 'I can see the new rendered SVG image' do step 'I can see the new rendered SVG image' do
expect(find('.file-content')).to have_css('img') expect(page).to have_css('.file-content img')
end end
private private
......
...@@ -93,14 +93,14 @@ module SharedDiffNote ...@@ -93,14 +93,14 @@ module SharedDiffNote
page.within("form[id$='#{sample_commit.line_code}']") do page.within("form[id$='#{sample_commit.line_code}']") do
fill_in 'note[note]', with: ':smile:' fill_in 'note[note]', with: ':smile:'
click_button('Add Comment') click_button('Comment')
end end
end end
end end
step 'I submit the diff comment' do step 'I submit the diff comment' do
page.within(diff_file_selector) do page.within(diff_file_selector) do
click_button("Add Comment") click_button("Comment")
end end
end end
......
...@@ -182,7 +182,7 @@ module SharedIssuable ...@@ -182,7 +182,7 @@ module SharedIssuable
page.within('.js-main-target-form') do page.within('.js-main-target-form') do
fill_in 'note[note]', with: "##{issuable.to_reference(project)}" fill_in 'note[note]', with: "##{issuable.to_reference(project)}"
click_button 'Add Comment' click_button 'Comment'
end end
end end
......
...@@ -17,7 +17,7 @@ module SharedNote ...@@ -17,7 +17,7 @@ module SharedNote
step 'I leave a comment like "XML attached"' do step 'I leave a comment like "XML attached"' do
page.within(".js-main-target-form") do page.within(".js-main-target-form") do
fill_in "note[note]", with: "XML attached" fill_in "note[note]", with: "XML attached"
click_button "Add Comment" click_button "Comment"
end end
end end
...@@ -30,7 +30,7 @@ module SharedNote ...@@ -30,7 +30,7 @@ module SharedNote
step 'I submit the comment' do step 'I submit the comment' do
page.within(".js-main-target-form") do page.within(".js-main-target-form") do
click_button "Add Comment" click_button "Comment"
end end
end end
...@@ -115,7 +115,7 @@ module SharedNote ...@@ -115,7 +115,7 @@ module SharedNote
step 'I leave a comment with a header containing "Comment with a header"' do step 'I leave a comment with a header containing "Comment with a header"' do
page.within(".js-main-target-form") do page.within(".js-main-target-form") do
fill_in "note[note]", with: "# Comment with a header" fill_in "note[note]", with: "# Comment with a header"
click_button "Add Comment" click_button "Comment"
sleep 0.05 sleep 0.05
end end
end end
......
...@@ -12,7 +12,7 @@ module Ci ...@@ -12,7 +12,7 @@ module Ci
attr_reader :before_script, :image, :services, :variables, :path, :cache attr_reader :before_script, :image, :services, :variables, :path, :cache
def initialize(config, path = nil) def initialize(config, path = nil)
@config = YAML.safe_load(config, [Symbol]) @config = YAML.safe_load(config, [Symbol], [], true)
@path = path @path = path
unless @config.is_a? Hash unless @config.is_a? Hash
......
...@@ -22,7 +22,7 @@ describe 'Comments', feature: true do ...@@ -22,7 +22,7 @@ describe 'Comments', feature: true do
it 'should be valid' do it 'should be valid' do
is_expected.to have_css('.js-main-target-form', visible: true, count: 1) is_expected.to have_css('.js-main-target-form', visible: true, count: 1)
expect(find('.js-main-target-form input[type=submit]').value). expect(find('.js-main-target-form input[type=submit]').value).
to eq('Add Comment') to eq('Comment')
page.within('.js-main-target-form') do page.within('.js-main-target-form') do
expect(page).not_to have_link('Cancel') expect(page).not_to have_link('Cancel')
end end
...@@ -49,7 +49,7 @@ describe 'Comments', feature: true do ...@@ -49,7 +49,7 @@ describe 'Comments', feature: true do
page.within('.js-main-target-form') do page.within('.js-main-target-form') do
fill_in 'note[note]', with: 'This is awsome!' fill_in 'note[note]', with: 'This is awsome!'
find('.js-md-preview-button').click find('.js-md-preview-button').click
click_button 'Add Comment' click_button 'Comment'
end end
end end
...@@ -202,7 +202,7 @@ describe 'Comments', feature: true do ...@@ -202,7 +202,7 @@ describe 'Comments', feature: true do
before do before do
page.within("tr[id='#{line_code_2}'] + .js-temp-notes-holder") do page.within("tr[id='#{line_code_2}'] + .js-temp-notes-holder") do
fill_in 'note[note]', with: 'Another comment on line 10' fill_in 'note[note]', with: 'Another comment on line 10'
click_button('Add Comment') click_button('Comment')
end end
end end
......
...@@ -495,6 +495,45 @@ module Ci ...@@ -495,6 +495,45 @@ module Ci
end end
end end
describe "YAML Alias/Anchor" do
it "is correctly supported for jobs" do
config = <<EOT
job1: &JOBTMPL
script: execute-script-for-job
job2: *JOBTMPL
EOT
config_processor = GitlabCiYamlProcessor.new(config)
expect(config_processor.builds_for_stage_and_ref("test", "master").size).to eq(2)
expect(config_processor.builds_for_stage_and_ref("test", "master").first).to eq({
except: nil,
stage: "test",
stage_idx: 1,
name: :job1,
only: nil,
commands: "\nexecute-script-for-job",
tag_list: [],
options: {},
when: "on_success",
allow_failure: false
})
expect(config_processor.builds_for_stage_and_ref("test", "master").second).to eq({
except: nil,
stage: "test",
stage_idx: 1,
name: :job2,
only: nil,
commands: "\nexecute-script-for-job",
tag_list: [],
options: {},
when: "on_success",
allow_failure: false
})
end
end
describe "Error handling" do describe "Error handling" do
it "fails to parse YAML" do it "fails to parse YAML" do
expect{GitlabCiYamlProcessor.new("invalid: yaml: test")}.to raise_error(Psych::SyntaxError) expect{GitlabCiYamlProcessor.new("invalid: yaml: test")}.to raise_error(Psych::SyntaxError)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment