#2891: displaying select menu for backlogs display options: none, left, right

pull/6827/head
Jens Ulferts 14 years ago
parent a867c763d4
commit 599917e553
  1. 23
      app/helpers/version_settings_helper.rb
  2. 21
      app/views/versions/_form.rhtml
  3. 5
      config/locales/de.yml
  4. 9
      config/locales/en-GB.yml
  5. 6
      config/locales/en.yml
  6. 31
      features/project_admin.feature
  7. 1
      init.rb
  8. 13
      lib/backlogs_version_controller_patch.rb
  9. 13
      spec/helpers/version_settings_helper_spec.rb

@ -0,0 +1,23 @@
module VersionSettingsHelper
unloadable
def position_display_options
options = [::VersionSetting::DISPLAY_NONE,
::VersionSetting::DISPLAY_LEFT,
::VersionSetting::DISPLAY_RIGHT]
options.collect {|s| [humanize_display_option(s), s]}
end
private
def humanize_display_option(option)
case option
when ::VersionSetting::DISPLAY_NONE
t("version_settings_display_option_none")
when ::VersionSetting::DISPLAY_LEFT
t("version_settings_display_option_left")
when ::VersionSetting::DISPLAY_RIGHT
t("version_settings_display_option_right")
end
end
end

@ -0,0 +1,21 @@
<%= error_messages_for 'version' %>
<% @version.build_version_setting if @version.version_setting.nil? %>
<div class="box">
<p><%= f.text_field :name, :size => 60, :required => true %></p>
<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 :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>
<% f.fields_for :version_setting do |sf| %>
<p><%= sf.select :display, position_display_options %></p>
<% end %>
<% @version.custom_field_values.each do |value| %>
<p><%= custom_field_tag_with_label :version, value %></p>
<% end %>
</div>

@ -86,3 +86,8 @@ de:
error_outro: Bitte beheben Sie die obigen Fehler bevor Sie erneut abschicken.
backlogs:
show_statistics: 'Scrum Statistiken anzeigen'
version_settings_display_option_none: kein
version_settings_display_option_left: links
version_settings_display_option_right: rechts
version_settings_display_label: Spalte im Backlog

@ -1,5 +1,5 @@
---
en-GB:
---
en-GB:
rb_label_copy_tasks_open: "[[Open]]"
label_webcal: Webcal Feed
event_sprint_summary: "{{project}}: {{summary}}"
@ -84,3 +84,8 @@ en-GB:
backlogs_product_backlog: Product backlog
remaining_hours: remaining hours
error_outro: Please correct the above errors before submitting again.
version_settings_display_option_none: none
version_settings_display_option_left: left
version_settings_display_option_right: right
version_settings_display_label: Column in backlog

@ -104,3 +104,9 @@ en:
backlogs:
show_statistics: 'Show Scrum statistics'
version_settings_display_option_none: none
version_settings_display_option_left: left
version_settings_display_option_right: right
version_settings_display_label: Column in backlog

@ -0,0 +1,31 @@
Feature: Project Admin
As a Project Admin
I want to configure the backlogs plugin
So that my team and I can work effectively
Background:
Given there is 1 project with:
| name | ecookbook |
And I am working in project "ecookbook"
And the project uses the following modules:
| backlogs |
And the backlogs module is initialized
And there is 1 user with:
| login | padme |
And there is a role "project admin"
And the role "project admin" may have the following rights:
| manage_versions |
And the user "padme" is a "project admin"
And the project has the following sprints:
| name | sprint_start_date | effective_date |
| Sprint 001 | 2010-01-01 | 2010-01-31 |
| Sprint 002 | 2010-02-01 | 2010-02-28 |
| Sprint 003 | 2010-03-01 | 2010-03-31 |
| Sprint 004 | 2010-03-01 | 2010-03-31 |
And I am logged in as "padme"
Scenario: One can select whether versions are displayed left or right (left is default) in the backlogs page
When I go to the edit page of the version called "Sprint 001"
Then there should be a "version_version_setting_attributes_display" field within "#content form"
And the "version_version_setting_attributes_display" field within "#content form" should contain "2"

@ -18,6 +18,7 @@ Dispatcher.to_prepare do
require_dependency 'backlogs_project_patch'
require_dependency 'backlogs_user_patch'
require_dependency 'backlogs_my_controller_patch'
require_dependency 'backlogs_version_controller_patch'
end
require_dependency 'backlogs_hooks'

@ -0,0 +1,13 @@
module Backlogs
module VersionsControllerPatch
def self.included(base)
base.class_eval do
unloadable
include VersionSettingsHelper
helper :version_settings
end
end
end
end
VersionsController.send(:include, Backlogs::VersionsControllerPatch)

@ -0,0 +1,13 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe VersionSettingsHelper do
describe :position_display_options do
before(:each) do
@expected_options = [[I18n.t("version_settings_display_option_none"), 1],
[I18n.t("version_settings_display_option_left"), 2],
[I18n.t("version_settings_display_option_right"), 3]]
end
it { helper.position_display_options.should eql @expected_options }
end
end
Loading…
Cancel
Save