Merge branch 'ticket/unstable/279-version-start-date' of git://github.com/edavis10/chiliproject.git into unstable

This commit is contained in:
Holger Just 2011-04-07 23:46:45 +02:00
commit 6e0717261c
49 changed files with 52 additions and 49 deletions

View File

@ -41,9 +41,13 @@ class Version < ActiveRecord::Base
def visible?(user=User.current)
user.allowed_to?(:view_issues, self.project)
end
# When a version started.
#
# Can either be a set date stored in the database or a dynamic one
# based on the earlist start_date of the fixed_issues
def start_date
@start_date ||= fixed_issues.minimum('start_date')
@start_date ||= (read_attribute(:start_date) || fixed_issues.minimum('start_date'))
end
def due_date

View File

@ -2,6 +2,7 @@
<table class="list versions">
<thead><tr>
<th><%= l(:label_version) %></th>
<th><%= l(:field_start_date) %></th>
<th><%= l(:field_effective_date) %></th>
<th><%= l(:field_description) %></th>
<th><%= l(:field_status) %></th>
@ -13,6 +14,7 @@
<% for version in @project.shared_versions.sort %>
<tr class="version <%= cycle 'odd', 'even' %> <%=h version.status %> <%= 'shared' if version.project != @project %>">
<td class="name"><%= link_to_version version %></td>
<td class="date"><%= format_date(version.start_date) %></td>
<td class="date"><%= format_date(version.effective_date) %></td>
<td class="description"><%=h version.description %></td>
<td class="status"><%= l("version_status_#{version.status}") %></td>

View File

@ -5,6 +5,7 @@
<p><%= f.text_field :description, :size => 60 %></p>
<p><%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]} %></p>
<p><%= f.text_field :wiki_page_title, :label => :label_wiki_page, :size => 60, :disabled => @project.wiki.nil? %></p>
<p><%= f.text_field :start_date, :size => 10 %><%= calendar_for('version_start_date') %></p>
<p><%= f.text_field :effective_date, :size => 10 %><%= calendar_for('version_effective_date') %></p>
<p><%= f.select :sharing, @version.allowed_sharings.collect {|v| [format_version_sharing(v), v]} %></p>

View File

@ -1,7 +1,10 @@
<% if version.completed? %>
<p><%= format_date(version.effective_date) %></p>
<% elsif version.effective_date %>
<p><strong><%= due_date_distance_in_words(version.effective_date) %></strong> (<%= format_date(version.effective_date) %>)</p>
<p>
<%= l(:field_start_date) %> <%= h(format_date(version.start_date)) %>
<%= l(:field_due_date) %> <%= h(format_date(version.due_date)) %>
</p>
<% if !version.completed? && version.due_date %>
<p><strong><%= due_date_distance_in_words(version.effective_date) %></strong></p>
<% end %>
<p><%=h version.description %></p>

View File

@ -252,7 +252,6 @@ bg:
field_admin: Администратор
field_last_login_on: Последно свързване
field_language: Език
field_effective_date: Дата
field_password: Парола
field_new_password: Нова парола
field_password_confirmation: Потвърждение

View File

@ -241,7 +241,6 @@ bs:
field_admin: Administrator
field_last_login_on: Posljednja konekcija
field_language: Jezik
field_effective_date: Datum
field_password: Lozinka
field_new_password: Nova lozinka
field_password_confirmation: Potvrda

View File

@ -253,7 +253,6 @@ ca:
field_admin: Administrador
field_last_login_on: Última connexió
field_language: Idioma
field_effective_date: Data
field_password: Contrasenya
field_new_password: Contrasenya nova
field_password_confirmation: Confirmació

View File

@ -226,7 +226,6 @@ cs:
field_admin: Administrátor
field_last_login_on: Poslední přihlášení
field_language: Jazyk
field_effective_date: Datum
field_password: Heslo
field_new_password: Nové heslo
field_password_confirmation: Potvrzení

View File

