inline_forms 1.6.50 → 1.6.51

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YmM5OGMyYjhjODgxODNhNzk4MWQxZGUyZWYyMzlkZjExYmI5MDNjNg==
4
+ YzJiZTRmZmVlYzA5OTVkNGFhMDE4ZGZmMGI1MGI5MzY0MTA2N2QwYQ==
5
5
  data.tar.gz: !binary |-
6
- MTcxMzM0NDI4MmFjOTFiNjZmOWRlOTQ5YmFkNWFkMjA4ZGIyNTk5Ng==
6
+ ZDIyZDhjMTUxNmQyOTk0M2ViNzkyY2M5YjFiZDhjYTY2NTA4Y2VhMQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDQ2ZTc1MWU0ZTVjOWMyM2NmODUyYzdiNWFhNGQ5YjE1MjEyYTUzNDlhOTgx
10
- YzI2YWYwZTcwYmU5ZGM0MjY5NDgzYmQxMzZiNDcwMmRhYzIxNWFlYjJjMTlk
11
- ZDA1OGJhNGE3NWE2NDFkZGQ2ZTkyY2IzY2E4YjY5NzdjMjY4NTI=
9
+ NGEyYWViNjA5YzE0MmZhYWFjM2ZkZDAxYjQyZTI4MjM1ZmZkYzdlNmVkYzlj
10
+ OWExZDg1NGE5NWM0NTE4YTI3ZGYxYThkNDY2YmVmYWU2NjQ1NjMxZTdlODc5
11
+ YjRlYjI2Mjg0YzMyNzBlOTkzZjA1YWYwZWRlNDA1Y2EzZThmNmM=
12
12
  data.tar.gz: !binary |-
13
- ZDMxNjQ3YTJlZTQ3ZDVmZDZiNzRiMjRiNGJkMzdiMTY1YjE3NzUwMzI0MGVm
14
- MTcwZTZjNDRlZTY4OTJkMGVlMzVkY2Y2NmI0M2ZhOWU3NmRiMmI4YzBiODhi
15
- MDM2NjE0MTM2NjA1NDc0YTlkZTE0Mjc3MzVjMTJmZWYwNmM4YWE=
13
+ MDBlYmVhNWU1ZDBlOWQyNzQyMWMzYjBlZGM2MzY5ZDdkMmE1YTAxMjhhMTcz
14
+ MTE1MTNlYWRmOGQxOGFkNTJlOWQyMTcyYzk3M2YwOGU2YzJjYjE5ZTk4MWFk
15
+ MDVkOWJlNjU1ZjgwNTkxZDI4YWZhOWMzY2JmNTgwMmYwYTNhNDk=
@@ -1,6 +1,14 @@
1
+ $(document).foundation();
2
+
1
3
  $(document).ready(function() {
4
+ // initialize datepickers
5
+ $.datepicker.setDefaults({
6
+ changeMonth : true,
7
+ changeYear : true,
8
+ yearRange: '-100:+1'
9
+ });
2
10
  // get rid of translation_missing tooltips
3
- $(this).on("mouseover", ".translation_missing", function() {
4
- $(this).attr('title', '');
5
- });
11
+ $(this).on("mouseover", ".translation_missing", function() {
12
+ $(this).attr('title', '');
13
+ });
6
14
  });
@@ -6,11 +6,11 @@
6
6
  //
7
7
  //= require jquery
8
8
  //= require jquery_ujs
9
+ //= require jquery.ui.all
10
+ //= require jquery.ui.datepicker-nl.js
9
11
  //= require foundation
10
- //= require foundation-datetimepicker
11
12
  //= require jquery-scrollto
12
13
  //= require jquery.remotipart
13
14
  //= require ckeditor/init
14
15
  //= require inline_forms
15
16
 
16
- $(document).foundation();
@@ -63,21 +63,6 @@
63
63
  font-family: monospace;
64
64
  }
65
65
 
66
- .ui-tooltip-content ul {
67
- padding: 0;
68
- margin: 0;
69
- list-style-type: none;
70
- }
71
-
72
- .ui-tooltip-content ul li {
73
- margin-left: 20px;
74
- }
75
-
76
- .ui-tooltip-content ul li:first-letter
77
- {
78
- margin-left: -20px;
79
- }
80
-
81
66
 
