Merge branch '3.2-master' into 265-new_design_for_activity_feed

This commit is contained in:
Alexander Machehin 2012-03-11 22:44:25 +06:00
commit 6d5120e5cc
49 changed files with 368 additions and 414 deletions

View File

@ -31,10 +31,6 @@ $(document).ready(function() {
disableNotifierCbx($(this)); disableNotifierCbx($(this));
}); });
$('div.information > div.user').live('click', function() {
droplist();
});
$('div.information > div.profile > a').live('click', function(e) { $('div.information > div.profile > a').live('click', function(e) {
e.preventDefault(); e.preventDefault();
}); });

View File

@ -1,7 +1,7 @@
jQuery(document).ready(function(){ jQuery(document).ready(function(){
var params = { var params = {
changedEl: ".lineForm select", changedEl: ".lineForm select.cusel",
visRows: 999999, visRows: 999999,
scrollArrows: false scrollArrows: false
} }

View File

@ -1,5 +1,5 @@
$(document).ready(function() { $(document).ready(function() {
$('select#build_list_pl_id').change(function() { $('#build_list_pl_id').change(function() {
var platform_id = $(this).val(); var platform_id = $(this).val();
var base_platforms = $('.base_platforms input[type=checkbox]'); var base_platforms = $('.base_platforms input[type=checkbox]');
@ -19,5 +19,5 @@ $(document).ready(function() {
} }
}); });
}); });
$('select#build_list_pl_id').trigger('change'); $('#build_list_pl_id').trigger('change');
}); });

View File

