Class: ODDB::View::DescriptionForm

Inherits:
Form
  • Object
show all
Includes:
HtmlGrid::ErrorMessage
Defined in:
src/view/descriptionform.rb

Direct Known Subclasses

Admin::AtcClassForm, Admin::CommercialFormForm, Admin::GalenicFormForm, Admin::GalenicGroupForm, Admin::IndicationForm, Substances::DescriptionForm, TestDescription::StubExtendedDescriptionForm

Constant Summary

COMPONENTS =
{}
DELETE_BUTTON =
true
DEFAULT_CLASS =
HtmlGrid::InputText
DESCRIPTION_CSS =
nil
EVENT =
:update
LABELS =
true

Constants included from FormMethods

ACCEPT_CHARSET, DEFAULT_CLASS, EVENT

Instance Method Summary (collapse)

Methods included from FormMethods

#delete_item, #delete_item_warn, #get_event_button, #post_event_button

Instance Method Details

- (Object) init



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'src/view/descriptionform.rb', line 20

def init
  index=0
  self.languages.each_with_index { |language, index|
    components.store([0,index], language.intern)
    if(descr_css = self::class::DESCRIPTION_CSS)
      component_css_map.store([1,index], descr_css)
    end
  }
  super
  @grid.add_style('list', 0, 0, 2, @grid.height)
  @grid.add(HtmlGrid::Submit.new(self::class::EVENT, @model, @session, self), 1, index.next)
  if(self::class::DELETE_BUTTON)
    button = HtmlGrid::Button.new(:delete, @model, @session, self)
    button.set_attribute("onclick", "form.event.value='delete'; form.submit();")
    @grid.add(button, 1, index.next)
  end
  error_message()
end

- (Object) languages



38
39
40
# File 'src/view/descriptionform.rb', line 38

def languages
  @lookandfeel.languages
end

- (Object) synonym_list(model, session)



41
42
43
44
45
46
47
# File 'src/view/descriptionform.rb', line 41

def synonym_list(model, session)
  input = DEFAULT_CLASS.new(:synonym_list, model, session, self)
  if(syns = model.synonyms)
    input.value = syns.join(', ')
  end
  input
end