82
67
  /* LEFT */
83
68
 
@@ -2,5 +2,6 @@
2
2
  * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
3
  * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
4
  * the top of the compiled file, but it's generally better to create a new file per style scope.
5
- *= require 'inline_forms'
5
+ *
6
+ *= require inline_forms
6
7
  */
@@ -4,7 +4,7 @@ InlineForms::SPECIAL_COLUMN_TYPES[:check_list]=:no_migration
4
4
  # checklist
5
5
  def check_list_show(object, attribute)
6
6
  out = '<ul class="checklist">'
7
- out << link_to_inline_edit(object, attribute) if object.send(attribute).empty?
7
+ out << link_to_inline_edit(object, attribute, "<i class='fi-plus'></i>".html_safe) if object.send(attribute).empty?
8
8
  object.send(attribute).sort.each do | item |
9
9
  out << '<li>'
10
10
  out << link_to_inline_edit(object, attribute, item._presentation )
@@ -21,19 +21,13 @@ def check_list_edit(object, attribute)
21
21
  else
22
22
  values = object.send(attribute).first.class.name.constantize.order(attribute.to_s.singularize.camelcase.constantize.order_by_clause)
23
23
  end
24
- out = '<div class="edit_form_checklist">'
25
- out << '<ul>'
24
+ out = ''
26
25
  values.each do | item |
27
- out << '<li>'
26
+ out << "<div class='row #{cycle('odd', 'even')}'>"
28
27
  out << check_box_tag( attribute.to_s + '[' + item.id.to_s + ']', 1, object.send(attribute.to_s.singularize + "_ids").include?(item.id) )
29
- out << '<div class="edit_form_checklist_text">'
30
- out << h(item._presentation)
28
+ out << "<label for=#{attribute.to_s + '[' + item.id.to_s + ']'}>#{h(item._presentation)}</label>"
31
29
  out << '</div>'
32
- out << '<div style="clear: both;"></div>'
33
- out << '</li>'
34
30
  end
35
- out << '</ul>'
36
- out << '</div>'
37
31
  out.html_safe
38
32
  end
39
33
 
@@ -3,13 +3,13 @@ InlineForms::SPECIAL_COLUMN_TYPES[:date_select]=:date
3
3
 
4
4
  # date
5
5
  def date_select_show(object, attribute)
6
- link_to_inline_edit object, attribute, object.send(attribute).nil? ? "" : object.send(attribute).strftime("%d-%m-%Y")
6
+ link_to_inline_edit object, attribute, object.send(attribute).nil? ? "<i class='fi-plus'></i>".html_safe : object.send(attribute).strftime("%d-%m-%Y")
7
7
  end
8
8
 
9
9
  def date_select_edit(object, attribute)
10
10
  css_id = 'datepicker_' + object.class.to_s.underscore + '_' + object.id.to_s + '_' + attribute.to_s
11
11
  out = text_field_tag attribute, ( object.send(attribute).nil? ? "" : object.send(attribute).strftime("%d-%m-%Y") ), :id => css_id, :class =>'datepicker'
12
- out << "<script>$('##{css_id}').fdatepicker();</script>".html_safe
12
+ out << "<script>$('##{css_id}').datepicker();</script>".html_safe
13
13
  end
14
14
 
15
15
  def date_select_update(object, attribute)
@@ -3,7 +3,7 @@ InlineForms::SPECIAL_COLUMN_TYPES[:dropdown]=:belongs_to
3
3
 
4
4
  # dropdown
5
5
  def dropdown_show(object, attribute)
6
- attribute_value = object.send(attribute)._presentation rescue nil
6
+ attribute_value = object.send(attribute)._presentation rescue "<i class='fi-plus'></i>".html_safe
7
7
  link_to_inline_edit object, attribute, attribute_value
8
8
  end
9
9
 
@@ -4,7 +4,7 @@ InlineForms::SPECIAL_COLUMN_TYPES[:dropdown_with_values]=:integer
4
4
  # dropdown_with_values
5
5
  def dropdown_with_values_show(object, attribute)
6
6
  values = attribute_values(object, attribute)
