added scope :recent to repository and show repositories on the platform page

This commit is contained in:
Timothy N. Tsvetkov 2011-03-31 04:25:18 +04:00
parent e984500a69
commit 6f9683c686
3 changed files with 32 additions and 3 deletions

View File

@ -5,6 +5,8 @@ class Repository < ActiveRecord::Base
validate :name, :presence => true, :uniqueness => true
validate :unixname, :uniqueness => true, :presence => true, :format => { :with => /^[a-zA-Z0-9\-.]+$/ }
scope :recent, order("name ASC")
before_create :create_directory
def path

View File

@ -36,7 +36,31 @@
- else
= link_to t("layout.platforms.freeze"), freeze_platform_path(@platform), :confirm => I18n.t("layout.platforms.confirm_freeze"), :class => "button"
-# Show repositories
-# Show projects
%a{ :name => "repositories" }
.block
.secondary-navigation
%ul.wat-cf
%li.first.active= link_to t("layout.repositories.list"), platform_path(@platform) + "#repositories"
%li= link_to t("layout.repositories.new"), new_platform_repository_path(@platform)
.content
%h2.title
= t("layout.repositories.list_header")
.inner
%table.table
%tr
%th.first= t("activerecord.attributes.repository.name")
%th= t("activerecord.attributes.repository.created_at")
%th.last &nbsp;
- @platform.repositories.recent.each do |repository|
%tr{:class => cycle("odd", "even")}
%td
= link_to repository.name, platform_repository_path(@platform, repository)
%td
= repository.created_at
%td.last
#{link_to t("layout.show"), platform_repository_path(@platform, repository)} | #{link_to t("layout.delete"), platform_repository_path(@platform, repository), :method => :delete, :confirm => t("layout.repositories.confirm_delete")}
.actions-bar.wat-cf
.actions
-#- content_for :sidebar, render(:partial => 'sidebar')
-#- content_for :sidebar do

View File

@ -34,12 +34,15 @@ ru:
released_suffix: (выпущена)
confirm_delete: Вы уверены, что хотите удалить эту платформу?
repositories:
list: Список
list_header: Репозитории
new: Новый репозиторий
show: Репозиторий
location: Расположение
projects: Проекты
new_header: Новый репозиторий
back_to_the_list: К списку репозиториев
confirm_delete: Вы уверены, что хотите удалить этот репозиторий?
projects:
new: Новый проект
location: Расположение