#2891: displaying select menu for backlogs display options: none, left, right
parent
a867c763d4
commit
599917e553
@ -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> |
@ -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" |
@ -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…
Reference in new issue