7
- link_to_inline_edit object, attribute, object.send(attribute) ? values.assoc(object.send(attribute))[1] : ""
7
+ link_to_inline_edit object, attribute, object.send(attribute) ? values.assoc(object.send(attribute))[1] : "<i class='fi-plus'></i>".html_safe
8
8
  end
9
9
  def dropdown_with_values_edit(object, attribute)
10
10
  # the leading underscore is to avoid name conflicts, like 'email' and 'email_type' will result in 'email' and 'email[email_type_id]' in the form!
@@ -2,7 +2,7 @@
2
2
  InlineForms::SPECIAL_COLUMN_TYPES[:plain_text_area]=:text
3
3
 
4
4
  def plain_text_area_show(object, attribute)
5
- link_to_inline_edit object, attribute, object[attribute] #.empty? ? 'Click here to edit' : object[attribute]
5
+ link_to_inline_edit object, attribute, (object[attribute].nil? || object[attribute].empty?) ? "<i class='fi-plus'></i>".html_safe : object[attribute]
6
6
  end
7
7
 
8
8
  def plain_text_area_edit(object, attribute)
@@ -10,16 +10,15 @@ def radio_button_show(object, attribute)
10
10
  end
11
11
 
12
12
  def radio_button_edit(object, attribute)
13
- out ='<ul class="radio_list">'
13
+ out =''
14
14
  values = attribute_values(object, attribute)
15
15
  values.each do |key,value|
16
- out << '<li>'
16
+ out << "<div class='row #{cycle('odd', 'even')}'>"
17
17
  out << radio_button_tag(attribute.to_s, key, key == object.send(attribute))
18
- out << value
19
- out << '</li>'
18
+ out << "<label for=#{key}>#{value}</label>"
19
+ out << '</div>'
20
20
  end
21
- out << '</ul>'
22
- raw out
21
+ out.html_safe
23
22
  end
24
23
 
25
24
  def radio_button_update(object, attribute)
@@ -2,7 +2,7 @@
2
2
  InlineForms::SPECIAL_COLUMN_TYPES[:text_area_without_ckeditor]=:text
3
3
 
4
4
  def text_area_without_ckeditor_show(object, attribute)
5
- link_to_inline_edit object, attribute, object[attribute]
5
+ link_to_inline_edit object, attribute, (object[attribute].nil? || object[attribute].empty?) ? "<i class='fi-plus'></i>".html_safe : object[attribute]
6
6
  end
7
7
 
8
8
  def text_area_without_ckeditor_edit(object, attribute)
@@ -2,7 +2,7 @@
2
2
  InlineForms::SPECIAL_COLUMN_TYPES[:text_field]=:string
3
3
 
4
4
  def text_field_show(object, attribute)
5
- link_to_inline_edit object, attribute, (object.send attribute.to_sym)
5
+ link_to_inline_edit object, attribute, (object[attribute].nil? || object[attribute].empty?) ? "<i class='fi-plus'></i>".html_safe : object[attribute]
6
6
  end
7
7
 
8
8
  def text_field_edit(object, attribute)
@@ -1,4 +1,4 @@
1
- <div class="new_record">
1
+ <div class="new_record"">
2
2
  <% flash.each do |key, value| %>
3
3
  <div id="flash" class="flash <%= key %>">
4
4
  <ul>
@@ -10,16 +10,13 @@
10
10
  </ul>
11
11
  </div>
12
12
  <% end %>
13
- <script type="text/javascript">
14
- $(function() {
15
- $("#flash").delay(1000).fadeTo('slow', 0.33);
16
- });
17
- </script>
13
+
18
14
  <div class="row" >
19
15
  <div class="large-12 column object_presentation" >
20
16
  <%= t('inline_forms.view.add_new', :model => @Klass.model_name.human ) -%>
21
17
  </div>
22
18
  </div>
19
+
23
20
  <%= form_tag send(@Klass.to_s.underscore.pluralize + '_path', :update => @update_span,
24
21
  :parent_class => @parent_class,
25
22
  :parent_id => @parent_id ),
@@ -61,9 +58,4 @@
61
58
  </div>
62
59
  <div class="row record_footer"></div>
63
60
  <% end %>
64
- <script type="text/javascript">
65
- $(function() {
66
- $("#new_record").slideDown(4000);
67
- });
68
- </script>
69
61
  </div>
