Project

General

Profile

Feature #1828 » 0003-Add-support-for-a-default-target-version-for-a-proje.patch

Proper patch for supporting a default target version - Eric Thomas, 2010-07-15 07:13

View differences:

app/models/project.rb
20 20
  STATUS_ACTIVE     = 1
21 21
  STATUS_ARCHIVED   = 9
22 22
  
23
  belongs_to :default_version, :class_name => 'Version', :foreign_key => 'default_version_id'
24

  
23 25
  # Specific overidden Activities
24 26
  has_many :time_entry_activities
25 27
  has_many :members, :include => [:user, :roles], :conditions => "#{User.table_name}.type='User' AND #{User.table_name}.status=#{User::STATUS_ACTIVE}"
app/views/issues/_attributes.rhtml
19 19
                     :tabindex => 199) if authorize_for('issue_categories', 'new') %></p>
20 20
<% end %>
21 21
<% unless @issue.assignable_versions.empty? %>
22
<p><%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), :include_blank => true %>
22
<p><%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.new_record? ? @project.default_version : @issue.fixed_version), :include_blank => true %>
23 23
<%= prompt_to_remote(image_tag('add.png', :style => 'vertical-align: middle;'),
24 24
                     l(:label_version_new),
25 25
                     'version[name]', 
app/views/projects/_form.rhtml
15 15
<% end %></p>
16 16
<p><%= f.text_field :homepage, :size => 60 %></p>
17 17
<p><%= f.check_box :is_public %></p>
18

  
19
<% if Project.exists?(@project) && !@project.shared_versions.empty? %>
20
  <p><%= f.select :default_version_id, version_options_for_select(@project.shared_versions, @project.default_version), :include_blank => true %></p>
21
<% end %>
22

  
18 23
<%= wikitoolbar_for 'project_description' %>
19 24

  
20 25
<% @project.custom_field_values.each do |value| %>
config/locales/bg.yml
206 206
  field_new_password: Нова парола
207 207
  field_password_confirmation: Потвърждение
208 208
  field_version: Версия
209
  field_default_version: Default version
209 210
  field_type: Тип
210 211
  field_host: Хост
211 212
  field_port: Порт
config/locales/bs.yml
240 240
  field_new_password: Nova lozinka
241 241
  field_password_confirmation: Potvrda
242 242
  field_version: Verzija
243
  field_default_version: Default version
243 244
  field_type: Tip
244 245
  field_host: Host
245 246
  field_port: Port
config/locales/ca.yml
222 222
  field_new_password: Contrasenya nova
223 223
  field_password_confirmation: Confirmació
224 224
  field_version: Versió
225
  field_default_version: Default version
225 226
  field_type: Tipus
226 227
  field_host: Ordinador
227 228
  field_port: Port
config/locales/cs.yml
221 221
  field_new_password: Nové heslo
222 222
  field_password_confirmation: Potvrzení
223 223
  field_version: Verze
224
  field_default_version: Default version
224 225
  field_type: Typ
225 226
  field_host: Host
226 227
  field_port: Port
config/locales/da.yml
238 238
  field_new_password: Nyt kodeord
239 239
  field_password_confirmation: Bekræft
240 240
  field_version: Version
241
  field_default_version: Default version
241 242
  field_type: Type
242 243
  field_host: Vært
243 244
  field_port: Port
config/locales/de.yml
263 263
  field_new_password: Neues Kennwort
264 264
  field_password_confirmation: Bestätigung
265 265
  field_version: Version
266
  field_default_version: Default version
266 267
  field_type: Typ
267 268
  field_host: Host
268 269
  field_port: Port
config/locales/el.yml
231 231
  field_new_password: Νέος κωδικός πρόσβασης
232 232
  field_password_confirmation: Επιβεβαίωση
233 233
  field_version: Έκδοση
234
  field_default_version: Default version
234 235
  field_type: Τύπος
235 236
  field_host: Κόμβος
236 237
  field_port: Θύρα
config/locales/en.yml
241 241
  field_new_password: New password
242 242
  field_password_confirmation: Confirmation
243 243
  field_version: Version
244
  field_default_version: Default version
244 245
  field_type: Type
245 246
  field_host: Host
246 247
  field_port: Port
config/locales/es.yml
326 326
  field_user: Usuario
327 327
  field_value: Valor
328 328
  field_version: Versión
329
  field_default_version: Versión por defecto
329 330
  general_csv_decimal_separator: ','
330 331
  general_csv_encoding: ISO-8859-15
331 332
  general_csv_separator: ';'
config/locales/eu.yml
241 241
  field_new_password: Pasahitz berria
242 242
  field_password_confirmation: Berrespena
243 243
  field_version: Bertsioa
244
  field_default_version: Default version
244 245
  field_type: Mota
245 246
  field_host: Ostalaria
246 247
  field_port: Portua
config/locales/fi.yml
251 251
  field_new_password: Uusi salasana
252 252
  field_password_confirmation: Vahvistus
253 253
  field_version: Versio
254
  field_default_version: Default version
254 255
  field_type: Tyyppi
255 256
  field_host: Verkko-osoite
256 257
  field_port: Portti
config/locales/fr.yml
260 260
  field_new_password: Nouveau mot de passe
261 261
  field_password_confirmation: Confirmation
262 262
  field_version: Version
263
  field_default_version: Default version
263 264
  field_type: Type
264 265
  field_host: Hôte
265 266
  field_port: Port
config/locales/gl.yml
303 303
  field_user: Usuario
304 304
  field_value: Valor
305 305
  field_version: Versión
306
  field_default_version: Default version
306 307
  general_csv_decimal_separator: ','
307 308
  general_csv_encoding: ISO-8859-15
308 309
  general_csv_separator: ';'
config/locales/he.yml
218 218
  field_new_password: סיסמה חדשה
219 219
  field_password_confirmation: אישור
220 220
  field_version: גירסא
221
  field_default_version: Default version
221 222
  field_type: סוג
222 223
  field_host: שרת
223 224
  field_port: פורט
config/locales/hr.yml
237 237
  field_new_password: Nova zaporka
238 238
  field_password_confirmation: Potvrda zaporke
239 239
  field_version: Verzija
240
  field_default_version: Default version
240 241
  field_type: Tip
241 242
  field_host: Host
242 243
  field_port: Port
config/locales/hu.yml
247 247
  field_new_password: Új jelszó
248 248
  field_password_confirmation: Megerősítés
249 249
  field_version: Verzió
250
  field_default_version: Default version
250 251
  field_type: Típus
251 252
  field_host: Kiszolgáló
252 253
  field_port: Port
config/locales/id.yml
239 239
  field_new_password: Kata sandi baru
240 240
  field_password_confirmation: Konfirmasi
241 241
  field_version: Versi
242
  field_default_version: Default version
242 243
  field_type: Tipe
243 244
  field_host: Host
244 245
  field_port: Port
config/locales/it.yml
219 219
  field_new_password: Nuova password
220 220
  field_password_confirmation: Conferma
221 221
  field_version: Versione
222
  field_default_version: Default version
222 223
  field_type: Tipo
223 224
  field_host: Host
224 225
  field_port: Porta
config/locales/ja.yml
272 272
  field_new_password: 新しいパスワード
273 273
  field_password_confirmation: パスワードの確認
274 274
  field_version: バージョン
275
  field_default_version: Default version
275 276
  field_type: タイプ
276 277
  field_host: ホスト
277 278
  field_port: ポート
config/locales/ko.yml
287 287
  field_new_password: 새 비밀번호
288 288
  field_password_confirmation: 비밀번호 확인
289 289
  field_version: 버전
290
  field_default_version: Default version
290 291
  field_type: 방식
291 292
  field_host: 호스트
292 293
  field_port: 포트
config/locales/lt.yml
298 298
  field_new_password: Naujas slaptažodis
299 299
  field_password_confirmation: Patvirtinimas
300 300
  field_version: Versija
301
  field_default_version: Default version
301 302
  field_type: Tipas
302 303
  field_host: Pagrindinis kompiuteris
303 304
  field_port: Prievadas
config/locales/mn.yml
236 236
  field_new_password: Шннэ нууц үг
237 237
  field_password_confirmation: Баталгаажуулах
238 238
  field_version: Хувилбар
239
  field_default_version: Default version
239 240
  field_type: Төрөл
240 241
  field_host: Хост
241 242
  field_port: Порт
config/locales/nl.yml
265 265
  field_user: Gebruiker
266 266
  field_value: Waarde
267 267
  field_version: Versie
268
  field_default_version: Default version
268 269
  general_csv_decimal_separator: '.'
269 270
  general_csv_encoding: ISO-8859-1
270 271
  general_csv_separator: ','
config/locales/no.yml
219 219
  field_new_password: Nytt passord
220 220
  field_password_confirmation: Bekreft passord
221 221
  field_version: Versjon
222
  field_default_version: Default version
222 223
  field_type: Type
223 224
  field_host: Vert
224 225
  field_port: Port
config/locales/pl.yml
290 290
  field_user: Użytkownik
291 291
  field_value: Wartość
292 292
  field_version: Wersja
293
  field_default_version: Default version
293 294
  field_vf_personnel: Personel
294 295
  field_vf_watcher: Obserwator
295 296
  general_csv_decimal_separator: '.'
config/locales/pt-BR.yml
252 252
  field_new_password: Nova senha
253 253
  field_password_confirmation: Confirmação
254 254
  field_version: Versão
255
  field_default_version: Default version
255 256
  field_type: Tipo
256 257
  field_host: Servidor
257 258
  field_port: Porta
config/locales/pt.yml
237 237
  field_new_password: Nova palavra-chave
238 238
  field_password_confirmation: Confirmação
239 239
  field_version: Versão
240
  field_default_version: Default version
240 241
  field_type: Tipo
241 242
  field_host: Servidor
242 243
  field_port: Porta
config/locales/ro.yml
220 220
  field_new_password: Parola nouă
221 221
  field_password_confirmation: Confirmare
222 222
  field_version: Versiune
223
  field_default_version: Default version
223 224
  field_type: Tip
224 225
  field_host: Gazdă
225 226
  field_port: Port
config/locales/ru.yml
375 375
  field_user: Пользователь
376 376
  field_value: Значение
377 377
  field_version: Версия
378
  field_default_version: Default version
378 379
  field_watcher: Наблюдатель
379 380

  
380 381
  general_csv_decimal_separator: '.'
config/locales/sk.yml
219 219
  field_new_password: Nové heslo
220 220
  field_password_confirmation: Potvrdenie
221 221
  field_version: Verzia
222
  field_default_version: Default version
222 223
  field_type: Typ
223 224
  field_host: Host
224 225
  field_port: Port
config/locales/sl.yml
223 223
  field_new_password: Novo geslo
224 224
  field_password_confirmation: Potrditev
225 225
  field_version: Verzija
226
  field_default_version: Default version
226 227
  field_type: Tip
227 228
  field_host: Gostitelj
228 229
  field_port: Vrata
config/locales/sr.yml
230 230
  field_new_password: Nova lozinka
231 231
  field_password_confirmation: Potvrda
232 232
  field_version: Verzija
233
  field_default_version: Default version
233 234
  field_type: Tip
234 235
  field_host: Host
235 236
  field_port: Port
config/locales/sv.yml
288 288
  field_new_password: Nytt lösenord
289 289
  field_password_confirmation: Bekräfta lösenord
290 290
  field_version: Version
291
  field_default_version: Default version
291 292
  field_type: Typ
292 293
  field_host: Värddator
293 294
  field_port: Port
config/locales/th.yml
217 217
  field_new_password: รหัสผ่านใหม่
218 218
  field_password_confirmation: ยืนยันรหัสผ่าน
219 219
  field_version: รุ่น
220
  field_default_version: Default version
220 221
  field_type: ชนิด
221 222
  field_host: โฮสต์
222 223
  field_port: พอร์ต
config/locales/tr.yml
248 248
  field_new_password: Yeni Parola
249 249
  field_password_confirmation: Onay
250 250
  field_version: Versiyon
251
  field_default_version: Default version
251 252
  field_type: Tip
252 253
  field_host: Host
253 254
  field_port: Port
config/locales/uk.yml
211 211
  field_new_password: Новий пароль
212 212
  field_password_confirmation: Підтвердження
213 213
  field_version: Версія
214
  field_default_version: Default version
214 215
  field_type: Тип
215 216
  field_host: Машина
216 217
  field_port: Порт
config/locales/vi.yml
282 282
  field_new_password: Mật mã mới
283 283
  field_password_confirmation: Khẳng định lại
284 284
  field_version: Phiên bản
285
  field_default_version: Default version
285 286
  field_type: Kiểu
286 287
  field_host: Host
287 288
  field_port: Port
config/locales/zh-TW.yml
332 332
  field_new_password: 新密碼
333 333
  field_password_confirmation: 確認新密碼
334 334
  field_version: 版本
335
  field_default_version: Default version
335 336
  field_type: Type
336 337
  field_host: Host
337 338
  field_port: 連接埠
config/locales/zh.yml
260 260
  field_new_password: 新密码
261 261
  field_password_confirmation: 确认
262 262
  field_version: 版本
263
  field_default_version: Default version
263 264
  field_type: 类型
264 265
  field_host: 主机
265 266
  field_port: 端口
db/migrate/109_add_default_version_to_project.rb
1
class AddDefaultVersionToProject < ActiveRecord::Migration
2
  def self.up
3
    add_column :projects, :default_version_id, :integer, :default => nil
4
  end
5

  
6
  def self.down
7
    remove_column :projects, :default_version_id
8
  end
9
end
test/fixtures/projects.yml
11 11
  parent_id: 
12 12
  lft: 1
13 13
  rgt: 10
14
  default_version_id:
14 15
projects_002: 
15 16
  created_on: 2006-07-19 19:14:19 +02:00
16 17
  name: OnlineStore
......
23 24
  parent_id: 
24 25
  lft: 11
25 26
  rgt: 12
27
  default_version_id: 7
26 28
projects_003: 
27 29
  created_on: 2006-07-19 19:15:21 +02:00
28 30
  name: eCookbook Subproject 1
......
35 37
  parent_id: 1
36 38
  lft: 6
37 39
  rgt: 7
40
  default_version_id:
38 41
projects_004: 
39 42
  created_on: 2006-07-19 19:15:51 +02:00
40 43
  name: eCookbook Subproject 2
......
47 50
  parent_id: 1
48 51
  lft: 8
49 52
  rgt: 9
53
  default_version_id:
50 54
projects_005: 
51 55
  created_on: 2006-07-19 19:15:51 +02:00
52 56
  name: Private child of eCookbook
......
59 63
  parent_id: 1
60 64
  lft: 2
61 65
  rgt: 5
66
  default_version_id:
62 67
projects_006: 
63 68
  created_on: 2006-07-19 19:15:51 +02:00
64 69
  name: Child of private child
......
71 76
  parent_id: 5
72 77
  lft: 3
73 78
  rgt: 4
74
  
79
  default_version_id:
test/functional/issues_controller_test.rb
396 396
                                                 :value => 'Default string' }
397 397
  end
398 398

  
399
  def test_get_new_with_default_version
400
    @request.session[:user_id] = 2
401
    get :new, :project_id => 2, :tracker_id => 1
402
    assert_response :success
403
    assert_template 'new'
404

  
405
    assert_tag :select, :attributes => { :name => 'issue[fixed_version_id]' },
406
                        :child => { :tag => 'option', :attributes => { :selected => 'selected'},
407
                                                      :content => 'Systemwide visible version'}
408
  end
409

  
399 410
  def test_get_new_without_tracker_id
400 411
    @request.session[:user_id] = 2
401 412
    get :new, :project_id => 1
(3-3/4)