Commit a767a86c authored by gitlabhq's avatar gitlabhq

Merge branch 'dev'

parents ae47d692 5c9cb850
......@@ -19,6 +19,7 @@ gem "pygments.rb", "0.2.3"
gem "thin"
gem "git"
gem "acts_as_list"
gem 'rdiscount'
group :assets do
gem 'sass-rails', " ~> 3.1.0"
......@@ -26,7 +27,8 @@ group :assets do
gem 'uglifier'
end
group :development do
group :development do
gem 'letter_opener'
gem 'rails-footnotes', '>= 3.7.5.rc4'
gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git'
end
......
......@@ -119,6 +119,8 @@ GEM
rails (>= 3.0.0)
launchy (2.0.5)
addressable (~> 2.2.6)
letter_opener (0.0.2)
launchy
libv8 (3.3.10.2)
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
......@@ -161,6 +163,7 @@ GEM
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2)
rdiscount (1.6.8)
rdoc (3.9.4)
rspec (2.6.0)
rspec-core (~> 2.6.0)
......@@ -261,9 +264,11 @@ DEPENDENCIES
jquery-rails
kaminari
launchy
letter_opener
pygments.rb (= 0.2.3)
rails (= 3.1.0)
rails-footnotes (>= 3.7.5.rc4)
rdiscount
rspec-rails
ruby-debug19
sass-rails (~> 3.1.0)
......
[Dolphin]
ShowPreview=true
Timestamp=2011,9,14,20,34,18
Timestamp=2011,10,28,13,16,25
Version=2
This diff is collapsed.
......@@ -102,54 +102,6 @@ table.round-borders {
float:left;
}
.day-commits-table {
@include round-borders-all(4px);
padding: 4px 0px;
margin-bottom:10px;
display:block;
width:100%;
background: #E6F1F6;
.day-header {
padding:10px;
h3 {
margin:0px;
}
}
ul {
display:block;
list-style:none;
margin:0px;
padding:0px;
li.commit {
display:list-item;
padding:8px;
margin:0px;
background: #F7FBFC;
border-top: 1px solid #E2EAEE;
&:first-child {
border-top: 1px solid #E2EAEE;
}
&:nth-child(2n+1) {
background: white;
}
a.button {
width:85px;
padding:10px;
margin:0px;
float:right;
}
p {
margin-bottom: 3px;
font-size: 13px;
}
}
}
}
@mixin panel-color {
background: #111 !important;
background: -webkit-gradient(linear,left top,left bottom,from(#333),to(#111)) !important;
......@@ -210,9 +162,9 @@ table.round-borders {
padding:20px;
}
body {
background: #eaeaea;
}
//body {
//background: #eaeaea;
//}
a {
color: #111;
......@@ -383,23 +335,19 @@ input.ssh_project_url {
border-width: 1px;
}
tbody tr:nth-child(2n) td, tbody tr.even td {
background: none repeat scroll 0 0 #F7FBFC;
border-top: 1px solid #E2EAEE;
border-bottom: 1px solid #E2EAEE;
}
.top_menu_count {
background: none repeat scroll 0 0 #FFF6BF;
border-color: #FFD324;
color: #514721;
border: 1px solid #DDDDDD;
background: none repeat scroll 0 0 white;
color: #333;
border-color: #4BB8D2;
padding: 2px;
font-size:12px;
position:relative;
top:-14px;
left:10px;
font-size:10px;
border-top:none;
text-align:center;
float:right;
width:25px;
}
#logo {
......@@ -411,7 +359,7 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
text-shadow: #555 1px 1px;
}
/** FALSH **/
/** FLASH **/
#flash_container {
height:40px;
......@@ -429,6 +377,7 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
color:#444;
font-size:22px;
padding-top:5px;
margin:2px;
}
}
......@@ -682,9 +631,9 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
}
.top_panel_issues{
#issue_search_form {
margin:5px 0;
input {
#issue_search_form {
margin:5px 0;
input {
border:1px solid #D3D3D3;
padding: 3px;
height: 28px;
......@@ -693,10 +642,67 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
box-sizing: border-box;
-moz-box-sizing: border-box;
&:focus {
&:focus {
border-color:#c2e1ef;
}
}
}
}
.left {
float:left;
}
.right {
float:right;
}
.width-50p{
width:50%;
}
.width-49p{
width:49%;
}
.width-30p{
width:30%;
}
.width-65p{
width:65%;
}
pre.commit_message {
white-space: pre-wrap;
}
#container {
min-height:100%;
}
.ui-selectmenu{
@include round-borders-all(4px);
margin-right:10px;
font-size:1.5em;
height:auto;
font-weight:bold;
.ui-selectmenu-status {
padding:3px 10px;
}
}
td.code {
width: 100%;
.highlight {
margin-left: 55px;
overflow:auto;
overflow-y:hidden;
}
}
.highlight pre {
white-space: pre;
word-wrap:normal;
}
.highlighttable tr:hover {
background:white;
}
table.highlighttable pre{
line-height:16px !important;
font-size:12px !important;
}
This diff is collapsed.
class Admin::MailerController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :authenticate_admin!
......
class Admin::ProjectsController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :authenticate_admin!
......
class Admin::TeamMembersController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :authenticate_admin!
......
class Admin::UsersController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :authenticate_admin!
......
......@@ -8,8 +8,18 @@ class ApplicationController < ActionController::Base
render :file => File.join(Rails.root, "public", "gitosis_error"), :layout => false
end
layout :layout_by_resource
protected
def layout_by_resource
if devise_controller?
"devise"
else
"application"
end
end
def abilities
@abilities ||= Six.new
end
......
......@@ -2,6 +2,7 @@ require "base64"
class CommitsController < ApplicationController
before_filter :project
layout "project"
# Authorize
before_filter :add_project_abilities
......
class DashboardController < ApplicationController
def index
@projects = current_user.projects.all
@active_projects = @projects.select(&:last_activity_date).sort_by(&:last_activity_date).reverse
end
end
......@@ -2,6 +2,7 @@ class IssuesController < ApplicationController
before_filter :authenticate_user!
before_filter :project
before_filter :issue, :only => [:edit, :update, :destroy, :show]
layout "project"
# Authorize
before_filter :add_project_abilities
......@@ -41,7 +42,7 @@ class IssuesController < ApplicationController
def create
@issue = @project.issues.new(params[:issue])
@issue.author = current_user
if @issue.save
if @issue.save && @issue.assignee != current_user
Notify.new_issue_email(@issue).deliver
end
......
class KeysController < ApplicationController
layout "profile"
respond_to :js
def index
......
class ProfileController < ApplicationController
layout "profile"
def show
@user = current_user
end
......
class ProjectsController < ApplicationController
before_filter :project, :except => [:index, :new, :create]
layout :determine_layout
# Authorize
before_filter :add_project_abilities
......@@ -152,4 +153,12 @@ class ProjectsController < ApplicationController
def project
@project ||= Project.find_by_code(params[:id])
end
def determine_layout
if @project && !@project.new_record?
"project"
else
"application"
end
end
end
class SnippetsController < ApplicationController
before_filter :authenticate_user!
before_filter :project
layout "project"
# Authorize
before_filter :add_project_abilities
......
class TeamMembersController < ApplicationController
before_filter :project
layout "project"
# Authorize
before_filter :add_project_abilities
......
......@@ -28,6 +28,12 @@ module ApplicationHelper
else
"Never"
end
rescue
"Never"
end
def markdown(text)
RDiscount.new(text, :autolink, :no_pseudo_protocols, :safelink, :smart, :filter_html).to_html.html_safe
end
def search_autocomplete_source
......
module DashboardHelper
def dashboard_feed_path(project, object)
case object.class.name.to_s
when "Issue" then project_issues_path(project, project.issues.find(object.id))
when "Grit::Commit" then project_commit_path(project, project.repo.commits(object.id).first)
when "Note"
then
note = object
case note.noteable_type
when "Issue" then project_issue_path(project, note.noteable_id)
when "Snippet" then project_snippet_path(project, note.noteable_id)
when "Commit" then project_commit_path(project, :id => note.noteable_id)
else wall_project_path(project)
end
else "#"
end
rescue
"#"
end
def dashboard_feed_title(object)
title = case object.class.name.to_s
when "Note" then markdown(object.note)
when "Issue" then object.title
when "Grit::Commit" then object.safe_message
else ""
end
"[#{object.class.name}] #{truncate(sanitize(title, :tags => []), :length => 60)} "
end
end
......@@ -10,6 +10,11 @@ class Issue < ActiveRecord::Base
validates_presence_of :assignee_id
validates_presence_of :author_id
delegate :name,
:email,
:to => :author,
:prefix => true
validates :title,
:presence => true,
:length => { :within => 0..255 }
......
......@@ -7,6 +7,11 @@ class Note < ActiveRecord::Base
belongs_to :author,
:class_name => "User"
delegate :name,
:email,
:to => :author,
:prefix => true
attr_protected :author, :author_id
validates_presence_of :project
......
......@@ -119,6 +119,26 @@ class Project < ActiveRecord::Base
repo rescue false
end
def last_activity
updates(1).first
rescue
nil
end
def last_activity_date
last_activity.try(:created_at)
end
def updates(n = 3)
[
fresh_commits(n),
issues.last(n),
notes.fresh.limit(n)
].compact.flatten.sort do |x, y|
y.created_at <=> x.created_at
end[0...n]
end
def commit(commit_id = nil)
if commit_id
repo.commits(commit_id).first
......@@ -131,16 +151,16 @@ class Project < ActiveRecord::Base
@heads ||= repo.heads
end
def fresh_commits
def fresh_commits(n = 10)
commits = heads.map do |h|
repo.commits(h.name, 10)
repo.commits(h.name, n)
end.flatten.uniq { |c| c.id }
commits.sort! do |x, y|
y.committed_date <=> x.committed_date
end
commits[0..10]
commits[0...n]
end
def commits_since(date)
......
%div.top_project_menu
%span= link_to "Users", admin_users_path, :style => "width:50px;", :class => controller.controller_name == "users" ? "current" : nil
%span= link_to "Projects", admin_projects_path, :style => "width:50px;", :class => controller.controller_name == "projects" ? "current" : nil
%span= link_to "Teams", admin_team_members_path, :style => "width:50px;", :class => controller.controller_name == "team_members" ? "current" : nil
%span= link_to "Emails", admin_emails_path, :style => "width:50px;", :class => controller.controller_name == "mailer" ? "current" : nil
%table
%tr
%thead
%th Name
%th Code
%th Path
......
- @admin_team_members.group_by(&:project).sort.each do |project, members|
%h3= link_to project.name, [:admin, project]
%table
%tr
%thead
%th Name
%th Email
%th Read
......
%table
%tr
%thead
%th Admin
%th Name
%th Email
......
- @commits.group_by { |c| c.committed_date.to_date }.each do |day, commits|
.day-commits-table
.day-header
%div{ :class => "commits-date ui-box ui-box-small ui-box-big" }
.day-commits-table
%h3= day.stamp("28 Aug, 2010")
%ul
- commits.each do |commit|
%li{ :class => "commit", :url => project_commit_path(@project, :id => commit.id) }
- if commit.author.email
= image_tag gravatar_icon(commit.author.email), :class => "left", :width => 40, :style => "padding-right:5px;"
- else
= image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"
%p
%strong
= truncate(commit.safe_message, :length => 60)
= link_to "Browse Code", tree_project_path(@project, :commit_id => commit.id), :class => "lite_button", :style => "float:right"
= link_to truncate(commit.id.to_s, :length => 16), project_commit_path(@project, :id => commit.id), :class => "lite_button", :style => "width:120px;float:right"
%span
%span.author
= commit.author
= time_ago_in_words(commit.committed_date)
ago
.data
- commits.each do |commit|
%a{ :class => "commit", :href => project_commit_path(@project, :id => commit.id) }
%span.commit-info
%data.commit-button
= truncate(commit.id.to_s, :length => 16)
%i
%data.commit-browse{ :onclick => "location.href='#{tree_project_path(@project, :commit_id => commit.id)}';return false;"}
Browse Code
- if commit.author_email
= image_tag gravatar_icon(commit.author_email), :class => "left", :width => 40, :style => "padding-right:5px;"
- else
= image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"
%span.commit-title
%strong
= truncate(commit.safe_message, :length => 60)
%span.commit-author
%strong= commit.author_name
= time_ago_in_words(commit.committed_date)
ago
= more_commits_link if @commits.size > 99
%div
%h3
.left
= form_tag project_commits_path(@project), :method => :get do
= select_tag "branch", options_for_select(@repo.heads.map(&:name), @branch), :onchange => "this.form.submit();", :class => "", :prompt => "Branches"
&nbsp;
.left.prepend-1
= form_tag project_commits_path(@project), :method => :get do
= select_tag "tag", options_for_select(@project.tags, @tag), :onchange => "this.form.submit();", :class => "", :prompt => "Tags"
= text_field_tag "ssh", @project.url_to_repo, :class => ["ssh_project_url", "one_click_select"]
.clear
- content_for(:body_class, "project-page commits-page")
.left
= form_tag project_commits_path(@project), :method => :get do
= select_tag "branch", options_for_select(@repo.heads.map(&:name), @branch), :onchange => "this.form.submit();", :class => "", :prompt => "Branches"
.left
= form_tag project_commits_path(@project), :method => :get do
= select_tag "tag", options_for_select(@project.tags, @tag), :onchange => "this.form.submit();", :class => "", :prompt => "Tags"
.clear
%br
-#%a.right.button{:href => "#"} Download
-#-if can? current_user, :admin_project, @project
%a.right.button.blue{:href => "#"} EDIT
%h2.icon
%span
%a.project-name{:href => "#"}
%i.arrow>
Project
&nbsp;
%d
%a{:href => "#"}
= @ref
- if params[:path]
%h3{:style => "color:#555"} /#{params[:path]}
%div{:id => dom_id(@project)}
= render "commits"
&nbsp;
%d
%a{:href => "#"}= params[:path].split("/").join(" / ")
%div{:id => dom_id(@project)}
= render "commits"
......@@ -7,7 +7,7 @@
%td= @commit.id
%tr
%td Author
%td= @commit.author
%td= @commit.author_name
%tr
%td Commiter
%td= @commit.committer
......@@ -16,7 +16,9 @@
%td= @commit.committed_date
%tr
%td Message
%td= @commit.safe_message
%td
%pre.commit_message
= preserve @commit.safe_message
%tr
%td Tree
%td= link_to 'Browse Code', tree_project_path(@project, :commit_id => @commit.id)
......
timeline
- content_for(:body_class, "dashboard-page")
#dashboard-content.dashboard-content.content
%aside
%h4
- if current_user.can_create_project?
%a.button-small.button-green{:href => new_project_path} New Repository
Your Repositories
%ol.project-list
- @projects.each do |project|
%li
%a{:href => project_path(project)}
%span.arrow
%span.project-name= project.name
%span.time
%strong Last activity:
= project.last_activity_date ? time_ago_in_words(project.last_activity_date) + " ago" : "Never"
#news-feed.news-feed
%h2.icon
%span>
Dashboard
- @active_projects.first(3).each do |project|
.project-box.project-updates.ui-box.ui-box-small.ui-box-big
%h3= project.name
.data
- project.updates.each do |update|
%a.project-update{:href => dashboard_feed_path(project, update)}
= image_tag gravatar_icon(update.author_email), :class => "left", :width => 40
%span.update-title
= dashboard_feed_title(update)
%span.update-author
%strong= update.author_name
authored
= time_ago_in_words(update.created_at)
ago
%br
/ .project-update
/ .project-updates
/ #news-feed
/ #dashboard-content
<h2>Forgot your password?</h2>
<div class="span-12 colborder">
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.submit "Send me reset password instructions", :class => "lbutton vm" %></div>
<% end %>
</div>
<div>
<%= render :partial => "devise/shared/links" %>
</div>
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :class => "login-box", :method => :post }) do |f| %>
<%= image_tag "login-logo.png", :width => "304", :height => "66", :class => "login-logo", :alt => "Login Logo" %>
<%= devise_error_messages! %>
<%= f.email_field :email, :placeholder => "Email", :class => "text top" %>
<br/>
<%= f.submit "Reset password", :class => "grey-button" %>
<div class="right"> <%= render :partial => "devise/shared/links" %></div>
<% end %>
<h2>Sign in</h2>
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => "login-box" }) do |f| %>
<%= image_tag "login-logo.png", :width => "304", :height => "66", :class => "login-logo", :alt => "Login Logo" %>
<%= f.text_field :email, :class => "text top", :placeholder => "Email" %>
<%= f.password_field :password, :class => "text bottom", :placeholder => "Password" %>
<div class="span-12 colborder">
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
<div><%= f.label :email %><br />
<%= f.text_field :email %></div>
<div><%= f.label :password %><br />
<%= f.password_field :password %></div>
<% if devise_mapping.rememberable? -%>
<div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
<% end -%>
<br/>
<div><%= f.submit "Sign in", :class => "lbutton vm" %></div>
<% end %>
</div>
<div>
<%= render :partial => "devise/shared/links" %>
</div>
<% if devise_mapping.rememberable? -%>
<div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
<% end -%>
<br/>
<%= f.submit "Sign in", :class => "grey-button" %>
<div class="right"> <%= render :partial => "devise/shared/links" %></div>
<% end %>
%table.round-borders#issues-table
%tr
%thead
- if can?(current_user, :admin_issue, @project) && !params[:f] || params[:f] == "0"
%th
%th Assignee
......
%h2
= "Issue ##{@issue.id} - #{html_escape(@issue.title)}"
.span-15
.left.width-65p
-#= simple_format html_escape(@issue.content)
.issue_notes= render "notes/notes"
.span-8.right
.right.width-30p
.span-8
- if @issue.closed
%center.success Closed
......
<div id="header-panel">
<!-- Page Header -->
<header>
<h1 class="logo">
<a href="/">GITLAB</a></h1>
<div class="login-top">
<%= link_to profile_path, :class => "pic" do %>
<%= image_tag gravatar_icon(current_user.email) %>
<% end %>
<%= link_to profile_path, :class => "username" do %>
<%= current_user.name %>
<% end %>
<%= link_to 'Logout', destroy_user_session_path, :class => "logout", :method => :delete %>
</div>
<div class="search">
<%= text_field_tag "search", nil, :placeholder => "Search", :class => "search-input" %>
</div>
<!-- .login-top -->
<nav>
<%= link_to dashboard_path, :class => current_page?(root_path) ? "current dashboard" : "dashboard" do %>
<span></span>Dashboard
<% end %>
<%= link_to projects_path, :class => current_page?(projects_path) ? "current project" : "project" do %>
<span></span>Projects
<% end %>
<%= link_to((current_user.is_admin? ? admin_root_path : "#"), :class => (admin_namespace? ? "current admin" : "admin")) do %>
<span></span>Admin
<% end %>
</nav>
</header>
<!-- eo Page Header -->
<div id="header-panel" style="display:none">
<div class="container">
<div class="span-24">
<div class="span-10">
<%#= image_tag "git.png", :height => 40, :class => "left" %>
<%#= link_to "gitlab", root_path, :id => "logo" %>
<span class="search-holder">
<%= text_field_tag "search", nil, :placeholder => "Search" %>
</span>
</div>
<div class="right">
<%= link_to truncate(@project.name, :length => 20), project_path(@project), :class => "current button" if @project && !@project.new_record? %>
<%= link_to 'Projects', projects_path, :class => current_page?(projects_path) ? "current button" : "button" %>
<%= link_to('Admin', admin_root_path, :class => admin_namespace? ? "current button" : "button" ) if current_user.is_admin? %>
<%= link_to profile_path, :class => ((controller.controller_name == "keys" || controller.controller_name == "profile") ? "current button" : "button") do %>
<%= image_tag gravatar_icon(current_user.email) %>
<%= current_user.name.split(" ").first %>
<% end %>
<%= link_to 'Logout', destroy_user_session_path, :style => "border-left: 1px solid #666;", :class => "button", :method => :delete %>
</div>
</div>
</div>
......
- if content_for?(:page_title)
= yield :page_title
!!!
%html
%head
%title
GitLab #{" - #{@project.name}" if @project && !@project.new_record?}
= stylesheet_link_tag "application"
= javascript_include_tag "application"
= csrf_meta_tags
%link{:href => "/assets/favicon.png", :rel => "icon", :type => "image/png"}/
= javascript_tag do
REQ_URI = "#{request.env["REQUEST_URI"]}";
REQ_REFFER = "#{request.env["HTTP_REFERER"]}";
%body{ :class => content_for?(:body_class) ? yield(:body_class) : 'project-page', :id => yield(:boyd_id)}
#container
= render :partial => "layouts/flash"
= render :partial => "layouts/head_panel"
.project-container
.project-sidebar
.fixed
%aside
= link_to "Users", admin_users_path, :class => controller.controller_name == "users" ? "current" : nil
= link_to "Projects", admin_projects_path, :class => controller.controller_name == "projects" ? "current" : nil
= link_to "Teams", admin_team_members_path, :class => controller.controller_name == "team_members" ? "current" : nil
= link_to "Emails", admin_emails_path, :class => controller.controller_name == "mailer" ? "current" : nil
.project-content
= yield
......@@ -3,10 +3,10 @@
%head
%title
GitLab #{" - #{@project.name}" if @project && !@project.new_record?}
= stylesheet_link_tag 'blueprint/screen', :media => "screen, projection"
= stylesheet_link_tag 'blueprint/print', :media => "print"
= stylesheet_link_tag 'blueprint/plugins/buttons/screen', :media => "screen, projection"
= stylesheet_link_tag 'blueprint/plugins/link-icons/screen', :media => "screen, projection"
-#= stylesheet_link_tag 'blueprint/screen', :media => "screen, projection"
-#= stylesheet_link_tag 'blueprint/print', :media => "print"
-#= stylesheet_link_tag 'blueprint/plugins/buttons/screen', :media => "screen, projection"
-#= stylesheet_link_tag 'blueprint/plugins/link-icons/screen', :media => "screen, projection"
= stylesheet_link_tag "application"
= javascript_include_tag "application"
= csrf_meta_tags
......@@ -14,15 +14,10 @@
= javascript_tag do
REQ_URI = "#{request.env["REQUEST_URI"]}";
REQ_REFFER = "#{request.env["HTTP_REFERER"]}";
%body#thebody
= render :partial => "layouts/flash"
- if user_signed_in?
%body{ :class => yield(:body_class), :id => yield(:boyd_id)}
#container
= render :partial => "layouts/flash"
= render :partial => "layouts/head_panel"
.top_bar.container
= render :partial => "projects/top_menu" if @project && !@project.new_record?
= render :partial => "projects/projects_top_menu" if (controller.controller_name == "projects" && ["index", "new", "create"].include?(controller.action_name)) && !admin_namespace?
= render :partial => "profile/top_menu" if ["keys", "profile"].include?(controller.controller_name)
= render :partial => "admin/top_menu" if admin_namespace?
#content-container.container
.span-24
%div{ :id => "main", :role => "main", :class => "container_4" }
= render :partial => "layouts/page_title"
= yield
!!!
%html
%head
%title
GitLab #{" - #{@project.name}" if @project && !@project.new_record?}
= stylesheet_link_tag "application"
= javascript_include_tag "application"
= csrf_meta_tags
%link{:href => "/assets/favicon.png", :rel => "icon", :type => "image/png"}/
= javascript_tag do
REQ_URI = "#{request.env["REQUEST_URI"]}";
REQ_REFFER = "#{request.env["HTTP_REFERER"]}";
%body.login-page
= render :partial => "layouts/flash"
= yield
!!!
%html
%head
%title
GitLab #{" - #{@project.name}" if @project && !@project.new_record?}
= stylesheet_link_tag "application"
= javascript_include_tag "application"
= csrf_meta_tags
%link{:href => "/assets/favicon.png", :rel => "icon", :type => "image/png"}/
= javascript_tag do
REQ_URI = "#{request.env["REQUEST_URI"]}";
REQ_REFFER = "#{request.env["HTTP_REFERER"]}";
%body{ :class => content_for?(:body_class) ? yield(:body_class) : 'project-page', :id => yield(:boyd_id)}
#container
= render :partial => "layouts/flash"
= render :partial => "layouts/head_panel"
.project-container
.project-sidebar
.fixed
%aside
= link_to "Profile", profile_path, :class => current_page?(:controller => "profile", :action => :show) ? "current" : nil
= link_to "Password", profile_password_path, :class => current_page?(:controller => "profile", :action => :password) ? "current" : nil
= link_to keys_path, :class => controller.controller_name == "keys" ? "current" : nil do
Keys
- unless current_user.keys.empty?
%span{ :class => "number" }= current_user.keys.count
.project-content
= yield
!!!
%html
%head
%title
GitLab #{" - #{@project.name}" if @project && !@project.new_record?}
= stylesheet_link_tag "application"
= javascript_include_tag "application"
= csrf_meta_tags
%link{:href => "/assets/favicon.png", :rel => "icon", :type => "image/png"}/
= javascript_tag do
REQ_URI = "#{request.env["REQUEST_URI"]}";
REQ_REFFER = "#{request.env["HTTP_REFERER"]}";
%body{ :class => content_for?(:body_class) ? yield(:body_class) : 'project-page', :id => yield(:boyd_id)}
#container
= render :partial => "layouts/flash"
= render :partial => "layouts/head_panel"
.project-container
.project-sidebar
.fixed
%input.git-url.text{:id => "", :name => "", :readonly => "", :type => "text", :value => @project.url_to_repo}
%aside
= link_to "History", project_path(@project), :class => current_page?(:controller => "projects", :action => "show", :id => @project) ? "current" : nil
= link_to "Tree", tree_project_path(@project), :class => current_page?(:controller => "projects", :action => "tree", :id => @project) ? "current" : nil
= link_to "Commits", project_commits_path(@project), :class => current_page?(:controller => "commits", :action => "index", :project_id => @project) ? "current" : nil
= link_to team_project_path(@project), :class => (current_page?(:controller => "projects", :action => "team", :id => @project) || controller.controller_name == "team_members") ? "current" : nil do
Team
- if @project.users_projects.count > 0
%span{ :class => "number" }= @project.users_projects.count
= link_to project_issues_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do
Issues
- if @project.issues.opened.count > 0
%span{ :class => "number" }= @project.issues.opened.count
= link_to wall_project_path(@project), :class => current_page?(:controller => "projects", :action => "wall", :id => @project) ? "current" : nil do
Wall
- if @project.common_notes.count > 0
%span{ :class => "number" }= @project.common_notes.count
= link_to project_snippets_path(@project), :class => (controller.controller_name == "snippets") ? "current" : nil do
Snippets
- if @project.snippets.count > 0
%span{ :class => "number" }= @project.snippets.non_expired.count
- if @commit
= 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
.project-content
= yield
......@@ -2,7 +2,7 @@
%div.note_author
= image_tag gravatar_icon(note.author.email), :class => "left", :width => 40, :style => "padding-right:5px;"
%div.note_content.left
= simple_format(html_escape(note.note))
= markdown(note.note)
- if note.attachment.url
Attachment:
= link_to note.attachment_identifier, note.attachment.url, :target => "_blank"
......
%div.top_project_menu
%span= link_to "Profile", profile_path, :class => current_page?(:controller => "profile", :action => :show) ? "current" : nil
%span= link_to "Password", profile_password_path, :style => "width:70px;", :class => current_page?(:controller => "profile", :action => :password) ? "current" : nil
%span= link_to "Keys", keys_path, :class => controller.controller_name == "keys" ? "current" : nil
......@@ -40,7 +40,7 @@
%p{:style => "margin-bottom: 3px;"}
%span.author
= note.author.name
= link_to truncate(note.note, :length => 200), link_to_item + "#note_#{note.id}"
= link_to markdown(truncate(note.note, :length => 200)), link_to_item + "#note_#{note.id}"
- if note.attachment.url
%br
Attachment:
......
......@@ -2,7 +2,7 @@
%div#new-member-holder
= link_to "Add new", new_project_team_member_path(@project), :remote => true, :class => "lbutton vm"
%table.round-borders#team-table
%tr
%thead
%th Name
%th Email
%th Web
......
- @projects.in_groups_of(3, false) do |projects|
- projects.each_with_index do |project, i|
%div{ :class => "project_thumb round-borders", :style => i == 2 ? "" : "margin-right:30px;" }
%div{ :class => "project", :url => project_path(project) }
%h2
= image_tag gravatar_icon(project.name), :class => "left", :width => 40, :style => "padding-right:5px;"
= link_to ("/" + project.code), project_path(project), :style => "text-decoration:none"
%p= project.name
%p= project.url_to_repo
-#%p
Commit &ndash;
= last_commit(project)
%hr
= link_to "Browse Code", tree_project_path(project), :class => "lbutton"
= link_to "Commits", project_commits_path(project), :class => "lbutton", :style => "float:right;width:80px;"
.clear
%div.grid_1
%div{ :class => "project-box ui-box ui-box-big" }
= link_to project_path(project) do
%h3= project.name
.data
%p.title.repository
%span Repository:
= project.url_to_repo
%p.title.activity
%span Last Activity:
- last_note = project.notes.last
= last_note ? last_note.created_at.stamp("24 Aug, 2011") : "Never"
.buttons
%a.browse-code.button.yellow{:href => tree_project_path(project)} Browse code
%a.commits.button.green{:href => project_commits_path(project)} Commits
%div.top_project_menu
-#%span= link_to @project.code.capitalize, @project, :class => current_page?(:controller => "projects", :action => "show", :id => @project) ? "current" : nil
- if @project.repo_exists?
%span= link_to image_tag("home.png", :width => 20), project_path(@project), :class => current_page?(:controller => "projects", :action => "show", :id => @project) ? "current" : nil
%span= link_to "Tree", tree_project_path(@project), :class => current_page?(:controller => "projects", :action => "tree", :id => @project) ? "current" : nil
......
%h3
.left
= form_tag tree_project_path(@project), :method => :get do
= select_tag "branch", options_for_select(@repo.heads.map(&:name), @branch), :onchange => "this.form.submit();", :class => "", :prompt => "Branches"
&nbsp;
.left.prepend-1
= form_tag tree_project_path(@project), :method => :get do
= select_tag "tag", options_for_select(@project.tags, @tag), :onchange => "this.form.submit();", :class => "", :prompt => "Tags"
= text_field_tag "ssh", @project.url_to_repo, :class => ["ssh_project_url","one_click_select"]
.clear
%h3#tree-breadcrumbs
= link_to @project.name, tree_project_path(@project, :path => nil, :commit_id => @commit.try(:id)), :remote => true
- if params[:path]
- part_path = ""
- params[:path].split("\/").each do |part|
- part_path = File.join(part_path, part) unless part_path.empty?
- if part_path.empty?
- part_path = part
\/
= link_to truncate(part, :length => 40), tree_file_project_path(@project, :path => part_path, :commit_id => @commit.try(:id), :branch => @branch, :tag => @tag), :remote => :true
.left
= form_tag tree_project_path(@project), :method => :get do
= select_tag "branch", options_for_select(@repo.heads.map(&:name), @branch), :onchange => "this.form.submit();", :class => "", :prompt => "Branches"
.left
= form_tag tree_project_path(@project), :method => :get do
= select_tag "tag", options_for_select(@project.tags, @tag), :onchange => "this.form.submit();", :class => "", :prompt => "Tags"
.clear
%br
-#%a.right.button{:href => "#"} Download
-#-if can? current_user, :admin_project, @project
%a.right.button.blue{:href => "#"} EDIT
#tree-breadcrumbs
%h2.icon
%span
= link_to tree_project_path(@project, :path => nil, :commit_id => @commit.try(:id)), :remote => true, :class => 'project-name' do
%i.arrow>
= @project.name
&nbsp;
%d
%a{:href => "#"}
= @ref
- if params[:path]
- part_path = ""
- params[:path].split("\/").each do |part|
- part_path = File.join(part_path, part) unless part_path.empty?
- if part_path.empty?
- part_path = part
\/
= link_to truncate(part, :length => 40), tree_file_project_path(@project, :path => part_path, :commit_id => @commit.try(:id), :branch => @branch, :tag => @tag), :remote => :true
.clear
#tree-content-holder
- if tree.is_a?(Grit::Blob)
= render :partial => "projects/tree_file", :locals => { :name => tree.name, :content => tree.data, :file => tree }
- else
- contents = tree.contents
%table#tree-slider.round-borders
%tr
%thead
%th Name
%th Last Update
%th
......
- content_for(:body_class, "projects-page")
- content_for(:page_title) do
.grid_4
- if current_user.can_create_project?
%a.grey-button.right{:href => new_project_path} Create new project
%h2.icon
%span
Projects
- unless @projects.empty?
%div{:class => "tile", :style => view_mode_style("tile")}
= render "tile"
......
......@@ -13,11 +13,11 @@
= label_tag "week_view","Week"
.clear
%hr
.span-11
.left.width-49p
%h3 Commits
=render "projects/recent_commits"
.span-11.right
.right.width-49p
%h3 Talk
=render "projects/recent_messages"
......
......@@ -29,4 +29,5 @@ Gitlab::Application.configure do
config.assets.debug = true
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.delivery_method = :letter_opener
end
......@@ -15,6 +15,7 @@ Gitlab::Application.routes.draw do
put "profile/password", :to => "profile#password_update"
put "profile/edit", :to => "profile#social_update"
get "profile", :to => "profile#show"
get "dashboard", :to => "dashboard#index"
#get "profile/:id", :to => "profile#show"
resources :projects, :only => [:new, :create, :index]
......@@ -53,5 +54,5 @@ Gitlab::Application.routes.draw do
end
resources :notes, :only => [:create, :destroy]
end
root :to => "projects#index"
root :to => "dashboard#index"
end
......@@ -8,4 +8,16 @@ module CommitExt
rescue
"-- invalid encoding for commit message"
end
def created_at
committed_date
end
def author_email
author.email.force_encoding(Encoding::UTF_8)
end
def author_name
author.name.force_encoding(Encoding::UTF_8)
end
end
No preview for this file type
......@@ -62,6 +62,51 @@ describe Project do
end
end
describe "updates" do
let(:project) { Factory :project }
before do
@issue = Factory :issue,
:project => project,
:author => Factory(:user),
:assignee => Factory(:user)
@note = Factory :note,
:project => project,
:author => Factory(:user)
@commit = project.fresh_commits(1).first
end
describe "return commit, note & issue" do
it { project.updates(3).count.should == 3 }
it { project.updates(3).last.id.should == @commit.id }
it { project.updates(3).include?(@issue).should be_true }
it { project.updates(3).include?(@note).should be_true }
end
end
describe "last_activity" do
let(:project) { Factory :project }
before do
@note = Factory :note,
:project => project,
:author => Factory(:user)
end
it { project.last_activity.should == @note }
it { project.last_activity_date.to_s.should == @note.created_at.to_s }
end
describe "fresh commits" do
let(:project) { Factory :project }
it { project.fresh_commits(3).count.should == 3 }
it { project.fresh_commits.first.id.should == "2fb376f61875b58bceee0492e270e9c805294b1a" }
it { project.fresh_commits.last.id.should == "0dac878dbfe0b9c6104a87d65fe999149a8d862c" }
end
describe "Git methods" do
let(:project) { Factory :project }
......
require 'spec_helper'
describe "Dashboard" do
before { login_as :user }
describe "GET /dashboard" do
before do
@project = Factory :project
@project.add_access(@user, :read, :write)
visit dashboard_path
end
it "should be on dashboard page" do
current_path.should == dashboard_path
end
it "should have projects panel" do
within ".project-list" do
page.should have_content(@project.name)
end
end
it "should have news feed" do
within "#news-feed" do
page.should have_content(@project.commit.author.name)
page.should have_content(@project.commit.safe_message)
end
end
end
end
......@@ -5,7 +5,10 @@ describe "Issues" do
before do
login_as :user
@user2 = Factory :user
project.add_access(@user, :read, :write)
project.add_access(@user2, :read, :write)
end
describe "GET /issues" do
......@@ -49,20 +52,20 @@ describe "Issues" do
end
it "should show only open" do
should have_content(@issue.title)
should have_content(@issue.title[0..25])
should have_no_content(@closed_issue.title)
end
it "should show only closed" do
choose "closed_issues"
should have_no_content(@issue.title)
should have_content(@closed_issue.title)
should have_content(@closed_issue.title[0..25])
end
it "should show all" do
choose "all_issues"
should have_content(@issue.title)
should have_content(@closed_issue.title)
should have_content(@issue.title[0..25])
should have_content(@closed_issue.title[0..25])
end
end
end
......@@ -78,35 +81,66 @@ describe "Issues" do
end
describe "fill in" do
before do
fill_in "issue_title", :with => "bug 345"
click_link "Select user"
click_link @user.name
end
it { expect { click_button "Save" }.to change {Issue.count}.by(1) }
it "should add new issue to table" do
click_button "Save"
page.should_not have_content("Add new issue")
page.should have_content @user.name
page.should have_content "bug 345"
page.should have_content project.name
describe 'assign to me' do
before do
fill_in "issue_title", :with => "bug 345"
click_link "Select user"
within "#issue_assignee_id-menu" do
click_link @user.name
end
end
it { expect { click_button "Save" }.to change {Issue.count}.by(1) }
it "should add new issue to table" do
click_button "Save"
page.should_not have_content("Add new issue")
page.should have_content @user.name
page.should have_content "bug 345"
page.should have_content project.name
end
it "should call send mail" do
Notify.should_not_receive(:new_issue_email)
click_button "Save"
end
end
it "should call send mail" do
Notify.should_receive(:new_issue_email).and_return(stub(:deliver => true))
click_button "Save"
end
describe 'assign to other' do
before do
fill_in "issue_title", :with => "bug 345"
click_link "Select user"
within "#issue_assignee_id-menu" do
click_link @user2.name
end
end
it { expect { click_button "Save" }.to change {Issue.count}.by(1) }
it "should add new issue to table" do
click_button "Save"
page.should_not have_content("Add new issue")
page.should have_content @user2.name
page.should have_content "bug 345"
page.should have_content project.name
end
it "should call send mail" do
Notify.should_receive(:new_issue_email).and_return(stub(:deliver => true))
click_button "Save"
end
it "should send valid email to user with email & password" do
click_button "Save"
issue = Issue.last
email = ActionMailer::Base.deliveries.last
email.subject.should have_content("New Issue was created")
email.body.should have_content(issue.title)
email.body.should have_content(issue.assignee.name)
end
it "should send valid email to user with email & password" do
click_button "Save"
issue = Issue.last
email = ActionMailer::Base.deliveries.last
email.subject.should have_content("New Issue was created")
email.body.should have_content(issue.title)
email.body.should have_content(issue.assignee.name)
end
end
end
......
......@@ -13,14 +13,14 @@ describe "Projects" do
end
it "should have link to new project" do
page.should have_content("New Project")
page.should have_content("Create new project")
end
end
describe "GET /projects/new" do
before do
visit projects_path
click_link "New Project"
click_link "Create new project"
end
it "should be correct path" do
......
......@@ -12,15 +12,15 @@ module LoginMacros
end
visit new_user_session_path
fill_in "Email", :with => @user.email
fill_in "Password", :with => "123456"
fill_in "user_email", :with => @user.email
fill_in "user_password", :with => "123456"
click_button "Sign in"
end
def login_with(user)
visit new_user_session_path
fill_in "Email", :with => user.email
fill_in "Password", :with => "123456"
fill_in "user_email", :with => user.email
fill_in "user_password", :with => "123456"
click_button "Sign in"
end
......
......@@ -445,7 +445,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
* http://docs.jquery.com/UI/Dialog#theming
*/
.ui-dialog { position: absolute; padding: 0; width: 300px; overflow: hidden; }
.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; background: #333; color:#eaeaea }
.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; background: #F7F7F7; color:#555; }
.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0;}
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; background:#eaeaea}
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment