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
08b1302d
Commit
08b1302d
authored
May 26, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow saving no plan on namespaces
parent
211679e2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
4 deletions
+6
-4
app/models/ee/namespace.rb
app/models/ee/namespace.rb
+2
-2
app/views/admin/_namespace_plan.html.haml
app/views/admin/_namespace_plan.html.haml
+3
-1
spec/models/ee/namespace_spec.rb
spec/models/ee/namespace_spec.rb
+1
-1
No files found.
app/models/ee/namespace.rb
View file @
08b1302d
...
...
@@ -24,7 +24,7 @@ module EE
delegate
:shared_runners_minutes
,
:shared_runners_seconds
,
:shared_runners_seconds_last_reset
,
to: :namespace_statistics
,
allow_nil:
true
validates
:plan
,
inclusion:
{
in:
EE_PLANS
.
keys
},
allow_
nil
:
true
validates
:plan
,
inclusion:
{
in:
EE_PLANS
.
keys
},
allow_
blank
:
true
end
# Checks features (i.e. https://about.gitlab.com/products/) availabily
...
...
@@ -58,7 +58,7 @@ module EE
def
plans
@ancestors_plans
||=
if
parent_id
ancestors
.
where
.
not
(
plan:
nil
).
reorder
(
nil
).
pluck
(
'DISTINCT plan'
)
+
[
plan
]
ancestors
.
where
.
not
(
plan:
[
nil
,
''
]
).
reorder
(
nil
).
pluck
(
'DISTINCT plan'
)
+
[
plan
]
else
[
plan
]
end
...
...
app/views/admin/_namespace_plan.html.haml
View file @
08b1302d
.form-group
=
f
.
label
:plan
,
class:
'control-label'
.col-sm-10
=
f
.
select
:plan
,
options_for_select
(
Namespace
::
EE_PLANS
.
keys
.
map
{
|
plan
|
[
plan
.
titleize
,
plan
]
},
f
.
object
.
plan
),
{},
class:
'form-control'
=
f
.
select
:plan
,
options_for_select
(
Namespace
::
EE_PLANS
.
keys
.
map
{
|
plan
|
[
plan
.
titleize
,
plan
]
},
f
.
object
.
plan
),
{
include_blank:
'No associated plan'
},
class:
'form-control'
spec/models/ee/namespace_spec.rb
View file @
08b1302d
...
...
@@ -8,7 +8,7 @@ describe Namespace, models: true do
it
{
is_expected
.
to
delegate_method
(
:shared_runners_minutes
).
to
(
:namespace_statistics
)
}
it
{
is_expected
.
to
delegate_method
(
:shared_runners_seconds
).
to
(
:namespace_statistics
)
}
it
{
is_expected
.
to
delegate_method
(
:shared_runners_seconds_last_reset
).
to
(
:namespace_statistics
)
}
it
{
is_expected
.
to
validate_inclusion_of
(
:plan
).
in_array
(
Namespace
::
EE_PLANS
.
keys
).
allow_
nil
}
it
{
is_expected
.
to
validate_inclusion_of
(
:plan
).
in_array
(
Namespace
::
EE_PLANS
.
keys
).
allow_
blank
}
describe
'#feature_available?'
do
let
(
:group
)
{
create
(
:group
,
plan:
plan_license
)
}
...
...
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