Sha256: 94675643a32aad19fa021a986e4262300b6d535d4460fe904f8bf6726429cc8c

Contents?: true

Size: 1.75 KB

Versions: 42

Compression:

Stored size: 1.75 KB

Contents

module FlexaLib
  module Helpers
    module ButtonHelpers

      #BUUTTON_HELPERS
      def flexa_cancel_button_to(model)
        model_name = model.class.to_s.underscore
        content_tag :li do
          link_to content_tag("i", "",:class=>"icon-backward")<<' Cancelar', send("#{model_name.pluralize}_path"),:id=>"cancel"
        end
      end
  
      #BUUTTON_HELPERS
      def flexa_edit_button_to(model)
        model_name = model.class.to_s.underscore
        content_tag :li do
          link_to content_tag("i", "",:class=>"icon-pencil")<<' Editar', send("edit_#{model_name}_path",model)
        end
      end
      
      
      #BUUTTON_HELPERS
      def flexa_delete_button_to(model)
        content_tag :li do
          link_to content_tag("i", "",:class=>"icon-minus")<<' Excluir', model, :confirm => 'Deseja realmente excluir?', :method => :delete
        end
      end
      
      #BUUTTON_HELPERS
      def flexa_add_button_to(class_ref)
        class_name = class_ref.name.to_s.underscore
        content_tag :li do
          link_to content_tag("i", "",:class=>"icon-plus")<<" Adicionar", send("new_#{class_name}_path"), :id=>"add"
        end
      end
      
      #BUUTTON_HELPERS
      # para criar botôes genéricos
      def flexa_generic_button_to(text,link,icon="",*args)
        options = args.extract_options!
        if !icon.nil?
          text = raw content_tag("i", "",:class=>"icon-"+icon.to_s)<<" "+text
        end
        content_tag :li do
          link_to text, link, options
        end
      end
      
      #BUUTTON_HELPERS
      def flexa_submit_button(text="Salvar")
        content_tag :li do
          flexa_link_to_submit content_tag("i", "",:class=>"icon-ok")<<" "<<text,:id=>"submit"      
        end
      end
    
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
flexa_lib-0.5.1 lib/flexa_lib/helpers/button_helpers.rb
flexa_lib-0.5.0 lib/flexa_lib/helpers/button_helpers.rb
flexa_lib-0.3.9 lib/flexa_lib/helpers/button_helpers.rb
flexa_lib-0.3.8 lib/flexa_lib/helpers/button_helpers.rb
flexa_lib-0.3.7 lib/flexa_lib/helpers/button_helpers.rb
flexa_lib-0.3.6 lib/flexa_lib/helpers/button_helpers.rb
flexa_lib-0.3.5 lib/flexa_lib/helpers/button_helpers.rb
flexa_lib-0.3.4 lib/flexa_lib/helpers/button_helpers.rb
flexa_lib-0.3.3 lib/flexa_lib/helpers/button_helpers.rb
flexa_lib-0.3.2 lib/flexa_lib/helpers/button_helpers.rb
flexa_lib-0.3.1 lib/flexa_lib/helpers/button_helpers.rb
flexa_lib-0.3.0 lib/flexa_lib/helpers/button_helpers.rb
flexa_lib-0.2.9 lib/flexa_lib/helpers/button_helpers.rb
flexa_lib-0.2.8 lib/flexa_lib/helpers/button_helpers.rb
flexa_lib-0.2.7 lib/flexa_lib/helpers/button_helpers.rb
flexa_lib-0.2.6 lib/flexa_lib/helpers/button_helpers.rb
flexa_lib-0.2.5 lib/flexa_lib/helpers/button_helpers.rb
flexa_lib-0.2.4 lib/flexa_lib/helpers/button_helpers.rb
flexa_lib-0.2.3 lib/flexa_lib/helpers/button_helpers.rb
flexa_lib-0.2.2 lib/flexa_lib/helpers/button_helpers.rb