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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
54881838
Commit
54881838
authored
Jun 30, 2017
by
Ruben Davila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add custom page when there is no license
parent
867fd30d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
2 deletions
+43
-2
app/controllers/admin/licenses_controller.rb
app/controllers/admin/licenses_controller.rb
+6
-2
app/views/admin/licenses/missing.html.haml
app/views/admin/licenses/missing.html.haml
+15
-0
spec/controllers/admin/licenses_controller_spec.rb
spec/controllers/admin/licenses_controller_spec.rb
+22
-0
No files found.
app/controllers/admin/licenses_controller.rb
View file @
54881838
class
Admin::LicensesController
<
Admin
::
ApplicationController
before_action
:license
,
only:
[
:show
,
:download
,
:destroy
]
before_action
:require_license
,
only:
[
:
show
,
:
download
,
:destroy
]
before_action
:require_license
,
only:
[
:download
,
:destroy
]
respond_to
:html
def
show
@previous_licenses
=
License
.
previous
if
@license
.
blank?
render
:missing
else
@previous_licenses
=
License
.
previous
end
end
def
download
...
...
app/views/admin/licenses/missing.html.haml
0 → 100644
View file @
54881838
-
page_title
"License"
%h3
.page-title
Your License
=
link_to
'Buy License'
,
"
#{
Gitlab
::
SUBSCRIPTIONS_URL
}
/plans"
,
target:
'_blank'
,
class:
"btn btn-new pull-right"
=
link_to
'Upload New License'
,
new_admin_license_path
,
class:
"btn pull-right"
%hr
%h4
You do not have a license.
%p
You can start a 30 day free trial for all premium features.
=
link_to
'Start free trial'
,
new_trial_url
,
class:
"btn btn-new"
spec/controllers/admin/licenses_controller_spec.rb
View file @
54881838
...
...
@@ -15,4 +15,26 @@ describe Admin::LicensesController do
expect
(
flash
[
:alert
]).
to
include
'Please enter or upload a license.'
end
end
describe
'GET #show'
do
context
'with an existent license'
do
it
'renders the license details'
do
allow
(
License
).
to
receive
(
:current
).
and_return
(
create
(
:license
))
get
:show
expect
(
response
).
to
render_template
(
:show
)
end
end
context
'without a license'
do
it
'renders missing license page'
do
allow
(
License
).
to
receive
(
:current
).
and_return
(
nil
)
get
:show
expect
(
response
).
to
render_template
(
:missing
)
end
end
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