aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2011-05-25 14:38:17 +0200
committerPetteri Räty <petsku@petteriraty.eu>2011-06-05 23:40:55 +0300
commit8f5097eeccad507935df12fd426e1cbe953412da (patch)
tree819cc53fd1d866ab948bd6f9962d3587e8787fb6
parentBugfix: broken agenda initializer (diff)
downloadcouncil-webapp-8f5097eeccad507935df12fd426e1cbe953412da.tar.gz
council-webapp-8f5097eeccad507935df12fd426e1cbe953412da.tar.bz2
council-webapp-8f5097eeccad507935df12fd426e1cbe953412da.zip
Bugfix - agenda items management
Don't list rejected agenda items Don't show "Reject" and "Add to current agenda" buttons on pages showing item already in agenda.
-rw-r--r--site/app/views/agenda_items/show.dryml2
-rw-r--r--site/app/views/agendas/show.dryml2
-rw-r--r--site/features/agenda_items.feature9
-rw-r--r--site/features/step_definitions/agenda_item_steps.rb7
-rw-r--r--site/features/support/paths.rb4
5 files changed, 20 insertions, 4 deletions
diff --git a/site/app/views/agenda_items/show.dryml b/site/app/views/agenda_items/show.dryml
index ba27673..1713266 100644
--- a/site/app/views/agenda_items/show.dryml
+++ b/site/app/views/agenda_items/show.dryml
@@ -1,6 +1,6 @@
<show-page>
<append-content:>
- <form if="&this.editable_by?(current_user, :agenda)">
+ <form if="&this.editable_by?(current_user, :agenda) and this.agenda.nil?">
<input value="&Agenda.current.id" type="hidden" name="agenda_item[agenda_id]"/>
<submit label="Add to current agenda"/>
</form>
diff --git a/site/app/views/agendas/show.dryml b/site/app/views/agendas/show.dryml
index 113edb4..40a413e 100644
--- a/site/app/views/agendas/show.dryml
+++ b/site/app/views/agendas/show.dryml
@@ -3,7 +3,7 @@
<h3 class="collection-heading">
Suggested items:
</h3>
- <with with="&AgendaItem.all(:conditions => { :agenda_id => nil })">
+ <with with="&AgendaItem.all(:conditions => { :agenda_id => nil, :rejected => false })">
<collection unless="&this.nil?" />
</with>
</append-collection-section:>
diff --git a/site/features/agenda_items.feature b/site/features/agenda_items.feature
index e9b417c..114b8a4 100644
--- a/site/features/agenda_items.feature
+++ b/site/features/agenda_items.feature
@@ -36,4 +36,11 @@ Feature: Suggest Agenda Items
Given rejected agenda item
And an agenda
When I am on the current agenda page
- Then I should not see "rejected"
+ Then I should not see "Rejected item"
+
+ Scenario: When item is added to agenda don't add it to agenda and don't remove it any more
+ Given agenda item in current agenda
+ And I am logged in as a council member
+ When I am on newest agenda item page
+ Then I should not see "Add to current agenda" button
+ And I should not see "Reject" button
diff --git a/site/features/step_definitions/agenda_item_steps.rb b/site/features/step_definitions/agenda_item_steps.rb
index d68ee91..22348e8 100644
--- a/site/features/step_definitions/agenda_item_steps.rb
+++ b/site/features/step_definitions/agenda_item_steps.rb
@@ -11,7 +11,7 @@ Given /^example agenda item$/ do
end
Given /^rejected agenda item$/ do
- AgendaItem.new(:title => 'Rejected', :discussion => '', :body => 'example', :rejected => true).save!
+ AgendaItem.new(:title => 'Rejected item', :discussion => '', :body => 'example', :rejected => true).save!
end
When /^I follow first suggested agenda link$/ do
@@ -22,3 +22,8 @@ end
When /^I should see current agenda as the agenda$/ do
When "I should see \"Agenda #{Agenda.current.id}\" within \".agenda-item-agenda\""
end
+
+Given /^agenda item in current agenda$/ do
+ Agenda.create!
+ AgendaItem.create! :agenda => Agenda.last, :title => 'Item in current agenda'
+end
diff --git a/site/features/support/paths.rb b/site/features/support/paths.rb
index 18d72ca..0dc1576 100644
--- a/site/features/support/paths.rb
+++ b/site/features/support/paths.rb
@@ -34,6 +34,10 @@ module NavigationHelpers
when /([1-9]*)th agenda page/
agenda_path(Agenda.find $1)
+
+ when /newest agenda item page/
+ agenda_item_path(AgendaItem.first)
+
# Add more mappings here.
# Here is an example that pulls values out of the Regexp:
#