@ -239,7 +239,6 @@ da:
field_admin: Administrator
field_last_login_on: Sidste forbindelse
field_language: Sprog
field_effective_date: Dato
field_password: Kodeord
field_new_password: Nyt kodeord
field_password_confirmation: Bekræft

View File

@ -267,7 +267,6 @@ de:
field_admin: Administrator
field_last_login_on: Letzte Anmeldung
field_language: Sprache
field_effective_date: Datum
field_password: Kennwort
field_new_password: Neues Kennwort
field_password_confirmation: Bestätigung

View File

@ -236,7 +236,6 @@ el:
field_admin: Διαχειριστής
field_last_login_on: Τελευταία σύνδεση
field_language: Γλώσσα
field_effective_date: Ημερομηνία
field_password: Κωδικός πρόσβασης
field_new_password: Νέος κωδικός πρόσβασης
field_password_confirmation: Επιβεβαίωση

View File

@ -246,7 +246,7 @@ en-GB:
field_admin: Administrator
field_last_login_on: Last connection
field_language: Language
field_effective_date: Date
field_effective_date: Due date
field_password: Password
field_new_password: New password
field_password_confirmation: Confirmation

View File

@ -252,7 +252,7 @@ en:
field_admin: Administrator
field_last_login_on: Last connection
field_language: Language
field_effective_date: Date
field_effective_date: Due date
field_password: Password
field_new_password: New password
field_password_confirmation: Confirmation

View File

@ -269,7 +269,6 @@ es:
field_done_ratio: % Realizado
field_downloads: Descargas
field_due_date: Fecha fin
field_effective_date: Fecha
field_estimated_hours: Tiempo estimado
field_field_format: Formato
field_filename: Fichero

View File

@ -246,7 +246,6 @@ eu:
field_admin: Kudeatzailea
field_last_login_on: Azken konexioa
field_language: Hizkuntza
field_effective_date: Data
field_password: Pasahitza
field_new_password: Pasahitz berria
field_password_confirmation: Berrespena

View File

@ -247,7 +247,6 @@ fi:
field_admin: Ylläpitäjä
field_last_login_on: Viimeinen yhteys
field_language: Kieli
field_effective_date: Päivä
field_password: Salasana
field_new_password: Uusi salasana
field_password_confirmation: Vahvistus

View File

@ -259,7 +259,6 @@ fr:
field_admin: Administrateur
field_last_login_on: "Dernière connexion "
field_language: Langue
field_effective_date: Date
field_password: Mot de passe
field_new_password: Nouveau mot de passe
field_password_confirmation: Confirmation

View File

@ -246,7 +246,6 @@ gl:
field_done_ratio: % Realizado
field_downloads: Descargas
field_due_date: Data fin
field_effective_date: Data
field_estimated_hours: Tempo estimado
field_field_format: Formato
field_filename: Arquivo

View File

@ -255,7 +255,6 @@ he:
field_admin: ניהול
field_last_login_on: התחברות אחרונה
field_language: שפה
field_effective_date: תאריך
field_password: סיסמה
field_new_password: סיסמה חדשה
field_password_confirmation: אישור

View File

@ -242,7 +242,6 @@ hr:
field_admin: Administrator
field_last_login_on: Zadnja prijava
field_language: Primarni jezik
field_effective_date: Datum
field_password: Zaporka
field_new_password: Nova zaporka
field_password_confirmation: Potvrda zaporke

View File

@ -245,7 +245,6 @@
field_admin: Adminisztrátor
field_last_login_on: Utolsó bejelentkezés
field_language: Nyelv
field_effective_date: Dátum
field_password: Jelszó
field_new_password: Új jelszó
field_password_confirmation: Megerősítés

View File

@ -240,7 +240,6 @@ id:
field_admin: Administrator
field_last_login_on: Terakhir login
field_language: Bahasa
field_effective_date: Tanggal
field_password: Kata sandi
field_new_password: Kata sandi baru
field_password_confirmation: Konfirmasi

View File

@ -218,7 +218,6 @@ it:
field_admin: Amministratore
field_last_login_on: Ultima connessione
field_language: Lingua
field_effective_date: Data
field_password: Password
field_new_password: Nuova password
field_password_confirmation: Conferma

