Write basic robots.txt. Apply configurable anonymous access, hide some functionality from guests. Apply basic design for main page. Autoconfirm manually created users. Code refactor and cleanup. Remove unused code, routes, containers, rpms, personal_repositories. Redo product_build_lists monitoring and filtering. Fix add_project to repo bug. Add links to bottom menu. Switch off deploy assets sppedup. Refs #349, #263

This commit is contained in:
Pavel Chipiga 2012-03-31 02:37:54 +03:00
parent 4ce18b017e
commit d6e6959f46
50 changed files with 405 additions and 537 deletions

View File

@ -721,3 +721,15 @@ div.toolbar div.legend.rights span.group,
div.toolbar div.legend.rights span.user {
margin: 0 10px;
}
.root {
width: 100%;
text-align: center;
margin-top: 150px;
input.query {
width: 80%;
border: 1px solid;
line-height: 20px;
font-size: 14px;
}
}

View File

@ -12,6 +12,7 @@ class Admin::UsersController < ApplicationController
def create
@user.role = params[:role]
@user.confirmed_at = Time.now.utc
if @user.save
flash[:notice] = t('flash.user.saved')
redirect_to users_path

View File

@ -30,8 +30,6 @@ class ApplicationController < ActionController::Base
end
def get_owner
# params['user_id'] && User.find_by_id(params['user_id']) ||
# params['group_id'] && Group.find_by_id(params['group_id']) || current_user
if self.class.method_defined? :parent
if parent and (parent.is_a? User or parent.is_a? Group)
return parent

View File

@ -5,6 +5,7 @@ class BuildListsController < ApplicationController
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']
before_filter :find_project, :only => NESTED_ACTIONS
before_filter :find_build_list, :only => [:show, :publish, :cancel]
before_filter :find_build_list_by_bs, :only => [:publish_build, :status_build, :pre_build, :post_build, :circle_build]

View File

@ -1,3 +0,0 @@
# -*- encoding : utf-8 -*-
class ContainersController < ApplicationController
end

View File

@ -13,10 +13,4 @@ class DownloadsController < ApplicationController
redirect_to downloads_path, :notice => t('flash.downloads.statistics_refreshed')
end
def test_sudo
system('sudo touch /home/rosa/test_sudo1.txt')
system('/usr/bin/sudo /bin/touch /home/rosa/test_sudo2.txt')
redirect_to downloads_path, :notice => 'Sudo tested!'
end
end

View File

@ -1,6 +1,7 @@
# -*- encoding : utf-8 -*-
class Git::BaseController < ApplicationController
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:show, :index, :blame, :raw] if APP_CONFIG['anonymous_access']
load_and_authorize_resource :project
before_filter :find_git_repository

View File

@ -2,7 +2,7 @@
class IssuesController < ApplicationController
NON_RESTFUL_ACTION = [:create_label, :update_label, :destroy_label, :search_collaborators]
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]
before_filter :load_and_authorize_label, :only => NON_RESTFUL_ACTION

View File

@ -0,0 +1,11 @@
# -*- encoding : utf-8 -*-
class PagesController < ApplicationController
# before_filter :authenticate_user!, :except => [:show, :main, :forbidden]
# load_and_authorize_resource
def root
end
def forbidden
end
end

View File

@ -1,59 +0,0 @@
# -*- encoding : utf-8 -*-
class PersonalRepositoriesController < ApplicationController
before_filter :authenticate_user!
before_filter :find_repository#, :only => [:show, :destroy, :add_project, :remove_project, :make_private, :settings]
before_filter :check_repository
load_and_authorize_resource :class => Repository
def show
if params[:query]
@projects = @repository.projects.recent.by_name("%#{params[:query]}%").paginate :page => params[:project_page], :per_page => 30
else
@projects = @repository.projects.recent.paginate :page => params[:project_page], :per_page => 30
end
@user = @repository.platform.owner
@urpmi_commands = @repository.platform.urpmi_list(request.host)
end
def change_visibility
@repository.platform.change_visibility
redirect_to settings_personal_repository_path(@repository)
end
def settings
end
def add_project
if params[:project_id]
@project = current_user.own_projects.find(params[:project_id])
unless @repository.projects.find_by_name(@project.name)
@repository.projects << @project
flash[:notice] = t('flash.repository.project_added')
else
flash[:error] = t('flash.repository.project_not_added')
end
redirect_to personal_repository_path(@repository)
else
@projects = current_user.own_projects.addable_to_repository(@repository.id).paginate(:page => params[:project_page])
render 'projects_list'
end
end
def remove_project
@project = current_user.own_projects.find(params[:project_id])
ProjectToRepository.where(:project_id => @project.id, :repository_id => @repository.id).destroy_all
redirect_to personal_repository_path(@repository), :notice => t('flash.repository.project_removed')
end
protected
def find_repository
@repository = Repository.find(params[:id])
end
def check_repository
redirect_to root_path if !@repository.platform.personal?
end
end

View File

@ -90,9 +90,6 @@ class PlatformsController < ApplicationController
redirect_to platforms_path
end
def forbidden
end
def members
@members = @platform.members.order('name')
end

View File

