camaleon_cms 2.1.2.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of camaleon_cms might be problematic. Click here for more details.

Files changed (186) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -4
  3. data/app/apps/plugins/attack/attack_helper.rb +3 -0
  4. data/app/apps/plugins/attack/config/custom_models.rb +4 -2
  5. data/app/apps/plugins/attack/config/locales/translation.yml +19 -0
  6. data/app/apps/plugins/attack/models/attack.rb +1 -1
  7. data/app/apps/plugins/front_cache/config/initializer.rb +4 -2
  8. data/app/apps/plugins/front_cache/config/locales/translation.yml +19 -0
  9. data/app/apps/themes/camaleon_first/main_helper.rb +1 -3
  10. data/app/apps/themes/default/views/admin/settings.html.erb +0 -1
  11. data/app/apps/themes/default/views/layouts/index.html.erb +5 -5
  12. data/app/apps/themes/new/assets/css/main.css +1 -1
  13. data/app/apps/themes/new/assets/js/main.js +1 -1
  14. data/app/apps/themes/new/views/admin/settings.html.erb +1 -1
  15. data/app/assets/images/camaleon_cms/language/{pt_br.png → pt-BR.png} +0 -0
  16. data/app/assets/javascripts/camaleon_cms/admin/_custom_fields.js +105 -51
  17. data/app/assets/javascripts/camaleon_cms/admin/_libraries.js +4 -2
  18. data/app/assets/javascripts/camaleon_cms/admin/_translator.js +2 -2
  19. data/app/assets/javascripts/camaleon_cms/admin/custom_fields_form.js +9 -7
  20. data/app/assets/javascripts/camaleon_cms/admin/jquery_validate/{pt_br.js → pt-BR.js} +0 -0
  21. data/app/assets/javascripts/camaleon_cms/admin/momentjs/{pt_br.js → pt-BR.js} +1 -1
  22. data/app/assets/javascripts/camaleon_cms/admin/nav_menu.js.coffee +15 -1
  23. data/app/assets/javascripts/camaleon_cms/admin/tinymce/langs/{pt_br.js → pt-BR.js} +1 -1
  24. data/app/assets/javascripts/camaleon_cms/admin/uploader/_media_manager.js.coffee +24 -12
  25. data/app/assets/stylesheets/camaleon_cms/admin/_custom_admin.css.scss +9 -0
  26. data/app/assets/stylesheets/camaleon_cms/admin/lte/_admin.css.scss +1 -1
  27. data/app/controllers/camaleon_cms/admin/appearances/nav_menus_controller.rb +13 -6
  28. data/app/controllers/camaleon_cms/admin/appearances/themes_controller.rb +1 -1
  29. data/app/controllers/camaleon_cms/admin/appearances/widgets/assign_controller.rb +1 -1
  30. data/app/controllers/camaleon_cms/admin/appearances/widgets/main_controller.rb +1 -1
  31. data/app/controllers/camaleon_cms/admin/appearances/widgets/sidebar_controller.rb +1 -1
  32. data/app/controllers/camaleon_cms/admin/comments_controller.rb +1 -1
  33. data/app/controllers/camaleon_cms/admin/media_controller.rb +15 -5
  34. data/app/controllers/camaleon_cms/admin/plugins_controller.rb +1 -1
  35. data/app/controllers/camaleon_cms/admin/settings/custom_fields_controller.rb +14 -8
  36. data/app/controllers/camaleon_cms/admin/settings_controller.rb +22 -7
  37. data/app/controllers/camaleon_cms/admin/user_roles_controller.rb +1 -1
  38. data/app/controllers/camaleon_cms/admin/users_controller.rb +1 -1
  39. data/app/controllers/camaleon_cms/apps/plugins_admin_controller.rb +4 -1
  40. data/app/controllers/camaleon_cms/apps/plugins_front_controller.rb +5 -10
  41. data/app/controllers/camaleon_cms/apps/themes_front_controller.rb +1 -4
  42. data/app/controllers/camaleon_cms/camaleon_controller.rb +4 -13
  43. data/app/controllers/camaleon_cms/frontend_controller.rb +15 -9
  44. data/app/controllers/concerns/camaleon_cms/frontend_concern.rb +17 -8
  45. data/app/decorators/camaleon_cms/application_decorator.rb +3 -3
  46. data/app/decorators/camaleon_cms/custom_fields_concern.rb +21 -6
  47. data/app/decorators/camaleon_cms/post_comment_decorator.rb +21 -0
  48. data/app/decorators/camaleon_cms/site_decorator.rb +5 -5
  49. data/app/decorators/camaleon_cms/theme_decorator.rb +10 -0
  50. data/app/decorators/camaleon_cms/user_decorator.rb +2 -2
  51. data/app/helpers/camaleon_cms/admin/custom_fields_helper.rb +24 -2
  52. data/app/helpers/camaleon_cms/admin/menus_helper.rb +13 -12
  53. data/app/helpers/camaleon_cms/frontend/application_helper.rb +1 -1
  54. data/app/helpers/camaleon_cms/frontend/nav_menu_helper.rb +7 -6
  55. data/app/helpers/camaleon_cms/plugins_helper.rb +20 -18
  56. data/app/helpers/camaleon_cms/site_helper.rb +1 -20
  57. data/app/helpers/camaleon_cms/theme_helper.rb +1 -1
  58. data/app/helpers/camaleon_cms/uploader_helper.rb +25 -20
  59. data/app/helpers/camaleon_cms/user_roles_helper.rb +6 -1
  60. data/app/mailers/camaleon_cms/html_mailer.rb +2 -1
  61. data/app/models/camaleon_cms/ability.rb +3 -26
  62. data/app/models/camaleon_cms/custom_field.rb +2 -1
  63. data/app/models/camaleon_cms/custom_field_group.rb +23 -22
  64. data/app/models/camaleon_cms/custom_fields_relationship.rb +1 -1
  65. data/app/models/camaleon_cms/nav_menu.rb +1 -1
  66. data/app/models/camaleon_cms/nav_menu_item.rb +12 -19
  67. data/app/models/camaleon_cms/post.rb +1 -1
  68. data/app/models/camaleon_cms/post_comment.rb +3 -1
  69. data/app/models/camaleon_cms/post_default.rb +1 -1
  70. data/app/models/camaleon_cms/post_type.rb +5 -4
  71. data/app/models/camaleon_cms/site.rb +12 -0
  72. data/app/models/camaleon_cms/term_taxonomy.rb +1 -1
  73. data/app/models/camaleon_cms/user_role.rb +5 -1
  74. data/app/models/concerns/camaleon_cms/custom_fields_read.rb +99 -49
  75. data/app/uploaders/camaleon_cms_aws_uploader.rb +1 -1
  76. data/app/uploaders/camaleon_cms_local_uploader.rb +19 -3
  77. data/app/uploaders/camaleon_cms_uploader.rb +13 -6
  78. data/app/views/camaleon_cms/admin/appearances/nav_menus/_custom_menus.html.erb +9 -2
  79. data/app/views/camaleon_cms/admin/appearances/nav_menus/_form.html.erb +1 -1
  80. data/app/views/camaleon_cms/admin/appearances/nav_menus/_menu_items.html.erb +2 -2
  81. data/app/views/camaleon_cms/admin/appearances/themes/index.html.erb +1 -3
  82. data/app/views/camaleon_cms/admin/media/_render_file_item.html.erb +1 -0
  83. data/app/views/camaleon_cms/admin/media/index.html.erb +3 -3
  84. data/app/views/camaleon_cms/admin/posts/_sidebar.html.erb +1 -1
  85. data/app/views/camaleon_cms/admin/posts/form.html.erb +1 -1
  86. data/app/views/camaleon_cms/admin/settings/_configuration_settings.html.erb +4 -0
  87. data/app/views/camaleon_cms/admin/settings/custom_fields/_get_items.html.erb +6 -6
  88. data/app/views/camaleon_cms/admin/settings/custom_fields/_meta_data.html.erb +0 -9
  89. data/app/views/camaleon_cms/admin/settings/custom_fields/_render.html.erb +39 -55
  90. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_audio.html.erb +1 -1
  91. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_checkbox.html.erb +2 -2
  92. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_checkboxes.html.erb +3 -3
  93. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_colorpicker.html.erb +3 -3
  94. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_date.html.erb +3 -3
  95. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_editor.html.erb +2 -2
  96. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_email.html.erb +1 -1
  97. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_field_attrs.html.erb +3 -3
  98. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_file.html.erb +1 -1
  99. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_image.html.erb +2 -2
  100. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_numeric.html.erb +1 -1
  101. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_phone.html.erb +1 -1
  102. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_posts.html.erb +3 -3
  103. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_private_file.html.erb +4 -0
  104. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_radio.html.erb +3 -3
  105. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_select.html.erb +3 -3
  106. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_select_eval.html.erb +1 -1
  107. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_text_area.html.erb +2 -2
  108. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_text_box.html.erb +2 -2
  109. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_url.html.erb +1 -1
  110. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_users.html.erb +1 -1
  111. data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_video.html.erb +1 -1
  112. data/app/views/camaleon_cms/admin/settings/custom_fields/form.html.erb +8 -0
  113. data/app/views/camaleon_cms/admin/settings/site.html.erb +1 -20
  114. data/app/views/camaleon_cms/admin/settings/theme.html.erb +20 -0
  115. data/app/views/camaleon_cms/admin/user_roles/form.html.erb +2 -2
  116. data/app/views/camaleon_cms/default_theme/admin/settings.html.erb +0 -1
  117. data/app/views/camaleon_cms/default_theme/partials/_comments.html.erb +0 -2
  118. data/app/views/camaleon_cms/default_theme/partials/_search_form.html.erb +1 -1
  119. data/app/views/camaleon_cms/default_theme/partials/_sidebar.html.erb +3 -3
  120. data/app/views/layouts/camaleon_cms/admin/_footer.html.erb +1 -1
  121. data/config/initializers/action_view.rb +12 -7
  122. data/config/initializers/custom_initializers.rb +6 -12
  123. data/config/locales/camaleon_cms/admin/en.yml +1 -0
  124. data/config/locales/camaleon_cms/admin/es.yml +4 -0
  125. data/config/locales/camaleon_cms/admin/it.yml +1 -24
  126. data/config/locales/camaleon_cms/admin/js.yml +41 -0
  127. data/config/locales/camaleon_cms/admin/{pt_br.yml → pt-BR.yml} +48 -18
  128. data/config/locales/camaleon_cms/common.yml +66 -0
  129. data/config/locales/camaleon_cms/languages.yml +13 -0
  130. data/config/locales/camaleon_cms/routes.yml +2 -2
  131. data/config/routes/admin.rb +3 -0
  132. data/config/system.json +3 -3
  133. data/db/migrate/20160606135421_improve_menus_structure.rb +7 -0
  134. data/db/migrate/20160609121449_add_group_to_custom_field_values.rb +5 -0
  135. data/lib/camaleon_cms/engine.rb +4 -3
  136. data/lib/camaleon_cms/version.rb +1 -1
  137. data/lib/ext/string.rb +20 -0
  138. data/lib/ext/translator.rb +2 -2
  139. data/lib/generators/camaleon_cms/gem_plugin_generator.rb +1 -1
  140. data/lib/generators/camaleon_cms/gem_plugin_template/config/camaleon_plugin.json +1 -1
  141. data/lib/generators/camaleon_cms/install_generator.rb +1 -0
  142. data/lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/main_helper.rb +1 -4
  143. data/lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/views/index.html.erb +1 -25
  144. data/lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/views/layouts/index.html.erb +17 -18
  145. data/lib/plugin_routes.rb +4 -4
  146. metadata +25 -48
  147. data/app/apps/plugins/contact_form/admin_forms_controller.rb +0 -85
  148. data/app/apps/plugins/contact_form/assets/css/admin/form-builder/formbuilder.css +0 -70
  149. data/app/apps/plugins/contact_form/assets/css/contact-form.css +0 -8
  150. data/app/apps/plugins/contact_form/assets/css/front/railsform.scss +0 -94
  151. data/app/apps/plugins/contact_form/assets/css/readme.txt +0 -1
  152. data/app/apps/plugins/contact_form/assets/js/contact_form.js +0 -2
  153. data/app/apps/plugins/contact_form/assets/js/form-builder/formbuilder.js +0 -1271
  154. data/app/apps/plugins/contact_form/assets/js/form-builder/vendor.js +0 -3072
  155. data/app/apps/plugins/contact_form/assets/js/readme.txt +0 -1
  156. data/app/apps/plugins/contact_form/config/config.json +0 -35
  157. data/app/apps/plugins/contact_form/config/custom_models.rb +0 -3
  158. data/app/apps/plugins/contact_form/config/locales/readme.txt +0 -1
  159. data/app/apps/plugins/contact_form/config/locales/translation.yml +0 -315
  160. data/app/apps/plugins/contact_form/config/routes_admin.txt +0 -4
  161. data/app/apps/plugins/contact_form/config/routes_front.txt +0 -2
  162. data/app/apps/plugins/contact_form/contact_form_helper.rb +0 -154
  163. data/app/apps/plugins/contact_form/contact_form_html_helper.rb +0 -140
  164. data/app/apps/plugins/contact_form/front_controller.rb +0 -50
  165. data/app/apps/plugins/contact_form/models/contact_form.rb +0 -26
  166. data/app/apps/plugins/contact_form/views/admin_forms/_form.html.erb +0 -33
  167. data/app/apps/plugins/contact_form/views/admin_forms/edit.html.erb +0 -338
  168. data/app/apps/plugins/contact_form/views/admin_forms/index.html.erb +0 -65
  169. data/app/apps/plugins/contact_form/views/admin_forms/responses.html.erb +0 -60
  170. data/app/apps/plugins/contact_form/views/contact_form/_email_content.html.erb +0 -26
  171. data/app/apps/plugins/contact_form/views/forms_shorcode.html.erb +0 -28
  172. data/app/apps/plugins/contact_form/views/front/index.html.erb +0 -3
  173. data/app/apps/themes/camaleon_first/views/admin/settings.html.erb +0 -4
  174. data/app/apps/themes/new/assets/css/bootstrap/bootstrap.min.css +0 -6735
  175. data/app/apps/themes/new/assets/js/plugins/bootstrap/bootstrap.min.js +0 -6
  176. data/app/apps/themes/new/assets/js/plugins/jquery/jquery.min.js +0 -4
  177. data/lib/generators/camaleon_cms/gem_theme_generator.rb +0 -97
  178. data/lib/generators/camaleon_cms/gem_theme_template/app/assets/images/themes/my_plugin/image.png +0 -0
  179. data/lib/generators/camaleon_cms/gem_theme_template/app/assets/javascripts/themes/my_plugin/main.js +0 -14
  180. data/lib/generators/camaleon_cms/gem_theme_template/app/assets/stylesheets/themes/my_plugin/main.css +0 -13
  181. data/lib/generators/camaleon_cms/gem_theme_template/app/helpers/themes/my_plugin/main_helper.rb +0 -26
  182. data/lib/generators/camaleon_cms/gem_theme_template/app/views/themes/my_plugin/admin/settings.html.erb +0 -4
  183. data/lib/generators/camaleon_cms/gem_theme_template/app/views/themes/my_plugin/index.html.erb +0 -25
  184. data/lib/generators/camaleon_cms/gem_theme_template/app/views/themes/my_plugin/layouts/index.html.erb +0 -70
  185. data/lib/generators/camaleon_cms/gem_theme_template/app/views/themes/my_plugin/partials/readme.txt +0 -1
  186. data/lib/generators/camaleon_cms/gem_theme_template/config/camaleon_theme.json +0 -14
