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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
2d577cae
Commit
2d577cae
authored
Oct 14, 2011
by
gitlabhq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
branch/tag remember - to session instead of cookie
parent
fc34fc86
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
17 deletions
+19
-17
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+9
-6
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+8
-0
app/views/commits/index.html.haml
app/views/commits/index.html.haml
+1
-6
app/views/projects/_tree.html.haml
app/views/projects/_tree.html.haml
+1
-5
No files found.
app/controllers/application_controller.rb
View file @
2d577cae
...
...
@@ -43,11 +43,14 @@ class ApplicationController < ActionController::Base
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
]
if
@project
&&
session
[
:ui
]
&&
session
[
:ui
][
@project
.
id
]
project_session
=
session
[
:ui
][
@project
.
id
]
project_session
[
:branch
]
=
nil
if
params
[
:tag
]
params
[
:branch
]
||=
project_session
[
:branch
]
params
[
:tag
]
||=
project_session
[
:tag
]
end
rescue
session
[
:ui
]
=
nil
end
end
app/helpers/projects_helper.rb
View file @
2d577cae
...
...
@@ -3,4 +3,12 @@ module ProjectsHelper
cookies
[
"project_view"
]
||=
"tile"
cookies
[
"project_view"
]
==
type
?
nil
:
"display:none"
end
def
remember_refs
session
[
:ui
]
||=
{}
session
[
:ui
][
@project
.
id
]
=
{
:branch
=>
params
[
:branch
],
:tag
=>
params
[
:tag
]
}
end
end
app/views/commits/index.html.haml
View file @
2d577cae
...
...
@@ -14,9 +14,4 @@
%div
{
:id
=>
dom_id
(
@project
)}
=
render
"commits"
:javascript
$
(
function
(){
$
.
cookie
(
'
branch
'
,
'
#{
params
[
:branch
]
}
'
,
{
expires
:
1
});
$
.
cookie
(
'
tag
'
,
'
#{
params
[
:tag
]
}
'
,
{
expires
:
1
});
});
-
remember_refs
app/views/projects/_tree.html.haml
View file @
2d577cae
...
...
@@ -46,11 +46,7 @@
=
render
:partial
=>
"projects/tree_item"
,
:locals
=>
{
:content
=>
content
}
:javascript
$
(
function
(){
$
.
cookie
(
'
branch
'
,
'
#{
params
[
:branch
]
}
'
,
{
expires
:
1
});
$
.
cookie
(
'
tag
'
,
'
#{
params
[
:tag
]
}
'
,
{
expires
:
1
});
});
-
remember_refs
:javascript
$
(
function
(){
...
...
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