@ -1,6 +1,7 @@
# -*- encoding : utf-8 -*-
class ProductBuildListsController < ApplicationController
before_filter :authenticate_user!, :except => [:status_build]
skip_before_filter :authenticate_user!, :only => [:index] if APP_CONFIG['anonymous_access']
load_and_authorize_resource :platform, :only => [:create, :destroy]
load_and_authorize_resource :product, :through => :platform, :only => [:create, :destroy]
load_and_authorize_resource :product_build_list, :through => :product, :only => [:create, :destroy]
@ -21,31 +22,21 @@ class ProductBuildListsController < ApplicationController
@product_build_list.save!
render :nothing => true
end
def destroy
@product_build_list.destroy
flash[:notice] = t('flash.product.build_list_delete')
redirect_to [@platform, @product]
end
# def index
# @product_build_lists = ProductBuildList.paginate :page => params[:page]
# end
def search
new_params = {:filter => {}}
params[:filter].each do |k,v|
new_params[:filter][k] = v unless v.empty?
end
#redirect_to @product ? product_build_lists_path(@product, new_params) : product_build_lists_path(new_params)
redirect_to product_build_lists_path(new_params)
end
def index
#@action_url = @product ? search_product_build_lists_path(@product) : search_build_lists_path
@action_url = search_product_build_lists_path
@filter = ProductBuildList::Filter.new(@product, current_user, params[:filter] || {})
@product_build_lists = @filter.find.recent.paginate :page => params[:page]
if params[:product_id].present?
@product_build_lists = @product_build_lists.where(:id => params[:product_id])
else
@product_build_lists = @product_build_lists.scoped_to_product_name(params[:product_name]) if params[:product_name].present?
@product_build_lists = @product_build_lists.for_status(params[:status]) if params[:status].present?
end
@product_build_lists = @product_build_lists.recent.paginate :page => params[:page]
end
protected

View File

@ -51,10 +51,10 @@ class RepositoriesController < ApplicationController
def add_project
if params[:project_id]
@project = Project.find(params[:project_id])
unless @repository.projects.find_by_name(@project.name)
begin
@repository.projects << @project
flash[:notice] = t('flash.repository.project_added')
else
rescue ActiveRecord::RecordInvalid
flash[:error] = t('flash.repository.project_not_added')
end
redirect_to platform_repository_path(@platform, @repository)

View File

@ -1,6 +1,6 @@
# -*- encoding : utf-8 -*-
class SearchController < ApplicationController
before_filter :authenticate_user!
before_filter :authenticate_user! unless APP_CONFIG['anonymous_access']
# load_and_authorize_resource
def index

View File

@ -6,6 +6,7 @@ class WikiController < ApplicationController
WIKI_OPTIONS = {}
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:show, :index, :git, :compare, :compare_wiki, :history, :wiki_history, :search, :pages] if APP_CONFIG['anonymous_access']
load_resource :project
before_filter :authorize_read_actions, :only => [:index, :show, :git, :compare, :compare_wiki, :history, :wiki_history, :search, :pages]
@ -278,7 +279,7 @@ class WikiController < ApplicationController
end
def authorize_read_actions
authorize! :read, @project
authorize! :show, @project
end
def authorize_write_actions

View File

@ -13,7 +13,12 @@ class Ability
@user = user
# Shared rights between guests and registered users
can :forbidden, Platform
can :show, Project, :visibility => 'open'
can :read, Issue, :project => {:visibility => 'open'}
can :search, BuildList
can :read, BuildList, :project => {:visibility => 'open'}
can :read, ProductBuildList, :product => {:platform => {:visibility => 'open'}}
# Core callbacks
can [:publish_build, :status_build, :pre_build, :post_build, :circle_build, :new_bbdt], BuildList
if user.guest? # Guest rights
@ -55,9 +60,7 @@ class Ability
can(:destroy, Project) {|project| owner? project}
can :remove_user, Project
can :search, BuildList
can [:read, :owned], BuildList, :user_id => user.id
can :read, BuildList, :project => {:visibility => 'open'}
can [:read, :related], BuildList, :project => {:owner_type => 'User', :owner_id => user.id}
can [:read, :related], BuildList, :project => {:owner_type => 'Group', :owner_id => user.group_ids}
can(:read, BuildList, read_relations_for('build_lists', 'projects')) {|build_list| can? :read, build_list.project}
@ -80,7 +83,7 @@ class Ability
can([:create, :update, :projects_list, :add_project, :remove_project], Repository) {|repository| local_admin? repository.platform}
can([:change_visibility, :settings, :destroy], Repository) {|repository| owner? repository.platform}
can :read, Product, :platform => {:platform_type => 'main'}
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.platform_type == 'main'}
@ -88,13 +91,10 @@ class Ability
can(:create, ProductBuildList) {|pbl| can?(:update, pbl.product)}
can(:destroy, ProductBuildList) {|pbl| can?(:destroy, pbl.product)}
can(:read, ProductBuildList) {|pbl| can?(:read, pbl.product)}
can [:read, :create], PrivateUser, :platform => {:owner_type => 'User', :owner_id => user.id}
can [:read, :create], PrivateUser, :platform => {:owner_type => 'Group', :owner_id => user.group_ids}
# can :read, Issue, :status => 'open'
can :read, Issue, :project => {:visibility => 'open'}
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}

View File

@ -56,7 +56,7 @@ class BuildList::Filter
:project_name => nil
}))
@options[:ownership] = @options[:ownership].presence || (@project ? 'index' : 'owned')
@options[:ownership] = @options[:ownership].presence || (@project || !@user ? 'index' : 'owned')
@options[:status] = @options[:status].present? ? @options[:status].to_i : nil
@options[:created_at_start] = build_date_from_params(:created_at_start, @options)
@options[:created_at_end] = build_date_from_params(:created_at_end, @options)

View File

@ -1,7 +0,0 @@
# -*- encoding : utf-8 -*-
class Container < ActiveRecord::Base
belongs_to :project
belongs_to :owner, :class_name => 'User', :foreign_key => 'owner_id'
validates :name, :project_id, :onwer_id, :presence => true
end

View File

