Class: ODDB::Html::View::Drugs::Admin::SequenceInnerForm

Inherits:
HtmlGrid::Composite
  • Object
show all
Includes:
HtmlGrid::ErrorMessage
Defined in:
lib/oddb/html/view/drugs/admin/sequence.rb

Constant Summary collapse

COLSPAN_MAP =
{
  [1,3] => 3,
  [1,4] => 3,
}
COMPONENTS =
{
  [0,0] => :atc,
  [2,0] => :show_atc_name,
  [0,1] => :registration,
  [1,2,0] => :fachinfo_link,
  [1,2,1] => :patinfo_link,
  [0,3] => :fachinfo_url,
  [0,4] => :patinfo_url,
  [1,5,0] => :submit, 
  [1,5,1] => :delete, 
}
COMPONENT_CSS_MAP =
{
  [1,3] => 'url',
  [1,4] => 'url',
}
LABELS =
true
LEGACY_INTERFACE =
false

Instance Method Summary collapse

Instance Method Details

#atc_name(model) ⇒ Object



191
192
193
# File 'lib/oddb/html/view/drugs/admin/sequence.rb', line 191

def atc_name(model)
  HtmlGrid::InputText.new(:atc_name, model, @session, self)
end

#delete(model) ⇒ Object



194
195
196
197
198
199
200
201
202
203
# File 'lib/oddb/html/view/drugs/admin/sequence.rb', line 194

def delete(model)
  button = HtmlGrid::Button.new(:delete, model, @session, self)
  script = "this.form.event.value = 'delete'; this.form.submit();" 
  if(model.saved?)
    confirm = @lookandfeel.lookup(:delete_sequence_confirm)
    script = "if(confirm('#{confirm}')) { #{script} };"
  end
  button.onclick = script
  button
end


204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/oddb/html/view/drugs/admin/sequence.rb', line 204

def fachinfo_link(model)
  url = if model.respond_to?(:fachinfo) \
           && model.fachinfo.send(@session.language)
          @lookandfeel._event_url(:fachinfo, [:uid, model.uid])
        elsif model.respond_to?(:fachinfo_url)
          model.fachinfo_url
        end
  if url
    link = HtmlGrid::Link.new(:square_fachinfo, model, @session, self)
    link.css_class = 'square fachinfo'
    link.href = url
    link
  end
end

#initObject



184
185
186
187
188
189
190
# File 'lib/oddb/html/view/drugs/admin/sequence.rb', line 184

def init
  if(@session.errors.any? { |err| err.message == "e_unknown_atc" })
    components.store([2,0], :atc_name)
  end
  super
  error_message
end


218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/oddb/html/view/drugs/admin/sequence.rb', line 218

def patinfo_link(model)
  url = if model.respond_to?(:patinfo) && model.patinfo.send(@session.language)
          @lookandfeel._event_url(:patinfo, [:uid, model.uid])
        elsif model.respond_to?(:patinfo_url)
          model.patinfo_url
        end
  if url
    link = HtmlGrid::Link.new(:square_patinfo, model, @session, self)
    link.css_class = 'square patinfo'
    link.href = url
    link
  end
end

#show_atc_name(model) ⇒ Object



231
232
233
234
235
236
237
# File 'lib/oddb/html/view/drugs/admin/sequence.rb', line 231

def show_atc_name(model)
  if(atc = model.atc)
    value = HtmlGrid::Value.new(:atc_name, atc, @session, self)
    value.value = atc.name.de
    value
  end
end