Commit 487ae906a948e72429c60a1b5abe9508ed516a32

Authored by gitlabhq
1 parent 1ffb4b98

project layout

app/assets/stylesheets/projects.css.scss
... ... @@ -390,16 +390,17 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
390 390 }
391 391  
392 392 .top_menu_count {
393   - background: none repeat scroll 0 0 #FFF6BF;
394   - border-color: #FFD324;
395   - color: #514721;
396   - border: 1px solid #DDDDDD;
  393 + background: none repeat scroll 0 0 white;
  394 + color: #333;
  395 + border-color: #4BB8D2;
397 396 padding: 2px;
398   - font-size:12px;
399   - position:relative;
400   - top:-14px;
401   - left:10px;
  397 + font-size:10px;
402 398 border-top:none;
  399 + text-align:center;
  400 + float:right;
  401 + width:25px;
  402 +
  403 +
403 404 }
404 405  
405 406 #logo {
... ... @@ -700,3 +701,9 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
700 701 }
701 702 }
702 703  
  704 +.left {
  705 + float:left;
  706 +}
  707 +.right {
  708 + float:right;
  709 +}
... ...
app/controllers/issues_controller.rb
... ... @@ -2,6 +2,7 @@ class IssuesController < ApplicationController
2 2 before_filter :authenticate_user!
3 3 before_filter :project
4 4 before_filter :issue, :only => [:edit, :update, :destroy, :show]
  5 + layout "project"
5 6  
6 7 # Authorize
7 8 before_filter :add_project_abilities
... ...
app/controllers/projects_controller.rb
1 1 class ProjectsController < ApplicationController
2 2 before_filter :project, :except => [:index, :new, :create]
  3 + layout :determine_layout
3 4  
4 5 # Authorize
5 6 before_filter :add_project_abilities
... ... @@ -152,4 +153,12 @@ class ProjectsController &lt; ApplicationController
152 153 def project
153 154 @project ||= Project.find_by_code(params[:id])
154 155 end
  156 +
  157 + def determine_layout
  158 + if @project && !@project.new_record?
  159 + "project"
  160 + else
  161 + "application"
  162 + end
  163 + end
155 164 end
... ...
app/views/layouts/project.html.haml 0 → 100644
... ... @@ -0,0 +1,46 @@
  1 +!!!
  2 +%html
  3 + %head
  4 + %title
  5 + GitLab #{" - #{@project.name}" if @project && !@project.new_record?}
  6 + = stylesheet_link_tag "application"
  7 + = javascript_include_tag "application"
  8 + = csrf_meta_tags
  9 + %link{:href => "/assets/favicon.png", :rel => "icon", :type => "image/png"}/
  10 + = javascript_tag do
  11 + REQ_URI = "#{request.env["REQUEST_URI"]}";
  12 + REQ_REFFER = "#{request.env["HTTP_REFERER"]}";
  13 + %body.project-page
  14 + #container
  15 + = render :partial => "layouts/flash"
  16 + = render :partial => "layouts/head_panel"
  17 + = render :partial => "layouts/page_title"
  18 + .project-container
  19 + .project-sidebar.grid_1
  20 + %input.git-url.text{:id => "", :name => "", :readonly => "", :type => "text", :value => @project.url_to_repo}
  21 + %aside
  22 + = link_to image_tag("home.png", :width => 20), project_path(@project), :class => current_page?(:controller => "projects", :action => "show", :id => @project) ? "current" : nil
  23 + = link_to "Tree", tree_project_path(@project), :class => current_page?(:controller => "projects", :action => "tree", :id => @project) ? "current" : nil
  24 + = link_to "Commits", project_commits_path(@project), :class => current_page?(:controller => "commits", :action => "index", :project_id => @project) ? "current" : nil
  25 + = link_to team_project_path(@project), :class => (current_page?(:controller => "projects", :action => "team", :id => @project) || controller.controller_name == "team_members") ? "current" : nil do
  26 + Team
  27 + - if @project.users_projects.count > 0
  28 + %span{ :class => "top_menu_count" }= @project.users_projects.count
  29 + = link_to project_issues_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do
  30 + Issues
  31 + - if @project.issues.opened.count > 0
  32 + %span{ :class => "top_menu_count" }= @project.issues.opened.count
  33 + = link_to wall_project_path(@project), :class => current_page?(:controller => "projects", :action => "wall", :id => @project) ? "current" : nil do
  34 + Wall
  35 + - if @project.common_notes.count > 0
  36 + %span{ :class => "top_menu_count" }= @project.common_notes.count
  37 + = link_to project_snippets_path(@project), :class => (controller.controller_name == "snippets") ? "current" : nil do
  38 + Snippets
  39 + - if @project.snippets.count > 0
  40 + %span{ :class => "top_menu_count" }= @project.snippets.non_expired.count
  41 + - if @commit
  42 + = link_to truncate(commit_name(@project,@commit), :length => 15), project_commit_path(@project, :id => @commit.id), :class => current_page?(:controller => "commits", :action => "show", :project_id => @project, :id => @commit.id) ? "current" : nil
  43 +
  44 +
  45 + .project-content
  46 + = yield
... ...
app/views/projects/_top_menu.html.haml
1 1 %div.top_project_menu
2   - -#%span= link_to @project.code.capitalize, @project, :class => current_page?(:controller => "projects", :action => "show", :id => @project) ? "current" : nil
3 2 - if @project.repo_exists?
4 3 %span= link_to image_tag("home.png", :width => 20), project_path(@project), :class => current_page?(:controller => "projects", :action => "show", :id => @project) ? "current" : nil
5 4 %span= link_to "Tree", tree_project_path(@project), :class => current_page?(:controller => "projects", :action => "tree", :id => @project) ? "current" : nil
... ...