Module: ODDB::View::FormMethods

Includes:
HiddenPointer
Included in:
Admin::PackageForm, Admin::RootPackageComposite, Admin::RootSequenceForm, Admin::SequenceForm, Form
Defined in:
src/view/form.rb

Constant Summary

ACCEPT_CHARSET =
'UTF-8'
DEFAULT_CLASS =
HtmlGrid::InputText
EVENT =
:update

Instance Method Summary (collapse)

Instance Method Details

- (Object) delete_item(model, session = @session)



27
28
29
30
31
32
33
# File 'src/view/form.rb', line 27

def delete_item(model, session=@session)
  unless(@model.is_a? Persistence::CreateItem)
    button = HtmlGrid::Button.new(:delete, model, session, self)
    button.set_attribute("onclick", "form.event.value='delete'; form.submit();")
    button
  end
end

- (Object) delete_item_warn(model, warning)



34
35
36
37
38
39
40
41
42
43
# File 'src/view/form.rb', line 34

def delete_item_warn(model, warning)
  unless(@model.is_a? Persistence::CreateItem)
    button = HtmlGrid::Button.new(:delete, model, @session, self)
    warning = @lookandfeel.lookup(warning)
    script = "if(confirm('#{warning}')) "
    script << "{ form.event.value='delete'; form.submit(); }"
    button.set_attribute("onclick", script)
    button
  end
end

- (Object) get_event_button(event, params = {})



50
51
52
53
54
55
56
# File 'src/view/form.rb', line 50

def get_event_button(event, params={})
  button = HtmlGrid::Button.new(event, @model, @session, self)
  url = @lookandfeel._event_url(event, params) 
  script = "document.location.href='#{url}';"
  button.set_attribute("onclick", script)
  button
end

- (Object) post_event_button(event)



44
45
46
47
48
49
# File 'src/view/form.rb', line 44

def post_event_button(event)
  button = HtmlGrid::Button.new(event, @model, @session, self)
  script = "this.form.event.value='"+event.to_s+"'; this.form.submit();"
  button.set_attribute("onclick", script)
  button
end