@ -34,10 +34,6 @@ class ProductBuildList < ActiveRecord::Base
"/downloads/#{product.platform.name}/product/#{id}/"
end
# def human_status
# I18n.t("layout.product_build_lists.statuses.#{status}")
# end
def event_log_message
{:product => product.name}.inspect
end
@ -60,7 +56,7 @@ class ProductBuildList < ActiveRecord::Base
raise "Failed to create product_build_list #{id} inside platform #{platform.name} tar url #{tar_url} with code #{result}."
end
end
def xml_delete_iso_container
result = ProductBuilder.delete_iso_container self
if result == ProductBuilder::SUCCESS
@ -69,5 +65,4 @@ class ProductBuildList < ActiveRecord::Base
raise "Failed to destroy product_build_list #{id} inside platform #{platform.name} with code #{result}."
end
end
end

View File

@ -1,57 +0,0 @@
# -*- encoding : utf-8 -*-
class ProductBuildList::Filter
def initialize(product, user, options = {})
@product = product
@user = user
set_options(options)
end
def find
product_build_lists = @product ? @product.product_build_lists : ProductBuildList.scoped
if @options[:id]
product_build_lists = product_build_lists.where(:id => @options[:id])
else
product_build_lists = product_build_lists.accessible_by(::Ability.new(@user), @options[:ownership].to_sym) if @options[:ownership]
product_build_lists = product_build_lists.for_status(@options[:status]) if @options[:status]
product_build_lists = product_build_lists.scoped_to_product_name(@options[:product_name]) if @options[:product_name]
end
product_build_lists
end
def respond_to?(name)
return true if @options.has_key?(name)
super
end
def method_missing(name, *args, &block)
@options.has_key?(name) ? @options[name] : super
end
private
def set_options(options)
@options = HashWithIndifferentAccess.new(options.reverse_merge({
:ownership => nil,
:status => nil,
:id => nil,
:product_name => nil
}))
@options[:ownership] = @options[:ownership].presence || (@product ? 'index' : 'owned')
@options[:status] = @options[:status].present? ? @options[:status].to_i : nil
@options[:id] = @options[:id].presence
@options[:product_name] = @options[:product_name].presence
end
#def build_date_from_params(field_name, params)
# if params["#{field_name}(1i)"].present? || params["#{field_name}(2i)"].present? || params["#{field_name}(3i)"].present?
# Date.civil((params["#{field_name}(1i)"].presence || Date.today.year).to_i,
# (params["#{field_name}(2i)"].presence || Date.today.month).to_i,
# (params["#{field_name}(3i)"].presence || Date.today.day).to_i)
# else
# nil
# end
#end
end

View File

@ -1,7 +0,0 @@
# -*- encoding : utf-8 -*-
class Rpm < ActiveRecord::Base
belongs_to :arch
belongs_to :project
validates :name, :arch_id, :project_id, :presence => true
end

View File

@ -18,23 +18,24 @@
= 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|
.bordered.nopadding
%h3= t("layout.build_lists.ownership.header")
.table
.lefter= f.radio_button :ownership, 'owned', :class => 'niceRadio', :id => 'myradio1'
.lefter= t("layout.build_lists.ownership.owned")
.both
- unless @project
- if current_user
.bordered.nopadding
%h3= t("layout.build_lists.ownership.header")
.table
.lefter= f.radio_button :ownership, 'related', :class => 'niceRadio', :id => 'myradio2'
.lefter= t("layout.build_lists.ownership.related")
.lefter= f.radio_button :ownership, 'owned', :class => 'niceRadio', :id => 'myradio1'
.lefter= t("layout.build_lists.ownership.owned")
.both
.table
.lefter= f.radio_button :ownership, 'index', :class => 'niceRadio', :id => 'myradio3'
.lefter= t("layout.build_lists.ownership.index")
.both
%br
= f.submit t("layout.search.header")
- unless @project
.table
.lefter= f.radio_button :ownership, 'related', :class => 'niceRadio', :id => 'myradio2'
.lefter= t("layout.build_lists.ownership.related")
.both
.table
.lefter= f.radio_button :ownership, 'index', :class => 'niceRadio', :id => 'myradio3'
.lefter= t("layout.build_lists.ownership.index")
.both
%br
= f.submit t("layout.search.header")
.block
%h3.small= t("activerecord.attributes.build_list.status")
.lineForm.aside= f.select :status, BuildList::STATUSES.collect{|status| [BuildList.human_status(status), status]}, {:include_blank => true, :selected => @filter.status}, {:class => 'sel80 aside', :id => 'status', :tabindex => 2}

View File

@ -17,4 +17,4 @@
= render :partial => 'show'
= render :partial => "comments/list", :locals => {:list => Project.commit_comments(@commit, @project), :project => @project, :commentable => @commit}
= render :partial => "comments/add", :locals => {:project => @project, :commentable => @commit}
= render :partial => "comments/add", :locals => {:project => @project, :commentable => @commit} if current_user

View File

@ -1,16 +1,17 @@
-content_for :sidebar do
=form_tag project_issues_path(@project), :id => 'filter_issues', :method => :get do
.bordered.nopadding
%h3=t("layout.issues.accessory")
%table
%tr
%td.width18=radio_button_tag :myradio, 'all', !@is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'}
%td.width135=t("layout.issues.all")
%td.width30.right=@project.issues.count
%tr
%td=radio_button_tag :myradio, 'to_me', @is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'}
%td=t("layout.issues.to_me")
%td.width30.right=@project.issues.where(:user_id => current_user).count
- if current_user
=form_tag project_issues_path(@project), :id => 'filter_issues', :method => :get do
.bordered.nopadding
%h3=t("layout.issues.accessory")
%table
%tr
%td.width18=radio_button_tag :myradio, 'all', !@is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'}
%td.width135=t("layout.issues.all")
%td.width30.right=@project.issues.count
%tr
%td=radio_button_tag :myradio, 'to_me', @is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'}
%td=t("layout.issues.to_me")
%td.width30.right=@project.issues.where(:user_id => current_user).count
=form_tag project_issues_path(@project), :id => 'search_issue', :method => :get do
.bordered.bpadding20
=tracker_search_field(:search_issue, t('layout.issues.search'))

