BigW Consortium Gitlab

Commit e98c7785 by Dmitriy Zaporozhets

init commit

parent 0f43e98e
#this code temporarily disables notes for all controllers
# Footnotes::Filter.notes = []
--colour
rvm use 1.9.2-p290
v 0.9.1
- increassed test coverage
- design improvements
- new issue email notification
- updated app name
- issue redesigned
- issue can be edit
v 0.8.0
- sytax highlight for main file types
- redesign
- stability
- security fixes
- increased test coverage
- email notification
source 'http://rubygems.org'
gem 'rails', '3.1.0'
gem 'sqlite3'
gem 'devise', "1.4.7"
gem 'stamp'
gem 'will_paginate', '~> 3.0'
gem 'haml-rails'
gem 'jquery-rails'
gem 'grit'
gem "carrierwave"
gem 'six'
gem 'therubyracer'
gem 'faker'
gem 'seed-fu', :branch => 'rails-3-1', :git => 'git://github.com/mbleigh/seed-fu.git'
gem "lockfile"
gem "inifile"
gem "net-ssh"
gem "albino", :git => "git://github.com/randx/albino.git"
gem "kaminari"
group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
group :development do
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 'capybara'
gem 'autotest'
gem 'autotest-rails'
gem 'ruby-debug19', :require => 'ruby-debug'
gem 'awesome_print'
gem 'database_cleaner'
gem 'launchy'
end
group :test do
gem 'turn', :require => false
gem 'simplecov', :require => false
end
GIT
remote: git://github.com/ctran/annotate_models.git
revision: cfeec96c9ca0fa5035b10be3d73e798cc4fc52f7
specs:
annotate (2.4.1.beta1)
GIT
remote: git://github.com/mbleigh/seed-fu.git
revision: 29fe8c61ca6cc4408115ea7475fe2647081bd348
branch: rails-3-1
specs:
seed-fu (2.0.1.rails31)
activerecord (~> 3.1.0.rc4)
activesupport (~> 3.1.0.rc4)
GIT
remote: git://github.com/randx/albino.git
revision: 118380924969f3a856659f86ea1f40c1ba7bfcb1
specs:
albino (1.3.3)
posix-spawn (>= 0.3.6)
GEM
remote: http://rubygems.org/
specs:
ZenTest (4.5.0)
actionmailer (3.1.0)
actionpack (= 3.1.0)
mail (~> 2.3.0)
actionpack (3.1.0)
activemodel (= 3.1.0)
activesupport (= 3.1.0)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
rack (~> 1.3.2)
rack-cache (~> 1.0.3)
rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
sprockets (~> 2.0.0)
activemodel (3.1.0)
activesupport (= 3.1.0)
bcrypt-ruby (~> 3.0.0)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.0)
activemodel (= 3.1.0)
activesupport (= 3.1.0)
arel (~> 2.2.1)
tzinfo (~> 0.3.29)
activeresource (3.1.0)
activemodel (= 3.1.0)
activesupport (= 3.1.0)
activesupport (3.1.0)
multi_json (~> 1.0)
addressable (2.2.6)
ansi (1.3.0)
archive-tar-minitar (0.5.2)
arel (2.2.1)
autotest (4.4.6)
ZenTest (>= 4.4.1)
autotest-rails (4.1.1)
ZenTest (= 4.5)
awesome_print (0.4.0)
bcrypt-ruby (3.0.1)
builder (3.0.0)
capybara (1.0.1)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
carrierwave (0.5.7)
activesupport (~> 3.0)
childprocess (0.2.2)
ffi (~> 1.0.6)
coffee-rails (3.1.1)
coffee-script (>= 2.2.0)
railties (~> 3.1.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.1.2)
columnize (0.3.4)
database_cleaner (0.6.7)
devise (1.4.7)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
warden (~> 1.0.3)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.2.6)
multi_json (~> 1.0)
faker (0.9.5)
i18n (~> 0.4)
ffi (1.0.9)
grit (2.4.1)
diff-lcs (~> 1.1)
mime-types (~> 1.15)
haml (3.1.3)
haml-rails (0.3.4)
actionpack (~> 3.0)
activesupport (~> 3.0)
haml (~> 3.0)
railties (~> 3.0)
hike (1.2.1)
i18n (0.6.0)
inifile (0.4.1)
jquery-rails (1.0.14)
railties (~> 3.0)
thor (~> 0.14)
json_pure (1.5.4)
spruz (~> 0.2.8)
kaminari (0.12.4)
rails (>= 3.0.0)
launchy (2.0.5)
addressable (~> 2.2.6)
libv8 (3.3.10.2)
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
lockfile (1.4.3)
mail (2.3.0)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
multi_json (1.0.3)
net-ssh (2.2.1)
nokogiri (1.5.0)
orm_adapter (0.0.5)
polyglot (0.3.2)
posix-spawn (0.3.6)
rack (1.3.2)
rack-cache (1.0.3)
rack (>= 0.4)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.1.0)
actionmailer (= 3.1.0)
actionpack (= 3.1.0)
activerecord (= 3.1.0)
activeresource (= 3.1.0)
activesupport (= 3.1.0)
bundler (~> 1.0)
railties (= 3.1.0)
rails-footnotes (3.7.5.rc4)
rails (>= 3.0.0)
railties (3.1.0)
actionpack (= 3.1.0)
activesupport (= 3.1.0)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2)
rdoc (3.9.4)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
rspec-mocks (~> 2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
rspec-rails (2.6.1)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.6.0)
ruby-debug-base19 (0.11.25)
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
ruby_core_source (>= 0.1.4)
ruby-debug19 (0.11.6)
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
ruby-debug-base19 (>= 0.11.19)
ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
rubyzip (0.9.4)
sass (3.1.7)
sass-rails (3.1.1)
actionpack (~> 3.1.0)
railties (~> 3.1.0)
sass (>= 3.1.4)
tilt (~> 1.3.2)
selenium-webdriver (2.5.0)
childprocess (>= 0.2.1)
ffi (>= 1.0.7)
json_pure
rubyzip
shoulda (2.11.3)
simplecov (0.5.3)
multi_json (~> 1.0.3)
simplecov-html (~> 0.5.3)
simplecov-html (0.5.3)
six (0.2.0)
sprockets (2.0.0)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
spruz (0.2.13)
sqlite3 (1.3.4)
stamp (0.1.6)
therubyracer (0.9.4)
libv8 (~> 3.3.10)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
turn (0.8.2)
ansi (>= 1.2.2)
tzinfo (0.3.29)
uglifier (1.0.3)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
warden (1.0.5)
rack (>= 1.0)
will_paginate (3.0.0)
xpath (0.1.4)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
albino!
annotate!
autotest
autotest-rails
awesome_print
capybara
carrierwave
coffee-rails (~> 3.1.0)
database_cleaner
devise (= 1.4.7)
faker
grit
haml-rails
inifile
jquery-rails
kaminari
launchy
lockfile
net-ssh
rails (= 3.1.0)
rails-footnotes (>= 3.7.5.rc4)
rspec-rails
ruby-debug19
sass-rails (~> 3.1.0)
seed-fu!
shoulda
simplecov
six
sqlite3
stamp
therubyracer
turn
uglifier
will_paginate (~> 3.0)
Copyright (c) 2011 Dmitriy Zaporozhets
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
== Welcome to GitLab
GitLAb is a free Project/Repository managment application
== Application details
rails 3.1
works only with gitosis
sqlite as default db
== Getting Started
1. At the command prompt, clone application:
2. Setup and configure gitosis https://help.ubuntu.com/community/Git but use "git" as gitosis user name
3. Change directory to <tt>app</tt> and run next commands:
ruby configure.rb # OR ruby configure.rb production | test | development
4. Check config/gitosis.yml file
5. Start rails application:
rails s
6. Go to http://localhost:3000/ and you'll see project managment page
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
Gitlab::Application.load_tasks
[Dolphin]
ShowPreview=true
Timestamp=2011,9,14,20,34,18
Version=2
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
$(function(){
$(".one_click_select").click(function(){
$(this).select();
});
$('select#branch').selectmenu({style:'popup', width:200});
$('select#tag').selectmenu({style:'popup', width:200});
});
$(document).ready(function(){
$(".day-commits-table li.commit").live('click', function(e){
if(e.target.nodeName != "A") {
location.href = $(this).attr("url");
e.stopPropagation();
return false;
}
});
});
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
This source diff could not be displayed because it is too large. You can view the blob instead.
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
$(document).ready(function(){
$('#tree-slider td.tree-item-file-name a, #tree-breadcrumbs a').live("click", function() {
history.pushState({ path: this.path }, '', this.href)
})
$("#tree-slider tr.tree-item").live('click', function(e){
if(e.target.nodeName != "A") {
e.stopPropagation();
$(this).find("td.tree-item-file-name a").click();
return false;
}
});
$("#projects-list .project").live('click', function(e){
if(e.target.nodeName != "A" && e.target.nodeName != "INPUT") {
location.href = $(this).attr("url");
e.stopPropagation();
return false;
}
});
$("#issues-table .issue").live('click', function(e){
if(e.target.nodeName != "A" && e.target.nodeName != "INPUT") {
location.href = $(this).attr("url");
e.stopPropagation();
return false;
}
});
$(document).keypress(function(e) {
if( $(e.target).is(":input") ) return;
switch(e.which) {
case 115: focusSearch();
e.preventDefault();
}
});
});
function focusSearch() {
$("#search").focus();
}
/*
* 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_self
*= require_tree .
*/
// Place all the styles related to the Dashboard controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
@mixin round-borders-all($radius) {
border: 1px solid #eaeaea;
-moz-border-radius: $radius;
-webkit-border-radius: $radius;
border-radius: $radius;
}
table.highlighttable
{
margin:0px;
padding:0px;
font-size:12px;
table-layout:fixed
}
td.code,
td.linenos{
padding:0;
margin:0;
vertical-align:top;
}
.highlight{
background:none;
padding:10px 0px 0px 0;
margin-left:10px;
}
.highlight pre{
}
.linenodiv pre {
white-space:pre-line;
}
td.linenos {
background:#ECECEC;
color:#777;
padding:10px 0px 0px 10px;
float:left;
width:45px;
border-right: 1px solid #ccc;
}
td.code .highlight {
overflow-x: scroll;
}
table.highlighttable pre{
padding:0;
margin:0;
font-family: 'Courier New', 'andale mono','lucida console',monospace;
color: #333;
text-align:left;
}
.git-empty .highlight {
@include round-borders-all(4px);
background:#eee;
padding:5px;
//overflow-x:scroll;
pre{
padding:0;
line-height:2.0;
margin:0;
font-family: 'Courier New', 'andale mono','lucida console',monospace;
color: #333;
text-align:left;}
}
.shadow{
-webkit-box-shadow:0 5px 15px #000;
-moz-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 */
.k { color: #000000; font-weight: bold } /* Keyword */
.cm { color: #888888 } /* Comment.Multiline */
.cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.c1 { color: #888888 } /* Comment.Single */
.cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.ge { font-style: italic } /* Generic.Emph */
.gr { color: #aa0000 } /* Generic.Error */
.gh { color: #303030 } /* Generic.Heading */
.gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.go { color: #888888 } /* Generic.Output */
.gp { color: #555555 } /* Generic.Prompt */
.gs { font-weight: bold } /* Generic.Strong */
.gu { color: #606060 } /* Generic.Subheading */
.gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc{font-weight:bold;} /* Keyword.Constant */
.highlight .kd{font-weight:bold;} /* Keyword.Declaration */
.highlight .kn{font-weight:bold;} /* Keyword.Namespace */
.highlight .kp{font-weight:bold;} /* Keyword.Pseudo */
.highlight .kr{font-weight:bold;} /* Keyword.Reserved */
.highlight .kt{color:#458;font-weight:bold;} /* Keyword.Type */
.m { color: #0000DD; font-weight: bold } /* Literal.Number */
.s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na{color:#008080;} /* Name.Attribute */
.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 .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 */
.highlight .nt{color:#000080;} /* Name.Tag */
.highlight .nv{color:#008080;} /* Name.Variable */
.py { color: #336699; font-weight: bold } /* Name.Property */
.ow { color: #008800 } /* Operator.Word */
.w { color: #bbbbbb } /* Text.Whitespace */
.mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi {color:#099;} /* Literal.Number.Integer */
.mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc{color:#d14;} /* Literal.String.Char */
.sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2{color:#d14;} /* Literal.String.Double */
.highlight .se{color:#d14;} /* Literal.String.Escape */
.highlight .sh{color:#d14;} /* Literal.String.Heredoc */
.highlight .si{color:#d14;} /* Literal.String.Interpol */
.highlight .sx{color:#d14;} /* Literal.String.Other */
.highlight .sr{color:#d14;} /* Literal.String.Regex */
.highlight .s1{color:#d14;} /* Literal.String.Single */
.highlight .ss{color:#d14;} /* Literal.String.Symbol */
.bp { color: #003388 } /* Name.Builtin.Pseudo */
.vc { color: #336699 } /* Name.Variable.Class */
.vg { color: #dd7700 } /* Name.Variable.Global */
.vi { color: #3333bb }
// Place all the styles related to the Issues controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
/* Selectmenu
----------------------------------*/
.ui-selectmenu { background:none; font-size:12px;display: block; display: inline-block; position: relative; height: 2.2em; vertical-align: middle; text-decoration: none; overflow: hidden; zoom: 1; }
.ui-selectmenu-icon { position:absolute; right:6px; margin-top:-8px; top: 50%; }
.ui-selectmenu-menu { padding:0; margin:0; position:absolute; top: 0; display: none; z-index: 1005;} /* z-index: 1005 to make selectmenu work with dialog */
.ui-selectmenu-menu ul { padding:0; margin:0; list-style:none; position: relative; overflow: auto; overflow-y: auto ; overflow-x: hidden; }
.ui-selectmenu-open { display: block; }
.ui-selectmenu.ui-widget { background:none; }
.ui-selectmenu-menu-popup { margin-top: -1px; }
.ui-selectmenu-menu-dropdown { }
.ui-selectmenu-menu li.ui-state-active { background:#F7FBFC; border:none; padding:1px 0;}
.ui-selectmenu-menu li { padding:0; margin:0; display: block; border-top: 1px dotted transparent; border-bottom: 1px dotted transparent; border-right-width: 0 !important; border-left-width: 0 !important; font-weight: normal !important; }
.ui-selectmenu-menu li a,.ui-selectmenu-status { line-height: 1.4em; display: block; padding: .405em 2.1em .405em 1em; outline:none; text-decoration:none; }
.ui-selectmenu-menu li.ui-state-disabled a, .ui-state-disabled { cursor: default; }
.ui-selectmenu-menu li.ui-selectmenu-hasIcon a,
.ui-selectmenu-hasIcon .ui-selectmenu-status { padding-left: 20px; position: relative; margin-left: 5px; }
.ui-selectmenu-menu li .ui-icon, .ui-selectmenu-status .ui-icon { position: absolute; top: 1em; margin-top: -8px; left: 0; }
.ui-selectmenu-status { line-height: 1.4em; }
.ui-selectmenu-open li.ui-selectmenu-item-focus { background: none repeat scroll 0 0 #FFF6BF; border:1px solid #eaeaea;}
.ui-selectmenu-open li.ui-selectmenu-item-selected { }
.ui-selectmenu-menu li span,.ui-selectmenu-status span { display:block; margin-bottom: .2em; }
.ui-selectmenu-menu li .ui-selectmenu-item-header { font-weight: bold; }
.ui-selectmenu-menu li .ui-selectmenu-item-content { }
.ui-selectmenu-menu li .ui-selectmenu-item-footer { opacity: .8; }
/* for optgroups */
.ui-selectmenu-menu .ui-selectmenu-group { font-size: 1em; }
.ui-selectmenu-menu .ui-selectmenu-group .ui-selectmenu-group-label { line-height: 1.4em; display:block; padding: .6em .5em 0; font-weight: bold; }
.ui-selectmenu-menu .ui-selectmenu-group ul { margin: 0; padding: 0; }
/* IE6 workaround (dotted transparent borders) */
* html .ui-selectmenu-menu li { border-color: pink; filter:chroma(color=pink); width:100%; }
* html .ui-selectmenu-menu li a { position: relative }
/* IE7 workaround (opacity disabled) */
*+html .ui-state-disabled, *+html .ui-state-disabled a { color: silver; }
// Place all the styles related to the Profile controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
// Place all the styles related to the Projects controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
@mixin round-borders-bottom($radius) {
border-top: 1px solid #eaeaea;
-moz-border-radius-bottomright: $radius;
-moz-border-radius-bottomleft: $radius;
border-bottom-right-radius: $radius;
border-bottom-left-radius: $radius;
-webkit-border-bottom-left-radius: $radius;
-webkit-border-bottom-right-radius: $radius;
}
@mixin round-borders-top($radius) {
border-top: 1px solid #eaeaea;
-moz-border-radius-topright: $radius;
-moz-border-radius-topleft: $radius;
border-top-right-radius: $radius;
border-top-left-radius: $radius;
-webkit-border-top-left-radius: $radius;
-webkit-border-top-right-radius: $radius;
}
@mixin round-borders-all($radius) {
border: 1px solid #eaeaea;
-moz-border-radius: $radius;
-webkit-border-radius: $radius;
border-radius: $radius;
}
@mixin hover-color {
background: #fff !important;
background: -webkit-gradient(linear,left top,left bottom,from(#fff),to(#FFF6BF)) !important;
background: -moz-linear-gradient(top,#fff,#FFF6BF) !important;
background: transparent 9 !important;
}
.diff_file {
border:1px solid #CCC;
margin-bottom:1em;
.diff_file_header {
padding:5px 5px;
border-bottom:1px solid #CCC;
background: #eee;
}
.diff_file_content {
overflow-x: scroll;
background:#fff;
color:#333;
font-size: 12px;
font-family: 'Courier New', 'andale mono','lucida console',monospace;
}
.diff_file_content_image {
background:#eee;
text-align:center;
img {
padding:100px;
max-width:300px;
}
}
}
#logo {
&:hover {
background:none;
}
}
.file_stats {
margin-bottom:10px;
@include round-borders-all(4px);
span {
border-top: 1px solid #eaeaea;
padding:5px 5px;
display:block;
&:first-child {
border-top:none;
}
img {
width:18px;
float:left;
margin-right: 6px;
}
}
}
.round-borders {
@include round-borders-all(4px);
padding: 4px 0px;
}
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;
background: -moz-linear-gradient(top,#333,#111) !important;
background: transparent 9 !important;
}
#header-panel {
@include panel-color;
height:40px;
position:fixed;
z-index:999;
top:0px;
width:100%;
margin-bottom:10px;
overflow:hidden;
.button{
color:#bbb;
border:none;
margin:0px;
height:25px;
background:transparent;
padding:10px 20px 5px 20px;
&:hover{
color:white;
}
&.current {
border-bottom: 3px solid #EAEAEA !important;
padding: 10px 20px 0;
color: #eaeaea;
}
}
.search-holder {
float:left;
width:290px;
input {
@include round-borders-all(4px);
width:290px;
border-color:#888;
padding:5px;
background:#666;
color:#222;
&:focus {
background:#fff;
color:#000;
}
}
}
}
#content-container{
min-height:250px;
background: #fff;
@include round-borders-bottom(8px);
borders:2px solid #eaeaea;
border-top: none;
padding:20px;
}
body {
background: #eaeaea;
}
a {
color: #111;
}
.diff_file_content{
.old_line, .new_line {
background:#ECECEC;
color:#777;
width:15px;
float:left;
padding: 0px 10px;
border-right: 1px solid #ccc;
}
}
.view_file_content{
.old_line, .new_line {
background:#ECECEC;
color:#777;
width:15px;
float:left;
padding: 0px 10px;
border-right: 1px solid #ccc;
}
.old_line{
display:none;
}
}
.view_file {
border:1px solid #CCC;
margin-bottom:1em;
.view_file_header {
padding:5px 5px;
border-bottom:1px solid #CCC;
background: #eee;
}
.view_file_content {
background:#fff;
color:#514721;
font-size: 11px;
}
.view_file_content_image {
background:#eee;
text-align:center;
img {
padding:100px;
max-width:300px;
}
}
}
.back_small.button{
}
input.ssh_project_url {
padding:5px;
margin:0px;
float:right;
width:400px;
text-align:center;
}
.day-commits-table li.commit {
cursor:pointer;
&:hover {
@include hover-color;
}
}
/*
#FFF6BF
#FFD324
*/
#tree-slider tr.tree-item {
cursor:pointer;
&:hover {
@include hover-color;
td {
@include hover-color;
}
}
}
#projects-list .project {
height:50px;
}
#projects-list .project,
#issues-table .issue{
cursor:pointer;
&:hover {
@include hover-color;
td {
@include hover-color;
}
}
}
.clear {
clear: both;
}
.top_project_menu {
a {
border-right: 1px solid #FFFFFF;
box-shadow: -1px 0 #DDDDDD inset;
color: #666;
display: block;
font-size: 16px;
text-decoration: none;
line-height: 20px;
padding: 11px 26px 12px 24px;
text-shadow: 0 1px 0 #FFFFFF;
float:left;
&.current {
background-color: #FFFFFF;
color: #222222;
}
}
}
.top_bar {
margin-top:50px;
background-color: #F4F4F4;
@include round-borders-top(8px);
box-shadow: 0 1px #FFFFFF inset, 0 -1px #DDDDDD inset;
height: 43px;
overflow: hidden;
width:990px;
}
/** FORM INPUTS **/
.user_new,
.edit_user,
.new_project,
.edit_project {
input[type='text'],
input[type='email'],
input[type='password'],
textarea {
width:400px;
padding:8px;
font-size:14px;
@include round-borders-all(4px);
}
}
.input_button {
//@include round-borders-all(4px);
padding:8px;
font-size:14px;
cursor:pointer;
background-color: #F5F5F5;
border-color: #EEEEEE #DEDEDE #DEDEDE #EEEEEE;
border-right: 1px solid #DEDEDE;
border-style: solid;
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;
padding: 2px;
font-size:12px;
position:relative;
top:-14px;
left:10px;
border-top:none;
}
#logo {
color: #EAEAEA;
font-family: monospace;
font-size: 26px;
padding: 4px;
text-decoration: none;
text-shadow: #555 1px 1px;
}
/** FALSH **/
#flash_container {
height:40px;
position:fixed;
z-index:1009;
top:0px;
width:100%;
margin-bottom:10px;
overflow:hidden;
background:white;
cursor:pointer;
border-bottom:1px solid #777;
h4 {
color:#444;
font-size:22px;
padding-top:5px;
}
}
/** Buttons **/
.lbutton,
.lite_button {
display:block;
float:left;
margin: 0px 5px;
padding:5px 10px;
font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;
border:1px solid #D3D3D3;
background:white;
font-size:12px;
line-height:130%;
text-decoration:none;
font-weight:bold;
color:#565656;
cursor:pointer;
&:hover {
border:1px solid #C2E1EF;
color: #0099FF;
}
&.hm {
margin: 0px 0px;
}
&.vm {
margin: 5px 0px;
}
}
/** Notes **/
#notes-list {
display:block;
list-style:none;
margin:0px;
padding:0px;
li {
display:list-item;
padding:8px;
margin:0px;
background: #F7FBFC;
border-top: 1px solid #E2EAEE;
&:first-child {
border-top: none;
}
&:nth-child(2n+1) {
background: white;
}
p {
margin-bottom: 3px;
font-size: 12px;
}
}
}
.notes_count {
background: none repeat scroll 0 0 #FFF6BF;
border-color: #FFD324;
color: #514721;
border: 2px solid #DDDDDD;
margin-bottom: 1em;
margin-top: 3px;
padding: 2px 5px;
position: relative;
right: 6px;
top: 6px;
}
.note_author {
float:left;
width:60px;
}
.note_content {
float:left;
width:750px;
}
.issue_notes {
.note_content {
float:left;
width:400px;
}
}
class Admin::MailerController < ApplicationController
before_filter :authenticate_user!
before_filter :authenticate_admin!
def preview
end
def preview_note
@note = Note.first
@user = @note.author
@project = @note.project
case params[:type]
when "Commit" then
@commit = @project.commit
render :file => 'notify/note_commit_email.html.haml', :layout => 'notify'
when "Issue" then
@issue = Issue.first
render :file => 'notify/note_issue_email.html.haml', :layout => 'notify'
else
render :file => 'notify/note_wall_email.html.haml', :layout => 'notify'
end
rescue
render :text => "Preview not avaialble"
end
def preview_user_new
@user = User.first
@password = "DHasJKDHAS!"
render :file => 'notify/new_user_email.html.haml', :layout => 'notify'
rescue
render :text => "Preview not avaialble"
end
def preview_issue_new
@issue = Issue.first
@user = @issue.assignee
@project = @issue.project
render :file => 'notify/new_issue_email.html.haml', :layout => 'notify'
rescue
render :text => "Preview not avaialble"
end
end
class Admin::ProjectsController < ApplicationController
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
@admin_project = Project.find_by_code(params[:id])
end
def create
@admin_project = Project.new(params[:project])
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
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
end
end
def destroy
@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
end
end
class Admin::TeamMembersController < ApplicationController
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
@admin_team_member = UsersProject.find(params[:id])
end
def create
@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
end
end
def update
@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
end
end
def destroy
@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
end
end
class Admin::UsersController < ApplicationController
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
respond_to do |format|
format.html # new.html.erb
format.json { render json: @admin_user }
end
end
def edit
@admin_user = User.find(params[:id])
end
def create
admin = params[:user].delete("admin")
@admin_user = User.new(params[:user])
@admin_user.admin = (admin && admin.to_i > 0)
respond_to do |format|
if @admin_user.save
Notify.new_user_email(@admin_user, params[:user][:password]).deliver
format.html { redirect_to [:admin, @admin_user], notice: 'User was successfully created.' }
format.json { render json: @admin_user, status: :created, location: @admin_user }
else
format.html { render action: "new" }
format.json { render json: @admin_user.errors, status: :unprocessable_entity }
end
end
end
def update
admin = params[:user].delete("admin")
if params[:user][:password].empty?
params[:user].delete(:password)
params[:user].delete(:password_confirmation)
end
@admin_user = User.find(params[:id])
@admin_user.admin = (admin && admin.to_i > 0)
respond_to do |format|
if @admin_user.update_attributes(params[:user])
format.html { redirect_to [:admin, @admin_user], notice: 'User was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @admin_user.errors, status: :unprocessable_entity }
end
end
end
def destroy
@admin_user = User.find(params[:id])
@admin_user.destroy
respond_to do |format|
format.html { redirect_to admin_users_url }
format.json { head :ok }
end
end
end
class ApplicationController < ActionController::Base
before_filter :authenticate_user!
protect_from_forgery
helper_method :abilities, :can?
protected
def abilities
@abilities ||= Six.new
end
def can?(object, action, subject)
abilities.allowed?(object, action, subject)
end
def project
@project ||= Project.find_by_code(params[:project_id])
end
def add_project_abilities
abilities << Ability
end
def authenticate_admin!
return redirect_to(new_user_session_path) unless current_user.is_admin?
end
def authorize_project!(action)
return redirect_to(new_user_session_path) unless can?(current_user, action, project)
end
def method_missing(method_sym, *arguments, &block)
if method_sym.to_s =~ /^authorize_(.*)!$/
authorize_project!($1.to_sym)
else
super
end
end
end
require "base64"
class CommitsController < ApplicationController
before_filter :project
# Authorize
before_filter :add_project_abilities
before_filter :authorize_read_project!
def index
@repo = project.repo
@branch = if !params[:branch].blank?
params[:branch]
elsif !params[:tag].blank?
params[:tag]
else
"master"
end
if params[:path]
@commits = @repo.log(@branch, params[:path], :max_count => params[:limit] || 100, :skip => params[:offset] || 0)
else
@commits = @repo.commits(@branch, params[:limit] || 100, params[:offset] || 0)
end
respond_to do |format|
format.html # index.html.erb
format.js
format.json { render json: @commits }
end
end
def show
@commit = project.repo.commits(params[:id]).first
@notes = project.notes.where(:noteable_id => @commit.id, :noteable_type => "Commit")
@note = @project.notes.new(:noteable_id => @commit.id, :noteable_type => "Commit")
respond_to do |format|
format.html # show.html.erb
format.js
format.json { render json: @commit }
end
end
end
class DashboardController < ApplicationController
end
class IssuesController < ApplicationController
before_filter :authenticate_user!
before_filter :project
# Authorize
before_filter :add_project_abilities
before_filter :authorize_read_issue!
before_filter :authorize_write_issue!, :only => [:new, :create, :close, :edit, :update]
before_filter :authorize_admin_issue!, :only => [:destroy]
respond_to :js
def index
@issues = case params[:f].to_i
when 1 then @project.issues.all
when 2 then @project.issues.closed
when 3 then @project.issues.opened.assigned(current_user)
else @project.issues.opened
end
respond_to do |format|
format.html # index.html.erb
format.js
end
end
def new
@issue = @project.issues.new
respond_with(@issue)
end
def edit
@issue = @project.issues.find(params[:id])
respond_with(@issue)
end
def show
@issue = @project.issues.find(params[:id])
@notes = @issue.notes
@note = @project.notes.new(:noteable => @issue)
end
def create
@issue = @project.issues.new(params[:issue])
@issue.author = current_user
if @issue.save
Notify.new_issue_email(@issue).deliver
end
respond_with(@issue)
end
def update
@issue = @project.issues.find(params[:id])
@issue.update_attributes(params[:issue])
respond_to do |format|
format.js
format.html { redirect_to [@project, @issue]}
end
end
def destroy
@issue = @project.issues.find(params[:id])
@issue.destroy
respond_to do |format|
format.js { render :nothing => true }
end
end
end
class KeysController < ApplicationController
respond_to :js
def index
@keys = current_user.keys.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @keys }
end
end
def new
@key = current_user.keys.new
respond_with(@key)
end
def create
@key = current_user.keys.new(params[:key])
@key.save
respond_with(@key)
end
# DELETE /keys/1
# DELETE /keys/1.json
def destroy
@key = current_user.keys.find(params[:id])
@key.destroy
respond_to do |format|
format.html { redirect_to keys_url }
format.js { render :nothing => true }
format.json { head :ok }
end
end
end
class NotesController < ApplicationController
before_filter :project
# Authorize
before_filter :add_project_abilities
before_filter :authorize_write_note!, :only => [:create]
before_filter :authorize_admin_note!, :only => [:destroy]
respond_to :js
def create
@note = @project.notes.new(params[:note])
@note.author = current_user
if @note.save
notify if params[:notify] == '1'
end
respond_to do |format|
format.html {redirect_to :back}
format.js
end
end
def destroy
@note = @project.notes.find(params[:id])
@note.destroy
respond_to do |format|
format.js { render :nothing => true }
end
end
protected
def notify
@project.users.reject { |u| u.id == current_user.id } .each do |u|
case @note.noteable_type
when "Commit" then
Notify.note_commit_email(u, @note).deliver
when "Issue" then
Notify.note_issue_email(u, @note).deliver
else
Notify.note_wall_email(u, @note).deliver
end
end
end
end
class ProfileController < ApplicationController
def show
@user = current_user
end
def password
@user = current_user
end
def password_update
params[:user].reject!{ |k, v| k != "password" && k != "password_confirmation"}
@user = current_user
if @user.update_attributes(params[:user])
flash[:notice] = "Password was successfully updated. Please login with it"
redirect_to new_user_session_path
else
render :action => "password"
end
end
end
class ProjectsController < ApplicationController
before_filter :project, :except => [:index, :new, :create]
# Authorize
before_filter :add_project_abilities
before_filter :authorize_read_project!, :except => [:index, :new, :create]
before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy]
def index
@projects = current_user.projects.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @projects }
end
end
def show
@repo = project.repo
@commit = @repo.commits.first
@tree = @commit.tree
@tree = @tree / params[:path] if params[:path]
respond_to do |format|
format.html # show.html.erb
format.json { render json: project }
end
rescue Grit::NoSuchPathError => ex
respond_to do |format|
format.html {render "projects/empty"}
end
end
def tree
@repo = project.repo
@branch = if !params[:branch].blank?
params[:branch]
elsif !params[:tag].blank?
params[:tag]
else
"master"
end
if params[:commit_id]
@commit = @repo.commits(params[:commit_id]).first
else
@commit = @repo.commits(@branch || "master").first
end
@tree = @commit.tree
@tree = @tree / params[:path] if params[:path]
respond_to do |format|
format.html # show.html.erb
format.js do
# temp solution
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
end
format.json { render json: project }
end
end
def blob
@repo = project.repo
@commit = project.commit(params[:commit_id])
@tree = project.tree(@commit, params[:path])
if @tree.is_a?(Grit::Blob)
send_data(@tree.data, :type => @tree.mime_type, :disposition => 'inline', :filename => @tree.name)
else
head(404)
end
end
def new
@project = Project.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @project }
end
end
def edit
end
def create
@project = Project.new(params[:project])
Project.transaction do
@project.save!
@project.users_projects.create!(:admin => true, :read => true, :write => true, :user => current_user)
end
respond_to do |format|
if @project.valid?
format.html { redirect_to @project, notice: 'Project was successfully created.' }
format.js
format.json { render json: @project, status: :created, location: @project }
else
format.html { render action: "new" }
format.js
format.json { render json: @project.errors, status: :unprocessable_entity }
end
end
rescue StandardError => ex
@project.errors.add(:base, "Cant save project. Please try again later")
respond_to do |format|
format.html { render action: "new" }
format.js
format.json { render json: @project.errors, status: :unprocessable_entity }
end
end
def update
respond_to do |format|
if project.update_attributes(params[:project])
format.html { redirect_to project, notice: 'Project was successfully updated.' }
format.js
format.json { head :ok }
else
format.html { render action: "edit" }
format.js
format.json { render json: project.errors, status: :unprocessable_entity }
end
end
end
def destroy
project.destroy
respond_to do |format|
format.html { redirect_to projects_url }
format.json { head :ok }
end
end
def wall
@notes = @project.common_notes
@note = Note.new
end
protected
def project
@project ||= Project.find_by_code(params[:id])
end
end
class TeamMembersController < ApplicationController
before_filter :project
# Authorize
before_filter :add_project_abilities
before_filter :authorize_read_team_member!
before_filter :authorize_admin_team_member!, :only => [:new, :create, :destroy, :update]
def show
@team_member = project.users_projects.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.js
format.json { render json: @team_member }
end
end
def new
@team_member = project.users_projects.new
respond_to do |format|
format.html # new.html.erb
format.js
format.json { render json: @team_member }
end
end
def create
@team_member = UsersProject.new(params[:team_member])
@team_member.project = project
respond_to do |format|
if @team_member.save
format.html { redirect_to @team_member, notice: 'Team member was successfully created.' }
format.js
format.json { render json: @team_member, status: :created, location: @team_member }
else
format.html { render action: "new" }
format.js
format.json { render json: @team_member.errors, status: :unprocessable_entity }
end
end
end
def update
@team_member = project.users_projects.find(params[:id])
@team_member.update_attributes(params[:team_member])
respond_to do |format|
format.js
format.html { redirect_to team_project_path(@project)}
end
end
def destroy
@team_member = project.users_projects.find(params[:id])
@team_member.destroy
respond_to do |format|
format.html { redirect_to root_path }
format.json { head :ok }
format.js { render :nothing => true }
end
end
end
module Admin::ProjectsHelper
end
module Admin::UsersHelper
end
require 'digest/md5'
module ApplicationHelper
def gravatar_icon(user_email)
"http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(user_email)}?s=40&d=identicon"
end
def commit_name(project, commit)
if project.commit.id == commit.id
"master"
else
commit.id
end
end
def admin_namespace?
controller.class.name.split("::").first=="Admin"
end
def projects_namespace?
!current_page?(root_url) &&
controller.controller_name != "keys" &&
!admin_namespace?
end
def last_commit(project)
if project.repo_exists?
time_ago_in_words(project.commit.committed_date) + " ago"
else
"Never"
end
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 => "Admin", :url => admin_root_path }
]
project_nav = []
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} / Team", :url => team_project_path(@project) }
]
end
[projects, default_nav, project_nav].flatten.to_json
end
def handle_file_type(file_name, mime_type)
if file_name =~ /(\.rb|\.ru|\.rake|Rakefile|\.gemspec|\.rbx|Gemfile)$/
:ruby
elsif file_name =~ /\.py$/
:python
elsif file_name =~ /(\.pl|\.scala|\.c|\.cpp|\.java|\.haml|\.html|\.sass|\.scss|\.xml|\.php|\.erb)$/
$1[1..-1].to_sym
elsif file_name =~ /\.js$/
:javascript
elsif file_name =~ /\.sh$/
:bash
elsif file_name =~ /\.coffee$/
:coffeescript
elsif file_name =~ /\.yml$/
:yaml
elsif file_name =~ /\.md$/
:minid
else
:text
end
end
end
module CommitsHelper
def diff_line(line, line_new = 0, line_old = 0)
full_line = html_escape(line.gsub(/\n/, ''))
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] == "-"
full_line = "<span class=\"old_line\">#{line_old}</span><span class=\"new_line\">&nbsp;</span> " + full_line
"#FDD"
else
full_line = "<span class=\"old_line\">#{line_old}</span><span class=\"new_line\">#{line_new}</span> " + full_line
"none"
end
raw "<div style=\"white-space:pre;background:#{color};\">#{full_line}</div>"
end
def more_commits_link
offset = params[:offset] || 0
limit = params[:limit] || 100
link_to "More", project_commits_path(@project, :offset => offset.to_i + limit.to_i, :limit => limit),
:remote => true, :class => "lite_button vm", :style => "text-align:center; width:930px; ", :id => "more-commits-link"
end
end
module DashboardHelper
end
module IssuesHelper
end
module KeysHelper
end
module ProfileHelper
end
module ProjectsHelper
end
module TeamMembersHelper
end
class Notify < ActionMailer::Base
default_url_options[:host] = "gitlabhq.com"
default from: "notify@gitlabhq.com"
def new_user_email(user, password)
@user = user
@password = password
mail(:to => @user.email, :subject => "gitlab | Account was created for you")
end
def new_issue_email(issue)
@user = issue.assignee
@project = issue.project
@issue = issue
mail(:to => @user.email, :subject => "gitlab | New Issue was created")
end
def note_wall_email(user, note)
@user = user
@note = note
@project = note.project
mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ")
end
def note_commit_email(user, note)
@user = user
@note = note
@project = note.project
@commit = @project.repo.commits(note.noteable_id).first
mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ")
end
def note_issue_email(user, note)
@user = user
@note = note
@project = note.project
@issue = note.noteable
mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ")
end
end
class Ability
def self.allowed(object, subject)
case subject.class.name
when "Project" then project_abilities(object, subject)
else []
end
end
def self.project_abilities(user, project)
rules = []
rules << [
:read_project,
:read_issue,
:read_team_member,
:read_note
] if project.readers.include?(user)
rules << [
:write_project,
:write_issue,
:write_note
] if project.writers.include?(user)
rules << [
:admin_project,
:admin_issue,
:admin_team_member,
:admin_note
] if project.admins.include?(user)
rules.flatten
end
end
class Issue < ActiveRecord::Base
belongs_to :project
belongs_to :author, :class_name => "User"
belongs_to :assignee, :class_name => "User"
has_many :notes, :as => :noteable
attr_protected :author, :author_id, :project, :project_id
validates_presence_of :project_id
validates_presence_of :assignee_id
validates_presence_of :author_id
validates :title,
:presence => true,
:length => { :within => 0..255 }
validates :content,
:presence => true,
:length => { :within => 0..2000 }
scope :opened, where(:closed => false)
scope :closed, where(:closed => true)
scope :assigned, lambda { |u| where(:assignee_id => u.id)}
end
# == Schema Information
#
# Table name: issues
#
# id :integer not null, primary key
# title :string(255)
# content :text
# assignee_id :integer
# author_id :integer
# project_id :integer
# created_at :datetime
# updated_at :datetime
# closed :boolean default(FALSE), not null
#
class Key < ActiveRecord::Base
belongs_to :user
validates :title,
:presence => true,
:length => { :within => 0..255 }
validates :key,
:presence => true,
:uniqueness => true,
:length => { :within => 0..555 }
before_save :set_identifier
after_save :update_gitosis
after_destroy :gitosis_delete_key
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
end
end
def gitosis_delete_key
Gitosis.new.configure do |c|
c.delete_key(identifier)
projects.each do |project|
c.update_project(project.path, project.gitosis_writers)
end
end
end
#projects that has this key
def projects
user.projects
end
end
# == Schema Information
#
# Table name: keys
#
# id :integer not null, primary key
# user_id :integer not null
# created_at :datetime
# updated_at :datetime
# key :text
# title :string(255)
# identifier :string(255)
#
require 'carrierwave/orm/activerecord'
require 'file_size_validator'
class Note < ActiveRecord::Base
belongs_to :project
belongs_to :noteable, :polymorphic => true
belongs_to :author,
:class_name => "User"
attr_protected :author, :author_id
validates_presence_of :project
validates :note,
:presence => true,
:length => { :within => 0..255 }
validates :attachment,
:file_size => {
:maximum => 10.megabytes.to_i
}
scope :common, where(:noteable_id => nil)
mount_uploader :attachment, AttachmentUploader
end
# == Schema Information
#
# Table name: notes
#
# id :integer not null, primary key
# note :string(255)
# noteable_id :string(255)
# noteable_type :string(255)
# author_id :integer
# created_at :datetime
# updated_at :datetime
# project_id :integer
# attachment :string(255)
#
require "grit"
class Project < ActiveRecord::Base
has_many :issues, :dependent => :destroy
has_many :users_projects, :dependent => :destroy
has_many :users, :through => :users_projects
has_many :notes, :dependent => :destroy
validates :name,
:uniqueness => true,
:presence => true,
:length => { :within => 0..255 }
validates :path,
:uniqueness => true,
:presence => true,
:length => { :within => 0..255 }
validates :description,
:length => { :within => 0..2000 }
validates :code,
:presence => true,
:uniqueness => true,
:length => { :within => 3..12 }
before_save :format_code
after_destroy :destroy_gitosis_project
after_save :update_gitosis_project
attr_protected :private_flag
scope :public_only, where(:private_flag => false)
def to_param
code
end
def common_notes
notes.where(:noteable_type => ["", nil])
end
def format_code
read_attribute(:code).downcase.strip.gsub(' ', '')
end
def update_gitosis_project
Gitosis.new.configure do |c|
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) }
users_projects.create(opts)
end
def reset_access(user)
users_projects.where(:project_id => self.id, :user_id => user.id).destroy if self.id
end
def writers
@writers ||= users_projects.includes(:user).where(:write => true).map(&:user)
end
def gitosis_writers
keys = Key.joins({:user => :users_projects}).where("users_projects.project_id = ? AND users_projects.write = ?", id, true)
keys.map(&:identifier)
end
def readers
@readers ||= users_projects.includes(:user).where(:read => true).map(&:user)
end
def admins
@admins ||=users_projects.includes(:user).where(:admin => true).map(&:user)
end
def public?
!private_flag
end
def private?
private_flag
end
def url_to_repo
"#{GITOSIS["git_user"]}@#{GITOSIS["host"]}:#{path}.git"
end
def path_to_repo
GITOSIS["base_path"] + path + ".git"
end
def repo
@repo ||= Grit::Repo.new(path_to_repo)
end
def tags
repo.tags.map(&:name).sort.reverse
end
def repo_exists?
repo rescue false
end
def commit(commit_id = nil)
if commit_id
repo.commits(commit_id).first
else
repo.commits.first
end
end
def tree(fcommit, path = nil)
fcommit = commit if fcommit == :head
tree = fcommit.tree
path ? (tree / path) : tree
end
def valid_repo?
repo
rescue
errors.add(:path, "Invalid repository path")
false
end
end
# == Schema Information
#
# Table name: projects
#
# id :integer not null, primary key
# name :string(255)
# path :string(255)
# description :text
# created_at :datetime
# updated_at :datetime
# private_flag :boolean default(TRUE), not null
# code :string(255)
#
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me, :name
has_many :users_projects, :dependent => :destroy
has_many :projects, :through => :users_projects
has_many :keys, :dependent => :destroy
has_many :issues,
:foreign_key => :author_id,
:dependent => :destroy
has_many :assigned_issues,
:class_name => "Issue",
:foreign_key => :assignee_id,
:dependent => :destroy
scope :not_in_project, lambda { |project| where("id not in (:ids)", :ids => project.users.map(&:id) ) }
def identifier
email.gsub "@", "_"
end
def is_admin?
admin
end
end
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# email :string(255) default(""), not null
# encrypted_password :string(128) default(""), not null
# reset_password_token :string(255)
# reset_password_sent_at :datetime
# remember_created_at :datetime
# sign_in_count :integer default(0)
# current_sign_in_at :datetime
# last_sign_in_at :datetime
# current_sign_in_ip :string(255)
# last_sign_in_ip :string(255)
# created_at :datetime
# updated_at :datetime
# name :string(255)
# admin :boolean default(FALSE), not null
#
class UsersProject < ActiveRecord::Base
belongs_to :user
belongs_to :project
attr_protected :project_id, :project
after_commit :update_gitosis_project
validates_uniqueness_of :user_id, :scope => [:project_id]
validates_presence_of :user_id
validates_presence_of :project_id
delegate :name, :email, :to => :user, :prefix => true
def update_gitosis_project
Gitosis.new.configure do |c|
c.update_project(project.path, project.gitosis_writers)
end
end
end
# == Schema Information
#
# Table name: users_projects
#
# id :integer not null, primary key
# user_id :integer not null
# project_id :integer not null
# read :boolean default(FALSE)
# write :boolean default(FALSE)
# admin :boolean default(FALSE)
# created_at :datetime
# updated_at :datetime
#
# encoding: utf-8
class AttachmentUploader < CarrierWave::Uploader::Base
# Include RMagick or ImageScience support:
# include CarrierWave::RMagick
# include CarrierWave::MiniMagick
# include CarrierWave::ImageScience
# Choose what kind of storage to use for this uploader:
storage :file
# storage :fog
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
# Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
# end
# Process files as they are uploaded:
# process :scale => [200, 300]
#
# def scale(width, height)
# # do something
# end
# Create different versions of your uploaded files:
# version :thumb do
# process :scale => [50, 50]
# end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
# def extension_white_list
# %w(jpg jpeg gif png)
# end
# Override the filename of the uploaded files:
# Avoid using model.id or version_name here, see uploader/store.rb for details.
# def filename
# "something.jpg" if original_filename
# end
end
%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
%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
#accordion
%h3
%a New user
%div
%iframe{ :src=> admin_mailer_preview_user_new_path, :width=>"100%", :height=>"350"}
%h3
%a New issue
%div
%iframe{ :src=> admin_mailer_preview_issue_new_path, :width=>"100%", :height=>"350"}
%h3
%a Commit note
%div
%iframe{ :src=> admin_mailer_preview_note_path(:type => "Commit"), :width=>"100%", :height=>"350"}
%h3
%a Issue note
%div
%iframe{ :src=> admin_mailer_preview_note_path(:type => "Issue"), :width=>"100%", :height=>"350"}
%h3
%a Wall note
%div
%iframe{ :src=> admin_mailer_preview_note_path(:type => "Wall"), :width=>"100%", :height=>"350"}
:javascript
$(function() {
$( "#accordion" ).accordion(); });
= form_for [:admin, @admin_project] do |f|
-if @admin_project.errors.any?
#error_explanation
%h2= "#{pluralize(@admin_project.errors.count, "error")} prohibited this admin_project from being saved:"
%ul
- @admin_project.errors.full_messages.each do |msg|
%li= msg
.span-24
.span-12
.field
= f.label :name
%br
= f.text_field :name
.field
= f.label :code
%br
= f.text_field :code
.field
= f.label :path
%br
= f.text_field :path
.span-10
.field
= f.label :description
%br
= f.text_area :description
.clear
.actions
= f.submit 'Save', :class => "lbutton"
= render 'form'
= link_to 'Show', [:admin, @admin_project]
\|
= link_to 'Back', admin_projects_path
%table
%tr
%th Name
%th Code
%th Path
%th Team Members
%th Last Commit
%th
%th
%th
- @admin_projects.each do |project|
%tr
%td= project.name
%td= project.code
%td= project.path
%td= project.users_projects.count
%td= last_commit(project)
%td= link_to 'Show', [:admin, project]
%td= link_to 'Edit', edit_admin_project_path(project), :id => "edit_#{dom_id(project)}"
%td= link_to 'Destroy', [:admin, project], :confirm => 'Are you sure?', :method => :delete
%br
= paginate @admin_projects
= link_to 'New Project', new_admin_project_path
%h1 New project
= render 'form'
= link_to 'Back', admin_projects_path
%p#notice= notice
.span-8.colborder
%h2= @admin_project.name
%p
%b Name:
= @admin_project.name
%p
%b Code:
= @admin_project.code
%p
%b Path:
= @admin_project.path
%p
%b Description:
= @admin_project.description
= link_to 'Edit', edit_admin_project_path(@admin_project)
\|
= link_to 'Back', admin_projects_path
.span-14
%h2 Team
%table.round-borders
%tr
%th Name
%th Added
%th Web
%th Git
%th Admin
%th
- @admin_project.users_projects.each do |tm|
%tr
%td= link_to tm.user_name, admin_team_member_path(tm)
%td= time_ago_in_words(tm.updated_at) + " ago"
%td= check_box_tag "read", 1, @admin_project.readers.include?(tm.user), :disabled => :disabled
%td= check_box_tag "commit", 1, @admin_project.writers.include?(tm.user), :disabled => :disabled
%td.span-2= check_box_tag "admin", 1, @admin_project.admins.include?(tm.user), :disabled => :disabled
%td= link_to 'Destroy', admin_team_member_path(tm), :confirm => 'Are you sure?', :method => :delete
= link_to 'New Team Member', new_admin_team_member_path(:team_member => {:project_id => @admin_project.id})
= form_for @admin_team_member, :as => :team_member, :url => @admin_team_member.new_record? ? admin_team_members_path(@admin_team_member) : admin_team_member_path(@admin_team_member) do |f|
-if @admin_team_member.errors.any?
#error_explanation
%h2= "#{pluralize(@admin_team_member.errors.count, "error")} prohibited this admin_project from being saved:"
%ul
- @admin_team_member.errors.full_messages.each do |msg|
%li= msg
.span-10
- if @admin_team_member.new_record?
.field
= f.label :user_id
%br
= f.select :user_id, User.all.map { |user| [user.name, user.id] }
.field
= f.label :project_id
%br
= f.select :project_id, Project.all.map { |user| [user.name, user.id] }
.span-10
.span-6
%b Access:
.span-8
= f.check_box :read
Web Access (Browse Repo)
.span-8
= f.check_box :write
Git Access (User will be added to commiters list)
.span-6.append-bottom
= f.check_box :admin
Admin (Can manage project)
%hr
.actions
= f.submit 'Save'
= render 'form'
= link_to 'Show', admin_team_member_path(@admin_team_member)
\|
= link_to 'Back', admin_team_members_path
- @admin_team_members.group_by(&:project).sort.each do |project, members|
%h3= link_to project.name, [:admin, project]
%table
%tr
%th Name
%th Email
%th Read
%th Git
%th Manage
%th Added
%th
%th
%th
- members.each do |tm|
- user = tm.user
%tr
%td.span-6= tm.user_name
%td.span-6= tm.user_email
%td.span-1= check_box_tag "read", 1, project.readers.include?(user), :disabled => :disabled
%td.span-1= check_box_tag "commit", 1, project.writers.include?(user), :disabled => :disabled
%td.span-2= check_box_tag "admin", 1, project.admins.include?(user), :disabled => :disabled
%td.span-3= time_ago_in_words(tm.updated_at) + " ago"
%td= link_to 'Show', admin_team_member_path(tm)
%td= link_to 'Edit', edit_admin_team_member_path(tm), :id => "edit_#{dom_id(tm)}"
%td= link_to 'Destroy', admin_team_member_path(tm), :confirm => 'Are you sure?', :method => :delete
%br
= paginate @admin_team_members
= link_to 'New Team Member', new_admin_team_member_path
%h1 New team member
= render 'form'
= link_to 'Back', admin_team_members_path
%p#notice= notice
.span-10
%p
%b Name:
= @admin_team_member.user_name
%p
%b Project:
= @admin_team_member.project.name
%p
%b Since:
= @admin_team_member.updated_at
.span-10
.span-6
%b Access:
.span-8
= check_box_tag "read", 1, @admin_team_member.read, :disabled => :disabled
Web Access (Browse Repo)
.span-8
= check_box_tag "commit", 1, @admin_team_member.write, :disabled => :disabled
Git Access (User will be added to commiters list)
.span-6.append-bottom
= check_box_tag "admin", 1, @admin_team_member.admin, :disabled => :disabled
Admin (Can manage project)
%hr
= link_to 'Edit', edit_admin_team_member_path(@admin_project)
\|
= link_to 'Back', admin_team_members_path
.user_new
= form_for [:admin, @admin_user] do |f|
-if @admin_user.errors.any?
#error_explanation
%h2= "#{pluralize(@admin_user.errors.count, "error")} prohibited this admin_user from being saved:"
%ul
- @admin_user.errors.full_messages.each do |msg|
%li= msg
.span-24
.span-11.colborder
.field
= f.label :name
%br
= f.text_field :name
.field
= f.label :email
%br
= f.text_field :email
.field
= f.label :password
%br
= f.password_field :password
.field
= f.label :password_confirmation
%br
= f.password_field :password_confirmation
.span-11
.field.prepend-top.append-bottom
= f.check_box :admin
= f.label :admin
.field.prepend-top
= f.check_box :allowed_create_repo, :disabled => true
= f.label :allowed_create_repo
.clear
%br
.actions
= f.submit 'Save', :class => "lbutton"
= render 'form'
= link_to 'Show', [:admin, @admin_user], :class => "right lbutton"
= link_to 'Back', admin_users_path, :class => "right lbutton"
%table
%tr
%th Admin
%th Name
%th Email
%th Projects
%th
%th
%th
- @admin_users.each do |user|
%tr
%td= check_box_tag "admin", 1, user.admin, :disabled => :disabled
%td= user.name
%td= user.email
%td= user.users_projects.count
%td= link_to 'Show', [:admin, user]
%td= link_to 'Edit', edit_admin_user_path(user), :id => "edit_#{dom_id(user)}"
%td= link_to 'Destroy', [:admin, user], :confirm => 'Are you sure?', :method => :delete
%br
= paginate @admin_users
= link_to 'New User', new_admin_user_path
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
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