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
Léo-Paul Géneau
gitlab-ce
Commits
3629dc33
Commit
3629dc33
authored
Apr 26, 2018
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display terms to a user
When terms are present, they can be viewed on `/-/users/terms`.
parent
17b25bd2
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
135 additions
and
0 deletions
+135
-0
app/assets/stylesheets/framework.scss
app/assets/stylesheets/framework.scss
+1
-0
app/assets/stylesheets/framework/terms.scss
app/assets/stylesheets/framework/terms.scss
+37
-0
app/controllers/users/terms_controller.rb
app/controllers/users/terms_controller.rb
+19
-0
app/views/layouts/terms.html.haml
app/views/layouts/terms.html.haml
+30
-0
app/views/users/terms/index.html.haml
app/views/users/terms/index.html.haml
+2
-0
config/routes/user.rb
config/routes/user.rb
+7
-0
spec/controllers/users/terms_controller_spec.rb
spec/controllers/users/terms_controller_spec.rb
+23
-0
spec/features/users/terms_spec.rb
spec/features/users/terms_spec.rb
+16
-0
No files found.
app/assets/stylesheets/framework.scss
View file @
3629dc33
...
@@ -61,3 +61,4 @@
...
@@ -61,3 +61,4 @@
@import
'framework/stacked_progress_bar'
;
@import
'framework/stacked_progress_bar'
;
@import
'framework/ci_variable_list'
;
@import
'framework/ci_variable_list'
;
@import
'framework/feature_highlight'
;
@import
'framework/feature_highlight'
;
@import
'framework/terms'
;
app/assets/stylesheets/framework/terms.scss
0 → 100644
View file @
3629dc33
.terms
{
.panel
{
.panel-heading
{
display
:
-
webkit-flex
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
.title
{
display
:
-
webkit-flex
;
display
:
flex
;
align-items
:
center
;
padding
:
2px
8px
;
margin
:
5px
2px
5px
-8px
;
border-radius
:
4px
;
.logo-text
{
width
:
55px
;
height
:
24px
;
margin
:
0
15px
;
}
}
.navbar-collapse
{
padding-right
:
0
;
}
.nav
li
a
{
color
:
$theme-gray-700
;
}
}
.panel-content
{
padding
:
0
$gl-padding
;
}
}
}
app/controllers/users/terms_controller.rb
0 → 100644
View file @
3629dc33
module
Users
class
TermsController
<
ApplicationController
before_action
:terms
layout
'terms'
def
index
end
private
def
terms
unless
@terms
=
Gitlab
::
CurrentSettings
.
current_application_settings
.
latest_terms
redirect_to
request
.
referer
||
root_path
end
end
end
end
app/views/layouts/terms.html.haml
0 → 100644
View file @
3629dc33
!!! 5
-
@hide_breadcrumbs
=
true
%html
{
lang:
I18n
.
locale
,
class:
page_class
}
=
render
"layouts/head"
%body
{
class:
"#{user_application_theme} #{@body_class}"
,
data:
{
page:
body_data_page
}
}
=
render
'peek/bar'
.layout-page.terms
.content-wrapper
%div
{
class:
"#{(container_class unless @no_container)} #{@content_class}"
}
.content
{
id:
"content-body"
}
.panel.panel-default
.panel-heading
.title
=
brand_header_logo
-
logo_text
=
brand_header_logo_type
-
if
logo_text
.
present?
%span
.logo-text.hidden-xs
=
logo_text
-
if
header_link?
(
:user_dropdown
)
.navbar-collapse.collapse
%ul
.nav.navbar-nav
%li
.header-user.dropdown
=
link_to
current_user
,
class:
user_dropdown_class
,
data:
{
toggle:
"dropdown"
}
do
=
image_tag
avatar_icon_for_user
(
current_user
,
23
),
width:
23
,
height:
23
,
class:
"header-user-avatar qa-user-avatar"
=
sprite_icon
(
'angle-down'
,
css_class:
'caret-down'
)
.dropdown-menu-nav.dropdown-menu-align-right
=
render
'layouts/header/current_user_dropdown'
=
yield
=
yield
:scripts_body
app/views/users/terms/index.html.haml
0 → 100644
View file @
3629dc33
.panel-content.rendered-terms
=
markdown_field
(
@terms
,
:terms
)
config/routes/user.rb
View file @
3629dc33
...
@@ -27,6 +27,13 @@ devise_scope :user do
...
@@ -27,6 +27,13 @@ devise_scope :user do
get
'/users/almost_there'
=>
'confirmations#almost_there'
get
'/users/almost_there'
=>
'confirmations#almost_there'
end
end
scope
'-/users'
,
module: :users
do
resources
:terms
,
only:
[
:index
]
do
post
:accept
,
on: :member
post
:decline
,
on: :member
end
end
scope
(
constraints:
{
username:
Gitlab
::
PathRegex
.
root_namespace_route_regex
})
do
scope
(
constraints:
{
username:
Gitlab
::
PathRegex
.
root_namespace_route_regex
})
do
scope
(
path:
'users/:username'
,
scope
(
path:
'users/:username'
,
as: :user
,
as: :user
,
...
...
spec/controllers/users/terms_controller_spec.rb
0 → 100644
View file @
3629dc33
require
'spec_helper'
describe
Users
::
TermsController
do
let
(
:user
)
{
create
(
:user
)
}
before
do
sign_in
user
end
describe
'GET #index'
do
it
'redirects when no terms exist'
do
get
:index
expect
(
response
).
to
have_gitlab_http_status
(
:redirect
)
end
it
'shows terms when they exist'
do
create
(
:term
)
expect
(
response
).
to
have_gitlab_http_status
(
:success
)
end
end
end
spec/features/users/terms_spec.rb
0 → 100644
View file @
3629dc33
require
'spec_helper'
describe
'Users > Terms'
do
let
(
:user
)
{
create
(
:user
)
}
let!
(
:term
)
{
create
(
:term
,
terms:
'By accepting, you promise to be nice!'
)
}
before
do
sign_in
(
user
)
visit
terms_path
end
it
'shows the terms'
do
expect
(
page
).
to
have_content
(
'By accepting, you promise to be nice!'
)
end
end
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