Module: MxitRailsHelper
- Defined in:
- app/helpers/mxit_rails_helper.rb
Instance Method Summary collapse
- #mxit_proceed(content) ⇒ Object
- #mxit_select_row(label, value, selected) ⇒ Object
- #mxit_style(*names) ⇒ Object
- #mxit_table_row(*styles) ⇒ Object
- #mxit_validation_message ⇒ Object
Instance Method Details
#mxit_proceed(content) ⇒ Object
33 34 35 |
# File 'app/helpers/mxit_rails_helper.rb', line 33 def mxit_proceed content "<br /><b style=\"#{ mxit_style :link }\"> > #{content}</b><br />".html_safe end |
#mxit_select_row(label, value, selected) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/helpers/mxit_rails_helper.rb', line 37 def mxit_select_row label, value, selected @_mxit_select_index ||= 0 @_mxit_select_index += 1 target = "#{request.path}?" if @_mxit.multi_select # Which input to modify, and which key to toggle for that input target += "_mxit_rails_multi_select=#{@_mxit.select}&_mxit_rails_multi_select_value=#{value}" else target += "_mxit_rails_submit=true&#{@_mxit.select}=#{value}" end content = selected ? "<b>#{label}</b>" : label output = "<a href=\"#{target}\">" if @_mxit.numbered_list output += "#{@_mxit_select_index})</a> #{content}" else output += "#{label}</a>" output = (selected ? '+ ' : '- ') + output end output += "<br />" output.html_safe end |
#mxit_style(*names) ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/helpers/mxit_rails_helper.rb', line 25 def mxit_style *names content = [] names.each do |name| content << MxitRails::Styles.get(name) || '' end content.join(' ').html_safe end |
#mxit_table_row(*styles) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/helpers/mxit_rails_helper.rb', line 7 def mxit_table_row *styles str = '' if @_mxit.has_table # Close the previous row if there is one str += "<br /></td></tr>" else # Start a new table str += '<table title="mxit:table:full" style="width:100%" name="main_table" cellspacing="0" cellpadding="0">' str += '<colgroup span="1" width="100%"></colgroup>' end @_mxit.has_table = true # Start the new row style = styles.empty? ? mxit_style(:body) : mxit_style(*styles) str += "<tr><td style=\"#{ style }\">" str.html_safe end |
#mxit_validation_message ⇒ Object
3 4 5 |
# File 'app/helpers/mxit_rails_helper.rb', line 3 def @_mxit_validation_messages.first end |