@@ -0,0 +1,43 @@
1
+ This goes in _new.html.erb
2
+ <% if form_element.to_sym == :associated -%>
3
+ <% @nested_model = @object.send(attribute) %>
4
+ <%= render 'new_nested' %>
5
+ <% end %>
6
+ ********
7
+
8
+ <% @nested_object = @nested_model.build %>
9
+
10
+ <div class="new_nested_record">
11
+ <div class="row" >
12
+ <div class="large-12 column object_presentation" >
13
+ <%= t('inline_forms.view.add_new', :model => @nested_object.class ) -%>
14
+ </div>
15
+ </div>
16
+ <% nested_attributes = @nested_object.inline_forms_attribute_list -%>
17
+ <% nested_attributes.each do | nested_attribute, nested_name, nested_form_element | -%>
18
+ <% @nested_form_element = nested_form_element %>
19
+ <% @nested_attribute = nested_attribute %>
20
+ <% unless @nested_form_element.to_sym == :associated -%>
21
+ <% if @nested_form_element == :header %>
22
+ <div class="row form_element_header" >
23
+ <div class='large-12 column' >
24
+ <%= @nested_object.class.human_attribute_name(@nested_attribute) -%>
25
+ </div>
26
+ </div>
27
+ <% else %>
28
+ <div class="row <%= cycle('odd', 'even') %>">
29
+ <div class='medium-3 large-3 column' >
30
+ <%= @nested_object.class.human_attribute_name(@nested_attribute) -%>
31
+ </div>
32
+ <div class='medium-9 large-9 column' >
33
+ <%= send("#{@nested_form_element}_edit", @nested_object, @nested_attribute) -%>
34
+ </div>
35
+ </div>
36
+ <% end -%>
37
+ <% end -%>
38
+ <% end -%>
39
+ <% if @nested_form_element.to_sym == :associated -%>
40
+ <%= render 'new_nested' %>
41
+ <% end %>
42
+ <div class="row record_footer"></div>
43
+ </div>
@@ -1,60 +1,64 @@
1
- <% unless @skip %>
2
- <div class="row object_presentation">
3
- <div class="small-11 column object_presentation">
4
- <%= h(@object._presentation) -%>
5
- </div>
6
- <div class="small-1 column close_link" >
7
- <%= close_link(@object, @update_span) -%>
8
- </div>
9
- </div>
10
- <% end %>
11
- <% attributes = @inline_forms_attribute_list || @object.inline_forms_attribute_list -%>
12
- <% attributes.each do | attribute, name, form_element | -%>
13
- <% if cancan_disabled? || can?(:read, @object, attribute) %>
14
- <% css_class_id = "#{@object.class.name.underscore}_#{@object.id}_#{attribute}" -%>
15
- <% if form_element == :header %>
16
- <div class="row form_element_header">
17
- <div class='large-12 column' >
18
- <%= @object.class.human_attribute_name(attribute) -%>
19
- </div>
1
+ <div class="row">
2
+ <div class='small-11 small-centered column'>
3
+ <% unless @skip %>
4
+ <div class="row object_presentation">
5
+ <div class="small-11 column object_presentation">
6
+ <%= h(@object._presentation) -%>
7
+ </div>
8
+ <div class="small-1 column close_link" >
9
+ <%= close_link(@object, @update_span) -%>
20
10
  </div>