View File

@ -32,4 +32,4 @@
= render :partial => "comments/list", :locals => {:list => @issue.comments, :project => @project, :commentable => @issue}
%br
= render :partial => "comments/add", :locals => {:project => @project, :commentable => @issue}
= render :partial => "comments/add", :locals => {:project => @project, :commentable => @issue} if current_user

View File

@ -7,13 +7,10 @@
= image_tag 'flag.png', :alt => 'flag'
%li
= image_tag 'square.png'
= link_to t('bottom_menu.about'), '#'
= link_to t('bottom_menu.about'), t('bottom_menu.about_url')
%li
= image_tag 'square.png'
= link_to t('bottom_menu.contacts'), '#'
= link_to t('bottom_menu.contacts'), t('bottom_menu.contacts_url')
%li
= image_tag 'square.png'
= link_to t('bottom_menu.tos'), '#'
%li
= image_tag 'square.png'
= link_to t('bottom_menu.security'), '#'
= link_to t('bottom_menu.tos'), t('bottom_menu.tos_url')

View File

@ -2,5 +2,5 @@
- (collection = t which_menu).each do |base, title|
- if can? :index, base.to_s.classify.constantize
%li= link_to title, send(:"#{base}_path"), :class => controller_name == base.to_s ? 'active' : ''
- if current_user.admin? && which_menu == 'top_menu'
- if current_user.try(:admin?) and which_menu == 'top_menu'
%li= link_to t('admins_menu_header'), users_path, :class => t('admins_menu').has_key?(controller_name.to_sym) ? 'active' : ''

View File

@ -0,0 +1,4 @@
.root
= form_tag search_index_path, :method => 'get' do
= text_field_tag 'query', params[:query], :placeholder => t("layout.search.header"), :class => 'query'
= submit_tag t("layout.search.header")

View File

@ -1,11 +0,0 @@
%table.table
%tr
%th.first= t("activerecord.attributes.project.name")
%th.last &nbsp;
- @projects.each do |project|
%tr{:class => cycle("odd", "even")}
%td
= link_to project.owner.name + '/' + project.name, project_path(project)
%td.last
#{link_to t("layout.show"), project_path(project)} | #{link_to t("layout.add"), url_for(:controller => :personal_repositories, :action => :add_project, :project_id => project.id)}

View File

@ -1,11 +0,0 @@
%table.table
%tr
%th.first= t("activerecord.attributes.project.name")
%th.last &nbsp;
- @projects.each do |project|
%tr{:class => cycle("odd", "even")}
%td= link_to project.name, project_path(project)
%td.last
= link_to t("layout.show"), project_path(project)
\|
= link_to t("layout.delete"), url_for(:action => :remove_project, :project_id => project.id), :confirm => t("layout.projects.confirm_delete")

View File

@ -1,49 +0,0 @@
.block
.secondary-navigation
%ul.wat-cf
%li.first.active= link_to t("layout.personal_repositories.show"), personal_repository_path(@repository)
%li= link_to t("layout.personal_repositories.settings"), settings_personal_repository_path(@repository)
.content
.inner
%p
%b
= t("activerecord.attributes.repository.name")
\:
= @repository.name
%p
%b
= t("activerecord.attributes.repository.description")
\:
= @repository.description
%p
%b
= t("activerecord.attributes.repository.platform")
\:
= link_to @repository.platform.name, url_for(@repository.platform)
%p
%b
= t("activerecord.attributes.platform.visibility")
\:
= @repository.platform.visibility
.wat-cf
= link_to image_tag("x.png", :alt => t("layout.delete")) + " " + t("layout.delete"), @repository_path, :method => "delete", :class => "button", :confirm => t("layout.repositories.confirm_delete")
%a{ :name => "projects" }
.block
.secondary-navigation
%ul.wat-cf
%li.first= link_to t("layout.projects.list"), personal_repository_path(@repository) + "#projects"
%li.active= link_to t("layout.projects.add"), add_project_personal_repository_path(@repository)
.content
%h2.title
= t("layout.projects.list_header")
.inner
= render :partial => 'shared/search_form'
= render :partial => 'proj_list', :object => @projects
.actions-bar.wat-cf
.actions
= will_paginate @projects, :param_name => :project_page
-# content_for :sidebar, render(:partial => 'sidebar')

View File

@ -1,18 +0,0 @@
-set_meta_tags :title => [title_object(@repository), t('layout.personal_repositories.settings')]
.block
.secondary-navigation
%ul.wat-cf
%li.first= link_to t("layout.personal_repositories.show"), personal_repository_path(@repository)
%li.active= link_to t("layout.personal_repositories.settings"), settings_personal_repository_path(@repository)
%li= link_to t("layout.personal_repositories.private_users"), platform_private_users_path(@repository.platform) if @repository.platform.hidden?
.content
%h2.title= t("layout.personal_repositories.settings_header")
.inner
.group
%span= t("activerecord.attributes.platform.visibility") + ":"
%span
%i= t("activerecord.attributes.platform.visibility_types.#{ @repository.platform.visibility }")
.group
= link_to t("layout.personal_repositories.change_visibility_from_#{ @repository.platform.visibility }"), change_visibility_personal_repository_path(@repository)
-# content_for :sidebar, render(:partial => 'sidebar')

View File

