decidim-core 0.10.1 → 0.11.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (269) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -11
  3. data/app/assets/images/decidim/icons.svg +25 -6
  4. data/app/assets/javascripts/decidim/account_form.js.es6 +8 -8
  5. data/app/assets/javascripts/decidim/append_elements.js.es6 +1 -1
  6. data/app/assets/javascripts/decidim/append_redirect_url_to_modals.js.es6 +5 -5
  7. data/app/assets/javascripts/decidim/data_picker.js.es6 +10 -10
  8. data/app/assets/javascripts/decidim/editor.js.es6 +37 -22
  9. data/app/assets/javascripts/decidim/filters.js.es6 +1 -1
  10. data/app/assets/javascripts/decidim/form_filter.component.js.es6 +15 -15
  11. data/app/assets/javascripts/decidim/form_filter.component.test.js +29 -29
  12. data/app/assets/javascripts/decidim/impersonation.js.es6 +3 -3
  13. data/app/assets/javascripts/decidim/input_mentions.js.es6 +100 -0
  14. data/app/assets/javascripts/decidim/input_tags.js.es6 +12 -0
  15. data/app/assets/javascripts/decidim/{map.js.es6.erb → map.js.es6} +9 -9
  16. data/app/assets/javascripts/decidim/notifications.js.es6 +10 -10
  17. data/app/assets/javascripts/decidim/orders.js.es6 +5 -5
  18. data/app/assets/javascripts/decidim/user_registrations.js.es6 +4 -4
  19. data/app/assets/javascripts/decidim/widget.js.es6 +1 -1
  20. data/app/assets/javascripts/decidim.js.es6 +10 -0
  21. data/app/assets/stylesheets/decidim/application.scss.erb +1 -1
  22. data/app/assets/stylesheets/decidim/modules/_author-avatar.scss +39 -0
  23. data/app/assets/stylesheets/decidim/modules/_cards.scss +158 -3
  24. data/app/assets/stylesheets/decidim/modules/_definition-data.scss +6 -0
  25. data/app/assets/stylesheets/decidim/modules/_extra.scss +1 -3
  26. data/app/assets/stylesheets/decidim/modules/_icons.scss +14 -6
  27. data/app/assets/stylesheets/decidim/modules/_inline-filters.scss +61 -0
  28. data/app/assets/stylesheets/decidim/modules/_input-mentions.scss +124 -0
  29. data/app/assets/stylesheets/decidim/modules/_input-tags.scss +55 -0
  30. data/app/assets/stylesheets/decidim/modules/_modules.scss +3 -0
  31. data/app/assets/stylesheets/decidim/modules/_status-labels.scss +4 -0
  32. data/app/assets/stylesheets/decidim/modules/_typography.scss +16 -0
  33. data/app/assets/stylesheets/decidim/utils/_helpers.scss +29 -0
  34. data/app/assets/stylesheets/decidim/utils/_mixins.scss +6 -0
  35. data/app/cells/decidim/author_box/show.erb +10 -0
  36. data/app/cells/decidim/author_box_cell.rb +21 -0
  37. data/app/cells/decidim/card/show.erb +17 -0
  38. data/app/cells/decidim/card_cell.rb +29 -0
  39. data/app/cells/decidim/profile/profile_inline.erb +21 -0
  40. data/app/cells/decidim/profile/show.erb +13 -0
  41. data/app/cells/decidim/profile_cell.rb +17 -0
  42. data/app/commands/decidim/create_omniauth_registration.rb +3 -2
  43. data/app/commands/decidim/create_report.rb +1 -1
  44. data/app/commands/decidim/invite_user.rb +2 -0
  45. data/app/constraints/decidim/current_component.rb +41 -0
  46. data/app/controllers/concerns/decidim/action_authorization.rb +3 -3
  47. data/app/controllers/concerns/decidim/devise_controllers.rb +2 -1
  48. data/app/controllers/concerns/decidim/filter_resource.rb +1 -1
  49. data/app/controllers/concerns/decidim/form_factory.rb +1 -1
  50. data/app/controllers/concerns/decidim/impersonate_users.rb +6 -2
  51. data/app/controllers/concerns/decidim/needs_authorization.rb +2 -2
  52. data/app/controllers/concerns/decidim/participatory_space_context.rb +15 -0
  53. data/app/controllers/concerns/decidim/settings.rb +5 -5
  54. data/app/controllers/decidim/application_controller.rb +2 -1
  55. data/app/controllers/decidim/{features → components}/base_controller.rb +16 -8
  56. data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +3 -1
  57. data/app/controllers/decidim/devise/registrations_controller.rb +1 -3
  58. data/app/controllers/decidim/doorkeeper/authorizations_controller.rb +16 -0
  59. data/app/controllers/decidim/doorkeeper/credentials_controller.rb +46 -0
  60. data/app/controllers/decidim/doorkeeper/token_info_controller.rb +9 -0
  61. data/app/controllers/decidim/doorkeeper/tokens_controller.rb +9 -0
  62. data/app/controllers/decidim/widgets_controller.rb +1 -1
  63. data/app/forms/decidim/follow_form.rb +1 -1
  64. data/app/forms/decidim/form.rb +1 -1
  65. data/app/forms/decidim/omniauth_registration_form.rb +1 -0
  66. data/app/forms/decidim/registration_form.rb +5 -5
  67. data/app/helpers/decidim/card_helper.rb +16 -0
  68. data/app/helpers/decidim/component_path_helper.rb +36 -0
  69. data/app/helpers/decidim/icon_helper.rb +7 -7
  70. data/app/helpers/decidim/messaging/conversation_helper.rb +4 -3
  71. data/app/helpers/decidim/paginate_helper.rb +1 -1
  72. data/app/helpers/decidim/resource_helper.rb +2 -2
  73. data/app/jobs/decidim/export_job.rb +3 -3
  74. data/app/mailers/decidim/messaging/conversation_mailer.rb +0 -2
  75. data/app/middleware/decidim/current_organization.rb +2 -2
  76. data/app/models/decidim/abilities/admin_ability.rb +1 -1
  77. data/app/models/decidim/abilities/everyone_ability.rb +1 -1
  78. data/app/models/decidim/abilities/participatory_process_admin_ability.rb +2 -2
  79. data/app/models/decidim/abilities/participatory_process_collaborator_ability.rb +2 -2
  80. data/app/models/decidim/action_log.rb +7 -5
  81. data/app/models/decidim/area.rb +7 -0
  82. data/app/models/decidim/authorization.rb +14 -0
  83. data/app/models/decidim/{feature.rb → component.rb} +15 -15
  84. data/app/models/decidim/moderation.rb +1 -1
  85. data/app/models/decidim/oauth_application.rb +24 -0
  86. data/app/models/decidim/organization.rb +5 -0
  87. data/app/models/decidim/participatory_space_link.rb +20 -0
  88. data/app/models/decidim/participatory_space_private_user.rb +19 -0
  89. data/app/models/decidim/user.rb +7 -0
  90. data/app/presenters/decidim/admin_log/area_presenter.rb +38 -0
  91. data/app/presenters/decidim/admin_log/{feature_presenter.rb → component_presenter.rb} +5 -5
  92. data/app/presenters/decidim/admin_log/newsletter_resource_presenter.rb +1 -1
  93. data/app/presenters/decidim/admin_log/oauth_application_presenter.rb +50 -0
  94. data/app/presenters/decidim/admin_log/oauth_application_resource_presenter.rb +18 -0
  95. data/app/presenters/decidim/home_stats_presenter.rb +7 -7
  96. data/app/presenters/decidim/log/value_types/area_presenter.rb +1 -1
  97. data/app/presenters/decidim/log/value_types/area_type_presenter.rb +28 -0
  98. data/app/presenters/decidim/log/value_types/currency_presenter.rb +20 -0
  99. data/app/presenters/decidim/log/value_types/scope_presenter.rb +1 -1
  100. data/app/presenters/decidim/log/value_types/scope_type_presenter.rb +1 -1
  101. data/app/presenters/decidim/resource_locator_presenter.rb +3 -3
  102. data/app/services/decidim/action_authorizer.rb +9 -9
  103. data/app/services/decidim/action_logger.rb +9 -7
  104. data/app/services/decidim/email_notification_generator.rb +1 -1
  105. data/app/services/decidim/notification_generator_for_recipient.rb +1 -1
  106. data/app/services/decidim/resource_search.rb +8 -8
  107. data/app/services/decidim/settings_change.rb +5 -5
  108. data/app/services/decidim/static_map_generator.rb +1 -1
  109. data/app/types/decidim/core/attachment_type.rb +14 -0
  110. data/app/types/decidim/core/category_type.rb +16 -0
  111. data/app/types/decidim/core/coordinates_type.rb +19 -0
  112. data/app/types/decidim/core/scope_api_type.rb +16 -0
  113. data/app/uploaders/decidim/oauth_application_logo_uploader.rb +9 -0
  114. data/app/validators/geocoding_validator.rb +2 -2
  115. data/app/views/decidim/account/delete.html.erb +7 -7
  116. data/app/views/decidim/application/_collection.html.erb +1 -1
  117. data/app/views/decidim/application/_document.html.erb +1 -1
  118. data/app/views/decidim/application/_photos.html.erb +1 -1
  119. data/app/views/decidim/devise/invitations/edit.html.erb +1 -1
  120. data/app/views/decidim/devise/omniauth_registrations/new.html.erb +1 -1
  121. data/app/views/decidim/devise/registrations/new.html.erb +1 -1
  122. data/app/views/decidim/devise/sessions/new.html.erb +2 -2
  123. data/app/views/decidim/devise/shared/_omniauth_buttons.html.erb +1 -1
  124. data/app/views/decidim/devise/shared/_omniauth_buttons_mini.html.erb +1 -1
  125. data/app/views/decidim/doorkeeper/authorizations/new.html.erb +58 -0
  126. data/app/views/decidim/messaging/conversations/_show.html.erb +1 -1
  127. data/app/views/decidim/messaging/conversations/index.html.erb +1 -1
  128. data/app/views/decidim/notifications/index.html.erb +1 -1
  129. data/app/views/decidim/notifications_settings/show.html.erb +2 -2
  130. data/app/views/decidim/own_user_groups/index.html.erb +3 -3
  131. data/app/views/decidim/scopes/_scopes_picker_input.html.erb +4 -4
  132. data/app/views/decidim/scopes/picker.html.erb +3 -3
  133. data/app/views/decidim/shared/_action_authorization_modal.html.erb +1 -1
  134. data/app/views/decidim/shared/_author.html.erb +1 -1
  135. data/app/views/decidim/shared/_author_reference.html.erb +1 -12
  136. data/app/views/decidim/shared/{_feature_announcement.html.erb → _component_announcement.html.erb} +2 -2
  137. data/app/views/decidim/shared/_embed_modal.html.erb +1 -1
  138. data/app/views/decidim/shared/_flag_modal.html.erb +5 -5
  139. data/app/views/decidim/shared/_login_modal.html.erb +3 -3
  140. data/app/views/decidim/shared/_private_participatory_space.html.erb +5 -0
  141. data/app/views/decidim/shared/_share_modal.html.erb +1 -1
  142. data/app/views/decidim/shared/_tags.html.erb +1 -1
  143. data/app/views/decidim/shared/_version_author.html.erb +1 -1
  144. data/app/views/decidim/widgets/_data_picker.html.erb +4 -4
  145. data/app/views/devise/mailer/confirmation_instructions.html.erb +3 -3
  146. data/app/views/devise/mailer/invite_private_user.html.erb +17 -0
  147. data/app/views/devise/mailer/invite_private_user.text.erb +15 -0
  148. data/app/views/devise/mailer/password_change.html.erb +2 -2
  149. data/app/views/devise/mailer/reset_password_instructions.html.erb +5 -5
  150. data/app/views/kaminari/decidim/_first_page.html.erb +2 -3
  151. data/app/views/kaminari/decidim/_gap.html.erb +2 -3
  152. data/app/views/kaminari/decidim/_last_page.html.erb +2 -3
  153. data/app/views/kaminari/decidim/_next_page.html.erb +2 -3
  154. data/app/views/kaminari/decidim/_page.html.erb +2 -3
  155. data/app/views/kaminari/decidim/_paginator.html.erb +1 -2
  156. data/app/views/kaminari/decidim/_prev_page.html.erb +2 -3
  157. data/app/views/layouts/decidim/_application.html.erb +4 -4
  158. data/app/views/layouts/decidim/_component_authorization_modals.html.erb +5 -0
  159. data/app/views/layouts/decidim/_cookie_warning.html.erb +2 -2
  160. data/app/views/layouts/decidim/_head.html.erb +4 -4
  161. data/app/views/layouts/decidim/_impersonation_warning.html.erb +4 -4
  162. data/app/views/layouts/decidim/_language_chooser.html.erb +1 -1
  163. data/app/views/layouts/decidim/_social_media_links.html.erb +5 -5
  164. data/app/views/layouts/decidim/_wrapper.html.erb +5 -5
  165. data/app/views/layouts/decidim/mailer.html.erb +1 -1
  166. data/app/views/layouts/decidim/widget.html.erb +5 -5
  167. data/app/views/pages/home/_hero.html.erb +1 -1
  168. data/app/views/pages/home.html.erb +6 -6
  169. data/config/locales/ca.yml +66 -27
  170. data/config/locales/en.yml +69 -30
  171. data/config/locales/es.yml +66 -27
  172. data/config/locales/eu.yml +69 -30
  173. data/config/locales/fi.yml +69 -30
  174. data/config/locales/fr.yml +85 -46
  175. data/config/locales/gl.yml +69 -30
  176. data/config/locales/it.yml +69 -30
  177. data/config/locales/nl.yml +122 -83
  178. data/config/locales/pl.yml +69 -30
  179. data/config/locales/pt-BR.yml +69 -30
  180. data/config/locales/pt.yml +69 -30
  181. data/config/locales/ru.yml +0 -7
  182. data/config/locales/sv.yml +69 -30
  183. data/config/locales/uk.yml +0 -13
  184. data/config/routes.rb +8 -0
  185. data/db/migrate/20180206183235_create_participatory_space_private_users.rb +15 -0
  186. data/db/migrate/20180221101934_fix_nickname_index.rb +5 -6
  187. data/db/migrate/20180226140756_add_version_to_action_logs.rb +5 -1
  188. data/db/migrate/20180227131727_create_participatory_space_links.rb +12 -0
  189. data/db/migrate/20180305132906_rename_features_to_components.rb +13 -0
  190. data/db/migrate/20180308113207_doorkeeper_models.rb +85 -0
  191. data/db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb +2 -2
  192. data/db/migrate/{20180326075746_change_event_name_and_class_to_rename_to_publish_proposal_event.rb → 20180323102631_change_event_name_and_class_to_rename_to_publish_proposal_event.rb} +0 -0
  193. data/db/seeds.rb +12 -2
  194. data/lib/decidim/api/attachable_interface.rb +13 -0
  195. data/lib/decidim/api/authorable_interface.rb +13 -0
  196. data/lib/decidim/api/categorizable_interface.rb +13 -0
  197. data/lib/decidim/api/participatory_space_interface.rb +4 -4
  198. data/lib/decidim/api/scopable_interface.rb +13 -0
  199. data/lib/decidim/authorable.rb +8 -0
  200. data/lib/decidim/{feature_manifest.rb → component_manifest.rb} +24 -21
  201. data/lib/decidim/{feature_validator.rb → component_validator.rb} +6 -6
  202. data/lib/decidim/{features → components}/export_manifest.rb +4 -4
  203. data/lib/decidim/components/namer.rb +35 -0
  204. data/lib/decidim/components.rb +9 -0
  205. data/lib/decidim/content_parsers/user_parser.rb +1 -1
  206. data/lib/decidim/core/api.rb +13 -0
  207. data/lib/decidim/core/engine.rb +76 -3
  208. data/lib/decidim/core/test/factories.rb +43 -10
  209. data/lib/decidim/core/test/shared_examples/announcements_examples.rb +9 -9
  210. data/lib/decidim/core/test/shared_examples/attachable_interface_examples.rb +16 -0
  211. data/lib/decidim/core/test/shared_examples/authorable_interface_examples.rb +33 -0
  212. data/lib/decidim/core/test/shared_examples/categorizable_interface_examples.rb +19 -0
  213. data/lib/decidim/core/test/shared_examples/comments_examples.rb +3 -3
  214. data/lib/decidim/core/test/shared_examples/follows_examples.rb +1 -1
  215. data/lib/decidim/core/test/shared_examples/has_component.rb +21 -0
  216. data/lib/decidim/core/test/shared_examples/has_reference.rb +2 -2
  217. data/lib/decidim/core/test/shared_examples/localised_email.rb +1 -1
  218. data/lib/decidim/core/test/shared_examples/paginated_resource_examples.rb +1 -1
  219. data/lib/decidim/core/test/shared_examples/reportable.rb +8 -6
  220. data/lib/decidim/core/test/shared_examples/reports_examples.rb +1 -1
  221. data/lib/decidim/core/test/shared_examples/scopable_interface_examples.rb +19 -0
  222. data/lib/decidim/core/test/shared_examples/scope_helper_examples.rb +8 -3
  223. data/lib/decidim/core/test/shared_examples/simple_event.rb +1 -1
  224. data/lib/decidim/core/test/shared_examples/user_localised_email_examples.rb +1 -1
  225. data/lib/decidim/core/test.rb +1 -1
  226. data/lib/decidim/core/version.rb +1 -1
  227. data/lib/decidim/core.rb +35 -37
  228. data/lib/decidim/events/base_event.rb +5 -5
  229. data/lib/decidim/events/simple_event.rb +8 -8
  230. data/lib/decidim/form_builder.rb +48 -3
  231. data/lib/decidim/has_attachment_collections.rb +1 -1
  232. data/lib/decidim/has_attachments.rb +1 -1
  233. data/lib/decidim/has_category.rb +2 -2
  234. data/lib/decidim/has_component.rb +23 -0
  235. data/lib/decidim/has_private_users.rb +26 -0
  236. data/lib/decidim/has_reference.rb +3 -3
  237. data/lib/decidim/page_finder.rb +1 -1
  238. data/lib/decidim/participatory_space_manifest.rb +3 -3
  239. data/lib/decidim/participatory_space_resourceable.rb +80 -0
  240. data/lib/decidim/publicable.rb +2 -2
  241. data/lib/decidim/query_extensions.rb +2 -2
  242. data/lib/decidim/rectify_ext.rb +32 -0
  243. data/lib/decidim/reportable.rb +1 -1
  244. data/lib/decidim/resource_manifest.rb +13 -13
  245. data/lib/decidim/resourceable.rb +8 -8
  246. data/lib/decidim/scopable.rb +1 -1
  247. data/lib/decidim/{scopable_feature.rb → scopable_component.rb} +1 -1
  248. data/lib/decidim/settings_manifest.rb +1 -1
  249. data/lib/decidim/stats_registry.rb +1 -1
  250. data/lib/decidim/view_model.rb +9 -0
  251. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.fr.js +4 -1
  252. data/vendor/assets/javascripts/form_datepicker.js.es6 +10 -10
  253. data/vendor/assets/javascripts/quill.min.js +2 -2
  254. data/vendor/assets/javascripts/quill.min.js.map +1 -1
  255. data/vendor/assets/javascripts/tagsinput.js +683 -0
  256. data/vendor/assets/javascripts/tribute.js +1607 -0
  257. data/vendor/assets/stylesheets/quill.bubble.css +30 -16
  258. data/vendor/assets/stylesheets/quill.core.css +19 -9
  259. data/vendor/assets/stylesheets/quill.snow.css +30 -16
  260. data/vendor/assets/stylesheets/tagsinput.css +55 -0
  261. data/vendor/assets/stylesheets/tribute.css +27 -0
  262. metadata +164 -27
  263. data/app/constraints/decidim/current_feature.rb +0 -41
  264. data/app/helpers/decidim/feature_path_helper.rb +0 -36
  265. data/app/views/layouts/decidim/_feature_authorization_modals.html.erb +0 -5
  266. data/lib/decidim/core/test/shared_examples/has_feature.rb +0 -21
  267. data/lib/decidim/features/namer.rb +0 -35
  268. data/lib/decidim/features.rb +0 -9
  269. data/lib/decidim/has_feature.rb +0 -23
