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
0359f1d9
Commit
0359f1d9
authored
Mar 25, 2013
by
Andrew8xx8
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Codestyle improved
parent
3e695acf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
13 deletions
+7
-13
app/controllers/projects/snippets_controller.rb
app/controllers/projects/snippets_controller.rb
+2
-5
app/controllers/snippets_controller.rb
app/controllers/snippets_controller.rb
+4
-7
config/routes.rb
config/routes.rb
+1
-1
No files found.
app/controllers/projects/snippets_controller.rb
View file @
0359f1d9
...
@@ -29,9 +29,8 @@ class Projects::SnippetsController < Projects::ApplicationController
...
@@ -29,9 +29,8 @@ class Projects::SnippetsController < Projects::ApplicationController
def
create
def
create
@snippet
=
@project
.
snippets
.
build
(
params
[
:project_snippet
])
@snippet
=
@project
.
snippets
.
build
(
params
[
:project_snippet
])
@snippet
.
author
=
current_user
@snippet
.
author
=
current_user
@snippet
.
save
if
@snippet
.
valid?
if
@snippet
.
save
redirect_to
project_snippet_path
(
@project
,
@snippet
)
redirect_to
project_snippet_path
(
@project
,
@snippet
)
else
else
respond_with
(
@snippet
)
respond_with
(
@snippet
)
...
@@ -42,9 +41,7 @@ class Projects::SnippetsController < Projects::ApplicationController
...
@@ -42,9 +41,7 @@ class Projects::SnippetsController < Projects::ApplicationController
end
end
def
update
def
update
@snippet
.
update_attributes
(
params
[
:project_snippet
])
if
@snippet
.
update_attributes
(
params
[
:project_snippet
])
if
@snippet
.
valid?
redirect_to
project_snippet_path
(
@project
,
@snippet
)
redirect_to
project_snippet_path
(
@project
,
@snippet
)
else
else
respond_with
(
@snippet
)
respond_with
(
@snippet
)
...
...
app/controllers/snippets_controller.rb
View file @
0359f1d9
...
@@ -31,15 +31,14 @@ class SnippetsController < ApplicationController
...
@@ -31,15 +31,14 @@ class SnippetsController < ApplicationController
end
end
def
new
def
new
@snippet
=
PersonalSnippet
.
new
@snippet
=
PersonalSnippet
.
build
end
end
def
create
def
create
@snippet
=
PersonalSnippet
.
new
(
params
[
:personal_snippet
])
@snippet
=
PersonalSnippet
.
build
(
params
[
:personal_snippet
])
@snippet
.
author
=
current_user
@snippet
.
author
=
current_user
@snippet
.
save
if
@snippet
.
valid?
if
@snippet
.
save
redirect_to
snippet_path
(
@snippet
)
redirect_to
snippet_path
(
@snippet
)
else
else
respond_with
@snippet
respond_with
@snippet
...
@@ -50,9 +49,7 @@ class SnippetsController < ApplicationController
...
@@ -50,9 +49,7 @@ class SnippetsController < ApplicationController
end
end
def
update
def
update
@snippet
.
update_attributes
(
params
[
:personal_snippet
])
if
@snippet
.
update_attributes
(
params
[
:personal_snippet
])
if
@snippet
.
valid?
redirect_to
snippet_path
(
@snippet
)
redirect_to
snippet_path
(
@snippet
)
else
else
respond_with
@snippet
respond_with
@snippet
...
...
config/routes.rb
View file @
0359f1d9
...
@@ -46,7 +46,7 @@ Gitlab::Application.routes.draw do
...
@@ -46,7 +46,7 @@ Gitlab::Application.routes.draw do
get
"raw"
get
"raw"
end
end
end
end
match
"/s/:username"
=>
"snippets#user_index"
,
as: :user_snippets
,
constraints:
{
username:
/.*/
}
get
"/s/:username"
=>
"snippets#user_index"
,
as: :user_snippets
,
constraints:
{
username:
/.*/
}
#
#
# Public namespace
# Public namespace
...
...
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