Merge branch 'master' into 90-pull

Fucking conflicts:
	app/controllers/projects/issues_controller.rb
	app/models/ability.rb
	app/views/projects/issues/show.html.haml
	config/routes.rb
	db/schema.rb
	lib/tasks/import.rake
	spec/models/comment_for_commit_spec.rb
	vendor/assets/javascripts/bootstrap-tab.js
	vendor/assets/stylesheets/bootstrap.css
This commit is contained in:
Alexander Machehin 2012-09-25 17:55:30 +06:00
commit dfbf8a8d58
160 changed files with 2889 additions and 1172 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*~
.bundle
.rvmrc
.DS_Store

14
Gemfile
View File

@ -1,6 +1,6 @@
source 'http://rubygems.org'
gem 'rails', '3.2.7' #, :git => 'git://github.com/rails/rails.git'
gem 'rails', '3.2.8' #, :git => 'git://github.com/rails/rails.git'
gem 'pg', '~> 0.14.0'
# gem 'silent-postgres', :git => 'git://github.com/dolzenko/silent-postgres.git' #'~> 0.1.1'
@ -25,14 +25,14 @@ gem 'state_machine'
# gem 'rugged', '~> 0.16.0'
gem 'grack', :git => 'git://github.com/rdblue/grack.git', :require => 'git_http'
gem "grit", :git => 'git://github.com/warpc/grit.git' #, :path => '~/Sites/code/grit'
gem 'charlock_holmes', '~> 0.6.8' #, :git => 'git://github.com/brianmario/charlock_holmes.git', :branch => 'bundle-icu'
gem 'charlock_holmes', '~> 0.6.9' #, :git => 'git://github.com/brianmario/charlock_holmes.git', :branch => 'bundle-icu'
# gem 'ruby-filemagic', '~> 0.4.2', :require => 'filemagic/ext'
gem 'github-linguist', '~> 2.1.2', :require => 'linguist'
gem 'github-linguist', '~> 2.2.1', :require => 'linguist'
gem 'diff-display', '~> 0.0.1'
# Wiki
gem "gollum", :git => 'git://github.com/github/gollum.git'
gem "redcarpet", "1.17.2"
gem "gollum", '~> 2.1.3'
gem "redcarpet", "~> 2.1.1"
gem 'creole'
gem 'rdiscount'
# gem 'org-ruby'
@ -58,7 +58,7 @@ group :assets do
gem 'coffee-rails', '~> 3.2.2'
gem 'compass-rails', '~> 1.0.3'
gem 'uglifier', '~> 1.2.4'
gem 'therubyracer', '~> 0.10.1', :platforms => [:mri, :rbx]
gem 'therubyracer', '~> 0.10.2', :platforms => [:mri, :rbx]
gem 'therubyrhino', '~> 1.73.1', :platforms => :jruby
end
@ -81,7 +81,7 @@ end
group :test do
gem 'rspec-rails', '~> 2.11.0', :group => 'development'
gem 'factory_girl_rails', '~> 3.6.0'
gem 'factory_girl_rails', '~> 4.0.0'
gem 'rr', '~> 1.0.4'
gem 'shoulda'
end

View File

@ -6,23 +6,6 @@ GIT
redhillonrails_core (2.0.0.pre)
activerecord (>= 3.1.0.rc)
GIT
remote: git://github.com/github/gollum.git
revision: 8422b712048656c8ea391c2d7ef27fb29f66746b
specs:
gollum (2.1.0)
github-markdown
github-markup (>= 0.7.0, < 1.0.0)
grit (~> 2.5.0)
mustache (>= 0.11.2, < 1.0.0)
nokogiri (~> 1.4)
posix-spawn (~> 0.3.0)
pygments.rb (~> 0.2.0)
sanitize (~> 2.0.0)
sinatra (~> 1.0)
stringex (~> 1.4.0)
useragent (~> 0.4.9)
GIT
remote: git://github.com/rdblue/grack.git
revision: 020be3fef3fb308b9d214252522aa5945bf6584a
@ -42,12 +25,12 @@ GEM
remote: http://rubygems.org/
specs:
RedCloth (4.2.9)
actionmailer (3.2.7)
actionpack (= 3.2.7)
actionmailer (3.2.8)
actionpack (= 3.2.8)
mail (~> 2.4.4)
actionpack (3.2.7)
activemodel (= 3.2.7)
activesupport (= 3.2.7)
actionpack (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
@ -55,18 +38,18 @@ GEM
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.1.3)
activemodel (3.2.7)
activesupport (= 3.2.7)
activemodel (3.2.8)
activesupport (= 3.2.8)
builder (~> 3.0.0)
activerecord (3.2.7)
activemodel (= 3.2.7)
activesupport (= 3.2.7)
activerecord (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.7)
activemodel (= 3.2.7)
activesupport (= 3.2.7)
activesupport (3.2.7)
activeresource (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
activesupport (3.2.8)
i18n (~> 0.6)
multi_json (~> 1.0)
airbrake (3.1.2)
@ -92,9 +75,9 @@ GEM
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
capistrano_colors (0.5.5)
charlock_holmes (0.6.8)
charlock_holmes (0.6.9)
chronic (0.6.7)
chunky_png (1.2.5)
chunky_png (1.2.6)
cocaine (0.2.1)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
@ -125,21 +108,33 @@ GEM
execjs (1.4.0)
multi_json (~> 1.0)
expression_parser (0.9.0)
factory_girl (3.6.0)
factory_girl (4.0.0)
activesupport (>= 3.0.0)
factory_girl_rails (3.6.0)
factory_girl (~> 3.6.0)
factory_girl_rails (4.0.0)
factory_girl (~> 4.0.0)
railties (>= 3.0.0)
ffi (1.0.11)
fssm (0.2.9)
github-linguist (2.1.2)
github-linguist (2.2.1)
charlock_holmes (~> 0.6.6)
escape_utils (~> 0.2.3)
mime-types (~> 1.18)
pygments.rb (>= 0.2.13)
github-markdown (0.5.0)
github-markup (0.7.4)
haml (3.1.6)
gollum (2.1.3)
github-markdown
github-markup (>= 0.7.0, < 1.0.0)
grit (~> 2.5.0)
mustache (>= 0.11.2, < 1.0.0)
nokogiri (~> 1.4)
posix-spawn (~> 0.3.0)
pygments.rb (~> 0.2.0)
sanitize (~> 2.0.0)
sinatra (~> 1.0)
stringex (~> 1.4.0)
useragent (~> 0.4.9)
haml (3.1.7)
haml-rails (0.3.4)
actionpack (~> 3.0)
activesupport (~> 3.0)
@ -150,7 +145,7 @@ GEM
hike (1.2.1)
hirb (0.7.0)
i18n (0.6.0)
jbuilder (0.4.0)
jbuilder (0.4.3)
activesupport (>= 3.0.0)
blankslate (>= 2.1.2.4)
journey (1.0.4)
@ -223,14 +218,14 @@ GEM
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.2.7)
actionmailer (= 3.2.7)
actionpack (= 3.2.7)
activerecord (= 3.2.7)
activeresource (= 3.2.7)
activesupport (= 3.2.7)
rails (3.2.8)
actionmailer (= 3.2.8)
actionpack (= 3.2.8)
activerecord (= 3.2.8)
activeresource (= 3.2.8)
activesupport (= 3.2.8)
bundler (~> 1.0)
railties (= 3.2.7)
railties (= 3.2.8)
rails-backbone (0.7.2)
coffee-script (~> 2.2.0)
ejs (~> 1.0.0)
@ -239,9 +234,9 @@ GEM
railties (>= 3.0.0)
rails3-jquery-autocomplete (1.0.7)
rails (~> 3.0)
railties (3.2.7)
actionpack (= 3.2.7)
activesupport (= 3.2.7)
railties (3.2.8)
actionpack (= 3.2.8)
activesupport (= 3.2.8)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
@ -251,9 +246,9 @@ GEM
rdiscount (1.6.8)
rdoc (3.12)
json (~> 1.4)
redcarpet (1.17.2)
redcarpet (2.1.1)
redis (3.0.1)
redis-namespace (1.2.0)
redis-namespace (1.2.1)
redis (~> 3.0.0)
redisk (0.2.2)
redis (>= 0.1.1)
@ -277,7 +272,7 @@ GEM
rspec-core (2.11.1)
rspec-expectations (2.11.2)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.1)
rspec-mocks (2.11.2)
rspec-rails (2.11.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
@ -296,7 +291,7 @@ GEM
capistrano (>= 2.0.0)
sanitize (2.0.3)
nokogiri (>= 1.4.4, < 1.6)
sass (3.1.20)
sass (3.2.0)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
@ -324,19 +319,19 @@ GEM
state_machine (1.1.2)
stringex (1.4.0)
systemu (2.5.2)
therubyracer (0.10.1)
therubyracer (0.10.2)
libv8 (~> 3.3.10)
thin (1.4.1)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
thor (0.15.4)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.33)
uglifier (1.2.6)
uglifier (1.2.7)
execjs (>= 0.3.0)
multi_json (~> 1.3)
unicorn (4.3.1)
@ -370,15 +365,15 @@ DEPENDENCIES
cape
capistrano
capistrano_colors
charlock_holmes (~> 0.6.8)
charlock_holmes (~> 0.6.9)
coffee-rails (~> 3.2.2)
compass-rails (~> 1.0.3)
creole
devise (~> 2.1.2)
diff-display (~> 0.0.1)
factory_girl_rails (~> 3.6.0)
github-linguist (~> 2.1.2)
gollum!
factory_girl_rails (~> 4.0.0)
github-linguist (~> 2.2.1)
gollum (~> 2.1.3)
grack!
grit!
haml-rails (~> 0.3.4)
@ -394,12 +389,12 @@ DEPENDENCIES
paperclip (~> 3.1.4)
perform_later (~> 1.3.0)
pg (~> 0.14.0)
rails (= 3.2.7)
rails (= 3.2.8)
rails-backbone (~> 0.7.2)
rails3-generators
rails3-jquery-autocomplete (~> 1.0.7)
rdiscount
redcarpet (= 1.17.2)
redcarpet (~> 2.1.1)
redhillonrails_core!
resque (~> 1.21.0)
resque-status (~> 0.3.3)
@ -413,7 +408,7 @@ DEPENDENCIES
shotgun
shoulda
state_machine
therubyracer (~> 0.10.1)
therubyracer (~> 0.10.2)
therubyrhino (~> 1.73.1)
trinidad (~> 1.0.2)
uglifier (~> 1.2.4)

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

View File

@ -34,7 +34,7 @@ $(document).ready(function() {
var current = $(this);
current.parent().find('input.user_role_chbx').each(function(i,el) {
if ($(el).attr('id') != current.attr('id')) {
$(el).removeAttr('checked');
$(el).removeAttr('checked');
}
});
});
@ -81,4 +81,10 @@ $(document).ready(function() {
}
return false;
});
window.CodeMirrorRun = function(code) {
CodeMirror.runMode(code.innerHTML.replace(/&amp;/gi, '&').replace(/&lt;/gi, '<').replace(/&gt;/gi, '>'), code.className, code);
}
$('.md_and_cm code').each(function (code) { CodeMirrorRun(this); });
});

View File

@ -0,0 +1,23 @@
Rosa.Views.ProjectModifyView = Backbone.View.extend({
initialize: function() {
_.bindAll(this, 'checkboxClick');
this.$checkbox_wrapper = $('#niceCheckbox1');
this._$checkbox = this.$checkbox_wrapper.children('#project_is_package').first();
this.$maintainer_form = $('#maintainer_form');
this.$checkbox_wrapper.on('click', this.checkboxClick);
},
checkboxClick: function() {
if (this._$checkbox.is(':checked')) {
this.$maintainer_form.slideDown();
} else {
this.$maintainer_form.slideUp();
}
},
render: function() {
this.checkboxClick();
}
});

View File

@ -1,32 +1,32 @@
function changeCheck(el) {
var el = el, input = el.find('input[type="checkbox"]');
if(input.attr("checked")) {
el.css('backgroundPosition', '0 0');
input.removeAttr('checked');
} else {
el.css('backgroundPosition', '0 -18px');
input.attr('checked', true);
}
return true;
}
function startChangeCheck(el) {
var el = el, input = el.find('input[type="checkbox"]');
if(input.attr('checked')) {
el.css('backgroundPosition', '0 -18px');
}
return true;
}
$(document).ready(function(){
$('.niceCheck-main').each(function(i,el) {
startChangeCheck($(el));
});
$('.niceCheck-main').click(function() {
changeCheck($(this));
});
});
function changeCheck(el) {
var input = el.find('input[type="checkbox"]');
if(input.attr("checked")) {
el.css('backgroundPosition', '0 0');
input.removeAttr('checked');
} else {
el.css('backgroundPosition', '0 -18px');
input.attr('checked', true);
}
return true;
}
function startChangeCheck(el) {
var input = el.find('input[type="checkbox"]');
if(input.attr('checked')) {
el.css('backgroundPosition', '0 -18px');
}
return true;
}
$(document).ready(function(){
$('.niceCheck-main').each(function(i,el) {
startChangeCheck($(el));
});
$('.niceCheck-main').click(function() {
changeCheck($(this));
});
});

View File

