Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
0a35f372
Commit
0a35f372
authored
Jan 04, 2018
by
Jose Ivan Vargas
Committed by
Tim Zallmann
Jan 04, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added multi editor setting on the profile preferences page
parent
54bbcc3d
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
86 additions
and
2 deletions
+86
-2
app/assets/images/multi-editor-off.png
app/assets/images/multi-editor-off.png
+0
-0
app/assets/images/multi-editor-on.png
app/assets/images/multi-editor-on.png
+0
-0
app/assets/javascripts/profile/profile.js
app/assets/javascripts/profile/profile.js
+21
-0
app/assets/stylesheets/framework/header.scss
app/assets/stylesheets/framework/header.scss
+1
-1
app/assets/stylesheets/framework/variables.scss
app/assets/stylesheets/framework/variables.scss
+5
-0
app/assets/stylesheets/pages/profiles/preferences.scss
app/assets/stylesheets/pages/profiles/preferences.scss
+16
-0
app/views/layouts/header/_default.html.haml
app/views/layouts/header/_default.html.haml
+2
-0
app/views/profiles/preferences/show.html.haml
app/views/profiles/preferences/show.html.haml
+17
-0
changelogs/unreleased/jivl-activate-repo-cookie-preferences.yml
...logs/unreleased/jivl-activate-repo-cookie-preferences.yml
+5
-0
spec/features/profiles/user_visits_profile_preferences_page_spec.rb
...res/profiles/user_visits_profile_preferences_page_spec.rb
+12
-0
spec/features/projects/user_edits_files_spec.rb
spec/features/projects/user_edits_files_spec.rb
+3
-1
spec/support/cookie_helper.rb
spec/support/cookie_helper.rb
+4
-0
No files found.
app/assets/images/multi-editor-off.png
0 → 100644
View file @
0a35f372
4.77 KB
app/assets/images/multi-editor-on.png
0 → 100644
View file @
0a35f372
5.34 KB
app/assets/javascripts/profile/profile.js
View file @
0a35f372
/* eslint-disable comma-dangle, no-unused-vars, class-methods-use-this, quotes, consistent-return, func-names, prefer-arrow-callback, space-before-function-paren, max-len */
/* eslint-disable comma-dangle, no-unused-vars, class-methods-use-this, quotes, consistent-return, func-names, prefer-arrow-callback, space-before-function-paren, max-len */
import
Cookies
from
'
js-cookie
'
;
import
Flash
from
'
../flash
'
;
import
Flash
from
'
../flash
'
;
import
{
getPagePath
}
from
'
../lib/utils/common_utils
'
;
import
{
getPagePath
}
from
'
../lib/utils/common_utils
'
;
...
@@ -7,6 +8,8 @@ import { getPagePath } from '../lib/utils/common_utils';
...
@@ -7,6 +8,8 @@ import { getPagePath } from '../lib/utils/common_utils';
constructor
({
form
}
=
{})
{
constructor
({
form
}
=
{})
{
this
.
onSubmitForm
=
this
.
onSubmitForm
.
bind
(
this
);
this
.
onSubmitForm
=
this
.
onSubmitForm
.
bind
(
this
);
this
.
form
=
form
||
$
(
'
.edit-user
'
);
this
.
form
=
form
||
$
(
'
.edit-user
'
);
this
.
newRepoActivated
=
Cookies
.
get
(
'
new_repo
'
);
this
.
setRepoRadio
();
this
.
bindEvents
();
this
.
bindEvents
();
this
.
initAvatarGlCrop
();
this
.
initAvatarGlCrop
();
}
}
...
@@ -25,6 +28,7 @@ import { getPagePath } from '../lib/utils/common_utils';
...
@@ -25,6 +28,7 @@ import { getPagePath } from '../lib/utils/common_utils';
bindEvents
()
{
bindEvents
()
{
$
(
'
.js-preferences-form
'
).
on
(
'
change.preference
'
,
'
input[type=radio]
'
,
this
.
submitForm
);
$
(
'
.js-preferences-form
'
).
on
(
'
change.preference
'
,
'
input[type=radio]
'
,
this
.
submitForm
);
$
(
'
input[name="user[multi_file]"]
'
).
on
(
'
change
'
,
this
.
setNewRepoCookie
);
$
(
'
#user_notification_email
'
).
on
(
'
change
'
,
this
.
submitForm
);
$
(
'
#user_notification_email
'
).
on
(
'
change
'
,
this
.
submitForm
);
$
(
'
#user_notified_of_own_activity
'
).
on
(
'
change
'
,
this
.
submitForm
);
$
(
'
#user_notified_of_own_activity
'
).
on
(
'
change
'
,
this
.
submitForm
);
$
(
'
.update-username
'
).
on
(
'
ajax:before
'
,
this
.
beforeUpdateUsername
);
$
(
'
.update-username
'
).
on
(
'
ajax:before
'
,
this
.
beforeUpdateUsername
);
...
@@ -82,6 +86,23 @@ import { getPagePath } from '../lib/utils/common_utils';
...
@@ -82,6 +86,23 @@ import { getPagePath } from '../lib/utils/common_utils';
}
}
});
});
}
}
setNewRepoCookie
()
{
if
(
this
.
value
===
'
off
'
)
{
Cookies
.
remove
(
'
new_repo
'
);
}
else
{
Cookies
.
set
(
'
new_repo
'
,
true
,
{
expires_in
:
365
});
}
}
setRepoRadio
()
{
const
multiEditRadios
=
$
(
'
input[name="user[multi_file]"]
'
);
if
(
this
.
newRepoActivated
||
this
.
newRepoActivated
===
'
true
'
)
{
multiEditRadios
.
filter
(
'
[value=on]
'
).
prop
(
'
checked
'
,
true
);
}
else
{
multiEditRadios
.
filter
(
'
[value=off]
'
).
prop
(
'
checked
'
,
true
);
}
}
}
}
$
(
function
()
{
$
(
function
()
{
...
...
app/assets/stylesheets/framework/header.scss
View file @
0a35f372
...
@@ -516,7 +516,7 @@
...
@@ -516,7 +516,7 @@
.header-user
{
.header-user
{
.dropdown-menu-nav
{
.dropdown-menu-nav
{
width
:
auto
;
width
:
auto
;
min-width
:
1
4
0px
;
min-width
:
1
6
0px
;
margin-top
:
4px
;
margin-top
:
4px
;
color
:
$gl-text-color
;
color
:
$gl-text-color
;
left
:
auto
;
left
:
auto
;
...
...
app/assets/stylesheets/framework/variables.scss
View file @
0a35f372
...
@@ -727,3 +727,8 @@ Popup
...
@@ -727,3 +727,8 @@ Popup
$popup-triangle-size
:
15px
;
$popup-triangle-size
:
15px
;
$popup-triangle-border-size
:
1px
;
$popup-triangle-border-size
:
1px
;
$popup-box-shadow-color
:
rgba
(
90
,
90
,
90
,
0
.05
);
$popup-box-shadow-color
:
rgba
(
90
,
90
,
90
,
0
.05
);
/*
Multi file editor
*/
$border-color-settings
:
#e1e1e1
;
app/assets/stylesheets/pages/profiles/preferences.scss
View file @
0a35f372
...
@@ -20,6 +20,22 @@
...
@@ -20,6 +20,22 @@
}
}
}
}
.multi-file-editor-options
{
label
{
margin-right
:
20px
;
text-align
:
center
;
}
.preview
{
font-size
:
0
;
img
{
border
:
1px
solid
$border-color-settings
;
border-radius
:
4px
;
}
}
}
.application-theme
{
.application-theme
{
label
{
label
{
margin-right
:
20px
;
margin-right
:
20px
;
...
...
app/views/layouts/header/_default.html.haml
View file @
0a35f372
...
@@ -56,6 +56,8 @@
...
@@ -56,6 +56,8 @@
=
link_to
"Profile"
,
current_user
,
class:
'profile-link'
,
data:
{
user:
current_user
.
username
}
=
link_to
"Profile"
,
current_user
,
class:
'profile-link'
,
data:
{
user:
current_user
.
username
}
%li
%li
=
link_to
"Settings"
,
profile_path
=
link_to
"Settings"
,
profile_path
%li
=
link_to
"Turn on multi edit"
,
profile_preferences_path
-
if
current_user
-
if
current_user
%li
%li
=
link_to
"Help"
,
help_path
=
link_to
"Help"
,
help_path
...
...
app/views/profiles/preferences/show.html.haml
View file @
0a35f372
...
@@ -3,6 +3,23 @@
...
@@ -3,6 +3,23 @@
=
render
'profiles/head'
=
render
'profiles/head'
=
form_for
@user
,
url:
profile_preferences_path
,
remote:
true
,
method: :put
,
html:
{
class:
'row prepend-top-default js-preferences-form'
}
do
|
f
|
=
form_for
@user
,
url:
profile_preferences_path
,
remote:
true
,
method: :put
,
html:
{
class:
'row prepend-top-default js-preferences-form'
}
do
|
f
|
.col-lg-4
%h4
.prepend-top-0
GitLab multi file editor
%p
Unlock an additional editing experience which makes it possible to edit and commit multiple files
.col-lg-8.multi-file-editor-options
=
label_tag
do
.preview.append-bottom-10
=
image_tag
"multi-editor-off.png"
=
f
.
radio_button
:multi_file
,
"off"
,
checked:
true
Off
=
label_tag
do
.preview.append-bottom-10
=
image_tag
"multi-editor-on.png"
=
f
.
radio_button
:multi_file
,
"on"
,
checked:
false
On
.col-sm-12
%hr
.col-lg-4.application-theme
.col-lg-4.application-theme
%h4
.prepend-top-0
%h4
.prepend-top-0
GitLab navigation theme
GitLab navigation theme
...
...
changelogs/unreleased/jivl-activate-repo-cookie-preferences.yml
0 → 100644
View file @
0a35f372
---
title
:
Added option to user preferences to enable the multi file editor
merge_request
:
16056
author
:
type
:
added
spec/features/profiles/user_visits_profile_preferences_page_spec.rb
View file @
0a35f372
...
@@ -32,6 +32,18 @@ describe 'User visits the profile preferences page' do
...
@@ -32,6 +32,18 @@ describe 'User visits the profile preferences page' do
end
end
end
end
describe
'User changes their multi file editor preferences'
,
:js
do
it
'set the new_repo cookie when the option is ON'
do
choose
'user_multi_file_on'
expect
(
get_cookie
(
'new_repo'
)).
not_to
be_nil
end
it
'deletes the new_repo cookie when the option is OFF'
do
choose
'user_multi_file_off'
expect
(
get_cookie
(
'new_repo'
)).
to
be_nil
end
end
describe
'User changes their default dashboard'
,
:js
do
describe
'User changes their default dashboard'
,
:js
do
it
'creates a flash message'
do
it
'creates a flash message'
do
select
'Starred Projects'
,
from:
'user_dashboard'
select
'Starred Projects'
,
from:
'user_dashboard'
...
...
spec/features/projects/user_edits_files_spec.rb
View file @
0a35f372
...
@@ -33,7 +33,9 @@ describe 'User edits files' do
...
@@ -33,7 +33,9 @@ describe 'User edits files' do
binary_file
=
File
.
join
(
project
.
repository
.
root_ref
,
'files/images/logo-black.png'
)
binary_file
=
File
.
join
(
project
.
repository
.
root_ref
,
'files/images/logo-black.png'
)
visit
(
project_blob_path
(
project
,
binary_file
))
visit
(
project_blob_path
(
project
,
binary_file
))
expect
(
page
).
not_to
have_link
(
'edit'
)
page
.
within
'.content'
do
expect
(
page
).
not_to
have_link
(
'edit'
)
end
end
end
it
'commits an edited file'
,
:js
do
it
'commits an edited file'
,
:js
do
...
...
spec/support/cookie_helper.rb
View file @
0a35f372
...
@@ -8,6 +8,10 @@ module CookieHelper
...
@@ -8,6 +8,10 @@ module CookieHelper
page
.
driver
.
browser
.
manage
.
add_cookie
(
name:
name
,
value:
value
,
**
options
)
page
.
driver
.
browser
.
manage
.
add_cookie
(
name:
name
,
value:
value
,
**
options
)
end
end
def
get_cookie
(
name
)
page
.
driver
.
browser
.
manage
.
cookie_named
(
name
)
end
private
private
def
on_a_page?
def
on_a_page?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment