Commit b8ca1d62 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'dev'

Conflicts:
	app/assets/images/ajax-loader.gif
	public/favicon.ico
parents 23187d60 1d1b5186
......@@ -5,7 +5,7 @@ gem 'rails', '3.1.0'
gem 'sqlite3'
gem 'devise', "1.4.7"
gem 'stamp'
gem 'will_paginate', '~> 3.0'
gem 'kaminari'
gem 'haml-rails'
gem 'jquery-rails'
gem 'grit', :git => 'git://github.com/gitlabhq/grit.git'
......@@ -16,10 +16,12 @@ gem 'faker'
gem 'seed-fu', :git => 'git://github.com/mbleigh/seed-fu.git'
gem "inifile"
gem "pygments.rb", "0.2.3"
gem "kaminari"
gem "thin"
gem "git"
gem "acts_as_list"
gem 'rdiscount'
gem 'acts-as-taggable-on', '~>2.1.0'
group :assets do
gem 'sass-rails', " ~> 3.1.0"
......@@ -27,14 +29,15 @@ 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
group :development, :test do
gem 'rspec-rails'
gem 'shoulda'
gem "shoulda", "~> 3.0.0.beta2"
gem 'capybara'
gem 'autotest'
gem 'autotest-rails'
......
......@@ -54,6 +54,8 @@ GEM
activesupport (= 3.1.0)
activesupport (3.1.0)
multi_json (~> 1.0)
acts-as-taggable-on (2.1.1)
rails
acts_as_list (0.1.4)
addressable (2.2.6)
ansi (1.3.0)
......@@ -119,6 +121,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 +165,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)
......@@ -200,7 +205,11 @@ GEM
ffi (>= 1.0.7)
json_pure
rubyzip
shoulda (2.11.3)
shoulda (3.0.0.beta2)
shoulda-context (~> 1.0.0.beta1)
shoulda-matchers (~> 1.0.0.beta1)
shoulda-context (1.0.0.beta1)
shoulda-matchers (1.0.0.beta3)
simplecov (0.5.3)
multi_json (~> 1.0.3)
simplecov-html (~> 0.5.3)
......@@ -232,7 +241,6 @@ GEM
multi_json (>= 1.0.2)
warden (1.0.5)
rack (>= 1.0)
will_paginate (3.0.0)
xpath (0.1.4)
nokogiri (~> 1.3)
......@@ -240,6 +248,7 @@ PLATFORMS
ruby
DEPENDENCIES
acts-as-taggable-on (~> 2.1.0)
acts_as_list
annotate!
autotest
......@@ -258,14 +267,16 @@ 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)
seed-fu!
shoulda
shoulda (~> 3.0.0.beta2)
simplecov
six
sqlite3
......@@ -274,4 +285,3 @@ DEPENDENCIES
thin
turn
uglifier
will_paginate (~> 3.0)
[Dolphin]
ShowPreview=true
Timestamp=2011,9,14,20,34,18
Timestamp=2011,10,28,13,16,25
Version=2
......@@ -5,11 +5,15 @@
// the compiled file.
//
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require jquery.ui.selectmenu
//= require jquery.tagify
//= require jquery.cookie
//= require_tree .
$(function(){
$(".one_click_select").click(function(){
$(".one_click_select").live("click", function(){
$(this).select();
});
......@@ -17,6 +21,6 @@ $(function(){
$('select#tag').selectmenu({style:'popup', width:200});
});
function updatePage(){
$.ajax({type: "GET", url: location.href, dataType: "script"});
function updatePage(data){
$.ajax({type: "GET", url: location.href, data: data, dataType: "script"});
}
This diff is collapsed.
......@@ -7,3 +7,51 @@ $(document).ready(function(){
}
});
});
var CommitsList = {
ref:null,
limit:0,
offset:0,
init:
function(ref, limit) {
this.ref=ref;
this.limit=limit;
this.offset=limit;
this.initLoadMore();
$('.loading').show();
},
getOld:
function() {
$('.loading').show();
$.ajax({
type: "GET",
url: location.href,
data: "limit=" + this.limit + "&offset=" + this.offset + "&ref=" + this.ref,
complete: function(){ $('.loading').hide()},
dataType: "script"});
},
append:
function(count, html) {
$("#commits_list").append(html);
if(count > 0) {
this.offset += count;
this.initLoadMore();
}
},
initLoadMore:
function() {
$(window).bind('scroll', function(){
if($(window).scrollTop() == $(document).height() - $(window).height()){
$(window).unbind('scroll');
CommitsList.getOld();
}
});
}
}
This diff is collapsed.
var NoteList = {
first_id: 0,
last_id: 0,
resource_name: null,
init:
function(resource_name, first_id, last_id) {
this.resource_name = resource_name;
this.first_id = first_id;
this.last_id = last_id;
this.initRefresh();
this.initLoadMore();
},
getOld:
function() {
$('.loading').show();
$.ajax({
type: "GET",
url: location.href,
data: "first_id=" + this.first_id,
complete: function(){ $('.loading').hide()},
dataType: "script"});
},
append:
function(id, html) {
this.first_id = id;
$("#notes-list").append(html);
this.initLoadMore();
},
replace:
function(fid, lid, html) {
this.first_id = fid;
this.last_id = lid;
$("#notes-list").html(html);
this.initLoadMore();
},
prepend:
function(id, html) {
this.last_id = id;
$("#notes-list").prepend(html);
},
getNew:
function() {
// refersh notes list
$.ajax({
type: "GET",
url: location.href,
data: "last_id=" + this.last_id,
dataType: "script"});
},
refresh:
function() {
// refersh notes list
$.ajax({
type: "GET",
url: location.href,
data: "first_id=" + this.first_id + "&last_id=" + this.last_id,
dataType: "script"});
},
initRefresh:
function() {
// init timer
var intNew = setInterval("NoteList.getNew()", 15000);
var intRefresh = setInterval("NoteList.refresh()", 90000);
},
initLoadMore:
function() {
$(window).bind('scroll', function(){
if($(window).scrollTop() == $(document).height() - $(window).height()){
$(window).unbind('scroll');
NoteList.getOld();
}
});
}
}
......@@ -8,7 +8,7 @@ $(document).ready(function(){
e.stopPropagation();
$(this).find("td.tree-item-file-name a").click();
return false;
}
}
});
$("#projects-list .project").live('click', function(e){
......
......@@ -2,6 +2,9 @@
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require jquery-ui/jquery-ui
*= require jquery-ui/jquery.ui.selectmenu
*= require jquery-ui/jquery.tagify
*= require_self
*= require_tree .
*= require_tree .
*/
This diff is collapsed.
@mixin round-borders-all($radius) {
@mixin round-borders-all($radius) {
border: 1px solid #eaeaea;
-moz-border-radius: $radius;
-webkit-border-radius: $radius;
......@@ -28,11 +28,11 @@ td.linenos{
.highlight pre{
}
.linenodiv pre {
.linenodiv pre {
white-space:pre-line;
}
td.linenos {
td.linenos {
background:#ECECEC;
color:#777;
padding:10px 0px 0px 10px;
......@@ -42,7 +42,7 @@ td.linenos {
}
td.code .highlight {
td.code .highlight {
overflow: auto;
}
table.highlighttable pre{
......@@ -53,9 +53,8 @@ table.highlighttable pre{
text-align:left;
}
.git-empty .highlight {
@include round-borders-all(4px);
@include round-borders-all(4px);
background:#eee;
padding:5px;
//overflow-x:scroll;
......@@ -71,10 +70,9 @@ table.highlighttable pre{
.shadow{
-webkit-box-shadow:0 5px 15px #000;
-moz-box-shadow:0 5px 15px #000;
box-shadow:0 5px 15px #000;
box-shadow:0 5px 15px #000;
}
.hll { background-color: #ffffff }
.c { color: #888888; font-style: italic } /* Comment */
.err { color: #a61717; background-color: #e3d2d2 } /* Error */
......@@ -105,7 +103,7 @@ table.highlighttable pre{
.highlight .nb{color:#0086B3;} /* Name.Builtin */
.highlight .nc{color:#458;font-weight:bold;} /* Name.Class */
.highlight .no{color:#008080;} /* Name.Constant */
.highlight .ni{color:#800080;}
.highlight .ni{color:#800080;}
.highlight .ne{color:#900;font-weight:bold;} /* Name.Exception */
.highlight .nf{color:#900;font-weight:bold;} /* Name.Function */
.highlight .nn{color:#005;font-weight:bold;} /* Name.Namespace */
......
This diff is collapsed.
This diff is collapsed.
.tags-list {
padding : 0px 10px 10px 10px;
}
.tags-list a {
display: inline-block;
padding: 8px 11px 8px 11px;
margin: 1px 5px 0px 0px;
border-radius: 4px;
border: 1px solid #72bbdf;
background-color: #72bbdf;
color: #0f326d;
font-weight: bold;
font-size: 14px;
}
.small-tags a{
font-size: 9px;
display: inline-block;
padding: 2px 3px 1px 3px;
margin: 0px 3px 0px 0px;
border-radius: 2px;
background-color: #72bbdf;
color: #FFF;
text-shadow: none;
font-weight: bold;
}
\ No newline at end of file
class Admin::MailerController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :authenticate_admin!
......@@ -20,7 +21,7 @@ class Admin::MailerController < ApplicationController
else
render :file => 'notify/note_wall_email.html.haml', :layout => 'notify'
end
rescue
rescue
render :text => "Preview not avaialble"
end
......@@ -29,7 +30,7 @@ class Admin::MailerController < ApplicationController
@password = "DHasJKDHAS!"
render :file => 'notify/new_user_email.html.haml', :layout => 'notify'
rescue
rescue
render :text => "Preview not avaialble"
end
......@@ -38,7 +39,7 @@ class Admin::MailerController < ApplicationController
@user = @issue.assignee
@project = @issue.project
render :file => 'notify/new_issue_email.html.haml', :layout => 'notify'
rescue
rescue
render :text => "Preview not avaialble"
end
end
class Admin::ProjectsController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :authenticate_admin!
def index
@admin_projects = Project.page(params[:page])
respond_to do |format|
format.html # index.html.erb
format.json { render json: @admin_projects }
end
end
def show
@admin_project = Project.find_by_code(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @admin_project }
end
end
def new
@admin_project = Project.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @admin_project }
end
end
def edit
......@@ -37,28 +23,20 @@ class Admin::ProjectsController < ApplicationController
@admin_project = Project.new(params[:project])
@admin_project.owner = current_user
respond_to do |format|
if @admin_project.save
format.html { redirect_to [:admin, @admin_project], notice: 'Project was successfully created.' }
format.json { render json: @admin_project, status: :created, location: @admin_project }
else
format.html { render action: "new" }
format.json { render json: @admin_project.errors, status: :unprocessable_entity }
end
if @admin_project.save
redirect_to [:admin, @admin_project], notice: 'Project was successfully created.'
else
render :action => "new"
end
end
def update
@admin_project = Project.find_by_code(params[:id])
respond_to do |format|
if @admin_project.update_attributes(params[:project])
format.html { redirect_to [:admin, @admin_project], notice: 'Project was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @admin_project.errors, status: :unprocessable_entity }
end
if @admin_project.update_attributes(params[:project])
redirect_to [:admin, @admin_project], notice: 'Project was successfully updated.'
else
render :action => "edit"
end
end
......@@ -66,9 +44,6 @@ class Admin::ProjectsController < ApplicationController
@admin_project = Project.find_by_code(params[:id])
@admin_project.destroy
respond_to do |format|
format.html { redirect_to admin_projects_url }
format.json { head :ok }
end
redirect_to admin_projects_url
end
end
class Admin::TeamMembersController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :authenticate_admin!
def index
@admin_team_members = UsersProject.page(params[:page]).per(100).order("project_id DESC")
respond_to do |format|
format.html # index.html.erb
format.json { render json: @admin_team_members }
end
end
def show
@admin_team_member = UsersProject.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @admin_team_member }
end
end
def new
@admin_team_member = UsersProject.new(params[:team_member])
respond_to do |format|
format.html # new.html.erb
format.json { render json: @admin_team_member }
end
end
def edit
......@@ -37,14 +23,10 @@ class Admin::TeamMembersController < ApplicationController
@admin_team_member = UsersProject.new(params[:team_member])
@admin_team_member.project_id = params[:team_member][:project_id]
respond_to do |format|
if @admin_team_member.save
format.html { redirect_to admin_team_member_path(@admin_team_member), notice: 'UsersProject was successfully created.' }
format.json { render json: @admin_team_member, status: :created, location: @team_member }
else
format.html { render action: "new" }
format.json { render json: @admin_team_member.errors, status: :unprocessable_entity }
end
if @admin_team_member.save
redirect_to admin_team_member_path(@admin_team_member), notice: 'UsersProject was successfully created.'
else
render action: "new"
end
end
......@@ -52,14 +34,10 @@ class Admin::TeamMembersController < ApplicationController
@admin_team_member = UsersProject.find(params[:id])
@admin_team_member.project_id = params[:team_member][:project_id]
respond_to do |format|
if @admin_team_member.update_attributes(params[:team_member])
format.html { redirect_to admin_team_member_path(@admin_team_member), notice: 'UsersProject was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @admin_team_member.errors, status: :unprocessable_entity }
end
if @admin_team_member.update_attributes(params[:team_member])
redirect_to admin_team_member_path(@admin_team_member), notice: 'UsersProject was successfully updated.'
else
render action: "edit"
end
end
......@@ -67,9 +45,6 @@ class Admin::TeamMembersController < ApplicationController
@admin_team_member = UsersProject.find(params[:id])
@admin_team_member.destroy
respond_to do |format|
format.html { redirect_to admin_team_members_url }
format.json { head :ok }
end
redirect_to admin_team_members_url
end
end
class Admin::UsersController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :authenticate_admin!
def index
@admin_users = User.page(params[:page])
respond_to do |format|
format.html # index.html.erb
format.json { render json: @admin_users }
end
end
def show
@admin_user = User.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @admin_user }
end
end
def new
@admin_user = User.new(:projects_limit => 10)
respond_to do |format|
format.html # new.html.erb
format.json { render json: @admin_user }
end
end
def edit
......@@ -36,7 +22,7 @@ class Admin::UsersController < ApplicationController
def create
admin = params[:user].delete("admin")
@admin_user = User.new(params[:user])
@admin_user = User.new(params[:user])
@admin_user.admin = (admin && admin.to_i > 0)
respond_to do |format|
......@@ -54,8 +40,8 @@ class Admin::UsersController < ApplicationController
def update
admin = params[:user].delete("admin")
if params[:user][:password].empty?
params[:user].delete(:password)
params[:user].delete(:password_confirmation)
params[:user].delete(:password)
params[:user].delete(:password_confirmation)
end
@admin_user = User.find(params[:id])
......
class ApplicationController < ActionController::Base
before_filter :authenticate_user!
before_filter :view_style
protect_from_forgery
helper_method :abilities, :can?
......@@ -8,7 +10,17 @@ class ApplicationController < ActionController::Base
render :file => File.join(Rails.root, "public", "gitosis_error"), :layout => false
end
protected
layout :layout_by_resource
protected
def layout_by_resource
if devise_controller?
"devise"
else
"application"
end
end
def abilities
@abilities ||= Six.new
......@@ -18,7 +30,7 @@ class ApplicationController < ActionController::Base
abilities.allowed?(object, action, subject)
end
def project
def project
@project ||= Project.find_by_code(params[:project_id])
end
......@@ -47,19 +59,13 @@ class ApplicationController < ActionController::Base
end
def load_refs
@branch = unless params[:branch].blank?
params[:branch]
else
nil
end
@tag = unless params[:tag].blank?
params[:tag]
else
nil
end
@ref = @branch || @tag || "master"
unless params[:ref].blank?
@ref = params[:ref]
else
@branch = params[:branch].blank? ? nil : params[:branch]
@tag = params[:tag].blank? ? nil : params[:tag]
@ref = @branch || @tag || "master"
end
end
def render_404
......@@ -69,4 +75,30 @@ class ApplicationController < ActionController::Base
def require_non_empty_project
redirect_to @project unless @project.repo_exists?
end
def view_style
if params[:view_style] == "collapsed"
cookies[:view_style] = "collapsed"
elsif params[:view_style] == "fluid"
cookies[:view_style] = ""
end
@view_mode = if cookies[:view_style] == "collapsed"
:fixed
else
:fluid
end
end
def respond_with_notes
if params[:last_id] && params[:first_id]
@notes = @notes.where("id >= ?", params[:first_id])
elsif params[:last_id]
@notes = @notes.where("id > ?", params[:last_id])
elsif params[:first_id]
@notes = @notes.where("id < ?", params[:first_id])
else
nil
end
end
end
......@@ -2,6 +2,7 @@ require "base64"
class CommitsController < ApplicationController
before_filter :project
layout "project"
# Authorize
before_filter :add_project_abilities
......@@ -12,11 +13,12 @@ class CommitsController < ApplicationController
load_refs # load @branch, @tag & @ref
@repo = project.repo
limit, offset = (params[:limit] || 20), (params[:offset] || 0)
if params[:path]
@commits = @repo.log(@ref, params[:path], :max_count => params[:limit] || 100, :skip => params[:offset] || 0)
@commits = @repo.log(@ref, params[:path], :max_count => limit, :skip => offset)
else
@commits = @repo.commits(@ref, params[:limit] || 100, params[:offset] || 0)
@commits = @repo.commits(@ref, limit, offset)
end
respond_to do |format|
......@@ -27,12 +29,12 @@ class CommitsController < ApplicationController
def show
@commit = project.repo.commits(params[:id]).first
@notes = project.notes.where(:noteable_id => @commit.id, :noteable_type => "Commit")
@notes = project.notes.where(:noteable_id => @commit.id, :noteable_type => "Commit").order("created_at DESC").limit(20)
@note = @project.notes.new(:noteable_id => @commit.id, :noteable_type => "Commit")
respond_to do |format|
format.html # show.html.erb
format.js
respond_to do |format|
format.html
format.js { respond_with_notes }
end
end
end
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
class IssuesController < ApplicationController
before_filter :authenticate_user!
before_filter :project
before_filter :project
before_filter :issue, :only => [:edit, :update, :destroy, :show]
layout "project"
# Authorize
before_filter :add_project_abilities
before_filter :authorize_read_issue!
before_filter :authorize_write_issue!, :only => [:new, :create, :close, :edit, :update, :sort]
before_filter :authorize_write_issue!, :only => [:new, :create, :close, :edit, :update, :sort]
respond_to :js
......@@ -34,14 +35,19 @@ class IssuesController < ApplicationController
end
def show
@notes = @issue.notes
@notes = @issue.notes.order("created_at DESC").limit(20)
@note = @project.notes.new(:noteable => @issue)
respond_to do |format|
format.html
format.js { respond_with_notes }
end
end
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
......@@ -57,14 +63,13 @@ class IssuesController < ApplicationController
end
end
def destroy
return access_denied! unless can?(current_user, :admin_issue, @issue)
@issue.destroy
respond_to do |format|
format.js { render :nothing => true }
format.js { render :nothing => true }
end
end
......@@ -78,7 +83,23 @@ class IssuesController < ApplicationController
render :nothing => true
end
protected
def search
terms = params['terms']
@project = Project.find(params['project'])
@issues = case params[:status].to_i
when 1 then @project.issues
when 2 then @project.issues.closed
when 3 then @project.issues.opened.assigned(current_user)
else @project.issues.opened
end
@issues = @issues.where("title LIKE ? OR content LIKE ?", "%#{terms}%", "%#{terms}%") unless terms.blank?
render :partial => 'issues'
end
protected
def issue
@issue ||= @project.issues.find(params[:id])
......
class KeysController < ApplicationController
layout "profile"
respond_to :js
def index
......@@ -24,7 +25,7 @@ class KeysController < ApplicationController
respond_to do |format|
format.html { redirect_to keys_url }
format.js { render :nothing => true }
format.js { render :nothing => true }
end
end
end
class NotesController < ApplicationController
before_filter :project
before_filter :project
# Authorize
before_filter :add_project_abilities
before_filter :authorize_write_note!, :only => [:create]
before_filter :authorize_write_note!, :only => [:create]
respond_to :js
......@@ -15,10 +15,9 @@ class NotesController < ApplicationController
notify if params[:notify] == '1'
end
respond_to do |format|
format.html {redirect_to :back}
format.js
format.js
end
end
......@@ -30,11 +29,11 @@ class NotesController < ApplicationController
@note.destroy
respond_to do |format|
format.js { render :nothing => true }
format.js { render :nothing => true }
end
end
protected
protected
def notify
@project.users.reject { |u| u.id == current_user.id } .each do |u|
......
class ProfileController < ApplicationController
layout "profile"
def show
@user = current_user
end
......@@ -14,7 +15,7 @@ class ProfileController < ApplicationController
end
def password_update
params[:user].reject!{ |k, v| k != "password" && k != "password_confirmation"}
params[:user].reject!{ |k, v| k != "password" && k != "password_confirmation"}
@user = current_user
if @user.update_attributes(params[:user])
......
class ProjectsController < ApplicationController
before_filter :project, :except => [:index, :new, :create]
before_filter :project, :except => [:index, :new, :create]
layout :determine_layout
# Authorize
before_filter :add_project_abilities
before_filter :authorize_read_project!, :except => [:index, :new, :create]
before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy]
before_filter :authorize_read_project!, :except => [:index, :new, :create]
before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy]
before_filter :require_non_empty_project, :only => [:blob, :tree]
def index
@projects = current_user.projects.all
source = current_user.projects
source = source.tagged_with(params[:tag]) unless params[:tag].blank?
@projects = source.all
end
def new
......@@ -23,7 +26,7 @@ class ProjectsController < ApplicationController
@project = Project.new(params[:project])
@project.owner = current_user
Project.transaction do
Project.transaction do
@project.save!
@project.users_projects.create!(:admin => true, :read => true, :write => true, :user => current_user)
end
......@@ -31,7 +34,7 @@ class ProjectsController < ApplicationController
respond_to do |format|
if @project.valid?
format.html { redirect_to @project, notice: 'Project was successfully created.' }
format.js
format.js
else
format.html { render action: "new" }
format.js
......@@ -51,10 +54,10 @@ class ProjectsController < ApplicationController
respond_to do |format|
if project.update_attributes(params[:project])
format.html { redirect_to project, :notice => 'Project was successfully updated.' }
format.js
format.js
else
format.html { render action: "edit" }
format.js
format.js
end
end
end
......@@ -85,13 +88,12 @@ class ProjectsController < ApplicationController
def wall
@note = Note.new
@notes = @project.common_notes.order("created_at DESC")
@notes = @notes.fresh.limit(20)
@notes = case params[:view]
when "week" then @notes.since((Date.today - 7.days).at_beginning_of_day)
when "all" then @notes.all
when "day" then @notes.since(Date.today.at_beginning_of_day)
else @notes.fresh.limit(10)
end
respond_to do |format|
format.html
format.js { respond_with_notes }
end
end
#
......@@ -105,7 +107,7 @@ class ProjectsController < ApplicationController
if params[:commit_id]
@commit = @repo.commits(params[:commit_id]).first
else
else
@commit = @repo.commits(@ref || "master").first
end
......@@ -114,7 +116,7 @@ class ProjectsController < ApplicationController
respond_to do |format|
format.html # show.html.erb
format.js do
format.js do
# diasbale cache to allow back button works
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
response.headers["Pragma"] = "no-cache"
......@@ -132,7 +134,7 @@ class ProjectsController < ApplicationController
if @tree.is_a?(Grit::Blob)
send_data(@tree.data, :type => @tree.mime_type, :disposition => 'inline', :filename => @tree.name)
else
else
head(404)
end
rescue
......@@ -147,9 +149,17 @@ class ProjectsController < ApplicationController
end
end
protected
protected
def project
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
before_filter :project
layout "project"
# Authorize
before_filter :add_project_abilities
before_filter :authorize_read_snippet!
before_filter :authorize_write_snippet!, :only => [:new, :create, :close, :edit, :update, :sort]
before_filter :authorize_write_snippet!, :only => [:new, :create, :close, :edit, :update, :sort]
respond_to :html
......@@ -13,7 +14,7 @@ class SnippetsController < ApplicationController
@snippets = @project.snippets
end
def new
def new
@snippet = @project.snippets.new
end
......
class TagsController < ApplicationController
def index
@tags = Project.tag_counts.order('count DESC')
@tags = @tags.where('name like ?', "%#{params[:term]}%") unless params[:term].blank?
respond_to do |format|
format.html
format.json { render json: @tags.limit(8).map {|t| t.name}}
end
end
end
class TeamMembersController < ApplicationController
before_filter :project
before_filter :project
layout "project"
# Authorize
before_filter :add_project_abilities
before_filter :authorize_read_project!
before_filter :authorize_admin_project!, :only => [:new, :create, :destroy, :update]
before_filter :authorize_admin_project!, :only => [:new, :create, :destroy, :update]
def show
@team_member = project.users_projects.find(params[:id])
......@@ -26,7 +27,7 @@ class TeamMembersController < ApplicationController
respond_to do |format|
format.js
format.html do
format.html do
unless @team_member.valid?
flash[:alert] = "User should have at least one role"
end
......@@ -41,7 +42,7 @@ class TeamMembersController < ApplicationController
respond_to do |format|
format.html { redirect_to root_path }
format.js { render :nothing => true }
format.js { render :nothing => true }
end
end
end
......@@ -4,6 +4,14 @@ module ApplicationHelper
"http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(user_email)}?s=40&d=identicon"
end
def body_class(default_class = nil)
main = content_for(:body_class).blank? ?
default_class :
content_for(:body_class)
[main, cookies[:view_style]].join(" ")
end
def commit_name(project, commit)
if project.commit.id == commit.id
"master"
......@@ -23,18 +31,33 @@ module ApplicationHelper
end
def last_commit(project)
if project.repo_exists?
if project.repo_exists?
time_ago_in_words(project.commit.committed_date) + " ago"
else
else
"Never"
end
rescue
"Never"
end
def grouped_options_refs
options = [
["Branch", @repo.heads.map(&:name) ],
[ "Tag", @project.tags ]
]
grouped_options_for_select(options, @ref)
end
def markdown(text)
RDiscount.new(text, :autolink, :no_pseudo_protocols, :safelink, :smart, :filter_html).to_html.html_safe
end
def search_autocomplete_source
projects = current_user.projects.map{ |p| { :label => p.name, :url => project_path(p) } }
default_nav = [
{ :label => "Keys", :url => keys_path },
{ :label => "Projects", :url => projects_path },
{ :label => "Keys", :url => keys_path },
{ :label => "Projects", :url => projects_path },
{ :label => "Admin", :url => admin_root_path }
]
......@@ -42,10 +65,10 @@ module ApplicationHelper
if @project && !@project.new_record?
project_nav = [
{ :label => "#{@project.code} / Issues", :url => project_issues_path(@project) },
{ :label => "#{@project.code} / Wall", :url => wall_project_path(@project) },
{ :label => "#{@project.code} / Tree", :url => tree_project_path(@project) },
{ :label => "#{@project.code} / Commits", :url => project_commits_path(@project) },
{ :label => "#{@project.code} / Issues", :url => project_issues_path(@project) },
{ :label => "#{@project.code} / Wall", :url => wall_project_path(@project) },
{ :label => "#{@project.code} / Tree", :url => tree_project_path(@project) },
{ :label => "#{@project.code} / Commits", :url => project_commits_path(@project) },
{ :label => "#{@project.code} / Team", :url => team_project_path(@project) }
]
end
......
module CommitsHelper
def diff_line(line, line_new = 0, line_old = 0)
full_line = html_escape(line.gsub(/\n/, ''))
color = if line[0] == "+"
color = if line[0] == "+"
full_line = "<span class=\"old_line\">&nbsp;</span><span class=\"new_line\">#{line_new}</span> " + full_line
"#DFD"
elsif line[0] == "-"
elsif line[0] == "-"
full_line = "<span class=\"old_line\">#{line_old}</span><span class=\"new_line\">&nbsp;</span> " + full_line
"#FDD"
else
else
full_line = "<span class=\"old_line\">#{line_old}</span><span class=\"new_line\">#{line_new}</span> " + full_line
"none"
end
......
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
......@@ -12,7 +12,7 @@ module ProjectsHelper
else
true
end
rescue
rescue
nil
end
end
module SnippetsHelper
def lifetime_select_options
options = [
['forever', nil],
['1 day', "#{Date.current + 1.day}"],
['1 week', "#{Date.current + 1.week}"],
['1 month', "#{Date.current + 1.month}"]
]
options_for_select(options)
end
end
......@@ -17,14 +17,14 @@ class Ability
:read_issue,
:read_snippet,
:read_team_member,
:read_note
:read_note
] if project.readers.include?(user)
rules << [
:write_project,
:write_issue,
:write_snippet,
:write_note
:write_note
] if project.writers.include?(user)
rules << [
......@@ -32,13 +32,13 @@ class Ability
:admin_issue,
:admin_snippet,
:admin_team_member,
:admin_note
:admin_note
] if project.admins.include?(user)
rules.flatten
end
class << self
class << self
[:issue, :note, :snippet].each do |name|
define_method "#{name}_abilities" do |user, subject|
if subject.author == user
......@@ -48,7 +48,7 @@ class Ability
:"admin_#{name}"
]
else
subject.respond_to?(:project) ?
subject.respond_to?(:project) ?
project_abilities(user, subject.project) : []
end
end
......
......@@ -10,13 +10,18 @@ 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 }
validates :content,
:presence => true,
:length => { :within => 0..2000 }
#validates :content,
#:presence => true,
#:length => { :within => 0..2000 }
scope :critical, where(:critical => true)
scope :non_critical, where(:critical => false)
......@@ -30,7 +35,7 @@ class Issue < ActiveRecord::Base
def today?
Date.today == created_at.to_date
end
def new?
today? && created_at == updated_at
end
......
......@@ -8,7 +8,7 @@ class Key < ActiveRecord::Base
validates :key,
:presence => true,
:uniqueness => true,
:length => { :within => 0..1024 }
:length => { :within => 0..1600 }
before_save :set_identifier
after_save :update_gitosis
......@@ -17,11 +17,11 @@ class Key < ActiveRecord::Base
def set_identifier
self.identifier = "#{user.identifier}_#{Time.now.to_i}"
end
def update_gitosis
Gitosis.new.configure do |c|
c.update_keys(identifier, key)
projects.each do |project|
c.update_project(project.path, project.gitosis_writers)
end
......
......@@ -7,18 +7,23 @@ class Note < ActiveRecord::Base
belongs_to :author,
:class_name => "User"
attr_protected :author, :author_id
delegate :name,
:email,
:to => :author,
:prefix => true
attr_protected :author, :author_id
validates_presence_of :project
validates :note,
:presence => true,
:length => { :within => 0..255 }
:length => { :within => 0..5000 }
validates :attachment,
:file_size => {
:maximum => 10.megabytes.to_i
}
validates :attachment,
:file_size => {
:maximum => 10.megabytes.to_i
}
scope :common, where(:noteable_id => nil)
......
......@@ -9,6 +9,8 @@ class Project < ActiveRecord::Base
has_many :notes, :dependent => :destroy
has_many :snippets, :dependent => :destroy
acts_as_taggable
validates :name,
:uniqueness => true,
:presence => true,
......@@ -20,7 +22,7 @@ class Project < ActiveRecord::Base
:format => { :with => /^[a-zA-Z0-9_\-]*$/,
:message => "only letters, digits & '_' '-' allowed" },
:length => { :within => 0..255 }
validates :description,
:length => { :within => 0..2000 }
......@@ -57,13 +59,13 @@ class Project < ActiveRecord::Base
c.update_project(path, gitosis_writers)
end
end
def destroy_gitosis_project
Gitosis.new.configure do |c|
c.destroy_project(self)
end
end
def add_access(user, *access)
opts = { :user => user }
access.each { |name| opts.merge!(name => true) }
......@@ -102,12 +104,12 @@ class Project < ActiveRecord::Base
def url_to_repo
"#{GITOSIS["git_user"]}@#{GITOSIS["host"]}:#{path}.git"
end
def path_to_repo
GITOSIS["base_path"] + path + ".git"
end
def repo
def repo
@repo ||= Grit::Repo.new(path_to_repo)
end
......@@ -119,32 +121,52 @@ 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
else
else
repo.commits.first
end
end
def heads
def heads
@heads ||= repo.heads
end
def fresh_commits
commits = heads.map do |h|
repo.commits(h.name, 10)
def fresh_commits(n = 10)
commits = heads.map do |h|
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)
commits = heads.map do |h|
commits = heads.map do |h|
repo.log(h.name, nil, :since => date)
end.flatten.uniq { |c| c.id }
......@@ -165,7 +187,7 @@ class Project < ActiveRecord::Base
unless owner.can_create_project?
errors[:base] << ("Your own projects limit is #{owner.projects_limit}! Please contact administrator to increase it")
end
rescue
rescue
errors[:base] << ("Cant check your ability to create project")
end
......
......@@ -13,7 +13,7 @@ class Snippet < ActiveRecord::Base
validates :title,
:presence => true,
:length => { :within => 0..255 }
validates :file_name,
:presence => true,
:length => { :within => 0..255 }
......@@ -22,9 +22,11 @@ class Snippet < ActiveRecord::Base
:presence => true,
:length => { :within => 0..10000 }
scope :fresh, order("created_at DESC")
scope :non_expired, where(["expires_at IS NULL OR expires_at > ?", Time.current])
def self.content_types
[
[
".rb", ".py", ".pl", ".scala", ".c", ".cpp", ".java",
".haml", ".html", ".sass", ".scss", ".xml", ".php", ".erb",
".js", ".sh", ".coffee", ".yml", ".md"
......@@ -34,6 +36,10 @@ class Snippet < ActiveRecord::Base
def colorize
system_colorize(content, file_name)
end
def expired?
expires_at && expires_at < Time.current
end
end
# == Schema Information
#
......@@ -47,5 +53,6 @@ end
# created_at :datetime
# updated_at :datetime
# file_name :string(255)
# expires_at :datetime
#
......@@ -5,7 +5,7 @@ class User < ActiveRecord::Base
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me,
attr_accessible :email, :password, :password_confirmation, :remember_me,
:name, :projects_limit, :skype, :linkedin, :twitter
has_many :users_projects, :dependent => :destroy
......
%p This is page with preview for all system emails that are sent to user
%p Email previews built based on existing Project/Commit/Issue base - so some preview maybe unavailable unless object appear in system
%p Email previews built based on existing Project/Commit/Issue base - so some preview maybe unavailable unless object appear in system
#accordion
%h3
%a New user
%div
%div
%iframe{ :src=> admin_mailer_preview_user_new_path, :width=>"100%", :height=>"350"}
%h3
%a New issue
%div
%div
%iframe{ :src=> admin_mailer_preview_issue_new_path, :width=>"100%", :height=>"350"}
%h3
%h3
%a Commit note
%div
%iframe{ :src=> admin_mailer_preview_note_path(:type => "Commit"), :width=>"100%", :height=>"350"}
%h3
%a Issue note
%div
%div
%iframe{ :src=> admin_mailer_preview_note_path(:type => "Issue"), :width=>"100%", :height=>"350"}
%h3
%a Wall note
%div
%div
%iframe{ :src=> admin_mailer_preview_note_path(:type => "Wall"), :width=>"100%", :height=>"350"}
:javascript
:javascript
$(function() {
$( "#accordion" ).accordion(); });
%table
%tr
%thead
%th Name
%th Code
%th Path
......
%p#notice= notice
.span-8.colborder
%h2= @admin_project.name
%h2= @admin_project.name
%p
%b Name:
......@@ -22,16 +22,16 @@
.span-14
%h2 Team
%h2 Team
%table.round-borders
%tr
%th Name
%th Added
%th Added
%th Web
%th Git
%th Admin
%th
%th
- @admin_project.users_projects.each do |tm|
%tr
......
- @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
%th Git
%th Manage
%th Added
%th
%th Added
%th
%th
%th
- members.each do |tm|
......
......@@ -11,7 +11,6 @@
%b Since:
= @admin_team_member.updated_at
.span-10
.span-6
%b Access:
......
......@@ -44,7 +44,7 @@
.field
= f.label :twitter
%br
= f.text_field :twitter
= f.text_field :twitter
.clear
%br
.actions
......
%table
%tr
%thead
%th Admin
%th Name
%th Email
......
......@@ -2,5 +2,4 @@
= render 'form'
= link_to 'Back', admin_users_path, :class => "right lbutton"
......@@ -19,28 +19,27 @@
= @admin_user.skype
%p
%b LinkedIn:
= @admin_user.linkedin
= @admin_user.linkedin
%p
%b Twitter:
= @admin_user.twitter
.clear
= link_to 'Edit', edit_admin_user_path(@admin_user)
\|
= link_to 'Back', admin_users_path
.span-14
%h2 Projects
%h2 Projects
%table.round-borders
%tr
%th Name
%th Added
%th Added
%th Web
%th Git
%th Admin
%th
%th
- @admin_user.users_projects.each do |tm|
- project = tm.project
......
- @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
= more_commits_link if @commits.size > 99
.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
......@@ -8,7 +8,7 @@
.diff_file_header
- if diff.deleted_file
%strong{:id => "#{diff.b_path}"}= diff.a_path
- else
- else
= link_to tree_file_project_path(@project, @commit.id, diff.b_path) do
%strong{:id => "#{diff.b_path}"}= diff.b_path
%br/
......@@ -19,5 +19,5 @@
.diff_file_content_image
%img{:src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
- else
%p
%p
%center No preview for this file type
......@@ -6,4 +6,4 @@
%h1 Listing commits
%div{:id => dom_id(@project)}
= render "commits"
%br/
\ No newline at end of file
%br/
......@@ -2,6 +2,7 @@
- line_new = 0
- lines_arr = diff.diff.lines.to_a
- lines_arr.each do |line|
- next if line.match(/^--- \/dev\/null/)
- next if line.match(/^--- a/)
- next if line.match(/^\+\+\+ b/)
- if line.match(/^@@ -/)
......@@ -12,10 +13,10 @@
= diff_line(line, line_new, line_old)
- if line[0] == "+"
- line_new += 1
- elsif
- elsif
- line[0] == "-"
- line_old += 1
- else
- else
- line_new += 1
- line_old += 1
%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
- if params[:path]
%h3{:style => "color:#555"} /#{params[:path]}
%div{:id => dom_id(@project)}
= render "commits"
- content_for(:body_class, "project-page commits-page")
-#%a.right.button{:href => "#"} Download
-#-if can? current_user, :admin_project, @project
%a.right.button.blue{:href => "#"} EDIT
%h2.icon
%span
%d
= link_to project_commits_path(@project) do
= @project.name
- if params[:path]
\/
%a{:href => "#"}= params[:path].split("/").join(" / ")
.right= render :partial => "projects/refs", :locals => { :destination => project_commits_path(@project) }
%div{:id => dom_id(@project)}
#commits_list= render "commits"
.clear
.loading{ :style => "display:none;"}
%center= image_tag "ajax-loader.gif"
:javascript
$(function(){
CommitsList.init("#{@ref}", 20);
});
:plain
CommitsList.append(#{@commits.count}, "#{escape_javascript(render(:partial => 'commits/commits'))}");
%h3
= "[ #{@commit.committer} ] #{truncate(@commit.safe_message)}"
= "[ #{@commit.author_name} ] #{truncate(@commit.safe_message, :length => 70)}"
-#= link_to 'Back', project_commits_path(@project), :class => "button"
%table.round-borders
%tr
......@@ -7,33 +7,21 @@
%td= @commit.id
%tr
%td Author
%td= @commit.author
%tr
%td Commiter
%td= @commit.committer
%td= @commit.author_name
%tr
%td Commited Date
%td= @commit.committed_date
%td= @commit.committed_date.stamp("21 Aug 2011, 11:15pm")
%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)
.clear
#tabs
%ul
%li
%a{ :href => "#tabs-1" } Diff
%li
%a{ :href => "#tabs-2" } Comments
%span{ :class => "notes_count" }= @notes.count
%hr
#tabs-1
= render "commits/diff"
#tabs-2
= render "notes/notes"
%br
:javascript
$(function() { $( "#tabs" ).tabs(); });
= render "commits/diff"
= render "notes/notes"
-#:plain
$("#side-commit-preview").remove();
var side = $("<div id='side-commit-preview'></div>");
side.html("#{escape_javascript(render "commits/show")}");
$("##{dom_id(@project)}").parent().append(side);
$("##{dom_id(@project)}").addClass("span-14");
:plain
$("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}");
= render "notes/load"
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
......@@ -9,4 +9,4 @@
<div><%= f.submit "Resend confirmation instructions" %></div>
<% end %>
<%= render :partial => "devise/shared/links" %>
\ No newline at end of file
<%= render :partial => "devise/shared/links" %>
......@@ -13,4 +13,4 @@
<div><%= f.submit "Change my password" %></div>
<% end %>
<%= render :partial => "devise/shared/links" %>
\ No newline at end of file
<%= render :partial => "devise/shared/links" %>
<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 %>
......@@ -22,4 +22,4 @@
<%- resource_class.omniauth_providers.each do |provider| %>
<%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
<% end -%>
<% end -%>
\ No newline at end of file
<% end -%>
......@@ -9,4 +9,4 @@
<div><%= f.submit "Resend unlock instructions" %></div>
<% end %>
<%= render :partial => "devise/shared/links" %>
\ No newline at end of file
<%= render :partial => "devise/shared/links" %>
......@@ -7,10 +7,10 @@
.span-8
= f.label :title
= f.text_field :title, :style => "width:450px"
.span-8
= f.label :content
= f.text_area :content, :style => "width:450px; height:130px"
= f.text_area :title, :style => "width:450px; height:100px", :maxlength => 255
-#.span-8
-#= f.label :content
-#= f.text_area :content, :style => "width:450px; height:130px"
.span-8.append-bottom
= f.label :assignee_id
= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" })
......
%table.round-borders#issues-table
%tr
%thead
- if can?(current_user, :admin_issue, @project) && !params[:f] || params[:f] == "0"
%th
%th
%th Assignee
%th ID
%th Title
%th Closed?
%th
- @issues.critical.each do |issue|
= render(:partial => 'show', :locals => {:issue => issue})
......
%tr{ :id => dom_id(issue), :class => "issue #{issue.critical ? "critical" : ""}", :url => project_issue_path(@project, issue) }
- if can?(current_user, :admin_issue, @project) && !params[:f] || params[:f] == "0"
- if can?(current_user, :admin_issue, @project) && (!params[:f] || params[:f] == "0")
%td
= image_tag "move.png" , :class => [:handle, :left]
%td
= image_tag gravatar_icon(issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;"
= truncate issue.assignee.name, :lenght => 20
= issue.assignee.name
%td ##{issue.id}
%td
= html_escape issue.title
= truncate(html_escape(issue.title), :length => 200)
%br
%br
- if issue.critical
%span.tag.high critical
- if issue.today?
%span.tag.today today
.right
- if can?(current_user, :admin_issue, @project) || issue.author == current_user
= link_to 'Edit', edit_project_issue_path(@project, issue), :class => "cgray", :remote => true
- if can?(current_user, :admin_issue, @project) || issue.author == current_user
&nbsp;
= link_to 'Destroy', [@project, issue], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "cred delete-issue negative", :id => "destroy_issue_#{issue.id}"
-#- if issue.author == current_user
-#%span.tag.yours yours
-#- if issue.notes.count > 0
......@@ -21,13 +30,8 @@
-#notes
%td
- if can? current_user, :write_issue, @project
= form_for([@project, issue], :remote => true) do |f|
= form_for([@project, issue], :remote => true) do |f|
= f.check_box :closed, :onclick => "$(this).parent().submit();"
= hidden_field_tag :status_only, true
- else
- else
= check_box_tag "closed", 1, issue.closed, :disabled => true
%td
- if can?(current_user, :admin_issue, @project) || issue.author == current_user
= link_to 'Edit', edit_project_issue_path(@project, issue), :class => "lbutton positive", :remote => true
- if can?(current_user, :admin_issue, @project) || issue.author == current_user
= link_to 'Destroy', [@project, issue], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "lbutton delete-issue negative", :id => "destroy_issue_#{issue.id}"
%div
- if can? current_user, :write_issue, @project
.left= link_to 'New Issue', new_project_issue_path(@project), :remote => true, :class => "lbutton vm"
.right
= form_tag project_issues_path(@project), :method => :get do
.span-2
= radio_button_tag :f, 0, (params[:f] || "0") == "0", :onclick => "this.form.submit()", :id => "open_issues"
= label_tag "open_issues","Open"
.span-2
= radio_button_tag :f, 2, params[:f] == "2", :onclick => "this.form.submit()", :id => "closed_issues"
= label_tag "closed_issues","Closed"
.span-2
= radio_button_tag :f, 3, params[:f] == "3", :onclick => "this.form.submit()", :id => "my_issues"
= label_tag "my_issues","To Me"
.span-2
= radio_button_tag :f, 1, params[:f] == "1", :onclick => "this.form.submit()", :id => "all_issues"
= label_tag "all_issues","All"
.top_panel_issues
- if can? current_user, :write_issue, @project
%div{:class => "left", :style => "margin-right: 10px;" }
= link_to 'New Issue', new_project_issue_path(@project), :remote => true, :class => "lbutton vm"
= form_tag search_project_issues_path(@project), :method => :get, :remote => true, :class => :left, :id => "issue_search_form" do
= hidden_field_tag :project_id, @project.id, { :id => 'project_id' }
= search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search' }
.right.issues_filter
= form_tag project_issues_path(@project), :method => :get do
.left
= radio_button_tag :f, 0, (params[:f] || "0") == "0", :onclick => "this.form.submit()", :id => "open_issues", :class => "status"
= label_tag "open_issues","Open"
.left
= radio_button_tag :f, 2, params[:f] == "2", :onclick => "this.form.submit()", :id => "closed_issues", :class => "status"
= label_tag "closed_issues","Closed"
.left
= radio_button_tag :f, 3, params[:f] == "3", :onclick => "this.form.submit()", :id => "my_issues", :class => "status"
= label_tag "my_issues","To Me"
.left
= radio_button_tag :f, 1, params[:f] == "1", :onclick => "this.form.submit()", :id => "all_issues", :class => "status"
= label_tag "all_issues","All"
#issues-table-holder= render "issues"
%br
:javascript
$('.delete-issue').live('ajax:success', function() {
$(this).closest('tr').fadeOut(); });
var href = $('.issue_search').parent().attr('action');
var last_terms = '';
$('.issue_search').keyup(function() {
var terms = $(this).val();
var project_id = $('#project_id').val();
var status = $('.status:checked').val();
if (terms != last_terms) {
last_terms = terms;
if (terms.length >= 2 || terms.length == 0) {
$.get(href, { 'status': status, 'terms': terms, project: project_id }, function(response) {
$('#issues-table').html(response);
setSortable();
});
}
}
});
$('.delete-issue').live('ajax:success', function() {
$(this).closest('tr').fadeOut(); updatePage();});
function setSortable(){
$('#issues-table>tbody').sortable({
axis: 'y',
......
%h2
= "Issue ##{@issue.id} - #{@issue.title}"
.span-15
= simple_format html_escape(@issue.content)
%strong
Issue
= "##{@issue.id}"
&ndash;
= html_escape(@issue.title)
.left.width-65p
.issue_notes= render "notes/notes"
.span-8.right
.loading{ :style => "display:none;"}
%center= image_tag "ajax-loader.gif"
.right.width-30p
.span-8
- if @issue.closed
%center.success Closed
- else
%center.error Open
%table.round-borders
%tr
%td Title:
%td
= truncate html_escape(@issue.title)
%tr
%td Project
%td
%strong= @issue.project.name
%tr
%td Author:
%td Author:
%td
= image_tag gravatar_icon(@issue.author.email), :class => "left", :width => 40, :style => "padding:0 5px;"
= @issue.author.name
%tr
%td Assignee:
%td Assignee:
%td
= image_tag gravatar_icon(@issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;"
= @issue.assignee.name
%tr
%td Tags
%td
- if @issue.critical
%span.tag.high critical
- else
%span.tag.normal normal
- if @issue.today?
%span.tag.today today
%tr
%td Closed?
%td
- if can? current_user, :write_issue, @project
= form_for([@project, @issue]) do |f|
- if can? current_user, :write_issue, @issue
= form_for([@project, @issue]) do |f|
= f.check_box :closed, :onclick => "$(this).parent().submit();"
= hidden_field_tag :status_only, true
- else
- else
= check_box_tag "closed", 1, @issue.closed, :disabled => true
- if can?(current_user, :write_issue, @issue)
.clear
%br
= link_to 'Edit', edit_project_issue_path(@project, @issue), :class => "lbutton positive", :remote => true
.right= link_to 'Destroy', [@project, @issue], :confirm => 'Are you sure?', :method => :delete, :class => "lbutton delete-issue negative", :id => "destroy_issue_#{@issue.id}"
.clear
:plain
$("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}");
= render "notes/load"
......@@ -2,11 +2,11 @@
- if @issue.valid?
:plain
$("##{dom_id(@issue)}").fadeOut();
- else
- else
- if @issue.valid?
:plain
$("#edit_issue_dialog").dialog("close");
$.ajax({type: "GET", url: location.href, dataType: "script"});
updatePage();
- else
:plain
$("#edit_issue_dialog").empty();
......
......@@ -10,6 +10,6 @@
= render(:partial => 'show', :locals => {:key => key})
:javascript
$('.delete-key').live('ajax:success', function() {
$(this).closest('tr').fadeOut(); });
$('.delete-key').live('ajax:success', function() {
$(this).closest('tr').fadeOut(); });
......@@ -6,9 +6,9 @@
%h4= text
:javascript
$(function(){
$("#flash_container").slideDown("slow");
$("#flash_container").click(function(){
$(this).slideUp("slow");
$("#flash_container").slideDown("slow");
$("#flash_container").click(function(){
$(this).slideUp("slow");
});
setTimeout("hideFlash()",2000);
});
......
<div id="header-panel">
<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>
<!-- Page Header -->
<header>
<h1 class="logo">
<a href="/">GITLAB</a>
</h1>
<div class="account-box">
<%= link_to profile_path, :class => "pic" do %>
<%= image_tag gravatar_icon(current_user.email) %>
<% end %>
<a href="#" class="arrow-up"></a>
<div class="account-links">
<%= link_to profile_path, :class => "username" do %>
<%#= current_user.name %>
Your profile
<% end %>
<%= link_to "Fluid layout", url_for( :view_style => 'fluid' ) if cookies[:view_style] == "collapsed"%>
<%= link_to "Fixed layout", url_for( :view_style => 'collapsed' ) unless cookies[:view_style] == "collapsed"%>
<%= link_to 'Logout', destroy_user_session_path, :class => "logout", :method => :delete %>
</div>
</div><!-- .account-box -->
<div class="search">
<%= text_field_tag "search", nil, :placeholder => "Search", :class => "search-input" %>
</div>
</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 -->
<% if current_user %>
<%= javascript_tag do %>
......
- 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
= javascript_tag do
REQ_URI = "#{request.env["REQUEST_URI"]}";
REQ_REFFER = "#{request.env["HTTP_REFERER"]}";
%body{ :class => 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
......@@ -2,28 +2,16 @@
%html
%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 'jquery_ui/jquery-ui-1.8.16.custom', :media => "screen, projection"
GitLab
= 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#thebody
= render :partial => "layouts/flash"
- if user_signed_in?
%body{ :class => 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
= yield
= 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
= javascript_tag do
REQ_URI = "#{request.env["REQUEST_URI"]}";
REQ_REFFER = "#{request.env["HTTP_REFERER"]}";
%body.login-page
= render :partial => "layouts/flash"
= yield
This diff is collapsed.
This diff is collapsed.
......@@ -10,7 +10,7 @@
%div
= f.label :note
%cite (255 symbols only)
%cite
%br
= f.text_area :note, :size => 255
......@@ -22,7 +22,7 @@
= check_box_tag :notify, 1, true
= label_tag :notify, "Notify project team about your note"
.clear
%br
= f.submit 'Add note', :class => "lbutton vm", :id => "submit_note"
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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