inline_forms 5.2.2 → 5.2.3

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30957aecb0bd21d5065b52dab970864a0cc97a451101eb39c810e958c319ad99
4
- data.tar.gz: 84c3cb7f84e1aab7d00afa5b30f307a77c2eb5af8aa9aecfb056e2f1fb0fb0d4
3
+ metadata.gz: 92f900685c61e69f02a5242fceb3ac1b0c195a5ea01065dfc272847d07774520
4
+ data.tar.gz: ac2641cdd5af7158fef7a76a4e398df624a2134da93c83098f5700c8b3948b19
5
5
  SHA512:
6
- metadata.gz: c1aefda4a47ad908d07a1d5020048536bcf29b1f2ee91cc8f310d1828192e981c1bd2517515ee19033e001ae88e41ce8b9c1e6ea7e0fc20dd549aec61cee2985
7
- data.tar.gz: 0421ce0bf9de2ec5946b132b0a39dc3d5527ebe3f9bcac8034bee51aec934e43af039ef13b377aceff46b4251d01f123ca935220b69b240b4435a0bfbf41b52a
6
+ metadata.gz: 5e9c274626fc395ac0feed1e73d710b4e01d2f51b8b99d3060e44184e22ab1e33c6fbb6537ae207b9da06897c1649e500aab5f6a972ca99501282940b7f33030
7
+ data.tar.gz: 2e121d624de0c428365138e34d1aa580b5cb933d1579da5dd77c33a61fb92b7b54f0d2ebe681d307a0351f35fbeb2f049a4b81857c073dfcde69e7306cffa4ba
@@ -0,0 +1,45 @@
1
+ # -*- encoding : utf-8 -*-
2
+ #InlineForms::SPECIAL_COLUMN_TYPES[:absence_list]=:no_migration
3
+
4
+ # checklist
5
+ def absence_list_show(object, attribute) # the object is the lesson, attribute should be absences???
6
+ absence_status = { 1 => 'aanwezig', 3 => 'laat met reden', 4 => 'laat' , 5 => 'afwezig met reden', 6 => 'afwezig' }
7
+ out = '<ul class="absence_list">'
8
+ out << link_to_inline_edit(object, attribute) if object.send(attribute).empty? # no absences yet
9
+ object.kids.sort.each do | item | # we need the kids from this lesson.
10
+
11
+ out << "<li>"
12
+ out << "#{item.full_name}: "
13
+ out << "<br />"
14
+ out << "<span id='absence_#{Absence.this_lesson_this_kid(object, item).id}_status'>"
15
+ out << link_to_inline_edit( Absence.this_lesson_this_kid(object, item),
16
+ :status,
17
+ absence_status[Absence.this_lesson_this_kid(object, item).status],
18
+ :dropdown_with_values
19
+ )
20
+ out << '</span>'
21
+ out << '</li>'
22
+ end
23
+ out << '</ul>'
24
+ out.html_safe
25
+ end
26
+
27
+ def absence_list_edit(object, attribute)
28
+ # object.send(attribute).build if object.send(attribute).empty?
29
+ # values = object.send(attribute).first.class.name.constantize.find(:all) # TODO bring order
30
+ out = '<div class="edit_form_checklist">'
31
+ out << '<ul>'
32
+ item = object.kid
33
+ out << "<li>"
34
+ out << item._presentation
35
+ out << dropdown_with_values_edit(Absence.this_lesson(item).first, :status)
36
+ out << '</li>'
37
+ out << '</ul>'
38
+ out << '</div>'
39
+ out.html_safe
40
+ end
41
+
42
+ # def absence_list_update(object, attribute)
43
+ # params[attribute] ||= {}
44
+ # object.send(attribute.singularize + '_ids=', params[attribute].keys)
45
+ # end
@@ -118,7 +118,7 @@ module InlineFormsHelper
118
118
  end
119
119
 
120
120
  # link_to_inline_edit
121
- def link_to_inline_edit(object, attribute, attribute_value='')
121
+ def link_to_inline_edit(object, attribute, attribute_value='', form_element=nil)
122
122
  attribute_value = attribute_value.to_s
123
123
  spaces = attribute_value.length > 40 ? 0 : 40 - attribute_value.length
124
124
  value = h(attribute_value) + ("&nbsp;" * spaces).html_safe
@@ -128,7 +128,7 @@ module InlineFormsHelper
128
128
  send( 'edit_' + object.class.to_s.underscore + '_path',
129
129
  object,
130
130
  :attribute => attribute.to_s,
131
- :form_element => calling_method.sub(/_[a-z]+$/,'').sub(/block in /,''),
131
+ :form_element => form_element.nil? ? calling_method.sub(/_[a-z]+$/,'').sub(/block in /,'') : form_element,
132
132
  :update => css_class_id ),
133
133
  :remote => true
134
134
  else
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineForms
3
- VERSION = "5.2.2"
3
+ VERSION = "5.2.3"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.2
4
+ version: 5.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-09-20 00:00:00.000000000 Z
13
+ date: 2018-09-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rvm
@@ -167,6 +167,7 @@ files:
167
167
  - app/controllers/geo_code_curacao_controller.rb
168
168
  - app/controllers/inline_forms_application_controller.rb
169
169
  - app/controllers/inline_forms_controller.rb
170
+ - app/helpers/form_elements/absence_list.rb
170
171
  - app/helpers/form_elements/audio_field.rb
171
172
  - app/helpers/form_elements/check_box.rb
172
173
  - app/helpers/form_elements/check_list.rb