@ -1,32 +0,0 @@
-set_meta_tags :title => [title_object(@repository), t('activerecord.models.repository')]
.block
.secondary-navigation
%ul.wat-cf
%li.first.active= link_to t("layout.personal_repositories.show"), personal_repository_path(@repository)
%li= link_to t("layout.personal_repositories.settings"), settings_personal_repository_path(@repository)
%li= link_to t("layout.personal_repositories.private_users"), platform_private_users_path(@repository.platform) if @repository.platform.hidden?
.content
.inner
= render 'shared/urpmi_list', :urpmi_commands => @urpmi_commands
.wat-cf
=# link_to image_tag("x.png", :alt => t("layout.delete")) + " " + t("layout.delete"), @repository_path, :method => "delete", :class => "button", :confirm => t("layout.repositories.confirm_delete")
%a{ :name => "projects" }
.block
.secondary-navigation
%ul.wat-cf
%li.first.active= link_to t("layout.projects.list"), personal_repository_path(@repository) + "#projects"
%li= link_to t("layout.projects.add"), add_project_personal_repository_path(@repository)
%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 => 'proj_list1', :object => @projects
.actions-bar.wat-cf
.actions
= will_paginate @projects, :param_name => :project_page
- content_for :sidebar, render(:partial => 'shared/user_groups_sidebar')

View File

@ -1,29 +1,12 @@
- content_for :sidebar do
= form_for :filter, :url => @action_url, :html => { :method => :post, :class => :form } do |f|
.bordered.nopadding
%h3= t("layout.product_build_lists.ownership.header")
.table
.lefter= f.radio_button :ownership, 'owned', :class => 'niceRadio', :id => 'myradio1'
.lefter= t("layout.product_build_lists.ownership.owned")
.both
- unless @product
.table
.lefter= f.radio_button :ownership, 'related', :class => 'niceRadio', :id => 'myradio2'
.lefter= t("layout.product_build_lists.ownership.related")
.both
.table
.lefter= f.radio_button :ownership, 'index', :class => 'niceRadio', :id => 'myradio3'
.lefter= t("layout.product_build_lists.ownership.index")
.both
%br
= f.submit t("layout.search.header")
= form_tag product_build_lists_path, :method => :get, :html => {:class => :form} do
.block
%h3.small= t("activerecord.attributes.product_build_list.status")
.lineForm.aside= f.select :status, ProductBuildList::STATUSES.collect{|status| [ProductBuildList.human_status(status), status]}, {:include_blank => true, :selected => @filter.status}, {:class => 'sel80 aside', :id => 'status', :tabindex => 2}
.lineForm.aside= select_tag :status, options_for_select(ProductBuildList::STATUSES.map{|s| [ProductBuildList.human_status(s), s]}, params[:status]), {:include_blank => true, :class => 'sel80 aside'}
%h3.small= t("layout.product_build_lists.product_name_search")
= f.text_field :product_name
= text_field_tag :product_name, params[:product_name]
%h3.small= t("layout.product_build_lists.id_search")
= f.text_field :id
= text_field_tag :product_id, params[:product_id]
%br
%br
= f.submit t("layout.search.header")
= submit_tag t("layout.search.header")

View File

@ -6,5 +6,5 @@
%td.td2
%span= project.description
%td.buttons
= link_to remove_project_repository_path(@repository, :project_id => project.id), :method => :delete, :confirm => t("layout.confirm") do
= link_to remove_project_platform_repository_path(@platform, @repository, :project_id => project.id), :method => :delete, :confirm => t("layout.confirm") do
%span.delete &nbsp;

View File

@ -17,7 +17,7 @@
"<%=
if can? :remove_project, @repository
j(link_to('<span class="delete">&nbsp;</span>'.html_safe,
remove_project_repository_path(@repository, :project_id => project.id),
remove_project_platform_repository_path(@platform, @repository, :project_id => project.id),
:method => :delete, :confirm => t("layout.confirm")
)
)

View File

@ -10,7 +10,7 @@
%br
%h3.fix= t("layout.projects.list_header")
- if can? :add_project, @repository
= link_to t("layout.projects.add"), add_project_repository_path(@repository), :class => 'button'
= link_to t("layout.projects.add"), add_project_platform_repository_path(@platform, @repository), :class => 'button'
= render :partial => 'proj_list'#, :object => @projects
=# will_paginate @projects

View File

@ -68,17 +68,16 @@ namespace :deploy do
end
# Speed up precompile (http://www.bencurtis.com/2011/12/skipping-asset-compilation-with-capistrano )
namespace :assets do
task :precompile, :roles => :web, :except => { :no_release => true } do
from = source.next_revision(current_revision)
if capture("cd #{latest_release} && #{source.local.log(from)} app/assets/ lib/assets/ vendor/assets/ | wc -l").to_i > 0
run "cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile"
else
logger.info "Skipping asset pre-compilation because there were no asset changes"
end
end
end
# namespace :assets do
# task :precompile, :roles => :web, :except => { :no_release => true } do
# from = source.next_revision(current_revision)
# if capture("cd #{latest_release} && #{source.local.log(from)} app/assets/ lib/assets/ vendor/assets/ | wc -l").to_i > 0
# run "cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile"
# else
# logger.info "Skipping asset pre-compilation because there were no asset changes"
# end
# end
# end
end
after "deploy:finalize_update", "deploy:symlink_all"

View File

@ -170,8 +170,6 @@ en:
models:
arch: Arch
container: Container
rpm: RPM
private_user: Private user
product_build_list: Product build list
download: Statistics
@ -197,24 +195,6 @@ en:
created_at: Created
updated_at: Updated
container:
name: Name
project_id: Project
project: Project
owner_id: Owner
owner: Owner
created_at: Created
updated_at: Updated
rpm:
name: Name
arch_id: Arch
arch: Arch
project_id: Project
project: Project
created_at: Created
updated_at: Updated
download:
name: Name
version: Version

