Merge branch 'master' of github.com:evilmartians/rosa-build

This commit is contained in:
Timothy N. Tsvetkov 2011-04-28 18:32:20 +04:00
commit 35483ce02f
8 changed files with 24 additions and 5 deletions

View File

@ -1,6 +1,6 @@
class ProductsController < ApplicationController
before_filter :authenticate_user!, :except => [:product_status]
before_filter :find_product, :only => [:show, :edit, :update, :build, :product_status]
before_filter :find_product, :only => [:show, :edit, :update, :build, :product_status, :destroy]
before_filter :find_platform, :except => [:product_status, :build]
def product_status
@ -59,6 +59,12 @@ class ProductsController < ApplicationController
def show
end
def destroy
@product.destroy
flash[:notice] = t("flash.product.destroyed")
redirect_to @platform
end
protected
def find_product_by_name

View File

@ -4,7 +4,11 @@ class RepositoriesController < ApplicationController
before_filter :find_repository, :only => [:show, :destroy]
def show
@projects = @repository.projects.recent.paginate :page => params[:page], :per_page => 30
if params[:query]
@projects = @repository.projects.recent.by_name(params[:query]).paginate :page => params[:page], :per_page => 30
else
@projects = @repository.projects.recent.paginate :page => params[:page], :per_page => 30
end
end
def new

View File

@ -5,7 +5,7 @@ class Product < ActiveRecord::Base
ATTRS_TO_CLONE = [ 'build_path', 'build', 'build', 'counter', 'ks', 'menu', 'tar' ]
validates :name, :presence => true, :uniqueness => true
validates :name, :presence => true, :uniqueness => {:scope => :platform_id}
validates :platform_id, :presence => true
validates :build_status, :inclusion => { :in => [ NEVER_BUILT, BUILD_COMPLETED, BUILD_FAILED ] }

View File

@ -8,6 +8,7 @@ class Project < ActiveRecord::Base
include Project::HasRepository
scope :recent, order("name ASC")
scope :by_name, lambda { |name| {:conditions => ['name like ?', '%' + name + '%']} }
#before_create :create_directory, :create_git_repo
before_create :xml_rpc_create

View File

@ -2,7 +2,7 @@ class Repository < ActiveRecord::Base
belongs_to :platform
has_many :projects, :dependent => :destroy
validates :name, :presence => {:scope => :platform_id}, :uniqueness => true
validates :name, :uniqueness => {:scope => :platform_id}, :presence => true
validates :unixname, :uniqueness => {:scope => :platform_id}, :presence => true, :format => { :with => /^[a-zA-Z0-9\-.]+$/ }
scope :recent, order("name ASC")

View File

@ -34,6 +34,12 @@
%h2.title
= t("layout.projects.list_header")
.inner
= form_tag platform_repository_path(@platform, @repository), :method => :get do
.group
= label_tag :query, t("layout.search_by_name"), :class => :label
= text_field_tag :query
%button.search{:type => "submit"}
= t("layout.search")
%table.table
%tr
%th.first= t("activerecord.attributes.project.name")

View File

@ -11,6 +11,7 @@ ru:
delete: Удалить
save: Сохранить
search: Искать
search_by_name: Фильтр по имени
are_you_sure: "Вы уверены?"
login: Войти
or: или
@ -147,6 +148,7 @@ ru:
saved: Продукт успешно сохранен
save_error: Не удалось сохранить изменения
build_started: Запущена сборка продукта
destroyed: Продукт удален
platform:
saved: Платформа успешно добавлена
saved_error: Не удалось создать платформу

View File

@ -1 +1 @@
/* Override here any style defined by web-app-theme */ .form input.file_field:hover { -webkit-box-shadow: rgba(0,0,0,0.0) 0 0 0px; -moz-box-shadow: rgba(0,0,0,0.0) 0 0 0px; box-shadow: 0 0 0px rgba(0, 0, 0, 0.0); border: 0px solid #a2a294; }
/* Override here any style defined by web-app-theme */ .form input.file_field:hover { -webkit-box-shadow: rgba(0,0,0,0.0) 0 0 0px; -moz-box-shadow: rgba(0,0,0,0.0) 0 0 0px; box-shadow: 0 0 0px rgba(0, 0, 0, 0.0); border: 0px solid #a2a294; } button.search { height:2em; line-height:2em; }