@@ -1,15 +1,15 @@
1
1
  /* global spyOn */
2
2
  /* eslint-disable id-length */
3
- window.$ = require('jquery');
3
+ window.$ = require("jquery");
4
4
 
5
- require('./history.js.es6');
6
- require('./data_picker.js.es6');
7
- require('./form_filter.component.js.es6');
5
+ require("./history.js.es6");
6
+ require("./data_picker.js.es6");
7
+ require("./form_filter.component.js.es6");
8
8
 
9
9
  const { Decidim: { FormFilterComponent } } = window;
10
10
 
11
- describe('FormFilterComponent', () => {
12
- const selector = 'form#new_filter';
11
+ describe("FormFilterComponent", () => {
12
+ const selector = "form#new_filter";
13
13
  let subject = null;
14
14
  let scopesPickerState = {filter_scope_id: [{ url: "picker_url_3", value: 3, text: "Scope 3"}, { url: "picker_url_4", value: 4, text: "Scope 4"}]} // eslint-disable-line camelcase
15
15
 
@@ -40,27 +40,27 @@ describe('FormFilterComponent', () => {
40
40
  </fieldset>
41
41
  </form>
42
42
  `;
43
- $('body').append(form);
43
+ $("body").append(form);
44
44
 
45
45
  window.theDataPicker = new window.Decidim.DataPicker($(".data-picker"));
46
- subject = new FormFilterComponent($(document).find('form'));
46
+ subject = new FormFilterComponent($(document).find("form"));
47
47
  });
48
48
 
49
- it('exists', () => {
49
+ it("exists", () => {
50
50
  expect(FormFilterComponent).toBeDefined();
51
51
  });
52
52
 
53
- it('initializes unmounted', () => {
53
+ it("initializes unmounted", () => {
54
54
  expect(subject.mounted).toBeFalsy();
55
55
  });
56
56
 
57
- it('initializes the formSelector with the given selector', () => {
57
+ it("initializes the formSelector with the given selector", () => {
58
58
  expect(subject.$form).toEqual($(selector));
59
59
  });
60
60
 
61
- describe('when mounted', () => {
61
+ describe("when mounted", () => {
62
62
  beforeEach(() => {
63
- spyOn(subject.$form, 'on');
63
+ spyOn(subject.$form, "on");
64
64
  subject.mountComponent();
65
65
  });
66
66
 
@@ -68,52 +68,52 @@ describe('FormFilterComponent', () => {
68
68
  subject.unmountComponent();
69
69
  });
70
70
 
71
- it('mounts the component', () => {
71
+ it("mounts the component", () => {
72
72
  expect(subject.mounted).toBeTruthy();
73
73
  });
74
74
 
75
- it('binds the form change event', () => {
76
- expect(subject.$form.on).toHaveBeenCalledWith('change', 'input, select', subject._onFormChange);
75
+ it("binds the form change event", () => {
76
+ expect(subject.$form.on).toHaveBeenCalledWith("change", "input, select", subject._onFormChange);
77
77
  });
78
78
 
79
- describe('onpopstate event', () => {
79
+ describe("onpopstate event", () => {
80
80
  beforeEach(() => {
81
- spyOn(subject.$form, 'submit');
81
+ spyOn(subject.$form, "submit");
82
82
  });
83
83
 
84
- it('clears the form data', () => {
85
- spyOn(subject, '_clearForm');
84
+ it("clears the form data", () => {
85
+ spyOn(subject, "_clearForm");
86
86
 
87
87
  window.onpopstate({ isTrusted: true, state: scopesPickerState});
88
88
 
89
89
  expect(subject._clearForm).toHaveBeenCalled();
90
90
  });
91
91
 
92
- it('sets the correct form fields based on the current location', () => {
93
- spyOn(subject, '_getLocation').and.returnValue('/filters?filter[scope_id][]=3&filter[scope_id][]=4&filter[category_id]=2');
92
+ it("sets the correct form fields based on the current location", () => {
93
+ spyOn(subject, "_getLocation").and.returnValue("/filters?filter[scope_id][]=3&filter[scope_id][]=4&filter[category_id]=2");
94
94
  window.onpopstate({ isTrusted: true, state: scopesPickerState});
95
95
 
96
- expect($(selector).find('select#filter_category_id').val()).toEqual('2');
96
+ expect($(selector).find("select#filter_category_id").val()).toEqual("2");
97
97
  expect($(`${selector} #filter_scope_id .picker-values div input`).map(function(_index, input) {
98
98
  return $(input).val();
99
- }).get()).toEqual(['3', '4']);
99
+ }).get()).toEqual(["3", "4"]);
100
100
  });
