Class: ODDB::Html::View::Drugs::FeedbackList

Inherits:
List
  • Object
show all
Defined in:
lib/oddb/html/view/drugs/feedback.rb

Constant Summary collapse

COLSPAN_MAP =
{ [0,0] => 2 }
COMPONENTS =
{
  [0,0] => :name,
  [0,1] => :email,
  [0,2] => :message,
}
CSS_MAP =
{
  [0,2] => 'top',
}
LABELS =
true
LOOKANDFEEL_MAP =
{
  :message => :feedback,
}
OFFSET_STEP =
[0,7]
OMIT_HEADER =
true

Constants inherited from List

List::BACKGROUND_ROW, List::BACKGROUND_SUFFIX, List::LEGACY_INTERFACE, List::SORT_DEFAULT

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from List

#query_args, #query_key, #sort_link

Class Method Details

.boolean(ypos, key) ⇒ Object



22
23
24
25
# File 'lib/oddb/html/view/drugs/feedback.rb', line 22

def boolean ypos, key
  components.update( [0, ypos] => key ) 
  define_method(key) { |model| boolean model.send(key) }
end

.componentsObject



26
27
28
# File 'lib/oddb/html/view/drugs/feedback.rb', line 26

def components
  @components ||= {}
end

Instance Method Details

#boolean(bool) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/oddb/html/view/drugs/feedback.rb', line 53

def boolean(bool)
  div = HtmlGrid::Div.new(bool, @session, self)
  css = 'square '
  if(bool)
    div.value = '+'
    css << 'plus'
  else
    div.value = '-'
    css << 'minus'
  end
  div.css_class = css
  div.label = true
  div
end

#email(model) ⇒ Object



67
68
69
70
71
72
73
# File 'lib/oddb/html/view/drugs/feedback.rb', line 67

def email(model)
  value = HtmlGrid::Value.new(:email, model, @session, self)
  if(!model.email_public)
    value.value = @lookandfeel.lookup(:email_not_public)
  end
  value
end

#initObject



49
50
51
52
# File 'lib/oddb/html/view/drugs/feedback.rb', line 49

def init
  components.update self.class.components
  super
end

#name(model) ⇒ Object



74
75
76
77
# File 'lib/oddb/html/view/drugs/feedback.rb', line 74

def name(model)
  @lookandfeel.lookup(:feedback_by, model.name, 
                      model.time.strftime("%A, %d. %B %Y - %H:%M"))
end