Class: Sinatra::Xeditable_Select::Select
- Inherits:
 - 
      Sinatra::XeditableAbstract
      
        
- Object
 - Sinatra::XeditableAbstract
 - Sinatra::Xeditable_Select::Select
 
 
- Defined in:
 - lib/sinatra/xeditable_select.rb
 
Instance Attribute Summary collapse
- 
  
    
      #nil_value  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Value that represent the nil option.
 
Instance Method Summary collapse
- #html(id, value) ⇒ Object
 - 
  
    
      #initialize(values, url, html_class)  ⇒ Select 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Select.
 - #xeditable_type ⇒ Object
 
Constructor Details
#initialize(values, url, html_class) ⇒ Select
Returns a new instance of Select.
      51 52 53 54  | 
    
      # File 'lib/sinatra/xeditable_select.rb', line 51 def initialize(values, url, html_class) super(values,url,html_class) @nil_value=::I18n.t(:empty) end  | 
  
Instance Attribute Details
#nil_value ⇒ Object
Value that represent the nil option. If the value incorpored on html method is nil, it will be replaced with this
      49 50 51  | 
    
      # File 'lib/sinatra/xeditable_select.rb', line 49 def nil_value @nil_value end  | 
  
Instance Method Details
#html(id, value) ⇒ Object
      60 61 62 63 64 65 66  | 
    
      # File 'lib/sinatra/xeditable_select.rb', line 60 def html(id, value) value_value = (value && 1 || 0) if [TrueClass, FalseClass].include?(value.class) value_value ||= value.nil? ? nil_value.to_s : value.to_s value_text = value.nil? ? values[nil_value.to_s] : values[value.to_s] return value_text if !active "<a href='#' class='#{html_class}' id='select-#{html_class}-#{id}' data-value='#{value_value}' data-pk='#{id}'>#{value_text}</a>" end  | 
  
#xeditable_type ⇒ Object
      56 57 58  | 
    
      # File 'lib/sinatra/xeditable_select.rb', line 56 def xeditable_type 'select' end  |