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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
b765a795
Commit
b765a795
authored
Mar 18, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move snippets to own tab as feature. Make it disabled for new projects by default
parent
112dc875
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
3 deletions
+25
-3
app/contexts/projects/create_context.rb
app/contexts/projects/create_context.rb
+2
-1
app/controllers/snippets_controller.rb
app/controllers/snippets_controller.rb
+5
-0
app/models/project.rb
app/models/project.rb
+1
-1
app/views/layouts/project_resource.html.haml
app/views/layouts/project_resource.html.haml
+4
-0
app/views/projects/_form.html.haml
app/views/projects/_form.html.haml
+6
-0
db/migrate/20130318212250_add_snippets_to_features.rb
db/migrate/20130318212250_add_snippets_to_features.rb
+5
-0
db/schema.rb
db/schema.rb
+2
-1
No files found.
app/contexts/projects/create_context.rb
View file @
b765a795
...
@@ -32,8 +32,9 @@ module Projects
...
@@ -32,8 +32,9 @@ module Projects
@project
.
namespace_id
=
current_user
.
namespace_id
@project
.
namespace_id
=
current_user
.
namespace_id
end
end
# Disable
wall
by default
# Disable
less important features
by default
@project
.
wall_enabled
=
false
@project
.
wall_enabled
=
false
@project
.
snippets_enabled
=
false
@project
.
creator
=
current_user
@project
.
creator
=
current_user
...
...
app/controllers/snippets_controller.rb
View file @
b765a795
class
SnippetsController
<
ProjectResourceController
class
SnippetsController
<
ProjectResourceController
before_filter
:module_enabled
before_filter
:snippet
,
only:
[
:show
,
:edit
,
:destroy
,
:update
,
:raw
]
before_filter
:snippet
,
only:
[
:show
,
:edit
,
:destroy
,
:update
,
:raw
]
# Allow read any snippet
# Allow read any snippet
...
@@ -84,4 +85,8 @@ class SnippetsController < ProjectResourceController
...
@@ -84,4 +85,8 @@ class SnippetsController < ProjectResourceController
def
authorize_admin_snippet!
def
authorize_admin_snippet!
return
render_404
unless
can?
(
current_user
,
:admin_snippet
,
@snippet
)
return
render_404
unless
can?
(
current_user
,
:admin_snippet
,
@snippet
)
end
end
def
module_enabled
return
render_404
unless
@project
.
snippet_enabled
end
end
end
app/models/project.rb
View file @
b765a795
...
@@ -29,7 +29,7 @@ class Project < ActiveRecord::Base
...
@@ -29,7 +29,7 @@ class Project < ActiveRecord::Base
class
TransferError
<
StandardError
;
end
class
TransferError
<
StandardError
;
end
attr_accessible
:name
,
:path
,
:description
,
:default_branch
,
:issues_tracker
,
attr_accessible
:name
,
:path
,
:description
,
:default_branch
,
:issues_tracker
,
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
:issues_tracker_id
,
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
:
snippets_enabled
,
:
issues_tracker_id
,
:wiki_enabled
,
:public
,
:import_url
,
as:
[
:default
,
:admin
]
:wiki_enabled
,
:public
,
:import_url
,
as:
[
:default
,
:admin
]
attr_accessible
:namespace_id
,
:creator_id
,
as: :admin
attr_accessible
:namespace_id
,
:creator_id
,
as: :admin
...
...
app/views/layouts/project_resource.html.haml
View file @
b765a795
...
@@ -43,6 +43,10 @@
...
@@ -43,6 +43,10 @@
=
nav_link
(
path:
'projects#wall'
)
do
=
nav_link
(
path:
'projects#wall'
)
do
=
link_to
'Wall'
,
wall_project_path
(
@project
)
=
link_to
'Wall'
,
wall_project_path
(
@project
)
-
if
@project
.
snippets_enabled
=
nav_link
(
controller: :snippets
)
do
=
link_to
'Snippets'
,
project_snippets_path
(
@project
)
-
if
can?
current_user
,
:admin_project
,
@project
-
if
can?
current_user
,
:admin_project
,
@project
=
nav_link
(
html_options:
{
class:
"
#{
project_tab_class
}
"
})
do
=
nav_link
(
html_options:
{
class:
"
#{
project_tab_class
}
"
})
do
=
link_to
edit_project_path
(
@project
),
class:
"stat-tab tab "
do
=
link_to
edit_project_path
(
@project
),
class:
"stat-tab tab "
do
...
...
app/views/projects/_form.html.haml
View file @
b765a795
...
@@ -87,6 +87,12 @@
...
@@ -87,6 +87,12 @@
=
f
.
check_box
:wall_enabled
=
f
.
check_box
:wall_enabled
%span
.descr
Simple chat system for broadcasting inside project
%span
.descr
Simple chat system for broadcasting inside project
.control-group
=
f
.
label
:snippets_enabled
,
"Snippets"
,
class:
'control-label'
.controls
=
f
.
check_box
:snippets_enabled
%span
.descr
Share code pastes with others out of git repository
.control-group
.control-group
=
f
.
label
:wiki_enabled
,
"Wiki"
,
class:
'control-label'
=
f
.
label
:wiki_enabled
,
"Wiki"
,
class:
'control-label'
.controls
.controls
...
...
db/migrate/20130318212250_add_snippets_to_features.rb
0 → 100644
View file @
b765a795
class
AddSnippetsToFeatures
<
ActiveRecord
::
Migration
def
change
add_column
:projects
,
:snippets_enabled
,
:boolean
,
null:
false
,
default:
true
end
end
db/schema.rb
View file @
b765a795
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#
#
# It's strongly recommended to check this file into your version control system.
# It's strongly recommended to check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
:version
=>
2013031
5124931
)
do
ActiveRecord
::
Schema
.
define
(
:version
=>
2013031
8212250
)
do
create_table
"events"
,
:force
=>
true
do
|
t
|
create_table
"events"
,
:force
=>
true
do
|
t
|
t
.
string
"target_type"
t
.
string
"target_type"
...
@@ -155,6 +155,7 @@ ActiveRecord::Schema.define(:version => 20130315124931) do
...
@@ -155,6 +155,7 @@ ActiveRecord::Schema.define(:version => 20130315124931) do
t
.
boolean
"public"
,
:default
=>
false
,
:null
=>
false
t
.
boolean
"public"
,
:default
=>
false
,
:null
=>
false
t
.
string
"issues_tracker"
,
:default
=>
"gitlab"
,
:null
=>
false
t
.
string
"issues_tracker"
,
:default
=>
"gitlab"
,
:null
=>
false
t
.
string
"issues_tracker_id"
t
.
string
"issues_tracker_id"
t
.
boolean
"snippets_enabled"
,
:default
=>
true
,
:null
=>
false
end
end
add_index
"projects"
,
[
"creator_id"
],
:name
=>
"index_projects_on_owner_id"
add_index
"projects"
,
[
"creator_id"
],
:name
=>
"index_projects_on_owner_id"
...
...
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