101
101
  });
102
102
  });
103
103
 
104
- describe('when unmounted', () => {
104
+ describe("when unmounted", () => {
105
105
  beforeEach(() => {
106
- spyOn(subject.$form, 'off');
106
+ spyOn(subject.$form, "off");
107
107
  subject.mountComponent();
108
108
  subject.unmountComponent();
109
109
  });
110
110
 
111
- it('mounts the component', () => {
111
+ it("mounts the component", () => {
112
112
  expect(subject.mounted).toBeFalsy();
113
113
  });
114
114
 
115
- it('unbinds the form change event', () => {
116
- expect(subject.$form.off).toHaveBeenCalledWith('change', 'input, select', subject._onFormChange);
115
+ it("unbinds the form change event", () => {
116
+ expect(subject.$form.off).toHaveBeenCalledWith("change", "input, select", subject._onFormChange);
117
117
  });
118
118
  });
119
119
 
@@ -1,12 +1,12 @@
1
1
  ((exports) => {
2
2
  exports.$(() => {
3
- const $impersonationWarning = $('.impersonation-warning');
4
- const endsAt = exports.moment($impersonationWarning.data('session-ends-at'));
3
+ const $impersonationWarning = $(".impersonation-warning");
4
+ const endsAt = exports.moment($impersonationWarning.data("session-ends-at"));
5
5
 
6
6
  setInterval(() => {
7
7
  const diff = (endsAt - exports.moment()) / 60000;
8
8
  const diffInMinutes = Math.round(diff);
9
- $impersonationWarning.find('.minutes').html(diffInMinutes);
9
+ $impersonationWarning.find(".minutes").html(diffInMinutes);
10
10
 
11
11
  if (diff <= 0) {
12
12
  window.location.reload();
@@ -0,0 +1,100 @@
1
+ // = require tribute
2
+
3
+ $(() => {
4
+ const $mentionContainer = $(".js-mentions");
5
+ const nodatafound = $mentionContainer.attr("data-noresults");
6
+ const sources = [];
7
+
8
+ // EXAMPLE DATA
9
+ // tag & name properties are mandatory
10
+ //
11
+ // sources = [{
12
+ // "tag": "barrera",
13
+ // "name": "Collins Franklin",
14
+ // },
15
+ // {
16
+ // "tag": "woods",
17
+ // "name": "Nadine Buck",
18
+ // },
19
+ // ...]
20
+
21
+ // Listener for the event triggered by quilljs
22
+ let cursor = "";
23
+ $mentionContainer.on("quill-position", function(event) {
24
+ cursor = event.detail.index;
25
+ });
26
+
27
+ // tribute.js docs - http://github.com/zurb/tribute
28
+ /* global Tribute*/
29
+ let tribute = new Tribute({
30
+ values: sources,
31
+ positionMenu: false,
32
+ menuContainer: null,
33
+ fillAttr: "tag",
34
+ noMatchTemplate: () => `<li>${nodatafound}</li>`,
35
+ lookup: (item) => item.tag + item.name,
36
+ selectTemplate: function(item) {
37
+ if (typeof item === "undefined") {
38
+ return null;
39
+ }
40
+ if (this.range.isContentEditable(this.current.element)) {
41
+ // Check quill.js
42
+ if ($(this.current.element).hasClass("editor-container")) {
43
+ let quill = this.current.element.__quill;
44
+ quill.insertText(cursor - 1, `@${item.original.tag} `, Quill.sources.API);
45
+ // cursor position + nickname length + "@" sign + space
46
+ let position = cursor + item.original.tag.length + 2;
47
+
48
+ let next = 0;
49
+ if (quill.getLength() > position) {
50
+ next = position
51
+ } else {
52
+ next = quill.getLength() - 1
53
+ }
54
+ // Workaround https://github.com/quilljs/quill/issues/731
55
+ setTimeout(function () {
56
+ quill.setSelection(next, 0);
57
+ }, 500);
58
+
59
+ return ""
60
+ }
61
+ return `<span contenteditable="false">@${item.original.tag}</span>`;
62
+ }
63
+ return `@${item.original.tag}`;
64
+ },
65
+ menuItemTemplate: function(item) {
66
+ let tpl = `<strong>${item.original.tag}</strong>&nbsp;<small>${item.original.name}</small>`;
67
+ return tpl;
68
+ }
69
+ });
70
+
71
+ tribute.attach($mentionContainer);
72
+
73
+ // DOM manipulation
74
+ $mentionContainer.on("focusin", (event) => {
75
+ // Set the parent container relative to the current element
76
+ tribute.menuContainer = event.target.parentNode;
77
+ });
78
+ $mentionContainer.on("focusout", (event) => {
79
+ let $parent = $(event.target).parent();
80
+
81
+ if ($parent.hasClass("is-active")) {
82
+ $parent.removeClass("is-active");
83
+ }
84
+ });
85
+ $mentionContainer.on("input", (event) => {
86
+ let $parent = $(event.target).parent();
87
+
88
+ if (tribute.isActive) {
89
+ // We need to move the container to the wrapper selected
90
+ let $tribute = $(".tribute-container");
91
+ $tribute.appendTo($parent);
92
+ // Remove the inline styles, relative to absolute positioning
93
+ $tribute.removeAttr("style");
94
+ // Parent adaptation
95
+ $parent.addClass("is-active");
96
+ } else {
97
+ $parent.removeClass("is-active");
98
+ }
99
+ });
100
+ });
@@ -0,0 +1,12 @@
1
+ // = require tagsinput
2
+
3
+ $(() => {
4
+ const $tagContainer = $(".js-tags-container");
5
+
6
+ // Initialize
7
+ $tagContainer.tagsinput({
8
+ tagClass: "input__tag",
9
+ trimValue: true
10
+ });
11
+
12
+ });
@@ -7,18 +7,18 @@
7
7
 
8
8
  L.DivIcon.SVGIcon.DecidimIcon = L.DivIcon.SVGIcon.extend({
9
9
  options: {
10
- fillColor: '#ef604d',
10
+ fillColor: "#ef604d",
11
11
  opacity: 0
12
12
  },
13
13
  _createPathDescription: function() {
14
- return 'M14 1.17a11.685 11.685 0 0 0-11.685 11.685c0 11.25 10.23 20.61 10.665 21a1.5 1.5 0 0 0 2.025 0c0.435-.435 10.665-9.81 10.665-21A11.685 11.685 0 0 0 14 1.17Zm0 17.415A5.085 5.085 0 1 1 19.085 13.5 5.085 5.085 0 0 1 14 18.585Z';
14
+ return "M14 1.17a11.685 11.685 0 0 0-11.685 11.685c0 11.25 10.23 20.61 10.665 21a1.5 1.5 0 0 0 2.025 0c0.435-.435 10.665-9.81 10.665-21A11.685 11.685 0 0 0 14 1.17Zm0 17.415A5.085 5.085 0 1 1 19.085 13.5 5.085 5.085 0 0 1 14 18.585Z";
15
15
  },
16
16
  _createCircle: function() {
17
17
  return ""
18
18
  }
19
19
  });
20
20
 
21
- const popupTemplateId = 'marker-popup';
21
+ const popupTemplateId = "marker-popup";
22
22
  $.template(popupTemplateId, $(`#${popupTemplateId}`).html());
23
23
 
24
24
  const addMarkers = (markersData, markerClusters, map) => {
@@ -28,7 +28,7 @@ const addMarkers = (markersData, markerClusters, map) => {
28
28
  let marker = L.marker([markerData.latitude, markerData.longitude], {
29
29
  icon: new L.DivIcon.SVGIcon.DecidimIcon()
30
30
  });
31
- let node = document.createElement('div');
31
+ let node = document.createElement("div");
32
32
 
33
33
  $.tmpl(popupTemplateId, markerData).appendTo(node);
34
34
 
@@ -36,7 +36,7 @@ const addMarkers = (markersData, markerClusters, map) => {
36
36
  maxwidth: 640,
37
37
  minWidth: 500,
38
38
  keepInView: true,
39
- className: 'map-info'
39
+ className: "map-info"
40
40
  }).openPopup();
41
41
 
42
42
  markerClusters.addLayer(marker);
@@ -80,12 +80,12 @@ window.Decidim.currentMap = null;
80
80
  window.Decidim.mapConfiguration = {};
81
81
 
82
82
  $(() => {
83
- const mapId = 'map';
83
+ const mapId = "map";
84
84
  const $map = $(`#${mapId}`);
85
85
 
86
- const markersData = $map.data('markers-data');
87
- const hereAppId = $map.data('here-app-id');
88
- const hereAppCode = $map.data('here-app-code');
86
+ const markersData = $map.data("markers-data");
87
+ const hereAppId = $map.data("here-app-id");
88
+ const hereAppCode = $map.data("here-app-code");
89
89
 
90
90
  window.Decidim.mapConfiguration = { hereAppId, hereAppCode };
91
91
 
@@ -1,30 +1,30 @@
1
1
  $(() => {
2
- const $wrapper = $('#notifications');
3
- const $section = $wrapper.find('section#notifications-list');
4
- const $noNotificationsText = $wrapper.find('.empty-notifications');
5
- const $pagination = $wrapper.find('ul.pagination');
2
+ const $wrapper = $("#notifications");
3
+ const $section = $wrapper.find("section#notifications-list");
4
+ const $noNotificationsText = $wrapper.find(".empty-notifications");
5
+ const $pagination = $wrapper.find("ul.pagination");
6
6
  const FADEOUT_TIME = 500;
7
7
 
8
- const anyNotifications = () => $wrapper.find('.card--list__item').length > 0;
8
+ const anyNotifications = () => $wrapper.find(".card--list__item").length > 0;
9
9
  const emptyNotifications = () => {
10
10
  if (!anyNotifications()) {
11
11
  $section.remove();
12
- $noNotificationsText.removeClass('hide');
12
+ $noNotificationsText.removeClass("hide");
13
13
  }
14
14
  };
15
15
 
16
- $section.on('click', '.mark-as-read-button', (event) => {
17
- const $item = $(event.target).parents('.card--list__item');
16
+ $section.on("click", ".mark-as-read-button", (event) => {
17
+ const $item = $(event.target).parents(".card--list__item");
18
18
  $item.fadeOut(FADEOUT_TIME, () => {
19
19
  $item.remove();
20
20
  emptyNotifications();
21
21
  });
22
22
  });
23
23
 
24
- $wrapper.on('click', '.mark-all-as-read-button', () => {
24
+ $wrapper.on("click", ".mark-all-as-read-button", () => {
25
25
  $section.fadeOut(FADEOUT_TIME, () => {
26
26
  $pagination.remove();
27
- $wrapper.find('.card--list__item').remove();
27
+ $wrapper.find(".card--list__item").remove();
28
28
  emptyNotifications();
29
29
  });
30
30
  });
@@ -6,16 +6,16 @@ $(() => {
6
6
  $(document).on("click", ".order-by a", (event) => {
7
7
  const $target = $(event.target);
8
8
 
9
- $target.parents('.menu').find('a:first').text($target.text());
9
+ $target.parents(".menu").find("a:first").text($target.text());
10
10
 
11
- pushState($target.attr('href'));
11
+ pushState($target.attr("href"));
12
12
  })
13
13
 
14
14
  registerCallback("orders", () => {
15
15
  const url = window.location.toString();
16
16
  const match = url.match(/order=([^&]*)/);
17
- const $orderMenu = $('.order-by .menu');
18
- let order = $orderMenu.find('.menu a:first').data('order');
17
+ const $orderMenu = $(".order-by .menu");
18
+ let order = $orderMenu.find(".menu a:first").data("order");
19
19
 
20
20
  if (match) {
21
21
  order = match[1];
@@ -23,6 +23,6 @@ $(() => {
23
23
 
24
24
  const linkText = $orderMenu.find(`.menu a[data-order="${order}"]`).text();
25
25
 
26
- $orderMenu.find('a:first').text(linkText);
26
+ $orderMenu.find("a:first").text(linkText);
27
27
  });
28
28
  });
@@ -1,10 +1,10 @@
1
1
  $(() => {
2
- const $userRegistrationForm = $('.register-form');
3
- const $userGroupFields = $userRegistrationForm.find('.user-group-fields');
2
+ const $userRegistrationForm = $(".register-form");
3
+ const $userGroupFields = $userRegistrationForm.find(".user-group-fields");
4
4
  const inputSelector = 'input[name="user[sign_up_as]"]';
5
5
 
6
6
  const setGroupFieldsVisibility = (value) => {
7
- if (value === 'user') {
7
+ if (value === "user") {
8
8
  $userGroupFields.hide();
9
9
  } else {
10
10
  $userGroupFields.show();
@@ -13,7 +13,7 @@ $(() => {
13
13
 
14
14
  setGroupFieldsVisibility($userRegistrationForm.find(`${inputSelector}:checked`).val());
15
15
 
16
- $userRegistrationForm.on('change', inputSelector, (event) => {
16
+ $userRegistrationForm.on("change", inputSelector, (event) => {
17
17
  const value = event.target.value;
18
18
 
19
19
  setGroupFieldsVisibility(value);
@@ -10,5 +10,5 @@ window.addEventListener("message", (event) => {
10
10
 
11
11
  $(() => {
12
12
  // Set target blank for all widget links.
13
- $('a').attr('target', '_blank');
13
+ $("a").attr("target", "_blank");
14
14
  });
@@ -14,6 +14,9 @@
14
14
  // = require decidim/account_form
15
15
  // = require decidim/data_picker
16
16
  // = require decidim/append_redirect_url_to_modals
17
+ // = require decidim/editor
18
+ // = require decidim/input_tags
19
+ // = require decidim/input_mentions
17
20
 
18
21
  /* globals svg4everybody */
19
22
 
@@ -23,9 +26,16 @@ $(() => {
23
26
  if (window.Decidim.DataPicker) {
24
27
  window.theDataPicker = new window.Decidim.DataPicker($(".data-picker"));
25
28
  }
29
+
26
30
  $(document).foundation();
31
+
27
32
  svg4everybody();
33
+
28
34
  if (window.Decidim.formDatePicker) {
29
35
  window.Decidim.formDatePicker();
30
36
  }
37
+
38
+ if (window.Decidim.quillEditor) {
39
+ window.Decidim.quillEditor();
40
+ }
31
41
  });
@@ -1,6 +1,6 @@
1
1
  @import "decidim";
2
2
  @import "editor";
3
3
 
4
- <% Decidim.feature_manifests.map(&:stylesheet).compact.each do |stylesheet| %>
4
+ <% Decidim.component_manifests.map(&:stylesheet).compact.each do |stylesheet| %>
5
5
  @import "<%= stylesheet %>";
6
6
  <% end %>
@@ -38,6 +38,43 @@ $author-data-color: $muted;
38
38
  padding-left: 25px;
39
39
  }
40
40
 
41
+ .author-data--big{
42
+ padding-left: 0;
43
+
44
+ .author-data__main{
45
+ margin: 0;
46
+ }
47
+
48
+ .author--flex,
49
+ .author__name--container{
50
+ display: flex;
51
+ align-items: center;
52
+ }
53
+
54
+ .author__avatar{
55
+ position: relative;
56
+ margin-left: 0;
57
+
58
+ img{
59
+ max-width: none;
60
+ margin-top: auto;
61
+ width: rem-calc(54);
62
+ }
63
+ }
64
+
65
+ .author__name{
66
+ @extend .heading5;
67
+ }
68
+
69
+ .author__nickname{
70
+ font-size: rem-calc(15);
71
+ }
72
+
73
+ .author__verified{
74
+ margin-left: $global-margin / 4;
75
+ }
76
+ }
77
+
41
78
  .author-data--nopadding{
42
79
  padding-left: 0;
43
80
  }
@@ -51,6 +88,7 @@ $author-data-color: $muted;
51
88
  display: inline-block;
52
89
 
53
90
  > button,
91
+ > span,
54
92
  > a{
55
93
  margin-right: 1rem;
56
94
  }
@@ -131,4 +169,5 @@ a:hover .author__name{
131
169
  .author__verified{
132
170
  display: inline-block;
133
171
  vertical-align: middle;
172
+ color: $primary;
134
173
  }