carnival 0.0.43 → 0.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2326,6 +2326,6 @@ table input{
2326
2326
  width: 95%;
2327
2327
  }
2328
2328
 
2329
- .checkbox{
2329
+ .existing-options span{
2330
2330
  float: left;
2331
2331
  }
@@ -124,7 +124,7 @@ module Carnival
124
124
 
125
125
  date_filter_field = @presenter.date_filter_field
126
126
  if(date_filter_field.present? && params[:from].present? && params[:from] != "" && params[:to].present? && params[:to] != "")
127
- @model = @model.where("#{@presenter.table_name}.#{date_filter_field.name} between ? and ?", "#{params[:from]} 00:00:00", "#{params[:to]} 23:59:59")
127
+ records = records.where("#{@presenter.table_name}.#{date_filter_field.name} between ? and ?", "#{params[:from]} 00:00:00", "#{params[:to]} 23:59:59")
128
128
  add_filter 'Período',"#{params[:from]} - #{params[:to]}"
129
129
  end
130
130
 
@@ -19,5 +19,10 @@ module Carnival::ModelHelper
19
19
  end
20
20
  select
21
21
  end
22
+
23
+ def to_label_options
24
+ label = column_names.select { |column| column.eql?("name")}
25
+ label.empty? ? column_names.fetch(1).to_sym : label.first.to_sym
26
+ end
22
27
  end
23
28
  end
@@ -11,7 +11,7 @@
11
11
  nestedForms[getFormName(element)] = element;
12
12
  element.remove();
13
13
  });
14
-
14
+
15
15
  $(".existing-options").hide();
16
16
  $(".nested-form-subtitle").hide();
17
17
  });
@@ -52,6 +52,6 @@
52
52
  $(".existing-options").toggle();
53
53
  }
54
54
 
55
- function renderSelectOptions(){
56
- $(".existing-options").show();
55
+ function renderSelectOptions(selector){
56
+ $(selector).show();
57
57
  }
@@ -21,12 +21,13 @@
21
21
 
22
22
  - if field.nested_form_modes?(:associate)
23
23
  = " | "
24
- = link_to_function t("nested_form.existing_option"), "renderSelectOptions()"
25
-
26
- .existing-options
24
+ = link_to_function t("nested_form.existing_option"), "renderSelectOptions('.existing-options.#{field.name}')"
25
+
26
+ .existing-options{:class => field.name}
27
27
  %h4.existing-options-title
28
28
  = t("nested_form.existing_option_title")
29
- = f.association field.name.to_sym, as: :check_boxes,label: false
29
+ - field_presenter = model_presenter.presenter_to_field(field, nil)
30
+ = f.collection_check_boxes "#{field.name.singularize.to_sym}_ids".to_sym, field_presenter.model_class.send("all"), :id, field_presenter.model_class.to_label_options
30
31
 
31
32
  %ul.nested-form-list{:class => field.name}
32
33
  %h4.nested-form-subtitle
@@ -1,3 +1,3 @@
1
1
  module Carnival
2
- VERSION = "0.0.43"
2
+ VERSION = "0.0.44"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carnival
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.43
4
+ version: 0.0.44
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-24 00:00:00.000000000 Z
12
+ date: 2014-04-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails