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
53421e06
Commit
53421e06
authored
Oct 15, 2011
by
gitlabhq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean controllers
parent
5f8255ac
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
60 additions
and
88 deletions
+60
-88
app/controllers/commits_controller.rb
app/controllers/commits_controller.rb
+0
-2
app/controllers/keys_controller.rb
app/controllers/keys_controller.rb
+0
-6
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+57
-71
app/controllers/team_members_controller.rb
app/controllers/team_members_controller.rb
+0
-5
app/views/notes/_notes.html.haml
app/views/notes/_notes.html.haml
+1
-0
app/views/projects/_list.html.haml
app/views/projects/_list.html.haml
+0
-3
app/views/projects/_projects_top_menu.html.haml
app/views/projects/_projects_top_menu.html.haml
+2
-1
No files found.
app/controllers/commits_controller.rb
View file @
53421e06
...
@@ -21,7 +21,6 @@ class CommitsController < ApplicationController
...
@@ -21,7 +21,6 @@ class CommitsController < ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
# index.html.erb
format
.
html
# index.html.erb
format
.
js
format
.
js
format
.
json
{
render
json:
@commits
}
end
end
end
end
...
@@ -33,7 +32,6 @@ class CommitsController < ApplicationController
...
@@ -33,7 +32,6 @@ class CommitsController < ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
# show.html.erb
format
.
html
# show.html.erb
format
.
js
format
.
js
format
.
json
{
render
json:
@commit
}
end
end
end
end
end
end
app/controllers/keys_controller.rb
View file @
53421e06
...
@@ -3,11 +3,6 @@ class KeysController < ApplicationController
...
@@ -3,11 +3,6 @@ class KeysController < ApplicationController
def
index
def
index
@keys
=
current_user
.
keys
.
all
@keys
=
current_user
.
keys
.
all
respond_to
do
|
format
|
format
.
html
# index.html.erb
format
.
json
{
render
json:
@keys
}
end
end
end
def
new
def
new
...
@@ -32,7 +27,6 @@ class KeysController < ApplicationController
...
@@ -32,7 +27,6 @@ class KeysController < ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
{
redirect_to
keys_url
}
format
.
html
{
redirect_to
keys_url
}
format
.
js
{
render
:nothing
=>
true
}
format
.
js
{
render
:nothing
=>
true
}
format
.
json
{
head
:ok
}
end
end
end
end
end
end
app/controllers/projects_controller.rb
View file @
53421e06
...
@@ -8,10 +8,52 @@ class ProjectsController < ApplicationController
...
@@ -8,10 +8,52 @@ class ProjectsController < ApplicationController
def
index
def
index
@projects
=
current_user
.
projects
.
all
@projects
=
current_user
.
projects
.
all
end
def
new
@project
=
Project
.
new
end
def
edit
end
def
create
@project
=
Project
.
new
(
params
[
:project
])
@project
.
owner
=
current_user
Project
.
transaction
do
@project
.
save!
@project
.
users_projects
.
create!
(
:admin
=>
true
,
:read
=>
true
,
:write
=>
true
,
:user
=>
current_user
)
end
respond_to
do
|
format
|
if
@project
.
valid?
format
.
html
{
redirect_to
@project
,
notice:
'Project was successfully created.'
}
format
.
js
else
format
.
html
{
render
action:
"new"
}
format
.
js
end
end
rescue
Gitosis
::
AccessDenied
render
:js
=>
"location.href = '
#{
errors_gitosis_path
}
'"
and
return
rescue
StandardError
=>
ex
@project
.
errors
.
add
(
:base
,
"Cant save project. Please try again later"
)
respond_to
do
|
format
|
format
.
html
{
render
action:
"new"
}
format
.
js
end
end
def
update
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
# index.html.erb
if
project
.
update_attributes
(
params
[
:project
])
format
.
json
{
render
json:
@projects
}
format
.
html
{
redirect_to
project
,
notice:
'Project was successfully updated.'
}
format
.
js
else
format
.
html
{
render
action:
"edit"
}
format
.
js
end
end
end
end
end
...
@@ -21,20 +63,27 @@ class ProjectsController < ApplicationController
...
@@ -21,20 +63,27 @@ class ProjectsController < ApplicationController
@tree
=
@commit
.
tree
@tree
=
@commit
.
tree
@tree
=
@tree
/
params
[
:path
]
if
params
[
:path
]
@tree
=
@tree
/
params
[
:path
]
if
params
[
:path
]
respond_to
do
|
format
|
format
.
html
# show.html.erb
format
.
json
{
render
json:
project
}
end
rescue
Grit
::
NoSuchPathError
=>
ex
rescue
Grit
::
NoSuchPathError
=>
ex
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
{
render
"projects/empty"
}
format
.
html
{
render
"projects/empty"
}
end
end
end
end
def
tree
#
load_refs
# load @branch, @tag & @ref
# Wall
#
def
wall
@notes
=
@project
.
common_notes
@note
=
Note
.
new
end
#
# Repository preview
#
def
tree
load_refs
# load @branch, @tag & @ref
@repo
=
project
.
repo
@repo
=
project
.
repo
...
@@ -74,75 +123,12 @@ class ProjectsController < ApplicationController
...
@@ -74,75 +123,12 @@ class ProjectsController < ApplicationController
return
render_404
return
render_404
end
end
def
new
@project
=
Project
.
new
respond_to
do
|
format
|
format
.
html
# new.html.erb
format
.
json
{
render
json:
@project
}
end
end
def
edit
end
def
create
@project
=
Project
.
new
(
params
[
:project
])
@project
.
owner
=
current_user
Project
.
transaction
do
@project
.
save!
@project
.
users_projects
.
create!
(
:admin
=>
true
,
:read
=>
true
,
:write
=>
true
,
:user
=>
current_user
)
end
respond_to
do
|
format
|
if
@project
.
valid?
format
.
html
{
redirect_to
@project
,
notice:
'Project was successfully created.'
}
format
.
js
format
.
json
{
render
json:
@project
,
status: :created
,
location:
@project
}
else
format
.
html
{
render
action:
"new"
}
format
.
js
format
.
json
{
render
json:
@project
.
errors
,
status: :unprocessable_entity
}
end
end
rescue
Gitosis
::
AccessDenied
render
:js
=>
"location.href = '
#{
errors_gitosis_path
}
'"
and
return
rescue
StandardError
=>
ex
@project
.
errors
.
add
(
:base
,
"Cant save project. Please try again later"
)
respond_to
do
|
format
|
format
.
html
{
render
action:
"new"
}
format
.
js
format
.
json
{
render
json:
@project
.
errors
,
status: :unprocessable_entity
}
end
end
def
update
respond_to
do
|
format
|
if
project
.
update_attributes
(
params
[
:project
])
format
.
html
{
redirect_to
project
,
notice:
'Project was successfully updated.'
}
format
.
js
format
.
json
{
head
:ok
}
else
format
.
html
{
render
action:
"edit"
}
format
.
js
format
.
json
{
render
json:
project
.
errors
,
status: :unprocessable_entity
}
end
end
end
def
destroy
def
destroy
project
.
destroy
project
.
destroy
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
{
redirect_to
projects_url
}
format
.
html
{
redirect_to
projects_url
}
format
.
json
{
head
:ok
}
end
end
end
def
wall
@notes
=
@project
.
common_notes
@note
=
Note
.
new
end
end
protected
protected
...
...
app/controllers/team_members_controller.rb
View file @
53421e06
...
@@ -12,7 +12,6 @@ class TeamMembersController < ApplicationController
...
@@ -12,7 +12,6 @@ class TeamMembersController < ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
# show.html.erb
format
.
html
# show.html.erb
format
.
js
format
.
js
format
.
json
{
render
json:
@team_member
}
end
end
end
end
...
@@ -22,7 +21,6 @@ class TeamMembersController < ApplicationController
...
@@ -22,7 +21,6 @@ class TeamMembersController < ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
# new.html.erb
format
.
html
# new.html.erb
format
.
js
format
.
js
format
.
json
{
render
json:
@team_member
}
end
end
end
end
...
@@ -34,11 +32,9 @@ class TeamMembersController < ApplicationController
...
@@ -34,11 +32,9 @@ class TeamMembersController < ApplicationController
if
@team_member
.
save
if
@team_member
.
save
format
.
html
{
redirect_to
@team_member
,
notice:
'Team member was successfully created.'
}
format
.
html
{
redirect_to
@team_member
,
notice:
'Team member was successfully created.'
}
format
.
js
format
.
js
format
.
json
{
render
json:
@team_member
,
status: :created
,
location:
@team_member
}
else
else
format
.
html
{
render
action:
"new"
}
format
.
html
{
render
action:
"new"
}
format
.
js
format
.
js
format
.
json
{
render
json:
@team_member
.
errors
,
status: :unprocessable_entity
}
end
end
end
end
end
end
...
@@ -59,7 +55,6 @@ class TeamMembersController < ApplicationController
...
@@ -59,7 +55,6 @@ class TeamMembersController < ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
{
redirect_to
root_path
}
format
.
html
{
redirect_to
root_path
}
format
.
json
{
head
:ok
}
format
.
js
{
render
:nothing
=>
true
}
format
.
js
{
render
:nothing
=>
true
}
end
end
end
end
...
...
app/views/notes/_notes.html.haml
View file @
53421e06
%ul
#notes-list
%ul
#notes-list
-
@notes
.
each
do
|
note
|
-
@notes
.
each
do
|
note
|
-
next
unless
note
.
author
=
render
:partial
=>
"notes/show"
,
:locals
=>
{
:note
=>
note
}
=
render
:partial
=>
"notes/show"
,
:locals
=>
{
:note
=>
note
}
%br
%br
...
...
app/views/projects/_list.html.haml
View file @
53421e06
-#- if current_user.can_create_project?
= link_to 'New Project', new_project_path, :class => "lbutton vm"
%table
.round-borders
#projects-list
%table
.round-borders
#projects-list
%tr
%tr
%th
Name
%th
Name
...
...
app/views/projects/_projects_top_menu.html.haml
View file @
53421e06
%div
.top_project_menu
%div
.top_project_menu
%span
=
link_to
'All'
,
projects_path
,
:class
=>
current_page?
(
projects_path
)
?
"current"
:
nil
%span
=
link_to
'All'
,
projects_path
,
:class
=>
current_page?
(
projects_path
)
?
"current"
:
nil
-
if
current_user
.
can_create_project?
%span
=
link_to
"New Project"
,
new_project_path
,
:class
=>
current_page?
(
:controller
=>
"projects"
,
:action
=>
"new"
)
?
"current"
:
nil
%span
=
link_to
"New Project"
,
new_project_path
,
:class
=>
current_page?
(
:controller
=>
"projects"
,
:action
=>
"new"
)
?
"current"
:
nil
%span
.right
%span
.right
=
link_to_function
(
image_tag
(
"list_view_icon.jpg"
),
"switchProjectView()"
,
:style
=>
"border:none;box-shadow:none;"
)
=
link_to_function
(
image_tag
(
"list_view_icon.jpg"
),
"switchProjectView()"
,
:style
=>
"border:none;box-shadow:none;"
)
...
...
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