Class: ODDB::View::FeedbackPager

Inherits:
HtmlGrid::Composite show all
Defined in:
src/view/feedbacks.rb

Constant Summary

CSS_CLASS =
'component right'
COMPONENTS =
{
  [0,0]   =>  :fb_navigation_prev,
  [1,0] =>  'page_number0',
  [2,0] =>  :current_page,
  [3,0] =>  'page_number1',
  [4,0] =>  :pages,
  [5,0] =>  :fb_navigation_next,
}
LEGACY_INTERFACE =
false
CSS_MAP =
{
  [0,0,6] => 'pager',
}

Instance Method Summary (collapse)

Methods inherited from HtmlGrid::Composite

event_link, #hash_insert_col, #hash_insert_row

Instance Method Details



172
173
174
175
176
177
# File 'src/view/feedbacks.rb', line 172

def create_link(text_key, href)
  link = HtmlGrid::Link.new(text_key, @model, @session, self)
  link.href = href
  link.set_attribute('class', 'fbpager')
  link
end

- (Object) current_page(model)



178
179
180
# File 'src/view/feedbacks.rb', line 178

def current_page(model)
  model.index / 10 + 1
end

- (Object) fb_navigation_next(model)



192
193
194
195
196
197
198
199
200
201
202
# File 'src/view/feedbacks.rb', line 192

def fb_navigation_next(model)
  if(model.has_next?)
    args = {
      :index  => model.next_index
    }
    href = @lookandfeel.event_url(:self, args)
    create_link(:pager_fwd, href)
  else
    @lookandfeel.lookup(:pager_fwd)
  end
end

- (Object) fb_navigation_prev(model)



181
182
183
184
185
186
187
188
189
190
191
# File 'src/view/feedbacks.rb', line 181

def fb_navigation_prev(model)
  if(model.has_prev?)
    args = {
      :index  => model.prev_index
    }
    href = @lookandfeel.event_url(:self, args)
    create_link(:pager_back, href)
  else
    @lookandfeel.lookup(:pager_back)
  end
end

- (Object) pages(model)



203
204
205
# File 'src/view/feedbacks.rb', line 203

def pages(model)
  (model..to_f / model.class::INDEX_STEP.to_f).ceil
end