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
Kazuhiko Shiozaki
gitlab-ce
Commits
f51a4016
Commit
f51a4016
authored
Oct 14, 2011
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
branch/tag remember - to session instead of cookie
parent
5dc5ef7b
Changes
4
Hide 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 @
f51a4016
...
...
@@ -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 @
f51a4016
...
...
@@ -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 @
f51a4016
...
...
@@ -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 @
f51a4016
...
...
@@ -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