View File

@ -274,7 +274,6 @@ ja:
field_admin: 管理者
field_last_login_on: 最終接続日
field_language: 言語
field_effective_date: 期日
field_password: パスワード
field_new_password: 新しいパスワード
field_password_confirmation: パスワードの確認

View File

@ -284,7 +284,6 @@ ko:
field_admin: 관리자
field_last_login_on: 마지막 로그인
field_language: 언어
field_effective_date: 일자
field_password: 비밀번호
field_new_password: 새 비밀번호
field_password_confirmation: 비밀번호 확인

View File

@ -295,7 +295,6 @@ lt:
field_admin: Administratorius
field_last_login_on: Paskutinis ryšys
field_language: Kalba
field_effective_date: Data
field_password: Slaptažodis
field_new_password: Naujas slaptažodis
field_password_confirmation: Patvirtinimas

View File

@ -237,7 +237,6 @@ lv:
field_admin: Administrators
field_last_login_on: Pēdējo reizi pieslēdzies
field_language: Valoda
field_effective_date: Datums
field_password: Parole
field_new_password: Janā parole
field_password_confirmation: Paroles apstiprinājums

View File

@ -250,7 +250,6 @@ mk:
field_admin: Администратор
field_last_login_on: Последна најава
field_language: Јазик
field_effective_date: Дата
field_password: Лозинка
field_new_password: Нова лозинка
field_password_confirmation: Потврда

View File

@ -241,7 +241,6 @@ mn:
field_admin: Администратор
field_last_login_on: Сүүлийн холбоо
field_language: Хэл
field_effective_date: Огноо
field_password: Нууц үг
field_new_password: Шннэ нууц үг
field_password_confirmation: Баталгаажуулах

View File

@ -216,7 +216,6 @@ nl:
field_done_ratio: % Gereed
field_downloads: Downloads
field_due_date: Verwachte datum gereed
field_effective_date: Datum
field_estimated_hours: Geschatte tijd
field_field_format: Formaat
field_filename: Bestand

View File

@ -216,7 +216,6 @@
field_admin: Administrator
field_last_login_on: Sist innlogget
field_language: Språk
field_effective_date: Dato
field_password: Passord
field_new_password: Nytt passord
field_password_confirmation: Bekreft passord

View File

@ -233,7 +233,6 @@ pl:
field_done_ratio: % Wykonane
field_downloads: Pobrań
field_due_date: Data oddania
field_effective_date: Data
field_estimated_hours: Szacowany czas
field_field_format: Format
field_filename: Plik

View File

@ -249,7 +249,6 @@ pt-BR:
field_admin: Administrador
field_last_login_on: Última conexão
field_language: Idioma
field_effective_date: Data
field_password: Senha
field_new_password: Nova senha
field_password_confirmation: Confirmação

View File

@ -234,7 +234,6 @@ pt:
field_admin: Administrador
field_last_login_on: Última visita
field_language: Língua
field_effective_date: Data
field_password: Palavra-chave
field_new_password: Nova palavra-chave
field_password_confirmation: Confirmação

View File

@ -221,7 +221,6 @@ ro:
field_admin: Administrator
field_last_login_on: Ultima autentificare în
field_language: Limba
field_effective_date: Data
field_password: Parola
field_new_password: Parola nouă
field_password_confirmation: Confirmare

View File

@ -317,7 +317,6 @@ ru:
field_downloads: Загрузки
field_due_date: Дата выполнения
field_editable: Редактируемый
field_effective_date: Дата
field_estimated_hours: Оцененное время
field_field_format: Формат
field_filename: Файл

View File

@ -220,7 +220,6 @@ sk:
field_admin: Administrátor
field_last_login_on: Posledné prihlásenie
field_language: Jazyk
field_effective_date: Dátum
field_password: Heslo
field_new_password: Nové heslo
field_password_confirmation: Potvrdenie

View File

