From d6e6959f46ff54a9675e5d0d70ee22270fbea622 Mon Sep 17 00:00:00 2001 From: Pavel Chipiga Date: Sat, 31 Mar 2012 02:37:54 +0300 Subject: [PATCH] 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 --- app/assets/stylesheets/design/custom.scss | 12 ++ app/controllers/admin/users_controller.rb | 1 + app/controllers/application_controller.rb | 2 - app/controllers/build_lists_controller.rb | 1 + app/controllers/containers_controller.rb | 3 - app/controllers/downloads_controller.rb | 6 - app/controllers/git/base_controller.rb | 1 + app/controllers/issues_controller.rb | 2 +- app/controllers/pages_controller.rb | 11 + .../personal_repositories_controller.rb | 59 ----- app/controllers/platforms_controller.rb | 3 - .../product_build_lists_controller.rb | 27 +-- app/controllers/repositories_controller.rb | 4 +- app/controllers/search_controller.rb | 2 +- app/controllers/wiki_controller.rb | 3 +- app/models/ability.rb | 14 +- app/models/build_list/filter.rb | 2 +- app/models/container.rb | 7 - app/models/product_build_list.rb | 7 +- app/models/product_build_list/filter.rb | 57 ----- app/models/rpm.rb | 7 - app/views/build_lists/_filter.html.haml | 31 +-- app/views/git/commits/show.html.haml | 2 +- app/views/issues/_index_sidebar.html.haml | 25 +-- app/views/issues/show.html.haml | 2 +- app/views/layouts/menu/_bottom.html.haml | 9 +- app/views/layouts/menu/_top.html.haml | 2 +- .../{platforms => pages}/forbidden.html.haml | 0 app/views/pages/root.html.haml | 4 + .../_proj_list.html.haml | 11 - .../_proj_list1.html.haml | 11 - .../projects_list.html.haml | 49 ----- .../personal_repositories/settings.html.haml | 18 -- .../personal_repositories/show.html.haml | 32 --- .../product_build_lists/_filter.html.haml | 27 +-- app/views/repositories/_project.html.haml | 2 +- app/views/repositories/_project.js.erb | 2 +- app/views/repositories/show.html.haml | 2 +- config/deploy.rb | 21 +- config/locales/en.yml | 20 -- config/locales/menu.en.yml | 4 +- config/locales/menu.ru.yml | 4 +- config/locales/models/project.en.yml | 2 +- config/locales/models/project.ru.yml | 2 +- config/locales/ru.yml | 20 -- config/routes.rb | 149 +++++-------- ...120330201229_remove_containers_and_rpms.rb | 26 +++ db/schema.rb | 29 +-- public/robots.txt | 203 +++++++++++++++++- spec/factories/user_factory.rb | 2 +- 50 files changed, 405 insertions(+), 537 deletions(-) delete mode 100644 app/controllers/containers_controller.rb create mode 100644 app/controllers/pages_controller.rb delete mode 100644 app/controllers/personal_repositories_controller.rb delete mode 100644 app/models/container.rb delete mode 100644 app/models/product_build_list/filter.rb delete mode 100644 app/models/rpm.rb rename app/views/{platforms => pages}/forbidden.html.haml (100%) create mode 100644 app/views/pages/root.html.haml delete mode 100644 app/views/personal_repositories/_proj_list.html.haml delete mode 100644 app/views/personal_repositories/_proj_list1.html.haml delete mode 100644 app/views/personal_repositories/projects_list.html.haml delete mode 100644 app/views/personal_repositories/settings.html.haml delete mode 100644 app/views/personal_repositories/show.html.haml create mode 100644 db/migrate/20120330201229_remove_containers_and_rpms.rb diff --git a/app/assets/stylesheets/design/custom.scss b/app/assets/stylesheets/design/custom.scss index 3d9b6123a..a03a4f175 100644 --- a/app/assets/stylesheets/design/custom.scss +++ b/app/assets/stylesheets/design/custom.scss @@ -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; + } +} \ No newline at end of file diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index c7e901668..ba3626130 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -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 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 70b3fcb82..9551dfef0 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/app/controllers/build_lists_controller.rb b/app/controllers/build_lists_controller.rb index 7b64ebf9d..8f713a7bb 100644 --- a/app/controllers/build_lists_controller.rb +++ b/app/controllers/build_lists_controller.rb @@ -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] diff --git a/app/controllers/containers_controller.rb b/app/controllers/containers_controller.rb deleted file mode 100644 index 1475672a2..000000000 --- a/app/controllers/containers_controller.rb +++ /dev/null @@ -1,3 +0,0 @@ -# -*- encoding : utf-8 -*- -class ContainersController < ApplicationController -end diff --git a/app/controllers/downloads_controller.rb b/app/controllers/downloads_controller.rb index 8c10a3940..59a76d80d 100644 --- a/app/controllers/downloads_controller.rb +++ b/app/controllers/downloads_controller.rb @@ -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 diff --git a/app/controllers/git/base_controller.rb b/app/controllers/git/base_controller.rb index 21f761b5d..c9d33ba2c 100644 --- a/app/controllers/git/base_controller.rb +++ b/app/controllers/git/base_controller.rb @@ -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 diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 147eaea1e..4e9dad5e5 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -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 diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb new file mode 100644 index 000000000..bb2a527a9 --- /dev/null +++ b/app/controllers/pages_controller.rb @@ -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 diff --git a/app/controllers/personal_repositories_controller.rb b/app/controllers/personal_repositories_controller.rb deleted file mode 100644 index 122ed928a..000000000 --- a/app/controllers/personal_repositories_controller.rb +++ /dev/null @@ -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 diff --git a/app/controllers/platforms_controller.rb b/app/controllers/platforms_controller.rb index 743759fd0..3b480c59c 100644 --- a/app/controllers/platforms_controller.rb +++ b/app/controllers/platforms_controller.rb @@ -90,9 +90,6 @@ class PlatformsController < ApplicationController redirect_to platforms_path end - def forbidden - end - def members @members = @platform.members.order('name') end diff --git a/app/controllers/product_build_lists_controller.rb b/app/controllers/product_build_lists_controller.rb index 0792f1e4c..3e1384f4c 100644 --- a/app/controllers/product_build_lists_controller.rb +++ b/app/controllers/product_build_lists_controller.rb @@ -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 diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 36dae5e8f..1e746991d 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -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) diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index bcc574bc1..f4bf67e81 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -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 diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index bd242e62d..9a5149b5f 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -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 diff --git a/app/models/ability.rb b/app/models/ability.rb index 21546171c..c7c89c70d 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -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} diff --git a/app/models/build_list/filter.rb b/app/models/build_list/filter.rb index 5e39ec5b1..58b7a9320 100644 --- a/app/models/build_list/filter.rb +++ b/app/models/build_list/filter.rb @@ -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) diff --git a/app/models/container.rb b/app/models/container.rb deleted file mode 100644 index f2564b763..000000000 --- a/app/models/container.rb +++ /dev/null @@ -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 diff --git a/app/models/product_build_list.rb b/app/models/product_build_list.rb index 5bd145ee8..857aa1fc4 100644 --- a/app/models/product_build_list.rb +++ b/app/models/product_build_list.rb @@ -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 diff --git a/app/models/product_build_list/filter.rb b/app/models/product_build_list/filter.rb deleted file mode 100644 index 847d53c76..000000000 --- a/app/models/product_build_list/filter.rb +++ /dev/null @@ -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 diff --git a/app/models/rpm.rb b/app/models/rpm.rb deleted file mode 100644 index 577028102..000000000 --- a/app/models/rpm.rb +++ /dev/null @@ -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 diff --git a/app/views/build_lists/_filter.html.haml b/app/views/build_lists/_filter.html.haml index 8d967dcc5..d4068759e 100644 --- a/app/views/build_lists/_filter.html.haml +++ b/app/views/build_lists/_filter.html.haml @@ -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} diff --git a/app/views/git/commits/show.html.haml b/app/views/git/commits/show.html.haml index b5a052359..ee11394e6 100644 --- a/app/views/git/commits/show.html.haml +++ b/app/views/git/commits/show.html.haml @@ -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 diff --git a/app/views/issues/_index_sidebar.html.haml b/app/views/issues/_index_sidebar.html.haml index 01b125271..5b0b8bf29 100644 --- a/app/views/issues/_index_sidebar.html.haml +++ b/app/views/issues/_index_sidebar.html.haml @@ -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')) diff --git a/app/views/issues/show.html.haml b/app/views/issues/show.html.haml index e116fcc36..0c5b15fff 100644 --- a/app/views/issues/show.html.haml +++ b/app/views/issues/show.html.haml @@ -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 diff --git a/app/views/layouts/menu/_bottom.html.haml b/app/views/layouts/menu/_bottom.html.haml index 5f9aa9cdc..036519416 100644 --- a/app/views/layouts/menu/_bottom.html.haml +++ b/app/views/layouts/menu/_bottom.html.haml @@ -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'), '#' \ No newline at end of file + = link_to t('bottom_menu.tos'), t('bottom_menu.tos_url') \ No newline at end of file diff --git a/app/views/layouts/menu/_top.html.haml b/app/views/layouts/menu/_top.html.haml index 97688685e..182505e75 100644 --- a/app/views/layouts/menu/_top.html.haml +++ b/app/views/layouts/menu/_top.html.haml @@ -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' : '' diff --git a/app/views/platforms/forbidden.html.haml b/app/views/pages/forbidden.html.haml similarity index 100% rename from app/views/platforms/forbidden.html.haml rename to app/views/pages/forbidden.html.haml diff --git a/app/views/pages/root.html.haml b/app/views/pages/root.html.haml new file mode 100644 index 000000000..fee4f1649 --- /dev/null +++ b/app/views/pages/root.html.haml @@ -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") diff --git a/app/views/personal_repositories/_proj_list.html.haml b/app/views/personal_repositories/_proj_list.html.haml deleted file mode 100644 index f4cce088a..000000000 --- a/app/views/personal_repositories/_proj_list.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -%table.table - %tr - %th.first= t("activerecord.attributes.project.name") - %th.last   - - @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)} - diff --git a/app/views/personal_repositories/_proj_list1.html.haml b/app/views/personal_repositories/_proj_list1.html.haml deleted file mode 100644 index 8f98f58cd..000000000 --- a/app/views/personal_repositories/_proj_list1.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -%table.table - %tr - %th.first= t("activerecord.attributes.project.name") - %th.last   - - @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") \ No newline at end of file diff --git a/app/views/personal_repositories/projects_list.html.haml b/app/views/personal_repositories/projects_list.html.haml deleted file mode 100644 index 0a54e4c45..000000000 --- a/app/views/personal_repositories/projects_list.html.haml +++ /dev/null @@ -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') - diff --git a/app/views/personal_repositories/settings.html.haml b/app/views/personal_repositories/settings.html.haml deleted file mode 100644 index 2e38bda6f..000000000 --- a/app/views/personal_repositories/settings.html.haml +++ /dev/null @@ -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') diff --git a/app/views/personal_repositories/show.html.haml b/app/views/personal_repositories/show.html.haml deleted file mode 100644 index b643da67b..000000000 --- a/app/views/personal_repositories/show.html.haml +++ /dev/null @@ -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') diff --git a/app/views/product_build_lists/_filter.html.haml b/app/views/product_build_lists/_filter.html.haml index a84c227c7..8a9e88f02 100644 --- a/app/views/product_build_lists/_filter.html.haml +++ b/app/views/product_build_lists/_filter.html.haml @@ -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") \ No newline at end of file diff --git a/app/views/repositories/_project.html.haml b/app/views/repositories/_project.html.haml index c7fc27f63..2048b04a2 100644 --- a/app/views/repositories/_project.html.haml +++ b/app/views/repositories/_project.html.haml @@ -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   diff --git a/app/views/repositories/_project.js.erb b/app/views/repositories/_project.js.erb index 11e30ec45..fbff4878d 100644 --- a/app/views/repositories/_project.js.erb +++ b/app/views/repositories/_project.js.erb @@ -17,7 +17,7 @@ "<%= if can? :remove_project, @repository j(link_to(' '.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") ) ) diff --git a/app/views/repositories/show.html.haml b/app/views/repositories/show.html.haml index c9fe053ac..c38fe575d 100644 --- a/app/views/repositories/show.html.haml +++ b/app/views/repositories/show.html.haml @@ -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 diff --git a/config/deploy.rb b/config/deploy.rb index cbbd3263f..8f4b921c2 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -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" diff --git a/config/locales/en.yml b/config/locales/en.yml index c00d2b86c..8b087faae 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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 diff --git a/config/locales/menu.en.yml b/config/locales/menu.en.yml index 458463829..bac7d9023 100644 --- a/config/locales/menu.en.yml +++ b/config/locales/menu.en.yml @@ -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 diff --git a/config/locales/menu.ru.yml b/config/locales/menu.ru.yml index a7d0682d8..6099b8ae4 100644 --- a/config/locales/menu.ru.yml +++ b/config/locales/menu.ru.yml @@ -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: Коммиты diff --git a/config/locales/models/project.en.yml b/config/locales/models/project.en.yml index e79e66abd..e1f408056 100644 --- a/config/locales/models/project.en.yml +++ b/config/locales/models/project.en.yml @@ -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 diff --git a/config/locales/models/project.ru.yml b/config/locales/models/project.ru.yml index acda92170..23a15dc72 100644 --- a/config/locales/models/project.ru.yml +++ b/config/locales/models/project.ru.yml @@ -3,7 +3,7 @@ ru: projects: add: Добавить edit: Настройки - fork_and_edit: Клонировать и редактировать + fork_and_edit: Клонировать list: Список list_header: Проекты edit_header: Редактировать проект diff --git a/config/locales/ru.yml b/config/locales/ru.yml index f34e12511..97ae8ba21 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -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: Версия diff --git a/config/routes.rb b/config/routes.rb index 40c74bc3b..fa54201fc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 diff --git a/db/migrate/20120330201229_remove_containers_and_rpms.rb b/db/migrate/20120330201229_remove_containers_and_rpms.rb new file mode 100644 index 000000000..ac1dca3b8 --- /dev/null +++ b/db/migrate/20120330201229_remove_containers_and_rpms.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index d1166777e..337970d56 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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" diff --git a/public/robots.txt b/public/robots.txt index d310d070b..b7e1b54d9 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -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: / diff --git a/spec/factories/user_factory.rb b/spec/factories/user_factory.rb index c1d8a5f92..8f8d138a9 100644 --- a/spec/factories/user_factory.rb +++ b/spec/factories/user_factory.rb @@ -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