View File

@ -12,9 +12,11 @@ en:
bottom_menu:
copyright: ROSA Lab © 2012
about: About the company
about_url: http://www.rosalab.com/about
contacts: Contacts
contacts_url: http://www.rosalab.com/about/contacts
tos: Terms Of Service
security: Security
tos_url: http://www.rosalab.com/about
project_menu:
project: Project
commits: Commits

View File

@ -12,9 +12,11 @@ ru:
bottom_menu:
copyright: ROSA Лаб. © 2012
about: О компании
about_url: http://www.rosalab.ru/about
contacts: Контакты
contacts_url: http://www.rosalab.ru/about/contacts
tos: Условия использования
security: Безопасность
tos_url: http://www.rosalab.ru/about
project_menu:
project: Проект
commits: Коммиты

View File

@ -3,7 +3,7 @@ en:
projects:
add: Add
edit: Settings
fork_and_edit: Fork and Edit
fork_and_edit: Fork
list: List
list_header: Projects
edit_header: Edit project

View File

@ -3,7 +3,7 @@ ru:
projects:
add: Добавить
edit: Настройки
fork_and_edit: Клонировать и редактировать
fork_and_edit: Клонировать
list: Список
list_header: Проекты
edit_header: Редактировать проект

View File

@ -170,8 +170,6 @@ ru:
models:
arch: Arch
container: Container
rpm: RPM
private_user: Приватный пользователь
product_build_list: Сборочный лист продукта
download: Статистика
@ -198,24 +196,6 @@ ru:
created_at: Создана
updated_at: Обновлена
container:
name: Название
project_id: Проект
project: Проект
owner_id: Владелец
owner: Владелец
created_at: Создан
updated_at: Обновлен
rpm:
name: Название
arch_id: Arch
arch: Arch
project_id: Проект
project: Проект
created_at: Создан
updated_at: Обновлен
download:
name: Название
version: Версия

View File

@ -1,6 +1,5 @@
# -*- encoding : utf-8 -*-
Rosa::Application.routes.draw do
devise_scope :user do
get '/users/auth/:provider' => 'users/omniauth_callbacks#passthru'
get '/user' => 'users#profile', :as => :edit_profile
@ -14,9 +13,7 @@ Rosa::Application.routes.draw do
delete '/users/:id/delete' => 'admin/users#destroy', :as => :delete_user
end
devise_for :users, :controllers => {:omniauth_callbacks => 'users/omniauth_callbacks'}
resources :users, :only => [:show, :profile, :update] do
resources :groups, :only => [:new, :create, :index]
collection do
resources :register_requests, :only => [:index, :new, :create, :show_message, :approve, :reject] do
get :show_message, :on => :collection
@ -26,54 +23,31 @@ Rosa::Application.routes.draw do
end
get :autocomplete_user_uname
end
namespace :settings do
resource :notifier, :only => [:show, :update]
end
resources :platforms, :only => [:new, :create]
end
match 'users/:id/settings/private' => 'users#private', :as => :user_private_settings, :via => :get
match 'users/:id/settings/private' => 'users#private', :as => :user_private_settings, :via => :put
get 'users/:id/settings/private' => 'users#private', :as => :user_private_settings
get 'users/:id/settings/private' => 'users#private', :as => :user_private_settings
resources :event_logs, :only => :index
#resources :downloads, :only => :index
match 'statistics/' => 'downloads#index', :as => :downloads
match 'statistics/refresh' => 'downloads#refresh', :as => :downloads_refresh
match 'statistics/test_sudo' => 'downloads#test_sudo', :as => :test_sudo_downloads
match '/private/:platform_name/*file_path' => 'privates#show'
match 'build_lists/publish_build', :to => "build_lists#publish_build"
match 'build_lists/status_build', :to => "build_lists#status_build"
match 'build_lists/post_build', :to => "build_lists#post_build"
match 'build_lists/pre_build', :to => "build_lists#pre_build"
match 'build_lists/circle_build', :to => "build_lists#circle_build"
match 'build_lists/new_bbdt', :to => "build_lists#new_bbdt"
resources :build_lists, :only => [:index, :show] do
member do
put :cancel
put :publish
end
collection { post :search }
end
resources :product_build_lists, :only => [:index] do
collection { post :search }
end
resources :personal_repositories, :only => [:show] do
member do
get :settings
get :change_visibility
get :add_project
get :remove_project
resources :groups do
get :autocomplete_group_uname, :on => :collection
resources :members, :only => [:index, :edit, :update, :add] do
collection do
get :edit
post :add
post :update
delete :remove
end
member do
post :update
delete :remove
end
end
end
resources :platforms do
resources :private_users, :except => [:show, :destroy, :update]
member do
get :clone
get :members
@ -83,21 +57,21 @@ Rosa::Application.routes.draw do
post :make_clone
post :build_all
end
collection do
get :autocomplete_user_uname
end
resources :repositories do
member do
get :add_project
delete :remove_project
get :projects_list
end
end
resources :products do
# member do
# get :clone
# get :build
# end
resources :product_build_lists, :only => [:create, :destroy]
end
resources :repositories
end
match '/private/:platform_name/*file_path' => 'privates#show'
resources :projects, :except => [:show] do
resources :wiki do
@ -133,11 +107,9 @@ Rosa::Application.routes.draw do
end
post "labels/:label_id" => "issues#destroy_label", :as => :issues_delete_label
post "labels/:label_id/update" => "issues#update_label", :as => :issues_update_label
resources :build_lists, :only => [:index, :new, :create] do
collection { post :search }
end
resources :collaborators, :only => [:index, :edit, :update, :add] do
collection do
get :edit
@ -149,7 +121,6 @@ Rosa::Application.routes.draw do
post :update
end
end
member do
post :fork
get :sections
@ -157,43 +128,6 @@ Rosa::Application.routes.draw do
delete :remove_user
end
end
resources :repositories do
member do
get :add_project
delete :remove_project
get :projects_list
end
end
resources :groups do
get :autocomplete_group_uname, :on => :collection
resources :members, :only => [:index, :edit, :update, :add] do
collection do
get :edit
post :add
post :update
delete :remove
end
member do
post :update
delete :remove
end
end
resources :platforms, :only => [:new, :create]
end
# resources :users, :groups do
# resources :platforms, :only => [:new, :create]
# resources :repositories, :only => [:new, :create]
# end
resources :activity_feeds, :only => [:index]
resources :search, :only => [:index]
match 'product_status', :to => 'product_build_lists#status_build'
# Tree
get '/projects/:project_id' => "git/trees#show", :as => :project
get '/projects/:project_id/tree/:treeish(/*path)' => "git/trees#show", :defaults => {:treeish => :master}, :as => :tree
@ -218,6 +152,39 @@ Rosa::Application.routes.draw do
# Raw
get '/projects/:project_id/raw/:treeish/*path' => "git/blobs#raw", :defaults => {:treeish => :master}, :as => :raw, :format => false
root :to => "activity_feeds#index"
match '/forbidden', :to => 'platforms#forbidden', :as => 'forbidden'
# Core callbacks
match 'build_lists/publish_build', :to => "build_lists#publish_build"
match 'build_lists/status_build', :to => "build_lists#status_build"
match 'build_lists/post_build', :to => "build_lists#post_build"
match 'build_lists/pre_build', :to => "build_lists#pre_build"
match 'build_lists/circle_build', :to => "build_lists#circle_build"
match 'build_lists/new_bbdt', :to => "build_lists#new_bbdt"
match 'product_status', :to => 'product_build_lists#status_build'
resources :build_lists, :only => [:index, :show] do
member do
put :cancel
put :publish
end
collection { post :search }
end
resources :product_build_lists, :only => [:index]
resources :search, :only => [:index]
resources :event_logs, :only => :index
match 'statistics/' => 'downloads#index', :as => :downloads
match 'statistics/refresh' => 'downloads#refresh', :as => :downloads_refresh
match '/forbidden', :to => 'pages#forbidden', :as => 'forbidden'
if APP_CONFIG['anonymous_access']
authenticated do
root :to => "activity_feeds#index"
end
root :to => 'pages#root'
else
root :to => "activity_feeds#index"
end
end

