def draw_bitset(f, col, bitset=nil, options={})
      html          = ''
      bitset        = model.const_get(col_name.to_s.camelize + 'Bitset') if !bitset
      i             = 0
      id_array_var  = sprintf('%s_%s_var', f.object_name, col.name)
      ids           = []
      for flag in bitset.constants do
        checkbox_id = sprintf('%s_%s_%d', f.object_name, col.name, i)
        html += draw_checkbox(f, checkbox_id, flag, bitset, id_array_var) +
                label_tag(
                    checkbox_id,
                    f.object.class.human_const_name(bitset, flag)) +
                '&nbsp;&nbsp;'.html_safe
        ids << checkbox_id
        i += 1
      end
      # draw hidden field to send sum-up value
      html += f.hidden_field(col.name)

      # add hidden-field name to ids' last
      ids << sprintf("%s_%s", f.object_name, col.name)

      # define arrays to calculate flags
      html += "<script> var #{id_array_var}=[" +
                    ids.map{|id| "'" + id + "'"}.join(',') +
                "];</script>"
      html.html_safe
    end
def draw_bitset(f, col, bitset=nil, options={})
      html          = ''
      bitset        = model.const_get(col_name.to_s.camelize + 'Bitset') if !bitset
      i             = 0
      id_array_var  = sprintf('%s_%s_var', f.object_name, col.name)
      ids           = []
      for flag in bitset.constants do
        checkbox_id = sprintf('%s_%s_%d', f.object_name, col.name, i)
        html += draw_checkbox(f, checkbox_id, flag, bitset, id_array_var) +
                label_tag(
                    checkbox_id,
                    f.object.class.human_const_name(bitset, flag)) +
                '&nbsp;&nbsp;'.html_safe
        ids << checkbox_id
        i += 1
      end
      # draw hidden field to send sum-up value
      html += f.hidden_field(col.name)

      # add hidden-field name to ids' last
      ids << sprintf("%s_%s", f.object_name, col.name)

      # define arrays to calculate flags
      html += "<script> var #{id_array_var}=[" +
                    ids.map{|id| "'" + id + "'"}.join(',') +
                "];</script>"
      html.html_safe
    end
draw bitset checkboxes.

 When model class has integer field (e.g. 'flags') and
 Flags module which defines 'bitflag' constant,
 model.flags integer column is drawn as bitset checkboxes.
 Constant name will be translated by config/locales/*.yml
 See ModelPermission for example.

 'flags' column value is calculated at client side by JavaScript.

 options is not used now.

 === INPUTS
 f::       Form builder object.
 col::     column object returned by rec.class.columns, or symbol
 bitset::  ruby module contains 'bitflag' integer constants
 options:: (not used)