Class: HtmlCom::MindWordsWidget

Inherits:
Object
  • Object
show all
Defined in:
lib/htmlcom.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ MindWordsWidget

Returns a new instance of MindWordsWidget.



299
300
301
302
303
304
305
306
307
# File 'lib/htmlcom.rb', line 299

def initialize(attributes)

  @attributes = {
    content: '',
    action: 'mwupdate',
    target: 'icontent'
  }.merge(attributes)

end

Instance Method Details

#input(params = {}) ⇒ Object



309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# File 'lib/htmlcom.rb', line 309

def input(params={})

  h = @attributes.merge(params)
  content = h[:content]
  action = h[:action]
  target = h[:target]

@html ="<form action='\#{action}' method='post' target='\#{target}'>\n  <textarea name='content' cols='30' rows='19'>\n\#{content}\n  </textarea>\n  <input type='submit' value='Submit'/>\n</form>\n"
  self

end

#to_htmlObject



328
329
330
# File 'lib/htmlcom.rb', line 328

def to_html()
  @html
end