Skip to content

Commit

Permalink
[#889] count value is displaying count of page rather than of collection
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanlarsen committed Mar 11, 2011
1 parent 5c4db45 commit 090ac14
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions hobo/lib/hobo/rapid/generators/rapid/pages.dryml.erb
Expand Up @@ -33,7 +33,7 @@ model_key = model.to_s.underscore
</h2>

<p param="count" if>
<ht key="<%= model_key %>.collection.count" count="&this.size">
<ht key="<%= model_key %>.collection.count" count="&collection_count">
<count summary/>
</ht>
</p>
Expand Down Expand Up @@ -306,7 +306,7 @@ new_link = :new.in?(actions)
</h3>
<% end -%>
<p param="count" if>
<ht key="<%= model_key %>.collection.count" count="&this.size">
<ht key="<%= model_key %>.collection.count" count="&collection_count">
<count summary/>
</ht>
</p>
Expand Down
5 changes: 4 additions & 1 deletion hobo/lib/hobo/rapid/helper.rb
Expand Up @@ -102,7 +102,10 @@ def no_break(s)
s.gsub(' ', '&nbsp;')
end


# returns the number of items in the collection. See LH #889
def collection_count
this.try.to_int || this.try.total_entries || (this.try.loaded? && this.try.length) || this.try.count || this.try.length
end


def in_place_editor(attributes, this=nil)
Expand Down

0 comments on commit 090ac14

Please sign in to comment.