View File

@ -0,0 +1,26 @@
class RemoveContainersAndRpms < ActiveRecord::Migration
def up
drop_table :containers
drop_table :rpms
end
def down
create_table "containers" do |t|
t.string "name", :null => false
t.integer "project_id", :null => false
t.integer "owner_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "rpms" do |t|
t.string "name", :null => false
t.integer "arch_id", :null => false
t.integer "project_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "rpms", ["project_id", "arch_id"], :name => "index_rpms_on_project_id_and_arch_id"
add_index "rpms", ["project_id"], :name => "index_rpms_on_project_id"
end
end

View File

@ -11,14 +11,14 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20120329182602) do
ActiveRecord::Schema.define(:version => 20120330201229) do
create_table "activity_feeds", :force => true do |t|
t.integer "user_id", :null => false
t.string "kind"
t.text "data"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "arches", :force => true do |t|
@ -91,14 +91,6 @@ ActiveRecord::Schema.define(:version => 20120329182602) do
t.integer "project_id"
end
create_table "containers", :force => true do |t|
t.string "name", :null => false
t.integer "project_id", :null => false
t.integer "owner_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "delayed_jobs", :force => true do |t|
t.integer "priority", :default => 0
t.integer "attempts", :default => 0
@ -312,17 +304,6 @@ ActiveRecord::Schema.define(:version => 20120329182602) do
t.string "name", :null => false
end
create_table "rpms", :force => true do |t|
t.string "name", :null => false
t.integer "arch_id", :null => false
t.integer "project_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "rpms", ["project_id", "arch_id"], :name => "index_rpms_on_project_id_and_arch_id"
add_index "rpms", ["project_id"], :name => "index_rpms_on_project_id"
create_table "settings_notifiers", :force => true do |t|
t.integer "user_id", :null => false
t.boolean "can_notify", :default => true
@ -351,16 +332,16 @@ ActiveRecord::Schema.define(:version => 20120329182602) do
t.string "name"
t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "password_salt", :default => "", :null => false
t.string "reset_password_token"
t.datetime "remember_created_at"
t.datetime "created_at"
t.datetime "updated_at"
t.text "ssh_key"
t.string "uname"
t.string "role"
t.string "language", :default => "en"
t.integer "own_projects_count", :default => 0, :null => false
t.datetime "reset_password_sent_at"
t.integer "own_projects_count", :default => 0, :null => false
t.text "professional_experience"
t.string "site"
t.string "company"

View File