@ -106,7 +106,7 @@ $(document).ready(function() {
return false; return false;
}; };
$('#search_user, #search_labels').live('submit', function() { $('#search_user').live('submit', function() {
var id = $(this).attr('id'); var id = $(this).attr('id');
if(id.indexOf('user') != -1) { // FIXME if(id.indexOf('user') != -1) { // FIXME
var which = 'users'; var which = 'users';
@ -171,14 +171,13 @@ $(document).ready(function() {
var clone = $(this).clone(); var clone = $(this).clone();
form_new.find('#flag-span').fadeOut(0); form_new.find('#flag-span').fadeOut(0);
form_new.find('#issue_labels').append(clone); form_new.find('#issue_labels').append(clone);
var labels = $('#active_labels'); var labels = $('.manage_labels');
labels.find('#'+$(this).attr('id')).remove(); labels.append($(this).find('#'+$(this).attr('id')));
labels.append(clone);
}); });
$('.remove_label.label.selected').live('click', function() { $('.remove_label.label.selected').live('click', function() {
var id = $(this).attr('id'); var id = $(this).attr('id');
$('.current_labels, #active_labels').find('#'+id+'.label.selected.remove_label').remove(); $('.manage_labels, #active_labels').find('#'+id+'.label.selected.remove_label').remove();
var form = $('.form.issue'); var form = $('.form.issue');
if(form.find('.remove_label.label.selected').length == 1) { if(form.find('.remove_label.label.selected').length == 1) {
form.find('#flag-span').fadeIn(0); form.find('#flag-span').fadeIn(0);
@ -189,6 +188,7 @@ $(document).ready(function() {
label.removeClass('selected').addClass('add_label').removeClass('remove_label'); label.removeClass('selected').addClass('add_label').removeClass('remove_label');
label.find('.labeltext.selected').attr('style', '').removeClass('selected'); label.find('.labeltext.selected').attr('style', '').removeClass('selected');
label.find('.flag').fadeIn(0); label.find('.flag').fadeIn(0);
$('.manage_labels').find('#'+$(this).attr('id')).remove();
}); });
$('.issue_status.switch_issue_status').live('click', function () { $('.issue_status.switch_issue_status').live('click', function () {
@ -243,12 +243,14 @@ $(document).ready(function() {
$('.button.manage_executor').live('click', function() { $('.button.manage_executor').live('click', function() {
$('form#search_user, .button.update_executor').fadeIn(0); $('form#search_user, .button.update_executor').fadeIn(0);
$('.current_executor .people').addClass('remove_executor selected'); $('.current_executor .people').addClass('remove_executor selected').removeClass('nopointer');
$(this).fadeOut(0); $(this).fadeOut(0);
}); });
$('.button.manage_labels').live('click', function() { $('.button.manage_labels').live('click', function() {
$('form#search_labels, .button.update_labels').fadeIn(0); $('.button.update_labels').fadeIn(0);
$('.current_labels .label .labeltext.selected').parent().addClass('remove_label selected').removeClass('nopointer');
$('.current_labels .label .labeltext:not(.selected)').parent().addClass('add_label').removeClass('nopointer');
$(this).fadeOut(0); $(this).fadeOut(0);
}); });
@ -259,6 +261,7 @@ $(document).ready(function() {
url: form.attr("action"), url: form.attr("action"),
data: form.serialize(), data: form.serialize(),
success: function(data){ success: function(data){
$('.current_executor .people').removeClass('remove_executor selected').addClass('nopointer');
$('form#search_user, .button.update_executor').fadeOut(0); $('form#search_user, .button.update_executor').fadeOut(0);
$('.button.manage_executor').fadeIn(0); $('.button.manage_executor').fadeIn(0);
$('#manage_issue_users_list').html(''); $('#manage_issue_users_list').html('');
@ -277,7 +280,8 @@ $(document).ready(function() {
url: form.attr("action"), url: form.attr("action"),
data: form.serialize(), data: form.serialize(),
success: function(data){ success: function(data){
$('form#search_labels, .button.update_labels').fadeOut(0); $('.current_labels .label').removeClass('remove_label selected').addClass('nopointer');
$('.button.update_labels').fadeOut(0);
$('.button.manage_labels').fadeIn(0); $('.button.manage_labels').fadeIn(0);
$('#manage_issue_labels_list').html(''); $('#manage_issue_labels_list').html('');
}, },

View File

@ -305,6 +305,7 @@ table.tablesorter tbody td a .issue_title {
#output.formatted { #output.formatted {
width: auto; width: auto;
font-family: "Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace; font-family: "Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace;
color: #000000;
padding: 10px 5px 0px; padding: 10px 5px 0px;
margin-left: 45px; margin-left: 45px;
} }
@ -441,3 +442,5 @@ table.wiki .history .td2 .name span.username {
text-overflow: ellipsis; text-overflow: ellipsis;
width: 164px; width: 164px;
} }
#fork-and-edit {display:block;}

View File

@ -298,7 +298,7 @@ header div.droplist a:hover{
color: #575756; color: #575756;
text-decoration: none; text-decoration: none;
height: 34px; height: 34px;
padding: 0px 20px 6px 20px; padding: 0px 20px 8px 20px;
} }
.sub-menu nav ul li a.active { .sub-menu nav ul li a.active {
@ -651,6 +651,9 @@ article div.all.bigpadding div.rightside {
width: 70px; width: 70px;
} }
a.button.width81 {
width: 81px;
}
/* Footer */ /* Footer */

View File

@ -45,7 +45,7 @@ class ApplicationController < ActionController::Base
end end
def layout_by_resource def layout_by_resource
if devise_controller? && !(params[:controller] == 'devise/registrations' && params[:action] == 'edit') if devise_controller? && !(params[:controller] == 'devise/registrations' && ['edit', 'update'].include?(params[:action]))
"sessions" "sessions"
else else
"application" "application"

View File

@ -99,11 +99,6 @@ class IssuesController < ApplicationController
render 'issues/_search_collaborators', :layout => false render 'issues/_search_collaborators', :layout => false
end end
def search_labels
@labels = @project.labels.where("labels.name ILIKE ?", "%#{params[:search_labels]}%").order('labels.name').limit(10)
render 'issues/_search_labels', :layout => false
end
private private
def load_and_authorize_label def load_and_authorize_label

View File

@ -1,36 +1,11 @@
# -*- encoding : utf-8 -*- # -*- encoding : utf-8 -*-
class ProjectsController < ApplicationController class ProjectsController < ApplicationController
is_related_controller! before_filter :authenticate_user!
belongs_to :user, :group, :polymorphic => true, :optional => true
before_filter :authenticate_user!, :except => :auto_build
before_filter :find_project, :only => [:show, :edit, :update, :destroy, :fork, :sections]
before_filter :get_paths, :only => [:new, :create, :edit, :update]
load_and_authorize_resource load_and_authorize_resource
def index def index
@projects = if parent? and !parent.nil? @projects = current_user.projects.paginate(:page => params[:project_page])
parent.projects @projects = @projects.search(params[:query]).search_order if params[:query]
else
Project
end.accessible_by(current_ability)
@projects = if params[:query]
@projects.by_name("%#{params[:query]}%").order("CHAR_LENGTH(name) ASC")
else
@projects
end.paginate(:page => params[:project_page])
@own_projects = current_user.own_projects
#@part_projects = current_user.projects + current_user.groups.map(&:projects).flatten.uniq - @own_projects
end
def show
@current_build_lists = @project.build_lists.current.recent.paginate :page => params[:page]
@branch = @project.branch(params[:treeish])
@commit = @branch.present? ? @branch.commit : @git_repository.log(@treeish).first
end end
def new def new
@ -43,7 +18,6 @@ class ProjectsController < ApplicationController
def create def create
@project = Project.new params[:project] @project = Project.new params[:project]
#@project.owner = get_owner
@project.owner = choose_owner @project.owner = choose_owner
@who_owns = (@project.owner_type == 'User' ? :me : :group) @who_owns = (@project.owner_type == 'User' ? :me : :group)
@ -84,20 +58,6 @@ class ProjectsController < ApplicationController
end end
end end
# TODO remove this?
def auto_build
uname, name = params[:git_repo].split('/')
owner = User.find_by_uname(uname) || Group.find_by_uname(uname)
project = Project.where(:owner_id => owner.id, :owner_type => owner.class).find_by_name!(name)
project.delay.auto_build # TODO don't queue duplicates
# p = params.delete_if{|k,v| k == 'controller' or k == 'action'}
# ActiveSupport::Notifications.instrument("event_log.observer", :object => project, :message => p.inspect)
logger.info "Git hook recieved from #{params[:git_user]} to #{params[:git_repo]}"
render :nothing => true
end
def sections def sections
if request.post? if request.post?
if @project.update_attributes(params[:project]) if @project.update_attributes(params[:project])
@ -110,32 +70,19 @@ class ProjectsController < ApplicationController
end end
end end
def remove_user
@project.relations.by_object(current_user).destroy_all
flash[:notice] = t("flash.project.user_removed")
redirect_to projects_path
end
protected protected
def get_paths def choose_owner
if params[:user_id] if params[:who_owns] == 'group'
@user = User.find params[:user_id] Group.find(params[:owner_id])
@projects_path = user_path(@user) # user_projects_path @user else
@new_project_path = new_project_path current_user
elsif params[:group_id]
@group = Group.find params[:group_id]
@projects_path = group_path(@group) # group_projects_path @group
@new_projects_path = new_project_path
else
@projects_path = projects_path
@new_projects_path = new_project_path
end
end
def find_project
@project = Project.find params[:id]
end
def choose_owner
if params[:who_owns] == 'group'
Group.find(params[:owner_id])
else
current_user
end
end end
end
end end

View File

@ -20,6 +20,6 @@ class SearchController < ApplicationController
def find_collection(type) def find_collection(type)
var = :"@#{type}" var = :"@#{type}"
instance_variable_set var, type.classify.constantize.search(params[:query]).paginate(:page => params[:page]) unless instance_variable_defined?(var) instance_variable_set var, type.classify.constantize.search(params[:query]).search_order.paginate(:page => params[:page]) unless instance_variable_defined?(var)
end end
end end

View File

@ -44,6 +44,7 @@ class UsersController < ApplicationController
@user.role = params[:user][:role] @user.role = params[:user][:role]
params[:user].delete(:role) params[:user].delete(:role)
end end
@user ||= current_user
if @user.update_without_password(params[:user]) if @user.update_without_password(params[:user])
flash[:notice] = t('flash.user.saved') flash[:notice] = t('flash.user.saved')
redirect_to edit_user_path(@user) redirect_to edit_user_path(@user)

View File

@ -52,9 +52,11 @@ module GitHelper
end end
def choose_render_way(blob) def choose_render_way(blob)
return :image if blob.mime_type.match(/image/) return :image if blob.mime_type.match(/image/)
return :text if blob.mime_type.match(/text|xml|json/) return :binary if blob.binary?
:binary :text
# return :text if blob.mime_type.match(/text|xml|json/)
# :binary
end end
def force_encoding_to_site(string) def force_encoding_to_site(string)

View File

@ -15,4 +15,8 @@ module ProjectsHelper
} }
) )
end end
def visibility_icon(visibility)
visibility == 'open' ? 'unlock.png' : 'lock.png'
end
end end

View File

@ -53,6 +53,7 @@ class Ability
can([:update, :sections, :manage_collaborators], Project) {|project| local_admin? project} can([:update, :sections, :manage_collaborators], Project) {|project| local_admin? project}
can(:fork, Project) {|project| can? :read, project} can(:fork, Project) {|project| can? :read, project}
can(:destroy, Project) {|project| owner? project} can(:destroy, Project) {|project| owner? project}
can :remove_user, Project
# TODO: Turn on AAA when it will be updated # TODO: Turn on AAA when it will be updated
#can :create, AutoBuildList #can :create, AutoBuildList

View File

@ -18,7 +18,7 @@ class Git::Repository
end end
def repo def repo
@repo ||= Grit::Repo.new(path) @repo ||= Grit::Repo.new(path) rescue Grit::Repo.new(GAP_REPO_PATH)
end end
# Adds a callback to be fired after update file. # Adds a callback to be fired after update file.

View File

@ -17,6 +17,7 @@ class Group < ActiveRecord::Base
validates :uname, :presence => true, :uniqueness => {:case_sensitive => false}, :format => { :with => /^[a-z0-9_]+$/ } validates :uname, :presence => true, :uniqueness => {:case_sensitive => false}, :format => { :with => /^[a-z0-9_]+$/ }
validate { errors.add(:uname, :taken) if User.where('uname LIKE ?', uname).present? } validate { errors.add(:uname, :taken) if User.where('uname LIKE ?', uname).present? }
scope :search_order, order("CHAR_LENGTH(uname) ASC")
scope :search, lambda {|q| where("uname ILIKE ?", "%#{q}%")} scope :search, lambda {|q| where("uname ILIKE ?", "%#{q}%")}
scope :by_owner, lambda {|owner| where(:owner_id => owner.id)} scope :by_owner, lambda {|owner| where(:owner_id => owner.id)}
scope :by_admin, lambda {|admin| joins(:relations).where(:'relations.role' => 'admin', :'relations.target_id' => admin.id, :'relations.target_type' => 'User')} scope :by_admin, lambda {|admin| joins(:relations).where(:'relations.role' => 'admin', :'relations.target_id' => admin.id, :'relations.target_type' => 'User')}

View File

@ -6,4 +6,5 @@ class Label < ActiveRecord::Base
validates :name, :uniqueness => { :scope => :project_id} validates :name, :uniqueness => { :scope => :project_id}
validates :name, :color, :presence => true validates :name, :color, :presence => true
validates :color, :format => { :with => /\A([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\z/, :message => I18n.t('layout.issues.invalid_labels')} validates :color, :format => { :with => /\A([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\z/, :message => I18n.t('layout.issues.invalid_labels')}
end end

View File

@ -26,6 +26,7 @@ class Platform < ActiveRecord::Base
after_destroy lambda { umount_directory_for_rsync unless hidden? } after_destroy lambda { umount_directory_for_rsync unless hidden? }
after_update :update_owner_relation after_update :update_owner_relation
scope :search_order, order("CHAR_LENGTH(name) ASC")
scope :search, lambda {|q| where("name ILIKE ?", "%#{q}%").open} scope :search, lambda {|q| where("name ILIKE ?", "%#{q}%").open}
scope :by_visibilities, lambda {|v| where(:visibility => v)} scope :by_visibilities, lambda {|v| where(:visibility => v)}
scope :open, where(:visibility => 'open') scope :open, where(:visibility => 'open')

View File

@ -26,10 +26,11 @@ class Project < ActiveRecord::Base
validates_attachment_size :srpm, :less_than => 500.megabytes validates_attachment_size :srpm, :less_than => 500.megabytes
validates_attachment_content_type :srpm, :content_type => ['application/octet-stream', "application/x-rpm", "application/x-redhat-package-manager"], :message => I18n.t('layout.invalid_content_type') validates_attachment_content_type :srpm, :content_type => ['application/octet-stream', "application/x-rpm", "application/x-redhat-package-manager"], :message => I18n.t('layout.invalid_content_type')
#attr_accessible :category_id, :name, :description, :visibility attr_accessible :name, :description, :visibility, :srpm, :is_rpm, :default_branch, :has_issues, :has_wiki
attr_readonly :name attr_readonly :name
scope :recent, order("name ASC") scope :recent, order("name ASC")
scope :search_order, order("CHAR_LENGTH(name) ASC")
scope :search, lambda {|q| by_name("%#{q}%").open} scope :search, lambda {|q| by_name("%#{q}%").open}
scope :by_name, lambda {|name| where('projects.name ILIKE ?', name)} scope :by_name, lambda {|name| where('projects.name ILIKE ?', name)}
scope :by_visibilities, lambda {|v| where(:visibility => v)} scope :by_visibilities, lambda {|v| where(:visibility => v)}
@ -151,7 +152,7 @@ class Project < ActiveRecord::Base
end end
def fork(new_owner) def fork(new_owner)
clone.tap do |c| dup.tap do |c|
c.parent_id = id c.parent_id = id
c.owner = new_owner c.owner = new_owner
c.updated_at = nil; c.created_at = nil # :id = nil c.updated_at = nil; c.created_at = nil # :id = nil

View File

@ -42,6 +42,7 @@ class User < ActiveRecord::Base
attr_readonly :uname attr_readonly :uname
attr_accessor :login attr_accessor :login
scope :search_order, order("CHAR_LENGTH(uname) ASC")
scope :search, lambda {|q| where("uname ILIKE ?", "%#{q}%")} scope :search, lambda {|q| where("uname ILIKE ?", "%#{q}%")}
after_create lambda { self.create_notifier } after_create lambda { self.create_notifier }

View File

@ -1,6 +1,7 @@
- content_for :sidebar do - content_for :sidebar do
.bordered.nopadding .bordered.nopadding
%h3= t('layout.build_lists.build_server_status.header') %h3= t('layout.build_lists.build_server_status.header')
.table .table
.lefter= t('layout.build_lists.build_server_status.client_count') .lefter= t('layout.build_lists.build_server_status.client_count')
.righter= @build_server_status['client_count'] .righter= @build_server_status['client_count']
@ -13,6 +14,8 @@
.lefter= t('layout.build_lists.build_server_status.count_build_task') .lefter= t('layout.build_lists.build_server_status.count_build_task')
.righter= @build_server_status['count_build_task'] .righter= @build_server_status['count_build_task']
.both .both
%br
= link_to t('layout.build_lists.new_header'), new_project_build_list_path(@project), :class => 'button' if @project and can?(:create, @project.build_lists.build)
= form_for :filter, :url => @action_url, :html => { :method => :post, :class => :form } do |f| = form_for :filter, :url => @action_url, :html => { :method => :post, :class => :form } do |f|
.bordered.nopadding .bordered.nopadding

View File

@ -15,7 +15,5 @@
= will_paginate @build_lists = will_paginate @build_lists
= link_to t('layout.build_lists.new_header'), new_project_build_list_path(@project), :class => 'button' if @project and can?(:create, @project => BuildList)
= render 'build_lists/filter' = render 'build_lists/filter'
= render @project ? 'projects/submenu' : 'build_lists/submenu' = render @project ? 'projects/submenu' : 'build_lists/submenu'

View File

@ -1,7 +1,7 @@
%h3= t("layout.projects.files_in_project") %h3= t("layout.projects.files_in_project")
.files .files
.l .l= render :partial => 'git/shared/whereami'
= render :partial => 'git/shared/whereami' = render :partial => 'git/shared/fork'
.both .both
= form_tag blob_file_path, :name => 'blob-editor', :method => :put do = form_tag blob_file_path, :name => 'blob-editor', :method => :put do
@ -36,7 +36,7 @@
:javascript :javascript
$(function() { $(function() {
var editor = CodeMirror.fromTextArea(document.getElementById('code'), {lineNumbers: true, mode: '#{@blob.mime_type}', theme: 'eclipse'}); var editor = CodeMirror.fromTextArea(document.getElementById('code'), {lineNumbers: true, mode: '#{@blob.raw_mime_type.content_type}', theme: 'eclipse'});
}); });
/ - content_for :javascripts do / - content_for :javascripts do

View File

@ -1,7 +1,7 @@
%h3= t("layout.projects.files_in_project") %h3= t("layout.projects.files_in_project")
.files .files
.l .l= render :partial => 'git/shared/whereami'
= render :partial => 'git/shared/whereami' = render :partial => 'git/shared/fork'
.both .both
- render_way = choose_render_way(@blob) - render_way = choose_render_way(@blob)
@ -53,5 +53,5 @@
:javascript :javascript
$(document).ready(function() { $(document).ready(function() {
var text = $('#code').text().replace(/&amp;/gi, '&'); var text = $('#code').text().replace(/&amp;/gi, '&');
CodeMirror.runMode(text, "#{File.extname(@blob.name) == '.spec' ? 'text/x-rpm-spec' : @blob.mime_type}", document.getElementById("output")); CodeMirror.runMode(text, "#{@blob.raw_mime_type.content_type}", document.getElementById("output"));
}); });

View File

@ -1,7 +1,7 @@
%h3= t("layout.projects.files_in_project") %h3= t("layout.projects.files_in_project")
.files .files
.l .l= render :partial => 'git/shared/whereami'
= render :partial => 'git/shared/whereami' = render :partial => 'git/shared/fork'
.both .both
%table#myTable.tablesorter.project{:cellpadding => "0", :cellspacing => "0"} %table#myTable.tablesorter.project{:cellpadding => "0", :cellspacing => "0"}

View File

@ -0,0 +1,2 @@
- if can? :fork, @project
.r#fork-and-edit= link_to t('layout.projects.fork_and_edit'), fork_project_path(@project), :method => :post, :confirm => t("layout.confirm"), :class => 'button'

View File

@ -3,7 +3,7 @@
#labels-stock #labels-stock
=form_tag project_issues_path(@project), :id => 'filter_labels', :method => :get do =form_tag project_issues_path(@project), :id => 'filter_labels', :method => :get do
- @project.labels.each_with_index do |label, index| - @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}", :style => @labels.include?(label.name) ? "background-color:##{label.color};color:#FFF" : ''}
.div-label-left .div-label-left
.label .label
.flag{:id => "flag-#{label.name}", :style => "background-color: ##{label.color};"} .flag{:id => "flag-#{label.name}", :style => "background-color: ##{label.color};"}

View File

@ -16,14 +16,14 @@
=form_for :issue, :url => [@project, @issue], :method => :put, :html => { :class => 'edit_executor issue'} do |f| =form_for :issue, :url => [@project, @issue], :method => :put, :html => { :class => 'edit_executor issue'} do |f|
.current_executor .current_executor
- if @issue.user - if @issue.user
#user-0.people #user-0.people.nopointer
.avatar=image_tag avatar_url(@issue.user), :alt => 'avatar' .avatar=image_tag avatar_url(@issue.user), :alt => 'avatar'
.name="#{@issue.user.uname} (#{@issue.user.name})" .name="#{@issue.user.uname} (#{@issue.user.name})"
=hidden_field_tag "user-0", @issue.user.id, :name => 'issue[user_id]' =hidden_field_tag "user-0", @issue.user.id, :name => 'issue[user_id]'
.both .both
- else - else
.people.nopointer .people.nopointer
.avatar=image_tag(@issue.user.avatar(25), :alt => 'avatar') .avatar=image_tag avatar_url(@issue.user), :alt => 'avatar'
.name="#{@issue.user.uname} (#{@issue.user.name})" .name="#{@issue.user.uname} (#{@issue.user.name})"
.both .both
=link_to(t('layout.issues.label_manage'), '#', :class => "button tmargin10 manage_executor") if can_manage =link_to(t('layout.issues.label_manage'), '#', :class => "button tmargin10 manage_executor") if can_manage
@ -36,26 +36,23 @@
.block .block
%h3=t('layout.issues.labels') %h3=t('layout.issues.labels')
- if @issue.persisted?
- if can_manage
=form_for :issue, :url => [@project, @issue], :method => :put, :html => { :class => 'edit_labels issue'} do |f|
.current_labels
- (@issue.labels || []).each do |label|
.label.selected{:id => "flag#{label.id}"}
.flag{:style => "display:none; background: ##{label.color}"}
.labeltext.selected{:style => "background: ##{label.color}"}=label.name
=hidden_field_tag "label-#{label.id}", label.id, :name => "issue[labelings_attributes][#{label.id}][label_id]"
.both
- else
- (@issue.labels || []).each do |label|
.label.nopointer
.labeltext.selected{:style => "background: ##{label.color};"}
=label.name
.both
=link_to(t('layout.issues.label_manage'), '#', :class => "button tmargin10 manage_labels") if can_manage
- if can_manage - if can_manage
=form_tag search_labels_project_issues_path(@project), :id => 'search_labels', :method => :get, :style => @issue.persisted? ? 'display:none' : '' do .current_labels
=tracker_search_field(:search_labels, t('layout.issues.search_labels')) - (@project.labels || []).each do |label|
#manage_issue_labels_list - is_issue_label = @issue.labels.include? label
=render 'issues/search_labels' .label{:id => "flag#{label.id}", :class => @issue.persisted? ? 'nopointer' : 'add_label'}
=link_to(t('layout.issues.done'), '#', :class => "button tmargin10 update_labels", :style => 'display:none') if can_manage .flag{:style => "background: ##{label.color}; #{is_issue_label ? 'display:none;' : ''}"}
.labeltext{:class => is_issue_label ? 'selected' : '', :style => is_issue_label ? "background: ##{label.color}" : ''}=label.name
.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
- @issue.labels.each do |label|
=hidden_field_tag "flag#{label.id}", label.id, :name => "issue[labelings_attributes][#{label.id}][label_id]"
- else
- (@issue.labels || []).each do |label|
.label.nopointer
.labeltext.selected{:style => "background: ##{label.color};"}=label.name
.both
- if can_manage && @issue.persisted?
=link_to(t('layout.issues.label_manage'), '#', :class => "button tmargin10 manage_labels")
=link_to(t('layout.issues.done'), '#', :class => "button tmargin10 update_labels", :style => 'display:none')

View File

@ -1,6 +0,0 @@
- (@labels || []).each do |label|
.add_label.label{:id => "flag#{label.id}"}
.flag{:style => "background: ##{label.color};"}
.labeltext=label.name
=hidden_field_tag "label-#{label.id}", label.id, :name => "issue[labelings_attributes][#{label.id}][label_id]"
.both

View File

@ -1,6 +1,5 @@
.lineForm.fork .lineForm.fork
= select_tag :branch, branch_selector_options(project), = select_tag :branch, branch_selector_options(project), :id => 'branch_selector', :class => 'sel80'
:class => 'sel80', :id => 'branch_selector'
%form{ :action => '', :method => :get, :id => 'branch_changer', :'data-action' => "#{controller_name}"} %form{ :action => '', :method => :get, :id => 'branch_changer', :'data-action' => "#{controller_name}"}
.fork .fork
%p= t("layout.projects.#{params[:commit_hash].present? ? 'current_commit' : 'current_branch'}")+':' %p= t("layout.projects.#{params[:commit_hash].present? ? 'current_commit' : 'current_branch'}")+':'

View File

@ -1,16 +0,0 @@
.block.notice
%h3= t("layout.users.own_projects")
.content
%p
%ul
- @own_projects.each do |project|
%li
= link_to project.name, project_path(project)
-#.block.notice
-# %h3= t("layout.users.part_projects")
-# .content
-# %p
-# %ul
-# - @part_projects.each do |project|
-# %li
-# = link_to project.owner.uname + '/' + project.name, project_path(project)

View File

@ -1,4 +1,8 @@
%tr{:class => cycle("odd", "even")} %tr{:id => "Row#{project_counter}"}
%td= link_to project.name, project_path(project) %td
%td= project.name = link_to project do
%td= project.description .table-sort-left= image_tag visibility_icon(project.visibility)
.table-sort-right #{project.owner.uname} / #{project.name}
%td.td2= project.description
%td= t("layout.collaborators.role_names.#{project.relations.by_object(current_user).first.role}")
%td.td5= link_to image_tag('x.png'), remove_user_project_path(project), :method => :delete, :confirm => t("layout.confirm")

View File

@ -1,7 +1,7 @@
.description-top .description-top
.img= image_tag 'code.png' .img= image_tag 'code.png'
= text_field_tag :url, git_repo_url(project.git_repo_name), :class => 'name', = text_field_tag :url, git_repo_url(project.git_repo_name), :class => 'name',
:type => 'text',:spellcheck => 'false', :disabled => 'disabled' :type => 'text',:spellcheck => 'false', :readonly => true
.role .role
= t("layout.read_write_access") = t("layout.read_write_access")
= render :partial => 'projects/branch_select', :locals => {:project => project} = render :partial => 'projects/branch_select', :locals => {:project => project}

View File

@ -1,16 +1,12 @@
.block = link_to t('layout.projects.new'), new_project_path, :class => 'button' if can?(:create, Project)
.secondary-navigation
%ul.wat-cf
%li.first.active= link_to t("layout.projects.list"), projects_path
%li= link_to t("layout.projects.new"), new_project_path
.content
%h2.title
= t("layout.projects.list_header")
.inner
= render :partial => 'shared/search_form'
= render :partial => 'projects/list', :object => @projects
.actions-bar.wat-cf
.actions
= will_paginate @projects, :param_name => :project_page
- content_for :sidebar, render(:partial => 'own_projects_sidebar') %table#myTable.tablesorter{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
%th.th1= t("activerecord.attributes.project.name")
%th.th2= t("activerecord.attributes.project.description")
%th.th3= t("layout.projects.role")
%th.th4= t("layout.projects.remove_user")
%tbody= render @projects
= will_paginate

View File

@ -1,7 +1,4 @@
%h3.bpadding10 %h3.bpadding10= t("layout.projects.new")
= t("layout.projects.new_header")
= form_for @project, :html => { :class => :form, :multipart => true } do |f| = form_for @project, :html => { :class => :form, :multipart => true } do |f|
= render :partial => "form", :locals => {:f => f} = render :partial => "form", :locals => {:f => f}
-# content_for :sidebar, render('sidebar')

View File

@ -1,59 +0,0 @@
= render :partial => 'projects/submenu'
= render :partial => 'projects/repo_block', :locals => {:project => @project}
.description
%h3= t("layout.projects.about_subheader")
%p
= @project.description
= link_to t('layout.read_more'), '#'
%h3= t("layout.projects.last_commit")
- GitPresenters::CommitAsMessagePresenter.present(@commit, :branch => @branch) do |presenter|
= render :partial => 'shared/feed_message', :locals => {:presenter => presenter, :item_no => 1}
%h3= t("layout.projects.files_in_project")
.files
.l
= render :partial => 'git/shared/whereami'
#fork-and-edit.r
%a.button{:href => "#"} Fork and edit
.both
#repo-wrapper
%table#myTable.tablesorter.project{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
%th.th1.header= t("layout.project.filename")
%th.th2.header= t("layout.project.age")
%th.th3= t("layout.project.message")
%th.th4.header= t("layout.project.author")
%tbody
- if @path.present?
%tr
%td
.pic= image_tag 'folder.png'
.name
= link_to "..", tree_path(@project, @treeish, File.join([@path.dup.encode_to_default, ".."].compact).encode_to_default)
%td== &nbsp;
%td== &nbsp;
%td== &nbsp;
- @project.tree_info(@tree, @treeish, @path).each_pair do |entry, commit|
%tr
%td
- entry_path = File.join([@path.present? ? @path : nil, entry.name].compact).encode_to_default
- if entry.is_a? Grit::Blob
.pic= image_tag 'code.png'
.name
= link_to(entry.name, blob_path(@project, @treeish, entry_path), :class => 'files-see').encode_to_default
- else
.pic= image_tag 'folder.png'
.name
= link_to(entry.name, tree_path(@project, @treeish, entry_path), :class => 'files-see').encode_to_default
%td
%span{:style => "display: none;"}= commit.committed_date || commit.authored_date#> Dec 31, 2011
= l(commit.committed_date || commit.authored_date, :format => :short) #31 декабря 2011
%td
= commit.short_message.encode_to_default #Redo autostart script to start from user
%td
= (commit.committer || commit.author).name.encode_to_default #chipiga

View File

@ -1,5 +1,5 @@
= form_tag search_index_path, :method => 'get' do = form_tag search_index_path, :method => 'get' do
.leftside= text_field_tag 'query', params[:query], :placeholder => t("layout.search.header"), :class => 'exsearch' .leftside= text_field_tag 'query', params[:query], :placeholder => t("layout.search.header"), :class => 'exsearch'
.lineForm.leftside.rmargin10= select_tag 'type', options_for_select(t('layout.search.types').invert, params[:type]), :class => 'sel80', :id => 'selSearch' .lineForm.leftside.rmargin10= select_tag 'type', options_for_select(t('layout.search.types').invert, params[:type]), :class => 'sel80 cusel', :id => 'selSearch'
.leftside= submit_tag t("layout.search.header"), :class => 'button width100' .leftside= submit_tag t("layout.search.header"), :class => 'button width100'
.both .both

View File

@ -1,5 +1,7 @@
.left .left
= image_tag avatar_url(current_user, :big) = image_tag avatar_url(@user, :big)
%br
= link_to t("layout.users.edit"), edit_user_path(@user), :class => 'button width81' if can? :edit, @user
.left .left
%h3= @user.uname %h3= @user.uname
= @user.name = @user.name
@ -14,96 +16,5 @@
= link_to project.name, project = link_to project.name, project
%br %br
.left
%br
= link_to t("layout.users.edit"), edit_user_path(@user), :class => 'button' if can? :edit, @user
:javascript :javascript
$('article .all').addClass('verybigpadding'); $('article .all').addClass('verybigpadding');
-#.block
-# .secondary-navigation
-# %ul.wat-cf
-# %li.first= link_to t("layout.users.list"), users_path
-# %li= link_to t("layout.users.new"), new_user_path
-# %li.active= link_to t("layout.users.show"), user_path
-# .content
-# .inner
-# %p
-# %b
-# Id
-# \:
-# = @user.id
-# %p
-# %b
-# = t("activerecord.attributes.user.name")
-# \:
-# = @user.name
-# %p
-# %b
-# = t("activerecord.attributes.user.uname")
-# \:
-# = @user.uname
-# %p
-# %b
-# = t("activerecord.attributes.user.email")
-# \:
-# = @user.email
-# %p
-# %b
-# = t("activerecord.attributes.user.created_at")
-# \:
-# = @user.created_at
-# .wat-cf
-# - if can? :edit, @user
-# = link_to image_tag("code.png", :alt => t("layout.edit")) + " " + t("layout.edit"), edit_user_path(@user), :class => "button"
-# - if can? :destroy, @user
-# = link_to image_tag("x.png", :alt => t("layout.delete")) + " " + t("layout.delete"), user_path(@user), :method => "delete", :class => "button", :confirm => t("layout.users.confirm_delete")
-#
-#.block
-# .secondary-navigation
-# %ul.wat-cf
-# %li.first.active= link_to t("layout.platforms.list"), platforms_path
-# %li= link_to t("layout.platforms.new"), new_user_platform_path(@user)
-# .content
-# %h2.title
-# = t("layout.platforms.list_header")
-# .inner
-# = render :partial => 'shared/search_form'
-# = render :partial => 'platforms/list', :object => @platforms
-# .actions-bar.wat-cf
-# .actions
-# = will_paginate @platforms, :param_name => :platform_page
-#
-#-#.block
-# .secondary-navigation
-# %ul.wat-cf
-# %li.first.active= link_to t("layout.repositories.list"), repositories_path
-# %li= link_to t("layout.repositories.new"), new_user_repository_path(@user)
-# .content
-# %h2.title
-# = t("layout.repositories.list_header")
-# .inner
-# = render :partial => 'shared/search_form'
-# = render :partial => 'repositories/list', :object => @repositories
-# .actions-bar.wat-cf
-# .actions
-# = will_paginate @repositories, :param_name => :repository_page
-#
-#.block
-# .secondary-navigation
-# %ul.wat-cf
-# %li.first.active= link_to t("layout.projects.list"), projects_path
-# %li= link_to t("layout.projects.new"), new_project_path
-# .content
-# %h2.title
-# = t("layout.projects.list_header")
-# .inner
-# = render :partial => 'shared/search_form'
-# = render :partial => 'projects/list', :object => @projects
-# .actions-bar.wat-cf
-# .actions
-# = will_paginate @projects, :param_name => :project_page
-#
-#- content_for :sidebar, render('sidebar')

View File

@ -1,3 +1,9 @@
# -*- encoding : utf-8 -*- # -*- encoding : utf-8 -*-
require './lib/grit1' require './lib/grit1'
GAP_REPO_PATH = '/tmp/gap_repo.git'
unless File.directory? GAP_REPO_PATH
Grit::Repo.init_bare(GAP_REPO_PATH)
# FileUtils.chmod "a-w", GAP_REPO_PATH
end

View File

@ -13,3 +13,14 @@ Rosa::Application.config.middleware.insert_before ::Grack::Handler, ::Grack::Aut
# Grit::Git.git_timeout = 60 # Grit::Git.git_timeout = 60
Dir[Rails.root.join("lib/ext/**/*.rb")].each {|f| require f} Dir[Rails.root.join("lib/ext/**/*.rb")].each {|f| require f}
# add rpm spec as mime type for *.spec files
types = [
["text/x-python", ['py'], '8bit'],
["text/x-rpm-spec", ['spec'], '8bit'],
["text/x-csrc", ['h', 'c'], '8bit'],
["text/x-c++src", ['cpp'], '8bit']
]
types.each do |type|
MIME::Types.add MIME::Type.from_array(type)
end

View File

@ -3,6 +3,7 @@ en:
projects: projects:
add: Add add: Add
edit: Edit edit: Edit
fork_and_edit: Fork and Edit
list: List list: List
list_header: Projects list_header: Projects
edit_header: Edit the project edit_header: Edit the project
@ -11,8 +12,6 @@ en:
new_build: New build %{project_name} new_build: New build %{project_name}
confirm_delete: Are you sure to delete this project? confirm_delete: Are you sure to delete this project?
new: New project new: New project
new_header: New project
new_header: New project
location: Location location: Location
git_repo_location: Path to git repo git_repo_location: Path to git repo
current_project_header: Current project current_project_header: Current project
@ -23,6 +22,8 @@ en:
collaborators: Collaborators collaborators: Collaborators
groups: Groups groups: Groups
edit_collaborators: Edit collaborators edit_collaborators: Edit collaborators
role: Project role
remove_user: Leave project
issues: Issues issues: Issues
wiki: Wiki wiki: Wiki
delete_warning: Attention! Deleted project can not be restored! delete_warning: Attention! Deleted project can not be restored!
@ -51,6 +52,7 @@ en:
destroyed: Project deleted destroyed: Project deleted
forked: Project forked forked: Project forked
fork_error: Project fork error fork_error: Project fork error
user_removed: User successfully removed from project
activerecord: activerecord:
models: models:

View File

@ -3,6 +3,7 @@ ru:
projects: projects:
add: Добавить add: Добавить
edit: Редактировать edit: Редактировать
fork_and_edit: Клонировать и редактировать
list: Список list: Список
list_header: Проекты list_header: Проекты
edit_header: Редактировать проект edit_header: Редактировать проект
@ -11,8 +12,6 @@ ru:
new_build: Новая сборка %{project_name} new_build: Новая сборка %{project_name}
confirm_delete: Вы уверены, что хотите удалить этот проект? confirm_delete: Вы уверены, что хотите удалить этот проект?
new: Новый проект new: Новый проект
new_header: Новый проект
new_header: Новый проект
location: Расположение location: Расположение
git_repo_location: Путь к git-репозиторию git_repo_location: Путь к git-репозиторию
current_project_header: Текущий проект current_project_header: Текущий проект
@ -23,6 +22,8 @@ ru:
collaborators: Коллабораторы collaborators: Коллабораторы
groups: Группы groups: Группы
edit_collaborators: Изменить список участников edit_collaborators: Изменить список участников
role: Роль в проекте
remove_user: Покинуть проект
issues: Задачи issues: Задачи
wiki: Wiki wiki: Wiki
delete_warning: Внимание! Удаленный проект восстановлению не подлежит. delete_warning: Внимание! Удаленный проект восстановлению не подлежит.
@ -51,6 +52,7 @@ ru:
destroyed: Проект успешно удален destroyed: Проект успешно удален
forked: Проект успешно форкнут forked: Проект успешно форкнут
fork_error: Ошибка форка fork_error: Ошибка форка
user_removed: Пользователь успешно удален из проекта
activerecord: activerecord:
models: models:

View File

@ -3,6 +3,7 @@ Rosa::Application.routes.draw do
# XML RPC # XML RPC
match 'api/xmlrpc' => 'rpc#xe_index' match 'api/xmlrpc' => 'rpc#xe_index'
put '/users' => 'users#update'
devise_scope :user do devise_scope :user do
get '/users/auth/:provider' => 'users/omniauth_callbacks#passthru' get '/users/auth/:provider' => 'users/omniauth_callbacks#passthru'
end end
@ -126,7 +127,6 @@ Rosa::Application.routes.draw do
collection do collection do
post :create_label post :create_label
get :search_collaborators get :search_collaborators
get :search_labels
end end
end end
post "labels/:label_id" => "issues#destroy_label", :as => :issues_delete_label post "labels/:label_id" => "issues#destroy_label", :as => :issues_delete_label
@ -148,18 +148,13 @@ Rosa::Application.routes.draw do
post :update post :update
end end
end end
# resources :groups, :controller => 'project_groups' do
# end
collection do
get :auto_build
end
member do member do
post :fork post :fork
# get :new, :controller => 'projects', :action => 'new', :id => /new/, :as => :new
get :show, :controller => 'git/trees', :action => :show get :show, :controller => 'git/trees', :action => :show
get :sections get :sections
post :sections post :sections
delete :remove_user
end end
end end
@ -190,8 +185,6 @@ Rosa::Application.routes.draw do
resources :users, :groups do resources :users, :groups do
resources :platforms, :only => [:new, :create] resources :platforms, :only => [:new, :create]
resources :projects, :only => [:index]
# resources :repositories, :only => [:new, :create] # resources :repositories, :only => [:new, :create]
end end

View File

@ -23,8 +23,8 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
create_table "arches", :force => true do |t| create_table "arches", :force => true do |t|
t.string "name", :null => false t.string "name", :null => false
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
end end
add_index "arches", ["name"], :name => "index_arches_on_name", :unique => true add_index "arches", ["name"], :name => "index_arches_on_name", :unique => true
@ -33,8 +33,8 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.integer "user_id" t.integer "user_id"
t.string "provider" t.string "provider"
t.string "uid" t.string "uid"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
end end
add_index "authentications", ["provider", "uid"], :name => "index_authentications_on_provider_and_uid", :unique => true add_index "authentications", ["provider", "uid"], :name => "index_authentications_on_provider_and_uid", :unique => true
@ -45,8 +45,8 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.integer "arch_id" t.integer "arch_id"
t.integer "pl_id" t.integer "pl_id"
t.integer "bpl_id" t.integer "bpl_id"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
end end
create_table "build_list_items", :force => true do |t| create_table "build_list_items", :force => true do |t|
@ -54,8 +54,8 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.integer "level" t.integer "level"
t.integer "status" t.integer "status"
t.integer "build_list_id" t.integer "build_list_id"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
t.string "version" t.string "version"
end end
@ -69,8 +69,8 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.integer "project_id" t.integer "project_id"
t.integer "arch_id" t.integer "arch_id"
t.datetime "notified_at" t.datetime "notified_at"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
t.boolean "is_circle", :default => false t.boolean "is_circle", :default => false
t.text "additional_repos" t.text "additional_repos"
t.string "name" t.string "name"
@ -93,16 +93,16 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.string "name" t.string "name"
t.string "ancestry" t.string "ancestry"
t.integer "projects_count", :default => 0, :null => false t.integer "projects_count", :default => 0, :null => false
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
end end
create_table "comments", :force => true do |t| create_table "comments", :force => true do |t|
t.string "commentable_type" t.string "commentable_type"
t.integer "user_id" t.integer "user_id"
t.text "body" t.text "body"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
t.decimal "commentable_id", :precision => 50, :scale => 0 t.decimal "commentable_id", :precision => 50, :scale => 0
end end
@ -110,8 +110,8 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.string "name", :null => false t.string "name", :null => false
t.integer "project_id", :null => false t.integer "project_id", :null => false
t.integer "owner_id", :null => false t.integer "owner_id", :null => false
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
end end
create_table "delayed_jobs", :force => true do |t| create_table "delayed_jobs", :force => true do |t|
@ -123,8 +123,8 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.datetime "locked_at" t.datetime "locked_at"
t.datetime "failed_at" t.datetime "failed_at"
t.string "locked_by" t.string "locked_by"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
t.string "queue" t.string "queue"
end end
@ -136,8 +136,8 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.string "distro" t.string "distro"
t.string "platform" t.string "platform"
t.integer "counter", :default => 0 t.integer "counter", :default => 0
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
end end
create_table "event_logs", :force => true do |t| create_table "event_logs", :force => true do |t|
@ -152,14 +152,14 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.string "controller" t.string "controller"
t.string "action" t.string "action"
t.text "message" t.text "message"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
end end
create_table "groups", :force => true do |t| create_table "groups", :force => true do |t|
t.integer "owner_id" t.integer "owner_id"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
t.string "uname" t.string "uname"
t.integer "own_projects_count", :default => 0, :null => false t.integer "own_projects_count", :default => 0, :null => false
t.text "description" t.text "description"
@ -172,8 +172,8 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.string "title" t.string "title"
t.text "body" t.text "body"
t.string "status", :default => "open" t.string "status", :default => "open"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
t.integer "creator_id" t.integer "creator_id"
t.datetime "closed_at" t.datetime "closed_at"
t.integer "closed_by" t.integer "closed_by"
@ -204,8 +204,8 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.string "description" t.string "description"
t.string "name" t.string "name"
t.integer "parent_platform_id" t.integer "parent_platform_id"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
t.boolean "released", :default => false t.boolean "released", :default => false
t.integer "owner_id" t.integer "owner_id"
t.string "owner_type" t.string "owner_type"
@ -218,8 +218,8 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.integer "platform_id" t.integer "platform_id"
t.string "login" t.string "login"
t.string "password" t.string "password"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
t.integer "user_id" t.integer "user_id"
end end
@ -227,8 +227,8 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.integer "product_id" t.integer "product_id"
t.integer "status", :default => 2, :null => false t.integer "status", :default => 2, :null => false
t.datetime "notified_at" t.datetime "notified_at"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
end end
add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id" add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id"
@ -238,8 +238,8 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.integer "platform_id", :null => false t.integer "platform_id", :null => false
t.integer "build_status", :default => 2, :null => false t.integer "build_status", :default => 2, :null => false
t.string "build_path" t.string "build_path"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
t.text "build_script" t.text "build_script"
t.text "counter" t.text "counter"
t.text "ks" t.text "ks"
@ -259,8 +259,8 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.string "name" t.string "name"
t.string "version" t.string "version"
t.datetime "file_mtime" t.datetime "file_mtime"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
t.integer "platform_id" t.integer "platform_id"
end end
@ -269,14 +269,14 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
create_table "project_to_repositories", :force => true do |t| create_table "project_to_repositories", :force => true do |t|
t.integer "project_id" t.integer "project_id"
t.integer "repository_id" t.integer "repository_id"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
end end
create_table "projects", :force => true do |t| create_table "projects", :force => true do |t|
t.string "name" t.string "name"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
t.integer "owner_id" t.integer "owner_id"
t.string "owner_type" t.string "owner_type"
t.string "visibility", :default => "open" t.string "visibility", :default => "open"
@ -284,11 +284,11 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.text "description" t.text "description"
t.string "ancestry" t.string "ancestry"
t.boolean "has_issues", :default => true t.boolean "has_issues", :default => true
t.boolean "has_wiki", :default => false
t.string "srpm_file_name" t.string "srpm_file_name"
t.string "srpm_content_type" t.string "srpm_content_type"
t.integer "srpm_file_size" t.integer "srpm_file_size"
t.datetime "srpm_updated_at" t.datetime "srpm_updated_at"
t.boolean "has_wiki", :default => false
t.string "default_branch", :default => "master" t.string "default_branch", :default => "master"
t.boolean "is_rpm", :default => true t.boolean "is_rpm", :default => true
end end
@ -302,8 +302,8 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.string "token" t.string "token"
t.boolean "approved", :default => false t.boolean "approved", :default => false
t.boolean "rejected", :default => false t.boolean "rejected", :default => false
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
t.string "interest" t.string "interest"
t.text "more" t.text "more"
end end
@ -316,16 +316,16 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.string "object_type" t.string "object_type"
t.integer "target_id" t.integer "target_id"
t.string "target_type" t.string "target_type"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
t.string "role" t.string "role"
end end
create_table "repositories", :force => true do |t| create_table "repositories", :force => true do |t|
t.string "description", :null => false t.string "description", :null => false
t.integer "platform_id", :null => false t.integer "platform_id", :null => false
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
t.string "name", :null => false t.string "name", :null => false
end end
@ -333,8 +333,8 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.string "name", :null => false t.string "name", :null => false
t.integer "arch_id", :null => false t.integer "arch_id", :null => false
t.integer "project_id", :null => false t.integer "project_id", :null => false
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
end end
add_index "rpms", ["project_id", "arch_id"], :name => "index_rpms_on_project_id_and_arch_id" add_index "rpms", ["project_id", "arch_id"], :name => "index_rpms_on_project_id_and_arch_id"
@ -347,8 +347,8 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
t.boolean "new_comment_reply", :default => true t.boolean "new_comment_reply", :default => true
t.boolean "new_issue", :default => true t.boolean "new_issue", :default => true
t.boolean "issue_assign", :default => true t.boolean "issue_assign", :default => true
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
t.boolean "new_comment_commit_owner", :default => true t.boolean "new_comment_commit_owner", :default => true
t.boolean "new_comment_commit_repo_owner", :default => true t.boolean "new_comment_commit_repo_owner", :default => true
t.boolean "new_comment_commit_commentor", :default => true t.boolean "new_comment_commit_commentor", :default => true
@ -357,8 +357,8 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
create_table "subscribes", :force => true do |t| create_table "subscribes", :force => true do |t|
t.string "subscribeable_type" t.string "subscribeable_type"
t.integer "user_id" t.integer "user_id"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
t.boolean "status", :default => true t.boolean "status", :default => true
t.integer "project_id" t.integer "project_id"
t.decimal "subscribeable_id", :precision => 50, :scale => 0 t.decimal "subscribeable_id", :precision => 50, :scale => 0
@ -366,18 +366,18 @@ ActiveRecord::Schema.define(:version => 20120303171802) do
create_table "users", :force => true do |t| create_table "users", :force => true do |t|
t.string "name" t.string "name"
t.string "email", :default => "", :null => false t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false t.string "encrypted_password", :default => "", :null => false
t.string "reset_password_token" t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at" t.datetime "remember_created_at"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
t.text "ssh_key" t.text "ssh_key"
t.string "uname" t.string "uname"
t.string "role" t.string "role"
t.string "language", :default => "en" t.string "language", :default => "en"
t.datetime "reset_password_sent_at" t.integer "own_projects_count", :default => 0, :null => false
t.integer "own_projects_count", :default => 0, :null => false
t.text "professional_experience" t.text "professional_experience"
t.string "site" t.string "site"
t.string "company" t.string "company"

View File

@ -298,7 +298,7 @@ header div.droplist a:hover{
color: #575756; color: #575756;
text-decoration: none; text-decoration: none;
height: 34px; height: 34px;
padding: 0px 20px 6px 20px; padding: 0px 20px 8px 20px;
} }
.sub-menu nav ul li a.active { .sub-menu nav ul li a.active {
@ -651,6 +651,10 @@ article div.all.bigpadding div.rightside {
width: 70px; width: 70px;
} }
a.button.width81 {
width: 81px;
}
/* Footer */ /* Footer */
@ -1936,6 +1940,13 @@ img.delete-row {
cursor: pointer; cursor: pointer;
} }
table tbody tr.error td {
background: #e7bcbc;
}
table tbody tr.success td {
background: #e3edb7;
}
/* Create group */ /* Create group */
@ -2121,7 +2132,7 @@ div.pagination a {
/*404*/ /*404*/
article div.all.error404 { article div.all.error404 {
background: url("../pics/404.png") no-repeat 59% 0; background: url("../pics/404.png") no-repeat 49% 0;
height: 500px; height: 500px;
text-align: center; text-align: center;
} }
@ -2163,6 +2174,98 @@ article div.all.error404 p.search {
width: 230px; width: 230px;
} }
/*500*/
article div.all.error500 {
background: url("../pics/500.png") no-repeat 49% 0;
height: 500px;
text-align: center;
}
article div.all.error500 h1 {
margin: 0;
padding: 0;
margin-top: 135px;
font-size: 48px;
font-weight: normal;
}
article div.all.error500 h1 span {
color: #4496d0;
}
article div.all.error500 h2 {
margin: 0;
padding: 0;
margin-top: 5px;
font-size: 18px;
font-weight: normal;
text-align: left;
margin-left: 298px;
}
article div.all.error500 p {
margin: 0 auto;
padding: 0;
text-align: center;
font-size: 14px;
}
article div.all.error500 p.pages {
margin-top: 55px;
width: 280px;
}
article div.all.error500 p.search {
margin-top: 80px;
width: 230px;
}
/*503*/
article div.all.error503 {
background: url("../pics/503.png") no-repeat 50% 0;
height: 500px;
text-align: center;
}
article div.all.error503 h1 {
margin: 0;
padding: 0;
margin-top: 395px;
font-size: 38px;
font-weight: normal;
text-align: center;
}
article div.all.error503 h1 span {
color: #4496d0;
}
article div.all.error503 h2 {
margin: 0;
padding: 0;
margin-top: 25px;
font-size: 18px;
font-weight: normal;
text-align: left;
margin-left: 215px;
}
article div.all.error503 {
min-height: 630px;
}
article div.all.error503 h2 span {
color: #4496d0;
}
div.wrap.tmargin30 {
margin-top: 30px;
min-height: 91%;
}
/*search*/ /*search*/
input.button.width100 { input.button.width100 {

49
lib/grit/blob.rb Normal file
View File

@ -0,0 +1,49 @@
# -*- ruby encoding: utf-8 -*-
module Grit
class Blob
DEFAULT_RAW_MIME_TYPE = MIME::Types[DEFAULT_MIME_TYPE].first
delegate :binary?, :ascii?, :encoding, :to => :raw_mime_type
def mime_type_with_class_store
set_associated_mimes
@associated_mimes.first.simplified
end
alias_method_chain :mime_type, :class_store
attr_accessor :raw_mime_type
def raw_mime_type
set_associated_mimes
@raw_mime_type = @associated_mimes.first || DEFAULT_RAW_MIME_TYPE
@raw_mime_type
end
def raw_mime_types
set_associated_mimes
end
protected
# store all associated MIME::Types inside class
def set_associated_mimes
@associated_mimes ||= []
if @associated_mimes.empty?
guesses = MIME::Types.type_for(self.name) rescue [DEFAULT_RAW_MIME_TYPE]
guesses = [DEFAULT_RAW_MIME_TYPE] if guesses.empty?
@associated_mimes = guesses.sort{|a,b| mime_sort(a, b)}
end
@associated_mimes
end
# TODO make more clever function
def mime_sort(a,b)
return 0 if a.media_type == b.media_type and a.registered? == b.registered?
return -1 if a.media_type == 'text' and !a.registered?
return 1
end
end
end

View File

@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*- # -*- encoding : utf-8 -*-
require './lib/grit/repo.rb' require './lib/grit/repo.rb'
require './lib/grit/diff.rb' require './lib/grit/diff.rb'
require './lib/grit/blob.rb'

View File

@ -77,7 +77,7 @@ describe ProjectsController do
it_should_behave_like 'projects user with reader rights' it_should_behave_like 'projects user with reader rights'
it 'should be able to perform show action' do pending 'should be able to perform show action' do
get :show, :id => @project.id get :show, :id => @project.id
response.should render_template(:show) response.should render_template(:show)
end end
@ -103,7 +103,7 @@ describe ProjectsController do
set_session_for(@admin) set_session_for(@admin)
end end
it 'should return projects in right order' do pending 'should return projects in right order' do
get :index, :query => 'per' get :index, :query => 'per'
assigns(:projects).should eq([@project2, @project1]) assigns(:projects).should eq([@project2, @project1])
end end

View File

@ -84,7 +84,7 @@ table.tablesorter .th2 {
table.tablesorter .th3 { table.tablesorter .th3 {
width: 110px; width: 110px;
padding-left: 17px; // padding-left: 17px;
} }
table.tablesorter .td2 { table.tablesorter .td2 {