@ -1,98 +1,47 @@
$(document).ready(function() {
// TODO: Refactor this handler!! It's too complicated.
$('#build_list_save_to_platform_id').change(function() {
var platform_id = $(this).val();
var base_platforms = $('.all_platforms input[type=checkbox].build_bpl_ids');
$('#build_list_save_to_repository_id').change(function() {
var selected_option = $(this).find("option:selected");
base_platforms.each(function(){
if ($.inArray(platform_id, base_platforms.map(function(){ return $(this).val() }).get()) >= 0) {
if ($(this).val() == platform_id) {
if ($(this).attr('data-released') === '1') {
$('#build_list_auto_publish').removeAttr('checked').attr('disabled', 'disabled');
//disableUpdateTypes();
} else {
$('#build_list_auto_publish').removeAttr('disabled').attr('checked', 'checked');
//enableUpdateTypes();
}
var platform_id = selected_option.attr('platform_id');
var rep_name = selected_option.text().match(/[\w-]+\/([\w-]+)/)[1];
$(this).attr('checked', 'checked').removeAttr('disabled').trigger('change');
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled');
var rep_name = $('#build_list_save_to_platform_id option[value="' + $(this).val() + '"]').text().match(/[\w-]+\/([\w-]+)/)[1];
if (rep_name != 'main') {
$(this).parent().find('.offset25 input[type="checkbox"][rep_name="' + rep_name + '"]').attr('checked', 'checked');
}
$(this).parent().find('.offset25 input[type="checkbox"][rep_name="main"]').attr('checked', 'checked');
} else {
$(this).removeAttr('checked').attr('disabled', 'disabled').trigger('change');
$(this).parent().find('.offset25 input[type="checkbox"]').attr('disabled', 'disabled').removeAttr('checked');
}
} else {
$(this).removeAttr('disabled').removeAttr('checked').trigger('change');
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled').removeAttr('checked');
$('#build_list_auto_publish').removeAttr('disabled').attr('checked', 'checked');
var build_platform = $('#build_for_pl_' + platform_id);
var all_repositories = $('.all_platforms input');
all_repositories.removeAttr('checked');
if (build_platform.size() == 0) {
all_repositories.removeAttr('disabled');
} else {
all_repositories.attr('disabled', 'disabled');
var parent = build_platform.parent();
parent.find('input').removeAttr('disabled');
parent.find('input[rep_name="main"]').attr('checked', 'checked');
if (rep_name != 'main') {
parent.find('input[rep_name="' + rep_name + '"]').attr('checked', 'checked');
}
});
if ($.inArray(platform_id, base_platforms.map(function(){ return $(this).val() }).get()) == -1) {
// For personal platforms update types always enebaled:
enableUpdateTypes();
setBranchSelected(selected_option);
}
var build_list_auto_publish = $('#build_list_auto_publish');
if (selected_option.attr('publish_without_qa') == '1') {
build_list_auto_publish.removeAttr('disabled').attr('checked', 'checked');
} else {
build_list_auto_publish.removeAttr('checked').attr('disabled', 'disabled');
}
setBranchSelected();
});
$('#build_list_save_to_platform_id').trigger('change');
$('.offset25 label').click(function() {
setPlChecked($(this).prev()[0], !$(this).prev().attr('checked'));
});
$('.offset25 input[type="checkbox"]').click(function() {
setPlChecked(this, $(this).attr('checked'));
});
$('.build_bpl_ids').click(function() {
return false;
});
$('#build_list_save_to_repository_id').trigger('change');
});
function setPlChecked(pointer, checked) {
var pl_cbx = $(pointer).parent().parent().parent().find('input[type="checkbox"].build_bpl_ids');
var pl_id = pl_cbx.val();
if (checked && !$(pointer).attr('disabled')) {
pl_cbx.attr('checked', 'checked').trigger('change');
} else if ($('input[pl_id=' + pl_id + '][checked="checked"]').size() == 0) {
pl_cbx.removeAttr('checked').trigger('change');
function setBranchSelected(selected_option) {
var pl_name = selected_option.text().match(/([\w-.]+)\/[\w-.]+/)[1];
var bl_version_sel = $('#build_list_project_version');
var branch_pl_opt = bl_version_sel.find('option[value="latest_' + pl_name + '"]');
// If there is branch we need - set it selected:
if (branch_pl_opt.size() > 0) {
bl_version_sel.find('option[selected]').removeAttr('selected');
branch_pl_opt.attr('selected', 'selected');
bl_version_sel.val(branch_pl_opt);
// hack for FF to force render of select box.
bl_version_sel[0].innerHTML = bl_version_sel[0].innerHTML;
}
}
function setBranchSelected() {
var pl_id = $('#build_list_save_to_platform_id').val();
// Checks if selected platform is main or not:
if ( $('.all_platforms').find('input[type="checkbox"][value=' + pl_id + '].build_bpl_ids').size() > 0 ) {
var pl_name = $('#build_list_save_to_platform_id option[value="' + pl_id + '"]').text().match(/([\w-.]+)\/[\w-.]+/)[1];
var branch_pl_opt = $('#build_list_project_version option[value="latest_' + pl_name + '"]');
// If there is branch we need - set it selected:
if ( branch_pl_opt.size() > 0 ) {
$('#build_list_project_version option[selected]').removeAttr('selected');
branch_pl_opt.attr('selected', 'selected');
}
}
}
function disableUpdateTypes() {
$("select#build_list_update_type option").each(function(i,el) {
if ( $.inArray($(el).attr("value"), ["security", "bugfix"]) == -1 ) {
$(el).attr("disabled", "disabled");
// If disabled option is selected - select 'bugfix':
if ( $(el).attr("selected") ) {
$( $('select#build_list_update_type option[value="bugfix"]') ).attr("selected", "selected");
}
}
});
}
function enableUpdateTypes() {
$("select#build_list_update_type option").removeAttr("disabled");
}

View File

@ -0,0 +1,34 @@
$(document).ready(function() {
$('.buttons a.edit_comment').live('click', function() {
$(this).parent().parent().parent().hide();
$('#open-comment'+'.comment.'+$(this).attr('id')).show();
return false;
});
$('.cancel_edit_comment.button').live('click', function() {
$(this).parent().parent().parent().hide();
$('.buttons a.edit_comment#'+$(this).attr('id')).parent().parent().parent().show();
return false;
});
$('form.edit_comment').live('submit', function() {
var form = $(this);
form.parent().find('.flash').remove();
$.ajax({
type: 'POST',
url: form.attr("action"),
data: form.serialize(),
success: function(data){
var cancel_button = form.find('.cancel_edit_comment.button');
cancel_button.click();
$('.buttons a.edit_comment#'+cancel_button.attr('id')).parent().parent().find('.cm-s-default.md_and_cm').html(data).find('code').each(function (code) { CodeMirrorRun(this); })
},
error: function(data){
form.before(data.responseText);
}
});
return false;
});
});

View File

@ -0,0 +1,23 @@
$(document).ready(function() {
var preview_url = $('#preview_url').val();
$('#md_tabs.nav.nav-tabs').each(function(i) { $(this).find('a:first').tab('show') });
$('#md_tabs a[data-toggle="tab"]').on('shown', function (e) {
if(e.relatedTarget) { var hash = e.relatedTarget.hash; }
else { var hash = e.currentTarget.hash; }
var el = $(hash+'_input');
var el_dup = $(hash+'_input_dup');
var preview = $(e.target.hash+' > .formatted.cm-s-default');
if(el.val() != el_dup.val() || preview.val() === '') {
el_dup.val(el.val());
$.ajax({
type: 'POST',
url: preview_url,
data: el_dup.serialize(),
success: function(data){
preview.html(data).find('code').each(function (code) { CodeMirrorRun(this); })
}
});
};
});
});

View File

@ -224,6 +224,7 @@ $(document).ready(function() {
$('.edit_form.issue').live('submit', function() {
var form = $(this);
form.parent().find('.flash').remove();
$.ajax({
type: 'POST',
url: form.attr("action"),
@ -232,10 +233,10 @@ $(document).ready(function() {
form.fadeOut('slow');
$('#edit_issue_content').fadeIn('slow');
$('h3.issue_title').html(form.find('#issue_title').attr('value'));
$('.fulltext.view.issue_body').html(form.find('#issue_body').attr('value'));
$('.fulltext.view.issue_body').html(data).find('code').each(function (code) { CodeMirrorRun(this); })
},
error: function(data){
alert('error'); // TODO remove
form.before(data.responseText);
}
});
return false;

View File

@ -760,7 +760,7 @@ div.tos ol li {
}
div.tos_sidebar ul {
list-style: none outside none;
list-style: none outside none;
margin: 20px 0 0;
padding: 0;
text-align: left;
@ -1160,19 +1160,19 @@ form.mass_build section.right {
}
/* remove this lines after change to backbone */
table.tablesorter.advisories thead tr.search th {
table.tablesorter.static-search thead tr.search th {
padding: 0 5px;
}
table.tablesorter.advisories thead tr.search th input[type='text'] {
table.tablesorter.static-search thead tr.search th input[type='text'] {
width: 640px;
}
table.tablesorter.advisories thead tr.search th form {
table.tablesorter.static-search thead tr.search th form {
float: left;
}
table.tablesorter.advisories thead tr.search th form.button_to {
table.tablesorter.static-search thead tr.search th form.button_to {
padding: 3px 0 0 7px;
}
@ -1401,10 +1401,238 @@ hr.bootstrap {
}
}
time.js-relative-date {
display: block;
}
div.reloader {
float: right;
}
div.log-wrapper {
width: 565px;
div.log-header {
margin-bottom: 10px;
div.text-wrap, span {
height: 16px;
margin: 0;
padding: 0;
}
div.text-wrap {
width: 545px;
float: left;
h3 {
margin: 0;
}
}
span {
background: image-url("trigger.gif") no-repeat scroll left bottom transparent;
margin: 1px;
cursor: pointer;
display: block;
font-size: 0;
height: 14px;
width: 14px;
float: right;
}
span.closed {
background-position: left top;
}
}
div.log-body {
div.reloader, .log {
border: 1px solid #ccc;
}
div.reloader {
padding: 5px 10px;
border-bottom: none;
border-radius: 5px 5px 0 0;
table.options {
border-spacing: 5px 0;
tr {
td a {
display: inline-block;
height: 13px;
padding-left: 16px;
background: image-url('code.png') no-repeat;
padding-bottom: 2px;
margin: 2px 0 0 1px;
}
td.first {
padding-right: 5px;
}
td.last {
border-left: 1px solid #ccc;
}
}
tr.bottom {
td {
padding-left: 5px;
}
td.first {
border-top: 1px solid #ccc;
}
}
}
}
.log {
background: #f8f8f8;
height: 500px;
width: 543px;
min-width: 543px;
border-radius: 5px 0 5px 5px;
overflow: auto;
padding: 10px;
margin: 0;
font-family: monospace;
font-size: 13px;
}
}
}
table.tablesorter.platform-maintainers.static-search thead tr.search th input[type="text"] {
width: 430px;
}
.all_platforms {
> .both { margin: 0 0 5px; }
.build_for_pl { font-weight: bold; }
.offset25 { padding-left: 10px }
}
.md_and_cm {
overflow: auto;
margin: 10px 0 10px;
padding: 5px;
border-radius: 4px 4px 4px 4px;
background: #FFF;
pre {
background-color: #F8F8F8;
border: 1px solid #D6D6D6;
border-radius: 5px 5px 5px 5px;
color: #333333;
padding: 6px 10px;
overflow: auto;
code {
background-color: transparent;
border: none;
}
}
code {
background-color: #F8F8F8;
border: 1px solid #D6D6D6;
border-radius: 5px 5px 5px 5px;
margin: 0 2px;
padding: 0px 5px;
}
blockquote {
border-left: 4px solid #EDEDED;
padding: 0 15px;
}
p {
margin-top: 10px;
}
}
.md_and_cm > :first-child {
margin-top: 0 !important;
}
#md_tabs {
margin: 0;
}
#md_tabs.nav-tabs > li > a {
line-height: 5px;
}
#open-comment {
textarea {
background: none repeat scroll 0 0 #FFFFFF;
border: 1px solid #DEDEDE;
border-radius: 4px 4px 4px 4px;
color: #575756;
font-size: 12px;
height: 110px;
padding: 5px;
width: 98%;
max-width: 98%;
margin: 10px 0 10px;
resize: vertical;
}
textarea#issue_title {
height: 16px;
margin: 0 0 10px;
}
.tab-pane textarea {
min-height: 112px;
}
.edit_comment .comment-left {
margin-top: 0;
}
}
#open-comment > h3.tmargin0 {
margin-bottom: 0;
}
#md_help {
width: 800px;
top: 30%;
left: 42%;
.modal-body {
max-height: 560px;
padding-top: 0;
}
.modal-header {
padding-bottom: 0;
}
.col {
width: 245px;
float: left;
padding: 0;
margin-right: 10px;
h3 {
margin: 6px 0 0 0;
}
pre {
background: none repeat scroll 0 0 #EDEDED;
box-shadow: 0 3px 3px -1px rgba(18, 86, 135, 0.2);
border: 1px solid #EDEDED;
padding: 5px;
margin-top: 3px;
}
}
}
#repo-wrapper .edit_form.issue div.comment div.wrapper {
background: 0;
border: 0;
border-radius: 0;
height: 30px;
margin: 0;
padding: 0;
}

View File

@ -828,11 +828,11 @@ article div.activity div.fulltext.view {
margin: 0px 0px 10px 0px;
}
.right div.rightlist div.check {
div.rightlist div.check {
float: left;
}
.right div.rightlist div.forcheck {
div.rightlist div.forcheck {
float: left;
margin: 1px 0px 0px 5px;
}

View File

@ -10,7 +10,7 @@ class Groups::ProfileController < Groups::BaseController
end
def show
@projects = @group.projects #.paginate(:page => params[:project_page], :per_page => 10)
@projects = @group.projects.by_visibilities(['open'])
end
def new

View File

@ -9,11 +9,11 @@ class PagesController < ApplicationController
def tour_inside
@entries = case params[:id]
when 'projects'
when 'builds'
%w(repo builds monitoring)
when 'sources'
%w(source history annotation edit)
when 'builds'
when 'projects'
%w(control git tracker)
end
render "pages/tour/tour-inside", :layout => 'tour'

View File

@ -0,0 +1,15 @@
# -*- encoding : utf-8 -*-
class Platforms::MaintainersController < ApplicationController
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:index] if APP_CONFIG['anonymous_access']
load_and_authorize_resource :platform
def index
@maintainers = BuildList::Package.actual.by_platform(@platform)
.order('lower(name) ASC, length(name) ASC')
.includes(:project)
@maintainers = @maintainers.where('name ILIKE ?', "%#{params[:q]}%") if params[:q].present?
@maintainers = @maintainers.paginate(:page => params[:page])
end
end

View File

@ -2,7 +2,7 @@
class Platforms::PlatformsController < Platforms::BaseController
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:advisories] if APP_CONFIG['anonymous_access']
skip_before_filter :authenticate_user!, :only => [:advisories, :members, :show] if APP_CONFIG['anonymous_access']
load_and_authorize_resource
autocomplete :user, :uname
@ -86,33 +86,23 @@ class Platforms::PlatformsController < Platforms::BaseController
end
def remove_members
all_user_ids = params['user_remove'].inject([]) {|a, (k, v)| a << k if v.first == '1'; a}
all_user_ids.each do |uid|
Relation.by_target(@platform).where(:actor_id => uid, :actor_type => 'User').each{|r| r.destroy}
end
user_ids = params[:user_remove] ?
params[:user_remove].map{ |k, v| k if v.first == '1' }.compact : []
User.where(:id => user_ids).each{ |user| @platform.remove_member(user) }
redirect_to members_platform_path(@platform)
end
def remove_member
u = User.find(params[:member_id])
Relation.by_actor(u).by_target(@platform).each{|r| r.destroy}
User.where(:id => params[:member_id]).each{ |user| @platform.remove_member(user) }
redirect_to members_platform_path(@platform)
end
def add_member
if params[:member_id].present?
member = User.find(params[:member_id])
if @platform.relations.exists?(:actor_id => member.id, :actor_type => member.class.to_s) or @platform.owner == member
flash[:warning] = t('flash.platform.members.already_added', :name => member.uname)
if member = User.where(:id => params[:member_id]).first
if @platform.add_member(member)
flash[:notice] = t('flash.platform.members.successfully_added', :name => member.uname)
else
rel = @platform.relations.build(:role => 'admin')
rel.actor = member
if rel.save
flash[:notice] = t('flash.platform.members.successfully_added', :name => member.uname)
else
flash[:error] = t('flash.platform.members.error_in_adding', :name => member.uname)
end
flash[:error] = t('flash.platform.members.error_in_adding', :name => member.uname)
end
end
redirect_to members_platform_url(@platform)

View File

@ -23,7 +23,7 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
end
def destroy
if @product_build_list.destroy
if @product_build_list.destroy
flash[:notice] = t('flash.product_build_list.delete')
else
flash[:error] = t('flash.product_build_list.delete_error')

View File

@ -1,7 +1,8 @@
# -*- encoding : utf-8 -*-
class Platforms::ProductsController < Platforms::BaseController
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:index, :show] if APP_CONFIG['anonymous_access']
load_and_authorize_resource :platform
load_and_authorize_resource :product, :through => :platform

View File

@ -1,9 +1,11 @@
# -*- encoding : utf-8 -*-
class Platforms::RepositoriesController < Platforms::BaseController
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:index, :show, :projects_list] if APP_CONFIG['anonymous_access']
load_and_authorize_resource :platform
load_and_authorize_resource :repository, :through => :platform, :shallow => true
before_filter :set_members, :only => [:edit, :update]
def index
@repositories = @repositories.paginate(:page => params[:page])
@ -14,6 +16,46 @@ class Platforms::RepositoriesController < Platforms::BaseController
@projects = @projects.search(params[:query]).search_order if params[:query].present?
end
def edit
end
def update
if @repository.update_attributes(
:description => params[:repository][:description],
:publish_without_qa => (params[:repository][:publish_without_qa] || @repository.publish_without_qa)
)
flash[:notice] = I18n.t("flash.repository.updated")
redirect_to platform_repository_path(@platform, @repository)
else
flash[:error] = I18n.t("flash.repository.update_error")
flash[:warning] = @repository.errors.full_messages.join('. ')
render :action => :edit
end
end
def remove_members
user_ids = params[:user_remove] ?
params[:user_remove].map{ |k, v| k if v.first == '1' }.compact : []
User.where(:id => user_ids).each{ |user| @repository.remove_member(user) }
redirect_to edit_platform_repository_path(@platform, @repository)
end
def remove_member
User.where(:id => params[:member_id]).each{ |user| @repository.remove_member(user) }
redirect_to edit_platform_repository_path(@platform, @repository)
end
def add_member
if member = User.where(:id => params[:member_id]).first
if @repository.add_member(member)
flash[:notice] = t('flash.repository.members.successfully_added', :name => member.uname)
else
flash[:error] = t('flash.repository.members.error_in_adding', :name => member.uname)
end
end
redirect_to edit_platform_repository_path(@platform, @repository)
end
def new
@repository = Repository.new
@platform_id = params[:platform_id]
@ -94,4 +136,10 @@ class Platforms::RepositoriesController < Platforms::BaseController
redirect_to platform_repository_path(@platform, @repository), :notice => t('flash.repository.project_removed')
end
protected
def set_members
@members = @repository.members.order('name')
end
end

View File

@ -5,9 +5,9 @@ class Projects::BuildListsController < Projects::BaseController
before_filter :authenticate_user!, :except => CALLBACK_ACTIONS
before_filter :authenticate_build_service!, :only => CALLBACK_ACTIONS
skip_before_filter :authenticate_user!, :only => [:show, :index, :search] if APP_CONFIG['anonymous_access']
skip_before_filter :authenticate_user!, :only => [:show, :index, :search, :log] if APP_CONFIG['anonymous_access']
before_filter :find_build_list, :only => [:show, :publish, :cancel, :update]
before_filter :find_build_list, :only => [:show, :publish, :cancel, :update, :log]
before_filter :find_build_list_by_bs, :only => [:publish_build, :status_build, :pre_build, :post_build, :circle_build]
load_and_authorize_resource :project, :only => NESTED_ACTIONS
@ -44,15 +44,18 @@ class Projects::BuildListsController < Projects::BaseController
def create
notices, errors = [], []
@platform = Platform.includes(:repositories).find params[:build_list][:save_to_platform_id]
@repository = Repository.find params[:build_list][:save_to_repository_id]
@platform = @repository.platform
@repository = @project.repositories.where(:id => @platform.repository_ids).first
params[:build_list][:save_to_platform_id] = @platform.id
params[:build_list][:auto_publish] = false unless @repository.publish_without_qa?
params[:build_list][:save_to_repository_id] = @repository.id
params[:build_list][:auto_publish] = false if @platform.released
build_for_platforms = Repository.select(:platform_id).
where(:id => params[:build_list][:include_repos]).group(:platform_id).map(&:platform_id)
Arch.where(:id => params[:arches]).each do |arch|
Platform.main.where(:id => params[:build_for_platforms]).each do |build_for_platform|
Platform.main.where(:id => build_for_platforms).each do |build_for_platform|
@build_list = @project.build_lists.build(params[:build_list])
@build_list.commit_hash = @project.repo.commits(@build_list.project_version.match(/^latest_(.+)/).to_a.last ||
@build_list.project_version).first.id if @build_list.project_version
@ -101,6 +104,15 @@ class Projects::BuildListsController < Projects::BaseController
end
end
def log
@log = `tail -n #{params[:load_lines].to_i} #{Rails.root + 'public' + @build_list.fs_log_path}`
@log = t("layout.build_lists.log.not_available") unless $?.success?
respond_to do |format|
format.json { render :json => { :log => @log, :building => @build_list.build_started? } }
end
end
def publish_build
if params[:status].to_i == 0 # ok
@build_list.published

View File

@ -4,7 +4,7 @@ class Projects::CommentsController < Projects::BaseController
load_and_authorize_resource :project
before_filter :find_commentable
before_filter :find_or_build_comment
load_and_authorize_resource
load_and_authorize_resource #:through => :commentable
include CommentsHelper
@ -14,7 +14,8 @@ class Projects::CommentsController < Projects::BaseController
redirect_to project_commentable_path(@project, @commentable)
else
flash[:error] = I18n.t("flash.comment.save_error")
render :action => 'new'
flash[:warning] = @comment.errors.full_messages.join('. ')
redirect_to project_commentable_path(@project, @commentable)
end
end
@ -22,13 +23,12 @@ class Projects::CommentsController < Projects::BaseController
end
def update
if @comment.update_attributes(params[:comment])
flash[:notice] = I18n.t("flash.comment.saved")
redirect_to project_commentable_path(@project, @commentable)
status, message = if @comment.update_attributes(params[:comment])
[200, view_context.markdown(@comment.body)]
else
flash[:error] = I18n.t("flash.comment.save_error")
render :action => 'new'
[400, view_context.local_alert(@comment.errors.full_messages.join('. '))]
end
render :inline => message, :status => status
end
def destroy

View File

@ -1,6 +1,7 @@
# -*- encoding : utf-8 -*-
class Projects::Git::TreesController < Projects::Git::BaseController
before_filter lambda{redirect_to @project if params[:treeish] == @project.default_branch and params[:path].blank?}, :only => 'show'
before_filter lambda{redirect_to @project if params[:treeish] == @project.default_branch and params[:path].blank?}, :only => :show
skip_before_filter :set_branch_and_tree, :only => :archive
def show
@tree = @tree / @path if @path.present?
@ -9,13 +10,18 @@ class Projects::Git::TreesController < Projects::Git::BaseController
end
def archive
@commit = @project.repo.log(@treeish, nil, :max_count => 1).first
format = params[:format]
if (@treeish =~ /^#{@project.owner.uname}-#{@project.name}-/) && !(@treeish =~ /[\s]+/) && (format =~ /^(zip|tar\.gz)$/)
@treeish = @treeish.gsub(/^#{@project.owner.uname}-#{@project.name}-/, '')
@commit = @project.repo.commits(@treeish, 1).first
end
raise Grit::NoSuchPathError unless @commit
name = "#{@project.owner.uname}-#{@project.name}#{@project.repo.tags.include?(@treeish) ? "-#{@treeish}" : ''}-#{@commit.id[0..19]}"
fullname = "#{name}.#{params[:format] == 'tar' ? 'tar.gz' : 'zip'}"
name = "#{@project.owner.uname}-#{@project.name}-#{@treeish}"
fullname = "#{name}.#{format == 'zip' ? 'zip' : 'tar.gz'}"
file = Tempfile.new fullname, 'tmp'
system("cd #{@project.path}; git archive --format=#{params[:format]} --prefix=#{name}/ #{@treeish} #{params[:format] == 'tar' ? ' | gzip -9' : ''} > #{file.path}")
system("cd #{@project.path}; git archive --format=#{format} --prefix=#{name}/ #{@treeish} #{format == 'zip' ? '' : ' | gzip -9'} > #{file.path}")
file.close
send_file file.path, :disposition => 'attachment', :type => "application/#{params[:format] == 'tar' ? 'x-tar-gz' : 'zip'}", :filename => fullname
send_file file.path, :disposition => 'attachment', :type => "application/#{format == 'zip' ? 'zip' : 'x-tar-gz'}", :filename => fullname
end
end

View File

@ -1,33 +1,31 @@
# -*- encoding : utf-8 -*-
class Projects::IssuesController < Projects::BaseController
NON_RESTFUL_ACTION = [:create_label, :update_label, :destroy_label, :search_collaborators]
NON_RESTFUL_ACTION = [:create_label, :update_label, :destroy_label]
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:index, :show] if APP_CONFIG['anonymous_access']
load_resource :project
load_and_authorize_resource :issue, :through => :project, :find_by => :serial_id, :only => [:show, :edit, :update, :destroy, :new, :create, :index]
before_filter :load_and_authorize_label, :only => NON_RESTFUL_ACTION
layout 'application'
layout false, :only => [:update, :search_collaborators]
def index(status = 200)
@labels = params[:labels] || []
@issues = @project.issues.includes(:pull_request).includes(:assignee, :user)
@issues = @issues.where(:assignee_id => current_user.id) if @is_assigned_to_me = params[:filter] == 'to_me'
@issues = @issues.joins(:labels).where(:labels => {:name => @labels}) unless @labels == []
# Using mb_chars for correct transform to lowercase ('Русский Текст'.downcase => "Русский Текст")
@issues = @issues.where('issues.title ILIKE ?', "%#{params[:search_issue].mb_chars.downcase}%") if params[:search_issue]
@opened_issues = @issues.not_closed_or_merged.count
@closed_issues = @issues.closed_or_merged.count
@issues = @issues
@opened_issues, @closed_issues = @issues.not_closed_or_merged.count, @issues.closed_or_merged.count
if params[:status] == 'closed'
@issues = @issues.closed_or_merged
@status = params[:status]
@issues, @status = @issues.closed_or_merged, params[:status]
else
@issues = @issues.not_closed_or_merged
@status = 'open'
@issues, @status = @issues.not_closed_or_merged, 'open'
end
@issues = @issues.order('issues.serial_id desc').uniq.paginate :per_page => 10, :page => params[:page]
@issues = @issues.includes(:assignee, :user).order('issues.serial_id desc').uniq
.paginate :per_page => 10, :page => params[:page]
if status == 200
render 'index', :layout => request.xhr? ? 'issues' : 'application'
else
@ -36,17 +34,14 @@ class Projects::IssuesController < Projects::BaseController
end
def new
@issue = @project.issues.new
end
def create
@assignee_uname = params[:assignee_uname]
@issue = @project.issues.new(params[:issue])
@issue.user_id = current_user.id
if @issue.save
@issue.subscribe_creator(current_user.id)
flash[:notice] = I18n.t("flash.issue.saved")
redirect_to project_issues_path(@project)
else
@ -60,41 +55,39 @@ class Projects::IssuesController < Projects::BaseController
end
def update
@issue.labelings.destroy_all if params[:update_labels]
if params[:issue] && status = params[:issue][:status]
action = 'status'
@issue.set_close(current_user) if status == 'closed'
@issue.set_open if status == 'open'
status = 200 if @issue.save
render :partial => action, :status => (status || 500), :layout => false
render :partial => 'status', :status => (@issue.save ? 200 : 400)
elsif params[:issue]
@issue.labelings.destroy_all if params[:issue][:labelings_attributes] # FIXME
status = 200 if @issue.update_attributes(params[:issue])
render :nothing => true, :status => (status || 500), :layout => false
status, message = if @issue.update_attributes(params[:issue])
[200, view_context.markdown(@issue.body)]
else
[400, view_context.local_alert(@issue.errors.full_messages.join('. '))]
end
render :inline => message, :status => status
else
render :nothing => true, :status => 200, :layout => false
render :nothing => true, :status => 200
end
end
def destroy
@issue.destroy
flash[:notice] = t("flash.issue.destroyed")
redirect_to root_path
end
def create_label
status = @project.labels.create!(:name => params[:name], :color => params[:color]) ? 200 : 500
index(status)
index(@project.labels.create!(:name => params[:name], :color => params[:color]) ? 200 : 500)
end
def update_label
status = @label.update_attributes(:name => params[:name], :color => params[:color]) ? 200 : 500
index(status)
index(@label.update_attributes(:name => params[:name], :color => params[:color]) ? 200 : 500)
end
def destroy_label
status = (@label && @label_destroy) ? 200 : 500
index(status)
index((@label && @label_destroy) ? 200 : 500)
end
def search_collaborators
@ -102,7 +95,7 @@ class Projects::IssuesController < Projects::BaseController
users = User.joins(:groups => :projects).where(:projects => {:id => @project.id}).where("users.uname ILIKE ?", search)
users2 = @project.collaborators.where("users.uname ILIKE ?", search)
@users = (users + users2).uniq.sort {|x,y| x.uname <=> y.uname}.first(10)
render :partial => 'search_collaborators', :layout => false
render :partial => 'search_collaborators'
end
private

View File

@ -5,9 +5,7 @@ class Projects::ProjectsController < Projects::BaseController
def index
@projects = Project.accessible_by(current_ability, :membered)
# @projects = @projects.search(params[:query]).search_order if params[:query].present?
#puts prepare_list(@projects).inspect
respond_to do |format|
format.html { @projects = @projects.recent.paginate(:page => params[:page], :per_page => 25) }
format.json { @projects = prepare_list(@projects) }
@ -39,6 +37,7 @@ class Projects::ProjectsController < Projects::BaseController
end
def update
params[:project].delete(:maintainer_id) if params[:project][:maintainer_id].blank?
if @project.update_attributes(params[:project])
flash[:notice] = t('flash.project.saved')
redirect_to @project
@ -86,6 +85,18 @@ class Projects::ProjectsController < Projects::BaseController
redirect_to projects_path
end
def autocomplete_maintainers
term, limit = params[:term], params[:limit] || 10
items = User.member_of_project(@project)
.where("users.name ILIKE ? OR users.uname ILIKE ?", "%#{term}%", "%#{term}%")
.limit(limit).map { |u| {:value => u.fullname, :label => u.fullname, :id => u.id} }
render :json => items
end
def preview
render :inline => view_context.markdown(params[:text]), :layout => false
end
protected
def prepare_list(projects)

View File

@ -5,7 +5,6 @@ class SearchController < ApplicationController
def index
params[:type] ||= 'all'
params[:type] = 'projects' unless current_user
case params[:type]
when 'all'
find_collection('projects')

View File

@ -3,8 +3,6 @@ class Users::ProfileController < Users::BaseController
autocomplete :user, :uname
def show
@groups = @user.groups.uniq
@platforms = @user.platforms.paginate(:page => params[:platform_page], :per_page => 10)
@projects = @user.projects.paginate(:page => params[:project_page], :per_page => 10)
@projects = @user.projects.by_visibilities(['open'])
end
end

View File

@ -8,6 +8,7 @@ class Users::RegisterRequestsController < ApplicationController
end
def create
params[:register_request][:language] = I18n.locale if params[:register_request]
RegisterRequest.create(params[:register_request])
render :thanks
end

View File

@ -39,4 +39,19 @@ module ApplicationHelper
else object.class.name
end
end
def markdown(text)
unless @redcarpet
html_options = {filter_html: true, hard_wrap: true, with_toc_data: true}
options = {no_intraemphasis: true, tables: true, fenced_code_blocks: true, autolink: true, strikethrough: true, lax_html_blocks: true}
@redcarpet = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(html_options), options)
end
@redcarpet.render(text).html_safe
end
def local_alert(text, type = 'error')
html = "<div class='flash'><div class='alert #{type}'> #{text}"
html << link_to('×', '#', :class => 'close close-alert', 'data-dismiss' => 'alert')
html << '</div></div>'
end
end

View File

@ -43,4 +43,22 @@ module BuildListsHelper
build_list.project_version
end
end
def container_url
"http://#{request.host_with_port}/downloads#{@build_list.container_path}".html_safe
end
def build_list_log_url(log_type)
"http://#{request.host_with_port}/#{@build_list.fs_log_path(log_type)}".html_safe
end
def log_reload_time_options
t = I18n.t("layout.build_lists.log.reload_times").map { |i| i.reverse }
options_for_select(t, t.first).html_safe
end
def log_reload_lines_options
options_for_select([100, 200, 500, 1000, 1500, 2000], 1000).html_safe
end
end

View File

@ -4,6 +4,7 @@ class FeedbackMailer < ActionMailer::Base
default :to => FBM_CONFIG['email'],
:cc => FBM_CONFIG['cc'],
:bcc => FBM_CONFIG['bcc']
default_url_options.merge!(:protocol => 'https') if APP_CONFIG['mailer_https_url']
include Resque::Mailer # send email async

View File

@ -2,6 +2,7 @@
class UserMailer < ActionMailer::Base
default :from => APP_CONFIG['do-not-reply-email']
default_url_options.merge!(:protocol => 'https') if APP_CONFIG['mailer_https_url']
include Resque::Mailer # send email async
@ -36,8 +37,24 @@ class UserMailer < ActionMailer::Base
end
end
def build_list_notification(build_list, user)
I18n.locale = user.language if user.language
@user, @build_list = user, build_list
subject = "[№ #{build_list.bs_id.present? ? build_list.bs_id : t("layout.build_lists.bs_id_not_set")}] "
subject << (build_list.project ? build_list.project.name_with_owner : t("layout.projects.unexisted_project"))
subject << " - #{build_list.human_status} "
subject << I18n.t("notifications.subjects.for_arch", :arch => @build_list.arch.name)
mail(:to => user.email, :subject => subject) do |format|
format.html
end
end
def invite_approve_notification(register_request)
I18n.locale = register_request.language if register_request.language
@register_request = register_request
mail :to => register_request.email, :subject => I18n.t("notifications.subjects.invite_approve_notification")
mail :to => register_request.email, :subject => I18n.t("notifications.subjects.invite_approve_notification") do |format|
format.html
end
end
end

View File

@ -13,18 +13,22 @@ class Ability
@user = user
# Shared rights between guests and registered users
can :show, Project, :visibility => 'open'
can :archive, Project, :visibility => 'open'
can [:show, :archive], Project, :visibility => 'open'
can :read, Issue, :project => {:visibility => 'open'}
can :read, PullRequest, :project => {:visibility => 'open'}
can :search, BuildList
can [:read, :everything], BuildList, :project => {:visibility => 'open'}
can [:read, :log, :everything], BuildList, :project => {:visibility => 'open'}
can :read, ProductBuildList#, :product => {:platform => {:visibility => 'open'}} # double nested hash don't work
can :read, Advisory
can(:advisories, Platform) {APP_CONFIG['anonymous_access']}
# Core callbacks
can [:publish_build, :status_build, :pre_build, :post_build, :circle_build, :new_bbdt], BuildList
# Platforms block
can [:show, :members, :advisories], Platform, :visibility == 'open'
can [:read, :projects_list], Repository, :platform => {:visibility => 'open'}
can :read, Product, :platform => {:visibility => 'open'}
if user.guest? # Guest rights
# can [:new, :create], RegisterRequest
else # Registered user rights
@ -56,52 +60,49 @@ class Ability
can [:read, :archive], Project, :owner_type => 'Group', :owner_id => user.group_ids
can([:read, :membered], Project, read_relations_for('projects')) {|project| local_reader? project}
can(:write, Project) {|project| local_writer? project} # for grack
can([:update, :sections, :manage_collaborators], Project) {|project| local_admin? project}
can([:update, :sections, :manage_collaborators, :autocomplete_maintainers], Project) {|project| local_admin? project}
can(:fork, Project) {|project| can? :read, project}
can(:fork, Project) {|project| project.owner_type == 'Group' and can? :update, project.owner}
can(:destroy, Project) {|project| owner? project}
can(:destroy, Project) {|project| project.owner_type == 'Group' and project.owner.actors.exists?(:actor_type => 'User', :actor_id => user.id, :role => 'admin')}
can :remove_user, Project
can [:autocomplete_base_project_name, :autocomplete_head_project_name], Project
can [:preview, :autocomplete_base_project_name, :autocomplete_head_project_name], Project
can [:read, :owned, :everything], BuildList, :user_id => user.id
can [:read, :related, :everything], BuildList, :project => {:owner_type => 'User', :owner_id => user.id}
can [:read, :related, :everything], BuildList, :project => {:owner_type => 'Group', :owner_id => user.group_ids}
can([:read, :everything], BuildList, read_relations_for('build_lists', 'projects')) {|build_list| can? :read, build_list.project}
can [:read, :log, :owned, :everything], BuildList, :user_id => user.id
can [:read, :log, :related, :everything], BuildList, :project => {:owner_type => 'User', :owner_id => user.id}
can [:read, :log, :related, :everything], BuildList, :project => {:owner_type => 'Group', :owner_id => user.group_ids}
can([:read, :log, :everything], BuildList, read_relations_for('build_lists', 'projects')) {|build_list| can? :read, build_list.project}
can([:create, :update], BuildList) {|build_list| build_list.project.is_package && can?(:write, build_list.project)}
can(:publish, BuildList) do |build_list|
build_list.can_publish? and build_list.save_to_platform.released ? local_admin?(build_list.save_to_platform) : can?(:write, build_list.project)
build_list.can_publish? and build_list.save_to_repository.publish_without_qa ? can?(:write, build_list.project) : local_admin?(build_list.save_to_platform)
end
can(:reject_publish, BuildList) do |build_list|
build_list.can_reject_publish? and build_list.save_to_platform.released and local_admin?(build_list.save_to_platform)
build_list.can_reject_publish? and not build_list.save_to_repository.publish_without_qa and local_admin?(build_list.save_to_platform)
end
can(:cancel, BuildList) {|build_list| build_list.can_cancel? && can?(:write, build_list.project)}
can [:read], Advisory
can [:read, :members], Platform, :visibility => 'open'
can [:read, :owned, :related, :members], Platform, :owner_type => 'User', :owner_id => user.id
can [:read, :related, :members], Platform, :owner_type => 'Group', :owner_id => user.group_ids
can([:read, :related, :members], Platform, read_relations_for('platforms')) {|platform| local_reader? platform}
can([:update, :members], Platform) {|platform| local_admin? platform}
can([:destroy, :members, :add_member, :remove_member, :remove_members] , Platform) {|platform| owner?(platform) || local_admin?(platform) }
can [:autocomplete_user_uname, :read_advisories, :advisories], Platform
can [:autocomplete_user_uname], Platform
can([:failed_builds_list, :create], MassBuild) {|mass_build| (owner?(mass_build.platform) || local_admin?(mass_build.platform)) && mass_build.platform.main? }
can(:cancel, MassBuild) {|mass_build| (owner?(mass_build.platform) || local_admin?(mass_build.platform)) && !mass_build.stop_build && mass_build.platform.main?}
can [:read, :projects_list], Repository, :platform => {:visibility => 'open'}
can [:read, :projects_list], Repository, :platform => {:owner_type => 'User', :owner_id => user.id}
can [:read, :projects_list], Repository, :platform => {:owner_type => 'Group', :owner_id => user.group_ids}
can([:read, :projects_list], Repository, read_relations_for('repositories', 'platforms')) {|repository| local_reader? repository.platform}
can([:create, :update, :projects_list, :add_project, :remove_project], Repository) {|repository| local_admin? repository.platform}
can([:create, :edit, :update, :destroy, :projects_list, :add_project, :remove_project], Repository) {|repository| local_admin? repository.platform}
can([:remove_members, :remove_member, :add_member], Repository) {|repository| owner?(repository.platform) || local_admin?(repository.platform)}
can([:add_project, :remove_project], Repository) {|repository| repository.members.exists?(:id => user.id)}
can(:clear, Platform) {|platform| local_admin?(platform) && platform.personal?}
can([:change_visibility, :settings, :destroy], Repository) {|repository| owner? repository.platform}
can([:change_visibility, :settings, :destroy, :edit, :update], Repository) {|repository| owner? repository.platform}
can([:create, :destroy], KeyPair) {|key_pair| owner?(key_pair.repository.platform) || local_admin?(key_pair.repository.platform)}
can :read, Product, :platform => {:visibility => 'open'}
can :read, Product, :platform => {:owner_type => 'User', :owner_id => user.id, :platform_type => 'main'}
can :read, Product, :platform => {:owner_type => 'Group', :owner_id => user.group_ids, :platform_type => 'main'}
can(:read, Product, read_relations_for('products', 'platforms')) {|product| product.platform.main?}
@ -116,20 +117,21 @@ class Ability
can :read, Issue, :project => {:owner_type => 'User', :owner_id => user.id}
can :read, Issue, :project => {:owner_type => 'Group', :owner_id => user.group_ids}
can(:read, Issue, read_relations_for('issues', 'projects')) {|issue| can? :read, issue.project rescue nil}
can([:merge, :create], Issue) {|issue| can? :write, issue.project}
can(:merge, Issue) {|issue| can? :write, issue.project}
can(:create, Issue) {|issue| can? :read, issue.project}
can([:update, :destroy], Issue) {|issue| issue.user_id == user.id or local_admin?(issue.project)}
cannot :manage, Issue, :project => {:has_issues => false} # switch off issues
can(:autocomplete_base_project, Issue, read_relations_for('issues', 'projects')) {|issue| can? :read, issue.project rescue nil}
can(:create, Comment) {|comment| can? :read, comment.project}
can(:update, Comment) {|comment| comment.user_id == user.id or local_admin?(comment.project || comment.commentable.project)}
can(:update, Comment) {|comment| comment.user == user or comment.project.owner == user or local_admin?(comment.project)}
cannot :manage, Comment, :commentable_type => 'Issue', :commentable => {:project => {:has_issues => false}} # switch off issues
end
# Shared cannot rights for all users (registered, admin)
cannot :destroy, Platform, :platform_type => 'personal'
cannot [:create, :destroy, :add_project, :remove_project], Repository, :platform => {:platform_type => 'personal'}
cannot [:create, :destroy, :edit, :update, :add_project, :remove_project], Repository, :platform => {:platform_type => 'personal'}
cannot :clear, Platform, :platform_type => 'main'
cannot :destroy, Issue

View File

@ -79,7 +79,7 @@ class BuildList < ActiveRecord::Base
scope :recent, order("#{table_name}.updated_at DESC")
scope :for_status, lambda {|status| where(:status => status) }
scope :for_user, lambda { |user| where(:user_id => user.id) }
scope :for_platform, lambda { |platform| where(:build_for_platform_id => platform.id) }
scope :for_platform, lambda { |platform| where(:build_for_platform_id => platform) }
scope :by_mass_build, lambda { |mass_build| where(:mass_build_id => mass_build) }
scope :scoped_to_arch, lambda {|arch| where(:arch_id => arch) }
scope :scoped_to_save_platform, lambda {|pl_id| where(:save_to_platform_id => pl_id) }
@ -125,7 +125,11 @@ class BuildList < ActiveRecord::Base
end
end
after_transition :on => :published, :do => :set_version_and_tag
after_transition :on => :published, :do => [:set_version_and_tag, :actualize_packages]
after_transition :on => [:published, :fail_publish, :build_error], :do => :notify_users
after_transition :on => :build_success, :do => :notify_users,
:unless => lambda { |build_list| build_list.auto_publish? }
event :place_build do
transition :waiting_for_response => :build_pending, :if => lambda { |build_list|
@ -201,6 +205,19 @@ class BuildList < ActiveRecord::Base
save
end
def actualize_packages
ActiveRecord::Base.transaction do
old_pkgs = self.class.where(:project_id => self.project_id)
.where(:save_to_repository_id => self.save_to_repository_id)
.for_platform(self.build_for_platform_id)
.scoped_to_arch(self.arch_id)
.for_status(BUILD_PUBLISHED)
.recent.limit(2).last.packages # packages from previous build_list
old_pkgs.update_all(:actual => false)
self.packages.update_all(:actual => true)
end
end
#TODO: Share this checking on product owner.
def can_cancel?
[BUILD_PENDING, BuildServer::PLATFORM_PENDING].include?(status) && bs_id
@ -211,7 +228,7 @@ class BuildList < ActiveRecord::Base
end
def can_reject_publish?
can_publish? and save_to_platform.released
can_publish? and not save_to_repository.publish_without_qa
end
@ -266,6 +283,10 @@ class BuildList < ActiveRecord::Base
I18n.t("layout.build_lists.human_duration", {:hours => (duration/3600).to_i, :minutes => (duration%3600/60).to_i})
end
def fs_log_path(log_type = :build)
container_path? ? "downloads/#{container_path}/log/#{project.name}/#{log_type.to_s}.log" : nil
end
def in_work?
status == BuildServer::BUILD_STARTED
#[WAITING_FOR_RESPONSE, BuildServer::BUILD_PENDING, BuildServer::BUILD_STARTED].include?(status)
@ -273,6 +294,22 @@ class BuildList < ActiveRecord::Base
protected
def notify_users
unless mass_build_id
users = []
if project # find associated users
users = project.all_members.
select{ |user| user.notifier.can_notify? && user.notifier.new_associated_build? }
end
if user.notifier.can_notify? && user.notifier.new_build?
users = users | [user]
end
users.each do |user|
UserMailer.build_list_notification(self, user).deliver
end
end
end # notify_users
def delete_container
if can_cancel?
BuildServer.delete_build_list bs_id

View File

@ -7,6 +7,18 @@ class BuildList::Package < ActiveRecord::Base
attr_accessible :fullname, :name, :release, :version
validates :build_list_id, :project_id, :platform_id, :fullname, :package_type, :name, :release, :version, :presence => true
validates :build_list_id, :project_id, :platform_id, :fullname,
:package_type, :name, :release, :version,
:presence => true
validates :package_type, :inclusion => PACKAGE_TYPES
# Fetches only actual (last publised) packages.
scope :actual, where(:actual => true)
scope :by_platform, lambda {|platform| where(:platform_id => platform) }
scope :by_name, lambda {|name| where(:name => name) }
scope :by_package_type, lambda {|type| where(:package_type => type) }
def assignee
project.maintainer
end
end

View File

@ -16,5 +16,6 @@ class BuildListObserver < ActiveRecord::Observer
end
end
end
end
end # before_update
end

View File

@ -45,8 +45,8 @@ class MassBuild < ActiveRecord::Base
end
def cancel_all
self.update_attribute(:stop_build, true)
self.build_lists.find_each(:batch_size => 100) do |bl|
update_column(:stop_build, true)
build_lists.find_each(:batch_size => 100) do |bl|
bl.cancel
end
end

View File

@ -28,13 +28,12 @@ class Platform < ActiveRecord::Base
before_create :xml_rpc_create, :unless => lambda {Thread.current[:skip]}
before_destroy :xml_rpc_destroy
after_update :freeze_platform
after_update :freeze_platform_and_update_repos
after_update :update_owner_relation
after_create lambda { symlink_directory unless hidden? }
after_destroy lambda { remove_symlink_directory unless hidden? }
after_update :update_owner_relation
scope :search_order, order("CHAR_LENGTH(name) ASC")
scope :search, lambda {|q| where("name ILIKE ?", "%#{q.to_s.strip}%")}
scope :by_visibilities, lambda {|v| where(:visibility => v)}
@ -74,6 +73,14 @@ class Platform < ActiveRecord::Base
build_path(name)
end
def add_member(member, role = 'admin')
Relation.add_member(member, self, role)
end
def remove_member(member)
Relation.remove_member(member, self)
end
def symlink_path
Rails.root.join("public", "downloads", name)
end
@ -131,11 +138,11 @@ class Platform < ActiveRecord::Base
end
def change_visibility
if !self.hidden?
self.update_attribute(:visibility, 'hidden')
if !hidden?
update_attributes(:visibility => 'hidden')
remove_symlink_directory
else
self.update_attribute(:visibility, 'open')
update_attributes(:visibility => 'open')
symlink_directory
end
end
@ -230,10 +237,11 @@ class Platform < ActiveRecord::Base
end
later :xml_rpc_clone, :loner => true, :queue => :clone_build
def freeze_platform
def freeze_platform_and_update_repos
if released_changed? && released == true
result = BuildServer.freeze(name)
result = BuildServer.freeze(name)
raise "Failed freeze platform #{name} with code #{result}" if result != BuildServer::SUCCESS
repositories.update_all(:publish_without_qa => false)
end
end
end

View File

@ -5,6 +5,7 @@ class Project < ActiveRecord::Base
NAME_REGEXP = /[a-zA-Z0-9_\-\+\.]+/
belongs_to :owner, :polymorphic => true, :counter_cache => :own_projects_count
belongs_to :maintainer, :class_name => "User"
has_many :issues, :dependent => :destroy
has_many :pull_requests, :dependent => :destroy, :foreign_key => 'base_project_id'
@ -22,12 +23,15 @@ class Project < ActiveRecord::Base
has_many :packages, :class_name => "BuildList::Package", :dependent => :destroy
has_and_belongs_to_many :advisories # should be without :dependent => :destroy
validates :name, :uniqueness => {:scope => [:owner_id, :owner_type], :case_sensitive => false}, :presence => true, :format => {:with => /^#{NAME_REGEXP}$/, :message => I18n.t("activerecord.errors.project.uname")}
validates :name, :uniqueness => {:scope => [:owner_id, :owner_type], :case_sensitive => false},
:presence => true,
:format => {:with => /^#{NAME_REGEXP}$/, :message => I18n.t("activerecord.errors.project.uname")}
validates :owner, :presence => true
validates :maintainer_id, :presence => true, :unless => :new_record?
validates :visibility, :presence => true, :inclusion => {:in => VISIBILITIES}
validate { errors.add(:base, :can_have_less_or_equal, :count => MAX_OWN_PROJECTS) if owner.projects.size >= MAX_OWN_PROJECTS }
attr_accessible :name, :description, :visibility, :srpm, :is_package, :default_branch, :has_issues, :has_wiki
attr_accessible :name, :description, :visibility, :srpm, :is_package, :default_branch, :has_issues, :has_wiki, :maintainer_id
attr_readonly :name, :owner_id, :owner_type
scope :recent, order("name ASC")
@ -36,9 +40,19 @@ class Project < ActiveRecord::Base
scope :by_name, lambda {|name| where('projects.name ILIKE ?', name)}
scope :by_visibilities, lambda {|v| where(:visibility => v)}
scope :opened, where(:visibility => 'open')
scope :addable_to_repository, lambda { |repository_id| where("projects.id NOT IN (SELECT project_to_repositories.project_id FROM project_to_repositories WHERE (project_to_repositories.repository_id = #{ repository_id }))") }
scope :package, where(:is_package => true)
scope :addable_to_repository, lambda { |repository_id| where %Q(
projects.id NOT IN (
SELECT
ptr.project_id
FROM
project_to_repositories AS ptr
WHERE (ptr.repository_id = #{ repository_id })
)
) }
after_create :attach_to_personal_repository
before_create :set_maintainer
after_save :attach_to_personal_repository
has_ancestry :orphan_strategy => :rootify #:adopt not available yet
@ -63,8 +77,12 @@ class Project < ActiveRecord::Base
name
end
def all_members
members | (owner_type == 'User' ? [owner] : owner.members)
end
def members
collaborators + groups.map(&:members).flatten
collaborators | groups.map(&:members).flatten
end
def platforms
@ -121,6 +139,8 @@ class Project < ActiveRecord::Base
c.parent_id = id
c.owner = new_owner
c.updated_at = nil; c.created_at = nil # :id = nil
# Hack to call protected method :)
c.send :set_maintainer
c.save
end
end
@ -129,6 +149,10 @@ class Project < ActiveRecord::Base
I18n.t("layout.projects.human_average_build_time", {:hours => (average_build_time/3600).to_i, :minutes => (average_build_time%3600/60).to_i})
end
def formatted_average_build_time
"%02d:%02d" % [average_build_time / 3600, average_build_time % 3600 / 60]
end
def xml_rpc_create(repository)
result = BuildServer.create_project name, repository.platform.name, repository.name, path
if result == BuildServer::SUCCESS
@ -150,6 +174,16 @@ class Project < ActiveRecord::Base
protected
def attach_to_personal_repository
repositories << self.owner.personal_repository if !repositories.exists?(:id => self.owner.personal_repository)
owner_rep = self.owner.personal_repository
if is_package
repositories << owner_rep unless repositories.exists?(:id => owner_rep)
else
repositories.delete owner_rep
end
end
def set_maintainer
self.maintainer_id = (owner_type == 'User') ? self.owner_id : self.owner.owner_id
end
end

View File

@ -1,16 +1,17 @@
# -*- encoding : utf-8 -*-
class RegisterRequest < ActiveRecord::Base
default_scope order('created_at ASC')
scope :rejected, where(:rejected => true)
scope :approved, where(:approved => true)
scope :unprocessed, where(:approved => false, :rejected => false)
validates :email, :presence => true, :uniqueness => {:case_sensitive => false}, :format => { :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }
# before_create :generate_token
before_update :invite_approve_notification
validates :email, :presence => true, :uniqueness => {:case_sensitive => false}, :format => { :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }
def approve
update_attributes(:approved => true, :rejected => false)
end
@ -26,7 +27,7 @@ class RegisterRequest < ActiveRecord::Base
end
def invite_approve_notification
if approved_changed? and approved == true
if approved_changed? && approved?
generate_token
UserMailer.invite_approve_notification(self).deliver
end

View File

@ -10,9 +10,9 @@ class Relation < ActiveRecord::Base
before_validation :add_default_role
scope :by_user_through_groups, lambda {|u| where("actor_type = 'User' AND actor_id = ? OR actor_type = 'Group' AND actor_id IN (?)", u.id, u.group_ids)}
scope :by_actor, lambda {|obj| {:conditions => ['actor_id = ? AND actor_type = ?', obj.id, obj.class.to_s]}}
scope :by_target, lambda {|tar| {:conditions => ['target_id = ? AND target_type = ?', tar.id, tar.class.to_s]}}
scope :by_role, lambda {|role| {:conditions => ['role = ?', role]}}
scope :by_actor, lambda {|obj| where(:actor_id => obj.id, :actor_type => obj.class.to_s)}
scope :by_target, lambda {|tar| where(:target_id => tar.id, :target_type => tar.class.to_s)}
scope :by_role, lambda {|role| where(:role => role)}
def self.create_with_role(actor, target, role)
r = self.new
@ -22,6 +22,20 @@ class Relation < ActiveRecord::Base
r.save
end
def self.add_member(member, target, role)
if target.relations.exists?(:actor_id => member.id, :actor_type => member.class.to_s) || @platform.try(:owner) == member
true
else
rel = target.relations.build(:role => role)
rel.actor = member
rel.save
end
end
def self.remove_member(member, target)
Relation.by_actor(member).by_target(target).each{|r| r.destroy}
end
protected
def add_default_role

View File

@ -2,6 +2,11 @@
class Repository < ActiveRecord::Base
belongs_to :platform
has_many :relations, :as => :target, :dependent => :destroy
has_many :actors, :as => :target, :class_name => 'Relation', :dependent => :destroy
has_many :members, :through => :actors, :source => :actor, :source_type => 'User'
has_many :project_to_repositories, :dependent => :destroy, :validate => true
has_many :projects, :through => :project_to_repositories
has_one :key_pair, :dependent => :destroy
@ -14,7 +19,7 @@ class Repository < ActiveRecord::Base
before_create :xml_rpc_create, :unless => lambda {Thread.current[:skip]}
before_destroy :xml_rpc_destroy, :unless => lambda {Thread.current[:skip]}
attr_accessible :name, :description
attr_accessible :name, :description, :publish_without_qa
attr_readonly :name, :platform_id
def base_clone(attrs = {})
@ -38,6 +43,14 @@ class Repository < ActiveRecord::Base
end
end
def add_member(member, role = 'admin')
Relation.add_member(member, self, role)
end
def remove_member(member)
Relation.remove_member(member, self)
end
class << self
def build_stub(platform)
rep = Repository.new

View File

@ -34,7 +34,7 @@ class Subscribe < ActiveRecord::Base
def self.set_subscribe_to_commit(options, status)
if subscribe = Subscribe.where(options).first
subscribe.update_attribute(:status, status)
subscribe.update_attributes(:status => status)
else
Subscribe.create(options.merge(:status => status))
end

View File

@ -52,6 +52,10 @@ class User < ActiveRecord::Base
scope :admin, where(:role => 'admin')
scope :real, where(:role => ['', nil])
scope :member_of_project, lambda {|item|
where "#{table_name}.id IN (?)", item.members.map(&:id).uniq
}
after_create lambda { self.create_notifier }
before_create :ensure_authentication_token

View File

@ -9,7 +9,7 @@ class CommentPresenter < ApplicationPresenter
@user = comment.user
@options = opts
@content = simple_format(@comment.body, {}, :sanitize => true).html_safe
@content = @comment.body
end
def expandable?
@ -40,7 +40,8 @@ class CommentPresenter < ApplicationPresenter
res = []
if controller.can? :update, @comment
res << link_to(t("layout.edit"), ep).html_safe
res << link_to(t('layout.comments.md_cheatsheet_header'), '#md_help', 'data-toggle' => 'modal')
res << link_to(t("layout.edit"), ep, :id => "comment-#{comment.id}", :class => "edit_comment").html_safe
end
if controller.can? :delete, @comment
res << link_to(t("layout.delete"), dp, :method => "delete",

View File

@ -0,0 +1,43 @@
class MaintainerPresenter < ApplicationPresenter
attr_reader :package, :package_link, :package_name, :package_type,
:package_version, :package_release, :package_version_release,
:package_updated_at
attr_reader :maintainer, :maintainer_fullname, :maintainer_email,
:maintainer_link, :maintainer_mail_link
delegate :package_type, :to => :package
[:name, :version, :release, :updated_at].each do |meth|
define_method "package_#{meth}" do
@package.send meth
end
end
[:fullname, :email].each do |meth|
define_method "maintainer_#{meth}" do
@maintainer.send meth
end
end
def initialize(package, opts = {})
@package = package
@maintainer = package.try(:assignee)
end
def package_link
link_to @package.name, @package.project
end
def package_version_release
"#{@package.version}-#{@package.release}"
end
def maintainer_link
link_to @maintainer.fullname, @maintainer
end
def maintainer_email_link
mail_to @maintainer.email, @maintainer.email, :encode => "javascript"
end
end

View File

@ -1,4 +1,4 @@
%table#myTable.tablesorter.advisories{:cellspacing => "0", :cellpadding => "0"}
%table#myTable.tablesorter.advisories.static-search{:cellspacing => "0", :cellpadding => "0"}
%thead
%tr
%th.th1= t("activerecord.attributes.advisory.advisory_id")

View File

@ -3,7 +3,7 @@
%h3= @group.name
%h4= t("activerecord.attributes.group.description") + ":"
%p= @group.description
%h4= t("layout.groups.projects_list") + ":"
%h4= t("layout.groups.public_projects_list") + ":"
%p
- @projects.each do |project|
= link_to project.name, project

View File

@ -34,6 +34,7 @@
.a= link_to t('layout.logout'), destroy_user_session_path, :method => :delete
- else
.user
.profile= link_to t("layout.devise.shared_links.sign_up"), new_register_request_path
.profile= link_to t("layout.devise.shared_links.sign_in"), new_user_session_path
.right
.both
@ -55,4 +56,4 @@
bg_alpha : 0.5,
piro_scroll : true //pirobox always positioned at the center of the page
});
});
});

View File

@ -10,13 +10,16 @@
= link_to t("layout.platforms.about"), platform_path(@platform)
%li{:class => (contr == :repositories) ? 'active' : ''}
= link_to t("layout.repositories.list_header"), platform_repositories_path(@platform)
- if can? :show, @platform
%li{:class => (act == :index && contr == :maintainers) ? 'active' : nil}
= link_to t("layout.platforms.maintainers"), platform_maintainers_path(@platform)
- if can? :edit, @platform
%li{:class => (contr == :mass_builds && [:index, :create].include?(act)) ? 'active' : ''}
= link_to t("layout.platforms.mass_build"), platform_mass_builds_path(@platform)
- if can? :read, @platform.products.build
%li{:class => (contr == :products) ? 'active' : ''}
= link_to t("layout.products.list_header"), platform_products_path(@platform)
- if can? :read_advisories, @platform
- if can? :advisories, @platform
%li{:class => (contr == :platforms and act == :advisories) ? 'active' : ''}
= link_to t("layout.advisories.list_header"), advisories_platform_path(@platform)
- if can? :update, @platform

View File

@ -0,0 +1,25 @@
%table#myTable.tablesorter.platform-maintainers.static-search{:cellspacing => "0", :cellpadding => "0"}
%thead
%tr
%th.centered= t("activerecord.attributes.maintainer.package_name")
%th.centered= t("activerecord.attributes.maintainer.package_type")
%th.centered= t("activerecord.attributes.maintainer.version")
%th.centered{:colspan => 2}= t("activerecord.models.maintainer")
%th.centered= t("activerecord.attributes.maintainer.updated_at")
%tr.search
-# TODO: change filter to Backbone.js
%th{:colspan => 6, :rowspan => 1}
= form_tag platform_maintainers_path(@platform), :method => :get do |f|
= text_field_tag('q', params[:q], :placeholder => t("layout.maintainers.search_by_package"), :class => params[:q].present? ? 'black' : 'gray')
%input{:type => 'submit', :value => t("layout.search.header")}
= button_to t('layout.clear'), {:action => :index} , :method => :get
%tbody
- MaintainerPresenter.present_collection(@maintainers) do |pr|
%tr{:class => cycle("odd", "even")}
%td= pr.package_link
%td= pr.package_type
%td= pr.package_version_release
%td= pr.maintainer_link
%td= pr.maintainer_email_link.html_safe
%td= pr.package_updated_at

View File

@ -0,0 +1 @@
doHandleAbfAssignee(<%= @ret.to_json.html_safe %>);

View File

@ -0,0 +1,7 @@
-set_meta_tags :title => [title_object(@platform), t('layout.maintainers.list_header')]
-# FIXME: no these 'base' links!
= render 'platforms/base/submenu'
= render 'platforms/base/sidebar'
= render :partial => 'list', :object => @maintainers
= will_paginate @maintainers

View File

@ -2,42 +2,9 @@
= render 'submenu'
= render 'sidebar'
= form_tag remove_members_platform_path(@platform), :id => 'members_form', :method => :post do
%table.tablesorter{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
- if can? :remove_members, @platform
%th
\ 
%th
= t("layout.collaborators.members")
- if can? :remove_member, @platform
%th.buttons
= t("layout.remove")
%tbody
- @members.select{|u| u != @platform.owner}.each_with_index do |user, num|
%tr{:id => "admin-table-members-row#{num}", :class => cycle(:odd, :even)}
- if can? :remove_members, @platform
%td
%span.niceCheck-main{:id => "niceCheckbox#{num}", :style => "background-position: 0px 0px; "}
= check_box_tag "user_remove[#{user.id}][]"
%td
.img
= image_tag avatar_url(user)
.forimg= link_to user.fullname, user_path(user)
- if can? :remove_member, @platform
%td.buttons
= link_to remove_member_platform_path(@platform, :member_id => user.id), :method => :delete, :confirm => t("layout.confirm") do
%span.delete &nbsp;
- if can? :remove_memvers, @platforms
= submit_tag t("layout.delete"), :class => 'button'
.both
- if can? :add_member, @platform
.hr.top
= form_tag add_member_platform_path(@platform) do
.admin-search
= autocomplete_field_tag 'member_id', params[:member_id], autocomplete_user_uname_users_path, :id_element => '#member_id_field'
= hidden_field_tag 'member_id', nil, :id => 'member_id_field'
= submit_tag t("layout.add"), :class => 'button'
.both
= render "shared/members_table",
:remove_members_path => remove_members_platform_path(@platform),
:remove_member_path => remove_member_platform_path(@platform),
:add_member_path => add_member_platform_path(@platform),
:members => @members.select{|u| u != @platform.owner},
:editable_object => @platform

View File

@ -1,9 +1,13 @@
.leftlist= f.label :name, t("activerecord.attributes.repository.name"), :class => :label
.rightlist= f.text_field :name, :class => 'text_field'
- unless ['edit', 'update'].include? controller.action_name
.leftlist= f.label :name, t("activerecord.attributes.repository.name"), :class => :label
.rightlist= f.text_field :name, :class => 'text_field'
.leftlist= f.label :description, t("activerecord.attributes.repository.description"), :class => :label
.rightlist= f.text_field :description, :class => 'text_field'
.leftlist= f.label :publish_without_qa, t("activerecord.attributes.repository.publish_without_qa"), :class => :label
.rightlist= f.check_box :publish_without_qa, :class => 'check_box'
.both
.button_block

View File

@ -3,7 +3,7 @@
%tr
%th.th1= t("activerecord.attributes.repository.name")
%th.th2= t("layout.repositories.projects")
%th= t("layout.delete")
%th= t("activerecord.attributes.repository.publish_without_qa")
%tbody
- @repositories.each do |repository|
%tr{:class => cycle("odd", "even")}
@ -11,7 +11,5 @@
= link_to repository.name, platform_repository_path(@platform, repository)
%td
= repository.projects.count
%td.buttons
- if can? :destroy, repository
= link_to platform_repository_path(@platform, repository), :method => :delete, :confirm => t("layout.repositories.confirm_delete") do
%span.delete &nbsp;
%td
= repository.publish_without_qa

View File

@ -0,0 +1,16 @@
-set_meta_tags :title => [title_object(@repository), t('layout.repositories.edit')]
= render 'submenu'
= render 'sidebar'
%h3.fix= "#{t("layout.repositories.about")}: #{@repository.name}"
= form_for @repository, :url => platform_repository_path(@platform, @repository), :html => { :class => :form } do |f|
= render "form", :f => f
%br
= render "shared/members_table",
:remove_members_path => remove_members_platform_repository_path(@platform, @repository),
:remove_member_path => remove_member_platform_repository_path(@platform, @repository),
:add_member_path => add_member_platform_repository_path(@platform, @repository),
:members => @members,
:editable_object => @repository

View File

@ -2,10 +2,15 @@
= render 'submenu'
= render 'sidebar'
%h3.fix= "#{t("layout.repositories.about")}: #{@repository.name}"
%h3 #{t("layout.repositories.about")} #{@repository.name}
%p= @repository.description
.buttons_block
- if can? :update, @repository
= link_to image_tag("code.png", :alt => t("layout.edit")) + " " + t("layout.edit"), edit_platform_repository_path(@platform, @repository), :class => "button"
- if can? :destroy, @repository
= link_to image_tag("x.png", :alt => t("layout.delete")) + " " + t("layout.delete"), platform_repository_path(@platform, @repository), :method => "delete", :class => "button", :confirm => t("layout.repositories.confirm_delete")
%br
%br
%h3.fix= t("layout.projects.list_header")

View File

@ -6,8 +6,9 @@
=image_tag 'zip.png', :alt => 'ZIP'
%b.caret
%ul.dropdown-menu
%li=link_to "tar.gz", archive_path(project, @treeish, 'tar')
%li=link_to "zip", archive_path(project, @treeish, 'zip')
- file_name = "#{@project.owner.uname}-#{@project.name}-#{@commit.id}"
%li=link_to "tar.gz", archive_path(project, file_name, 'tar.gz')
%li=link_to "zip", archive_path(project, file_name, 'zip')
= text_field_tag :url, git_repo_url(project.git_repo_name), :class => 'name', :spellcheck => 'false', :readonly => true
.git_help ?

View File

@ -2,9 +2,14 @@
%td= link_to (build_list.bs_id.present? ? build_list.bs_id : t("layout.build_lists.bs_id_not_set")), build_list
%td
= build_list.human_status
%br
- if BuildList::HUMAN_STATUSES[build_list.status].in? [:build_pending, :build_started, :build_publish]
%time.js-relative-date{:datetime => build_list.updated_at.strftime("%FT%T%:z"), :title => build_list.updated_at.strftime("%F %T")}
= build_list.updated_at.strftime "%F %T"
- if build_list.build_started? && ((build_list.project.average_build_time || 0) > 0)
\/
%time
= build_list.project.formatted_average_build_time
- if build_list.project.present?
%td= link_to build_list.project.name_with_owner, build_list.project
%td= build_list_version_link(build_list)

View File

@ -1,4 +1,4 @@
- platform.repositories.each do |repo|
.both
= check_box_tag "build_list[include_repos][]", repo.id, repo.name == 'main' || @project.repositories.map(&:id).include?(repo.id), :id => "include_repos_#{repo.id}", :save_to_platform_id => platform.id, :rep_name => repo.name
= check_box_tag "build_list[include_repos][]", repo.id, repo.name == 'main' || @project.repositories.map(&:id).include?(repo.id), :id => "include_repos_#{repo.id}", :rep_name => repo.name
= label_tag "include_repos_#{repo.id}", repo.name

View File

@ -0,0 +1,148 @@
.hr
%a{:name => 'log'}
.log-wrapper
.log-header
.text-wrap
= link_to({:anchor => :log}, {:id => 'log_anchor'}) do
%h3= t("layout.build_lists.log.build_log")
%span
.both
.log-body.hidden
.reloader
%table.options
%tr.top
%td.first
= label_tag :word_wrap do
= check_box_tag :word_wrap
= t("layout.word_wrap")
%td.last{ :class => @build_list.build_started? ? nil : :hidden }
= label_tag :autoreload do
= check_box_tag :autoreload, true, @build_list.build_started?
= t("layout.build_lists.log.autoreload")
= select_tag :reload_interval, log_reload_time_options
%tr.bottom
%td.first
= link_to t("layout.build_lists.log.download"), build_list_log_url(:build), :id => :log_url
%td.last{ :class => @build_list.build_started? ? nil : :hidden }
= label_tag :load_lines do
= raw t("layout.build_lists.log.load_lines", :count => select_tag(:load_lines, log_reload_lines_options))
.both
%textarea.log{ :readonly => :readonly, :wrap => 'off',
:data => { :url => log_build_list_path(@build_list), :log_type => :build } }
= t("layout.build_lists.log.not_available")
:javascript
$(function() {
(function() {
var $wrapper = $('div.log-wrapper');
var $logBody = $wrapper.children('div.log-body').first();
var $logCont = $logBody.children('.log').first();
var logUrl = $logCont.data('url');
var $logHead = $wrapper.children('div.log-header').first();
var $trigger = $logHead.children('span').first();
var $autoload = $('#autoreload');
var state = $logBody.is(':visible');
var t = null; // timer
var first_open = true;
if (state) {
$trigger.removeClass('closed');
$wrapper.removeClass('inactive')
.addClass('active');
} else {
$trigger.addClass('closed');
$logBody.addClass('hidden');
$wrapper.removeClass('active')
.addClass('inactive');
}
function getLineHeight(element){
var temp = document.createElement(element.nodeName);
temp.setAttribute("style","margin:0px;padding:0px;font-family:"+element.style.fontFamily+";font-size:"+element.style.fontSize);
temp.innerHTML = "test";
temp = element.parentNode.appendChild(temp);
var ret = temp.clientHeight;
temp.parentNode.removeChild(temp);
return ret;
}
var loadLog = function() {
$.ajax({
url: logUrl,
type: "GET",
dataType: 'json',
data: $logCont.data(),
beforeSend: function( xhr ) {
var token = $('meta[name="csrf-token"]').attr('content');
if (token) xhr.setRequestHeader('X-CSRF-Token', token);
},
success: function(data, textStatus, jqXHR) {
var l = $logCont[0];
var vScroll = l.scrollTop;
var hScroll = l.scrollLeft;
var onBottom = Math.abs((l.clientHeight + vScroll - l.scrollHeight)) < getLineHeight(l);
$logCont.text(data.log);
$logCont.scrollLeft(hScroll);
$logCont.scrollTop((onBottom || first_open) ? l.scrollHeight - l.clientHeight : vScroll);
first_open = false;
if (!data.building) $autoload.attr({'checked': false}).trigger('change');
}
});
}
var reloadChange = function() {
if ($(this).is(':checked')) {
first_open = true;
loadLog();
$logCont.scrollTop($logCont[0].scrollHeight - $logCont[0].clientHeight);
t = setInterval(function() {
loadLog();
}, $('#reload_interval').val());
} else {
clearInterval(t);
}
}
var toggleHandler = function() {
state = !state;
// if log opened
if (state) {
if ($autoload.is(':checked')) {
$autoload.trigger('change');
}
} else {
clearInterval(t);
}
$logBody.slideToggle('slow')
.toggleClass('hidden');
$logHead.toggleClass('active inactive');
$trigger.toggleClass('closed');
window.location.href = $('a#log_anchor').attr('href');
}
$wrapper.on('click', '.log-header > span', toggleHandler);
$autoload.on('change', reloadChange);
$('#word_wrap').on('change', function() {
$logCont.attr({'wrap': ($(this).is(':checked')) ? 'soft' : 'off'});
});
$('#reload_interval').on('change', function() {
clearInterval(t);
if ($autoload.is(':checked')) {
t = setInterval($(this).val());
}
});
$('#load_lines').on('change', function() {
$logCont.data('load_lines', $(this).val());
}).trigger('change');
loadLog();
})();
});

View File

@ -6,12 +6,13 @@
- Platform.main.each do |pl|
- if pl.repository_ids.size > 0
.both
= check_box_tag "build_for_platforms[]", pl.id, (params[:build_for_platforms]||[]).include?(pl.id.to_s), :class => 'build_bpl_ids', :id => "bpls_#{pl.id}", :'data-released' => pl.released ? 1 : 0
= label_tag "bpls_#{pl.id}", pl.name
.offset25{:style => 'padding-left: 25px'}= render 'include_repos', :platform => pl
=# check_box_tag "build_for_platforms[]", pl.id, (params[:build_for_platforms]||[]).include?(pl.id.to_s), :class => 'build_bpl_ids', :id => "bpls_#{pl.id}"
=# label_tag "bpls_#{pl.id}", pl.name
%div{:id => "build_for_pl_#{pl.id}", :class => 'build_for_pl'}= pl.name
.offset25= render 'include_repos', :platform => pl
%section.right
%h3= t("activerecord.attributes.build_list.save_to_platform")
.lineForm= f.select :save_to_platform_id, @project.repositories.collect{|r| ["#{r.platform.name}/#{r.name}", r.platform.id]}
%h3= t("activerecord.attributes.build_list.save_to_repository")
.lineForm= f.select :save_to_repository_id, @project.repositories.collect{|r| ["#{r.platform.name}/#{r.name}", r.id, {:publish_without_qa => r.publish_without_qa? ? 1 : 0, :platform_id => r.platform.id}]}
%h3= t("activerecord.attributes.build_list.project_version")
.lineForm= f.select :project_version, versions_for_group_select(@project), :selected => params[:build_list].try(:fetch, :project_version) || "latest_" + @project.default_branch
%h3= t("activerecord.attributes.build_list.arch")

View File

@ -13,7 +13,6 @@
link_to("#{@build_list.save_to_platform.name}/#{@build_list.save_to_repository.name}",
[@build_list.save_to_platform, @build_list.save_to_repository])]
- elsif @build_list.container_path.present?
- container_url = "http://#{request.host_with_port}/downloads#{@build_list.container_path}"
= link_to container_url, container_url
.both
@ -125,8 +124,15 @@
var r = new Rosa.Routers.BuildListsAdvisoriesRouter();
});
= submit_tag t("layout.publish"), :confirm => t("layout.confirm"), :name => 'publish' if @build_list.can_publish? && can?(:publish, @build_list)
= submit_tag t("layout.reject_publish"), :confirm => t("layout.confirm"), :name => 'reject_publish' if @build_list.can_reject_publish? && can?(:reject_publish, @build_list)
- if BuildList::HUMAN_STATUSES[@build_list.status].in? [:build_started, :build_error, :success]
= render :partial => 'projects/build_lists/log'
- if (can_publish = @build_list.can_publish? && can?(:publish, @build_list))
.hr
= submit_tag t("layout.publish"), :confirm => t("layout.confirm"), :name => 'publish' if can_publish
- if @build_list.can_reject_publish? && can?(:reject_publish, @build_list)
= submit_tag t("layout.reject_publish"), :confirm => t("layout.confirm"), :name => 'reject_publish'
.hr
%h3= t("layout.build_lists.items_header")

View File

@ -1,4 +1,5 @@
#open-comment.comment.view
=link_to t('layout.comments.md_cheatsheet_header'), '#md_help', 'data-toggle' => 'modal', :style => 'float:right;'
%h3.tmargin0= t("layout.comments.new_header")
- if Comment.issue_comment?(commentable.class)
- new_path = project_issue_comments_path(project, commentable)
@ -10,7 +11,7 @@
- subscribe_path = is_subscribed ? unsubscribe_commit_path(project, commentable) : subscribe_commit_path(project, commentable)
= form_for :comment, :url => new_path, :method => :post, :html => { :class => :form } do |f|
= render "projects/comments/form", :f => f
= render "projects/comments/form", :f => f, :id => 'new'
.comment-left
= t("layout.comments.notifications_are")
%span.bold

View File

@ -0,0 +1,13 @@
%ul.nav.nav-tabs#md_tabs
%li
%a{"data-toggle" => "tab", :href => "##{id}_edit"}=t 'layout.edit'
%li
%a{"data-toggle" => "tab", :href => "##{id}_preview"}=t 'layout.preview'
.tab-content
.tab-pane.active{:id => "#{id}_edit"}
=f.text_area :body, :cols => 80, :id => "#{id}_edit_input"
=hidden_field_tag :body_dup, nil, :name => 'text', :id => "#{id}_edit_input_dup"
.tab-pane{:id => "#{id}_preview"}
.formatted.cm-s-default.md_and_cm

View File

@ -1,2 +1,2 @@
.wrapper= f.text_area :body, :cols => 80
.comment-right= submit_tag t("layout.save")
=render 'projects/comments/body', :f => f, :id => id
.comment-right= submit_tag t("layout.save")

View File

@ -3,4 +3,12 @@
%h3#block-list= t("layout.comments.comments_header")
- list.each do |comment|
- CommentPresenter.present(comment, :project => project, :commentable => commentable) do |presenter|
= render 'shared/feed_message', :presenter => presenter
= render 'shared/feed_message', :presenter => presenter
#open-comment.comment.hidden{:class => "comment-#{comment.id}"}
%h3.tmargin0= t("layout.comments.edit_header")
= form_for comment, :url => project_commentable_comment_path(project, commentable, comment), :html => { :class => 'form edit_comment' } do |f|
= render "projects/comments/form", :f => f, :id => "edit_#{comment.id}"
.comment-left
=link_to t('layout.cancel'), '#', :id => "comment-#{comment.id}", :class => 'cancel_edit_comment button'
.both
= render "projects/comments/markdown_help"

View File

@ -0,0 +1,86 @@
#md_help.modal.hidden
.modal-header
%button.close{"aria-hidden" => "true", "data-dismiss" => "modal", :type => "button"} ×
%h3#myModalLabel=t('layout.comments.md_cheatsheet_header')
.modal-body
.mod
.col
%h3=t 'layout.comments.md_cheatsheet.format_text'
%p=t 'layout.comments.md_cheatsheet.headers'
%pre
-[1, 3, 6].each do |i|
="#{'#'*i} This is an <h#{i}> tag"
%p=t 'layout.comments.md_cheatsheet.text_styles'
%pre
:preserve
*This text will be italic*
_This will also be italic_
**This text will be bold**
__This will also be bold__
.col
%h3=t 'layout.comments.md_cheatsheet.lists'
%p=t 'layout.comments.md_cheatsheet.unordered'
%pre
:preserve
* Item 1
* Item 2
* Item 2a
* Item 2b
%p=t 'layout.comments.md_cheatsheet.ordered'
%pre
:preserve
1. Item 1
2. Item 2
3. Item 3
* Item 3a
* Item 3b
.col
%h3=t 'layout.comments.md_cheatsheet.miscellaneous'
%p=t 'layout.comments.md_cheatsheet.images'
%pre
:preserve
![avatar](/assets/ava.png)
Format: ![Alt Text](url)
%p=t 'layout.comments.md_cheatsheet.links'
%pre
:preserve
https://abf.rosalinux.ru
[ABF](https://abf.rosalinux.ru/)
%p=t 'layout.comments.md_cheatsheet.blockquotes'
%pre
:preserve
As Kanye West said:
> We're living the future so
> the present is our past.
.both
%hr.bootstrap
%h3=t 'layout.comments.md_cheatsheet.code_examples'
.col
%p
=t 'layout.comments.md_cheatsheet.syntax_highlighting'
%pre
:preserve
```javascript
function fancyAlert(arg) {
if(arg) {
$.facebox({div:'#foo'})
}
}
```
.col
%p=t 'layout.comments.md_cheatsheet.indent_code'
%pre
:preserve
Here is a Python code example
without syntax highlighting:
def foo:
if not bar:
return true
.col
%p=t 'layout.comments.md_cheatsheet.inline_code'
%pre
:preserve
I think you should use an
`[addr]` element here instead.

View File

@ -8,4 +8,6 @@
= t("layout.comments.edit_header")
.inner
= form_for @comment, :url => project_commentable_comment_path(@project, @commentable, @comment), :html => {:class => :form} do |f|
= render "form", :f => f
= render "form", :f => f, :id => "edit_#{@comment.id}"
=hidden_field_tag :preview_url, project_md_preview_path(@project)

View File

@ -14,3 +14,6 @@
= render "projects/comments/list", :list => Comment.for_commit(@commit), :project => @project, :commentable => @commit
= render "projects/comments/add", :project => @project, :commentable => @commit if current_user
=hidden_field_tag :preview_url, project_md_preview_path(@project)

View File

@ -30,7 +30,7 @@
%h3= t("layout.projects.git_global_setup")
%p
%code
= "git config --global user.name #{current_user.fullname}"
= "git config --global user.name '#{current_user.fullname}'"
%br/
= "git config --global user.email #{current_user.email}"
%br/

View File

@ -1,8 +1,4 @@
.leftlist= t('activerecord.attributes.issue.title') + ':'
.rightlist= f.text_field :title
.leftlist= t('activerecord.attributes.issue.body') + ':'
.rightlist= f.text_area :body
.both
=render 'title_body', :f => f, :id => 'new'
.leftlist= t('activerecord.attributes.issue.assignee') + ':'
.rightlist
%span#people-span.small-text= t('layout.issues.choose_user_on_left')

View File

@ -9,19 +9,13 @@
%span.date=@issue.created_at.to_s(:long)
%br/
.both
.fulltext.view.issue_body=@issue.body
.fulltext.view.issue_body.formatted.cm-s-default.md_and_cm=markdown @issue.body
.both
%br
- if can? :update, @issue
=link_to t('layout.edit'), '#', :id => 'edit_issue_content', :class => 'button'
=form_for :issue, :url => [@project, @issue], :method => :put, :html => { :class => 'edit_form issue', :style => 'display:none;' } do |f|
.leftlist= t('activerecord.attributes.issue.title') + ':'
.rightlist{:style => @issue.pull_request ? 'width: 500px;' : ''}
= f.text_field :title
.leftlist= t('activerecord.attributes.issue.body') + ':'
.rightlist{:style => @issue.pull_request ? 'width: 500px;' : ''}
= f.text_area :body
.both
=render 'projects/issues/title_body', :f => f, :id => 'update'
=f.submit t('layout.update'), :id => 'update_issue_content'
=link_to t('layout.issues.cancel_button'), '#', :id => 'cancel_edit_issue_content', :class => 'button'
%br
%br

View File

@ -3,10 +3,10 @@
#labels-stock
=form_tag project_issues_path(@project), :id => 'filter_labels', :method => :get do
- @project.labels.each_with_index do |label, index|
.div-tracker-labels{:id => "label-#{label.name}", :style => @labels.include?(label.name) ? "background-color:##{label.color};color:#FFF" : ''}
.div-tracker-labels{:id => "label-#{label.name.parameterize}", :style => @labels.include?(label.name) ? "background-color:##{label.color};color:#FFF" : ''}
.div-label-left
.label
.flag{:id => "flag-#{label.name}", :style => "background-color: ##{label.color};"}
.flag{:id => "flag-#{label.name.parameterize}", :style => "background-color: ##{label.color};"}
.labeltext=label.name
=check_box_tag 'labels[]', label.name, @labels.include?(label.name), :style => 'display:none'
.both

View File

@ -27,7 +27,7 @@
.avatar=image_tag avatar_url(@issue.assignee), :alt => 'avatar'
.name=@issue.assignee.fullname
.both
=link_to(t('layout.issues.label_manage'), '#', :class => "button tmargin10 manage_assignee") if can_manage
=link_to(t('layout.issues.assignee_manage'), '#', :class => "button tmargin10 manage_assignee") if can_manage
- if can_manage
=form_tag search_collaborators_project_issues_path(@project), :id => 'search_user', :method => :get, :style => @issue.persisted? ? 'display:none' : '' do
=tracker_search_field(:search_user, t('layout.issues.search_user'))
@ -47,6 +47,7 @@
.both=hidden_field_tag "flag#{label.id}", label.id, :name => "issue[labelings_attributes][#{label.id}][label_id]"
=form_for :issue, :url => [@project, @issue], :method => :put, :html => { :class => 'edit_labels issue'} do |f|
.manage_labels
=hidden_field_tag "update_labels", true
- @issue.labels.each do |label|
=hidden_field_tag "flag#{label.id}", label.id, :name => "issue[labelings_attributes][#{label.id}][label_id]"
- else

View File

@ -0,0 +1,8 @@
#open-comment.comment.view
%h3.tmargin0= t 'activerecord.attributes.issue.title'
.wrapper= f.text_area :title, :cols => 80, :rows => 1
#open-comment.comment.view
=link_to t('layout.comments.md_cheatsheet_header'), '#md_help', 'data-toggle' => 'modal', :style => 'float:right;'
%h3.tmargin0= t 'activerecord.attributes.issue.body'
=render 'projects/comments/body', :f => f, :id => id
.both

View File

@ -5,3 +5,6 @@
%h3.bpadding10= t("layout.issues.create_header")
= form_for :issue, :url => project_issues_path(@project), :html => { :class => 'form issue' } do |f|
= render "form", :f => f
=hidden_field_tag :preview_url, project_md_preview_path(@project)
= render "projects/comments/markdown_help"

View File

@ -9,3 +9,6 @@
= render "projects/comments/list", :list => @issue.comments, :project => @project, :commentable => @issue
%br
= render "projects/comments/add", :project => @project, :commentable => @issue if current_user
=hidden_field_tag :preview_url, project_md_preview_path(@project)

View File

@ -6,14 +6,12 @@
.leftlist= f.label :description, t("activerecord.attributes.project.description"), :class => :label
.rightlist= f.text_area :description, :class => 'text_field', :cols => 80
.both
- if ['new', 'create'].include? controller.action_name
- if [:new, :create].include? act
.leftlist= f.label :owner_id, t("activerecord.attributes.project.owner"), :class => :label
.rightlist
= label_tag t("activerecord.attributes.project.who_owns.me")
- if Group.can_own_project(current_user).count > 0
= radio_button_tag :who_owns, 'me', @who_owns == :me #{}.merge( (@who_owns == :me) ? {:checked => 'checked'} : {} )
- puts @who_owns.inspect
- puts @who_owns == :group
= label_tag t("activerecord.attributes.project.who_owns.group")
= radio_button_tag :who_owns, 'group', @who_owns == :group #{}.merge( (@who_owns == :group) ? {:checked => 'checked'} : {} )
-# TODO: Make our own select_box helper with new design, blackjack and bitches!
@ -33,19 +31,33 @@
= image_tag("lock.png")
= t("activerecord.attributes.project.visibilities.#{visibility}")
.both
.leftlist
\ 
.rightlist
.check
%span#niceCheckbox1.niceCheck-main= f.check_box :is_package#, :class => 'niceCheckbox1'
.forcheck= t("activerecord.attributes.project.is_package")
.both
.both
- if [:edit, :update].include? act
.leftlist= t("activerecord.attributes.project.default_branch")
.rightlist= f.select :default_branch, options_from_collection_for_select(@project.repo.branches, :name, :name, @project.default_branch), :class => 'sel80', :id => 'branch_selector'
.both
- if [:edit, :update].include? act
.leftlist
\ 
.rightlist
.check
%span#niceCheckbox1.niceCheck-main= f.check_box :is_package#, :class => 'niceCheckbox1'
.forcheck= t("activerecord.attributes.project.is_package")
.both
.both
= f.select :default_branch,
options_from_collection_for_select( @project.repo.branches,
:name, :name, @project.default_branch),
:class => 'sel80', :id => 'branch_selector'
.both
#maintainer_form{:class => @project.is_package ? '' : 'hidden'}
= f.hidden_field :maintainer_id, :value => @project.maintainer_id
.leftlist
= t("activerecord.attributes.project.maintainer")
.rightlist
-# TODO: Maybe use something like Chosen with filter and prepopulated
-# list of potential maintainers?
= autocomplete_field_tag :maintainer_name, @project.maintainer.fullname,
autocomplete_maintainers_path(@project.owner, @project),
:id_element => '#project_maintainer_id',
:placeholder => @project.maintainer.fullname
- if [:new, :create].include? act
.leftlist= f.label :srpm, t("activerecord.attributes.project.srpm"), :class => :label
.rightlist= f.file_field :srpm, :class => 'file_field'
@ -54,3 +66,7 @@
\ 
.rightlist= submit_tag t("layout.save"), :class => 'button'
.both
:javascript
$(function() {
( new Rosa.Views.ProjectModifyView ).render();
});

View File

@ -15,3 +15,5 @@
.pull_status
=render 'status'
=render 'diff_commits_tabs' if @pull.status != 'already'
=hidden_field_tag :preview_url, project_md_preview_path(@project)

View File

@ -19,5 +19,5 @@
- if presenter.content?
.fulltext{:class => "#{presenter.expandable? ? "hidden" : ''} #{presenter.caption? ? "" : "alone"}",
:id => presenter.expandable? ? "content-expand#{item_no}" : ''}
= presenter.content
.cm-s-default.md_and_cm=markdown presenter.content
.both

View File

@ -0,0 +1,39 @@
= form_tag remove_members_path, :id => 'members_form', :method => :post do
%table.tablesorter{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
- if can? :remove_members, editable_object
%th
\ 
%th
= t("layout.collaborators.members")
- if can? :remove_member, editable_object
%th.buttons
= t("layout.remove")
%tbody
- members.each_with_index do |user, num|
%tr{:id => "admin-table-members-row#{num}", :class => cycle(:odd, :even)}
- if can? :remove_members, editable_object
%td
%span.niceCheck-main{:id => "niceCheckbox#{num}", :style => "background-position: 0px 0px; "}
= check_box_tag "user_remove[#{user.id}][]"
%td
.img
= image_tag avatar_url(user)
.forimg= link_to user.fullname, user_path(user)
- if can? :remove_member, editable_object
%td.buttons
= link_to "#{remove_member_path}?member_id=#{user.id}", :method => :delete, :confirm => t("layout.confirm") do
%span.delete &nbsp;
- if can? :remove_memvers, editable_object
= submit_tag t("layout.delete"), :class => 'button'
.both
- if can? :add_member, editable_object
.hr.top
= form_tag add_member_path do
.admin-search
= autocomplete_field_tag 'member_id', params[:member_id], autocomplete_user_uname_users_path, :id_element => '#member_id_field'
= hidden_field_tag 'member_id', nil, :id => 'member_id_field'
= submit_tag t("layout.add"), :class => 'button'
.both

View File

@ -0,0 +1,15 @@
%p
Build project
- if @build_list.project
= link_to @build_list.project.name_with_owner, project_url(@build_list.project)
- else
= t("layout.projects.unexisted_project")
completed with status
= @build_list.human_status
for arch
= "#{@build_list.arch.name}."
%p
More detailed information you can get by link:
= link_to "task [№ #{@build_list.bs_id ? @build_list.bs_id : t("layout.build_lists.bs_id_not_set")}]", build_list_url(@build_list)
%p== Support team «ROSA Build System»

View File

@ -0,0 +1,15 @@
%p
Сборка проекта
- if @build_list.project
= link_to @build_list.project.name_with_owner, project_url(@build_list.project)
- else
= t("layout.projects.unexisted_project")
завершена со статусом
= @build_list.human_status
для архитектуры
= "#{@build_list.arch.name}."
%p
Более подробную информацию можно получить по ссылке:
= link_to "задание [№ #{@build_list.bs_id ? @build_list.bs_id : t("layout.build_lists.bs_id_not_set")}]", build_list_url(@build_list)
%p== Команда поддержки «ROSA Build System»

View File

@ -0,0 +1,7 @@
%p== Hello, #{@register_request.name || @register_request.email}.
%p
You have been invited to project ABF. Please click on the following
= link_to 'link for registration', new_user_registration_url(:invitation_token => @register_request.token)
%p== Support team «ROSA Build System»

View File

@ -1,7 +0,0 @@
%p== Здравствуйте, #{@register_request.name || @register_request.email}.
%p
Вы приглашены в проект ABF. Чтобы зарегистрироваться перейдите по
= link_to 'ссылке', new_user_registration_url(:invitation_token => @register_request.token)
%p== Команда поддержки «ROSA Build System»

View File

@ -0,0 +1,7 @@
%p== Здравствуйте, #{@register_request.name || @register_request.email}.
%p
Вы приглашены в проект ABF. Пожалуйста, перейдите по
= link_to 'ссылке для регистрации', new_user_registration_url(:invitation_token => @register_request.token)
%p== Команда поддержки «ROSA Build System»

View File

@ -6,13 +6,13 @@
%h3= title @user.uname
= @user.name
%br
= link_to @user.email, "mailto:#{@user.email}"
= mail_to @user.email, @user.email, :encode => "javascript"
%br
%h4= t("activerecord.attributes.user.professional_experience") + ":"
%p= @user.professional_experience
%h4= t("layout.users.public_projects_list") + ":"
%p
- @user.projects.by_visibilities(['open']).each do |project|
- @projects.each do |project|
= link_to project.name, project
%br

View File

@ -0,0 +1,3 @@
.leftside.w25= f.check_box field
.leftside= f.label field, t("activerecord.attributes.settings.notifier.#{field}")
.both

View File

@ -7,32 +7,16 @@
%br
= form_for @user.notifier, :url => notifiers_settings_path, :html => {:class => :form} do |f|
.leftside.w25= f.check_box :can_notify
.leftside= f.label :can_notify, t('activerecord.attributes.settings.notifier.can_notify')
.both
= render 'notifier', :f => f, :field => :can_notify
%h3= t("layout.settings.notifiers.code_header")
.leftside.w25= f.check_box :new_comment_commit_owner, :class => 'notify_cbx'
.leftside= f.label :new_comment_commit_owner, t('activerecord.attributes.settings.notifier.new_comment_commit_owner')
.both
.leftside.w25= f.check_box :new_comment_commit_repo_owner, :class => 'notify_cbx'
.leftside= f.label :new_comment_commit_repo_owner, t('activerecord.attributes.settings.notifier.new_comment_commit_repo_owner')
.both
.leftside.w25= f.check_box :new_comment_commit_commentor, :class => 'notify_cbx'
.leftside= f.label :new_comment_commit_commentor, t('activerecord.attributes.settings.notifier.new_comment_commit_commentor')
.both
- [:new_comment_commit_owner, :new_comment_commit_repo_owner, :new_comment_commit_commentor].each do |field|
= render 'notifier', :f => f, :field => field
%h3= t("layout.settings.notifiers.tracker_header")
.leftside.w25= f.check_box :new_comment, :class => 'notify_cbx'
.leftside= f.label :new_comment, t('activerecord.attributes.settings.notifier.new_comment')
.both
.leftside.w25= f.check_box :new_comment_reply, :class => 'notify_cbx'
.leftside= f.label :new_comment_reply, t('activerecord.attributes.settings.notifier.new_comment_reply')
.both
.leftside.w25= f.check_box :new_issue, :class => 'notify_cbx'
.leftside= f.label :new_issue, t('activerecord.attributes.settings.notifier.new_issue')
.both
.leftside.w25= f.check_box :issue_assign, :class => 'notify_cbx'
.leftside= f.label :issue_assign, t('activerecord.attributes.settings.notifier.issue_assign')
.both
- [:new_comment, :new_comment_reply, :new_issue, :issue_assign].each do |field|
= render 'notifier', :f => f, :field => field
%h3= t("layout.settings.notifiers.build_list_header")
- [:new_build, :new_associated_build].each do |field|
= render 'notifier', :f => f, :field => field
%br
.leftside.w25

View File

@ -55,7 +55,7 @@ namespace :deploy do
run "ln -nfs #{fetch :shared_path}/config/database.yml #{fetch :release_path}/config/database.yml"
# Setup application
run "cp -n #{fetch :release_path}/config/deploy/application.#{fetch :stage}.yml #{fetch :shared_path}/config/application.yml"
run "cp -n #{fetch :release_path}/config/application.yml.sample #{fetch :shared_path}/config/application.yml"
run "ln -nfs #{fetch :shared_path}/config/application.yml #{fetch :release_path}/config/application.yml"
# It will survive downloads folder between deployments
@ -101,3 +101,33 @@ namespace :rake_tasks do
mirror_rake_tasks 'db:seeds'
end
end
namespace :update do
desc "Copy remote production shared files to localhost"
task :shared do
run_locally "rsync --recursive --times --rsh=ssh --compress --human-readable --progress #{user}@#{domain}:#{shared_path}/shared_contents/uploads public/uploads"
end
desc "Dump remote production postgresql database, rsync to localhost"
task :postgresql do
get("#{current_path}/config/database.yml", "tmp/database.yml")
remote_settings = YAML::load_file("tmp/database.yml")[rails_env]
local_settings = YAML::load_file("config/database.yml")["development"]
run "export PGPASSWORD=#{remote_settings["password"]} && pg_dump --host=#{remote_settings["host"]} --port=#{remote_settings["port"]} --username #{remote_settings["username"]} --file #{current_path}/tmp/#{remote_settings["database"]}_dump -Fc #{remote_settings["database"]}"
run_locally "rsync --recursive --times --rsh=ssh --compress --human-readable --progress #{user}@#{domain}:#{current_path}/tmp/#{remote_settings["database"]}_dump tmp/"
run_locally "dropdb -U #{local_settings["username"]} --host=#{local_settings["host"]} --port=#{local_settings["port"]} #{local_settings["database"]}"
run_locally "createdb -U #{local_settings["username"]} --host=#{local_settings["host"]} --port=#{local_settings["port"]} -T template0 #{local_settings["database"]}"
run_locally "pg_restore -U #{local_settings["username"]} --host=#{local_settings["host"]} --port=#{local_settings["port"]} -d #{local_settings["database"]} tmp/#{remote_settings["database"]}_dump"
end
desc "Dump all remote data to localhost"
task :all do
# update.shared
update.postgresql
end
end

View File

@ -1,16 +0,0 @@
production:
action_mailer_host: "abf.rosalinux.ru"
root_path: /share
nginx_log: /srv/rosa_build/shared/log/nginx.access.log
do-not-reply-email: do-not-reply@rosalinux.ru
project_name: ABF
repo_project_name: ABF
build_server_ip: 127.0.0.1
build_server_port: 12555
build_server_path: /xmlrpc
product_builder_ip:
mdv: 192.168.122.144
nau5: 192.168.122.203
product_builder_port: 12554
product_builder_path: /xmlrpc
distr_types: ['mdv']

View File

@ -1,23 +0,0 @@
common: &common
project_name: ABF
repo_project_name: ABF
distr_types: ['mdv', 'nau5', 'suse', 'deb']
wiki_formats:
markdown: "Markdown"
textile: "Textile"
org: "Org-mode"
production:
<<: *common
action_mailer_host: "school.rosalab.ru"
root_path: /share
nginx_log: /srv/rosa_build/shared/log/nginx.access.log
do-not-reply-email: do-not-reply@school.rosalab.ru
build_server_ip: 127.0.0.1
build_server_port: 12555
build_server_path: /xmlrpc
product_builder_ip:
mdv: 192.168.122.19
nau5: 192.168.122.203
product_builder_port: 12554
product_builder_path: /xmlrpc

View File

@ -1,16 +0,0 @@
production:
action_mailer_host: "dev-abf.rosalinux.ru"
root_path: /share
nginx_log: /srv/rosa_build/shared/log/nginx.access.log
do-not-reply-email: do-not-reply@dev-abf.rosalinux.ru
project_name: ABF
repo_project_name: ABF
build_server_ip: 127.0.0.1
build_server_port: 12555
build_server_path: /xmlrpc
product_builder_ip:
mdv: 192.168.122.19
nau5: 192.168.122.203
product_builder_port: 12554
product_builder_path: /xmlrpc
distr_types: ['mdv', 'nau5']

View File

@ -12,7 +12,8 @@ Mime::Type.register "text/plain", 'patch'
[["text/x-python", ['py'], '8bit'],
["text/x-rpm-spec", ['spec'], '8bit'],
["text/x-csrc", ['h', 'c'], '8bit'],
["text/x-c++src", ['cpp'], '8bit']
["text/x-c++src", ['cpp'], '8bit'],
["text/x-diff", ['diff'], '8bit']
].each do |type|
MIME::Types.add MIME::Type.from_array(type)
end

View File

@ -47,6 +47,7 @@ en:
processing: working ...
invalid_content_type: incorrect type
atom_link_tag_title: Private feed for %{nickname} | %{app_name}
preview: Preview
settings:
label: Settings
@ -57,6 +58,7 @@ en:
change_email_link: Change email address
code_header: Code
tracker_header: Tracker
build_list_header: Build List
devise:
shared_links:
@ -178,6 +180,8 @@ en:
new_comment_commit_owner: Notify about comments to my commit
new_comment_commit_repo_owner: Notify about comments to my repository commits
new_comment_commit_commentor: Notify about comments after my commit
new_build: Notify about my build tasks
new_associated_build: Notify about associated with me build tasks
private_user:
login: Login

View File

@ -1,6 +1,8 @@
en:
layout:
autoreload_page: Update page automatically
autoreload_log: Update log every
word_wrap: Word wrap
read_more: Read more
turned_on: on
turned_off: off

View File

@ -1,6 +1,8 @@
ru:
layout:
autoreload_page: Автоматически обновлять страницу
word_wrap: Перенос строк
autoreload_log: Обновлять лог каждые
read_more: Читать дальше
turned_on: включены
turned_off: выключены

View File

@ -18,6 +18,7 @@ en:
new_user_notification: Registered on project «%{ project_name }»
issue_assign_notification: New task assigned
invite_approve_notification: Invitation to ABF
for_arch: for arch %{arch}.
bodies:
new_comment_notification:

Some files were not shown because too many files have changed in this diff Show More