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
4eeb7145
Commit
4eeb7145
authored
Jun 29, 2017
by
Ruben Davila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small refactor after first code review.
parent
1d38dd49
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
15 deletions
+12
-15
app/helpers/license_helper.rb
app/helpers/license_helper.rb
+11
-14
app/models/license.rb
app/models/license.rb
+1
-1
No files found.
app/helpers/license_helper.rb
View file @
4eeb7145
...
...
@@ -17,24 +17,21 @@ module LicenseHelper
end
def
trial_license_message
if
signed_in?
&&
current_license
&
.
trial?
status
=
current_license
.
expired?
?
:expired
:
:active
return
unless
signed_in?
&&
current_license
&
.
trial?
message
=
buy_now_link
=
link_to
(
'Buy now!'
,
'https://customers.gitlab.com/plans'
,
target:
'_blank'
)
message
=
if
current_license
.
expired?
if
current_user
.
admin?
buy_now_link
=
link_to
(
'Buy now!'
,
'https://customers.gitlab.com/plans'
,
target:
'_blank'
)
if
status
==
:active
remaining_days
=
(
current_license
.
expires_at
-
Date
.
today
).
to_i
"Your GitLab Enterprise Edition trial license remains
#{
pluralize
(
remaining_days
,
'day'
)
}
.
#{
buy_now_link
}
"
.
html_safe
else
"Your GitLab Enterprise Edition trial license expired.
#{
buy_now_link
}
"
.
html_safe
end
elsif
status
==
:expired
"Your GitLab Enterprise Edition trial license expired.
#{
buy_now_link
}
"
.
html_safe
else
"Your GitLab Enterprise Edition trial license expired. Please contact your administrator."
end
end
elsif
current_user
.
admin?
remaining_days
=
(
current_license
.
expires_at
-
Date
.
today
).
to_i
"Your GitLab Enterprise Edition trial license will expire in
#{
pluralize
(
remaining_days
,
'day'
)
}
.
#{
buy_now_link
}
"
.
html_safe
end
message
end
...
...
app/models/license.rb
View file @
4eeb7145
...
...
@@ -158,7 +158,7 @@ class License < ActiveRecord::Base
def
block_changes?
return
false
if
current
.
nil?
return
false
if
current
&
.
trial?
return
false
if
current
.
trial?
current
.
block_changes?
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