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
fc34fc86
Commit
fc34fc86
authored
Oct 14, 2011
by
gitlabhq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
branch/tag memorization
parent
912a383d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
0 deletions
+26
-0
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+9
-0
app/controllers/commits_controller.rb
app/controllers/commits_controller.rb
+1
-0
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+2
-0
app/views/commits/index.html.haml
app/views/commits/index.html.haml
+7
-0
app/views/projects/_tree.html.haml
app/views/projects/_tree.html.haml
+7
-0
No files found.
app/controllers/application_controller.rb
View file @
fc34fc86
...
@@ -41,4 +41,13 @@ class ApplicationController < ActionController::Base
...
@@ -41,4 +41,13 @@ class ApplicationController < ActionController::Base
super
super
end
end
end
end
def
refs_from_cookie
# branch is high priority so we should reset
# it if tag selected
cookies
[
:branch
]
=
nil
if
params
[
:tag
]
params
[
:branch
]
||=
cookies
[
:branch
]
params
[
:tag
]
||=
cookies
[
:tag
]
end
end
end
app/controllers/commits_controller.rb
View file @
fc34fc86
...
@@ -8,6 +8,7 @@ class CommitsController < ApplicationController
...
@@ -8,6 +8,7 @@ class CommitsController < ApplicationController
before_filter
:authorize_read_project!
before_filter
:authorize_read_project!
def
index
def
index
refs_from_cookie
@repo
=
project
.
repo
@repo
=
project
.
repo
@branch
=
if
!
params
[
:branch
].
blank?
@branch
=
if
!
params
[
:branch
].
blank?
params
[
:branch
]
params
[
:branch
]
...
...
app/controllers/projects_controller.rb
View file @
fc34fc86
...
@@ -16,6 +16,7 @@ class ProjectsController < ApplicationController
...
@@ -16,6 +16,7 @@ class ProjectsController < ApplicationController
end
end
def
show
def
show
refs_from_cookie
@repo
=
project
.
repo
@repo
=
project
.
repo
@commit
=
@repo
.
commits
.
first
@commit
=
@repo
.
commits
.
first
@tree
=
@commit
.
tree
@tree
=
@commit
.
tree
...
@@ -32,6 +33,7 @@ class ProjectsController < ApplicationController
...
@@ -32,6 +33,7 @@ class ProjectsController < ApplicationController
end
end
def
tree
def
tree
refs_from_cookie
@repo
=
project
.
repo
@repo
=
project
.
repo
@branch
=
if
!
params
[
:branch
].
blank?
@branch
=
if
!
params
[
:branch
].
blank?
params
[
:branch
]
params
[
:branch
]
...
...
app/views/commits/index.html.haml
View file @
fc34fc86
...
@@ -13,3 +13,10 @@
...
@@ -13,3 +13,10 @@
%h3
{
:style
=>
"color:#555"
}
/
#{
params
[
:path
]
}
%h3
{
:style
=>
"color:#555"
}
/
#{
params
[
:path
]
}
%div
{
:id
=>
dom_id
(
@project
)}
%div
{
:id
=>
dom_id
(
@project
)}
=
render
"commits"
=
render
"commits"
:javascript
$
(
function
(){
$
.
cookie
(
'
branch
'
,
'
#{
params
[
:branch
]
}
'
,
{
expires
:
1
});
$
.
cookie
(
'
tag
'
,
'
#{
params
[
:tag
]
}
'
,
{
expires
:
1
});
});
app/views/projects/_tree.html.haml
View file @
fc34fc86
...
@@ -45,6 +45,13 @@
...
@@ -45,6 +45,13 @@
-
contents
.
select
{
|
i
|
i
.
is_a?
(
Grit
::
Blob
)}.
each
do
|
content
|
-
contents
.
select
{
|
i
|
i
.
is_a?
(
Grit
::
Blob
)}.
each
do
|
content
|
=
render
:partial
=>
"projects/tree_item"
,
:locals
=>
{
:content
=>
content
}
=
render
:partial
=>
"projects/tree_item"
,
:locals
=>
{
:content
=>
content
}
:javascript
$
(
function
(){
$
.
cookie
(
'
branch
'
,
'
#{
params
[
:branch
]
}
'
,
{
expires
:
1
});
$
.
cookie
(
'
tag
'
,
'
#{
params
[
:tag
]
}
'
,
{
expires
:
1
});
});
:javascript
:javascript
$
(
function
(){
$
(
function
(){
$
(
'
select#branch
'
).
selectmenu
({
style
:
'
popup
'
,
width
:
200
});
$
(
'
select#branch
'
).
selectmenu
({
style
:
'
popup
'
,
width
:
200
});
...
...
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