@@ -1,85 +0,0 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
- class Plugins::ContactForm::AdminFormsController < CamaleonCms::Apps::PluginsAdminController
10
- before_action :set_form, only: ['show','edit','update','destroy']
11
- add_breadcrumb I18n.t("plugin.contact_form.contact_form"), :admin_plugins_contact_form_admin_forms_path
12
-
13
- def index
14
- # here your actions for admin panel
15
- @forms = current_site.contact_forms.where("parent_id is null").all
16
- @forms = @forms.paginate(:page => params[:page], :per_page => current_site.admin_per_page)
17
- end
18
-
19
- def edit
20
- add_breadcrumb I18n.t("camaleon_cms.admin.button.edit")
21
- append_asset_libraries({"plugin_contact_form"=> { js: [plugin_asset_path("js/contact_form.js")], css: [plugin_asset_path("css/contact-form.css")] }})
22
- render "edit"
23
- end
24
-
25
- def update
26
- if @form.update(params[:plugins_contact_form_models_contact_form])
27
-
28
- settings = {"railscf_mail" => params[:railscf_mail], "railscf_message" => params[:railscf_message], "railscf_form_button" => params[:railscf_form_button]}.to_json
29
- current_site.contact_forms.where(id: @form.id).update_or_create({settings: fix_meta_value(settings)})
30
- current_site.contact_forms.where(id: @form.id).update_or_create({value: params[:meta]})
31
-
32
- flash[:notice] = t('camaleon_cms.admin.message.updated_success')
33
- redirect_to action: :edit, id: @form.id
34
- else
35
- edit
36
- end
37
- end
38
-
39
- def create
40
-
41
- params[:plugins_contact_form_models_contact_form][:value] = {"fields" => []}.to_json
42
- params[:plugins_contact_form_models_contact_form][:settings] = {}.to_json
43
-
44
- data_form = params[:plugins_contact_form_models_contact_form]
45
- @form = current_site.contact_forms.new(data_form)
46
-
47
- if @form.save
48
- flash[:notice] = "#{t('plugin.contact_form.message.save')}"
49
- redirect_to action: :edit, id: @form.id
50
- else
51
- flash[:error] = @form.errors.full_messages.join(', ')
52
- redirect_to action: :index
53
- end
54
- end
55
-
56
- def destroy
57
- flash[:notice] = "#{t('plugin.contact_form.message.delete')}" if @form.destroy
58
-
59
- redirect_to action: :index
60
- end
61
-
62
- def responses
63
- @form = current_site.contact_forms.where({id: params[:admin_form_id]}).first
64
- values = JSON.parse(@form.value).to_sym
65
-
66
- @op_fields = values[:fields]
67
- @forms = current_site.contact_forms.where({parent_id: @form.id})
68
- @forms = @forms.paginate(:page => params[:page], :per_page => current_site.admin_per_page)
69
- end
70
-
71
- def manual
72
-
73
- end
74
-
75
- # here add your custom functions
76
- private
77
- def set_form
78
- begin
79
- @form = current_site.contact_forms.find_by_id(params[:id])
80
- rescue
81
- flash[:error] = "Error form class"
82
- redirect_to cama_admin_path
83
- end
84
- end
85
- end
@@ -1,70 +0,0 @@
1
- .fb-button{float:right;/*display:inline-block;*/margin:0;padding:.563rem .844rem;border:0 none;background:#16a085;color:#fff;text-align:center;text-decoration:none;font-size:12px;line-height:1.5;cursor:pointer;border-radius:.125rem;border:thin solid #19b394;border-bottom:2px solid #16a085}
2
- .js-save-form.btn.btn-default[disabled]{float: right; display: none}
3
- .fb-button[disabled]{float:right;background:#ddd !important;border:thin solid #ccc;color:#777 !important;text-shadow:none !important;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=65)";opacity:.65;cursor:default}
4
- .fb-clear{clear:both}
5
- .fb-main{max-width:1000px;margin:0 auto;padding:0 20px 0 0;position:relative;font-family:'Source Sans Pro','Open Sans',Tahoma}
6
- .fb-save-wrapper{/*position:absolute;right:20px;top:10px*/}
7
- .fb-left{float:left;padding-top: 0;/*width:320px; padding-top:30px*/ }
8
- .fb-right{/*padding-top:70px;*/ margin-left: 0; /*margin-left:320px;*/ /*border-left:1px solid #ddd;*/padding-left:20px;min-height:100%;overflow:hidden}
9
- .fb-no-response-fields{color:#999}
10
- .fb-tabs{list-style:none;margin:0 0 20px 0; padding:0; /*padding:0 0 0 20px;*/border-bottom:1px solid #ccc}
11
- .fb-tabs li{display:inline-block}
12
- .fb-tabs li a{display:block;padding: 5px;color: #333; text-decoration: none;/*padding:10px;*/border-radius:5px 5px 0 0;font-size:13px;cursor:pointer;border-left:1px solid transparent;border-right:1px solid transparent}
13
- .fb-tabs li a:hover{background: #f5f5f5;}
14
- .fb-tabs li.active a{border:1px solid #ccc;margin-bottom:-1px;border-bottom-color:#fff; background-color: #3fbae4; border-color: #3fbae4; color: #ffffff;}
15
- .fb-tabs li.active a:hover{background-color: #3fbae4; border-color: #3fbae4;}
16
- .fb-tab-content .fb-tab-pane{/*padding:0 20px;*/display:none}
17
- .fb-tab-content .fb-tab-pane.active{display:block}
18
- .fb-add-field-types .section{padding-bottom:5px;margin-bottom:20px}
19
- .fb-add-field-types{font-size:0}
20
- .fb-add-field-types a{font-size:13px;display:inline-block;width:48.5%;/*background-color:#1abc9c;*/margin-bottom:9px;box-sizing:border-box}
21
- .fb-add-field-types a:nth-child(odd){margin-right:3%}
22
- .fb-add-field-types a .symbol{opacity:.6;margin:0 .25em 0 -1em}
23
- .fb-response-fields{padding-bottom:150px}
24
- .fb-response-fields a.sortable-placeholder{display:block;border:1px dashed #ddd;min-height:80px;height:80px;width:100%}
25
- .fb-field-wrapper{cursor:pointer;position:relative;margin-bottom:20px}
26
- .fb-field-wrapper input{border-radius:3px;border:thin solid #ddd}
27
- .fb-field-wrapper:hover .actions-wrapper,.fb-field-wrapper.editing .actions-wrapper{display:block}
28
- .fb-field-wrapper:hover .subtemplate-wrapper{border-color:#ddd;border-radius:3px}
29
- .fb-field-wrapper.editing{background-color:#ecf0f1;border-radius:3px}
30
- .fb-field-wrapper.editing .subtemplate-wrapper{border-color:#d9e1e3;border-style:solid;margin:0;border-radius:3px}
31
- .fb-field-wrapper .actions-wrapper{display:none;position:absolute;top:-7px;right:5px;z-index:3}
32
- .fb-field-wrapper .actions-wrapper a{display:inline-block;background-color:#ccc;padding:2px 8px}
33
- .edit-response-field input,.edit-response-field textarea,.edit-response-field select{border:thin solid #ddd;border-radius:.25em;padding:.5em;display:inline-block;height:auto;vertical-align:middle}
34
- .edit-response-field input:focus,.edit-response-field textarea:focus,.edit-response-field select:focus{outline:none;border:thin solid #1abc9c}
35
- .edit-response-field select{font-size:14px}
36
- .fb-field-wrapper .actions-wrapper a.js-duplicate,.fb-edit-field-wrapper .js-add-option{background-color:#ccc;border:none}
37
- .fb-field-wrapper .actions-wrapper a.js-clear,.fb-edit-field-wrapper .js-remove-option{background-color:#ccc;border:none}
38
- .fb-field-wrapper .subtemplate-wrapper{border:1px dashed transparent;margin-bottom:10px;padding:10px;position:relative}
39
- .fb-field-wrapper .subtemplate-wrapper .cover{position:absolute;top:0;left:0;height:100%;width:100%;z-index:2}
40
- .fb-field-wrapper .subtemplate-wrapper > label{display:block;border-bottom:thin solid #eee;padding-bottom:3px;margin-bottom:7px}
41
- .fb-field-wrapper .subtemplate-wrapper abbr{color:#f00}
42
- .fb-field-wrapper .input-line{clear:both;margin-bottom:10px}
43
- .fb-field-wrapper .input-line .above-line{margin-top:7px}
44
- .fb-field-wrapper .input-line > span{display:inline-block;vertical-align:top}
45
- .fb-field-wrapper .input-line > span input{width:100%}
46
- .fb-field-wrapper .input-line > span > label{display:block;font-size:13px;margin-left:3px}
47
- .fb-field-wrapper .help-block{display:block;font-size:12px;margin-top:5px}
48
- .fb-edit-field-wrapper{font-size:13px}
49
- .fb-edit-field-wrapper .fb-field-label{font-weight:normal;/*background:#eee;*/padding:.75em;color:#666;font-size:1.25em}
50
- .fb-edit-field-wrapper .fb-field-label .field-type{margin-top:.5em;display:block;font-family:'Source Sans Pro',sans-serif;font-size:1em}
51
- .fb-edit-field-wrapper .fb-field-label .field-type:before{content:'Type: ';color:#999}
52
- .fb-edit-field-wrapper .fb-field-label .fa.fa-arrow-right{display:none}
53
- .fb-edit-field-wrapper .fb-edit-section-header{border-bottom:1px solid #ddd;margin-top:25px;margin-bottom:10px;padding-bottom:5px;clear:both;font-weight:700}
54
- .fb-edit-field-wrapper .js-add-option,.fb-edit-field-wrapper .js-remove-option{padding:3px 6px}
55
- .fb-edit-field-wrapper .fb-bottom-add{margin-top:8px}
56
- .fb-edit-field-wrapper .option{ margin: 0 0 10px 0}
57
- .fb-common-wrapper .fb-label-description{margin-bottom:10px}
58
- .fb-common-wrapper .fb-label-description input,.fb-common-wrapper .fb-label-description textarea{width:100%}
59
- .fb-common-wrapper .fb-label-description textarea{min-height:5em}
60
- .response-field-draggable-helper{border:1px dashed #ddd;background:#eee}
61
- .response-field-text input.form-control{width:100%}
62
- .response-field-paragraph textarea.form-control{width:100%;min-height:100px}
63
- .response-field-textarea textarea.form-control{width:100%;min-height:100px}
64
- .response-field-address .street{width:400px}
65
- .response-field-address .city,.response-field-address .state,.response-field-address .zip,.response-field-address .country{width:198px}
66
- .response-field-date .month,.response-field-date .day,.response-field-date .year{width:50px}
67
- .response-field-time .hours,.response-field-time .minutes,.response-field-time .seconds{width:50px}
68
- .response-field-checkboxes .fb-option,.response-field-radio .fb-option{margin-bottom:5px;display:inline-block}
69
- .response-field-website input{/*width:200px*/}
70
- .radio, .checkbox {float: none;}
@@ -1,8 +0,0 @@
1
- /*
2
- *= require ./admin/form-builder/formbuilder
3
- */
4
-
5
- .fb-add-field-types a{
6
- font-size: 11px;
7
- min-width: 110px;
8
- }
@@ -1,94 +0,0 @@
1
- .railscf-form-group{
2
- margin-bottom: 15px;
3
- .red{
4
- color: #ff0000;
5
- }
6
- label{
7
- display: inline-block;
8
- margin-bottom: 5px;
9
- max-width: 100%;
10
- }
11
-
12
- textarea{
13
- overflow: auto;
14
-
15
- &.railscf-size-small {
16
- min-height: 60px;
17
- width: 200px;
18
- }
19
- &.railscf-size-medium {
20
- min-height: 100px;
21
- width: 400px;
22
- }
23
- &.railscf-size-large {
24
- min-height: 200px;
25
- width: 100%;
26
- }
27
- }
28
-
29
- select{
30
- &.railscf-form-control{
31
- width: auto;
32
- display: block;
33
- }
34
-
35
- }
36
-
37
- input{
38
- &.railscf-field-website,
39
- &.railscf-field-email,
40
- &.railscf-field-captcha{
41
- width: 200px;
42
- }
43
-
44
- &.railscf-size-small{
45
- width: 130px;
46
- }
47
-
48
- &.railscf-size-medium{
49
- width: 300px;
50
- }
51
-
52
- &.railscf-size-large{
53
- width: 100%;
54
- }
55
- }
56
-
57
- .radio,
58
- .checkbox {
59
- display: block;
60
- margin-bottom: 10px;
61
- margin-top: 10px;
62
- min-height: 20px;
63
- position: relative;
64
-
65
- > label{
66
- cursor: pointer;
67
- font-weight: 400;
68
- margin-bottom: 0;
69
- padding-left: 20px;
70
- }
71
- }
72
-
73
- .radio input[type="radio"],
74
- .radio-inline input[type="radio"],
75
- .checkbox input[type="checkbox"],
76
- .checkbox-inline input[type="checkbox"]{
77
- margin-left: -20px;
78
- position: absolute;
79
- }
80
-
81
- .railscf-form-control {
82
- background: none repeat scroll 0 0 #f9f9f9;
83
- border: 1px solid #e5e5e5;
84
- box-shadow: none;
85
- border-radius: 4px;
86
- font-size: 12px;
87
- height: 30px;
88
- line-height: 18px;
89
- transition: all 200ms ease 0s;
90
-
91
- padding: 6px 12px;
92
- width: 100%;
93
- }
94
- }
@@ -1 +0,0 @@
1
- Here all your css files
@@ -1,2 +0,0 @@
1
- //= require ./form-builder/vendor
2
- //= require ./form-builder/formbuilder
@@ -1,1271 +0,0 @@
1
- (function() {
2
- rivets.binders.input = {
3
- publishes: true,
4
- routine: rivets.binders.value.routine,
5
- bind: function(el) {
6
- return $(el).bind('input.rivets', this.publish);
7
- },
8
- unbind: function(el) {
9
- return $(el).unbind('input.rivets');
10
- }
11
- };
12
-
13
- rivets.configure({
14
- prefix: "rv",
15
- adapter: {
16
- subscribe: function(obj, keypath, callback) {
17
- callback.wrapped = function(m, v) {
18
- return callback(v);
19
- };
20
- return obj.on('change:' + keypath, callback.wrapped);
21
- },
22
- unsubscribe: function(obj, keypath, callback) {
23
- return obj.off('change:' + keypath, callback.wrapped);
24
- },
25
- read: function(obj, keypath) {
26
- if (keypath === "cid") {
27
- return obj.cid;
28
- }
29
- return obj.get(keypath);
30
- },
31
- publish: function(obj, keypath, value) {
32
- if (obj.cid) {
33
- return obj.set(keypath, value);
34
- } else {
35
- return obj[keypath] = value;
36
- }
37
- }
38
- }
39
- });
40
-
41
- }).call(this);
42
-
43
- (function() {
44
- var BuilderView, EditFieldView, Formbuilder, FormbuilderCollection, FormbuilderModel, ViewFieldView, _ref, _ref1, _ref2, _ref3, _ref4,
45
- __hasProp = {}.hasOwnProperty,
46
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
47
-
48
- FormbuilderModel = (function(_super) {
49
- __extends(FormbuilderModel, _super);
50
-
51
- function FormbuilderModel() {
52
- _ref = FormbuilderModel.__super__.constructor.apply(this, arguments);
53
- return _ref;
54
- }
55
-
56
- FormbuilderModel.prototype.sync = function() {};
57
-
58
- FormbuilderModel.prototype.indexInDOM = function() {
59
- var $wrapper,
60
- _this = this;
61
- $wrapper = $(".fb-field-wrapper").filter((function(_, el) {
62
- return $(el).data('cid') === _this.cid;
63
- }));
64
- return $(".fb-field-wrapper").index($wrapper);
65
- };
66
-
67
- FormbuilderModel.prototype.is_input = function() {
68
- return Formbuilder.inputFields[this.get(Formbuilder.options.mappings.FIELD_TYPE)] != null;
69
- };
70
-
71
- return FormbuilderModel;
72
-
73
- })(Backbone.DeepModel);
74
-
75
- FormbuilderCollection = (function(_super) {
76
- __extends(FormbuilderCollection, _super);
77
-
78
- function FormbuilderCollection() {
79
- _ref1 = FormbuilderCollection.__super__.constructor.apply(this, arguments);
80
- return _ref1;
81
- }
82
-
83
- FormbuilderCollection.prototype.initialize = function() {
84
- return this.on('add', this.copyCidToModel);
85
- };
86
-
87
- FormbuilderCollection.prototype.model = FormbuilderModel;
88
-
89
- FormbuilderCollection.prototype.comparator = function(model) {
90
- return model.indexInDOM();
91
- };
92
-
93
- FormbuilderCollection.prototype.copyCidToModel = function(model) {
94
- return model.attributes.cid = model.cid;
95
- };
96
-
97
- return FormbuilderCollection;
98
-
99
- })(Backbone.Collection);
100
-
101
- ViewFieldView = (function(_super) {
102
- __extends(ViewFieldView, _super);
103
-
104
- function ViewFieldView() {
105
- _ref2 = ViewFieldView.__super__.constructor.apply(this, arguments);
106
- return _ref2;
107
- }
108
-
109
- ViewFieldView.prototype.className = "fb-field-wrapper";
110
-
111
- ViewFieldView.prototype.events = {
112
- 'click .subtemplate-wrapper': 'focusEditView',
113
- 'click .js-duplicate': 'duplicate',
114
- 'click .js-clear': 'clear'
115
- };
116
-
117
- ViewFieldView.prototype.initialize = function(options) {
118
- this.parentView = options.parentView;
119
- this.listenTo(this.model, "change", this.render);
120
- return this.listenTo(this.model, "destroy", this.remove);
121
- };
122
-
123
- ViewFieldView.prototype.render = function() {
124
- this.$el.addClass('response-field-' + this.model.get(Formbuilder.options.mappings.FIELD_TYPE)).data('cid', this.model.cid).html(Formbuilder.templates["view/base" + (!this.model.is_input() ? '_non_input' : '')]({
125
- rf: this.model
126
- }));
127
- return this;
128
- };
129
-
130
- ViewFieldView.prototype.focusEditView = function() {
131
- return this.parentView.createAndShowEditView(this.model);
132
- };
133
-
134
- ViewFieldView.prototype.clear = function(e) {
135
- var cb, x,
136
- _this = this;
137
- e.preventDefault();
138
- e.stopPropagation();
139
- cb = function() {
140
- _this.parentView.handleFormUpdate();
141
- return _this.model.destroy();
142
- };
143
- x = Formbuilder.options.CLEAR_FIELD_CONFIRM;
144
- switch (typeof x) {
145
- case 'string':
146
- if (confirm(x)) {
147
- return cb();
148
- }
149
- break;
150
- case 'function':
151
- return x(cb);
152
- default:
153
- return cb();
154
- }
155
- };
156
-
157
- ViewFieldView.prototype.duplicate = function() {
158
- var attrs;
159
- attrs = _.clone(this.model.attributes);
160
- delete attrs['id'];
161
- attrs['label'] += ' Copy';
162
- return this.parentView.createField(attrs, {
163
- position: this.model.indexInDOM() + 1
164
- });
165
- };
166
-
167
- return ViewFieldView;
168
-
169
- })(Backbone.View);
170
-
171
- EditFieldView = (function(_super) {
172
- __extends(EditFieldView, _super);
173
-
174
- function EditFieldView() {
175
- _ref3 = EditFieldView.__super__.constructor.apply(this, arguments);
176
- return _ref3;
177
- }
178
-
179
- EditFieldView.prototype.className = "edit-response-field";
180
-
181
- EditFieldView.prototype.events = {
182
- 'click .js-add-option': 'addOption',
183
- 'click .js-remove-option': 'removeOption',
184
- 'click .js-default-updated': 'defaultUpdated',
185
- 'input .option-label-input': 'forceRender'
186
- };
187
-
188
- EditFieldView.prototype.initialize = function(options) {
189
- this.parentView = options.parentView;
190
- return this.listenTo(this.model, "destroy", this.remove);
191
- };
192
-
193
- EditFieldView.prototype.render = function() {
194
-
195
- this.$el.html(Formbuilder.templates["edit/base" + (!this.model.is_input() ? '_non_input' : '')]({
196
- rf: this.model
197
- }));
198
- this.$el.find('.fields-cid').html(this.model.attributes.cid);
199
-
200
- rivets.bind(this.$el, {
201
- model: this.model
202
- });
203
-
204
- return this;
205
- };
206
-
207
- EditFieldView.prototype.remove = function() {
208
- this.parentView.editView = void 0;
209
- this.parentView.$el.find("[data-target=\"#addField\"]").click();
210
- return EditFieldView.__super__.remove.apply(this, arguments);
211
- };
212
-
213
- EditFieldView.prototype.addOption = function(e) {
214
- var $el, i, newOption, options;
215
- $el = $(e.currentTarget);
216
- i = this.$el.find('.option').index($el.closest('.option'));
217
- options = this.model.get(Formbuilder.options.mappings.OPTIONS) || [];
218
- newOption = {
219
- label: "",
220
- checked: false
221
- };
222
- if (i > -1) {
223
- options.splice(i + 1, 0, newOption);
224
- } else {
225
- options.push(newOption);
226
- }
227
- this.model.set(Formbuilder.options.mappings.OPTIONS, options);
228
- this.model.trigger("change:" + Formbuilder.options.mappings.OPTIONS);
229
- return this.forceRender();
230
- };
231
-
232
- EditFieldView.prototype.removeOption = function(e) {
233
- var $el, index, options;
234
- $el = $(e.currentTarget);
235
- index = this.$el.find(".js-remove-option").index($el);
236
- options = this.model.get(Formbuilder.options.mappings.OPTIONS);
237
- options.splice(index, 1);
238
- this.model.set(Formbuilder.options.mappings.OPTIONS, options);
239
- this.model.trigger("change:" + Formbuilder.options.mappings.OPTIONS);
240
- return this.forceRender();
241
- };
242
-
243
- EditFieldView.prototype.defaultUpdated = function(e) {
244
- var $el;
245
- $el = $(e.currentTarget);
246
- if (this.model.get(Formbuilder.options.mappings.FIELD_TYPE) !== 'checkboxes') {
247
- this.$el.find(".js-default-updated").not($el).attr('checked', false).trigger('change');
248
- }
249
- return this.forceRender();
250
- };
251
-
252
- EditFieldView.prototype.forceRender = function() {
253
- return this.model.trigger('change');
254
- };
255
-
256
- return EditFieldView;
257
-
258
- })(Backbone.View);
259
-
260
- BuilderView = (function(_super) {
261
- __extends(BuilderView, _super);
262
-
263
- function BuilderView() {
264
- _ref4 = BuilderView.__super__.constructor.apply(this, arguments);
265
- return _ref4;
266
- }
267
-
268
- BuilderView.prototype.SUBVIEWS = [];
269
-
270
- BuilderView.prototype.events = {
271
- 'click .js-save-form': 'saveForm',
272
- 'click .fb-tabs a': 'showTab',
273
- 'click .fb-add-field-types a': 'addField',
274
- 'mouseover .fb-add-field-types': 'lockLeftWrapper',
275
- 'mouseout .fb-add-field-types': 'unlockLeftWrapper'
276
- };
277
-
278
- BuilderView.prototype.initialize = function(options) {
279
- var selector;
280
- selector = options.selector, this.formBuilder = options.formBuilder, this.bootstrapData = options.bootstrapData, Formbuilder.options.LANG = options.lang;
281
- if (selector != null) {
282
- this.setElement($(selector));
283
- }
284
- this.collection = new FormbuilderCollection;
285
- this.collection.bind('add', this.addOne, this);
286
- this.collection.bind('reset', this.reset, this);
287
- this.collection.bind('change', this.handleFormUpdate, this);
288
- this.collection.bind('destroy add reset', this.hideShowNoResponseFields, this);
289
- this.collection.bind('destroy', this.ensureEditViewScrolled, this);
290
- this.render();
291
- this.collection.reset(this.bootstrapData);
292
- return this.bindSaveEvent();
293
- };
294
-
295
- BuilderView.prototype.bindSaveEvent = function() {
296
- var _this = this;
297
- this.formSaved = true;
298
- this.saveFormButton = this.$el.find(".js-save-form");
299
- this.saveFormButton.attr('disabled', true).text(Formbuilder.options.dict.ALL_CHANGES_SAVED);
300
- if (!!Formbuilder.options.AUTOSAVE) {
301
- setInterval(function() {
302
- return _this.saveForm.call(_this);
303
- }, 1000);
304
- }
305
- return true;
306
- return $(window).bind('beforeunload', function() {
307
- if (_this.formSaved) {
308
- return void 0;
309
- } else {
310
- return Formbuilder.options.dict.UNSAVED_CHANGES;
311
- }
312
- });
313
- };
314
-
315
- BuilderView.prototype.reset = function() {
316
- this.$responseFields.html('');
317
- return this.addAll();
318
- };
319
-
320
- BuilderView.prototype.render = function() {
321
- var subview, _i, _len, _ref5;
322
- this.$el.html(Formbuilder.templates['page']());
323
- this.$fbLeft = this.$el.find('.fb-left');
324
- this.$responseFields = this.$el.find('.fb-response-fields');
325
- this.bindWindowScrollEvent();
326
- this.hideShowNoResponseFields();
327
- _ref5 = this.SUBVIEWS;
328
- for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
329
- subview = _ref5[_i];
330
- new subview({
331
- parentView: this
332
- }).render();
333
- }
334
- return this;
335
- };
336
-
337
- BuilderView.prototype.bindWindowScrollEvent = function() {
338
- var _this = this;
339
- return $(window).on('scroll', function() {
340
- var maxMargin, newMargin;
341
- if (_this.$fbLeft.data('locked') === true) {
342
- return;
343
- }
344
- newMargin = Math.max(0, $(window).scrollTop() - _this.$el.offset().top);
345
- maxMargin = _this.$responseFields.height();
346
- return _this.$fbLeft.css({
347
- //'margin-top': Math.min(maxMargin, newMargin)
348
- });
349
- });
350
- };
351
-
352
- BuilderView.prototype.showTab = function(e) {
353
- var $el, first_model, target;
354
- $el = $(e.currentTarget);
355
- target = $el.data('target');
356
- $el.closest('li').addClass('active').siblings('li').removeClass('active');
357
- $(target).addClass('active').siblings('.fb-tab-pane').removeClass('active');
358
- if (target !== '#editField') {
359
- this.unlockLeftWrapper();
360
- }
361
- if (target === '#editField' && !this.editView && (first_model = this.collection.models[0])) {
362
- return this.createAndShowEditView(first_model);
363
- }
364
- };
365
-
366
- BuilderView.prototype.addOne = function(responseField, _, options) {
367
- var $replacePosition, view;
368
- view = new ViewFieldView({
369
- model: responseField,
370
- parentView: this
371
- });
372
- if (options.$replaceEl != null) {
373
- return options.$replaceEl.replaceWith(view.render().el);
374
- } else if ((options.position == null) || options.position === -1) {
375
- return this.$responseFields.append(view.render().el);
376
- } else if (options.position === 0) {
377
- return this.$responseFields.prepend(view.render().el);
378
- } else if (($replacePosition = this.$responseFields.find(".fb-field-wrapper").eq(options.position))[0]) {
379
- return $replacePosition.before(view.render().el);
380
- } else {
381
- return this.$responseFields.append(view.render().el);
382
- }
383
- };
384
-
385
- BuilderView.prototype.setSortable = function() {
386
- var _this = this;
387
- if (this.$responseFields.hasClass('ui-sortable')) {
388
- this.$responseFields.sortable('destroy');
389
- }
390
- this.$responseFields.sortable({
391
- forcePlaceholderSize: true,
392
- placeholder: 'sortable-placeholder',
393
- axis: 'y',
394
- containment: '.fb-response-fields',
395
- stop: function(e, ui) {
396
- var rf;
397
- if (ui.item.data('field-type')) {
398
- rf = _this.collection.create(Formbuilder.helpers.defaultFieldAttrs(ui.item.data('field-type')), {
399
- $replaceEl: ui.item
400
- });
401
- _this.createAndShowEditView(rf);
402
- }
403
- _this.handleFormUpdate();
404
- return true;
405
- },
406
- update: function(e, ui) {
407
- if (!ui.item.data('field-type')) {
408
- return _this.ensureEditViewScrolled();
409
- }
410
- }
411
- });
412
- return this.setDraggable();
413
- };
414
-
415
- BuilderView.prototype.setDraggable = function() {
416
- var $addFieldButtons,
417
- _this = this;
418
- $addFieldButtons = this.$el.find("[data-field-type]");
419
- //return $addFieldButtons.draggable({
420
- // connectToSortable: this.$responseFields,
421
- // helper: function() {
422
- // var $helper;
423
- // $helper = $("<div class='response-field-draggable-helper' />");
424
- // $helper.css({
425
- // width: _this.$responseFields.width(),
426
- // height: '80px'
427
- // });
428
- // return $helper;
429
- // }
430
- //});
431
- };
432
-
433
- BuilderView.prototype.addAll = function() {
434
- this.collection.each(this.addOne, this);
435
- return this.setSortable();
436
- };
437
-
438
- BuilderView.prototype.hideShowNoResponseFields = function() {
439
- return this.$el.find(".fb-no-response-fields")[this.collection.length > 0 ? 'hide' : 'show']();
440
- };
441
-
442
- BuilderView.prototype.addField = function(e) {
443
- var field_type;
444
- field_type = $(e.currentTarget).data('field-type');
445
- return this.createField(Formbuilder.helpers.defaultFieldAttrs(field_type));
446
- };
447
-
448
- BuilderView.prototype.createField = function(attrs, options) {
449
- var rf;
450
- rf = this.collection.create(attrs, options);
451
- this.createAndShowEditView(rf);
452
- return this.handleFormUpdate();
453
- };
454
-
455
- BuilderView.prototype.createAndShowEditView = function(model) {
456
- var $newEditEl, $responseFieldEl, $sortableOption;
457
- $responseFieldEl = this.$el.find(".fb-field-wrapper").filter(function() {
458
- return $(this).data('cid') === model.cid;
459
- });
460
-
461
- $responseFieldEl.addClass('editing').siblings('.fb-field-wrapper').removeClass('editing');
462
- if (this.editView) {
463
- if (this.editView.model.cid === model.cid) {
464
- this.$el.find(".fb-tabs a[data-target=\"#editField\"]").click();
465
- this.scrollLeftWrapper($responseFieldEl);
466
- return;
467
- }
468
- this.editView.remove();
469
- }
470
- this.editView = new EditFieldView({
471
- model: model,
472
- parentView: this
473
- });
474
- $newEditEl = this.editView.render().$el;
475
- this.$el.find(".fb-edit-field-wrapper").html($newEditEl);
476
- this.$el.find(".fb-tabs a[data-target=\"#editField\"]").click();
477
- this.scrollLeftWrapper($responseFieldEl);
478
- return this;
479
- };
480
-
481
- BuilderView.prototype.ensureEditViewScrolled = function() {
482
- if (!this.editView) {
483
- return;
484
- }
485
- return this.scrollLeftWrapper($(".fb-field-wrapper.editing"));
486
- };
487
-
488
- BuilderView.prototype.scrollLeftWrapper = function($responseFieldEl) {
489
- var _this = this;
490
- this.unlockLeftWrapper();
491
- if (!$responseFieldEl[0]) {
492
- return;
493
- }
494
- return $.scrollWindowTo((this.$el.offset().top + $responseFieldEl.offset().top) - this.$responseFields.offset().top, 200, function() {
495
- return _this.lockLeftWrapper();
496
- });
497
- };
498
-
499
- BuilderView.prototype.lockLeftWrapper = function() {
500
- return this.$fbLeft.data('locked', true);
501
- };
502
-
503
- BuilderView.prototype.unlockLeftWrapper = function() {
504
- return this.$fbLeft.data('locked', false);
505
- };
506
-
507
- BuilderView.prototype.handleFormUpdate = function() {
508
- if (this.updatingBatch) {
509
- return;
510
- }
511
- this.formSaved = false;
512
- return this.saveFormButton.removeAttr('disabled').text(Formbuilder.options.dict.SAVE_FORM);
513
- };
514
-
515
- BuilderView.prototype.saveForm = function(e) {
516
- var payload;
517
- if (this.formSaved) {
518
- return;
519
- }
520
- this.formSaved = true;
521
- this.saveFormButton.attr('disabled', true).text(Formbuilder.options.dict.ALL_CHANGES_SAVED);
522
- this.collection.sort();
523
- payload = JSON.stringify({
524
- fields: this.collection.toJSON()
525
- });
526
- if (Formbuilder.options.HTTP_ENDPOINT) {
527
- this.doAjaxSave(payload);
528
- }
529
- return this.formBuilder.trigger('save', payload);
530
- };
531
-
532
- BuilderView.prototype.doAjaxSave = function(payload) {
533
- var _this = this;
534
- return $.ajax({
535
- url: Formbuilder.options.HTTP_ENDPOINT,
536
- type: Formbuilder.options.HTTP_METHOD,
537
- data: payload,
538
- contentType: "application/json",
539
- success: function(data) {
540
- var datum, _i, _len, _ref5;
541
- _this.updatingBatch = true;
542
- for (_i = 0, _len = data.length; _i < _len; _i++) {
543
- datum = data[_i];
544
- if ((_ref5 = _this.collection.get(datum.cid)) != null) {
545
- _ref5.set({
546
- id: datum.id
547
- });
548
- }
549
- _this.collection.trigger('sync');
550
- }
551
- return _this.updatingBatch = void 0;
552
- }
553
- });
554
- };
555
-
556
- return BuilderView;
557
-
558
- })(Backbone.View);
559
-
560
- Formbuilder = (function() {
561
- Formbuilder.helpers = {
562
- defaultFieldAttrs: function(field_type) {
563
- var attrs, _base;
564
- attrs = {};
565
- attrs[Formbuilder.options.mappings.LABEL] = Formbuilder.options.LANG.untitled;
566
- attrs[Formbuilder.options.mappings.FIELD_TYPE] = field_type;
567
- attrs[Formbuilder.options.mappings.REQUIRED] = true;
568
- attrs['field_options'] = {};
569
- return (typeof (_base = Formbuilder.fields[field_type]).defaultAttributes === "function" ? _base.defaultAttributes(attrs) : void 0) || attrs;
570
- },
571
- simple_format: function(x) {
572
- return x != null ? x.replace(/\n/g, '<br />') : void 0;
573
- }
574
- };
575
-
576
- Formbuilder.options = {
577
- BUTTON_CLASS: 'btn btn-default',//'fb-button',
578
- HTTP_ENDPOINT: '',
579
- HTTP_METHOD: 'POST',
580
- AUTOSAVE: true,
581
- CLEAR_FIELD_CONFIRM: false,
582
- LANG: {},
583
- mappings: {
584
- FIELD_CLASS: 'field_options.field_class',
585
- SIZE: 'field_options.size',
586
- UNITS: 'field_options.units',
587
- LABEL: 'label',
588
- FIELD_TYPE: 'field_type',
589
- REQUIRED: 'required',
590
- ADMIN_ONLY: 'admin_only',
591
- OPTIONS: 'field_options.options',
592
- DESCRIPTION: 'field_options.description',
593
- INCLUDE_OTHER: 'field_options.include_other_option',
594
- INCLUDE_BLANK: 'field_options.include_blank_option',
595
- INTEGER_ONLY: 'field_options.integer_only',
596
- MIN: 'field_options.min',
597
- MAX: 'field_options.max',
598
- MINLENGTH: 'field_options.minlength',
599
- MAXLENGTH: 'field_options.maxlength',
600
- LENGTH_UNITS: 'field_options.min_max_length_units'
601
- },
602
- dict: {
603
- ALL_CHANGES_SAVED: 'All changes saved',
604
- SAVE_FORM: 'Save form',
605
- UNSAVED_CHANGES: 'You have unsaved changes. If you leave this page, you will lose those changes!'
606
- }
607
- };
608
-
609
- Formbuilder.fields = {};
610
-
611
- Formbuilder.inputFields = {};
612
-
613
- Formbuilder.nonInputFields = {};
614
-
615
- Formbuilder.registerField = function(name, opts) {
616
- var x, _i, _len, _ref5;
617
- _ref5 = ['view', 'edit'];
618
- for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
619
- x = _ref5[_i];
620
- opts[x] = _.template(opts[x]);
621
- }
622
- opts.field_type = name;
623
- Formbuilder.fields[name] = opts;
624
-
625
- if (opts.type === 'non_input') {
626
- return Formbuilder.nonInputFields[name] = opts;
627
- } else {
628
- return Formbuilder.inputFields[name] = opts;
629
- }
630
- };
631
-
632
- function Formbuilder(opts) {
633
- var args;
634
- if (opts == null) {
635
- opts = {};
636
- }
637
- _.extend(this, Backbone.Events);
638
- args = _.extend(opts, {
639
- formBuilder: this
640
- });
641
- this.mainView = new BuilderView(args);
642
- }
643
-
644
- return Formbuilder;
645
-
646
- })();
647
-
648
- window.Formbuilder = Formbuilder;
649
-
650
- if (typeof module !== "undefined" && module !== null) {
651
- module.exports = Formbuilder;
652
- } else {
653
- window.Formbuilder = Formbuilder;
654
- }
655
-
656
- }).call(this);
657
-
658
- /*(function() {
659
- Formbuilder.registerField('address', {
660
- order: 50,
661
- view: "<div class='input-line'>\n <span class='street'>\n <input type='text' />\n <label>Address</label>\n </span>\n</div>\n\n<div class='input-line'>\n <span class='city'>\n <input type='text' />\n <label>City</label>\n </span>\n\n <span class='state'>\n <input type='text' />\n <label>State / Province / Region</label>\n </span>\n</div>\n\n<div class='input-line'>\n <span class='zip'>\n <input type='text' />\n <label>Zipcode</label>\n </span>\n\n <span class='country'>\n <select><option>United States</option></select>\n <label>Country</label>\n </span>\n</div>",
662
- edit: "",
663
- addButton: "<span class=\"symbol\"><span class=\"fa fa-home\"></span></span> Address"
664
- });
665
-
666
- }).call(this);*/
667
-
668
- (function() {
669
- Formbuilder.registerField('checkboxes', {
670
- order: 10,
671
- view: "<% for (i in (rf.get(Formbuilder.options.mappings.OPTIONS) || [])) { %>\n <div class='checkbox'>\n <label>\n <input class='rf-clase-<%= rf.get(Formbuilder.options.mappings.FIELD_CLASS) %>' type='checkbox' <%= rf.get(Formbuilder.options.mappings.OPTIONS)[i].checked && 'checked' %> onclick=\"javascript: return false;\" />\n <%= rf.get(Formbuilder.options.mappings.OPTIONS)[i].label %>\n </label>\n </div>\n<% } %>\n\n<% if (rf.get(Formbuilder.options.mappings.INCLUDE_OTHER)) { %>\n <div class='other-option'>\n <label>\n <input type='checkbox' />\n Other\n </label>\n\n <input type='text' />\n </div>\n<% } %>",
672
- //edit: "<%= Formbuilder.templates['edit/class']() %>\n<%= Formbuilder.templates['edit/options']({ includeOther: false }) %>",
673
- edit: "<%= Formbuilder.templates['edit/class']() %>\n<%= Formbuilder.templates['edit/options']() %>",
674
- addButton: "<span class=\"symbol\"><span class=\"fa fa-square-o\"></span></span> Checkboxes",
675
- defaultAttributes: function(attrs) {
676
- attrs.field_options.options = [
677
- {
678
- label: Formbuilder.options.LANG.default,
679
- checked: false
680
- }, {
681
- label: Formbuilder.options.LANG.default,
682
- checked: false
683
- }
684
- ];
685
- attrs.field_options.field_class = Formbuilder.options.LANG.default;
686
- return attrs;
687
- }
688
- });
689
-
690
- }).call(this);
691
-
692
- /*(function() {
693
- Formbuilder.registerField('date', {
694
- order: 20,
695
- view: "<div class='input-line'>\n <span class='month'>\n <input type=\"text\" />\n <label>MM</label>\n </span>\n\n <span class='above-line'>/</span>\n\n <span class='day'>\n <input type=\"text\" />\n <label>DD</label>\n </span>\n\n <span class='above-line'>/</span>\n\n <span class='year'>\n <input type=\"text\" />\n <label>YYYY</label>\n </span>\n</div>",
696
- edit: "",
697
- addButton: "<span class=\"symbol\"><span class=\"fa fa-calendar\"></span></span> Date"
698
- });
699
-
700
- }).call(this); */
701
-
702
- (function() {
703
- Formbuilder.registerField('dropdown', {
704
- order: 24,
705
- view: "<select class='form-control rf-clase-<%= rf.get(Formbuilder.options.mappings.FIELD_CLASS) %>'>\n <% if (rf.get(Formbuilder.options.mappings.INCLUDE_BLANK)) { %>\n <option value=''></option>\n <% } %>\n\n <% for (i in (rf.get(Formbuilder.options.mappings.OPTIONS) || [])) { %>\n <option <%= rf.get(Formbuilder.options.mappings.OPTIONS)[i].checked && 'selected' %>>\n <%= rf.get(Formbuilder.options.mappings.OPTIONS)[i].label %>\n </option>\n <% } %>\n</select>",
706
- //edit: "<%= Formbuilder.templates['edit/class']() %>\n<%= Formbuilder.templates['edit/options']({ includeBlank: true }) %>",
707
- edit: "<%= Formbuilder.templates['edit/class']() %>\n<%= Formbuilder.templates['edit/options']() %>",
708
- addButton: "<span class=\"symbol\"><span class=\"fa fa-caret-down\"></span></span> Dropdown",
709
- defaultAttributes: function(attrs) {
710
- attrs.field_options.options = [
711
- {
712
- label: Formbuilder.options.LANG.default,
713
- checked: false
714
- }, {
715
- label: Formbuilder.options.LANG.default,
716
- checked: false
717
- }
718
- ];
719
- attrs.field_options.include_blank_option = false;
720
- attrs.field_options.field_class = Formbuilder.options.LANG.default;
721
- return attrs;
722
- }
723
- });
724
-
725
- }).call(this);
726
-
727
- (function() {
728
- Formbuilder.registerField('email', {
729
- order: 40,
730
- view: "<input type='text' class='form-control rf-clase-<%= rf.get(Formbuilder.options.mappings.FIELD_CLASS) %>' />",
731
- edit: "<%= Formbuilder.templates['edit/class']() %>\n",
732
- addButton: "<span class=\"symbol\"><span class=\"fa fa-envelope-o\"></span></span> Email",
733
- defaultAttributes: function(attrs) {
734
- attrs.field_options.field_class = Formbuilder.options.LANG.default;
735
- return attrs;
736
- }
737
- });
738
-
739
- }).call(this);
740
-
741
- (function() {
742
-
743
-
744
- }).call(this);
745
-
746
- /*(function() {
747
- Formbuilder.registerField('number', {
748
- order: 30,
749
- view: "<input type='text' />\n<% if (units = rf.get(Formbuilder.options.mappings.UNITS)) { %>\n <%= units %>\n<% } %>",
750
- edit: "<%= Formbuilder.templates['edit/min_max']() %>\n<%= Formbuilder.templates['edit/units']() %>\n<%= Formbuilder.templates['edit/integer_only']() %>",
751
- addButton: "<span class=\"symbol\"><span class=\"fa fa-number\">123</span></span> Number"
752
- });
753
-
754
- }).call(this);*/
755
-
756
-
757
- (function() {
758
- Formbuilder.registerField('paragraph', {
759
- cid: '',
760
- order: 5,
761
- view: "<textarea class='form-control rf-clase-<%= rf.get(Formbuilder.options.mappings.FIELD_CLASS) %> '></textarea>",
762
- //edit: "<%= Formbuilder.templates['edit/class']() %>\n<%= Formbuilder.templates['edit/size']() %>\n<%= Formbuilder.templates['edit/min_max_length']() %>",
763
- edit: "<%= Formbuilder.templates['edit/class']() %>",
764
- addButton: "<span class=\"symbol\">&#182;</span> Textarea",
765
- defaultAttributes: function(attrs) {
766
- attrs.field_options.size = 'large';
767
- attrs.field_options.field_class = Formbuilder.options.LANG.default;
768
- return attrs;
769
- }
770
- });
771
-
772
- }).call(this);
773
-
774
- /*(function() {
775
- Formbuilder.registerField('price', {
776
- order: 45,
777
- view: "<div class='input-line'>\n <span class='above-line'>$</span>\n <span class='dolars'>\n <input type='text' />\n <label>Dollars</label>\n </span>\n <span class='above-line'>.</span>\n <span class='cents'>\n <input type='text' />\n <label>Cents</label>\n </span>\n</div>",
778
- edit: "",
779
- addButton: "<span class=\"symbol\"><span class=\"fa fa-usd\"></span></span> Price"
780
- });
781
-
782
- }).call(this);*/
783
-
784
- (function() {
785
- Formbuilder.registerField('radio', {
786
- order: 15,
787
- view: "<% for (i in (rf.get(Formbuilder.options.mappings.OPTIONS) || [])) { %>\n <div class='radio'>\n <label>\n <input class='rf-clase-<%= rf.get(Formbuilder.options.mappings.FIELD_CLASS) %>' type='radio' <%= rf.get(Formbuilder.options.mappings.OPTIONS)[i].checked && 'checked' %> onclick=\"javascript: return false;\" />\n <%= rf.get(Formbuilder.options.mappings.OPTIONS)[i].label %>\n </label>\n </div>\n<% } %>\n\n<% if (rf.get(Formbuilder.options.mappings.INCLUDE_OTHER)) { %>\n <div class='other-option'>\n <label>\n <input type='radio' />\n Other\n </label>\n\n <input type='text' />\n </div>\n<% } %>",
788
- //edit: "<%= Formbuilder.templates['edit/class']() %>\n<%= Formbuilder.templates['edit/options']({ includeOther: true }) %>",
789
- edit: "<%= Formbuilder.templates['edit/class']() %>\n<%= Formbuilder.templates['edit/options']() %>",
790
- addButton: "<span class=\"symbol\"><span class=\"fa fa-circle-o\"></span></span> Multiple Choice",
791
- defaultAttributes: function(attrs) {
792
- attrs.field_options.options = [
793
- {
794
- label: Formbuilder.options.LANG.default,
795
- checked: false
796
- }, {
797
- label: Formbuilder.options.LANG.default,
798
- checked: false
799
- }
800
- ];
801
- attrs.field_options.field_class = Formbuilder.options.LANG.default;
802
- return attrs;
803
- }
804
- });
805
-
806
- }).call(this);
807
-
808
- /*(function() {
809
- Formbuilder.registerField('section_break', {
810
- order: 0,
811
- type: 'non_input',
812
- view: "<label class='section-name'><%= rf.get(Formbuilder.options.mappings.LABEL) %></label>\n<p><%= rf.get(Formbuilder.options.mappings.DESCRIPTION) %></p>",
813
- edit: "<div class='fb-edit-section-header'>Label</div>\n<input type='text' data-rv-input='model.<%= Formbuilder.options.mappings.LABEL %>' />\n<textarea data-rv-input='model.<%= Formbuilder.options.mappings.DESCRIPTION %>'\n placeholder='Add a longer description to this field'></textarea>",
814
- addButton: "<span class='symbol'><span class='fa fa-minus'></span></span> Section Break"
815
- });
816
-
817
- }).call(this); */
818
-
819
- (function() {
820
- Formbuilder.registerField('text', {
821
- order: 0,
822
- view: "<input type='text' class='form-control rf-clase-<%= rf.get(Formbuilder.options.mappings.FIELD_CLASS) %>' />",
823
- //edit: "<%= Formbuilder.templates['edit/class']() %>\n<%= Formbuilder.templates['edit/size']() %>\n<%= Formbuilder.templates['edit/min_max_length']() %>",
824
- edit: "<%= Formbuilder.templates['edit/class']() %>",
825
- addButton: "<span class='symbol'><span class='fa fa-font'></span></span> Text",
826
- defaultAttributes: function(attrs) {
827
- attrs.field_options.size = 'large';
828
- attrs.field_options.field_class = Formbuilder.options.LANG.default;
829
- return attrs;
830
- }
831
- });
832
-
833
- }).call(this);
834
-
835
- (function() {
836
- Formbuilder.registerField('captcha', {
837
- order: 45,
838
- view: "<input type='text' placeholder='' class='form-control rf-clase-<%= rf.get(Formbuilder.options.mappings.FIELD_CLASS) %>' />",
839
- edit: "<%= Formbuilder.templates['edit/class']() %>\n",
840
- addButton: "<span class=\"symbol\"><span class=\"glyphicon glyphicon-barcode\"></span></span> Captcha",
841
- defaultAttributes: function(attrs) {
842
- attrs.field_options.field_class = Formbuilder.options.LANG.default;
843
- return attrs;
844
- }
845
- });
846
-
847
- }).call(this);
848
-
849
- (function() {
850
- Formbuilder.registerField('file', {
851
- order: 54,
852
- view: "<input type='file' placeholder='' class='rf-clase-<%= rf.get(Formbuilder.options.mappings.FIELD_CLASS) %>' multiple />",
853
- edit: "<%= Formbuilder.templates['edit/class']() %>\n",
854
- addButton: "<span class=\"symbol\"><span class=\"fa fa-cloud-upload\"></span></span> Upload File",
855
- defaultAttributes: function(attrs) {
856
- attrs.field_options.field_class = Formbuilder.options.LANG.default;
857
- return attrs;
858
- }
859
- });
860
-
861
- }).call(this);
862
-
863
- /*(function() {
864
- Formbuilder.registerField('time', {
865
- order: 25,
866
- view: "<div class='input-line'>\n <span class='hours'>\n <input type=\"text\" />\n <label>HH</label>\n </span>\n\n <span class='above-line'>:</span>\n\n <span class='minutes'>\n <input type=\"text\" />\n <label>MM</label>\n </span>\n\n <span class='above-line'>:</span>\n\n <span class='seconds'>\n <input type=\"text\" />\n <label>SS</label>\n </span>\n\n <span class='am_pm'>\n <select>\n <option>AM</option>\n <option>PM</option>\n </select>\n </span>\n</div>",
867
- edit: "",
868
- addButton: "<span class=\"symbol\"><span class=\"fa fa-clock-o\"></span></span> Time"
869
- });
870
-
871
- }).call(this);*/
872
-
873
- (function() {
874
- Formbuilder.registerField('website', {
875
- order: 35,
876
- view: "<input type='text' placeholder='http://' class='form-control rf-clase-<%= rf.get(Formbuilder.options.mappings.FIELD_CLASS) %>' />",
877
- edit: "<%= Formbuilder.templates['edit/class']() %>\n",
878
- addButton: "<span class=\"symbol\"><span class=\"fa fa-link\"></span></span> Website",
879
- defaultAttributes: function(attrs) {
880
- attrs.field_options.field_class = Formbuilder.options.LANG.default;
881
- return attrs;
882
- }
883
- });
884
-
885
- }).call(this);
886
-
887
- this["Formbuilder"] = this["Formbuilder"] || {};
888
- this["Formbuilder"]["templates"] = this["Formbuilder"]["templates"] || {};
889
-
890
- this["Formbuilder"]["templates"]["edit/base"] = function(obj) {
891
- obj || (obj = {});
892
- var __t, __p = '', __e = _.escape;
893
- with (obj) {
894
- __p +=
895
- ((__t = ( Formbuilder.templates['edit/base_header']() )) == null ? '' : __t) +
896
- '\n' +
897
- ((__t = ( Formbuilder.templates['edit/common']() )) == null ? '' : __t) +
898
- '\n' +
899
- ((__t = ( Formbuilder.fields[rf.get(Formbuilder.options.mappings.FIELD_TYPE)].edit({rf: rf}) )) == null ? '' : __t) +
900
- '\n';
901
-
902
- }
903
- return __p
904
- };
905
-
906
- this["Formbuilder"]["templates"]["edit/base_header"] = function(obj) {
907
- obj || (obj = {});
908
- var __t, __p = '', __e = _.escape;
909
- with (obj) {
910
- __p += '<div>cid: <span class=\'fields-cid\'></span>\n</div></div>\n' +
911
- '';
912
-
913
- }
914
- return __p
915
- };
916
-
917
- this["Formbuilder"]["templates"]["edit/base_non_input"] = function(obj) {
918
- obj || (obj = {});
919
- var __t, __p = '', __e = _.escape;
920
- with (obj) {
921
- __p +=
922
- ((__t = ( Formbuilder.templates['edit/base_header']() )) == null ? '' : __t) +
923
- '\n' +
924
- ((__t = ( Formbuilder.fields[rf.get(Formbuilder.options.mappings.FIELD_TYPE)].edit({rf: rf}) )) == null ? '' : __t) +
925
- '\n';
926
-
927
- }
928
- return __p
929
- };
930
-
931
- this["Formbuilder"]["templates"]["edit/checkboxes"] = function(obj) {
932
- obj || (obj = {});
933
- var __t, __p = '', __e = _.escape;
934
- with (obj) {
935
- __p += '<label>\n <input type=\'checkbox\' data-rv-checked=\'model.' +
936
- ((__t = ( Formbuilder.options.mappings.REQUIRED )) == null ? '' : __t) +
937
- '\' />\n '+Formbuilder.options.LANG.required+'\n</label>\n<!-- label>\n <input type=\'checkbox\' data-rv-checked=\'model.' +
938
- ((__t = ( Formbuilder.options.mappings.ADMIN_ONLY )) == null ? '' : __t) +
939
- '\' />\n Admin only\n</label -->';
940
-
941
- }
942
- return __p
943
- };
944
-
945
- this["Formbuilder"]["templates"]["edit/common"] = function(obj) {
946
- obj || (obj = {});
947
- var __t, __p = '', __e = _.escape;
948
- with (obj) {
949
- __p += '<div class=\'fb-edit-section-header\'>'+Formbuilder.options.LANG.label+
950
- ' (<small class=\'field-type\' data-rv-text=\'model.' +
951
- ((__t = ( Formbuilder.options.mappings.FIELD_TYPE )) == null ? '' : __t) +
952
- '\'></small>)\n' +
953
- '</div>\n' +
954
- '\n<div class=\'fb-common-wrapper\'>\n '+
955
- '<div class=\'fb-label-description\'>\n ' +
956
- ((__t = ( Formbuilder.templates['edit/label_description']() )) == null ? '' : __t) +
957
- '\n </div>\n '+
958
- '<div class=\'checkbox\'>\n ' +
959
- ((__t = ( Formbuilder.templates['edit/checkboxes']() )) == null ? '' : __t) +
960
- '\n </div>\n <div class=\'fb-clear\'></div>\n</div>\n';
961
-
962
- }
963
- return __p
964
- };
965
-
966
- this["Formbuilder"]["templates"]["edit/integer_only"] = function(obj) {
967
- obj || (obj = {});
968
- var __t, __p = '', __e = _.escape;
969
- with (obj) {
970
- __p += '<div class=\'fb-edit-section-header\'>Integer only</div>\n<label>\n <input type=\'checkbox\' data-rv-checked=\'model.' +
971
- ((__t = ( Formbuilder.options.mappings.INTEGER_ONLY )) == null ? '' : __t) +
972
- '\' />\n Only accept integers\n</label>\n';
973
-
974
- }
975
- return __p
976
- };
977
-
978
- this["Formbuilder"]["templates"]["edit/label_description"] = function(obj) {
979
- obj || (obj = {});
980
- var __t, __p = '', __e = _.escape;
981
- with (obj) {
982
- __p += '<input class=\'form-control\' type=\'text\' data-rv-input=\'model.' +
983
- ((__t = ( Formbuilder.options.mappings.LABEL )) == null ? '' : __t) +
984
- '\' />\n<br><br><textarea class=\'form-control\' data-rv-input=\'model.' +
985
- ((__t = ( Formbuilder.options.mappings.DESCRIPTION )) == null ? '' : __t) +
986
- '\'\n placeholder=\''+Formbuilder.options.LANG.msg_add_longer_description_field+'\'></textarea>';
987
-
988
- }
989
- return __p
990
- };
991
-
992
-
993
- this["Formbuilder"]["templates"]["edit/min_max"] = function(obj) {
994
- obj || (obj = {});
995
- var __t, __p = '', __e = _.escape;
996
- with (obj) {
997
- __p += '<div class=\'fb-edit-section-header\'>Minimum / Maximum</div>\n\nAbove\n<input type="text" data-rv-input="model.' +
998
- ((__t = ( Formbuilder.options.mappings.MIN )) == null ? '' : __t) +
999
- '" style="width: 30px" />\n\n&nbsp;&nbsp;\n\nBelow\n<input type="text" data-rv-input="model.' +
1000
- ((__t = ( Formbuilder.options.mappings.MAX )) == null ? '' : __t) +
1001
- '" style="width: 30px" />\n';
1002
-
1003
- }
1004
- return __p
1005
- };
1006
-
1007
- this["Formbuilder"]["templates"]["edit/min_max_length"] = function(obj) {
1008
- obj || (obj = {});
1009
- var __t, __p = '', __e = _.escape;
1010
- with (obj) {
1011
- __p += '<div class=\'fb-edit-section-header\'>Length Limit</div>\n\nMin\n<input type="text" data-rv-input="model.' +
1012
- ((__t = ( Formbuilder.options.mappings.MINLENGTH )) == null ? '' : __t) +
1013
- '" style="width: 30px" />\n\n&nbsp;&nbsp;\n\nMax\n<input type="text" data-rv-input="model.' +
1014
- ((__t = ( Formbuilder.options.mappings.MAXLENGTH )) == null ? '' : __t) +
1015
- '" style="width: 30px" />\n\n&nbsp;&nbsp;\n\n<select data-rv-value="model.' +
1016
- ((__t = ( Formbuilder.options.mappings.LENGTH_UNITS )) == null ? '' : __t) +
1017
- '" style="width: auto;">\n <option value="characters">characters</option>\n <option value="words">words</option>\n</select>\n';
1018
-
1019
- }
1020
- return __p
1021
- };
1022
-
1023
- this["Formbuilder"]["templates"]["edit/options"] = function(obj) {
1024
- obj || (obj = {});
1025
- var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
1026
- function print() { __p += __j.call(arguments, '') }
1027
- with (obj) {
1028
- __p += '<div class=\'fb-edit-section-header\'>'+Formbuilder.options.LANG.options+'</div>\n\n';
1029
- if (typeof includeBlank !== 'undefined'){ ;
1030
- __p += '\n <label>\n <input type=\'checkbox\' data-rv-checked=\'model.' +
1031
- ((__t = ( Formbuilder.options.mappings.INCLUDE_BLANK )) == null ? '' : __t) +
1032
- '\' />\n '+Formbuilder.options.LANG.include_lank+' \n </label>\n';
1033
- } ;
1034
- __p += '\n\n<div class=\'option\' data-rv-each-option=\'model.' +
1035
- ((__t = ( Formbuilder.options.mappings.OPTIONS )) == null ? '' : __t) +
1036
- '\'>\n <input type="checkbox" class=\'js-default-updated\' data-rv-checked="option:checked" />\n <input type="text" data-rv-input="option:label" class=\'option-label-input\' />\n <a class="js-add-option ' +
1037
- ((__t = ( Formbuilder.options.BUTTON_CLASS )) == null ? '' : __t) +
1038
- '" title="'+Formbuilder.options.LANG.add_option+'"><i class=\'fa fa-plus-circle\'></i></a>\n <a class="js-remove-option ' +
1039
- ((__t = ( Formbuilder.options.BUTTON_CLASS )) == null ? '' : __t) +
1040
- '" title="'+Formbuilder.options.LANG.remove_option+'"><i class=\'fa fa-minus-circle\'></i></a>\n</div>\n\n';
1041
- if (typeof includeOther !== 'undefined'){ ;
1042
- __p += '\n <label>\n <input type=\'checkbox\' data-rv-checked=\'model.' +
1043
- ((__t = ( Formbuilder.options.mappings.INCLUDE_OTHER )) == null ? '' : __t) +
1044
- '\' />\n '+Formbuilder.options.LANG.include_other+' \n </label>\n';
1045
- } ;
1046
- __p += '\n\n<div class=\'fb-bottom-add\'>\n <a class="js-add-option ' +
1047
- ((__t = ( Formbuilder.options.BUTTON_CLASS )) == null ? '' : __t) +
1048
- '">'+Formbuilder.options.LANG.add_option+'</a>\n</div>\n';
1049
-
1050
- }
1051
- return __p
1052
- };
1053
-
1054
- this["Formbuilder"]["templates"]["edit/size"] = function(obj) {
1055
- obj || (obj = {});
1056
- var __t, __p = '', __e = _.escape;
1057
- with (obj) {
1058
- __p += '<div class=\'fb-edit-section-header\'>Size</div>\n<select data-rv-value="model.' +
1059
- ((__t = ( Formbuilder.options.mappings.SIZE )) == null ? '' : __t) +
1060
- '">\n <option value="small">Small</option>\n <option value="medium">Medium</option>\n <option value="large">Large</option>\n</select>\n';
1061
-
1062
- }
1063
- return __p
1064
- };
1065
-
1066
-
1067
- /* add function field_class */
1068
- this["Formbuilder"]["templates"]["edit/class"] = function(obj) {
1069
- obj || (obj = {});
1070
- var __t, __p = '', __e = _.escape;
1071
- with (obj) {
1072
- __p += '<div class=\'fb-edit-section-header\'>'+Formbuilder.options.LANG.custom_class+'</div>\n<input class="form-control" type="text" data-rv-input="model.' +
1073
- ((__t = ( Formbuilder.options.mappings.FIELD_CLASS )) == null ? '' : __t) +
1074
- '" />\n';
1075
-
1076
- }
1077
- return __p
1078
- };
1079
- /* end function field_class*/
1080
-
1081
-
1082
- this["Formbuilder"]["templates"]["edit/units"] = function(obj) {
1083
- obj || (obj = {});
1084
- var __t, __p = '', __e = _.escape;
1085
- with (obj) {
1086
- __p += '<div class=\'fb-edit-section-header\'>Units</div>\n<input type="text" data-rv-input="model.' +
1087
- ((__t = ( Formbuilder.options.mappings.UNITS )) == null ? '' : __t) +
1088
- '" />\n';
1089
-
1090
- }
1091
- return __p
1092
- };
1093
-
1094
- this["Formbuilder"]["templates"]["page"] = function(obj) {
1095
- obj || (obj = {});
1096
- var __t, __p = '', __e = _.escape;
1097
- with (obj) {
1098
- __p +=
1099
- //
1100
- // ((__t = ( Formbuilder.templates['partials/save_button']() )) == null ? '' : __t) +
1101
- '\n' +
1102
- ((__t = ( Formbuilder.templates['partials/left_side']() )) == null ? '' : __t) +
1103
- '\n' +
1104
- ((__t = ( Formbuilder.templates['partials/right_side']() )) == null ? '' : __t) +
1105
- '\n<div class=\'fb-clear\'></div>\n</div>';
1106
-
1107
- }
1108
- return __p
1109
- };
1110
-
1111
- this["Formbuilder"]["templates"]["partials/add_field"] = function(obj) {
1112
- obj || (obj = {});
1113
- var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
1114
- function print() { __p += __j.call(arguments, '') }
1115
- with (obj) {
1116
- __p += '<div class=\'fb-tab-pane active\' id=\'addField\'>\n <div class=\'fb-add-field-types\'>\n <div class=\'section\'>\n ';
1117
- _.each(_.sortBy(Formbuilder.inputFields, 'order'), function(f){ ;
1118
- __p += '\n <a data-field-type="' +
1119
- ((__t = ( f.field_type )) == null ? '' : __t) +
1120
- '" class="' +
1121
- ((__t = ( Formbuilder.options.BUTTON_CLASS )) == null ? '' : __t) +
1122
- '">\n ' +
1123
- ((__t = ( f.addButton )) == null ? '' : __t) +
1124
- '\n </a>\n ';
1125
- }); ;
1126
- __p += '\n </div>\n\n <div class=\'section\'>\n ';
1127
- _.each(_.sortBy(Formbuilder.nonInputFields, 'order'), function(f){ ;
1128
- __p += '\n <a data-field-type="' +
1129
- ((__t = ( f.field_type )) == null ? '' : __t) +
1130
- '" class="' +
1131
- ((__t = ( Formbuilder.options.BUTTON_CLASS )) == null ? '' : __t) +
1132
- '">\n ' +
1133
- ((__t = ( f.addButton )) == null ? '' : __t) +
1134
- '\n </a>\n ';
1135
- }); ;
1136
- __p += '\n </div>\n </div>\n</div>\n';
1137
-
1138
- }
1139
- return __p
1140
- };
1141
-
1142
- this["Formbuilder"]["templates"]["partials/edit_field"] = function(obj) {
1143
- obj || (obj = {});
1144
- var __t, __p = '', __e = _.escape;
1145
- with (obj) {
1146
- __p += '<div class=\'fb-tab-pane\' id=\'editField\'>\n <div class=\'fb-edit-field-wrapper\'></div>\n</div>\n';
1147
-
1148
- }
1149
- return __p
1150
- };
1151
-
1152
- this["Formbuilder"]["templates"]["partials/left_side"] = function(obj) {
1153
- obj || (obj = {});
1154
- var __t, __p = '', __e = _.escape;
1155
- with (obj) {
1156
- __p += '<div class=\'row\'>\n' +
1157
- '<div class=\'col-md-6 \'>\n ' +
1158
- '<div class=\'panel panel-default\'>\n' +
1159
- '<div class=\'panel-heading\'>\n' +
1160
- '<h3 class=\'panel-title\'>'+Formbuilder.options.LANG.edit_field+'</h3>\n' +
1161
- '<ul class=\'panel-controls\'>\n' +
1162
- '<li>\n<a href=\'#\' class=\'panel-collapse\'>\n<span class=\'fa fa-angle-down\'></span>\n</a>\n</li>\n' +
1163
- '</ul>' +
1164
- '</div>\n' +
1165
- '<div class=\'panel-body\'>\n' +
1166
- '<div class=\'fb-no-response-fields\'>'+I18n("msg.no_response_fields")+'</div>\n ' +
1167
- '<div class=\'fb-response-fields\'></div>\n' +
1168
- '</div>\n' +
1169
- '</div>\n' +
1170
- '</div>\n';
1171
-
1172
- }
1173
- return __p
1174
- };
1175
-
1176
- this["Formbuilder"]["templates"]["partials/right_side"] = function(obj) {
1177
- obj || (obj = {});
1178
- var __t, __p = '', __e = _.escape;
1179
- with (obj) {
1180
- __p += '<div class=\'col-md-6 \'>\n <div class=\'panel panel-default\'>\n<div class=\'panel-heading\'><h3 class=\'panel-title\'>'+Formbuilder.options.LANG.add_field+'</h3>\n' +
1181
- '<ul class=\'panel-controls\'>\n<li>\n<a href=\'#\' class=\'panel-collapse\'>\n<span class=\'fa fa-angle-down\'></span>\n</a>\n</li>\n</ul></div>\n' +
1182
- '<div class=\'panel-body\'>\n <ul class=\'fb-tabs\'>\n <li class=\'active\'><a data-target=\'#addField\'>'+Formbuilder.options.LANG.add_new_field+'</a></li>\n<li>' +
1183
- '<a data-target=\'#editField\'>'+Formbuilder.options.LANG.edit_field+'</a></li>\n </ul>\n\n <div class=\'fb-tab-content\'>\n ' +
1184
- ((__t = ( Formbuilder.templates['partials/add_field']() )) == null ? '' : __t) +
1185
- '\n ' +
1186
- ((__t = ( Formbuilder.templates['partials/edit_field']() )) == null ? '' : __t) +
1187
- '\n </div>\n</div>\n</div>\n</div>';
1188
- }
1189
- return __p
1190
- };
1191
-
1192
- this["Formbuilder"]["templates"]["partials/save_button"] = function(obj) {
1193
- obj || (obj = {});
1194
- var __t, __p = '', __e = _.escape;
1195
- with (obj) {
1196
- __p += '<div class=\'row fb-save-wrapper\'>\n <button class=\'js-save-form ' +
1197
- ((__t = ( Formbuilder.options.BUTTON_CLASS )) == null ? '' : __t) +
1198
- '\'></button>\n</div>';
1199
-
1200
- }
1201
- return __p
1202
- };
1203
-
1204
- this["Formbuilder"]["templates"]["view/base"] = function(obj) {
1205
- obj || (obj = {});
1206
- var __t, __p = '', __e = _.escape;
1207
- with (obj) {
1208
- __p += '<div class=\'subtemplate-wrapper\'>\n <div class=\'cover\'></div>\n ' +
1209
- ((__t = ( Formbuilder.templates['view/label']({rf: rf}) )) == null ? '' : __t) +
1210
- '\n\n ' +
1211
- ((__t = ( Formbuilder.fields[rf.get(Formbuilder.options.mappings.FIELD_TYPE)].view({rf: rf}) )) == null ? '' : __t) +
1212
- '\n\n ' +
1213
- ((__t = ( Formbuilder.templates['view/description']({rf: rf}) )) == null ? '' : __t) +
1214
- '\n ' +
1215
- ((__t = ( Formbuilder.templates['view/duplicate_remove']({rf: rf}) )) == null ? '' : __t) +
1216
- '\n</div>\n';
1217
-
1218
- }
1219
- return __p
1220
- };
1221
-
1222
- this["Formbuilder"]["templates"]["view/base_non_input"] = function(obj) {
1223
- obj || (obj = {});
1224
- var __t, __p = '', __e = _.escape;
1225
- with (obj) {
1226
- __p += '';
1227
-
1228
- }
1229
- return __p
1230
- };
1231
-
1232
- this["Formbuilder"]["templates"]["view/description"] = function(obj) {
1233
- obj || (obj = {});
1234
- var __t, __p = '', __e = _.escape;
1235
- with (obj) {
1236
- __p += '<span class=\'help-block\'>\n ' +
1237
- ((__t = ( Formbuilder.helpers.simple_format(rf.get(Formbuilder.options.mappings.DESCRIPTION)) )) == null ? '' : __t) +
1238
- '\n</span>\n';
1239
-
1240
- }
1241
- return __p
1242
- };
1243
-
1244
- this["Formbuilder"]["templates"]["view/duplicate_remove"] = function(obj) {
1245
- obj || (obj = {});
1246
- var __t, __p = '', __e = _.escape;
1247
- with (obj) {
1248
- __p += '<div class=\'actions-wrapper\'>\n <a class="js-clear ' +
1249
- ((__t = ( Formbuilder.options.BUTTON_CLASS )) == null ? '' : __t) +
1250
- '" title="'+Formbuilder.options.LANG.remove_field+'"><i class=\'fa fa-minus-circle\'></i></a>\n</div>';
1251
-
1252
- }
1253
- return __p
1254
- };
1255
-
1256
- this["Formbuilder"]["templates"]["view/label"] = function(obj) {
1257
- obj || (obj = {});
1258
- var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
1259
- function print() { __p += __j.call(arguments, '') }
1260
- with (obj) {
1261
- __p += '<label>\n <span>' +
1262
- ((__t = ( Formbuilder.helpers.simple_format(rf.get(Formbuilder.options.mappings.LABEL)) )) == null ? '' : __t) +
1263
- '\n ';
1264
- if (rf.get(Formbuilder.options.mappings.REQUIRED)) { ;
1265
- __p += '\n <abbr title=\'required\'>*</abbr>\n ';
1266
- } ;
1267
- __p += '\n</label>\n';
1268
-
1269
- }
1270
- return __p
1271
- };