Commit 5fb1b9ffe359fd6c13dfb427aa23c985dff87fe1

Authored by gitlabhq
1 parent 5e12f10c

view refactoring

app/controllers/admin/mailer_controller.rb
1 1 class Admin::MailerController < ApplicationController
  2 + layout "admin"
2 3 before_filter :authenticate_user!
3 4 before_filter :authenticate_admin!
4 5  
... ...
app/controllers/admin/projects_controller.rb
1 1 class Admin::ProjectsController < ApplicationController
  2 + layout "admin"
2 3 before_filter :authenticate_user!
3 4 before_filter :authenticate_admin!
4 5  
... ...
app/controllers/admin/team_members_controller.rb
1 1 class Admin::TeamMembersController < ApplicationController
  2 + layout "admin"
2 3 before_filter :authenticate_user!
3 4 before_filter :authenticate_admin!
4 5  
... ...
app/controllers/admin/users_controller.rb
1 1 class Admin::UsersController < ApplicationController
  2 + layout "admin"
2 3 before_filter :authenticate_user!
3 4 before_filter :authenticate_admin!
4 5  
... ...
app/controllers/keys_controller.rb
1 1 class KeysController < ApplicationController
  2 + layout "profile"
2 3 respond_to :js
3 4  
4 5 def index
... ...
app/controllers/profile_controller.rb
1 1 class ProfileController < ApplicationController
  2 + layout "profile"
2 3 def show
3 4 @user = current_user
4 5 end
... ...
app/helpers/application_helper.rb
... ... @@ -28,6 +28,8 @@ module ApplicationHelper
28 28 else
29 29 "Never"
30 30 end
  31 + rescue
  32 + "Never"
31 33 end
32 34  
33 35 def markdown(text)
... ...
app/views/admin/_top_menu.html.haml
... ... @@ -1,6 +0,0 @@
1   -%div.top_project_menu
2   - %span= link_to "Users", admin_users_path, :style => "width:50px;", :class => controller.controller_name == "users" ? "current" : nil
3   - %span= link_to "Projects", admin_projects_path, :style => "width:50px;", :class => controller.controller_name == "projects" ? "current" : nil
4   - %span= link_to "Teams", admin_team_members_path, :style => "width:50px;", :class => controller.controller_name == "team_members" ? "current" : nil
5   - %span= link_to "Emails", admin_emails_path, :style => "width:50px;", :class => controller.controller_name == "mailer" ? "current" : nil
6   -
app/views/admin/projects/index.html.haml
1 1 %table
2   - %tr
  2 + %thead
3 3 %th Name
4 4 %th Code
5 5 %th Path
... ...
app/views/admin/team_members/index.html.haml
1 1 - @admin_team_members.group_by(&:project).sort.each do |project, members|
2 2 %h3= link_to project.name, [:admin, project]
3 3 %table
4   - %tr
  4 + %thead
5 5 %th Name
6 6 %th Email
7 7 %th Read
... ...
app/views/admin/users/index.html.haml
1 1 %table
2   - %tr
  2 + %thead
3 3 %th Admin
4 4 %th Name
5 5 %th Email
... ...
app/views/layouts/admin.html.haml 0 → 100644
... ... @@ -0,0 +1,27 @@
  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{ :class => content_for?(:body_class) ? yield(:body_class) : 'project-page', :id => yield(:boyd_id)}
  14 + #container
  15 + = render :partial => "layouts/flash"
  16 + = render :partial => "layouts/head_panel"
  17 + .project-container
  18 + .project-sidebar
  19 + .fixed
  20 + %aside
  21 + = link_to "Users", admin_users_path, :class => controller.controller_name == "users" ? "current" : nil
  22 + = link_to "Projects", admin_projects_path, :class => controller.controller_name == "projects" ? "current" : nil
  23 + = link_to "Teams", admin_team_members_path, :class => controller.controller_name == "team_members" ? "current" : nil
  24 + = link_to "Emails", admin_emails_path, :class => controller.controller_name == "mailer" ? "current" : nil
  25 +
  26 + .project-content
  27 + = yield
... ...
app/views/layouts/application.html.haml
... ... @@ -19,11 +19,5 @@
19 19 = render :partial => "layouts/flash"
20 20 = render :partial => "layouts/head_panel"
21 21 %div{ :id => "main", :role => "main", :class => "container_4" }
22   - - if @project && !@project.new_record?
23   - .top_bar.container= render :partial => "projects/top_menu"
24   - - if ["keys", "profile"].include?(controller.controller_name)
25   - .top_bar.container= render :partial => "profile/top_menu"
26   - - if admin_namespace?
27   - .top_bar.container= render :partial => "admin/top_menu"
28 22 = render :partial => "layouts/page_title"
29 23 = yield
... ...
app/views/layouts/profile.html.haml 0 → 100644
... ... @@ -0,0 +1,29 @@
  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{ :class => content_for?(:body_class) ? yield(:body_class) : 'project-page', :id => yield(:boyd_id)}
  14 + #container
  15 + = render :partial => "layouts/flash"
  16 + = render :partial => "layouts/head_panel"
  17 + .project-container
  18 + .project-sidebar
  19 + .fixed
  20 + %aside
  21 + = link_to "Profile", profile_path, :class => current_page?(:controller => "profile", :action => :show) ? "current" : nil
  22 + = link_to "Password", profile_password_path, :class => current_page?(:controller => "profile", :action => :password) ? "current" : nil
  23 + = link_to keys_path, :class => controller.controller_name == "keys" ? "current" : nil do
  24 + Keys
  25 + - unless current_user.keys.empty?
  26 + %span{ :class => "number" }= current_user.keys.count
  27 +
  28 + .project-content
  29 + = yield
... ...
app/views/profile/_top_menu.html.haml
... ... @@ -1,5 +0,0 @@
1   -%div.top_project_menu
2   - %span= link_to "Profile", profile_path, :class => current_page?(:controller => "profile", :action => :show) ? "current" : nil
3   - %span= link_to "Password", profile_password_path, :style => "width:70px;", :class => current_page?(:controller => "profile", :action => :password) ? "current" : nil
4   - %span= link_to "Keys", keys_path, :class => controller.controller_name == "keys" ? "current" : nil
5   -