flexa_lib 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@ require 'flexa_lib/version'
7
7
  Gem::Specification.new do |s|
8
8
  s.name = 'flexa_lib'
9
9
  # s.version = FlexaLib::VERSION
10
- s.version = '0.5.1'
10
+ s.version = '0.5.2'
11
11
  s.platform = Gem::Platform::RUBY
12
12
 
13
13
  s.authors = ['Allan Freitas','Marcio Sfalsin']
@@ -11,10 +11,17 @@ module FlexaLib
11
11
  end
12
12
 
13
13
  #BUUTTON_HELPERS
14
- def flexa_edit_button_to(model)
14
+ def flexa_edit_button_to(model, path=nil)
15
15
  model_name = model.class.to_s.underscore
16
+
17
+ if path.nil?
18
+ path_link = "edit_#{model_name}_path"
19
+ else
20
+ path_link = path
21
+ end
22
+
16
23
  content_tag :li do
17
- link_to content_tag("i", "",:class=>"icon-pencil")<<' Editar', send("edit_#{model_name}_path",model)
24
+ link_to content_tag("i", "",:class=>"icon-pencil")<<' Editar', send(path_link, model)
18
25
  end
19
26
  end
20
27
 
@@ -27,10 +34,15 @@ module FlexaLib
27
34
  end
28
35
 
29
36
  #BUUTTON_HELPERS
30
- def flexa_add_button_to(class_ref)
37
+ def flexa_add_button_to(class_ref,path=nil)
31
38
  class_name = class_ref.name.to_s.underscore
39
+ if path.nil?
40
+ path_link = "new_#{class_name}_path"
41
+ else
42
+ path_link = path
43
+ end
32
44
  content_tag :li do
33
- link_to content_tag("i", "",:class=>"icon-plus")<<" Adicionar", send("new_#{class_name}_path"), :id=>"add"
45
+ link_to content_tag("i", "",:class=>"icon-plus")<<" Adicionar", send(path_link), :id=>"add"
34
46
  end
35
47
  end
36
48
 
@@ -2,25 +2,30 @@ module FlexaLib
2
2
  module Helpers
3
3
  module CocoonHelpers
4
4
 
5
-
6
- def flexa_form_nested_item_box(parent_form,child_resource,readonly=false,&block)
5
+ def flexa_form_nested_item_box(parent_form, child_resource, readonly=false, &block)
7
6
 
8
7
  nested_form_view = child_resource.to_s.singularize << '_fields'
9
8
 
10
9
  if !readonly
11
- (content_tag :div, :id=>child_resource.to_s, :class=>"form_horizontal" do
12
- parent_form.semantic_fields_for(child_resource.to_sym) do |fp|
13
- render :partial => nested_form_view, :locals =>{:f => fp},:render_options => {:wrapper => 'inline' }
14
- end
10
+ content_tag :div do
11
+ concat(content_tag :div, :id=>child_resource.to_s, :class=>"form_horizontal" do
12
+
13
+ parent_form.semantic_fields_for(child_resource.to_sym) do |fp|
14
+ render :partial => nested_form_view, :locals =>{:f => fp},:render_options => {:wrapper => 'inline' }
15
+ end
16
+
15
17
  #block.call
16
- end)+flexa_form_add_button(parent_form,child_resource.to_sym)
18
+ end) + concat(flexa_form_add_button(parent_form,child_resource.to_sym))
19
+ end #fim da div que engloba os Itens e o BOTAO
17
20
  else
21
+ content_tag :div do
18
22
  content_tag :div, :id=>child_resource.to_s, :class=>"form_horizontal" do
19
23
  parent_form.semantic_fields_for(child_resource.to_sym) do |fp|
20
24
  render :partial => nested_form_view, :locals =>{:f => fp},:render_options => {:wrapper => 'inline' }
21
25
  end
22
26
  #block.call
23
27
  end
28
+ end #fim da div que engloba os Itens e o BOTAO
24
29
  end
25
30
  end
26
31
 
@@ -7,16 +7,21 @@ module FlexaLib
7
7
  include ActionView::Helpers::AssetTagHelper
8
8
 
9
9
  #OTHER_HELPERS
10
- def flexa_search_tool(class_ref, nested_path = nil)
10
+ def flexa_search_tool(class_ref, nested_path = nil, path = nil)
11
11
  class_name = class_ref.name.to_s.underscore
12
12
 
13
13
  if nested_path.nil?
14
- meu_path = send("#{class_name.pluralize}_path")
14
+ if path.nil?
15
+ meu_path = send("#{class_name.pluralize}_path")
16
+ else
17
+ meu_path = path
18
+ end
15
19
  else
16
20
  nested_path = nested_path.name.to_s.underscore
17
21
 
18
22
  meu_path = send("#{nested_path}_#{class_name.pluralize}_path")
19
23
  end
24
+
20
25
 
21
26
  content_tag :li do
22
27
  form_tag(meu_path, :method=>"get", :id=>"formsearch", :style=>"padding-top:4px;padding-left:50px;",:class=>"form-search") do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flexa_lib
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 1
10
- version: 0.5.1
9
+ - 2
10
+ version: 0.5.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Allan Freitas
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-04-18 00:00:00 Z
19
+ date: 2012-04-30 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: sass-rails