[Borges-users] more on auto-refresh
Слепнев Владимир
slepnev_v at rambler.ru
Fri Apr 9 17:16:37 EDT 2004
Borges rules =))
It seems that frames/iframes are Bad Things, because a) we have to use
JavaScript to refresh which we didn't have to, b) we need to
encapsulate session-specific data explicitly and c) frames screw up
navigation.
After I added the cache-control:no-cache HTTP header to Borges output,
the shopping cart in sushiNet started working OK with the back button.
But another UI flaw emerged: to back out of a store item after
purchasing it, we have to hit back twice. I edited StoreItemView.rb a
little to fix that, and I really like the feel of the new version.
Also, I made a small survey =) I asked two people whether the back
button should erase items from the shopping cart. One said "sure,
yes", and the other said "sure, no". I'm more with the "sure, no"
approach =)
Here's my StoreItemView:
class SushiNet::StoreItemView < Borges::Component
attr_accessor :item
def add_to_cart(n)
n.times {session.add_to_cart(@item)}
end
def initialize(item)
@item = item
end
def render_content_on(r)
r.heading(@item.title)
r.heading_level(@item.subtitle, 3)
r.paragraph(@item.description)
r.div do
r.italic(@item.price.to_cents)
r.space
r.form do
quantity = 0
r.text_input('1') {|q| quantity = q}
r.submit_button('Add to Cart') do
add_to_cart(quantity.to_i)
answer
end
end
end
end
end
Vladimir Slepnev
More information about the Borges-users
mailing list