Module: FlexaLib::Helpers::OtherHelpers

Includes:
ActionView::Helpers::AssetTagHelper
Included in:
FlexaLib::Helpers, TableHelper::BooleanColumn
Defined in:
lib/flexa_lib/helpers/other_helpers.rb

Instance Method Summary collapse

Instance Method Details

#flexa_boolean_grid(status) ⇒ Object



94
95
96
97
98
99
100
101
# File 'lib/flexa_lib/helpers/other_helpers.rb', line 94

def flexa_boolean_grid(status)
  if status
    imagem = 'icon_sucess.gif'
  else
    imagem = 'icon_error.gif'
  end
  image_tag(imagem)
end

#flexa_column(size = "3", &block) ⇒ Object

OTHER_HELPERS



74
75
76
77
78
# File 'lib/flexa_lib/helpers/other_helpers.rb', line 74

def flexa_column(size="3",&block)
   :div, :class=>"span"+size.to_s do
    block.call
  end
end

#flexa_fixed_toolbar(title = "", path = "", &block) ⇒ Object

OTHER_HELPERS



62
63
64
65
66
67
68
69
70
71
# File 'lib/flexa_lib/helpers/other_helpers.rb', line 62

def flexa_fixed_toolbar(title="",path="",&block)
     :header,:class=>"jumbotron subhead" do
         :div,:class=>"subnav subnav-fixed" do
             :ul,:class=>"nav nav-pills", :id=>"overview" do
              concat(flexa_page_title(title, path))  
              block.call  
            end  
        end
    end
end

#flexa_flash_messageObject

OTHER_HELPERS



50
51
52
53
54
55
56
57
58
59
# File 'lib/flexa_lib/helpers/other_helpers.rb', line 50

def flexa_flash_message
  messages = ""
  css_class = {:notice => "success", :info => "info", :warning => "info", :error => "error"}
  [:notice, :info, :warning, :error].each {|type|
    if flash[type]
      messages += ('div',flash[type],:class=>'alert alert-'<<css_class[type.to_sym])
    end
  }
  raw messages
end

#flexa_form_horizontal(&block) ⇒ Object

flexa_form_horizontal

vai gerar uma DIV para aplicar FLOAT:LEFT nos inputs do formulário <%=flexa_form_horizontal do%>

conteudo vai aqui

<%end%>



87
88
89
90
91
# File 'lib/flexa_lib/helpers/other_helpers.rb', line 87

def flexa_form_horizontal(&block)
   :div, :class=>"form_horizontal" do
    block.call
  end
end

#flexa_icon_text(icon, text) ⇒ Object

OTHER_HELPERS



45
46
47
# File 'lib/flexa_lib/helpers/other_helpers.rb', line 45

def flexa_icon_text(icon,text)
  ("i", "",:class=>"icon-"+icon)<<text
end

#flexa_page_title(title, path) ⇒ Object

OTHER_HELPERS



38
39
40
41
42
# File 'lib/flexa_lib/helpers/other_helpers.rb', line 38

def flexa_page_title(title, path)
   :li do
    link_to(("b", title), path)
  end
end

#flexa_search_tool(class_ref, nested_path = nil, path = nil) ⇒ Object

OTHER_HELPERS



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/flexa_lib/helpers/other_helpers.rb', line 10

def flexa_search_tool(class_ref, nested_path = nil, path = nil)
  class_name = class_ref.name.to_s.underscore
  
  if nested_path.nil?
    if path.nil?
      meu_path = send("#{class_name.pluralize}_path")
    else
      meu_path = path
    end
  else
    nested_path = nested_path.name.to_s.underscore
    
    meu_path = send("#{nested_path}_#{class_name.pluralize}_path")
  end

  
   :li do
    form_tag(meu_path, :method=>"get", :id=>"formsearch", :style=>"padding-top:4px;padding-left:50px;",:class=>"form-search") do
      concat(hidden_field_tag :fill, params[:fill])
      concat(text_field_tag :search, params[:search], :class=>"input-medium search-query")
      concat(("button",:type=>"submit",:class=>"btn btn-info",:style=>"margin-left:4px;",:id=>"btn-search") do
        ("i", "",:class=>"icon-search icon-white")
      end)
    end
  end
end

#formata_real(valor) ⇒ Object



104
105
106
# File 'lib/flexa_lib/helpers/other_helpers.rb', line 104

def formata_real(valor)
  number_to_currency(valor, {:separator => ",", :delimiter => ".", :unit => "R$ "})
end