decidim 0.4.4 → 0.5.0

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

Potentially problematic release.


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

Files changed (1154) hide show
  1. checksums.yaml +4 -4
  2. data/.babelrc +1 -1
  3. data/.circleci/config.yml +1 -1
  4. data/.codeclimate.yml +4 -11
  5. data/.dockerignore +1 -1
  6. data/.editorconfig +9 -0
  7. data/.gitattributes +2 -0
  8. data/.rubocop.yml +1 -0
  9. data/.simplecov +12 -0
  10. data/.yardopts +1 -1
  11. data/CHANGELOG.md +31 -1
  12. data/Gemfile.lock +91 -87
  13. data/Rakefile +0 -1
  14. data/codecov.yml +3 -0
  15. data/decidim-admin/app/assets/javascripts/decidim/admin/application.js.es6 +3 -0
  16. data/decidim-admin/app/assets/javascripts/decidim/admin/participatory_processes.js.es6 +12 -0
  17. data/decidim-admin/app/assets/javascripts/decidim/admin/scopes.js.es6 +20 -0
  18. data/decidim-admin/app/assets/javascripts/decidim/admin/select2.js.es6 +8 -0
  19. data/decidim-admin/app/assets/stylesheets/decidim/admin/_decidim.scss +2 -0
  20. data/decidim-admin/app/assets/stylesheets/decidim/admin/extra/_categories.scss +1 -1
  21. data/decidim-admin/app/assets/stylesheets/decidim/admin/extra/_login.scss +1 -1
  22. data/decidim-admin/app/assets/stylesheets/decidim/admin/extra/_sort.scss +1 -1
  23. data/decidim-admin/app/assets/stylesheets/decidim/admin/modules/_buttons.scss +3 -0
  24. data/decidim-admin/app/assets/stylesheets/decidim/admin/modules/_callouts.scss +0 -1
  25. data/decidim-admin/app/assets/stylesheets/decidim/admin/modules/_cards.scss +47 -0
  26. data/decidim-admin/app/assets/stylesheets/decidim/admin/modules/_secondary-nav.scss +2 -2
  27. data/decidim-admin/app/assets/stylesheets/decidim/admin/modules/_typography.scss +1 -1
  28. data/decidim-admin/app/assets/stylesheets/decidim/admin/plugins/_select2.scss +27 -0
  29. data/decidim-admin/app/assets/stylesheets/decidim/admin/utils/_toggle-expand.scss +1 -1
  30. data/decidim-admin/app/commands/decidim/admin/close_session_managed_user.rb +44 -0
  31. data/decidim-admin/app/commands/decidim/admin/create_feature.rb +2 -1
  32. data/decidim-admin/app/commands/decidim/admin/create_managed_user.rb +61 -0
  33. data/decidim-admin/app/commands/decidim/admin/create_scope.rb +7 -2
  34. data/decidim-admin/app/commands/decidim/admin/create_scope_type.rb +40 -0
  35. data/decidim-admin/app/commands/decidim/admin/impersonate_managed_user.rb +61 -0
  36. data/decidim-admin/app/commands/decidim/admin/promote_managed_user.rb +56 -0
  37. data/decidim-admin/app/commands/decidim/admin/update_participatory_process.rb +3 -1
  38. data/decidim-admin/app/commands/decidim/admin/update_scope.rb +4 -1
  39. data/decidim-admin/app/commands/decidim/admin/update_scope_type.rb +45 -0
  40. data/decidim-admin/app/controllers/decidim/admin/application_controller.rb +2 -1
  41. data/decidim-admin/app/controllers/decidim/admin/categories_controller.rb +3 -3
  42. data/decidim-admin/app/controllers/decidim/admin/exports_controller.rb +1 -1
  43. data/decidim-admin/app/controllers/decidim/admin/managed_users/impersonations_controller.rb +78 -0
  44. data/decidim-admin/app/controllers/decidim/admin/managed_users/promotions_controller.rb +43 -0
  45. data/decidim-admin/app/controllers/decidim/admin/managed_users_controller.rb +69 -0
  46. data/decidim-admin/app/controllers/decidim/admin/moderations_controller.rb +4 -4
  47. data/decidim-admin/app/controllers/decidim/admin/newsletters_controller.rb +1 -1
  48. data/decidim-admin/app/controllers/decidim/admin/participatory_processes_controller.rb +0 -5
  49. data/decidim-admin/app/controllers/decidim/admin/scope_types_controller.rb +79 -0
  50. data/decidim-admin/app/controllers/decidim/admin/scopes_controller.rb +22 -7
  51. data/decidim-admin/app/controllers/decidim/admin/user_groups_controller.rb +1 -1
  52. data/decidim-admin/app/controllers/decidim/admin/users_controller.rb +1 -2
  53. data/decidim-admin/app/forms/decidim/admin/impersonate_managed_user_form.rb +20 -0
  54. data/decidim-admin/app/forms/decidim/admin/managed_user_form.rb +35 -0
  55. data/decidim-admin/app/forms/decidim/admin/managed_user_promotion_form.rb +13 -0
  56. data/decidim-admin/app/forms/decidim/admin/participatory_process_form.rb +2 -0
  57. data/decidim-admin/app/forms/decidim/admin/scope_form.rb +17 -6
  58. data/decidim-admin/app/forms/decidim/admin/scope_type_form.rb +21 -0
  59. data/decidim-admin/app/helpers/decidim/admin/scopes_helper.rb +46 -0
  60. data/decidim-admin/app/helpers/decidim/admin/settings_helper.rb +12 -1
  61. data/decidim-admin/app/jobs/decidim/admin/expire_impersonation_job.rb +16 -0
  62. data/decidim-admin/app/models/decidim/admin/abilities/admin_ability.rb +17 -0
  63. data/decidim-admin/app/models/decidim/admin/abilities/user_manager_ability.rb +30 -0
  64. data/decidim-admin/app/views/decidim/admin/categories/_form.html.erb +1 -1
  65. data/decidim-admin/app/views/decidim/admin/categories/edit.html.erb +1 -1
  66. data/decidim-admin/app/views/decidim/admin/categories/index.html.erb +7 -7
  67. data/decidim-admin/app/views/decidim/admin/categories/new.html.erb +1 -1
  68. data/decidim-admin/app/views/decidim/admin/features/_form.html.erb +6 -3
  69. data/decidim-admin/app/views/decidim/admin/features/_settings_fields.html.erb +2 -1
  70. data/decidim-admin/app/views/decidim/admin/managed_users/_form.html.erb +12 -0
  71. data/decidim-admin/app/views/decidim/admin/managed_users/impersonations/_form.html.erb +10 -0
  72. data/decidim-admin/app/views/decidim/admin/managed_users/impersonations/index.html.erb +34 -0
  73. data/decidim-admin/app/views/decidim/admin/managed_users/impersonations/new.html.erb +15 -0
  74. data/decidim-admin/app/views/decidim/admin/managed_users/index.html.erb +44 -0
  75. data/decidim-admin/app/views/decidim/admin/managed_users/new.html.erb +47 -0
  76. data/decidim-admin/app/views/decidim/admin/managed_users/promotions/_form.html.erb +3 -0
  77. data/decidim-admin/app/views/decidim/admin/managed_users/promotions/new.html.erb +21 -0
  78. data/decidim-admin/app/views/decidim/admin/moderations/index.html.erb +4 -4
  79. data/decidim-admin/app/views/decidim/admin/participatory_process_copies/_form.html.erb +1 -1
  80. data/decidim-admin/app/views/decidim/admin/participatory_process_user_roles/edit.html.erb +1 -1
  81. data/decidim-admin/app/views/decidim/admin/participatory_processes/_form.html.erb +13 -8
  82. data/decidim-admin/app/views/decidim/admin/participatory_processes/index.html.erb +1 -1
  83. data/decidim-admin/app/views/decidim/admin/scope_types/_form.html.erb +7 -0
  84. data/decidim-admin/app/views/decidim/admin/scope_types/edit.html.erb +13 -0
  85. data/decidim-admin/app/views/decidim/admin/scope_types/index.html.erb +40 -0
  86. data/decidim-admin/app/views/decidim/admin/scope_types/new.html.erb +13 -0
  87. data/decidim-admin/app/views/decidim/admin/scopes/_form.html.erb +12 -2
  88. data/decidim-admin/app/views/decidim/admin/scopes/index.html.erb +19 -7
  89. data/decidim-admin/app/views/decidim/admin/scopes/new.html.erb +1 -1
  90. data/decidim-admin/app/views/decidim/admin/users/_form.html.erb +4 -0
  91. data/decidim-admin/app/views/decidim/admin/users/index.html.erb +2 -0
  92. data/decidim-admin/app/views/layouts/decidim/admin/newsletters.erb +1 -1
  93. data/decidim-admin/app/views/layouts/decidim/admin/pages.html.erb +1 -1
  94. data/decidim-admin/app/views/layouts/decidim/admin/participatory_process.html.erb +4 -4
  95. data/decidim-admin/app/views/layouts/decidim/admin/participatory_process_groups.html.erb +1 -1
  96. data/decidim-admin/app/views/layouts/decidim/admin/settings.html.erb +4 -1
  97. data/decidim-admin/app/views/layouts/decidim/admin/users.html.erb +8 -3
  98. data/decidim-admin/config/i18n-tasks.yml +2 -1
  99. data/decidim-admin/config/locales/ca.yml +80 -3
  100. data/decidim-admin/config/locales/en.yml +82 -2
  101. data/decidim-admin/config/locales/es.yml +80 -3
  102. data/decidim-admin/config/locales/eu.yml +44 -7
  103. data/decidim-admin/config/locales/fi.yml +0 -7
  104. data/decidim-admin/config/locales/fr.yml +21 -6
  105. data/decidim-admin/config/locales/it.yml +0 -10
  106. data/decidim-admin/config/locales/nl.yml +1 -1
  107. data/decidim-admin/config/locales/pl.yml +7 -0
  108. data/decidim-admin/config/routes.rb +24 -11
  109. data/decidim-admin/decidim-admin.gemspec +1 -0
  110. data/decidim-admin/lib/decidim/admin/engine.rb +6 -3
  111. data/decidim-admin/lib/decidim/admin/test/manage_attachments_examples.rb +77 -79
  112. data/decidim-admin/spec/commands/close_session_managed_user_spec.rb +33 -0
  113. data/decidim-admin/spec/commands/create_category_spec.rb +1 -1
  114. data/decidim-admin/spec/commands/create_feature_spec.rb +6 -0
  115. data/decidim-admin/spec/commands/create_managed_user_spec.rb +68 -0
  116. data/decidim-admin/spec/commands/create_newsletter_spec.rb +1 -1
  117. data/decidim-admin/spec/commands/create_scope_spec.rb +35 -2
  118. data/decidim-admin/spec/commands/create_scope_type_spec.rb +39 -0
  119. data/decidim-admin/spec/commands/create_static_page_spec.rb +1 -1
  120. data/decidim-admin/spec/commands/deliver_newsletter_spec.rb +1 -1
  121. data/decidim-admin/spec/commands/destroy_category_spec.rb +1 -1
  122. data/decidim-admin/spec/commands/impersonate_managed_user_spec.rb +75 -0
  123. data/decidim-admin/spec/commands/promote_managed_user_spec.rb +66 -0
  124. data/decidim-admin/spec/commands/update_category_spec.rb +1 -1
  125. data/decidim-admin/spec/commands/update_newsletter_spec.rb +1 -1
  126. data/decidim-admin/spec/commands/update_organization_spec.rb +1 -2
  127. data/decidim-admin/spec/commands/update_participatory_process_spec.rb +2 -2
  128. data/decidim-admin/spec/commands/update_scope_spec.rb +26 -2
  129. data/decidim-admin/spec/commands/update_scope_type_spec.rb +44 -0
  130. data/decidim-admin/spec/commands/update_static_page_spec.rb +1 -1
  131. data/decidim-admin/spec/features/admin_invite_spec.rb +1 -3
  132. data/decidim-admin/spec/features/admin_manages_features_spec.rb +52 -0
  133. data/decidim-admin/spec/features/admin_manages_managed_users_spec.rb +15 -0
  134. data/decidim-admin/spec/features/admin_manages_organization_admins_spec.rb +24 -1
  135. data/decidim-admin/spec/features/admin_manages_organization_scopes_spec.rb +39 -5
  136. data/decidim-admin/spec/features/admin_manages_participatory_process_groups_spec.rb +1 -2
  137. data/decidim-admin/spec/features/admin_manages_participatory_processes_spec.rb +2 -2
  138. data/decidim-admin/spec/features/admin_manages_user_groups_spec.rb +3 -2
  139. data/decidim-admin/spec/features/participatory_process_admin_manages_participatory_process_admins_spec.rb +1 -1
  140. data/decidim-admin/spec/features/participatory_process_admin_manages_participatory_processes_spec.rb +3 -2
  141. data/decidim-admin/spec/features/static_pages_spec.rb +1 -1
  142. data/decidim-admin/spec/features/user_manager_managed_users_spec.rb +14 -0
  143. data/decidim-admin/spec/forms/impersonate_managed_user_form_spec.rb +33 -0
  144. data/decidim-admin/spec/forms/managed_user_form_spec.rb +53 -0
  145. data/decidim-admin/spec/forms/managed_user_promotion_form_spec.rb +30 -0
  146. data/decidim-admin/spec/forms/organization_form_spec.rb +1 -6
  147. data/decidim-admin/spec/forms/participatory_process_form_spec.rb +0 -3
  148. data/decidim-admin/spec/forms/participatory_process_group_form_spec.rb +0 -4
  149. data/decidim-admin/spec/forms/scope_form_spec.rb +15 -11
  150. data/decidim-admin/spec/helpers/settings_helper_spec.rb +1 -1
  151. data/decidim-admin/spec/i18n_spec.rb +1 -1
  152. data/decidim-admin/spec/jobs/expire_impersonation_job_spec.rb +29 -0
  153. data/decidim-admin/spec/models/abilities/admin_ability_spec.rb +1 -0
  154. data/decidim-admin/spec/models/abilities/participatory_process_admin_ability_spec.rb +3 -9
  155. data/decidim-admin/spec/models/abilities/user_manager_ability_spec.rb +20 -0
  156. data/decidim-admin/spec/shared/manage_managed_users_examples.rb +173 -0
  157. data/decidim-admin/spec/shared/manage_process_admins_examples.rb +2 -2
  158. data/decidim-admin/spec/shared/manage_process_attachments_examples.rb +1 -2
  159. data/decidim-admin/spec/shared/manage_process_categories_examples.rb +3 -4
  160. data/decidim-admin/spec/shared/manage_process_steps_examples.rb +2 -2
  161. data/decidim-admin/spec/shared/manage_processes_examples.rb +54 -26
  162. data/decidim-admin/spec/shared/participatory_process_administration_by_admin_shared_context.rb +1 -1
  163. data/decidim-admin/spec/shared/participatory_process_administration_by_process_admin_shared_context.rb +1 -1
  164. data/decidim-admin/spec/shared/participatory_process_administration_shared_context.rb +1 -1
  165. data/decidim-api/app/controllers/decidim/api/application_controller.rb +8 -0
  166. data/decidim-api/app/controllers/decidim/api/documentation_controller.rb +2 -0
  167. data/decidim-api/app/controllers/decidim/api/queries_controller.rb +2 -0
  168. data/decidim-api/lib/decidim/api/test/type_context.rb +1 -1
  169. data/decidim-api/spec/i18n_spec.rb +1 -1
  170. data/decidim-api/spec/spec_helper.rb +0 -2
  171. data/decidim-budgets/app/assets/stylesheets/decidim/budgets/_budgets.scss +1 -1
  172. data/decidim-budgets/app/forms/decidim/budgets/admin/project_form.rb +1 -1
  173. data/decidim-budgets/app/views/decidim/budgets/admin/projects/_form.html.erb +3 -3
  174. data/decidim-budgets/app/views/decidim/budgets/projects/_budget_excess.html.erb +1 -1
  175. data/decidim-budgets/app/views/decidim/budgets/projects/_filters.html.erb +2 -2
  176. data/decidim-budgets/app/views/decidim/budgets/projects/_filters_small_view.html.erb +1 -1
  177. data/decidim-budgets/app/views/decidim/budgets/projects/_project.html.erb +1 -1
  178. data/decidim-budgets/app/views/decidim/budgets/projects/index.html.erb +2 -0
  179. data/decidim-budgets/app/views/decidim/budgets/projects/show.html.erb +1 -1
  180. data/decidim-budgets/config/i18n-tasks.yml +2 -1
  181. data/decidim-budgets/config/locales/ca.yml +2 -1
  182. data/decidim-budgets/config/locales/en.yml +3 -0
  183. data/decidim-budgets/config/locales/es.yml +2 -1
  184. data/decidim-budgets/config/locales/eu.yml +2 -1
  185. data/decidim-budgets/config/locales/fi.yml +1 -1
  186. data/decidim-budgets/config/locales/fr.yml +1 -1
  187. data/decidim-budgets/config/locales/it.yml +1 -1
  188. data/decidim-budgets/config/locales/nl.yml +1 -1
  189. data/decidim-budgets/config/locales/pl.yml +5 -0
  190. data/decidim-budgets/lib/decidim/budgets/feature.rb +2 -0
  191. data/decidim-budgets/spec/features/admin_manages_projects_spec.rb +1 -0
  192. data/decidim-budgets/spec/features/orders_spec.rb +5 -5
  193. data/decidim-budgets/spec/features/process_admin_manages_projects_spec.rb +1 -0
  194. data/decidim-budgets/spec/i18n_spec.rb +1 -1
  195. data/decidim-budgets/spec/shared/manage_attachments_examples.rb +1 -1
  196. data/decidim-budgets/spec/shared/manage_projects_examples.rb +3 -4
  197. data/decidim-comments/app/assets/javascripts/decidim/comments/bundle.js +0 -0
  198. data/decidim-comments/app/frontend/fragments/add_comment_form_commentable.fragment.graphql +1 -1
  199. data/decidim-comments/app/frontend/fragments/add_comment_form_session.fragment.graphql +1 -1
  200. data/decidim-comments/app/frontend/fragments/comment.fragment.graphql +1 -1
  201. data/decidim-comments/app/frontend/fragments/comment_data.fragment.graphql +1 -1
  202. data/decidim-comments/app/frontend/fragments/comment_thread.fragment.graphql +1 -1
  203. data/decidim-comments/app/frontend/fragments/down_vote_button.fragment.graphql +1 -1
  204. data/decidim-comments/app/frontend/fragments/up_vote_button.fragment.graphql +1 -1
  205. data/decidim-comments/app/frontend/mutations/add_comment.mutation.graphql +1 -1
  206. data/decidim-comments/app/frontend/mutations/down_vote.mutation.graphql +1 -1
  207. data/decidim-comments/app/frontend/mutations/up_vote.mutation.graphql +1 -1
  208. data/decidim-comments/app/frontend/queries/comments.query.graphql +1 -1
  209. data/decidim-comments/app/views/decidim/comments/comment_notification_mailer/reply_created.html.erb +1 -1
  210. data/decidim-comments/config/locales/ca.yml +1 -1
  211. data/decidim-comments/config/locales/es.yml +1 -1
  212. data/decidim-comments/config/locales/eu.yml +1 -1
  213. data/decidim-comments/config/locales/fi.yml +1 -1
  214. data/decidim-comments/config/locales/fr.yml +1 -1
  215. data/decidim-comments/config/locales/it.yml +1 -1
  216. data/decidim-comments/config/locales/nl.yml +1 -1
  217. data/decidim-comments/config/locales/pl.yml +6 -0
  218. data/decidim-comments/spec/commands/create_comment_spec.rb +1 -1
  219. data/decidim-comments/spec/commands/vote_comment_spec.rb +1 -1
  220. data/decidim-comments/spec/features/notifications_spec.rb +2 -8
  221. data/decidim-comments/spec/i18n_spec.rb +1 -1
  222. data/decidim-comments/spec/mailers/comment_notification_mailer_spec.rb +0 -1
  223. data/decidim-core/README.md +28 -0
  224. data/decidim-core/Rakefile +3 -0
  225. data/decidim-core/app/assets/config/decidim_core_manifest.js +10 -0
  226. data/decidim-core/app/assets/fonts/decidim/Source_Sans_Pro_400.eot +0 -0
  227. data/decidim-core/app/assets/fonts/decidim/Source_Sans_Pro_400.svg +345 -0
  228. data/decidim-core/app/assets/fonts/decidim/Source_Sans_Pro_400.ttf +0 -0
  229. data/decidim-core/app/assets/fonts/decidim/Source_Sans_Pro_400.woff +0 -0
  230. data/decidim-core/app/assets/fonts/decidim/Source_Sans_Pro_400.woff2 +0 -0
  231. data/decidim-core/app/assets/fonts/decidim/Source_Sans_Pro_600.eot +0 -0
  232. data/decidim-core/app/assets/fonts/decidim/Source_Sans_Pro_600.svg +339 -0
  233. data/decidim-core/app/assets/fonts/decidim/Source_Sans_Pro_600.ttf +0 -0
  234. data/decidim-core/app/assets/fonts/decidim/Source_Sans_Pro_600.woff +0 -0
  235. data/decidim-core/app/assets/fonts/decidim/Source_Sans_Pro_600.woff2 +0 -0
  236. data/decidim-core/app/assets/fonts/decidim/Source_Sans_Pro_900.eot +0 -0
  237. data/decidim-core/app/assets/fonts/decidim/Source_Sans_Pro_900.svg +342 -0
  238. data/decidim-core/app/assets/fonts/decidim/Source_Sans_Pro_900.ttf +0 -0
  239. data/decidim-core/app/assets/fonts/decidim/Source_Sans_Pro_900.woff +0 -0
  240. data/decidim-core/app/assets/fonts/decidim/Source_Sans_Pro_900.woff2 +0 -0
  241. data/decidim-core/app/assets/images/decidim/.keep +0 -0
  242. data/decidim-core/app/assets/images/decidim/cc-badge.png +0 -0
  243. data/{decidim-dev/spec/support/avatar.svg → decidim-core/app/assets/images/decidim/default-avatar.svg} +0 -0
  244. data/decidim-core/app/assets/images/decidim/icons.svg +1 -0
  245. data/decidim-core/app/assets/images/decidim/process.svg +10 -0
  246. data/decidim-core/app/assets/javascripts/decidim.js.es6 +27 -0
  247. data/decidim-core/app/assets/javascripts/decidim/account_form.js.es6 +27 -0
  248. data/decidim-core/app/assets/javascripts/decidim/append_elements.js.es6 +8 -0
  249. data/decidim-core/app/assets/javascripts/decidim/editor.js.es6 +51 -0
  250. data/decidim-core/app/assets/javascripts/decidim/filters.js.es6 +16 -0
  251. data/decidim-core/app/assets/javascripts/decidim/form_filter.component.js.es6 +237 -0
  252. data/decidim-core/app/assets/javascripts/decidim/form_filter.component.test.js +112 -0
  253. data/decidim-core/app/assets/javascripts/decidim/foundation.js.es6 +18 -0
  254. data/decidim-core/app/assets/javascripts/decidim/history.js.es6 +38 -0
  255. data/decidim-core/app/assets/javascripts/decidim/impersonation.js.es6 +16 -0
  256. data/decidim-core/app/assets/javascripts/decidim/map.js.es6.erb +95 -0
  257. data/decidim-core/app/assets/javascripts/decidim/orders.js.es6 +28 -0
  258. data/decidim-core/app/assets/javascripts/decidim/select2.field.js.es6 +47 -0
  259. data/decidim-core/app/assets/javascripts/decidim/select2.js.es6 +8 -0
  260. data/decidim-core/app/assets/javascripts/decidim/user_registrations.js.es6 +21 -0
  261. data/decidim-core/app/assets/javascripts/decidim/widget.js.es6 +14 -0
  262. data/decidim-core/app/assets/stylesheets/decidim/_decidim.scss +12 -0
  263. data/decidim-core/app/assets/stylesheets/decidim/_variables.scss +16 -0
  264. data/decidim-core/app/assets/stylesheets/decidim/application.scss.erb +6 -0
  265. data/decidim-core/app/assets/stylesheets/decidim/editor.sass +4 -0
  266. data/decidim-core/app/assets/stylesheets/decidim/email.css +1395 -0
  267. data/decidim-core/app/assets/stylesheets/decidim/extras/_add_comments.scss +9 -0
  268. data/decidim-core/app/assets/stylesheets/decidim/extras/_announcement.scss +3 -0
  269. data/decidim-core/app/assets/stylesheets/decidim/extras/_callout.scss +5 -0
  270. data/decidim-core/app/assets/stylesheets/decidim/extras/_collection-sort-controls.scss +5 -0
  271. data/decidim-core/app/assets/stylesheets/decidim/extras/_embed.scss +32 -0
  272. data/decidim-core/app/assets/stylesheets/decidim/extras/_impersonation-bar.scss +22 -0
  273. data/decidim-core/app/assets/stylesheets/decidim/extras/_label-required.scss +3 -0
  274. data/decidim-core/app/assets/stylesheets/decidim/extras/_leaflet.scss +15 -0
  275. data/decidim-core/app/assets/stylesheets/decidim/extras/_process_stats.scss +38 -0
  276. data/decidim-core/app/assets/stylesheets/decidim/extras/_proposal_form.scss +7 -0
  277. data/decidim-core/app/assets/stylesheets/decidim/extras/_quill.scss +8 -0
  278. data/decidim-core/app/assets/stylesheets/decidim/extras/_reference.scss +3 -0
  279. data/decidim-core/app/assets/stylesheets/decidim/extras/_register_form.scss +9 -0
  280. data/decidim-core/app/assets/stylesheets/decidim/extras/_results-per-page.scss +66 -0
  281. data/decidim-core/app/assets/stylesheets/decidim/extras/_social_icons_mini.scss +10 -0
  282. data/decidim-core/app/assets/stylesheets/decidim/extras/_status-labels.scss +3 -0
  283. data/decidim-core/app/assets/stylesheets/decidim/layouts/_home.scss +244 -0
  284. data/decidim-core/app/assets/stylesheets/decidim/layouts/_user.scss +24 -0
  285. data/decidim-core/app/assets/stylesheets/decidim/layouts/_view.scss +22 -0
  286. data/decidim-core/app/assets/stylesheets/decidim/map.css +3 -0
  287. data/decidim-core/app/assets/stylesheets/decidim/modules/_address.scss +26 -0
  288. data/decidim-core/app/assets/stylesheets/decidim/modules/_author-avatar.scss +119 -0
  289. data/decidim-core/app/assets/stylesheets/decidim/modules/_buttons.scss +142 -0
  290. data/decidim-core/app/assets/stylesheets/decidim/modules/_callout.scss +25 -0
  291. data/decidim-core/app/assets/stylesheets/decidim/modules/_card-grid.scss +25 -0
  292. data/decidim-core/app/assets/stylesheets/decidim/modules/_cards.scss +504 -0
  293. data/decidim-core/app/assets/stylesheets/decidim/modules/_comments.scss +141 -0
  294. data/decidim-core/app/assets/stylesheets/decidim/modules/_cookie-bar.scss +22 -0
  295. data/decidim-core/app/assets/stylesheets/decidim/modules/_datepicker.scss +224 -0
  296. data/decidim-core/app/assets/stylesheets/decidim/modules/_definition-data.scss +54 -0
  297. data/decidim-core/app/assets/stylesheets/decidim/modules/_extra.scss +43 -0
  298. data/decidim-core/app/assets/stylesheets/decidim/modules/_filter-tags.scss +24 -0
  299. data/decidim-core/app/assets/stylesheets/decidim/modules/_filters.scss +96 -0
  300. data/decidim-core/app/assets/stylesheets/decidim/modules/_flag.scss +9 -0
  301. data/decidim-core/app/assets/stylesheets/decidim/modules/_footer.scss +90 -0
  302. data/decidim-core/app/assets/stylesheets/decidim/modules/_forms.scss +30 -0
  303. data/decidim-core/app/assets/stylesheets/decidim/modules/_help.scss +14 -0
  304. data/decidim-core/app/assets/stylesheets/decidim/modules/_icons.scss +32 -0
  305. data/decidim-core/app/assets/stylesheets/decidim/modules/_layout.scss +56 -0
  306. data/decidim-core/app/assets/stylesheets/decidim/modules/_list-docs.scss +30 -0
  307. data/decidim-core/app/assets/stylesheets/decidim/modules/_main-container.scss +66 -0
  308. data/decidim-core/app/assets/stylesheets/decidim/modules/_map.scss +72 -0
  309. data/decidim-core/app/assets/stylesheets/decidim/modules/_margins.scss +16 -0
  310. data/decidim-core/app/assets/stylesheets/decidim/modules/_modules.scss +58 -0
  311. data/decidim-core/app/assets/stylesheets/decidim/modules/_navbar.scss +270 -0
  312. data/decidim-core/app/assets/stylesheets/decidim/modules/_opinion-toggle.scss +50 -0
  313. data/decidim-core/app/assets/stylesheets/decidim/modules/_order-by.scss +66 -0
  314. data/decidim-core/app/assets/stylesheets/decidim/modules/_pagination.scss +5 -0
  315. data/decidim-core/app/assets/stylesheets/decidim/modules/_process-header.scss +88 -0
  316. data/decidim-core/app/assets/stylesheets/decidim/modules/_process-info.scss +44 -0
  317. data/decidim-core/app/assets/stylesheets/decidim/modules/_process-nav.scss +97 -0
  318. data/decidim-core/app/assets/stylesheets/decidim/modules/_process-phase.scss +83 -0
  319. data/decidim-core/app/assets/stylesheets/decidim/modules/_reference.scss +6 -0
  320. data/decidim-core/app/assets/stylesheets/decidim/modules/_reveal.scss +20 -0
  321. data/decidim-core/app/assets/stylesheets/decidim/modules/_share.scss +28 -0
  322. data/decidim-core/app/assets/stylesheets/decidim/modules/_signup.scss +39 -0
  323. data/decidim-core/app/assets/stylesheets/decidim/modules/_static-pages.scss +46 -0
  324. data/decidim-core/app/assets/stylesheets/decidim/modules/_status-labels.scss +20 -0
  325. data/decidim-core/app/assets/stylesheets/decidim/modules/_tags.scss +29 -0
  326. data/decidim-core/app/assets/stylesheets/decidim/modules/_timeline.scss +171 -0
  327. data/decidim-core/app/assets/stylesheets/decidim/modules/_title-action.scss +28 -0
  328. data/decidim-core/app/assets/stylesheets/decidim/modules/_typography.scss +122 -0
  329. data/decidim-core/app/assets/stylesheets/decidim/modules/_user-form.scss +14 -0
  330. data/decidim-core/app/assets/stylesheets/decidim/modules/_video.scss +18 -0
  331. data/decidim-core/app/assets/stylesheets/decidim/plugins/_select2.scss +63 -0
  332. data/decidim-core/app/assets/stylesheets/decidim/utils/_fontface.scss +27 -0
  333. data/decidim-core/app/assets/stylesheets/decidim/utils/_helpers.scss +25 -0
  334. data/decidim-core/app/assets/stylesheets/decidim/utils/_keyframes.scss +21 -0
  335. data/decidim-core/app/assets/stylesheets/decidim/utils/_mixins.scss +41 -0
  336. data/decidim-core/app/assets/stylesheets/decidim/utils/_settings.scss +575 -0
  337. data/decidim-core/app/assets/stylesheets/decidim/utils/_toggle-expand.scss +8 -0
  338. data/decidim-core/app/commands/decidim/authorize_user.rb +59 -0
  339. data/decidim-core/app/commands/decidim/create_omniauth_registration.rb +96 -0
  340. data/decidim-core/app/commands/decidim/create_registration.rb +55 -0
  341. data/decidim-core/app/commands/decidim/create_report.rb +91 -0
  342. data/decidim-core/app/commands/decidim/destroy_account.rb +47 -0
  343. data/decidim-core/app/commands/decidim/invite_user.rb +56 -0
  344. data/decidim-core/app/commands/decidim/invite_user_again.rb +26 -0
  345. data/decidim-core/app/commands/decidim/remove_admin.rb +25 -0
  346. data/decidim-core/app/commands/decidim/update_account.rb +52 -0
  347. data/decidim-core/app/commands/decidim/update_notifications_settings.rb +32 -0
  348. data/decidim-core/app/constraints/decidim/current_feature.rb +42 -0
  349. data/decidim-core/app/constraints/decidim/current_participatory_process.rb +35 -0
  350. data/decidim-core/app/controllers/concerns/decidim/action_authorization.rb +74 -0
  351. data/decidim-core/app/controllers/concerns/decidim/devise_controllers.rb +36 -0
  352. data/decidim-core/app/controllers/concerns/decidim/filter_resource.rb +71 -0
  353. data/decidim-core/app/controllers/concerns/decidim/form_factory.rb +83 -0
  354. data/decidim-core/app/controllers/concerns/decidim/impersonate_users.rb +67 -0
  355. data/decidim-core/app/controllers/concerns/decidim/locale_switcher.rb +60 -0
  356. data/decidim-core/app/controllers/concerns/decidim/needs_authorization.rb +46 -0
  357. data/decidim-core/app/controllers/concerns/decidim/needs_organization.rb +42 -0
  358. data/decidim-core/app/controllers/concerns/decidim/needs_participatory_process.rb +46 -0
  359. data/decidim-core/app/controllers/concerns/decidim/paginable.rb +24 -0
  360. data/decidim-core/app/controllers/concerns/decidim/payload_info.rb +23 -0
  361. data/decidim-core/app/controllers/concerns/decidim/settings.rb +23 -0
  362. data/decidim-core/app/controllers/concerns/decidim/user_profile.rb +33 -0
  363. data/decidim-core/app/controllers/decidim/account_controller.rb +70 -0
  364. data/decidim-core/app/controllers/decidim/application_controller.rb +56 -0
  365. data/decidim-core/app/controllers/decidim/authorizations_controller.rb +90 -0
  366. data/decidim-core/app/controllers/decidim/cookie_policy_controller.rb +19 -0
  367. data/decidim-core/app/controllers/decidim/devise/confirmations_controller.rb +10 -0
  368. data/decidim-core/app/controllers/decidim/devise/invitations_controller.rb +30 -0
  369. data/decidim-core/app/controllers/decidim/devise/omniauth_registrations_controller.rb +95 -0
  370. data/decidim-core/app/controllers/decidim/devise/passwords_controller.rb +25 -0
  371. data/decidim-core/app/controllers/decidim/devise/registrations_controller.rb +67 -0
  372. data/decidim-core/app/controllers/decidim/devise/sessions_controller.rb +32 -0
  373. data/decidim-core/app/controllers/decidim/errors_controller.rb +15 -0
  374. data/decidim-core/app/controllers/decidim/features/base_controller.rb +56 -0
  375. data/decidim-core/app/controllers/decidim/locales_controller.rb +27 -0
  376. data/decidim-core/app/controllers/decidim/notifications_settings_controller.rb +30 -0
  377. data/decidim-core/app/controllers/decidim/own_user_groups_controller.rb +13 -0
  378. data/decidim-core/app/controllers/decidim/pages_controller.rb +42 -0
  379. data/decidim-core/app/controllers/decidim/participatory_process_groups_controller.rb +26 -0
  380. data/decidim-core/app/controllers/decidim/participatory_process_steps_controller.rb +18 -0
  381. data/decidim-core/app/controllers/decidim/participatory_process_widgets_controller.rb +19 -0
  382. data/decidim-core/app/controllers/decidim/participatory_processes_controller.rb +49 -0
  383. data/decidim-core/app/controllers/decidim/reports_controller.rb +33 -0
  384. data/decidim-core/app/controllers/decidim/scopes_controller.rb +29 -0
  385. data/decidim-core/app/controllers/decidim/static_map_controller.rb +17 -0
  386. data/decidim-core/app/controllers/decidim/widgets_controller.rb +34 -0
  387. data/decidim-core/app/forms/decidim/account_form.rb +42 -0
  388. data/decidim-core/app/forms/decidim/attachment_form.rb +14 -0
  389. data/decidim-core/app/forms/decidim/delete_account_form.rb +8 -0
  390. data/decidim-core/app/forms/decidim/form.rb +16 -0
  391. data/decidim-core/app/forms/decidim/invite_user_form.rb +48 -0
  392. data/decidim-core/app/forms/decidim/notifications_settings_form.rb +17 -0
  393. data/decidim-core/app/forms/decidim/omniauth_registration_form.rb +24 -0
  394. data/decidim-core/app/forms/decidim/registration_form.rb +55 -0
  395. data/decidim-core/app/forms/decidim/report_form.rb +13 -0
  396. data/decidim-core/app/forms/translatable_presence_validator.rb +31 -0
  397. data/decidim-core/app/helpers/decidim/action_authorization_helper.rb +88 -0
  398. data/decidim-core/app/helpers/decidim/application_helper.rb +28 -0
  399. data/decidim-core/app/helpers/decidim/aria_selected_link_to_helper.rb +27 -0
  400. data/decidim-core/app/helpers/decidim/attachments_helper.rb +27 -0
  401. data/decidim-core/app/helpers/decidim/authorization_form_helper.rb +26 -0
  402. data/decidim-core/app/helpers/decidim/cookies_helper.rb +11 -0
  403. data/decidim-core/app/helpers/decidim/decidim_form_helper.rb +116 -0
  404. data/decidim-core/app/helpers/decidim/feature_path_helper.rb +35 -0
  405. data/decidim-core/app/helpers/decidim/feature_reference_helper.rb +25 -0
  406. data/decidim-core/app/helpers/decidim/filters_helper.rb +21 -0
  407. data/decidim-core/app/helpers/decidim/humanize_booleans_helper.rb +15 -0
  408. data/decidim-core/app/helpers/decidim/icon_helper.rb +30 -0
  409. data/decidim-core/app/helpers/decidim/language_chooser_helper.rb +19 -0
  410. data/decidim-core/app/helpers/decidim/layout_helper.rb +78 -0
  411. data/decidim-core/app/helpers/decidim/localized_locales_helper.rb +44 -0
  412. data/decidim-core/app/helpers/decidim/map_helper.rb +42 -0
  413. data/decidim-core/app/helpers/decidim/menu_helper.rb +16 -0
  414. data/decidim-core/app/helpers/decidim/meta_tags_helper.rb +105 -0
  415. data/decidim-core/app/helpers/decidim/omniauth_helper.rb +24 -0
  416. data/decidim-core/app/helpers/decidim/orders_helper.rb +29 -0
  417. data/decidim-core/app/helpers/decidim/paginate_helper.rb +22 -0
  418. data/decidim-core/app/helpers/decidim/participatory_process_helper.rb +17 -0
  419. data/decidim-core/app/helpers/decidim/participatory_process_steps_helper.rb +18 -0
  420. data/decidim-core/app/helpers/decidim/replace_buttons_helper.rb +43 -0
  421. data/decidim-core/app/helpers/decidim/resource_helper.rb +73 -0
  422. data/decidim-core/app/helpers/decidim/scopes_helper.rb +15 -0
  423. data/decidim-core/app/helpers/decidim/translations_helper.rb +34 -0
  424. data/decidim-core/app/helpers/decidim/user_profile_helper.rb +24 -0
  425. data/decidim-core/app/helpers/decidim/widget_urls_helper.rb +11 -0
  426. data/decidim-core/app/jobs/decidim/application_job.rb +6 -0
  427. data/decidim-core/app/jobs/decidim/export_job.rb +22 -0
  428. data/decidim-core/app/mailers/concerns/decidim/localised_mailer.rb +30 -0
  429. data/decidim-core/app/mailers/decidim/application_mailer.rb +12 -0
  430. data/decidim-core/app/mailers/decidim/decidim_devise_mailer.rb +39 -0
  431. data/decidim-core/app/mailers/decidim/export_mailer.rb +30 -0
  432. data/decidim-core/app/mailers/decidim/newsletter_mailer.rb +25 -0
  433. data/decidim-core/app/mailers/decidim/reported_mailer.rb +42 -0
  434. data/decidim-core/app/middleware/decidim/current_organization.rb +55 -0
  435. data/decidim-core/app/models/decidim/abilities/admin_ability.rb +30 -0
  436. data/decidim-core/app/models/decidim/abilities/base_ability.rb +34 -0
  437. data/decidim-core/app/models/decidim/abilities/everyone_ability.rb +26 -0
  438. data/decidim-core/app/models/decidim/abilities/participatory_process_admin_ability.rb +28 -0
  439. data/decidim-core/app/models/decidim/abilities/participatory_process_collaborator_ability.rb +28 -0
  440. data/decidim-core/app/models/decidim/abilities/participatory_process_moderator_ability.rb +15 -0
  441. data/decidim-core/app/models/decidim/abilities/user_manager_ability.rb +35 -0
  442. data/decidim-core/app/models/decidim/application_record.rb +8 -0
  443. data/decidim-core/app/models/decidim/attachment.rb +57 -0
  444. data/decidim-core/app/models/decidim/authorization.rb +26 -0
  445. data/decidim-core/app/models/decidim/categorization.rb +8 -0
  446. data/decidim-core/app/models/decidim/category.rb +41 -0
  447. data/decidim-core/app/models/decidim/feature.rb +39 -0
  448. data/decidim-core/app/models/decidim/identity.rb +21 -0
  449. data/decidim-core/app/models/decidim/impersonation_log.rb +35 -0
  450. data/decidim-core/app/models/decidim/moderation.rb +12 -0
  451. data/decidim-core/app/models/decidim/newsletter.rb +26 -0
  452. data/decidim-core/app/models/decidim/organization.rb +37 -0
  453. data/decidim-core/app/models/decidim/participatory_process.rb +61 -0
  454. data/decidim-core/app/models/decidim/participatory_process_group.rb +15 -0
  455. data/decidim-core/app/models/decidim/participatory_process_step.rb +39 -0
  456. data/decidim-core/app/models/decidim/participatory_process_user_role.rb +22 -0
  457. data/decidim-core/app/models/decidim/report.rb +24 -0
  458. data/decidim-core/app/models/decidim/resource_link.rb +28 -0
  459. data/decidim-core/app/models/decidim/scope.rb +79 -0
  460. data/decidim-core/app/models/decidim/scope_type.rb +16 -0
  461. data/decidim-core/app/models/decidim/static_page.rb +57 -0
  462. data/decidim-core/app/models/decidim/user.rb +106 -0
  463. data/decidim-core/app/models/decidim/user_group.rb +45 -0
  464. data/decidim-core/app/models/decidim/user_group_membership.rb +9 -0
  465. data/decidim-core/app/presenters/decidim/home_stats_presenter.rb +81 -0
  466. data/decidim-core/app/presenters/decidim/menu_item_presenter.rb +57 -0
  467. data/decidim-core/app/presenters/decidim/menu_presenter.rb +47 -0
  468. data/decidim-core/app/presenters/decidim/participatory_process_stats_presenter.rb +50 -0
  469. data/decidim-core/app/presenters/decidim/resource_locator_presenter.rb +90 -0
  470. data/decidim-core/app/queries/decidim/freetext_scopes.rb +39 -0
  471. data/decidim-core/app/queries/decidim/highlighted_participatory_processes.rb +10 -0
  472. data/decidim-core/app/queries/decidim/organization_participatory_process_groups.rb +14 -0
  473. data/decidim-core/app/queries/decidim/organization_participatory_processes.rb +14 -0
  474. data/decidim-core/app/queries/decidim/organization_prioritized_participatory_processes.rb +18 -0
  475. data/decidim-core/app/queries/decidim/organization_published_participatory_processes.rb +17 -0
  476. data/decidim-core/app/queries/decidim/participatory_processes_with_user_role.rb +46 -0
  477. data/decidim-core/app/queries/decidim/prioritized_participatory_processes.rb +11 -0
  478. data/decidim-core/app/queries/decidim/promoted_participatory_processes.rb +10 -0
  479. data/decidim-core/app/queries/decidim/published_participatory_processes.rb +10 -0
  480. data/decidim-core/app/queries/decidim/stats_users_count.rb +25 -0
  481. data/decidim-core/app/services/decidim/action_authorizer.rb +103 -0
  482. data/decidim-core/app/services/decidim/authorization_handler.rb +92 -0
  483. data/decidim-core/app/services/decidim/resource_search.rb +69 -0
  484. data/decidim-core/app/services/decidim/static_map_generator.rb +48 -0
  485. data/decidim-core/app/uploaders/decidim/application_uploader.rb +17 -0
  486. data/decidim-core/app/uploaders/decidim/attachment_uploader.rb +73 -0
  487. data/decidim-core/app/uploaders/decidim/avatar_uploader.rb +22 -0
  488. data/decidim-core/app/uploaders/decidim/banner_image_uploader.rb +8 -0
  489. data/decidim-core/app/uploaders/decidim/hero_image_uploader.rb +8 -0
  490. data/decidim-core/app/uploaders/decidim/homepage_image_uploader.rb +16 -0
  491. data/decidim-core/app/uploaders/decidim/image_uploader.rb +47 -0
  492. data/decidim-core/app/uploaders/decidim/official_image_footer_uploader.rb +9 -0
  493. data/decidim-core/app/uploaders/decidim/official_image_header_uploader.rb +9 -0
  494. data/decidim-core/app/uploaders/decidim/organization_favicon_uploader.rb +18 -0
  495. data/decidim-core/app/uploaders/decidim/organization_logo_uploader.rb +10 -0
  496. data/decidim-core/app/validators/etiquette_validator.rb +42 -0
  497. data/decidim-core/app/validators/geocoding_validator.rb +22 -0
  498. data/decidim-core/app/views/decidim/account/_password_fields.html.erb +2 -0
  499. data/decidim-core/app/views/decidim/account/_user_groups.html.erb +0 -0
  500. data/decidim-core/app/views/decidim/account/delete.html.erb +30 -0
  501. data/decidim-core/app/views/decidim/account/show.html.erb +25 -0
  502. data/decidim-core/app/views/decidim/application/_attachments.html.erb +8 -0
  503. data/decidim-core/app/views/decidim/application/_documents.html.erb +28 -0
  504. data/decidim-core/app/views/decidim/application/_photos.html.erb +16 -0
  505. data/decidim-core/app/views/decidim/authorizations/first_login.html.erb +22 -0
  506. data/decidim-core/app/views/decidim/authorizations/index.html.erb +49 -0
  507. data/decidim-core/app/views/decidim/authorizations/new.html.erb +31 -0
  508. data/decidim-core/app/views/decidim/cookie_policy/accept.js.erb +3 -0
  509. data/decidim-core/app/views/decidim/devise/confirmations/new.html.erb +33 -0
  510. data/decidim-core/app/views/decidim/devise/invitations/edit.html.erb +29 -0
  511. data/decidim-core/app/views/decidim/devise/omniauth_registrations/new.html.erb +40 -0
  512. data/decidim-core/app/views/decidim/devise/passwords/edit.html.erb +35 -0
  513. data/decidim-core/app/views/decidim/devise/passwords/new.html.erb +31 -0
  514. data/decidim-core/app/views/decidim/devise/registrations/edit.html.erb +40 -0
  515. data/decidim-core/app/views/decidim/devise/registrations/new.html.erb +87 -0
  516. data/decidim-core/app/views/decidim/devise/sessions/new.html.erb +45 -0
  517. data/decidim-core/app/views/decidim/devise/shared/_links.html.erb +29 -0
  518. data/decidim-core/app/views/decidim/devise/shared/_omniauth_buttons.html.erb +21 -0
  519. data/decidim-core/app/views/decidim/devise/shared/_omniauth_buttons_mini.html.erb +20 -0
  520. data/decidim-core/app/views/decidim/errors/internal_server_error.html.erb +10 -0
  521. data/decidim-core/app/views/decidim/errors/not_found.html.erb +13 -0
  522. data/decidim-core/app/views/decidim/export_mailer/export.html.erb +1 -0
  523. data/decidim-core/app/views/decidim/newsletter_mailer/newsletter.html.erb +5 -0
  524. data/decidim-core/app/views/decidim/notifications_settings/show.html.erb +26 -0
  525. data/decidim-core/app/views/decidim/own_user_groups/index.html.erb +26 -0
  526. data/decidim-core/app/views/decidim/pages/index.html.erb +34 -0
  527. data/decidim-core/app/views/decidim/participatory_process_groups/_participatory_process_group.html.erb +22 -0
  528. data/decidim-core/app/views/decidim/participatory_process_groups/show.html.erb +11 -0
  529. data/decidim-core/app/views/decidim/participatory_process_steps/_participatory_process_step.html.erb +16 -0
  530. data/decidim-core/app/views/decidim/participatory_process_steps/_timeline.html.erb +7 -0
  531. data/decidim-core/app/views/decidim/participatory_process_steps/index.html.erb +14 -0
  532. data/decidim-core/app/views/decidim/participatory_process_widgets/show.html.erb +17 -0
  533. data/decidim-core/app/views/decidim/participatory_processes/_no_processes_yet.html.erb +3 -0
  534. data/decidim-core/app/views/decidim/participatory_processes/_order_by_processes.html.erb +3 -0
  535. data/decidim-core/app/views/decidim/participatory_processes/_participatory_process.html.erb +28 -0
  536. data/decidim-core/app/views/decidim/participatory_processes/_promoted_process.html.erb +32 -0
  537. data/decidim-core/app/views/decidim/participatory_processes/_statistics.html.erb +10 -0
  538. data/decidim-core/app/views/decidim/participatory_processes/index.html.erb +17 -0
  539. data/decidim-core/app/views/decidim/participatory_processes/show.html.erb +85 -0
  540. data/decidim-core/app/views/decidim/reported_mailer/hide.html.erb +9 -0
  541. data/decidim-core/app/views/decidim/reported_mailer/report.html.erb +9 -0
  542. data/decidim-core/app/views/decidim/shared/_action_authorization_modal.html.erb +55 -0
  543. data/decidim-core/app/views/decidim/shared/_address_details.html.erb +9 -0
  544. data/decidim-core/app/views/decidim/shared/_announcement.html.erb +5 -0
  545. data/decidim-core/app/views/decidim/shared/_comments.html.erb +0 -0
  546. data/decidim-core/app/views/decidim/shared/_embed_modal.html.erb +19 -0
  547. data/decidim-core/app/views/decidim/shared/_feature_announcement.html.erb +5 -0
  548. data/decidim-core/app/views/decidim/shared/_flag_modal.html.erb +20 -0
  549. data/decidim-core/app/views/decidim/shared/_login_modal.html.erb +33 -0
  550. data/decidim-core/app/views/decidim/shared/_orders.html.erb +16 -0
  551. data/decidim-core/app/views/decidim/shared/_results_per_page.html.erb +18 -0
  552. data/decidim-core/app/views/decidim/shared/_share_modal.html.erb +33 -0
  553. data/decidim-core/app/views/decidim/shared/_static_map.html.erb +17 -0
  554. data/decidim-core/app/views/decidim/shared/_tags.html.erb +10 -0
  555. data/decidim-core/app/views/decidim/widgets/show.js.erb +32 -0
  556. data/decidim-core/app/views/devise/mailer/confirmation_instructions.html.erb +4 -0
  557. data/decidim-core/app/views/devise/mailer/invitation_instructions.html.erb +13 -0
  558. data/decidim-core/app/views/devise/mailer/invitation_instructions.text.erb +11 -0
  559. data/decidim-core/app/views/devise/mailer/invite_admin.html.erb +17 -0
  560. data/decidim-core/app/views/devise/mailer/invite_admin.text.erb +15 -0
  561. data/decidim-core/app/views/devise/mailer/invite_collaborator.html.erb +17 -0
  562. data/decidim-core/app/views/devise/mailer/invite_collaborator.text.erb +15 -0
  563. data/decidim-core/app/views/devise/mailer/organization_admin_invitation_instructions.html.erb +10 -0
  564. data/decidim-core/app/views/devise/mailer/organization_admin_invitation_instructions.text.erb +11 -0
  565. data/decidim-core/app/views/devise/mailer/password_change.html.erb +3 -0
  566. data/decidim-core/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  567. data/decidim-core/app/views/kaminari/decidim/_first_page.html.erb +11 -0
  568. data/decidim-core/app/views/kaminari/decidim/_gap.html.erb +8 -0
  569. data/decidim-core/app/views/kaminari/decidim/_last_page.html.erb +11 -0
  570. data/decidim-core/app/views/kaminari/decidim/_next_page.html.erb +11 -0
  571. data/decidim-core/app/views/kaminari/decidim/_page.html.erb +12 -0
  572. data/decidim-core/app/views/kaminari/decidim/_paginator.html.erb +25 -0
  573. data/decidim-core/app/views/kaminari/decidim/_prev_page.html.erb +11 -0
  574. data/decidim-core/app/views/layouts/decidim/_application.html.erb +26 -0
  575. data/decidim-core/app/views/layouts/decidim/_cookie_warning.html.erb +8 -0
  576. data/decidim-core/app/views/layouts/decidim/_head.html.erb +24 -0
  577. data/decidim-core/app/views/layouts/decidim/_head_extra.html.erb +7 -0
  578. data/decidim-core/app/views/layouts/decidim/_impersonation_warning.html.erb +10 -0
  579. data/decidim-core/app/views/layouts/decidim/_language_chooser.html.erb +14 -0
  580. data/decidim-core/app/views/layouts/decidim/_logo.html.erb +31 -0
  581. data/decidim-core/app/views/layouts/decidim/_mailer_logo.html.erb +31 -0
  582. data/decidim-core/app/views/layouts/decidim/_process_header.html.erb +65 -0
  583. data/decidim-core/app/views/layouts/decidim/_process_header_steps.html.erb +27 -0
  584. data/decidim-core/app/views/layouts/decidim/_social_media_links.html.erb +39 -0
  585. data/decidim-core/app/views/layouts/decidim/_user_menu.html.erb +5 -0
  586. data/decidim-core/app/views/layouts/decidim/_wrapper.html.erb +110 -0
  587. data/decidim-core/app/views/layouts/decidim/application.html.erb +3 -0
  588. data/decidim-core/app/views/layouts/decidim/mailer.html.erb +119 -0
  589. data/decidim-core/app/views/layouts/decidim/participatory_process.html.erb +30 -0
  590. data/decidim-core/app/views/layouts/decidim/user_profile.html.erb +37 -0
  591. data/decidim-core/app/views/layouts/decidim/widget.html.erb +69 -0
  592. data/decidim-core/app/views/pages/decidim_page.html.erb +17 -0
  593. data/decidim-core/app/views/pages/home.html.erb +17 -0
  594. data/decidim-core/app/views/pages/home/_extended.html.erb +48 -0
  595. data/decidim-core/app/views/pages/home/_footer_sub_hero.html.erb +12 -0
  596. data/decidim-core/app/views/pages/home/_hero.html.erb +20 -0
  597. data/decidim-core/app/views/pages/home/_highlighted_processes.html.erb +37 -0
  598. data/decidim-core/app/views/pages/home/_statistics.html.erb +14 -0
  599. data/decidim-core/app/views/pages/home/_sub_hero.html.erb +11 -0
  600. data/decidim-core/bin/rails +15 -0
  601. data/decidim-core/config/i18n-tasks.yml +138 -0
  602. data/decidim-core/config/initializers/devise.rb +342 -0
  603. data/decidim-core/config/initializers/foundation_rails_helper.rb +3 -0
  604. data/decidim-core/config/initializers/invisible_captcha.rb +11 -0
  605. data/decidim-core/config/initializers/mail_previews.rb +5 -0
  606. data/decidim-core/config/locales/ca.yml +449 -0
  607. data/decidim-core/config/locales/en.yml +450 -0
  608. data/decidim-core/config/locales/es.yml +449 -0
  609. data/decidim-core/config/locales/eu.yml +404 -0
  610. data/decidim-core/config/locales/fi.yml +361 -0
  611. data/decidim-core/config/locales/fr.yml +443 -0
  612. data/decidim-core/config/locales/it.yml +325 -0
  613. data/decidim-core/config/locales/nl.yml +361 -0
  614. data/decidim-core/config/locales/pl.yml +91 -0
  615. data/decidim-core/config/routes.rb +69 -0
  616. data/decidim-core/config/secrets.yml +36 -0
  617. data/decidim-core/db/migrate/20160817115213_devise_create_decidim_users.rb +43 -0
  618. data/decidim-core/db/migrate/20160919104837_create_decidim_organizations.rb +19 -0
  619. data/decidim-core/db/migrate/20160920140207_devise_invitable_add_to_decidim_users.rb +25 -0
  620. data/decidim-core/db/migrate/20160920141039_user_belongs_to_organization.rb +7 -0
  621. data/decidim-core/db/migrate/20160920141151_user_has_roles.rb +7 -0
  622. data/decidim-core/db/migrate/20161005130108_add_participatory_processes.rb +19 -0
  623. data/decidim-core/db/migrate/20161005153007_add_description_to_organizations.rb +9 -0
  624. data/decidim-core/db/migrate/20161006085629_add_confirmable_to_devise.rb +16 -0
  625. data/decidim-core/db/migrate/20161010085443_add_name_to_users.rb +7 -0
  626. data/decidim-core/db/migrate/20161010102356_translate_processes.rb +17 -0
  627. data/decidim-core/db/migrate/20161010131544_add_locale_to_users.rb +7 -0
  628. data/decidim-core/db/migrate/20161011125616_add_hero_image_to_processes.rb +7 -0
  629. data/decidim-core/db/migrate/20161011141033_add_banner_image_to_processes.rb +7 -0
  630. data/decidim-core/db/migrate/20161013134732_add_promoted_flag_to_processes.rb +7 -0
  631. data/decidim-core/db/migrate/20161017085822_add_participatory_process_steps.rb +18 -0
  632. data/decidim-core/db/migrate/20161018091013_create_decidim_authorizations.rb +15 -0
  633. data/decidim-core/db/migrate/20161019072016_add_active_flag_to_step.rb +13 -0
  634. data/decidim-core/db/migrate/20161020080756_add_position_to_steps.rb +9 -0
  635. data/decidim-core/db/migrate/20161025125300_add_published_at_to_processes.rb +7 -0
  636. data/decidim-core/db/migrate/20161107152228_remove_not_null_on_step_position.rb +7 -0
  637. data/decidim-core/db/migrate/20161108093802_create_decidim_static_pages.rb +13 -0
  638. data/decidim-core/db/migrate/20161110092735_add_index_for_process_slug_organization.rb +10 -0
  639. data/decidim-core/db/migrate/20161110105712_create_decidim_features.rb +11 -0
  640. data/decidim-core/db/migrate/20161116115156_create_attachments.rb +18 -0
  641. data/decidim-core/db/migrate/20161123085134_add_categories.rb +12 -0
  642. data/decidim-core/db/migrate/20161130105257_create_decidim_scopes.rb +11 -0
  643. data/decidim-core/db/migrate/20161209134715_make_organization_description_optional.rb +7 -0
  644. data/decidim-core/db/migrate/20161213094244_add_avatar_to_users.rb +7 -0
  645. data/decidim-core/db/migrate/20161214152811_add_logo_to_organizations.rb +7 -0
  646. data/decidim-core/db/migrate/20170110133113_add_configuration_to_features.rb +9 -0
  647. data/decidim-core/db/migrate/20170110153807_add_handler_to_organization.rb +7 -0
  648. data/decidim-core/db/migrate/20170113150627_create_resource_links.rb +12 -0
  649. data/decidim-core/db/migrate/20170116110851_create_identities.rb +13 -0
  650. data/decidim-core/db/migrate/20170116135237_loosen_step_requirements.rb +8 -0
  651. data/decidim-core/db/migrate/20170117142904_add_uniqueness_field_to_authorizations.rb +9 -0
  652. data/decidim-core/db/migrate/20170119145359_create_user_groups.rb +13 -0
  653. data/decidim-core/db/migrate/20170119150255_create_user_group_memberships.rb +14 -0
  654. data/decidim-core/db/migrate/20170119150649_add_show_statistics_to_organization.rb +7 -0
  655. data/decidim-core/db/migrate/20170120120733_add_user_groups_verified.rb +7 -0
  656. data/decidim-core/db/migrate/20170123134023_make_attachments_polymorphic.rb +20 -0
  657. data/decidim-core/db/migrate/20170123140857_add_avatar_to_user_groups.rb +7 -0
  658. data/decidim-core/db/migrate/20170125135937_rename_attachable_to_attached_to.rb +13 -0
  659. data/decidim-core/db/migrate/20170125152026_add_weight_to_features.rb +7 -0
  660. data/decidim-core/db/migrate/20170126151123_add_extra_info_to_processes.rb +10 -0
  661. data/decidim-core/db/migrate/20170128140553_add_timestamps_to_identities.rb +7 -0
  662. data/decidim-core/db/migrate/20170130132833_add_favicon_to_decidim_organizations.rb +7 -0
  663. data/decidim-core/db/migrate/20170131134349_add_action_permissions_to_decidim_features.rb +7 -0
  664. data/decidim-core/db/migrate/20170202084913_add_comments_and_replies_notifications_to_users.rb +8 -0
  665. data/decidim-core/db/migrate/20170203150545_add_newsletter_notifications_to_users.rb +7 -0
  666. data/decidim-core/db/migrate/20170206083118_rename_extra_info_on_processes.rb +14 -0
  667. data/decidim-core/db/migrate/20170206142116_add_published_at_to_decidim_features.rb +8 -0
  668. data/decidim-core/db/migrate/20170207091021_add_social_media_handlers_to_organization.rb +10 -0
  669. data/decidim-core/db/migrate/20170207093048_add_organization_logo_and_url.rb +9 -0
  670. data/decidim-core/db/migrate/20170213081133_create_decidim_newsletters.rb +17 -0
  671. data/decidim-core/db/migrate/20170215115407_add_organization_custom_reference.rb +13 -0
  672. data/decidim-core/db/migrate/20170220110740_remove_steps_short_description.rb +23 -0
  673. data/decidim-core/db/migrate/20170221094835_add_scopes_to_processes.rb +8 -0
  674. data/decidim-core/db/migrate/20170228142440_add_participatory_process_groups.rb +17 -0
  675. data/decidim-core/db/migrate/20170306144354_add_secondary_hosts_to_organizations.rb +7 -0
  676. data/decidim-core/db/migrate/20170307084957_create_reports.rb +17 -0
  677. data/decidim-core/db/migrate/20170308091316_create_moderations.rb +14 -0
  678. data/decidim-core/db/migrate/20170313095436_add_available_authorizations_to_organization.rb +12 -0
  679. data/decidim-core/db/migrate/20170404132616_change_steps_end_and_start_date_to_date.rb +8 -0
  680. data/decidim-core/db/migrate/20170405091801_change_decidim_user_email_index_uniqueness.rb +8 -0
  681. data/decidim-core/db/migrate/20170405094028_add_organization_to_identities.rb +7 -0
  682. data/decidim-core/db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb +14 -0
  683. data/decidim-core/db/migrate/20170529150743_add_rejected_at_to_user_groups.rb +7 -0
  684. data/decidim-core/db/migrate/20170605140421_add_deleted_fields_to_users.rb +8 -0
  685. data/decidim-core/db/migrate/20170605162500_add_hierarchy_to_scopes.rb +70 -0
  686. data/decidim-core/db/migrate/20170606102659_set_email_unique_in_organization_conditional.rb +8 -0
  687. data/decidim-core/db/migrate/20170608142521_add_organization_to_user_groups.rb +27 -0
  688. data/decidim-core/db/migrate/20170612070905_add_uniqueness_to_name_and_document_number_to_user_groups.rb +8 -0
  689. data/decidim-core/db/migrate/20170612100253_create_decidim_categorizations.rb +12 -0
  690. data/decidim-core/db/migrate/20170713131206_add_admin_to_users.rb +13 -0
  691. data/decidim-core/db/migrate/20170713131308_migrate_user_roles_to_participatory_process_roles.rb +28 -0
  692. data/decidim-core/db/migrate/20170720135441_add_managed_to_users.rb +7 -0
  693. data/decidim-core/db/migrate/20170720140610_set_email_unique_in_organization_condition_for_managed_users.rb +12 -0
  694. data/decidim-core/db/migrate/20170724130558_create_impersonation_logs.rb +15 -0
  695. data/decidim-core/db/migrate/20170725085104_add_show_statistics_to_participatory_processes.rb +7 -0
  696. data/decidim-core/db/migrate/20170727125445_add_roles_to_users.rb +7 -0
  697. data/decidim-core/db/migrate/20170804125402_attachment_description_nullable.rb +7 -0
  698. data/decidim-core/db/migrate/20170808080905_add_announcement_to_participatory_processes.rb +7 -0
  699. data/decidim-core/db/migrate/20170809084005_add_scopes_enabled_to_participatory_processes.rb +7 -0
  700. data/decidim-core/db/seeds.rb +200 -0
  701. data/{decidim-dev/spec/support → decidim-core/db/seeds}/Exampledocument.pdf +0 -0
  702. data/{decidim-dev/spec/support → decidim-core/db/seeds}/city.jpeg +0 -0
  703. data/{decidim-dev/spec/support → decidim-core/db/seeds}/city2.jpeg +0 -0
  704. data/decidim-core/db/seeds/homepage_image.jpg +0 -0
  705. data/decidim-core/decidim-core.gemspec +60 -0
  706. data/decidim-core/lib/decidim/abilities.rb +7 -0
  707. data/decidim-core/lib/decidim/abilities/participatory_process_role_ability.rb +62 -0
  708. data/decidim-core/lib/decidim/attributes.rb +7 -0
  709. data/decidim-core/lib/decidim/attributes/time_with_zone.rb +14 -0
  710. data/decidim-core/lib/decidim/authorable.rb +33 -0
  711. data/decidim-core/lib/decidim/authorization_form_builder.rb +71 -0
  712. data/decidim-core/lib/decidim/core.rb +204 -0
  713. data/decidim-core/lib/decidim/core/api.rb +13 -0
  714. data/decidim-core/lib/decidim/core/api/author_interface.rb +18 -0
  715. data/decidim-core/lib/decidim/core/api/decidim_type.rb +17 -0
  716. data/decidim-core/lib/decidim/core/api/localized_string_type.rb +12 -0
  717. data/decidim-core/lib/decidim/core/api/process_step_type.rb +19 -0
  718. data/decidim-core/lib/decidim/core/api/process_type.rb +17 -0
  719. data/decidim-core/lib/decidim/core/api/session_type.rb +17 -0
  720. data/decidim-core/lib/decidim/core/api/translated_field_type.rb +43 -0
  721. data/decidim-core/lib/decidim/core/api/user_group_type.rb +35 -0
  722. data/decidim-core/lib/decidim/core/api/user_type.rb +33 -0
  723. data/decidim-core/lib/decidim/core/engine.rb +161 -0
  724. data/decidim-core/lib/decidim/core/test.rb +18 -0
  725. data/decidim-core/lib/decidim/core/test/factories.rb +360 -0
  726. data/decidim-core/lib/decidim/core/test/shared_examples/announcements_examples.rb +58 -0
  727. data/decidim-core/lib/decidim/core/test/shared_examples/authorable.rb +32 -0
  728. data/decidim-core/lib/decidim/core/test/shared_examples/comments_examples.rb +203 -0
  729. data/decidim-core/lib/decidim/core/test/shared_examples/errors.rb +21 -0
  730. data/decidim-core/lib/decidim/core/test/shared_examples/has_attachments.rb +25 -0
  731. data/decidim-core/lib/decidim/core/test/shared_examples/has_category.rb +11 -0
  732. data/decidim-core/lib/decidim/core/test/shared_examples/has_feature.rb +21 -0
  733. data/decidim-core/lib/decidim/core/test/shared_examples/has_reference.rb +43 -0
  734. data/decidim-core/lib/decidim/core/test/shared_examples/has_scope.rb +11 -0
  735. data/decidim-core/lib/decidim/core/test/shared_examples/localised_email.rb +25 -0
  736. data/decidim-core/lib/decidim/core/test/shared_examples/manage_moderations_examples.rb +69 -0
  737. data/decidim-core/lib/decidim/core/test/shared_examples/paginated_resource_examples.rb +26 -0
  738. data/decidim-core/lib/decidim/core/test/shared_examples/process_announcements_examples.rb +33 -0
  739. data/decidim-core/lib/decidim/core/test/shared_examples/publicable.rb +27 -0
  740. data/decidim-core/lib/decidim/core/test/shared_examples/reportable.rb +45 -0
  741. data/decidim-core/lib/decidim/core/test/shared_examples/reports_examples.rb +64 -0
  742. data/decidim-core/lib/decidim/core/version.rb +25 -0
  743. data/decidim-core/lib/decidim/devise_failure_app.rb +36 -0
  744. data/decidim-core/lib/decidim/exporters.rb +11 -0
  745. data/decidim-core/lib/decidim/exporters/csv.rb +55 -0
  746. data/decidim-core/lib/decidim/exporters/export_data.rb +23 -0
  747. data/decidim-core/lib/decidim/exporters/exporter.rb +29 -0
  748. data/decidim-core/lib/decidim/exporters/json.rb +23 -0
  749. data/decidim-core/lib/decidim/exporters/serializer.rb +30 -0
  750. data/decidim-core/lib/decidim/faker/localized.rb +163 -0
  751. data/decidim-core/lib/decidim/feature_manifest.rb +193 -0
  752. data/decidim-core/lib/decidim/feature_validator.rb +22 -0
  753. data/decidim-core/lib/decidim/features.rb +9 -0
  754. data/decidim-core/lib/decidim/features/export_manifest.rb +52 -0
  755. data/decidim-core/lib/decidim/features/namer.rb +35 -0
  756. data/decidim-core/lib/decidim/file_zipper.rb +29 -0
  757. data/decidim-core/lib/decidim/filter_form_builder.rb +64 -0
  758. data/decidim-core/lib/decidim/form_builder.rb +499 -0
  759. data/decidim-core/lib/decidim/has_attachments.rb +33 -0
  760. data/decidim-core/lib/decidim/has_category.rb +24 -0
  761. data/decidim-core/lib/decidim/has_feature.rb +22 -0
  762. data/decidim-core/lib/decidim/has_reference.rb +40 -0
  763. data/decidim-core/lib/decidim/has_scope.rb +25 -0
  764. data/decidim-core/lib/decidim/has_settings.rb +66 -0
  765. data/decidim-core/lib/decidim/i18n_exceptions.rb +17 -0
  766. data/decidim-core/lib/decidim/manifest_registry.rb +45 -0
  767. data/decidim-core/lib/decidim/menu.rb +61 -0
  768. data/decidim-core/lib/decidim/menu_item.rb +31 -0
  769. data/decidim-core/lib/decidim/menu_registry.rb +65 -0
  770. data/decidim-core/lib/decidim/notifiable.rb +22 -0
  771. data/decidim-core/lib/decidim/page_finder.rb +49 -0
  772. data/decidim-core/lib/decidim/publicable.rb +49 -0
  773. data/decidim-core/lib/decidim/query_extensions.rb +38 -0
  774. data/decidim-core/lib/decidim/reportable.rb +47 -0
  775. data/decidim-core/lib/decidim/resource_manifest.rb +74 -0
  776. data/decidim-core/lib/decidim/resourceable.rb +112 -0
  777. data/decidim-core/lib/decidim/scopable.rb +33 -0
  778. data/decidim-core/lib/decidim/settings_manifest.rb +104 -0
  779. data/decidim-core/lib/decidim/stats_registry.rb +111 -0
  780. data/decidim-core/lib/decidim/translatable_attributes.rb +64 -0
  781. data/decidim-core/lib/devise/models/decidim_validatable.rb +68 -0
  782. data/decidim-core/lib/tasks/decidim_tasks.rake +6 -0
  783. data/decidim-core/spec/assets/avatar.jpg +0 -0
  784. data/decidim-core/spec/commands/decidim/authorize_user_spec.rb +74 -0
  785. data/decidim-core/spec/commands/decidim/create_omniauth_registration_spec.rb +131 -0
  786. data/decidim-core/spec/commands/decidim/create_registration_spec.rb +131 -0
  787. data/decidim-core/spec/commands/decidim/create_report_spec.rb +99 -0
  788. data/decidim-core/spec/commands/decidim/destroy_account_spec.rb +74 -0
  789. data/decidim-core/spec/commands/decidim/invite_user_again_spec.rb +43 -0
  790. data/decidim-core/spec/commands/decidim/invite_user_spec.rb +100 -0
  791. data/decidim-core/spec/commands/decidim/remove_admin_spec.rb +31 -0
  792. data/decidim-core/spec/commands/decidim/update_account_spec.rb +122 -0
  793. data/decidim-core/spec/commands/decidim/update_notifications_settings_spec.rb +49 -0
  794. data/decidim-core/spec/controllers/authorizations_controller_spec.rb +36 -0
  795. data/decidim-core/spec/controllers/concerns/form_factory_spec.rb +92 -0
  796. data/decidim-core/spec/controllers/concerns/settings_spec.rb +45 -0
  797. data/decidim-core/spec/controllers/locales_controller_spec.rb +70 -0
  798. data/decidim-core/spec/controllers/omniauth_registrations_controller_spec.rb +44 -0
  799. data/decidim-core/spec/controllers/pages_controller_spec.rb +38 -0
  800. data/decidim-core/spec/controllers/participatory_processes_controller_spec.rb +117 -0
  801. data/decidim-core/spec/controllers/registrations_controller_spec.rb +57 -0
  802. data/decidim-core/spec/controllers/scopes_controller_spec.rb +97 -0
  803. data/decidim-core/spec/controllers/sessions_controller_spec.rb +60 -0
  804. data/decidim-core/spec/controllers/static_map_controller_spec.rb +37 -0
  805. data/decidim-core/spec/factories.rb +7 -0
  806. data/decidim-core/spec/factory_lint_spec.rb +9 -0
  807. data/decidim-core/spec/features/account_spec.rb +159 -0
  808. data/decidim-core/spec/features/authentication_spec.rb +433 -0
  809. data/decidim-core/spec/features/authorizations_spec.rb +139 -0
  810. data/decidim-core/spec/features/components_spec.rb +23 -0
  811. data/decidim-core/spec/features/cookies_spec.rb +25 -0
  812. data/decidim-core/spec/features/homepage_spec.rb +172 -0
  813. data/decidim-core/spec/features/locales_spec.rb +53 -0
  814. data/decidim-core/spec/features/menu_spec.rb +59 -0
  815. data/decidim-core/spec/features/participatory_process_groups_spec.rb +80 -0
  816. data/decidim-core/spec/features/participatory_process_steps_spec.rb +34 -0
  817. data/decidim-core/spec/features/participatory_processes_spec.rb +151 -0
  818. data/decidim-core/spec/features/user_groups_spec.rb +65 -0
  819. data/decidim-core/spec/forms/account_form_spec.rb +71 -0
  820. data/decidim-core/spec/forms/attachment_form_spec.rb +43 -0
  821. data/decidim-core/spec/forms/invite_user_form_spec.rb +64 -0
  822. data/decidim-core/spec/forms/notifications_settings_form_spec.rb +53 -0
  823. data/decidim-core/spec/forms/omniauth_registration_form_spec.rb +57 -0
  824. data/decidim-core/spec/forms/registration_form_spec.rb +125 -0
  825. data/decidim-core/spec/forms/report_form_spec.rb +29 -0
  826. data/decidim-core/spec/forms/translatable_presence_validator_spec.rb +52 -0
  827. data/decidim-core/spec/helpers/decidim/action_authorization_helper_spec.rb +151 -0
  828. data/decidim-core/spec/helpers/decidim/application_helper_spec.rb +40 -0
  829. data/decidim-core/spec/helpers/decidim/authorization_form_helper_spec.rb +44 -0
  830. data/decidim-core/spec/helpers/decidim/decidim_form_helper_spec.rb +51 -0
  831. data/decidim-core/spec/helpers/decidim/feature_path_helper_spec.rb +26 -0
  832. data/decidim-core/spec/helpers/decidim/filters_helper_spec.rb +44 -0
  833. data/decidim-core/spec/helpers/decidim/icon_helper_spec.rb +31 -0
  834. data/decidim-core/spec/helpers/decidim/omniauth_helper_spec.rb +50 -0
  835. data/decidim-core/spec/helpers/decidim/participatory_process_helper_spec.rb +41 -0
  836. data/decidim-core/spec/helpers/decidim/replace_buttons_helper_spec.rb +26 -0
  837. data/decidim-core/spec/helpers/decidim/resource_helper_spec.rb +76 -0
  838. data/decidim-core/spec/helpers/decidim/scopes_helper_spec.rb +40 -0
  839. data/decidim-core/spec/helpers/decidim/translations_helper_spec.rb +49 -0
  840. data/decidim-core/spec/helpers/decidim/widget_urls_helper_spec.rb +14 -0
  841. data/decidim-core/spec/i18n_spec.rb +7 -0
  842. data/decidim-core/spec/lib/attributes/time_with_timezone_spec.rb +41 -0
  843. data/decidim-core/spec/lib/authorization_form_builder_spec.rb +63 -0
  844. data/decidim-core/spec/lib/decidim_spec.rb +9 -0
  845. data/decidim-core/spec/lib/exporters/csv_spec.rb +39 -0
  846. data/decidim-core/spec/lib/exporters/json_spec.rb +34 -0
  847. data/decidim-core/spec/lib/exporters/serializer_spec.rb +14 -0
  848. data/decidim-core/spec/lib/faker_localized_spec.rb +70 -0
  849. data/decidim-core/spec/lib/feature_manifest_spec.rb +109 -0
  850. data/decidim-core/spec/lib/features/current_feature_spec.rb +102 -0
  851. data/decidim-core/spec/lib/features/export_manifest_spec.rb +42 -0
  852. data/decidim-core/spec/lib/file_zipper_spec.rb +29 -0
  853. data/decidim-core/spec/lib/filter_form_builder_spec.rb +68 -0
  854. data/decidim-core/spec/lib/form_builder_spec.rb +479 -0
  855. data/decidim-core/spec/lib/page_finder_spec.rb +58 -0
  856. data/decidim-core/spec/lib/resource_manifest_spec.rb +58 -0
  857. data/decidim-core/spec/lib/resourceable_spec.rb +105 -0
  858. data/decidim-core/spec/lib/seed_spec.rb +40 -0
  859. data/decidim-core/spec/lib/settings_manifest_spec.rb +79 -0
  860. data/decidim-core/spec/lib/stats_registry_spec.rb +111 -0
  861. data/decidim-core/spec/lib/translatable_attributes_spec.rb +58 -0
  862. data/decidim-core/spec/mailers/decidim_devise_mailer_spec.rb +54 -0
  863. data/decidim-core/spec/mailers/export_mailer_spec.rb +40 -0
  864. data/decidim-core/spec/mailers/newsletter_mailer_spec.rb +37 -0
  865. data/decidim-core/spec/mailers/previews/devise_mailer_preview.rb +13 -0
  866. data/decidim-core/spec/mailers/reported_mailer_spec.rb +38 -0
  867. data/decidim-core/spec/middleware/decidim/current_organization_spec.rb +42 -0
  868. data/decidim-core/spec/models/decidim/abilities/admin_ability_spec.rb +23 -0
  869. data/decidim-core/spec/models/decidim/abilities/base_ability_spec.rb +45 -0
  870. data/decidim-core/spec/models/decidim/abilities/everyone_ability_spec.rb +17 -0
  871. data/decidim-core/spec/models/decidim/abilities/participatory_process_admin_ability_spec.rb +23 -0
  872. data/decidim-core/spec/models/decidim/abilities/participatory_process_collaborator_ability_spec.rb +25 -0
  873. data/decidim-core/spec/models/decidim/attachment_spec.rb +89 -0
  874. data/decidim-core/spec/models/decidim/authorization_spec.rb +13 -0
  875. data/decidim-core/spec/models/decidim/category_spec.rb +40 -0
  876. data/decidim-core/spec/models/decidim/feature_spec.rb +14 -0
  877. data/decidim-core/spec/models/decidim/identity_spec.rb +56 -0
  878. data/decidim-core/spec/models/decidim/impersonation_log_spec.rb +28 -0
  879. data/decidim-core/spec/models/decidim/organization_spec.rb +39 -0
  880. data/decidim-core/spec/models/decidim/participatory_process_spec.rb +29 -0
  881. data/decidim-core/spec/models/decidim/participatory_process_step_spec.rb +120 -0
  882. data/decidim-core/spec/models/decidim/participatory_process_user_role_spec.rb +62 -0
  883. data/decidim-core/spec/models/decidim/resource_link_spec.rb +56 -0
  884. data/decidim-core/spec/models/decidim/scope_spec.rb +87 -0
  885. data/decidim-core/spec/models/decidim/scope_type_spec.rb +28 -0
  886. data/decidim-core/spec/models/decidim/static_page_spec.rb +104 -0
  887. data/decidim-core/spec/models/decidim/user_group_membership_spec.rb +21 -0
  888. data/decidim-core/spec/models/decidim/user_group_spec.rb +59 -0
  889. data/decidim-core/spec/models/decidim/user_spec.rb +91 -0
  890. data/decidim-core/spec/presenters/decidim/home_stats_presenter_spec.rb +76 -0
  891. data/decidim-core/spec/presenters/decidim/menu_item_presenter_spec.rb +19 -0
  892. data/decidim-core/spec/presenters/decidim/menu_presenter_spec.rb +60 -0
  893. data/decidim-core/spec/presenters/decidim/participatory_process_stats_presenter.spec.rb +44 -0
  894. data/decidim-core/spec/presenters/decidim/resource_locator_presenter_spec.rb +33 -0
  895. data/decidim-core/spec/queries/decidim/organization_participatory_process_groups_spec.rb +27 -0
  896. data/decidim-core/spec/queries/decidim/organization_participatory_processes_spec.rb +26 -0
  897. data/decidim-core/spec/queries/decidim/organization_prioritized_participatory_processes_spec.rb +48 -0
  898. data/decidim-core/spec/queries/decidim/organization_published_participatory_processes_spec.rb +40 -0
  899. data/decidim-core/spec/queries/decidim/participatory_processes_with_user_role_spec.rb +31 -0
  900. data/decidim-core/spec/queries/decidim/stats_users_count_spec.rb +42 -0
  901. data/decidim-core/spec/routing/feature_routes_spec.rb +15 -0
  902. data/decidim-core/spec/services/decidim/action_authorizer_spec.rb +130 -0
  903. data/decidim-core/spec/services/decidim/authorization_handler_spec.rb +72 -0
  904. data/decidim-core/spec/services/decidim/dummy_authorization_handler_spec.rb +43 -0
  905. data/decidim-core/spec/services/decidim/static_map_generator_spec.rb +28 -0
  906. data/decidim-core/spec/shared/with_promoted_participatory_processes_examples.rb +58 -0
  907. data/decidim-core/spec/spec_helper.rb +9 -0
  908. data/decidim-core/spec/types/decidim_type_spec.rb +30 -0
  909. data/decidim-core/spec/types/localized_string_type_spec.rb +30 -0
  910. data/decidim-core/spec/types/process_step_type_spec.rb +42 -0
  911. data/decidim-core/spec/types/process_type_spec.rb +39 -0
  912. data/decidim-core/spec/types/translated_field_type_spec.rb +68 -0
  913. data/decidim-core/spec/types/user_group_type_spec.rb +56 -0
  914. data/decidim-core/spec/types/user_type_spec.rb +44 -0
  915. data/decidim-core/spec/validators/etiquette_validator_spec.rb +63 -0
  916. data/decidim-core/spec/validators/geocoding_validator_spec.rb +57 -0
  917. data/decidim-core/spec/views/decidim/authorizations/new.html.erb_spec.rb +37 -0
  918. data/decidim-core/vendor/assets/javascripts/appendAround.js +41 -0
  919. data/decidim-core/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.ca.js +17 -0
  920. data/decidim-core/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.es.js +14 -0
  921. data/decidim-core/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.eu.js +15 -0
  922. data/decidim-core/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.fi.js +14 -0
  923. data/decidim-core/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.fr.js +14 -0
  924. data/decidim-core/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.it.js +14 -0
  925. data/decidim-core/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.nl.js +14 -0
  926. data/decidim-core/vendor/assets/javascripts/form_datepicker.js.es6 +32 -0
  927. data/decidim-core/vendor/assets/javascripts/foundation-datepicker.js +1417 -0
  928. data/decidim-core/vendor/assets/javascripts/leaflet-svg-icon.js +179 -0
  929. data/decidim-core/vendor/assets/javascripts/leaflet-tilelayer-here.js +166 -0
  930. data/decidim-core/vendor/assets/javascripts/leaflet.js +9 -0
  931. data/decidim-core/vendor/assets/javascripts/leaflet.markercluster.js +7 -0
  932. data/decidim-core/vendor/assets/javascripts/modernizr.js +3 -0
  933. data/decidim-core/vendor/assets/javascripts/morphdom.js +679 -0
  934. data/decidim-core/vendor/assets/javascripts/quill.min.js +8 -0
  935. data/decidim-core/vendor/assets/javascripts/quill.min.js.map +1 -0
  936. data/decidim-core/vendor/assets/javascripts/svg4everybody.min.js +2 -0
  937. data/decidim-core/vendor/assets/stylesheets/MarkerCluster.Default.css +60 -0
  938. data/decidim-core/vendor/assets/stylesheets/MarkerCluster.css +14 -0
  939. data/decidim-core/vendor/assets/stylesheets/leaflet.css +624 -0
  940. data/decidim-core/vendor/assets/stylesheets/quill.bubble.css +938 -0
  941. data/decidim-core/vendor/assets/stylesheets/quill.core.css +387 -0
  942. data/decidim-core/vendor/assets/stylesheets/quill.snow.css +931 -0
  943. data/decidim-dev/config/locales/ca.yml +1 -1
  944. data/decidim-dev/config/locales/es.yml +1 -1
  945. data/decidim-dev/config/locales/eu.yml +1 -1
  946. data/decidim-dev/config/locales/fi.yml +1 -1
  947. data/decidim-dev/config/locales/fr.yml +1 -1
  948. data/decidim-dev/config/locales/it.yml +1 -1
  949. data/decidim-dev/config/locales/nl.yml +1 -1
  950. data/decidim-dev/config/locales/pl.yml +6 -0
  951. data/decidim-dev/decidim-dev.gemspec +1 -1
  952. data/decidim-dev/lib/decidim/dev/test/authorization_shared_examples.rb +1 -7
  953. data/decidim-dev/lib/decidim/dev/test/base_spec_helper.rb +5 -27
  954. data/decidim-dev/lib/decidim/dev/test/i18n_shared_examples.rb +1 -1
  955. data/decidim-dev/lib/decidim/dev/test/rspec_support/attachments.rb +13 -0
  956. data/decidim-dev/lib/decidim/dev/test/rspec_support/authenticated_controller_context.rb +1 -1
  957. data/decidim-dev/lib/decidim/dev/test/rspec_support/capybara.rb +3 -9
  958. data/decidim-dev/lib/decidim/dev/test/rspec_support/capybara_select2.rb +35 -0
  959. data/decidim-dev/lib/decidim/dev/test/rspec_support/comments.rb +19 -0
  960. data/decidim-dev/lib/decidim/dev/test/rspec_support/feature.rb +2 -0
  961. data/decidim-dev/lib/decidim/dev/test/rspec_support/feature_context.rb +12 -3
  962. data/decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb +0 -10
  963. data/decidim-dev/lib/decidim/dev/test/rspec_support/phantomjs_polyfills/phantomjs-getOwnPropertyNames.js +1 -1
  964. data/decidim-dev/lib/decidim/dev/test/rspec_support/phantomjs_polyfills/phantomjs-shim.js +10 -0
  965. data/decidim-dev/lib/decidim/dev/test/rspec_support/translation_helpers.rb +21 -5
  966. data/decidim-dev/lib/decidim/dev/test/spec_helper.rb +2 -1
  967. data/decidim-dev/lib/generators/decidim/dummy_generator.rb +12 -0
  968. data/decidim-dev/lib/generators/decidim/templates/no_animations.rb +54 -0
  969. data/decidim-dev/spec/i18n_spec.rb +1 -1
  970. data/decidim-meetings/app/assets/images/decidim/meetings/icon.svg +1 -1
  971. data/decidim-meetings/app/controllers/decidim/meetings/admin/meeting_closes_controller.rb +0 -1
  972. data/decidim-meetings/app/controllers/decidim/meetings/meeting_widgets_controller.rb +0 -5
  973. data/decidim-meetings/app/forms/decidim/meetings/admin/meeting_form.rb +3 -5
  974. data/decidim-meetings/app/views/decidim/meetings/admin/meetings/_form.html.erb +3 -3
  975. data/decidim-meetings/app/views/decidim/meetings/meetings/_datetime.html.erb +1 -1
  976. data/decidim-meetings/app/views/decidim/meetings/meetings/_filters.html.erb +2 -2
  977. data/decidim-meetings/app/views/decidim/meetings/meetings/_filters_small_view.html.erb +1 -1
  978. data/decidim-meetings/app/views/decidim/meetings/meetings/_meetings.html.erb +1 -1
  979. data/decidim-meetings/app/views/decidim/meetings/meetings/index.html.erb +2 -0
  980. data/decidim-meetings/app/views/decidim/meetings/meetings/index.js.erb +4 -0
  981. data/decidim-meetings/app/views/decidim/meetings/meetings/show.html.erb +1 -1
  982. data/decidim-meetings/config/i18n-tasks.yml +3 -0
  983. data/decidim-meetings/config/locales/ca.yml +2 -1
  984. data/decidim-meetings/config/locales/en.yml +6 -0
  985. data/decidim-meetings/config/locales/es.yml +2 -1
  986. data/decidim-meetings/config/locales/eu.yml +1 -1
  987. data/decidim-meetings/config/locales/fi.yml +1 -1
  988. data/decidim-meetings/config/locales/fr.yml +1 -1
  989. data/decidim-meetings/config/locales/it.yml +1 -1
  990. data/decidim-meetings/config/locales/nl.yml +1 -1
  991. data/decidim-meetings/config/locales/pl.yml +63 -0
  992. data/decidim-meetings/lib/decidim/meetings/feature.rb +17 -1
  993. data/decidim-meetings/spec/features/admin_manages_meetings_spec.rb +1 -0
  994. data/decidim-meetings/spec/features/explore_meetings_spec.rb +5 -5
  995. data/decidim-meetings/spec/features/process_admin_manages_meetings_spec.rb +1 -0
  996. data/decidim-meetings/spec/forms/close_meeting_form_spec.rb +0 -3
  997. data/decidim-meetings/spec/i18n_spec.rb +1 -1
  998. data/decidim-meetings/spec/shared/manage_attachments_examples.rb +1 -1
  999. data/decidim-meetings/spec/shared/manage_meetings_examples.rb +4 -5
  1000. data/decidim-pages/app/assets/images/decidim/pages/icon.svg +1 -1
  1001. data/decidim-pages/app/views/decidim/pages/admin/pages/_form.html.erb +1 -1
  1002. data/decidim-pages/app/views/decidim/pages/application/show.html.erb +2 -0
  1003. data/decidim-pages/config/locales/ca.yml +1 -1
  1004. data/decidim-pages/config/locales/en.yml +2 -0
  1005. data/decidim-pages/config/locales/es.yml +1 -1
  1006. data/decidim-pages/config/locales/eu.yml +1 -1
  1007. data/decidim-pages/config/locales/fi.yml +1 -1
  1008. data/decidim-pages/config/locales/fr.yml +1 -1
  1009. data/decidim-pages/config/locales/it.yml +1 -1
  1010. data/decidim-pages/config/locales/nl.yml +1 -1
  1011. data/decidim-pages/config/locales/pl.yml +5 -0
  1012. data/decidim-pages/lib/decidim/pages/feature.rb +2 -0
  1013. data/decidim-pages/spec/commands/copy_page_spec.rb +1 -1
  1014. data/decidim-pages/spec/commands/create_page_spec.rb +1 -1
  1015. data/decidim-pages/spec/commands/destroy_page_spec.rb +1 -1
  1016. data/decidim-pages/spec/commands/update_page_spec.rb +1 -1
  1017. data/decidim-pages/spec/features/admin_spec.rb +8 -0
  1018. data/decidim-pages/spec/i18n_spec.rb +1 -1
  1019. data/decidim-proposals/app/assets/images/decidim/proposals/icon.svg +1 -1
  1020. data/decidim-proposals/app/assets/javascripts/decidim/proposals/add_proposal.js.es6 +2 -0
  1021. data/decidim-proposals/app/commands/decidim/proposals/admin/create_proposal.rb +44 -3
  1022. data/decidim-proposals/app/commands/decidim/proposals/create_proposal.rb +43 -2
  1023. data/decidim-proposals/app/controllers/decidim/proposals/admin/proposals_controller.rb +3 -1
  1024. data/decidim-proposals/app/controllers/decidim/proposals/proposals_controller.rb +3 -1
  1025. data/decidim-proposals/app/forms/decidim/proposals/admin/proposal_form.rb +2 -1
  1026. data/decidim-proposals/app/forms/decidim/proposals/proposal_form.rb +2 -1
  1027. data/decidim-proposals/app/models/decidim/proposals/proposal.rb +1 -0
  1028. data/decidim-proposals/app/views/decidim/proposals/admin/proposals/_form.html.erb +19 -2
  1029. data/decidim-proposals/app/views/decidim/proposals/admin/proposals/index.html.erb +12 -8
  1030. data/decidim-proposals/app/views/decidim/proposals/proposals/_filters.html.erb +2 -2
  1031. data/decidim-proposals/app/views/decidim/proposals/proposals/_filters_small_view.html.erb +1 -1
  1032. data/decidim-proposals/app/views/decidim/proposals/proposals/_proposal.html.erb +1 -1
  1033. data/decidim-proposals/app/views/decidim/proposals/proposals/index.html.erb +2 -0
  1034. data/decidim-proposals/app/views/decidim/proposals/proposals/index.js.erb +1 -1
  1035. data/decidim-proposals/app/views/decidim/proposals/proposals/new.html.erb +22 -2
  1036. data/decidim-proposals/app/views/decidim/proposals/proposals/show.html.erb +2 -1
  1037. data/decidim-proposals/config/i18n-tasks.yml +1 -1
  1038. data/decidim-proposals/config/locales/ca.yml +2 -1
  1039. data/decidim-proposals/config/locales/en.yml +7 -0
  1040. data/decidim-proposals/config/locales/es.yml +2 -1
  1041. data/decidim-proposals/config/locales/eu.yml +1 -1
  1042. data/decidim-proposals/config/locales/fi.yml +1 -1
  1043. data/decidim-proposals/config/locales/fr.yml +1 -1
  1044. data/decidim-proposals/config/locales/it.yml +1 -1
  1045. data/decidim-proposals/config/locales/nl.yml +1 -1
  1046. data/decidim-proposals/config/locales/pl.yml +5 -0
  1047. data/decidim-proposals/lib/decidim/proposals/feature.rb +13 -3
  1048. data/decidim-proposals/lib/decidim/proposals/test/factories.rb +8 -0
  1049. data/decidim-proposals/spec/controllers/concerns/{orderable_test.rb → orderable_spec.rb} +1 -1
  1050. data/decidim-proposals/spec/controllers/decidim/admin/proposal_answers_controller_spec.rb +0 -1
  1051. data/decidim-proposals/spec/features/admin_manages_proposals_spec.rb +2 -0
  1052. data/decidim-proposals/spec/features/process_admin_manages_proposals_spec.rb +2 -0
  1053. data/decidim-proposals/spec/features/proposals_spec.rb +97 -30
  1054. data/decidim-proposals/spec/i18n_spec.rb +1 -1
  1055. data/decidim-proposals/spec/services/decidim/proposals/proposal_search_spec.rb +25 -6
  1056. data/decidim-proposals/spec/shared/create_proposal_examples.rb +35 -3
  1057. data/decidim-proposals/spec/shared/export_proposals_examples.rb +1 -2
  1058. data/decidim-proposals/spec/shared/manage_proposals_examples.rb +37 -6
  1059. data/decidim-proposals/spec/shared/proposal_form_examples.rb +13 -3
  1060. data/decidim-proposals/spec/shared/proposals_help_texts_examples.rb +33 -0
  1061. data/decidim-results/app/assets/images/decidim/results/icon.svg +1 -1
  1062. data/decidim-results/app/forms/decidim/results/admin/result_form.rb +1 -1
  1063. data/decidim-results/app/views/decidim/results/admin/results/_form.html.erb +4 -4
  1064. data/decidim-results/app/views/decidim/results/results/_filters.html.erb +2 -2
  1065. data/decidim-results/app/views/decidim/results/results/_filters_small_view.html.erb +1 -1
  1066. data/decidim-results/app/views/decidim/results/results/_results.html.erb +1 -1
  1067. data/decidim-results/app/views/decidim/results/results/index.html.erb +2 -0
  1068. data/decidim-results/app/views/decidim/results/results/index.js.erb +3 -0
  1069. data/decidim-results/app/views/decidim/results/results/show.html.erb +1 -1
  1070. data/decidim-results/config/i18n-tasks.yml +2 -0
  1071. data/decidim-results/config/locales/ca.yml +2 -1
  1072. data/decidim-results/config/locales/en.yml +3 -0
  1073. data/decidim-results/config/locales/es.yml +2 -1
  1074. data/decidim-results/config/locales/eu.yml +1 -1
  1075. data/decidim-results/config/locales/fi.yml +1 -1
  1076. data/decidim-results/config/locales/fr.yml +1 -1
  1077. data/decidim-results/config/locales/it.yml +1 -1
  1078. data/decidim-results/config/locales/nl.yml +1 -1
  1079. data/decidim-results/config/locales/pl.yml +5 -0
  1080. data/decidim-results/lib/decidim/results/feature.rb +2 -0
  1081. data/decidim-results/spec/controllers/results_controller_spec.rb +0 -1
  1082. data/decidim-results/spec/features/admin_manages_results_spec.rb +1 -0
  1083. data/decidim-results/spec/features/explore_results_spec.rb +6 -6
  1084. data/decidim-results/spec/features/process_admin_manages_results_spec.rb +1 -0
  1085. data/decidim-results/spec/i18n_spec.rb +1 -1
  1086. data/decidim-results/spec/shared/manage_results_examples.rb +3 -4
  1087. data/decidim-surveys/app/assets/images/decidim/surveys/icon.svg +1 -1
  1088. data/decidim-surveys/app/views/decidim/surveys/admin/surveys/_answer_option.html.erb +7 -3
  1089. data/decidim-surveys/app/views/decidim/surveys/admin/surveys/_form.html.erb +1 -1
  1090. data/decidim-surveys/app/views/decidim/surveys/admin/surveys/_question.html.erb +12 -5
  1091. data/decidim-surveys/app/views/decidim/surveys/surveys/show.html.erb +2 -0
  1092. data/decidim-surveys/config/i18n-tasks.yml +0 -2
  1093. data/decidim-surveys/config/locales/ca.yml +1 -1
  1094. data/decidim-surveys/config/locales/en.yml +3 -0
  1095. data/decidim-surveys/config/locales/es.yml +1 -1
  1096. data/decidim-surveys/config/locales/eu.yml +67 -1
  1097. data/decidim-surveys/config/locales/fi.yml +1 -1
  1098. data/decidim-surveys/config/locales/fr.yml +64 -1
  1099. data/decidim-surveys/config/locales/it.yml +1 -1
  1100. data/decidim-surveys/config/locales/nl.yml +1 -1
  1101. data/decidim-surveys/config/locales/pl.yml +5 -0
  1102. data/decidim-surveys/lib/decidim/surveys/feature.rb +4 -5
  1103. data/decidim-surveys/spec/commands/decidim/surveys/admin/update_survey_spec.rb +1 -1
  1104. data/decidim-surveys/spec/commands/decidim/surveys/answer_survey_spec.rb +1 -1
  1105. data/decidim-surveys/spec/commands/decidim/surveys/create_survey_spec.rb +1 -1
  1106. data/decidim-surveys/spec/features/admin_manages_surveys_spec.rb +1 -0
  1107. data/decidim-surveys/spec/features/process_admin_manages_surveys_spec.rb +1 -0
  1108. data/decidim-surveys/spec/features/survey_spec.rb +12 -12
  1109. data/decidim-surveys/spec/shared/edit_survey_examples.rb +5 -6
  1110. data/decidim-surveys/spec/shared/export_survey_user_answers_examples.rb +1 -2
  1111. data/decidim-system/app/assets/stylesheets/decidim/system/_actions.scss +1 -1
  1112. data/decidim-system/app/assets/stylesheets/decidim/system/_layout.scss +1 -1
  1113. data/decidim-system/app/assets/stylesheets/decidim/system/_login.scss +1 -1
  1114. data/decidim-system/app/assets/stylesheets/decidim/system/_tables.scss +1 -1
  1115. data/decidim-system/app/commands/decidim/system/create_default_pages.rb +1 -1
  1116. data/decidim-system/app/commands/decidim/system/register_organization.rb +1 -1
  1117. data/decidim-system/config/locales/ca.yml +1 -1
  1118. data/decidim-system/config/locales/es.yml +1 -1
  1119. data/decidim-system/config/locales/eu.yml +5 -1
  1120. data/decidim-system/config/locales/fi.yml +1 -1
  1121. data/decidim-system/config/locales/fr.yml +1 -1
  1122. data/decidim-system/config/locales/it.yml +1 -1
  1123. data/decidim-system/config/locales/nl.yml +1 -1
  1124. data/decidim-system/config/locales/pl.yml +5 -0
  1125. data/decidim-system/spec/commands/decidim/system/create_admin_spec.rb +1 -1
  1126. data/decidim-system/spec/commands/decidim/system/register_organization_spec.rb +1 -1
  1127. data/decidim-system/spec/commands/decidim/system/update_organization_spec.rb +1 -1
  1128. data/decidim-system/spec/features/manage_admins_spec.rb +1 -1
  1129. data/decidim-system/spec/features/sessions_spec.rb +1 -1
  1130. data/decidim-system/spec/i18n_spec.rb +1 -1
  1131. data/decidim-system/spec/models/admin_spec.rb +1 -1
  1132. data/decidim-system/spec/spec_helper.rb +0 -2
  1133. data/decidim.gemspec +1 -1
  1134. data/jsconfig.json +1 -1
  1135. data/lib/generators/decidim/install_generator.rb +1 -0
  1136. data/lib/generators/decidim/templates/Gemfile.erb +1 -1
  1137. data/lib/generators/decidim/templates/initializer.rb +2 -3
  1138. data/package-lock.json +3947 -564
  1139. data/package.json +2 -1
  1140. metadata +809 -43
  1141. data/.mention-bot +0 -9
  1142. data/decidim-admin/app/views/decidim/admin/participatory_processes/show.html.erb +0 -54
  1143. data/decidim-admin/spec/controllers/participatory_processes_controller_spec.rb +0 -31
  1144. data/decidim-budgets/app/views/decidim/budgets/projects/_tags.html.erb +0 -10
  1145. data/decidim-dev/lib/decidim/dev/assets/Exampledocument.docx +0 -0
  1146. data/decidim-dev/lib/decidim/dev/assets/Exampledocument.odt +0 -0
  1147. data/decidim-dev/lib/decidim/dev/test/rspec_support/i18n.rb +0 -9
  1148. data/decidim-dev/spec/support/Exampledocument.docx +0 -0
  1149. data/decidim-dev/spec/support/Exampledocument.odt +0 -0
  1150. data/decidim-dev/spec/support/city3.jpeg +0 -0
  1151. data/decidim-dev/spec/support/malicious.jpg +0 -0
  1152. data/decidim-meetings/app/views/decidim/meetings/meetings/_tags.html.erb +0 -10
  1153. data/decidim-proposals/app/views/decidim/proposals/proposals/_tags.html.erb +0 -10
  1154. data/decidim-results/app/views/decidim/results/results/_tags.html.erb +0 -10
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+ require "decidim/api/test/type_context"
5
+
6
+ module Decidim
7
+ describe UserType, type: :graphql do
8
+ include_context "graphql type"
9
+
10
+ let(:model) { create(:user) }
11
+
12
+ describe "name" do
13
+ let(:query) { "{ name }" }
14
+
15
+ it "returns all the required fields" do
16
+ expect(response).to include("name" => model.name)
17
+ end
18
+ end
19
+
20
+ describe "isVerified" do
21
+ let(:query) { "{ isVerified }" }
22
+
23
+ it "returns false" do
24
+ expect(response).to include("isVerified" => false)
25
+ end
26
+ end
27
+
28
+ describe "avatarUrl" do
29
+ let(:query) { "{ avatarUrl }" }
30
+
31
+ it "returns the user avatar url" do
32
+ expect(response).to include("avatarUrl" => model.avatar.url)
33
+ end
34
+ end
35
+
36
+ describe "organizationName" do
37
+ let(:query) { "{ organizationName }" }
38
+
39
+ it "returns the user's organization name" do
40
+ expect(response).to include("organizationName" => model.organization.name)
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ describe EtiquetteValidator do
6
+ let(:validatable) do
7
+ Class.new do
8
+ def self.model_name
9
+ ActiveModel::Name.new(self, nil, "Validatable")
10
+ end
11
+
12
+ include Virtus.model
13
+ include ActiveModel::Validations
14
+
15
+ attribute :body
16
+
17
+ validates :body, etiquette: true
18
+ end
19
+ end
20
+
21
+ let(:subject) { validatable.new(body: body) }
22
+
23
+ context "when the body is reasonable" do
24
+ [
25
+ %(I am a very reasonable body, ain't I? I have the right length, the right style, the right words. Yup.),
26
+ %("Validate bodies", they said. "It's gonna be fun!", they said.),
27
+ %(I contain special characters because I'm à la mode.)
28
+ ].each do |a_body|
29
+ describe "like \"#{a_body}\"" do
30
+ let(:body) { a_body }
31
+
32
+ it "validates too much caps" do
33
+ expect(subject).to be_valid
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+ context "when the text has too much caps" do
40
+ let(:body) { "A SCREAMING PIECE of text" }
41
+ it { is_expected.to be_invalid }
42
+ end
43
+
44
+ context "when the text has too many marks" do
45
+ let(:body) { "I am screaming!!?" }
46
+ it { is_expected.to be_invalid }
47
+ end
48
+
49
+ context "when the text has very long words" do
50
+ let(:body) { "This word is veeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeery long." }
51
+ it { is_expected.to be_invalid }
52
+ end
53
+
54
+ context "when the text is written starting in downcase" do
55
+ let(:body) { "i no care about grammer" }
56
+ it { is_expected.to be_invalid }
57
+ end
58
+
59
+ context "when the body is too short" do
60
+ let(:body) { "Oh my god" }
61
+ it { is_expected.to be_invalid }
62
+ end
63
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ describe GeocodingValidator do
6
+ let(:validatable) do
7
+ Class.new do
8
+ def self.model_name
9
+ ActiveModel::Name.new(self, nil, "Validatable")
10
+ end
11
+
12
+ include Virtus.model
13
+ include ActiveModel::Validations
14
+
15
+ attribute :address
16
+ attribute :latitude
17
+ attribute :longitude
18
+
19
+ validates :address, geocoding: true
20
+
21
+ def feature
22
+ FactoryGirl.create(:feature)
23
+ end
24
+ end
25
+ end
26
+
27
+ let(:address) { "Carrer Pare Llaurador 113, baixos, 08224 Terrassa" }
28
+ let(:latitude) { 40.1234 }
29
+ let(:longitude) { 2.1234 }
30
+
31
+ let(:subject) { validatable.new(address: address) }
32
+
33
+ context "when the address is valid" do
34
+ before do
35
+ Geocoder::Lookup::Test.add_stub(
36
+ address,
37
+ [{ "latitude" => latitude, "longitude" => longitude }]
38
+ )
39
+ end
40
+
41
+ it "uses Geocoder to compute its coordinates" do
42
+ expect(subject).to be_valid
43
+ expect(subject.latitude).to eq(latitude)
44
+ expect(subject.longitude).to eq(longitude)
45
+ end
46
+ end
47
+
48
+ context "when the address is not valid" do
49
+ let(:address) { "The post-apocalyptic Land of Ooo" }
50
+
51
+ before do
52
+ Geocoder::Lookup::Test.add_stub(address, [])
53
+ end
54
+
55
+ it { is_expected.to be_invalid }
56
+ end
57
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ module Decidim
6
+ describe "decidim/authorizations/new" do
7
+ let(:handler) do
8
+ DummyAuthorizationHandler.new({})
9
+ end
10
+
11
+ before do
12
+ view.extend AuthorizationFormHelper
13
+ view.extend DecidimFormHelper
14
+ allow(view).to receive(:handler).and_return(handler)
15
+ allow(view).to receive(:authorizations_path).and_return("/authorizations")
16
+ allow(view).to receive(:stored_location).and_return("/processes")
17
+ end
18
+
19
+ context "when there's a partial to render the form" do
20
+ before do
21
+ filepath = File.join(Dir.pwd, "/app/views/", handler.to_partial_path).split("/")
22
+ filename = "_" + filepath.pop + ".html.erb"
23
+ @filepath = filepath.join("/")
24
+ FileUtils.mkdir_p(@filepath)
25
+ File.open(File.join(filepath, "/", filename), "w") { |file| file.write("Custom partial") }
26
+ end
27
+
28
+ after do
29
+ FileUtils.rm_rf(@filepath)
30
+ end
31
+
32
+ it "renders the form with the partial" do
33
+ expect(render).to include("Custom partial")
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,41 @@
1
+ /*! appendAround markup pattern. [c]2012, @scottjehl, Filament Group, Inc. MIT/GPL
2
+ how-to:
3
+ 1. Insert potential element containers throughout the DOM
4
+ 2. give each container a data-set attribute with a value that matches all other containers' values
5
+ 3. Place your appendAround content in one of the potential containers
6
+ 4. Call appendAround() on that element when the DOM is ready
7
+ */
8
+ (function($){
9
+ $.fn.appendAround = function(){
10
+ return this.each(function(){
11
+
12
+ var $self = $(this),
13
+ att = "data-set",
14
+ $parent = $self.parent(),
15
+ parent = $parent[0],
16
+ attval = $parent.attr(att),
17
+ $set = $( "["+ att +"='" + attval + "']" );
18
+
19
+ function isHidden(elem){
20
+ return $(elem).css("display") === "none";
21
+ }
22
+
23
+ function appendToVisibleContainer(){
24
+ if (isHidden(parent)){
25
+ var found = 0;
26
+ $set.each(function(){
27
+ if(!isHidden(this) && !found){
28
+ $self.appendTo(this);
29
+ found++;
30
+ parent = this;
31
+ }
32
+ });
33
+ }
34
+ }
35
+
36
+ appendToVisibleContainer();
37
+
38
+ $(window).bind("resize", appendToVisibleContainer);
39
+ });
40
+ };
41
+ }( jQuery ));
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Catalan translation for foundation-datepicker, language file from bootstrap-datepicker
3
+ * J. Garcia <jogaco.en@gmail.com>
4
+ */
5
+ ;(function($){
6
+ $.fn.fdatepicker.dates['ca'] = {
7
+ days: ["Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"],
8
+ daysShort: ["Diu", "Dil", "Dmt", "Dmc", "Dij", "Div", "Dis"],
9
+ daysMin: ["dg", "dl", "dt", "dc", "dj", "dv", "ds"],
10
+ months: ["Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"],
11
+ monthsShort: ["Gen", "Feb", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Oct", "Nov", "Des"],
12
+ today: "Avui",
13
+ clear: "Esborrar",
14
+ weekStart: 1,
15
+ format: "dd/mm/yyyy"
16
+ };
17
+ }(jQuery));
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Spanish translation for foundation-datepicker
3
+ * Bruno Bonamin <bruno.bonamin@gmail.com>
4
+ */
5
+ ;(function($){
6
+ $.fn.fdatepicker.dates['es'] = {
7
+ days: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado", "Domingo"],
8
+ daysShort: ["Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb", "Dom"],
9
+ daysMin: ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa", "Do"],
10
+ months: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
11
+ monthsShort: ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"],
12
+ today: "Hoy"
13
+ };
14
+ }(jQuery));
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Basque translation for foundation-datepicker, language file from bootstrap-datepicker
3
+ * Arkaitz Etxeberria <kondi80@gmail.com>
4
+ */
5
+ ;(function($){
6
+ $.fn.fdatepicker.dates['eu'] = {
7
+ days: ['Igandea', 'Astelehena', 'Asteartea', 'Asteazkena', 'Osteguna', 'Ostirala', 'Larunbata'],
8
+ daysShort: ['Ig', 'Al', 'Ar', 'Az', 'Og', 'Ol', 'Lr'],
9
+ daysMin: ['Ig', 'Al', 'Ar', 'Az', 'Og', 'Ol', 'Lr'],
10
+ months: ['Urtarrila', 'Otsaila', 'Martxoa', 'Apirila', 'Maiatza', 'Ekaina', 'Uztaila', 'Abuztua', 'Iraila', 'Urria', 'Azaroa', 'Abendua'],
11
+ monthsShort: ['Urt', 'Ots', 'Mar', 'Api', 'Mai', 'Eka', 'Uzt', 'Abu', 'Ira', 'Urr', 'Aza', 'Abe'],
12
+ today: "Gaur"
13
+ };
14
+ }(jQuery));
15
+
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Finnish translation for foundation-datepicker
3
+ * Jaakko Salonen <https://github.com/jsalonen>
4
+ */
5
+ ;(function($){
6
+ $.fn.fdatepicker.dates['fi'] = {
7
+ days: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai", "sunnuntai"],
8
+ daysShort: ["sun", "maa", "tii", "kes", "tor", "per", "lau", "sun"],
9
+ daysMin: ["su", "ma", "ti", "ke", "to", "pe", "la", "su"],
10
+ months: ["tammikuu", "helmikuu", "maaliskuu", "huhtikuu", "toukokuu", "kesäkuu", "heinäkuu", "elokuu", "syyskuu", "lokakuu", "marraskuu", "joulukuu"],
11
+ monthsShort: ["tam", "hel", "maa", "huh", "tou", "kes", "hei", "elo", "syy", "lok", "mar", "jou"],
12
+ today: "tänään"
13
+ };
14
+ }(jQuery));
@@ -0,0 +1,14 @@
1
+ /**
2
+ * French translation for foundation-datepicker
3
+ * Nico Mollet <nico.mollet@gmail.com>
4
+ */
5
+ ;(function($){
6
+ $.fn.fdatepicker.dates['fr'] = {
7
+ days: ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"],
8
+ daysShort: ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam", "Dim"],
9
+ daysMin: ["D", "L", "Ma", "Me", "J", "V", "S", "D"],
10
+ months: ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"],
11
+ monthsShort: ["Jan", "Fev", "Mar", "Avr", "Mai", "Jui", "Jul", "Aou", "Sep", "Oct", "Nov", "Dec"],
12
+ today: "Aujourd'hui"
13
+ };
14
+ }(jQuery));
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Italian translation for foundation-datepicker
3
+ * Enrico Rubboli <rubboli@gmail.com>
4
+ */
5
+ ;(function($){
6
+ $.fn.fdatepicker.dates['it'] = {
7
+ days: ["Domenica", "Lunedi", "Martedi", "Mercoledi", "Giovedi", "Venerdi", "Sabato", "Domenica"],
8
+ daysShort: ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab", "Dom"],
9
+ daysMin: ["Do", "Lu", "Ma", "Me", "Gi", "Ve", "Sa", "Do"],
10
+ months: ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"],
11
+ monthsShort: ["Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic"],
12
+ today: "Oggi"
13
+ };
14
+ }(jQuery));
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Dutch translation for foundation-datepicker
3
+ * Reinier Goltstein <mrgoltstein@gmail.com>
4
+ */
5
+ ;(function($){
6
+ $.fn.fdatepicker.dates['nl'] = {
7
+ days: ["Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag", "Zondag"],
8
+ daysShort: ["Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za", "Zo"],
9
+ daysMin: ["Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za", "Zo"],
10
+ months: ["Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "Oktober", "November", "December"],
11
+ monthsShort: ["Jan", "Feb", "Mrt", "Apr", "Mei", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"],
12
+ today: "Vandaag"
13
+ };
14
+ }(jQuery));
@@ -0,0 +1,32 @@
1
+ ((exports) => {
2
+ const formDatePicker = () => {
3
+ $('[data-datepicker]').each((_index, node) => {
4
+ const language = $('html').attr('lang') || 'en';
5
+ const initialDate = $(node).data('startdate') || '';
6
+ const pickTime = $(node).data('timepicker') === '';
7
+ const languageProps = $(node).fdatepicker.dates[language] && $(node).fdatepicker.dates[language].format;
8
+ let format = languageProps || 'mm/dd/yyyy';
9
+
10
+ if (pickTime) {
11
+ format = `${format}, hh:ii`;
12
+ }
13
+
14
+ $(node).fdatepicker({
15
+ format,
16
+ initialDate,
17
+ language,
18
+ pickTime,
19
+ disableDblClickSelection: true,
20
+ leftArrow: '<<',
21
+ rightArrow: '>>'
22
+ }).on('changeDate', (ev) => {
23
+ let newDate = exports.moment.utc(ev.date).format('YYYY-MM-DDTHH:mm:ss');
24
+
25
+ $(ev.target).siblings('input').val(newDate);
26
+ });
27
+ });
28
+ };
29
+
30
+ exports.Decidim = exports.Decidim || {};
31
+ exports.Decidim.formDatePicker = formDatePicker;
32
+ })(window);
@@ -0,0 +1,1417 @@
1
+ /* =========================================================
2
+ * foundation-datepicker.js
3
+ * Copyright 2015 Peter Beno, najlepsiwebdesigner@gmail.com, @benopeter
4
+ * project website http://foundation-datepicker.peterbeno.com
5
+ * ========================================================= */
6
+ ! function($) {
7
+
8
+ function UTCDate() {
9
+ return new Date(Date.UTC.apply(Date, arguments));
10
+ }
11
+
12
+ function UTCToday() {
13
+ var today = new Date();
14
+ return UTCDate(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate());
15
+ }
16
+
17
+ var Datepicker = function(element, options) {
18
+ var that = this;
19
+
20
+ this.element = $(element);
21
+ this.autoShow = (options.autoShow == undefined ? true : options.autoShow);
22
+ this.appendTo = options.appendTo || 'body';
23
+ this.closeButton = options.closeButton;
24
+ this.language = options.language || this.element.data('date-language') || "en";
25
+ this.language = this.language in dates ? this.language : this.language.split('-')[0]; //Check if "de-DE" style date is available, if not language should fallback to 2 letter code eg "de"
26
+ this.language = this.language in dates ? this.language : "en";
27
+ this.isRTL = dates[this.language].rtl || false;
28
+ this.format = DPGlobal.parseFormat(options.format || this.element.data('date-format') || dates[this.language].format || 'mm/dd/yyyy');
29
+ this.formatText = options.format || this.element.data('date-format') || dates[this.language].format || 'mm/dd/yyyy';
30
+ this.isInline = false;
31
+ this.isInput = this.element.is('input');
32
+ this.component = this.element.is('.date') ? this.element.find('.prefix, .postfix') : false;
33
+ this.hasInput = this.component && this.element.find('input').length;
34
+ this.disableDblClickSelection = options.disableDblClickSelection;
35
+ this.onRender = options.onRender || function() {};
36
+ if (this.component && this.component.length === 0) {
37
+ this.component = false;
38
+ }
39
+ this.linkField = options.linkField || this.element.data('link-field') || false;
40
+ this.linkFormat = DPGlobal.parseFormat(options.linkFormat || this.element.data('link-format') || 'yyyy-mm-dd hh:ii:ss');
41
+ this.minuteStep = options.minuteStep || this.element.data('minute-step') || 5;
42
+ this.pickerPosition = options.pickerPosition || this.element.data('picker-position') || 'bottom-right';
43
+ this.initialDate = options.initialDate || null;
44
+ this.faCSSprefix = options.faCSSprefix || 'fa';
45
+ this.leftArrow = options.leftArrow || '<i class="' + this.faCSSprefix + ' ' + this.faCSSprefix + '-chevron-left fi-arrow-left"/>';
46
+ this.rightArrow = options.rightArrow || '<i class="' + this.faCSSprefix + ' ' + this.faCSSprefix + '-chevron-right fi-arrow-right"/>';
47
+ this.closeIcon = options.closeIcon || '<i class="' + this.faCSSprefix + ' ' + this.faCSSprefix + '-remove ' + this.faCSSprefix + '-times fi-x"></i>';
48
+
49
+
50
+
51
+ this.minView = 0;
52
+ if ('minView' in options) {
53
+ this.minView = options.minView;
54
+ } else if ('minView' in this.element.data()) {
55
+ this.minView = this.element.data('min-view');
56
+ }
57
+ this.minView = DPGlobal.convertViewMode(this.minView);
58
+
59
+ this.maxView = DPGlobal.modes.length - 1;
60
+ if ('maxView' in options) {
61
+ this.maxView = options.maxView;
62
+ } else if ('maxView' in this.element.data()) {
63
+ this.maxView = this.element.data('max-view');
64
+ }
65
+ this.maxView = DPGlobal.convertViewMode(this.maxView);
66
+
67
+ this.startViewMode = 'month';
68
+ if ('startView' in options) {
69
+ this.startViewMode = options.startView;
70
+ } else if ('startView' in this.element.data()) {
71
+ this.startViewMode = this.element.data('start-view');
72
+ }
73
+ this.startViewMode = DPGlobal.convertViewMode(this.startViewMode);
74
+ this.viewMode = this.startViewMode;
75
+
76
+ if (!('minView' in options) && !('maxView' in options) && !(this.element.data('min-view')) && !(this.element.data('max-view'))) {
77
+ this.pickTime = false;
78
+ if ('pickTime' in options) {
79
+ this.pickTime = options.pickTime;
80
+ }
81
+ if (this.pickTime == true) {
82
+ this.minView = 0;
83
+ this.maxView = 4;
84
+ } else {
85
+ this.minView = 2;
86
+ this.maxView = 4;
87
+ }
88
+ }
89
+
90
+ this.forceParse = true;
91
+ if ('forceParse' in options) {
92
+ this.forceParse = options.forceParse;
93
+ } else if ('dateForceParse' in this.element.data()) {
94
+ this.forceParse = this.element.data('date-force-parse');
95
+ }
96
+
97
+
98
+ this.picker = $(DPGlobal.template(this.leftArrow, this.rightArrow, this.closeIcon))
99
+ .appendTo(this.isInline ? this.element : this.appendTo)
100
+ .on({
101
+ click: $.proxy(this.click, this),
102
+ mousedown: $.proxy(this.mousedown, this)
103
+ });
104
+ if (this.closeButton) {
105
+ this.picker.find('a.datepicker-close').show();
106
+ } else {
107
+ this.picker.find('a.datepicker-close').hide();
108
+ }
109
+
110
+ if (this.isInline) {
111
+ this.picker.addClass('datepicker-inline');
112
+ } else {
113
+ this.picker.addClass('datepicker-dropdown dropdown-menu');
114
+ }
115
+ if (this.isRTL) {
116
+ this.picker.addClass('datepicker-rtl');
117
+
118
+ this.picker.find('.date-switch').each(function(){
119
+ $(this).parent().prepend($(this).siblings('.next'));
120
+ $(this).parent().append($(this).siblings('.prev'));
121
+ })
122
+ this.picker.find('.prev, .next').toggleClass('prev next');
123
+
124
+ }
125
+ $(document).on('mousedown', function(e) {
126
+ if (that.isInput && e.target === that.element[0]) {
127
+ return;
128
+ }
129
+
130
+ // Clicked outside the datepicker, hide it
131
+ if ($(e.target).closest('.datepicker.datepicker-inline, .datepicker.datepicker-dropdown').length === 0) {
132
+ that.hide();
133
+ }
134
+ });
135
+
136
+ this.autoclose = true;
137
+ if ('autoclose' in options) {
138
+ this.autoclose = options.autoclose;
139
+ } else if ('dateAutoclose' in this.element.data()) {
140
+ this.autoclose = this.element.data('date-autoclose');
141
+ }
142
+
143
+ this.keyboardNavigation = true;
144
+ if ('keyboardNavigation' in options) {
145
+ this.keyboardNavigation = options.keyboardNavigation;
146
+ } else if ('dateKeyboardNavigation' in this.element.data()) {
147
+ this.keyboardNavigation = this.element.data('date-keyboard-navigation');
148
+ }
149
+
150
+ this.todayBtn = (options.todayBtn || this.element.data('date-today-btn') || false);
151
+ this.todayHighlight = (options.todayHighlight || this.element.data('date-today-highlight') || false);
152
+
153
+ this.calendarWeeks = false;
154
+ if ('calendarWeeks' in options) {
155
+ this.calendarWeeks = options.calendarWeeks;
156
+ } else if ('dateCalendarWeeks' in this.element.data()) {
157
+ this.calendarWeeks = this.element.data('date-calendar-weeks');
158
+ }
159
+ if (this.calendarWeeks)
160
+ this.picker.find('tfoot th.today')
161
+ .attr('colspan', function(i, val) {
162
+ return parseInt(val) + 1;
163
+ });
164
+
165
+ this.weekStart = ((options.weekStart || this.element.data('date-weekstart') || dates[this.language].weekStart || 0) % 7);
166
+ this.weekEnd = ((this.weekStart + 6) % 7);
167
+ this.startDate = -Infinity;
168
+ this.endDate = Infinity;
169
+ this.daysOfWeekDisabled = [];
170
+ this.datesDisabled = [];
171
+ this.setStartDate(options.startDate || this.element.data('date-startdate'));
172
+ this.setEndDate(options.endDate || this.element.data('date-enddate'));
173
+ this.setDaysOfWeekDisabled(options.daysOfWeekDisabled || this.element.data('date-days-of-week-disabled'));
174
+ this.setDatesDisabled(options.datesDisabled || this.element.data('dates-disabled'));
175
+
176
+ this.fillDow();
177
+ this.fillMonths();
178
+ this.update();
179
+
180
+ this.showMode();
181
+
182
+ if (this.isInline) {
183
+ this.show();
184
+ }
185
+
186
+ this._attachEvents();
187
+ };
188
+
189
+ Datepicker.prototype = {
190
+ constructor: Datepicker,
191
+
192
+ _events: [],
193
+ _attachEvents: function() {
194
+ this._detachEvents();
195
+ if (this.isInput) { // single input
196
+ if (!this.keyboardNavigation) {
197
+ this._events = [
198
+ [this.element, {
199
+ focus: (this.autoShow) ? $.proxy(this.show, this) : function() {}
200
+ }]
201
+ ];
202
+ } else {
203
+ this._events = [
204
+ [this.element, {
205
+ focus: (this.autoShow) ? $.proxy(this.show, this) : function() {},
206
+ keyup: $.proxy(this.update, this),
207
+ keydown: $.proxy(this.keydown, this),
208
+ click: (this.element.attr('readonly')) ? $.proxy(this.show, this) : function() {}
209
+ }]
210
+ ];
211
+ }
212
+ }
213
+ else if (this.component && this.hasInput) { // component: input + button
214
+ this._events = [
215
+ // For components that are not readonly, allow keyboard nav
216
+ [this.element.find('input'), {
217
+ focus: (this.autoShow) ? $.proxy(this.show, this) : function() {},
218
+ keyup: $.proxy(this.update, this),
219
+ keydown: $.proxy(this.keydown, this)
220
+ }],
221
+ [this.component, {
222
+ click: $.proxy(this.show, this)
223
+ }]
224
+ ];
225
+ } else if (this.element.is('div')) { // inline datepicker
226
+ this.isInline = true;
227
+ } else {
228
+ this._events = [
229
+ [this.element, {
230
+ click: $.proxy(this.show, this)
231
+ }]
232
+ ];
233
+ }
234
+
235
+ if (this.disableDblClickSelection) {
236
+ this._events[this._events.length] = [
237
+ this.element, {
238
+ dblclick: function(e) {
239
+ e.preventDefault();
240
+ e.stopPropagation();
241
+ $(this).blur()
242
+ }
243
+ }
244
+ ];
245
+ }
246
+
247
+ for (var i = 0, el, ev; i < this._events.length; i++) {
248
+ el = this._events[i][0];
249
+ ev = this._events[i][1];
250
+ el.on(ev);
251
+ }
252
+ },
253
+ _detachEvents: function() {
254
+ for (var i = 0, el, ev; i < this._events.length; i++) {
255
+ el = this._events[i][0];
256
+ ev = this._events[i][1];
257
+ el.off(ev);
258
+ }
259
+ this._events = [];
260
+ },
261
+
262
+ show: function(e) {
263
+ this.picker.show();
264
+ this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();
265
+ this.update();
266
+ this.place();
267
+ $(window).on('resize', $.proxy(this.place, this));
268
+ if (e) {
269
+ e.stopPropagation();
270
+ e.preventDefault();
271
+ }
272
+ this.element.trigger({
273
+ type: 'show',
274
+ date: this.date
275
+ });
276
+ },
277
+
278
+ hide: function(e) {
279
+ if (this.isInline) return;
280
+ if (!this.picker.is(':visible')) return;
281
+ this.picker.hide();
282
+ $(window).off('resize', this.place);
283
+ this.viewMode = this.startViewMode;
284
+ this.showMode();
285
+ if (!this.isInput) {
286
+ $(document).off('mousedown', this.hide);
287
+ }
288
+
289
+ if (
290
+ this.forceParse &&
291
+ (
292
+ this.isInput && this.element.val() ||
293
+ this.hasInput && this.element.find('input').val()
294
+ )
295
+ )
296
+ this.setValue();
297
+ this.element.trigger({
298
+ type: 'hide',
299
+ date: this.date
300
+ });
301
+ },
302
+
303
+ remove: function() {
304
+ this._detachEvents();
305
+ this.picker.remove();
306
+ delete this.element.data().datepicker;
307
+ },
308
+
309
+ getDate: function() {
310
+ var d = this.getUTCDate();
311
+ return new Date(d.getTime() + (d.getTimezoneOffset() * 60000));
312
+ },
313
+
314
+ getUTCDate: function() {
315
+ return this.date;
316
+ },
317
+
318
+ setDate: function(d) {
319
+ this.setUTCDate(new Date(d.getTime() - (d.getTimezoneOffset() * 60000)));
320
+ },
321
+
322
+ setUTCDate: function(d) {
323
+ this.date = d;
324
+ this.setValue();
325
+ },
326
+
327
+ setValue: function() {
328
+ var formatted = this.getFormattedDate();
329
+ if (!this.isInput) {
330
+ if (this.component) {
331
+ this.element.find('input').val(formatted);
332
+ }
333
+ this.element.data('date', formatted);
334
+ } else {
335
+ this.element.val(formatted);
336
+ }
337
+ },
338
+
339
+ getFormattedDate: function(format) {
340
+ if (format === undefined)
341
+ format = this.format;
342
+ return DPGlobal.formatDate(this.date, format, this.language);
343
+ },
344
+
345
+ setStartDate: function(startDate) {
346
+ this.startDate = startDate || -Infinity;
347
+ if (this.startDate !== -Infinity) {
348
+ this.startDate = DPGlobal.parseDate(this.startDate, this.format, this.language);
349
+ }
350
+ this.update();
351
+ this.updateNavArrows();
352
+ },
353
+
354
+ setEndDate: function(endDate) {
355
+ this.endDate = endDate || Infinity;
356
+ if (this.endDate !== Infinity) {
357
+ this.endDate = DPGlobal.parseDate(this.endDate, this.format, this.language);
358
+ }
359
+ this.update();
360
+ this.updateNavArrows();
361
+ },
362
+
363
+ setDaysOfWeekDisabled: function(daysOfWeekDisabled) {
364
+ this.daysOfWeekDisabled = daysOfWeekDisabled || [];
365
+ if (!$.isArray(this.daysOfWeekDisabled)) {
366
+ this.daysOfWeekDisabled = this.daysOfWeekDisabled.split(/,\s*/);
367
+ }
368
+ this.daysOfWeekDisabled = $.map(this.daysOfWeekDisabled, function(d) {
369
+ return parseInt(d, 10);
370
+ });
371
+ this.update();
372
+ this.updateNavArrows();
373
+ },
374
+
375
+ setDatesDisabled: function(datesDisabled) {
376
+ this.datesDisabled = datesDisabled || [];
377
+ if (!$.isArray(this.datesDisabled)) {
378
+ this.datesDisabled = this.datesDisabled.split(/,\s*/);
379
+ }
380
+ this.datesDisabled = $.map(this.datesDisabled, function(d) {
381
+ return DPGlobal.parseDate(d, this.format, this.language).valueOf();
382
+ });
383
+ this.update();
384
+ this.updateNavArrows();
385
+ },
386
+
387
+ place: function() {
388
+ if (this.isInline) return;
389
+ var zIndex = parseInt(this.element.parents().filter(function() {
390
+ return $(this).css('z-index') != 'auto';
391
+ }).first().css('z-index')) + 10;
392
+ var textbox = this.component ? this.component : this.element;
393
+ var offset = textbox.offset();
394
+ var height = textbox.outerHeight() + parseInt(textbox.css('margin-top'));
395
+ var width = textbox.outerWidth() + parseInt(textbox.css('margin-left'));
396
+ var fullOffsetTop = offset.top + height;
397
+ var offsetLeft = offset.left;
398
+ this.picker.removeClass('datepicker-top datepicker-bottom');
399
+ // if the datepicker is going to be below the window, show it on top of the input
400
+ if ((fullOffsetTop + this.picker.outerHeight()) >= $(window).scrollTop() + $(window).height()) {
401
+ fullOffsetTop = offset.top - this.picker.outerHeight();
402
+ this.picker.addClass('datepicker-top');
403
+ }
404
+ else {
405
+ this.picker.addClass('datepicker-bottom');
406
+ }
407
+
408
+ // if the datepicker is going to go past the right side of the window, we want
409
+ // to set the right position so the datepicker lines up with the textbox
410
+ if (offset.left + this.picker.width() >= $(window).width()) {
411
+ offsetLeft = (offset.left + width) - this.picker.width();
412
+ }
413
+ this.picker.css({
414
+ top: fullOffsetTop,
415
+ left: offsetLeft,
416
+ zIndex: zIndex
417
+ });
418
+ },
419
+
420
+ update: function() {
421
+ var date, fromArgs = false;
422
+ var currentVal = this.isInput ? this.element.val() : this.element.data('date') || this.element.find('input').val();
423
+ if (arguments && arguments.length && (typeof arguments[0] === 'string' || arguments[0] instanceof Date)) {
424
+ date = arguments[0];
425
+ fromArgs = true;
426
+ }
427
+ else if (!currentVal && this.initialDate != null) { // If value is not set, set it to the initialDate
428
+ date = this.initialDate
429
+ }
430
+ else {
431
+ date = this.isInput ? this.element.val() : this.element.data('date') || this.element.find('input').val();
432
+ }
433
+
434
+ if (date && date.length > this.formatText.length) {
435
+ $(this.picker).addClass('is-invalid')
436
+ $(this.element).addClass('is-invalid-input')
437
+ return;
438
+ } else {
439
+ $(this.picker).removeClass('is-invalid')
440
+ $(this.element).removeClass('is-invalid-input')
441
+
442
+ }
443
+
444
+ this.date = DPGlobal.parseDate(date, this.format, this.language);
445
+
446
+ if (fromArgs || this.initialDate != null) this.setValue();
447
+
448
+ if (this.date < this.startDate) {
449
+ this.viewDate = new Date(this.startDate.valueOf());
450
+ } else if (this.date > this.endDate) {
451
+ this.viewDate = new Date(this.endDate.valueOf());
452
+ } else {
453
+ this.viewDate = new Date(this.date.valueOf());
454
+ }
455
+ this.fill();
456
+ },
457
+
458
+ fillDow: function() {
459
+ var dowCnt = this.weekStart,
460
+ html = '<tr>';
461
+ if (this.calendarWeeks) {
462
+ var cell = '<th class="cw">&nbsp;</th>';
463
+ html += cell;
464
+ this.picker.find('.datepicker-days thead tr:first-child').prepend(cell);
465
+ }
466
+ while (dowCnt < this.weekStart + 7) {
467
+ html += '<th class="dow">' + dates[this.language].daysMin[(dowCnt++) % 7] + '</th>';
468
+ }
469
+ html += '</tr>';
470
+ this.picker.find('.datepicker-days thead').append(html);
471
+ },
472
+
473
+ fillMonths: function() {
474
+ var html = '',
475
+ i = 0;
476
+ while (i < 12) {
477
+ html += '<span class="month">' + dates[this.language].monthsShort[i++] + '</span>';
478
+ }
479
+ this.picker.find('.datepicker-months td').html(html);
480
+ },
481
+
482
+ fill: function() {
483
+ if (this.date == null || this.viewDate == null) {
484
+ return;
485
+ }
486
+
487
+ var d = new Date(this.viewDate.valueOf()),
488
+ year = d.getUTCFullYear(),
489
+ month = d.getUTCMonth(),
490
+ dayMonth = d.getUTCDate(),
491
+ hours = d.getUTCHours(),
492
+ minutes = d.getUTCMinutes(),
493
+ startYear = this.startDate !== -Infinity ? this.startDate.getUTCFullYear() : -Infinity,
494
+ startMonth = this.startDate !== -Infinity ? this.startDate.getUTCMonth() : -Infinity,
495
+ endYear = this.endDate !== Infinity ? this.endDate.getUTCFullYear() : Infinity,
496
+ endMonth = this.endDate !== Infinity ? this.endDate.getUTCMonth() : Infinity,
497
+ currentDate = this.date && UTCDate(this.date.getUTCFullYear(), this.date.getUTCMonth(), this.date.getUTCDate()).valueOf(),
498
+ today = new Date(),
499
+ titleFormat = dates[this.language].titleFormat || dates['en'].titleFormat;
500
+ // this.picker.find('.datepicker-days thead th.date-switch')
501
+ // .text(DPGlobal.formatDate(new UTCDate(year, month), titleFormat, this.language));
502
+
503
+ this.picker.find('.datepicker-days thead th:eq(1)')
504
+ .text(dates[this.language].months[month] + ' ' + year);
505
+ this.picker.find('.datepicker-hours thead th:eq(1)')
506
+ .text(dayMonth + ' ' + dates[this.language].months[month] + ' ' + year);
507
+ this.picker.find('.datepicker-minutes thead th:eq(1)')
508
+ .text(dayMonth + ' ' + dates[this.language].months[month] + ' ' + year);
509
+
510
+
511
+ this.picker.find('tfoot th.today')
512
+ .text(dates[this.language].today)
513
+ .toggle(this.todayBtn !== false);
514
+ this.updateNavArrows();
515
+ this.fillMonths();
516
+ var prevMonth = UTCDate(year, month - 1, 28, 0, 0, 0, 0),
517
+ day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
518
+ prevMonth.setUTCDate(day);
519
+ prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7) % 7);
520
+ var nextMonth = new Date(prevMonth.valueOf());
521
+ nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
522
+ nextMonth = nextMonth.valueOf();
523
+ var html = [];
524
+ var clsName;
525
+ while (prevMonth.valueOf() < nextMonth) {
526
+ if (prevMonth.getUTCDay() == this.weekStart) {
527
+ html.push('<tr>');
528
+ if (this.calendarWeeks) {
529
+ // adapted from https://github.com/timrwood/moment/blob/master/moment.js#L128
530
+ var a = new Date(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth(), prevMonth.getUTCDate() - prevMonth.getDay() + 10 - (this.weekStart && this.weekStart % 7 < 5 && 7)),
531
+ b = new Date(a.getFullYear(), 0, 4),
532
+ calWeek = ~~((a - b) / 864e5 / 7 + 1.5);
533
+ html.push('<td class="cw">' + calWeek + '</td>');
534
+ }
535
+ }
536
+ clsName = ' ' + this.onRender(prevMonth) + ' ';
537
+ if (prevMonth.getUTCFullYear() < year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() < month)) {
538
+ clsName += ' old';
539
+ } else if (prevMonth.getUTCFullYear() > year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() > month)) {
540
+ clsName += ' new';
541
+ }
542
+ // Compare internal UTC date with local today, not UTC today
543
+ if (this.todayHighlight &&
544
+ prevMonth.getUTCFullYear() == today.getFullYear() &&
545
+ prevMonth.getUTCMonth() == today.getMonth() &&
546
+ prevMonth.getUTCDate() == today.getDate()) {
547
+ clsName += ' today';
548
+ }
549
+ if (currentDate && prevMonth.valueOf() == currentDate) {
550
+ clsName += ' active';
551
+ }
552
+ if (prevMonth.valueOf() < this.startDate || prevMonth.valueOf() > this.endDate ||
553
+ $.inArray(prevMonth.getUTCDay(), this.daysOfWeekDisabled) !== -1 ||
554
+ $.inArray(prevMonth.valueOf(), this.datesDisabled) !== -1) {
555
+ clsName += ' disabled';
556
+ }
557
+ html.push('<td class="day' + clsName + '">' + prevMonth.getUTCDate() + '</td>');
558
+ if (prevMonth.getUTCDay() == this.weekEnd) {
559
+ html.push('</tr>');
560
+ }
561
+ prevMonth.setUTCDate(prevMonth.getUTCDate() + 1);
562
+ }
563
+ this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
564
+
565
+ html = [];
566
+ for (var i = 0; i < 24; i++) {
567
+ var actual = UTCDate(year, month, dayMonth, i);
568
+ clsName = '';
569
+ // We want the previous hour for the startDate
570
+ if ((actual.valueOf() + 3600000) < this.startDate || actual.valueOf() > this.endDate) {
571
+ clsName += ' disabled';
572
+ } else if (hours == i) {
573
+ clsName += ' active';
574
+ }
575
+ html.push('<span class="hour' + clsName + '">' + i + ':00</span>');
576
+ }
577
+ this.picker.find('.datepicker-hours td').html(html.join(''));
578
+
579
+ html = [];
580
+ for (var i = 0; i < 60; i += this.minuteStep) {
581
+ var actual = UTCDate(year, month, dayMonth, hours, i);
582
+ clsName = '';
583
+ if (actual.valueOf() < this.startDate || actual.valueOf() > this.endDate) {
584
+ clsName += ' disabled';
585
+ } else if (Math.floor(minutes / this.minuteStep) == Math.floor(i / this.minuteStep)) {
586
+ clsName += ' active';
587
+ }
588
+ html.push('<span class="minute' + clsName + '">' + hours + ':' + (i < 10 ? '0' + i : i) + '</span>');
589
+ }
590
+ this.picker.find('.datepicker-minutes td').html(html.join(''));
591
+
592
+
593
+ var currentYear = this.date && this.date.getUTCFullYear();
594
+ var months = this.picker.find('.datepicker-months')
595
+ .find('th:eq(1)')
596
+ .text(year)
597
+ .end()
598
+ .find('span').removeClass('active');
599
+ if (currentYear && currentYear == year) {
600
+ months.eq(this.date.getUTCMonth()).addClass('active');
601
+ }
602
+ if (year < startYear || year > endYear) {
603
+ months.addClass('disabled');
604
+ }
605
+ if (year == startYear) {
606
+ months.slice(0, startMonth).addClass('disabled');
607
+ }
608
+ if (year == endYear) {
609
+ months.slice(endMonth + 1).addClass('disabled');
610
+ }
611
+
612
+ html = '';
613
+ year = parseInt(year / 10, 10) * 10;
614
+ var yearCont = this.picker.find('.datepicker-years')
615
+ .find('th:eq(1)')
616
+ .text(year + '-' + (year + 9))
617
+ .end()
618
+ .find('td');
619
+ year -= 1;
620
+ for (var i = -1; i < 11; i++) {
621
+ html += '<span class="year' + (i == -1 || i == 10 ? ' old' : '') + (currentYear == year ? ' active' : '') + (year < startYear || year > endYear ? ' disabled' : '') + '">' + year + '</span>';
622
+ year += 1;
623
+ }
624
+ yearCont.html(html);
625
+ },
626
+
627
+ updateNavArrows: function() {
628
+ var d = new Date(this.viewDate),
629
+ year = d.getUTCFullYear(),
630
+ month = d.getUTCMonth(),
631
+ day = d.getUTCDate(),
632
+ hour = d.getUTCHours();
633
+ switch (this.viewMode) {
634
+ case 0:
635
+ if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear() && month <= this.startDate.getUTCMonth() && day <= this.startDate.getUTCDate() && hour <= this.startDate.getUTCHours()) {
636
+ this.picker.find('.prev').css({
637
+ visibility: 'hidden'
638
+ });
639
+ } else {
640
+ this.picker.find('.prev').css({
641
+ visibility: 'visible'
642
+ });
643
+ }
644
+ if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear() && month >= this.endDate.getUTCMonth() && day >= this.endDate.getUTCDate() && hour >= this.endDate.getUTCHours()) {
645
+ this.picker.find('.next').css({
646
+ visibility: 'hidden'
647
+ });
648
+ } else {
649
+ this.picker.find('.next').css({
650
+ visibility: 'visible'
651
+ });
652
+ }
653
+ break;
654
+ case 1:
655
+ if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear() && month <= this.startDate.getUTCMonth() && day <= this.startDate.getUTCDate()) {
656
+ this.picker.find('.prev').css({
657
+ visibility: 'hidden'
658
+ });
659
+ } else {
660
+ this.picker.find('.prev').css({
661
+ visibility: 'visible'
662
+ });
663
+ }
664
+ if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear() && month >= this.endDate.getUTCMonth() && day >= this.endDate.getUTCDate()) {
665
+ this.picker.find('.next').css({
666
+ visibility: 'hidden'
667
+ });
668
+ } else {
669
+ this.picker.find('.next').css({
670
+ visibility: 'visible'
671
+ });
672
+ }
673
+ break;
674
+ case 2:
675
+ if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear() && month <= this.startDate.getUTCMonth()) {
676
+ this.picker.find('.prev').css({
677
+ visibility: 'hidden'
678
+ });
679
+ } else {
680
+ this.picker.find('.prev').css({
681
+ visibility: 'visible'
682
+ });
683
+ }
684
+ if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear() && month >= this.endDate.getUTCMonth()) {
685
+ this.picker.find('.next').css({
686
+ visibility: 'hidden'
687
+ });
688
+ } else {
689
+ this.picker.find('.next').css({
690
+ visibility: 'visible'
691
+ });
692
+ }
693
+ break;
694
+ case 3:
695
+ case 4:
696
+ if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear()) {
697
+ this.picker.find('.prev').css({
698
+ visibility: 'hidden'
699
+ });
700
+ } else {
701
+ this.picker.find('.prev').css({
702
+ visibility: 'visible'
703
+ });
704
+ }
705
+ if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()) {
706
+ this.picker.find('.next').css({
707
+ visibility: 'hidden'
708
+ });
709
+ } else {
710
+ this.picker.find('.next').css({
711
+ visibility: 'visible'
712
+ });
713
+ }
714
+ break;
715
+ }
716
+ },
717
+
718
+ click: function(e) {
719
+ e.stopPropagation();
720
+ e.preventDefault();
721
+
722
+ if ($(e.target).hasClass('datepicker-close') || $(e.target).parent().hasClass('datepicker-close')) {
723
+ this.hide();
724
+ }
725
+
726
+ var target = $(e.target).closest('span, td, th');
727
+ if (target.length == 1) {
728
+ if (target.is('.disabled')) {
729
+ this.element.trigger({
730
+ type: 'outOfRange',
731
+ date: this.viewDate,
732
+ startDate: this.startDate,
733
+ endDate: this.endDate
734
+ });
735
+ return;
736
+ }
737
+
738
+ switch (target[0].nodeName.toLowerCase()) {
739
+ case 'th':
740
+ switch (target[0].className) {
741
+ case 'date-switch':
742
+ this.showMode(1);
743
+ break;
744
+ case 'prev':
745
+ case 'next':
746
+ var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className == 'prev' ? -1 : 1);
747
+ switch (this.viewMode) {
748
+ case 0:
749
+ this.viewDate = this.moveHour(this.viewDate, dir);
750
+ break;
751
+ case 1:
752
+ this.viewDate = this.moveDate(this.viewDate, dir);
753
+ break;
754
+ case 2:
755
+ this.viewDate = this.moveMonth(this.viewDate, dir);
756
+ break;
757
+ case 3:
758
+ case 4:
759
+ this.viewDate = this.moveYear(this.viewDate, dir);
760
+ break;
761
+ }
762
+ this.fill();
763
+ break;
764
+ case 'today':
765
+ var date = new Date();
766
+ date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds());
767
+
768
+ this.viewMode = this.startViewMode;
769
+ this.showMode(0);
770
+ this._setDate(date);
771
+ break;
772
+ }
773
+ break;
774
+ case 'span':
775
+ if (!target.is('.disabled')) {
776
+ if (target.is('.month')) {
777
+ if (this.minView === 3) {
778
+ var month = target.parent().find('span').index(target) || 0;
779
+ var year = this.viewDate.getUTCFullYear(),
780
+ day = 1,
781
+ hours = this.viewDate.getUTCHours(),
782
+ minutes = this.viewDate.getUTCMinutes(),
783
+ seconds = this.viewDate.getUTCSeconds();
784
+ this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));
785
+ } else {
786
+ this.viewDate.setUTCDate(1);
787
+ var month = target.parent().find('span').index(target);
788
+ this.viewDate.setUTCMonth(month);
789
+ this.element.trigger({
790
+ type: 'changeMonth',
791
+ date: this.viewDate
792
+ });
793
+ }
794
+ } else if (target.is('.year')) {
795
+ if (this.minView === 4) {
796
+ var year = parseInt(target.text(), 10) || 0;
797
+ var month = 0,
798
+ day = 1,
799
+ hours = this.viewDate.getUTCHours(),
800
+ minutes = this.viewDate.getUTCMinutes(),
801
+ seconds = this.viewDate.getUTCSeconds();
802
+ this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));
803
+ } else {
804
+ this.viewDate.setUTCDate(1);
805
+ var year = parseInt(target.text(), 10) || 0;
806
+ this.viewDate.setUTCFullYear(year);
807
+ this.element.trigger({
808
+ type: 'changeYear',
809
+ date: this.viewDate
810
+ });
811
+ }
812
+ } else if (target.is('.hour')) {
813
+ var hours = parseInt(target.text(), 10) || 0;
814
+ var year = this.viewDate.getUTCFullYear(),
815
+ month = this.viewDate.getUTCMonth(),
816
+ day = this.viewDate.getUTCDate(),
817
+ minutes = this.viewDate.getUTCMinutes(),
818
+ seconds = this.viewDate.getUTCSeconds();
819
+ this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));
820
+ } else if (target.is('.minute')) {
821
+ var minutes = parseInt(target.text().substr(target.text().indexOf(':') + 1), 10) || 0;
822
+ var year = this.viewDate.getUTCFullYear(),
823
+ month = this.viewDate.getUTCMonth(),
824
+ day = this.viewDate.getUTCDate(),
825
+ hours = this.viewDate.getUTCHours(),
826
+ seconds = this.viewDate.getUTCSeconds();
827
+ this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));
828
+ }
829
+
830
+
831
+
832
+ if (this.viewMode != 0) {
833
+
834
+
835
+
836
+ var oldViewMode = this.viewMode;
837
+ this.showMode(-1);
838
+ this.fill();
839
+ if (oldViewMode == this.viewMode && this.autoclose) {
840
+ this.hide();
841
+ }
842
+ } else {
843
+ this.fill();
844
+ if (this.autoclose) {
845
+ this.hide();
846
+ }
847
+ }
848
+ }
849
+ break;
850
+ case 'td':
851
+
852
+
853
+
854
+ if (target.is('.day') && !target.is('.disabled')) {
855
+ var day = parseInt(target.text(), 10) || 1;
856
+ var year = this.viewDate.getUTCFullYear(),
857
+ month = this.viewDate.getUTCMonth(),
858
+ hours = this.viewDate.getUTCHours(),
859
+ minutes = this.viewDate.getUTCMinutes(),
860
+ seconds = this.viewDate.getUTCSeconds();
861
+ if (target.is('.old')) {
862
+ if (month === 0) {
863
+ month = 11;
864
+ year -= 1;
865
+ } else {
866
+ month -= 1;
867
+ }
868
+ } else if (target.is('.new')) {
869
+ if (month == 11) {
870
+ month = 0;
871
+ year += 1;
872
+ } else {
873
+ month += 1;
874
+ }
875
+ }
876
+ this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));
877
+ }
878
+
879
+
880
+
881
+ var oldViewMode = this.viewMode;
882
+
883
+
884
+ this.showMode(-1);
885
+
886
+
887
+ this.fill();
888
+ if (oldViewMode == this.viewMode && this.autoclose) {
889
+ this.hide();
890
+ }
891
+ break;
892
+ }
893
+ }
894
+ },
895
+
896
+ _setDate: function(date, which) {
897
+
898
+ if (!which || which == 'date')
899
+ this.date = date;
900
+ if (!which || which == 'view')
901
+ this.viewDate = date;
902
+ this.fill();
903
+ this.setValue();
904
+ this.element.trigger({
905
+ type: 'changeDate',
906
+ date: this.date
907
+ });
908
+ var element;
909
+ if (this.isInput) {
910
+ element = this.element;
911
+ } else if (this.component) {
912
+ element = this.element.find('input');
913
+ }
914
+ if (element) {
915
+ element.change();
916
+ if (this.autoclose && (!which || which == 'date')) {
917
+ // this.hide();
918
+ }
919
+ }
920
+ },
921
+
922
+ moveHour: function(date, dir) {
923
+ if (!dir) return date;
924
+ var new_date = new Date(date.valueOf());
925
+ dir = dir > 0 ? 1 : -1;
926
+ new_date.setUTCHours(new_date.getUTCHours() + dir);
927
+ return new_date;
928
+ },
929
+
930
+ moveDate: function(date, dir) {
931
+ if (!dir) return date;
932
+ var new_date = new Date(date.valueOf());
933
+ dir = dir > 0 ? 1 : -1;
934
+ new_date.setUTCDate(new_date.getUTCDate() + dir);
935
+ return new_date;
936
+ },
937
+
938
+ moveMonth: function(date, dir) {
939
+ if (!dir) return date;
940
+ var new_date = new Date(date.valueOf()),
941
+ day = new_date.getUTCDate(),
942
+ month = new_date.getUTCMonth(),
943
+ mag = Math.abs(dir),
944
+ new_month, test;
945
+ dir = dir > 0 ? 1 : -1;
946
+ if (mag == 1) {
947
+ test = dir == -1
948
+ // If going back one month, make sure month is not current month
949
+ // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
950
+ ? function() {
951
+ return new_date.getUTCMonth() == month;
952
+ }
953
+ // If going forward one month, make sure month is as expected
954
+ // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
955
+ : function() {
956
+ return new_date.getUTCMonth() != new_month;
957
+ };
958
+ new_month = month + dir;
959
+ new_date.setUTCMonth(new_month);
960
+ // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
961
+ if (new_month < 0 || new_month > 11)
962
+ new_month = (new_month + 12) % 12;
963
+ } else {
964
+ // For magnitudes >1, move one month at a time...
965
+ for (var i = 0; i < mag; i++)
966
+ // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
967
+ new_date = this.moveMonth(new_date, dir);
968
+ // ...then reset the day, keeping it in the new month
969
+ new_month = new_date.getUTCMonth();
970
+ new_date.setUTCDate(day);
971
+ test = function() {
972
+ return new_month != new_date.getUTCMonth();
973
+ };
974
+ }
975
+ // Common date-resetting loop -- if date is beyond end of month, make it
976
+ // end of month
977
+ while (test()) {
978
+ new_date.setUTCDate(--day);
979
+ new_date.setUTCMonth(new_month);
980
+ }
981
+ return new_date;
982
+ },
983
+
984
+ moveYear: function(date, dir) {
985
+ return this.moveMonth(date, dir * 12);
986
+ },
987
+
988
+ dateWithinRange: function(date) {
989
+ return date >= this.startDate && date <= this.endDate;
990
+ },
991
+
992
+ keydown: function(e) {
993
+ if (!this.keyboardNavigation) {
994
+ return true;
995
+ }
996
+ if (this.picker.is(':not(:visible)')) {
997
+ if (e.keyCode == 27) // allow escape to hide and re-show picker
998
+ this.show();
999
+ return;
1000
+ }
1001
+ var dateChanged = false,
1002
+ dir, day, month,
1003
+ newDate, newViewDate;
1004
+ switch (e.keyCode) {
1005
+ case 27: // escape
1006
+ this.hide();
1007
+ e.preventDefault();
1008
+ break;
1009
+ case 37: // left
1010
+ case 39: // right
1011
+ if (!this.keyboardNavigation) break;
1012
+ dir = e.keyCode == 37 ? -1 : 1;
1013
+ if (e.ctrlKey) {
1014
+ newDate = this.moveYear(this.date, dir);
1015
+ newViewDate = this.moveYear(this.viewDate, dir);
1016
+ } else if (e.shiftKey) {
1017
+ newDate = this.moveMonth(this.date, dir);
1018
+ newViewDate = this.moveMonth(this.viewDate, dir);
1019
+ } else {
1020
+ newDate = new Date(this.date.valueOf());
1021
+ newDate.setUTCDate(this.date.getUTCDate() + dir);
1022
+ newViewDate = new Date(this.viewDate.valueOf());
1023
+ newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir);
1024
+ }
1025
+ if (this.dateWithinRange(newDate)) {
1026
+ this.date = newDate;
1027
+ this.viewDate = newViewDate;
1028
+ this.setValue();
1029
+ this.update();
1030
+ e.preventDefault();
1031
+ dateChanged = true;
1032
+ }
1033
+ break;
1034
+ case 38: // up
1035
+ case 40: // down
1036
+ if (!this.keyboardNavigation) break;
1037
+ dir = e.keyCode == 38 ? -1 : 1;
1038
+ if (e.ctrlKey) {
1039
+ newDate = this.moveYear(this.date, dir);
1040
+ newViewDate = this.moveYear(this.viewDate, dir);
1041
+ } else if (e.shiftKey) {
1042
+ newDate = this.moveMonth(this.date, dir);
1043
+ newViewDate = this.moveMonth(this.viewDate, dir);
1044
+ } else {
1045
+ newDate = new Date(this.date.valueOf());
1046
+ newDate.setUTCDate(this.date.getUTCDate() + dir * 7);
1047
+ newViewDate = new Date(this.viewDate.valueOf());
1048
+ newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir * 7);
1049
+ }
1050
+ if (this.dateWithinRange(newDate)) {
1051
+ this.date = newDate;
1052
+ this.viewDate = newViewDate;
1053
+ this.setValue();
1054
+ this.update();
1055
+ e.preventDefault();
1056
+ dateChanged = true;
1057
+ }
1058
+ break;
1059
+ case 13: // enter
1060
+ this.hide();
1061
+ e.preventDefault();
1062
+ break;
1063
+ case 9: // tab
1064
+ this.hide();
1065
+ break;
1066
+ }
1067
+ if (dateChanged) {
1068
+ this.element.trigger({
1069
+ type: 'changeDate',
1070
+ date: this.date
1071
+ });
1072
+ var element;
1073
+ if (this.isInput) {
1074
+ element = this.element;
1075
+ } else if (this.component) {
1076
+ element = this.element.find('input');
1077
+ }
1078
+ if (element) {
1079
+ element.change();
1080
+ }
1081
+ }
1082
+ },
1083
+
1084
+ showMode: function(dir) {
1085
+
1086
+ if (dir) {
1087
+ var newViewMode = Math.max(0, Math.min(DPGlobal.modes.length - 1, this.viewMode + dir));
1088
+ if (newViewMode >= this.minView && newViewMode <= this.maxView) {
1089
+ this.viewMode = newViewMode;
1090
+ }
1091
+ }
1092
+ /*
1093
+ vitalets: fixing bug of very special conditions:
1094
+ jquery 1.7.1 + webkit + show inline datepicker in bootstrap popover.
1095
+ Method show() does not set display css correctly and datepicker is not shown.
1096
+ Changed to .css('display', 'block') solve the problem.
1097
+ See https://github.com/vitalets/x-editable/issues/37
1098
+
1099
+ In jquery 1.7.2+ everything works fine.
1100
+ */
1101
+ //this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
1102
+ this.picker.find('>div').hide().filter('.datepicker-' + DPGlobal.modes[this.viewMode].clsName).css('display', 'block');
1103
+ this.updateNavArrows();
1104
+ },
1105
+
1106
+ changeViewDate: function(date) {
1107
+ this.date = date;
1108
+ this.viewDate = date;
1109
+ this.fill();
1110
+ },
1111
+
1112
+ reset: function(e) {
1113
+ this._setDate(null, 'date');
1114
+ }
1115
+ };
1116
+
1117
+ $.fn.fdatepicker = function(option) {
1118
+ var args = Array.apply(null, arguments);
1119
+ args.shift();
1120
+ return this.each(function() {
1121
+ var $this = $(this),
1122
+ data = $this.data('datepicker'),
1123
+ options = typeof option == 'object' && option;
1124
+ if (!data) {
1125
+ $this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.fdatepicker.defaults, options))));
1126
+ }
1127
+ if (typeof option == 'string' && typeof data[option] == 'function') {
1128
+ data[option].apply(data, args);
1129
+ }
1130
+ });
1131
+ };
1132
+
1133
+ $.fn.fdatepicker.defaults = {
1134
+ onRender: function(date) {
1135
+ return '';
1136
+ }
1137
+ };
1138
+ $.fn.fdatepicker.Constructor = Datepicker;
1139
+ var dates = $.fn.fdatepicker.dates = {
1140
+ 'en': {
1141
+ days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
1142
+ daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
1143
+ daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
1144
+ months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
1145
+ monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
1146
+ today: "Today",
1147
+ titleFormat: "MM yyyy"
1148
+ }
1149
+ };
1150
+
1151
+ var DPGlobal = {
1152
+ modes: [{
1153
+ clsName: 'minutes',
1154
+ navFnc: 'Hours',
1155
+ navStep: 1
1156
+ }, {
1157
+ clsName: 'hours',
1158
+ navFnc: 'Date',
1159
+ navStep: 1
1160
+ }, {
1161
+ clsName: 'days',
1162
+ navFnc: 'Month',
1163
+ navStep: 1
1164
+ }, {
1165
+ clsName: 'months',
1166
+ navFnc: 'FullYear',
1167
+ navStep: 1
1168
+ }, {
1169
+ clsName: 'years',
1170
+ navFnc: 'FullYear',
1171
+ navStep: 10
1172
+ }],
1173
+ isLeapYear: function(year) {
1174
+ return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
1175
+ },
1176
+ getDaysInMonth: function(year, month) {
1177
+ return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
1178
+ },
1179
+ validParts: /hh?|ii?|ss?|dd?|mm?|MM?|yy(?:yy)?/g,
1180
+ nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,
1181
+ parseFormat: function(format) {
1182
+ // IE treats \0 as a string end in inputs (truncating the value),
1183
+ // so it's a bad format delimiter, anyway
1184
+ var separators = format.replace(this.validParts, '\0').split('\0'),
1185
+ parts = format.match(this.validParts);
1186
+ if (!separators || !separators.length || !parts || parts.length === 0) {
1187
+ throw new Error("Invalid date format.");
1188
+ }
1189
+ this.formatText = format;
1190
+ return {
1191
+ separators: separators,
1192
+ parts: parts
1193
+ };
1194
+ },
1195
+ parseDate: function(date, format, language) {
1196
+ if (date instanceof Date) return new Date(date.valueOf() - date.getTimezoneOffset() * 60000);
1197
+ if (/^\d{4}\-\d{1,2}\-\d{1,2}$/.test(date)) {
1198
+ format = this.parseFormat('yyyy-mm-dd');
1199
+ }
1200
+ if (/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}$/.test(date)) {
1201
+ format = this.parseFormat('yyyy-mm-dd hh:ii');
1202
+ }
1203
+ if (/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}\:\d{1,2}[Z]{0,1}$/.test(date)) {
1204
+ format = this.parseFormat('yyyy-mm-dd hh:ii:ss');
1205
+ }
1206
+ if (/^[-+]\d+[dmwy]([\s,]+[-+]\d+[dmwy])*$/.test(date)) {
1207
+ var part_re = /([-+]\d+)([dmwy])/,
1208
+ parts = date.match(/([-+]\d+)([dmwy])/g),
1209
+ part, dir;
1210
+ date = new Date();
1211
+ for (var i = 0; i < parts.length; i++) {
1212
+ part = part_re.exec(parts[i]);
1213
+ dir = parseInt(part[1]);
1214
+ switch (part[2]) {
1215
+ case 'd':
1216
+ date.setUTCDate(date.getUTCDate() + dir);
1217
+ break;
1218
+ case 'm':
1219
+ date = Datetimepicker.prototype.moveMonth.call(Datetimepicker.prototype, date, dir);
1220
+ break;
1221
+ case 'w':
1222
+ date.setUTCDate(date.getUTCDate() + dir * 7);
1223
+ break;
1224
+ case 'y':
1225
+ date = Datetimepicker.prototype.moveYear.call(Datetimepicker.prototype, date, dir);
1226
+ break;
1227
+ }
1228
+ }
1229
+ return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
1230
+ }
1231
+ var parts = date && date.match(this.nonpunctuation) || [],
1232
+ date = new Date(),
1233
+ parsed = {},
1234
+ setters_order = ['hh', 'h', 'ii', 'i', 'ss', 's', 'yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],
1235
+ setters_map = {
1236
+ hh: function(d, v) {
1237
+ return d.setUTCHours(v);
1238
+ },
1239
+ h: function(d, v) {
1240
+ return d.setUTCHours(v);
1241
+ },
1242
+ ii: function(d, v) {
1243
+ return d.setUTCMinutes(v);
1244
+ },
1245
+ i: function(d, v) {
1246
+ return d.setUTCMinutes(v);
1247
+ },
1248
+ ss: function(d, v) {
1249
+ return d.setUTCSeconds(v);
1250
+ },
1251
+ s: function(d, v) {
1252
+ return d.setUTCSeconds(v);
1253
+ },
1254
+ yyyy: function(d, v) {
1255
+ return d.setUTCFullYear(v);
1256
+ },
1257
+ yy: function(d, v) {
1258
+ return d.setUTCFullYear(2000 + v);
1259
+ },
1260
+ m: function(d, v) {
1261
+ v -= 1;
1262
+ while (v < 0) v += 12;
1263
+ v %= 12;
1264
+ d.setUTCMonth(v);
1265
+ while (d.getUTCMonth() != v)
1266
+ d.setUTCDate(d.getUTCDate() - 1);
1267
+ return d;
1268
+ },
1269
+ d: function(d, v) {
1270
+ return d.setUTCDate(v);
1271
+ }
1272
+ },
1273
+ val, filtered, part;
1274
+ setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];
1275
+ setters_map['dd'] = setters_map['d'];
1276
+ date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); //date.getHours(), date.getMinutes(), date.getSeconds());
1277
+ if (parts.length == format.parts.length) {
1278
+ for (var i = 0, cnt = format.parts.length; i < cnt; i++) {
1279
+ val = parseInt(parts[i], 10);
1280
+ part = format.parts[i];
1281
+ if (isNaN(val)) {
1282
+ switch (part) {
1283
+ case 'MM':
1284
+ filtered = $(dates[language].months).filter(function() {
1285
+ var m = this.slice(0, parts[i].length),
1286
+ p = parts[i].slice(0, m.length);
1287
+ return m == p;
1288
+ });
1289
+ val = $.inArray(filtered[0], dates[language].months) + 1;
1290
+ break;
1291
+ case 'M':
1292
+ filtered = $(dates[language].monthsShort).filter(function() {
1293
+ var m = this.slice(0, parts[i].length),
1294
+ p = parts[i].slice(0, m.length);
1295
+ return m == p;
1296
+ });
1297
+ val = $.inArray(filtered[0], dates[language].monthsShort) + 1;
1298
+ break;
1299
+ }
1300
+ }
1301
+ parsed[part] = val;
1302
+ }
1303
+ for (var i = 0, s; i < setters_order.length; i++) {
1304
+ s = setters_order[i];
1305
+ if (s in parsed && !isNaN(parsed[s]))
1306
+ setters_map[s](date, parsed[s])
1307
+ }
1308
+ }
1309
+ return date;
1310
+ },
1311
+ formatDate: function(date, format, language) {
1312
+ if (date == null) {
1313
+ return '';
1314
+ }
1315
+ var val = {
1316
+ h: date.getUTCHours(),
1317
+ i: date.getUTCMinutes(),
1318
+ s: date.getUTCSeconds(),
1319
+ d: date.getUTCDate(),
1320
+ m: date.getUTCMonth() + 1,
1321
+ M: dates[language].monthsShort[date.getUTCMonth()],
1322
+ MM: dates[language].months[date.getUTCMonth()],
1323
+ yy: date.getUTCFullYear().toString().substring(2),
1324
+ yyyy: date.getUTCFullYear()
1325
+ };
1326
+ val.hh = (val.h < 10 ? '0' : '') + val.h;
1327
+ val.ii = (val.i < 10 ? '0' : '') + val.i;
1328
+ val.ss = (val.s < 10 ? '0' : '') + val.s;
1329
+ val.dd = (val.d < 10 ? '0' : '') + val.d;
1330
+ val.mm = (val.m < 10 ? '0' : '') + val.m;
1331
+ var date = [],
1332
+ seps = $.extend([], format.separators);
1333
+ for (var i = 0, cnt = format.parts.length; i < cnt; i++) {
1334
+ if (seps.length)
1335
+ date.push(seps.shift())
1336
+ date.push(val[format.parts[i]]);
1337
+ }
1338
+ return date.join('');
1339
+ },
1340
+ convertViewMode: function(viewMode) {
1341
+ switch (viewMode) {
1342
+ case 4:
1343
+ case 'decade':
1344
+ viewMode = 4;
1345
+ break;
1346
+ case 3:
1347
+ case 'year':
1348
+ viewMode = 3;
1349
+ break;
1350
+ case 2:
1351
+ case 'month':
1352
+ viewMode = 2;
1353
+ break;
1354
+ case 1:
1355
+ case 'day':
1356
+ viewMode = 1;
1357
+ break;
1358
+ case 0:
1359
+ case 'hour':
1360
+ viewMode = 0;
1361
+ break;
1362
+ }
1363
+
1364
+ return viewMode;
1365
+ },
1366
+ headTemplate: function(leftArrow, rightArrow) {return('<thead>' +
1367
+ '<tr>' +
1368
+ '<th class="prev">' + leftArrow + '</th>' +
1369
+ '<th colspan="5" class="date-switch"></th>' +
1370
+ '<th class="next">' + rightArrow + '</th>' +
1371
+ '</tr>' +
1372
+ '</thead>')},
1373
+ contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
1374
+ footTemplate: '<tfoot><tr><th colspan="7" class="today"></th></tr></tfoot>'
1375
+ };
1376
+ DPGlobal.template = function(leftArrow, rightArrow, closeIcon) {return( '<div class="datepicker">' +
1377
+ '<div class="datepicker-minutes">' +
1378
+ '<table class=" table-condensed">' +
1379
+ DPGlobal.headTemplate(leftArrow, rightArrow) +
1380
+ DPGlobal.contTemplate +
1381
+ DPGlobal.footTemplate +
1382
+ '</table>' +
1383
+ '</div>' +
1384
+ '<div class="datepicker-hours">' +
1385
+ '<table class=" table-condensed">' +
1386
+ DPGlobal.headTemplate(leftArrow, rightArrow) +
1387
+ DPGlobal.contTemplate +
1388
+ DPGlobal.footTemplate +
1389
+ '</table>' +
1390
+ '</div>' +
1391
+ '<div class="datepicker-days">' +
1392
+ '<table class=" table-condensed">' +
1393
+ DPGlobal.headTemplate(leftArrow, rightArrow) +
1394
+ '<tbody></tbody>' +
1395
+ DPGlobal.footTemplate +
1396
+ '</table>' +
1397
+ '</div>' +
1398
+ '<div class="datepicker-months">' +
1399
+ '<table class="table-condensed">' +
1400
+ DPGlobal.headTemplate(leftArrow, rightArrow) +
1401
+ DPGlobal.contTemplate +
1402
+ DPGlobal.footTemplate +
1403
+ '</table>' +
1404
+ '</div>' +
1405
+ '<div class="datepicker-years">' +
1406
+ '<table class="table-condensed">' +
1407
+ DPGlobal.headTemplate(leftArrow, rightArrow) +
1408
+ DPGlobal.contTemplate +
1409
+ DPGlobal.footTemplate +
1410
+ '</table>' +
1411
+ '</div>' +
1412
+ '<a class="button datepicker-close tiny alert right" style="width:auto;">' + closeIcon + '</a>' +
1413
+ '</div>')};
1414
+
1415
+ $.fn.fdatepicker.DPGlobal = DPGlobal;
1416
+
1417
+ }(window.jQuery);