Commit a9639776d7c52ca63c5ca7b86baf300b1a5e87e8
1 parent
3ba392b3
Exists in
master
and in
4 other branches
fixed/fluid layout switch
Showing
8 changed files
with
47 additions
and
32 deletions
Show diff stats
app/assets/stylesheets/style.scss
... | ... | @@ -292,7 +292,7 @@ body.login-page{background-color: #f1f1f1; padding-top: 10%} |
292 | 292 | |
293 | 293 | /* General */ |
294 | 294 | #container{background-color: white; overflow: hidden;} |
295 | -/*#container{margin: auto; width: 980px; border: 1px solid rgba(0,0,0,.22); border-top: 0; box-shadow: 0 0 0px 4px rgba(0,0,0,.04)}*/ | |
295 | +body.collapsed #container{margin: auto; width: 980px; border: 1px solid rgba(0,0,0,.22); border-top: 0; box-shadow: 0 0 0px 4px rgba(0,0,0,.04)} | |
296 | 296 | |
297 | 297 | |
298 | 298 | ... | ... |
app/controllers/application_controller.rb
1 | 1 | class ApplicationController < ActionController::Base |
2 | 2 | before_filter :authenticate_user! |
3 | + before_filter :view_style | |
4 | + | |
3 | 5 | protect_from_forgery |
4 | 6 | |
5 | 7 | helper_method :abilities, :can? |
... | ... | @@ -73,4 +75,12 @@ class ApplicationController < ActionController::Base |
73 | 75 | def require_non_empty_project |
74 | 76 | redirect_to @project unless @project.repo_exists? |
75 | 77 | end |
78 | + | |
79 | + def view_style | |
80 | + if params[:view_style] == "collapsed" | |
81 | + cookies[:view_style] = "collapsed" | |
82 | + elsif params[:view_style] == "fluid" | |
83 | + cookies[:view_style] = "" | |
84 | + end | |
85 | + end | |
76 | 86 | end | ... | ... |
app/helpers/application_helper.rb
... | ... | @@ -4,6 +4,14 @@ module ApplicationHelper |
4 | 4 | "http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(user_email)}?s=40&d=identicon" |
5 | 5 | end |
6 | 6 | |
7 | + def body_class(default_class = nil) | |
8 | + main = content_for(:body_class).blank? ? | |
9 | + default_class : | |
10 | + content_for(:body_class) | |
11 | + | |
12 | + [main, cookies[:view_style]].join(" ") | |
13 | + end | |
14 | + | |
7 | 15 | def commit_name(project, commit) |
8 | 16 | if project.commit.id == commit.id |
9 | 17 | "master" | ... | ... |
app/views/layouts/_head_panel.html.erb
1 | 1 | <!-- Page Header --> |
2 | 2 | <header> |
3 | -<h1 class="logo"> | |
4 | - <a href="/">GITLAB</a></h1> | |
5 | - <div class="login-top"> | |
6 | - <%= link_to profile_path, :class => "pic" do %> | |
7 | - <%= image_tag gravatar_icon(current_user.email) %> | |
8 | - <% end %> | |
9 | - <%= link_to profile_path, :class => "username" do %> | |
10 | - <%= current_user.name %> | |
11 | - <% end %> | |
12 | - <%= link_to 'Logout', destroy_user_session_path, :class => "logout", :method => :delete %> | |
3 | + <h1 class="logo"> | |
4 | + <a href="/">GITLAB</a> | |
5 | + </h1> | |
6 | + <div class="account-box"> | |
7 | + <%= link_to profile_path, :class => "pic" do %> | |
8 | + <%= image_tag gravatar_icon(current_user.email) %> | |
9 | + <% end %> | |
10 | + | |
11 | + <a href="#" class="arrow-up"></a> | |
12 | + | |
13 | + <div class="account-links"> | |
14 | + <%= link_to profile_path, :class => "username" do %> | |
15 | + <%#= current_user.name %> | |
16 | + Your profile | |
17 | + <% end %> | |
18 | + <%= link_to "Fluid layout", url_for( :view_style => 'fluid' ) if cookies[:view_style] == "collapsed"%> | |
19 | + <%= link_to "Fixed layout", url_for( :view_style => 'collapsed' ) unless cookies[:view_style] == "collapsed"%> | |
20 | + <%= link_to 'Logout', destroy_user_session_path, :class => "logout", :method => :delete %> | |
13 | 21 | </div> |
14 | - <div class="search"> | |
15 | - <%= text_field_tag "search", nil, :placeholder => "Search", :class => "search-input" %> | |
16 | - </div> | |
22 | + </div><!-- .account-box --> | |
23 | + | |
24 | + <div class="search"> | |
25 | + <%= text_field_tag "search", nil, :placeholder => "Search", :class => "search-input" %> | |
26 | + </div> | |
17 | 27 | <!-- .login-top --> |
18 | 28 | <nav> |
19 | 29 | <%= link_to dashboard_path, :class => current_page?(root_path) ? "current dashboard" : "dashboard" do %> |
... | ... | @@ -26,23 +36,10 @@ |
26 | 36 | <span></span>Admin |
27 | 37 | <% end %> |
28 | 38 | </nav> |
39 | + | |
29 | 40 | </header> |
30 | 41 | <!-- eo Page Header --> |
31 | 42 | |
32 | -<div id="header-panel" style="display:none"> | |
33 | - <div class="container"> | |
34 | - <div class="span-24"> | |
35 | - <div class="span-10"> | |
36 | - <span class="search-holder"> | |
37 | - </span> | |
38 | - </div> | |
39 | - <div class="right"> | |
40 | - <%= link_to truncate(@project.name, :length => 20), project_path(@project), :class => "current button" if @project && !@project.new_record? %> | |
41 | - </div> | |
42 | - </div> | |
43 | - </div> | |
44 | -</div> | |
45 | - | |
46 | 43 | <% if current_user %> |
47 | 44 | <%= javascript_tag do %> |
48 | 45 | $(function() { | ... | ... |
app/views/layouts/admin.html.haml
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | = javascript_tag do |
10 | 10 | REQ_URI = "#{request.env["REQUEST_URI"]}"; |
11 | 11 | REQ_REFFER = "#{request.env["HTTP_REFERER"]}"; |
12 | - %body{ :class => content_for?(:body_class) ? yield(:body_class) : 'project-page', :id => yield(:boyd_id)} | |
12 | + %body{ :class => body_class('project-page'), :id => yield(:boyd_id)} | |
13 | 13 | #container |
14 | 14 | = render :partial => "layouts/flash" |
15 | 15 | = render :partial => "layouts/head_panel" | ... | ... |
app/views/layouts/application.html.haml
... | ... | @@ -13,7 +13,7 @@ |
13 | 13 | = javascript_tag do |
14 | 14 | REQ_URI = "#{request.env["REQUEST_URI"]}"; |
15 | 15 | REQ_REFFER = "#{request.env["HTTP_REFERER"]}"; |
16 | - %body{ :class => yield(:body_class), :id => yield(:boyd_id)} | |
16 | + %body{ :class => body_class, :id => yield(:boyd_id)} | |
17 | 17 | #container |
18 | 18 | = render :partial => "layouts/flash" |
19 | 19 | = render :partial => "layouts/head_panel" | ... | ... |
app/views/layouts/profile.html.haml
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | = javascript_tag do |
10 | 10 | REQ_URI = "#{request.env["REQUEST_URI"]}"; |
11 | 11 | REQ_REFFER = "#{request.env["HTTP_REFERER"]}"; |
12 | - %body{ :class => content_for?(:body_class) ? yield(:body_class) : 'project-page', :id => yield(:boyd_id)} | |
12 | + %body{ :class => body_class('project-page'), :id => yield(:boyd_id)} | |
13 | 13 | #container |
14 | 14 | = render :partial => "layouts/flash" |
15 | 15 | = render :partial => "layouts/head_panel" | ... | ... |
app/views/layouts/project.html.haml
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | = javascript_tag do |
10 | 10 | REQ_URI = "#{request.env["REQUEST_URI"]}"; |
11 | 11 | REQ_REFFER = "#{request.env["HTTP_REFERER"]}"; |
12 | - %body{ :class => content_for?(:body_class) ? yield(:body_class) : 'project-page', :id => yield(:boyd_id)} | |
12 | + %body{ :class => body_class('project-page'), :id => yield(:boyd_id)} | |
13 | 13 | #container |
14 | 14 | = render :partial => "layouts/flash" |
15 | 15 | = render :partial => "layouts/head_panel" | ... | ... |