21
- <% else %>
22
- <% if form_element == :associated -%>
23
- <div class="row form_element_header associated_auto_header" id="<%= css_class_id -%>_list_auto_header" >
24
- <div class='medium-11 large-11 column' >
25
- <%= @object.class.human_attribute_name(attribute) -%>
26
- </div>
27
- <div class='medium-1 large-1 column'>
28
- <%= link_to_new_record(attribute.to_s.singularize.camelcase.constantize, "new_#{attribute.to_s.underscore.singularize}_path", css_class_id, @object.class, @object.id) -%>
29
- </div>
30
- </div>
31
- <div class="row <%= cycle('odd', 'even') %>">
32
- <div id="<%= css_class_id -%>" class='small-11 small-centered column' >
33
- <%= render :partial => "inline_forms/list",
34
- :locals => { :parent_class => @object.class,
35
- :parent_id => @object.id,
36
- :attribute => attribute } %>
37
- </div>
38
- </div>
39
- <% else -%>
40
- <div class="row <%= cycle('odd', 'even') %>">
41
- <div class='medium-3 large-3 column' >
42
- <% if @object.has_validations_for?(attribute) -%>
43
- <span data-tooltip class="has-tip tip-top" title="<%= validation_hints_as_list_for(@object, attribute) -%>">
44
- <%= @object.class.human_attribute_name(attribute) -%>
45
- </span>
46
- <% else %>
11
+ </div>
12
+ <% end %>
13
+ <% attributes = @inline_forms_attribute_list || @object.inline_forms_attribute_list -%>
14
+ <% attributes.each do | attribute, name, form_element | -%>
15
+ <% if cancan_disabled? || can?(:read, @object, attribute) %>
16
+ <% css_class_id = "#{@object.class.name.underscore}_#{@object.id}_#{attribute}" -%>
17
+ <% if form_element == :header %>
18
+ <div class="row form_element_header">
19
+ <div class='large-12 column' >
47
20
  <%= @object.class.human_attribute_name(attribute) -%>
48
- <% end %>
21
+ </div>
49
22
  </div>
50
- <div class='medium-9 large-9 column' >
51
- <span id="<%= css_class_id -%>" >
52
- <%= send("#{form_element}_show", @object, attribute) -%>
53
- </span>
54
- </div>
55
- </div>
23
+ <% else %>
24
+ <% if form_element == :associated -%>
25
+ <div class="row form_element_header associated_auto_header" id="<%= css_class_id -%>_list_auto_header" >
26
+ <div class='medium-11 large-11 column' >
27
+ <%= @object.class.human_attribute_name(attribute) -%>
28
+ </div>
29
+ <div class='medium-1 large-1 column'>
30
+ <%= link_to_new_record(attribute.to_s.singularize.camelcase.constantize, "new_#{attribute.to_s.underscore.singularize}_path", css_class_id, @object.class, @object.id) -%>
31
+ </div>
32
+ </div>
33
+ <div class="row <%= cycle('odd', 'even') %>">
34
+ <div id="<%= css_class_id -%>" class='small-11 small-centered column' >
35
+ <%= render :partial => "inline_forms/list",
36
+ :locals => { :parent_class => @object.class,
37
+ :parent_id => @object.id,
38
+ :attribute => attribute } %>
39
+ </div>
40
+ </div>
41
+ <% else -%>
42
+ <div class="row <%= cycle('odd', 'even') %>">
43
+ <div class='medium-3 large-3 column' >
44
+ <% if @object.has_validations_for?(attribute) -%>
45
+ <span data-tooltip class="has-tip tip-top" title="<%= validation_hints_as_list_for(@object, attribute) -%>">
46
+ <%= @object.class.human_attribute_name(attribute) -%>
47
+ </span>
48
+ <% else %>
49
+ <%= @object.class.human_attribute_name(attribute) -%>
50
+ <% end %>
51
+ </div>
52
+ <div class='medium-9 large-9 column' >
53
+ <span id="<%= css_class_id -%>" >
54
+ <%= send("#{form_element}_show", @object, attribute) -%>
55
+ </span>
56
+ </div>
57
+ </div>
58
+ <% end -%>
59
+ <% end -%>
56
60
  <% end -%>
57
61
  <% end -%>
58
- <% end -%>
59
- <% end -%>
60
- <div class="record_footer"></div>
62
+ <div class="record_footer"></div>
63
+ </div>
64
+ </div>
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineForms
3
- VERSION = "1.6.50"
3
+ VERSION = "1.6.51"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.50
4
+ version: 1.6.51
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-14 00:00:00.000000000 Z
11
+ date: 2014-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rvm
@@ -232,6 +232,7 @@ files:
232
232
  - lib/app/views/inline_forms/_header.html.erb
233
233
  - lib/app/views/inline_forms/_list.html.erb
234
234
  - lib/app/views/inline_forms/_new.html.erb
235
+ - lib/app/views/inline_forms/_new_nested.html.erb
235
236
  - lib/app/views/inline_forms/_show.html.erb
236
237
  - lib/app/views/inline_forms/close.js.erb
237
238
  - lib/app/views/inline_forms/edit.js.erb