@ -1,5 +1,202 @@
# www.robotstxt.org/
# www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449
User-agent: Googlebot
Allow: /*/*/tree/master
Allow: /*/*/blob/master
Disallow: /*/*/tree/*
Disallow: /*/*/blob/*
Disallow: /*/*/wiki/*/*
Disallow: /*/*/issues?*
Disallow: /*/*/commits/*
Disallow: /*/blame/
Disallow: /*/raw/
Disallow: /*.git
Disallow: /*.git/
Disallow: /search
Disallow: /users/sign_up
Disallow: /users/sign_in
Disallow: /users/password/new
Disallow: /users/register_requests/new
Disallow: /invite.html
Disallow: /thanks.html
User-agent: baiduspider
Allow: /*/*/tree/master
Allow: /*/*/blob/master
Disallow: /*/*/tree/*
Disallow: /*/*/blob/*
Disallow: /*/*/wiki/*/*
Disallow: /*/*/issues?*
Disallow: /*/*/commits/*
Disallow: /*/blame/
Disallow: /*/raw/
Disallow: /*.git
Disallow: /*.git/
Disallow: /search
Disallow: /users/sign_up
Disallow: /users/sign_in
Disallow: /users/password/new
Disallow: /users/register_requests/new
Disallow: /invite.html
Disallow: /thanks.html
User-agent: msnbot
Allow: /*/*/tree/master
Allow: /*/*/blob/master
Disallow: /*/*/tree/*
Disallow: /*/*/blob/*
Disallow: /*/*/wiki/*/*
Disallow: /*/*/issues?*
Disallow: /*/*/commits/*
Disallow: /*/blame/
Disallow: /*/raw/
Disallow: /*.git
Disallow: /*.git/
Disallow: /search
Disallow: /users/sign_up
Disallow: /users/sign_in
Disallow: /users/password/new
Disallow: /users/register_requests/new
Disallow: /invite.html
Disallow: /thanks.html
User-agent: naverbot
Allow: /*/*/tree/master
Allow: /*/*/blob/master
Disallow: /*/*/tree/*
Disallow: /*/*/blob/*
Disallow: /*/*/wiki/*/*
Disallow: /*/*/issues?*
Disallow: /*/*/commits/*
Disallow: /*/blame/
Disallow: /*/raw/
Disallow: /*.git
Disallow: /*.git/
Disallow: /search
Disallow: /users/sign_up
Disallow: /users/sign_in
Disallow: /users/password/new
Disallow: /users/register_requests/new
Disallow: /invite.html
Disallow: /thanks.html
User-agent: seznambot
Allow: /*/*/tree/master
Allow: /*/*/blob/master
Disallow: /*/*/tree/*
Disallow: /*/*/blob/*
Disallow: /*/*/wiki/*/*
Disallow: /*/*/issues?*
Disallow: /*/*/commits/*
Disallow: /*/blame/
Disallow: /*/raw/
Disallow: /*.git
Disallow: /*.git/
Disallow: /search
Disallow: /users/sign_up
Disallow: /users/sign_in
Disallow: /users/password/new
Disallow: /users/register_requests/new
Disallow: /invite.html
Disallow: /thanks.html
User-agent: Slurp
Allow: /*/*/tree/master
Allow: /*/*/blob/master
Disallow: /*/*/tree/*
Disallow: /*/*/blob/*
Disallow: /*/*/wiki/*/*
Disallow: /*/*/issues?*
Disallow: /*/*/commits/*
Disallow: /*/blame/
Disallow: /*/raw/
Disallow: /*.git
Disallow: /*.git/
Disallow: /search
Disallow: /users/sign_up
Disallow: /users/sign_in
Disallow: /users/password/new
Disallow: /users/register_requests/new
Disallow: /invite.html
Disallow: /thanks.html
User-agent: teoma
Allow: /*/*/tree/master
Allow: /*/*/blob/master
Disallow: /*/*/tree/*
Disallow: /*/*/blob/*
Disallow: /*/*/wiki/*/*
Disallow: /*/*/issues?*
Disallow: /*/*/commits/*
Disallow: /*/blame/
Disallow: /*/raw/
Disallow: /*.git
Disallow: /*.git/
Disallow: /search
Disallow: /users/sign_up
Disallow: /users/sign_in
Disallow: /users/password/new
Disallow: /users/register_requests/new
Disallow: /invite.html
Disallow: /thanks.html
User-agent: Yandex
Allow: /*/*/tree/master
Allow: /*/*/blob/master
Disallow: /*/*/tree/*
Disallow: /*/*/blob/*
Disallow: /*/*/wiki/*/*
Disallow: /*/*/issues?*
Disallow: /*/*/commits/*
Disallow: /*/blame/
Disallow: /*/raw/
Disallow: /*.git
Disallow: /*.git/
Disallow: /search
Disallow: /users/sign_up
Disallow: /users/sign_in
Disallow: /users/password/new
Disallow: /users/register_requests/new
Disallow: /invite.html
Disallow: /thanks.html
User-agent: CCBot
Allow: /*/*/tree/master
Allow: /*/*/blob/master
Disallow: /*/*/tree/*
Disallow: /*/*/blob/*
Disallow: /*/*/wiki/*/*
Disallow: /*/*/issues?*
Disallow: /*/*/commits/*
Disallow: /*/blame/
Disallow: /*/raw/
Disallow: /*.git
Disallow: /*.git/
Disallow: /search
Disallow: /users/sign_up
Disallow: /users/sign_in
Disallow: /users/password/new
Disallow: /users/register_requests/new
Disallow: /invite.html
Disallow: /thanks.html
User-agent: Telefonica
Allow: /*/*/tree/master
Allow: /*/*/blob/master
Disallow: /*/*/tree/*
Disallow: /*/*/blob/*
Disallow: /*/*/wiki/*/*
Disallow: /*/*/issues?*
Disallow: /*/*/commits/*
Disallow: /*/blame/
Disallow: /*/raw/
Disallow: /*.git
Disallow: /*.git/
Disallow: /search
Disallow: /users/sign_up
Disallow: /users/sign_in
Disallow: /users/password/new
Disallow: /users/register_requests/new
Disallow: /invite.html
Disallow: /thanks.html
User-agent: *
Disallow: /

View File

@ -6,7 +6,7 @@ FactoryGirl.define do
uname { FactoryGirl.generate(:uname) }
password '123456'
password_confirmation {|u| u.password}
confirmed_at { Time.current }
confirmed_at { Time.now.utc }
end
factory :admin, :parent => :user do