formily 0.0.5.5.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. checksums.yaml +7 -0
  2. data/CODE_OF_CONDUCT.md +13 -0
  3. data/Gemfile +4 -0
  4. data/Gemfile.lock +156 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +84 -0
  7. data/Rakefile +1 -0
  8. data/app/assets/fonts/formily-icon.eot +0 -0
  9. data/app/assets/fonts/formily-icon.svg +26 -0
  10. data/app/assets/fonts/formily-icon.ttf +0 -0
  11. data/app/assets/fonts/formily-icon.woff +0 -0
  12. data/app/assets/fonts/formily-icon.woff2 +0 -0
  13. data/app/assets/images/blank_file.png +0 -0
  14. data/app/assets/images/formily_spin.gif +0 -0
  15. data/app/assets/javascripts/formily.js +5 -0
  16. data/app/assets/javascripts/formily/base/ajax_reloader.js +24 -0
  17. data/app/assets/javascripts/formily/base/buttons.js +160 -0
  18. data/app/assets/javascripts/formily/base/form_response.js +28 -0
  19. data/app/assets/javascripts/formily/base/local_time.js +9 -0
  20. data/app/assets/javascripts/formily/editor.js +46 -0
  21. data/app/assets/javascripts/formily/editor/editor_buttons.js +186 -0
  22. data/app/assets/javascripts/formily/editor/form_preview.js +53 -0
  23. data/app/assets/javascripts/formily/editor/input_model.js +76 -0
  24. data/app/assets/javascripts/formily/editor/input_on_change.js +83 -0
  25. data/app/assets/javascripts/formily/editor/related_fields.js +76 -0
  26. data/app/assets/javascripts/formily/form.js +22 -0
  27. data/app/assets/javascripts/formily/formily_editor.js +329 -0
  28. data/app/assets/javascripts/formily/formily_modal.js +104 -0
  29. data/app/assets/javascripts/formily/formily_url.js.erb +26 -0
  30. data/app/assets/javascripts/formily/inputs/conditioned.js +4 -0
  31. data/app/assets/javascripts/formily/inputs/conditioned/checkbox.js +73 -0
  32. data/app/assets/javascripts/formily/inputs/conditioned/option.js +82 -0
  33. data/app/assets/javascripts/formily/inputs/conditioned/radio.js +160 -0
  34. data/app/assets/javascripts/formily/inputs/date_time.js +25 -0
  35. data/app/assets/javascripts/formily/inputs/input_tab.js +18 -0
  36. data/app/assets/javascripts/formily/inputs/location.js +39 -0
  37. data/app/assets/javascripts/formily/inputs/multi_file.js +228 -0
  38. data/app/assets/javascripts/formily/lib/jquery.datetimepicker.full.min.js +2 -0
  39. data/app/assets/javascripts/formily/lib/modernizr.js +8 -0
  40. data/app/assets/javascripts/formily/lib/strftime.min.js +12 -0
  41. data/app/assets/javascripts/formily/lib/tag-it.min.js +17 -0
  42. data/app/assets/javascripts/formily/mobile.js +10 -0
  43. data/app/assets/javascripts/formily_app.js +15 -0
  44. data/app/assets/javascripts/formily_iframe.js +11 -0
  45. data/app/assets/stylesheets/formily.scss +14 -0
  46. data/app/assets/stylesheets/formily/base/fonts.scss +65 -0
  47. data/app/assets/stylesheets/formily/base/layout.scss +66 -0
  48. data/app/assets/stylesheets/formily/base/links.css +7 -0
  49. data/app/assets/stylesheets/formily/base/ui-dialog.scss +129 -0
  50. data/app/assets/stylesheets/formily/editor.scss +25 -0
  51. data/app/assets/stylesheets/formily/editor/inputs_group_list.css +14 -0
  52. data/app/assets/stylesheets/formily/editor/inputs_list.css +97 -0
  53. data/app/assets/stylesheets/formily/editor/related_modal.scss +49 -0
  54. data/app/assets/stylesheets/formily/formily_editor.scss +53 -0
  55. data/app/assets/stylesheets/formily/formily_modal.scss +2 -0
  56. data/app/assets/stylesheets/formily/foundation_fix.scss +140 -0
  57. data/app/assets/stylesheets/formily/inputs/date_time.scss +8 -0
  58. data/app/assets/stylesheets/formily/inputs/multi_file.scss +111 -0
  59. data/app/assets/stylesheets/formily/jquery.datetimepicker.min.css +1 -0
  60. data/app/assets/stylesheets/formily/lib/jquery.tagit.css +69 -0
  61. data/app/assets/stylesheets/formily/modal/content.scss +36 -0
  62. data/app/assets/stylesheets/formily/modal/iframe.scss +29 -0
  63. data/app/assets/stylesheets/formily_iframe.scss +64 -0
  64. data/app/assets/stylesheets/foundation_formily.scss +20 -0
  65. data/app/controllers/formily/file_controller.rb +17 -0
  66. data/app/controllers/formily/form_types_controller.rb +46 -0
  67. data/app/controllers/formily/formilyable_controller.rb +98 -0
  68. data/app/controllers/formily/forms_controller.rb +133 -0
  69. data/app/controllers/formily/iframe/forms_controller.rb +28 -0
  70. data/app/controllers/formily/inputs_controller.rb +113 -0
  71. data/app/controllers/formily/submit_data_controller.rb +151 -0
  72. data/app/controllers/formily_controller.rb +22 -0
  73. data/app/helpers/formily_helper.rb +17 -0
  74. data/app/models/formily/checkbox_input.rb +8 -0
  75. data/app/models/formily/checkbox_input_group.rb +14 -0
  76. data/app/models/formily/date_time_input.rb +19 -0
  77. data/app/models/formily/file.rb +14 -0
  78. data/app/models/formily/form.rb +41 -0
  79. data/app/models/formily/form_type.rb +10 -0
  80. data/app/models/formily/formilyable_form.rb +18 -0
  81. data/app/models/formily/input.rb +124 -0
  82. data/app/models/formily/input_value.rb +23 -0
  83. data/app/models/formily/multiple_file_input.rb +18 -0
  84. data/app/models/formily/option_input.rb +8 -0
  85. data/app/models/formily/options_input_group.rb +14 -0
  86. data/app/models/formily/radio_input.rb +12 -0
  87. data/app/models/formily/radio_input_group.rb +14 -0
  88. data/app/models/formily/static_text.rb +8 -0
  89. data/app/models/formily/submit.rb +47 -0
  90. data/app/models/formily/text_input.rb +8 -0
  91. data/app/models/formily/textarea_input.rb +8 -0
  92. data/app/views/formily/data/_forms_table.html.haml +19 -0
  93. data/app/views/formily/data/_many_tables.html.erb +3 -0
  94. data/app/views/formily/data/_table.html.erb +33 -0
  95. data/app/views/formily/data/submit_data_table.html.haml +32 -0
  96. data/app/views/formily/editor/_default_value.haml +18 -0
  97. data/app/views/formily/editor/_editor.haml +18 -0
  98. data/app/views/formily/editor/_modal.haml +197 -0
  99. data/app/views/formily/editor/partial/_group.haml +41 -0
  100. data/app/views/formily/editor/partial/_group_input.haml +36 -0
  101. data/app/views/formily/editor/partial/_input.haml +35 -0
  102. data/app/views/formily/editor/partial/_input_fieldset.haml +12 -0
  103. data/app/views/formily/form_types/_form.haml +9 -0
  104. data/app/views/formily/form_types/edit.haml +6 -0
  105. data/app/views/formily/form_types/index.haml +24 -0
  106. data/app/views/formily/form_types/new.haml +6 -0
  107. data/app/views/formily/formilyable/index.haml +67 -0
  108. data/app/views/formily/formilyable/new.haml +37 -0
  109. data/app/views/formily/forms/_form.haml +34 -0
  110. data/app/views/formily/forms/_preview.haml +16 -0
  111. data/app/views/formily/forms/edit.haml +5 -0
  112. data/app/views/formily/forms/index.haml +40 -0
  113. data/app/views/formily/forms/new.haml +5 -0
  114. data/app/views/formily/forms/reload_formily_table.haml +4 -0
  115. data/app/views/formily/forms/show.haml +1 -0
  116. data/app/views/formily/helpers/_iframe_formily_modal.html.haml +3 -0
  117. data/app/views/formily/helpers/_related_forms.html.haml +12 -0
  118. data/app/views/formily/helpers/_related_forms_tr.html.haml +28 -0
  119. data/app/views/formily/iframe/forms/show.haml +1 -0
  120. data/app/views/formily/inputs/_group.haml +40 -0
  121. data/app/views/formily/inputs/_group_input.haml +36 -0
  122. data/app/views/formily/inputs/_input.haml +35 -0
  123. data/app/views/formily/inputs/_input_fieldset.haml +12 -0
  124. data/app/views/formily/inputs/render_input_html.haml +7 -0
  125. data/app/views/formily/partial/_form.haml +37 -0
  126. data/app/views/formily/partial/inputs/_checkbox_input.haml +18 -0
  127. data/app/views/formily/partial/inputs/_checkbox_input_group.haml +36 -0
  128. data/app/views/formily/partial/inputs/_conditioned_fields.haml +36 -0
  129. data/app/views/formily/partial/inputs/_date_time_input.haml +15 -0
  130. data/app/views/formily/partial/inputs/_file_input.haml +20 -0
  131. data/app/views/formily/partial/inputs/_file_preview.haml +14 -0
  132. data/app/views/formily/partial/inputs/_input.haml +1 -0
  133. data/app/views/formily/partial/inputs/_multiple_file_input.haml +25 -0
  134. data/app/views/formily/partial/inputs/_options_input_group.haml +77 -0
  135. data/app/views/formily/partial/inputs/_radio_input_group.haml +41 -0
  136. data/app/views/formily/partial/inputs/_static_text.haml +11 -0
  137. data/app/views/formily/partial/inputs/_text_input.haml +19 -0
  138. data/app/views/formily/partial/inputs/_textarea_input.haml +19 -0
  139. data/app/views/formily/submit_data/submit.html.erb +5 -0
  140. data/app/views/formily/submit_data/submit.json.jbuilder +5 -0
  141. data/app/views/layouts/formily_iframe.haml +16 -0
  142. data/config/routes.rb +41 -0
  143. data/formily.gemspec +41 -0
  144. data/lib/formily.rb +37 -0
  145. data/lib/formily/config.rb +72 -0
  146. data/lib/formily/engine.rb +12 -0
  147. data/lib/formily/helpers/view_helper.rb +114 -0
  148. data/lib/formily/relation.rb +26 -0
  149. data/lib/formily/relation/formily_methods.rb +30 -0
  150. data/lib/formily/relation/has_many_methods.rb +16 -0
  151. data/lib/formily/submitted_data_table.rb +74 -0
  152. data/lib/formily/version.rb +4 -0
  153. data/lib/generators/formily/install/install_generator.rb +43 -0
  154. data/lib/generators/formily/install/templates/create_formily_data.rb +28 -0
  155. data/lib/generators/formily/install/templates/create_formily_files.rb +13 -0
  156. data/lib/generators/formily/install/templates/create_formily_form_types.rb +12 -0
  157. data/lib/generators/formily/install/templates/create_formily_forms.rb +16 -0
  158. data/lib/generators/formily/install/templates/create_formily_inputs.rb +24 -0
  159. data/lib/generators/formily/install/templates/create_formilyable_forms.rb +17 -0
  160. data/lib/generators/formily/install/templates/formily.rb +21 -0
  161. data/lib/generators/formily/views/views_generator.rb +11 -0
  162. metadata +350 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b84fc2bb7f9473589b61bd8996d0ff5746aae335