@ -225,7 +225,6 @@ sl:
field_admin: Administrator
field_last_login_on: Zadnjič povezan(a)
field_language: Jezik
field_effective_date: Datum
field_password: Geslo
field_new_password: Novo geslo
field_password_confirmation: Potrditev

View File

@ -250,7 +250,6 @@ sr-YU:
field_admin: Administrator
field_last_login_on: Poslednje povezivanje
field_language: Jezik
field_effective_date: Datum
field_password: Lozinka
field_new_password: Nova lozinka
field_password_confirmation: Potvrda lozinke

View File

@ -250,7 +250,6 @@ sr:
field_admin: Администратор
field_last_login_on: Последње повезивање
field_language: Језик
field_effective_date: Датум
field_password: Лозинка
field_new_password: Нова лозинка
field_password_confirmation: Потврда лозинке

View File

@ -294,7 +294,6 @@ sv:
field_admin: Administratör
field_last_login_on: Senaste inloggning
field_language: Språk
field_effective_date: Datum
field_password: Lösenord
field_new_password: Nytt lösenord
field_password_confirmation: Bekräfta lösenord

View File

@ -222,7 +222,6 @@ th:
field_admin: ผู้บริหารจัดการ
field_last_login_on: เข้าระบบครั้งสุดท้าย
field_language: ภาษา
field_effective_date: วันที่
field_password: รหัสผ่าน
field_new_password: รหัสผ่านใหม่
field_password_confirmation: ยืนยันรหัสผ่าน

View File

@ -245,7 +245,6 @@ tr:
field_admin: Yönetici
field_last_login_on: Son Bağlantı
field_language: Dil
field_effective_date: Tarih
field_password: Parola
field_new_password: Yeni Parola
field_password_confirmation: Onay

View File

@ -216,7 +216,6 @@ uk:
field_admin: Адміністратор
field_last_login_on: Останнє підключення
field_language: Мова
field_effective_date: Дата
field_password: Пароль
field_new_password: Новий пароль
field_password_confirmation: Підтвердження

View File

@ -279,7 +279,6 @@ vi:
field_admin: Quản trị
field_last_login_on: Kết nối cuối
field_language: Ngôn ngữ
field_effective_date: Ngày
field_password: Mật mã
field_new_password: Mật mã mới
field_password_confirmation: Khẳng định lại

View File

@ -334,7 +334,6 @@
field_admin: 管理者
field_last_login_on: 最近連線日期
field_language: 語系
field_effective_date: 日期
field_password: 目前密碼
field_new_password: 新密碼
field_password_confirmation: 確認新密碼

View File

@ -257,7 +257,6 @@ zh:
field_admin: 管理员
field_last_login_on: 最后登录
field_language: 语言
field_effective_date: 日期
field_password: 密码
field_new_password: 新密码
field_password_confirmation: 确认

View File

@ -0,0 +1,9 @@
class AddStartDateToVersions < ActiveRecord::Migration
def self.up
add_column :versions, :start_date, :date
end
def self.down
remove_column :versions, :start_date
end
end

View File

@ -34,6 +34,31 @@ class VersionTest < ActiveSupport::TestCase
assert !v.save
assert_equal I18n.translate('activerecord.errors.messages.not_a_date'), v.errors.on(:effective_date)
end
context "#start_date" do
context "with no value saved" do
should "be the date of the earlist issue" do
project = Project.find(1)
v = Version.create!(:project => project, :name => 'Progress')
add_issue(v, :estimated_hours => 10, :start_date => '2010-03-01')
Issue.generate_for_project!(project, :subject => 'not assigned', :start_date => '2010-01-01')
assert_equal '2010-03-01', v.start_date.to_s
end
end
context "with a value saved" do
should "be the value" do
project = Project.find(1)
v = Version.create!(:project => project, :name => 'Progress', :start_date => '2010-01-05')
add_issue(v, :estimated_hours => 10, :start_date => '2010-03-01')
assert_equal '2010-01-05', v.start_date.to_s
end
end
end
def test_progress_should_be_0_with_no_assigned_issues
project = Project.find(1)