Skip to content

Commit

Permalink
Added legacy predicate in order to distinguish between rich featured …
Browse files Browse the repository at this point in the history
…minutes and, well, legacy stuff. Closes #62
  • Loading branch information
contradictioned committed Jul 31, 2014
1 parent e918a78 commit 59568f3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
3 changes: 2 additions & 1 deletion app/models/minutes/item.rb
Expand Up @@ -47,7 +47,8 @@ def move_down
# and as second item 'approvement of previous minutes'
# This methods enriches the stored items
def full_order
offset = minute.type == nil ? 3 : 2
#offset = minute.type == nil ? 3 : 2
offset = minute.legacy? ? 1 : 3
order + offset
end

Expand Down
8 changes: 7 additions & 1 deletion app/models/minutes/minute.rb
Expand Up @@ -53,10 +53,16 @@ class Minutes::Minute < ActiveRecord::Base
# and as second item 'approvement of previous minutes'
# This methods enriches the stored items by those two.
def item_titles
['Festlegung der Tagesordnung', 'Genehmigung von Protokollen'] + items.pluck(:title)
legacy? ? items.pluck(:title) : ['Festlegung der Tagesordnung', 'Genehmigung von Protokollen'] + items.pluck(:title)
end

validates_presence_of :chairperson_id
validates_presence_of :keeper_of_the_minutes_id
validates_presence_of :date

# All minutes from a meeting before 06.06.2014 are considered legacy.
# These minutes have no default prefixes and this is schade.
def legacy?
date < Date.new(2014, 06, 06)
end
end
3 changes: 2 additions & 1 deletion app/models/minutes/plenum_minute.rb
Expand Up @@ -24,6 +24,7 @@
class Minutes::PlenumMinute < Minutes::Minute

def item_titles
['Genehmigung von Protokollen'] + items.pluck(:title)
prefix = legacy? ? [] : ['Genehmigung von Protokollen']
prefix + items.pluck(:title)
end
end
6 changes: 4 additions & 2 deletions app/views/minutes/minutes/show.html.haml
Expand Up @@ -8,8 +8,10 @@
= render partial: 'meta'
= render partial: 'toplist'

= render partial: 'minutes/items/agenda_item'
= render partial: 'approvements'
- unless @minutes_minute.legacy?
= render partial: 'minutes/items/agenda_item'
= render partial: 'approvements'

= render partial: "minutes/items/item", collection: @minutes_minute.items, as: :item


Expand Down
3 changes: 2 additions & 1 deletion app/views/minutes/plenum_minutes/show.html.haml
Expand Up @@ -8,7 +8,8 @@
= render partial: 'meta'
= render partial: 'toplist'

= render partial: 'minutes/items/agenda_item'
- unless @minutes_minute.legacy?
= render partial: 'minutes/items/agenda_item'
= render partial: "minutes/items/item", collection: @minutes_minute.items, as: :item


Expand Down

0 comments on commit 59568f3

Please sign in to comment.