4
+ data.tar.gz: 21a06152a3ab5e902fcd9d1faa45a763d7361d4f
5
+ SHA512:
6
+ metadata.gz: 38308ce7f7d6f9394640108d5672a778e1aeab9632db18ed9f85f7abcf16716d4ba53e50773be43082c64cbb6157812e0293cad8df47666bbd45e8f8cefc822b
7
+ data.tar.gz: 8df0264eb76c96fe953fc88e231540d89be3bb2b8bb18bf6e4fb6fc4ec6b4646f0627824a0930f002fbb9f914545ca9baeda399f9d9e04404df01c87a5037dfe
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in formily.gemspec
4
+ gemspec
@@ -0,0 +1,156 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ formily (0.0.5.5.7)
5
+ browser (~> 2.2)
6
+ haml (~> 4.0)
7
+ jquery-rails (~> 4.0)
8
+ jquery-ui-rails (~> 5.0)
9
+ paper_trail (~> 6.0.2, >= 6.0.2)
10
+ paperclip (~> 4.0)
11
+ rails (~> 4.0)
12
+ sass-rails (~> 5.0)
13
+
14
+ GEM
15
+ remote: https://rubygems.org/
16
+ specs:
17
+ actionmailer (4.2.7.1)
18
+ actionpack (= 4.2.7.1)
19
+ actionview (= 4.2.7.1)
20
+ activejob (= 4.2.7.1)
21
+ mail (~> 2.5, >= 2.5.4)
22
+ rails-dom-testing (~> 1.0, >= 1.0.5)
23
+ actionpack (4.2.7.1)
24
+ actionview (= 4.2.7.1)
25
+ activesupport (= 4.2.7.1)
26
+ rack (~> 1.6)
27
+ rack-test (~> 0.6.2)
28
+ rails-dom-testing (~> 1.0, >= 1.0.5)
29
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
30
+ actionview (4.2.7.1)
31
+ activesupport (= 4.2.7.1)
32
+ builder (~> 3.1)
33
+ erubis (~> 2.7.0)
34
+ rails-dom-testing (~> 1.0, >= 1.0.5)
35
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
36
+ activejob (4.2.7.1)
37
+ activesupport (= 4.2.7.1)
38
+ globalid (>= 0.3.0)
39
+ activemodel (4.2.7.1)
40
+ activesupport (= 4.2.7.1)
41
+ builder (~> 3.1)
42
+ activerecord (4.2.7.1)
43
+ activemodel (= 4.2.7.1)
44
+ activesupport (= 4.2.7.1)
45
+ arel (~> 6.0)
46
+ activesupport (4.2.7.1)
47
+ i18n (~> 0.7)
48
+ json (~> 1.7, >= 1.7.7)
49
+ minitest (~> 5.1)
50
+ thread_safe (~> 0.3, >= 0.3.4)
51
+ tzinfo (~> 1.1)
52
+ arel (6.0.4)
53
+ browser (2.5.1)
54
+ builder (3.2.3)
55
+ climate_control (0.0.3)
56
+ activesupport (>= 3.0)
57
+ cocaine (0.5.8)
58
+ climate_control (>= 0.0.3, < 1.0)
59
+ concurrent-ruby (1.0.5)
60
+ crass (1.0.3)
61
+ erubis (2.7.0)
62
+ globalid (0.4.1)
63
+ activesupport (>= 4.2.0)
64
+ haml (4.0.7)
65
+ tilt
66
+ i18n (0.9.1)
67
+ concurrent-ruby (~> 1.0)
68
+ jquery-rails (4.2.2)
69
+ rails-dom-testing (>= 1, < 3)
70
+ railties (>= 4.2.0)
71
+ thor (>= 0.14, < 2.0)
72
+ jquery-ui-rails (5.0.5)
73
+ railties (>= 3.2.16)
74
+ json (1.8.6)
75
+ loofah (2.1.1)
76
+ crass (~> 1.0.2)
77
+ nokogiri (>= 1.5.9)
78
+ mail (2.7.0)
79
+ mini_mime (>= 0.1.1)
80
+ mime-types (3.1)
81
+ mime-types-data (~> 3.2015)
82
+ mime-types-data (3.2016.0521)
83
+ mimemagic (0.3.0)
84
+ mini_mime (1.0.0)
85
+ mini_portile2 (2.3.0)
86
+ minitest (5.10.1)
87
+ nokogiri (1.8.1)
88
+ mini_portile2 (~> 2.3.0)
89
+ paper_trail (6.0.2)
90
+ activerecord (>= 4.0, < 5.2)
91
+ request_store (~> 1.1)
92
+ paperclip (4.3.2)
93
+ activemodel (>= 3.2.0)
94
+ activesupport (>= 3.2.0)
95
+ cocaine (~> 0.5.5)
96
+ mime-types
97
+ mimemagic (= 0.3.0)
98
+ rack (1.6.8)
99
+ rack-test (0.6.3)
100
+ rack (>= 1.0)
101
+ rails (4.2.7.1)
102
+ actionmailer (= 4.2.7.1)
103
+ actionpack (= 4.2.7.1)
104
+ actionview (= 4.2.7.1)
105
+ activejob (= 4.2.7.1)
106
+ activemodel (= 4.2.7.1)
107
+ activerecord (= 4.2.7.1)
108
+ activesupport (= 4.2.7.1)
109
+ bundler (>= 1.3.0, < 2.0)
110
+ railties (= 4.2.7.1)
111
+ sprockets-rails
112
+ rails-deprecated_sanitizer (1.0.3)
113
+ activesupport (>= 4.2.0.alpha)
114
+ rails-dom-testing (1.0.8)
115
+ activesupport (>= 4.2.0.beta, < 5.0)
116
+ nokogiri (~> 1.6)
117
+ rails-deprecated_sanitizer (>= 1.0.1)
118
+ rails-html-sanitizer (1.0.3)
119
+ loofah (~> 2.0)
120
+ railties (4.2.7.1)
121
+ actionpack (= 4.2.7.1)
122
+ activesupport (= 4.2.7.1)
123
+ rake (>= 0.8.7)
124
+ thor (>= 0.18.1, < 2.0)
125
+ rake (10.4.2)
126
+ request_store (1.3.2)
127
+ sass (3.4.23)
128
+ sass-rails (5.0.6)
129
+ railties (>= 4.0.0, < 6)
130
+ sass (~> 3.1)
131
+ sprockets (>= 2.8, < 4.0)
132
+ sprockets-rails (>= 2.0, < 4.0)
133
+ tilt (>= 1.1, < 3)
134
+ sprockets (3.7.1)
135
+ concurrent-ruby (~> 1.0)
136
+ rack (> 1, < 3)
137
+ sprockets-rails (3.2.1)
138
+ actionpack (>= 4.0)
139
+ activesupport (>= 4.0)
140
+ sprockets (>= 3.0.0)
141
+ thor (0.20.0)
142
+ thread_safe (0.3.6)
143
+ tilt (2.0.6)
144
+ tzinfo (1.2.4)
145
+ thread_safe (~> 0.1)
146
+
147
+ PLATFORMS
148
+ ruby
149
+
150
+ DEPENDENCIES
151
+ bundler (~> 1.8)
152
+ formily!
153
+ rake (~> 10.0)
154
+
155
+ BUNDLED WITH
156
+ 1.16.0
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Alex
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,84 @@
1
+ # Formily
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/form/builder`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'formily'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install formily
22
+
23
+ ## Usage
24
+
25
+ Run:
26
+
27
+ $ rails generate formily:install
28
+
29
+ then:
30
+
31
+ $ rake db:migrate
32
+
33
+
34
+ Add into application.css:
35
+
36
+ //=require formily
37
+
38
+ Add into application.js:
39
+
40
+ //= require formily
41
+
42
+ Add into application layout:
43
+
44
+ <body>
45
+ ...
46
+ <%= formily_modal_tag %>
47
+ </body>
48
+
49
+ Dependency:
50
+
51
+ //= require jquery
52
+ //= require jquery_ujs
53
+ //= require jquery-ui
54
+
55
+ ### View helpers
56
+
57
+ URL helpers:
58
+
59
+ formily_forms_connect_form POST /formily/forms/connect_form formily/forms#connect_form
60
+ formily_forms GET /formily/forms formily/forms#index
61
+ new_formily_forms GET /formily/forms/new formily/forms#new
62
+ formily_form_show GET /formily/forms/:id formily/forms#show
63
+ formily_forms_edit GET /formily/forms/:id/edit formily/forms#edit
64
+ formily_form_delete DELETE /formily/forms/:id formily/forms#destroy
65
+ formily_submit_data_submit POST /formily/submit_data/submit formily/submit_data#submit
66
+
67
+
68
+ View helpers:
69
+
70
+ new_formily_form_btn('New', class: 'button')
71
+
72
+ edit_formily_form_btn(@form)
73
+
74
+ new_formily_form_link
75
+
76
+ edit_formily_form_link(@form)
77
+
78
+ formily_form_editor_btn_tag(@some_model)
79
+
80
+ ## Development
81
+
82
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
83
+
84
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,26 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Copyright (C) 2016 by original authors @ fontello.com</metadata>
5
+ <defs>
6
+ <font id="formily-icon" horiz-adv-x="1000" >
7
+ <font-face font-family="formily-icon" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
8
+ <missing-glyph horiz-adv-x="1000" />
9
+ <glyph glyph-name="plus" unicode="&#xe800;" d="M0 209l0 282 359 0 0 359 282 0 0-359 359 0 0-282-359 0 0-359-282 0 0 359-359 0z" horiz-adv-x="1000" />
10
+
11
+ <glyph glyph-name="ok" unicode="&#xe801;" d="M352-10l-334 333 158 160 176-174 400 401 159-160z" horiz-adv-x="928" />
12
+
13
+ <glyph glyph-name="trash-empty" unicode="&#xe802;" d="M286 439v-321q0-8-5-13t-13-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q8 0 13-5t5-13z m143 0v-321q0-8-5-13t-13-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q8 0 13-5t5-13z m142 0v-321q0-8-5-13t-12-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q7 0 12-5t5-13z m72-404v529h-500v-529q0-12 4-22t8-15 6-5h464q2 0 6 5t8 15 4 22z m-375 601h250l-27 65q-4 5-9 6h-177q-6-1-10-6z m518-18v-36q0-8-5-13t-13-5h-54v-529q0-46-26-80t-63-34h-464q-37 0-63 33t-27 79v531h-53q-8 0-13 5t-5 13v36q0 8 5 13t13 5h172l39 93q9 21 31 35t44 15h178q23 0 44-15t30-35l39-93h173q8 0 13-5t5-13z" horiz-adv-x="785.7" />
14
+
15
+ <glyph glyph-name="down" unicode="&#xe803;" d="M0 436l211 0 0 414 359 0 0-414 211 0-390-586z" horiz-adv-x="781" />
16
+
17
+ <glyph glyph-name="up" unicode="&#xe804;" d="M0 264l391 586 390-586-211 0 0-414-359 0 0 414-211 0z" horiz-adv-x="781" />
18
+
19
+ <glyph glyph-name="record-outline" unicode="&#xe805;" d="M313 559q-87 0-148-61t-61-148 61-147 148-62 147 62 61 147-61 148-147 61z m0 104q130 0 221-92t91-221-91-221-221-91-222 91-91 221 91 221 222 92z" horiz-adv-x="625" />
20
+
21
+ <glyph glyph-name="record" unicode="&#xe806;" d="M313 663q130 0 221-92t91-221-91-221-221-91-222 91-91 221 91 221 222 92z" horiz-adv-x="625" />
22
+
23
+ <glyph glyph-name="pencil" unicode="&#xe808;" d="M0-143l68 343 274-273z m137 392l422 422 259-260-421-422z m531 494q2 39 31 69t69 31 66-25l131-131q25-26 24-66t-30-69-69-30-66 24l-131 131q-27 27-25 66z" horiz-adv-x="989" />
24
+ </font>
25
+ </defs>
26
+ </svg>
@@ -0,0 +1,5 @@
1
+ //= require formily/formily_url
2
+ //= require formily/mobile
3
+ //= require formily/base/local_time
4
+ //= require formily/form
5
+ //= require formily/editor
@@ -0,0 +1,24 @@
1
+ $(document).ready(function() {
2
+
3
+ $(document).on('formily_update_table', function (e, data) {
4
+ var table_id = data.resource_id + '_' + data.user_id;
5
+ var table = $('table[data-formily-form-table=' + table_id + ']');
6
+
7
+ $.ajax({
8
+ url: '/formily/forms/reload_formily_table',
9
+ type: 'POST',
10
+ data: data,
11
+ success: function(response){
12
+ table.replaceWith(response);
13
+ },
14
+ error: function(response){
15
+ console.error(response);
16
+ },
17
+ complete: function(){
18
+ $('.tooltip').hide();
19
+ $(document).foundation();
20
+ }
21
+ });
22
+ });
23
+
24
+ });
@@ -0,0 +1,160 @@
1
+ // Formily form base buttons -> submit, save etc.
2
+ //= require formily/base/form_response
3
+
4
+ $(document).ready(function() {
5
+
6
+ var closeWindowFunc;
7
+
8
+ if(window.parent == window.top && window.opener) {
9
+ closeWindowFunc = function(str){
10
+ window.opener.FormilyModal.close(str);
11
+ window.close();
12
+ }
13
+ } else {
14
+ closeWindowFunc = function(str){
15
+ window.parent.FormilyModal.close(str);
16
+ }
17
+ }
18
+
19
+ $(document).on('click', '#formily_save_and_close', function(e){
20
+ var form = $(this).parents('form').get(0);
21
+ $(':file', form).remove();
22
+ form = $(this).parents('form');
23
+ var formData = new FormData(form.get(0));
24
+
25
+ if(isFormilyFileUploaded()){
26
+ formData.append('save_and_close', true);
27
+
28
+ $('.formily-spinner').show();
29
+
30
+ $.ajax({
31
+ url: form.attr('action'),
32
+ type: 'POST',
33
+ data: formData,
34
+ dataType: 'json',
35
+ success: function (data) {
36
+ closeWindowFunc('formily_update_table');
37
+ $('.formily-spinner').hide();
38
+ },
39
+ cache: false,
40
+ contentType: false,
41
+ processData: false
42
+ });
43
+ }
44
+
45
+ });
46
+
47
+ $(document).on('click', '#formily_cancel, .close-iframe-btn', function(e){
48
+ if(isFormilyFileUploaded()) {
49
+ closeWindowFunc('formily_update_table');
50
+ }
51
+ });
52
+
53
+ $(document).on('click', '#cancel_add_form', function(e){
54
+ if(isFormilyFileUploaded()){
55
+ closeWindowFunc('formily_update_table');
56
+ }
57
+ });
58
+
59
+ $(document).on('click', '.formily-edit', function(e){
60
+ $('input, button, textarea, select').each(function(){
61
+ $(this).attr('disabled', null);
62
+ });
63
+ $('.formily-edit').remove();
64
+ });
65
+
66
+ $('#formily_form_tag').on('submit', function(e){
67
+ var form = $(this);
68
+
69
+ if(isFormilyFileUploaded()){
70
+ if (validateRequiredFields(form)){
71
+ var formData = new FormData(form.get(0));
72
+
73
+ $('.formily-spinner').show();
74
+
75
+ $.ajax({
76
+ url: form.attr('action'),
77
+ type: 'POST',
78
+ data: formData,
79
+ dataType: 'json',
80
+ success: function (data) {
81
+ closeWindowFunc('formily_update_table');
82
+ $('.formily-spinner').show();
83
+ },
84
+ cache: false,
85
+ contentType: false,
86
+ processData: false
87
+ });
88
+ }
89
+ }
90
+
91
+ e.preventDefault();
92
+ return false;
93
+ });
94
+
95
+ $(document).on('click', '.add_new_response', function(e){
96
+ var self = $(this);
97
+ var url = self.data('href');
98
+ var data = self.data('params');
99
+
100
+ $.ajax({
101
+ url: url,
102
+ type: 'POST',
103
+ data: data,
104
+ success: function(data){
105
+ window.location.reload(true);
106
+ }
107
+ });
108
+
109
+ e.preventDefault();
110
+ });
111
+
112
+ var validateRequiredFields = function(form) {
113
+ var res = true;
114
+ var errors = $('ul.errors');
115
+ errors.children().remove();
116
+
117
+ form.find("[data-required='required']").each(function(){
118
+ var field = $(this);
119
+
120
+ if(field.attr('name')) {
121
+
122
+ if (field.attr('type') == 'text' || field.is('textarea')) {
123
+
124
+ if (field.val().replace(/^\s*/, '') == "") {
125
+ res = false;
126
+ field.parent().addClass('has-errors');
127
+ } else {
128
+ field.parent().removeClass('has-errors');
129
+ }
130
+
131
+ } else if (field.attr('type') == 'file') {
132
+ if (field.parent().find('span.label.secondary').length == 0
133
+ && field.val() == "" && field.parent().parent().find('.file_upload').length == 0) {
134
+ res = false;
135
+
136
+ if (field.attr('multiple')) {
137
+ field.parent().attr('class', 'alert');
138
+ field.parent().parent().addClass('has-errors');
139
+ } else {
140
+ field.parent().addClass('has-errors');
141
+ }
142
+ } else {
143
+ field.parent().removeClass('has-errors');
144
+ }
145
+ }
146
+ }
147
+ });
148
+
149
+ if($(".has-errors").first().length > 0) {
150
+ errors.append("<li>Please complete the highlighted required fields.</li>");
151
+ errors.removeClass("hidden");
152
+
153
+ $('html, body').animate({
154
+ scrollTop: $(".has-errors").first().offset().top
155
+ }, 1000);
156
+ }
157
+
158
+ return res;
159
+ }
160
+ });