decidim-posts 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE-AGPLv3.txt +661 -0
- data/README.md +40 -0
- data/Rakefile +9 -0
- data/app/cells/decidim/posts/comments/add_comment.erb +15 -0
- data/app/cells/decidim/posts/comments/comments_loading.erb +1 -0
- data/app/cells/decidim/posts/comments/order_control.erb +13 -0
- data/app/cells/decidim/posts/comments/show.erb +31 -0
- data/app/cells/decidim/posts/comments_cell.rb +158 -0
- data/app/cells/decidim/posts/content_blocks/posts/show.erb +3 -0
- data/app/cells/decidim/posts/content_blocks/posts_cell.rb +50 -0
- data/app/cells/decidim/posts/content_blocks/posts_settings_form/show.erb +3 -0
- data/app/cells/decidim/posts/content_blocks/posts_settings_form_cell.rb +23 -0
- data/app/cells/decidim/posts/feed_dropdown_metadata_cell.rb +19 -0
- data/app/cells/decidim/posts/meeting/show.erb +65 -0
- data/app/cells/decidim/posts/meeting_cell.rb +44 -0
- data/app/cells/decidim/posts/post/show.erb +30 -0
- data/app/cells/decidim/posts/post/survey.erb +68 -0
- data/app/cells/decidim/posts/post_attachments/show.erb +40 -0
- data/app/cells/decidim/posts/post_attachments_cell.rb +17 -0
- data/app/cells/decidim/posts/post_cell.rb +44 -0
- data/app/cells/decidim/posts/post_comment/show.erb +17 -0
- data/app/cells/decidim/posts/post_comment_cell.rb +49 -0
- data/app/cells/decidim/posts/post_header/show.erb +53 -0
- data/app/cells/decidim/posts/post_header_cell.rb +79 -0
- data/app/cells/decidim/posts/post_host/show.erb +74 -0
- data/app/cells/decidim/posts/post_host_cell.rb +73 -0
- data/app/cells/decidim/posts/post_metadata/show.erb +9 -0
- data/app/cells/decidim/posts/post_metadata_cell.rb +67 -0
- data/app/cells/decidim/posts/reaction_menu/show.erb +18 -0
- data/app/cells/decidim/posts/reaction_menu/styles.erb +7 -0
- data/app/cells/decidim/posts/reaction_menu_cell.rb +26 -0
- data/app/cells/decidim/posts/reactions/show.erb +8 -0
- data/app/cells/decidim/posts/reactions_cell.rb +22 -0
- data/app/commands/decidim/posts/add_reaction_to_resource.rb +90 -0
- data/app/commands/decidim/posts/create_post.rb +112 -0
- data/app/commands/decidim/posts/destroy_post.rb +20 -0
- data/app/commands/decidim/posts/remove_reaction_from_resource.rb +41 -0
- data/app/commands/decidim/posts/update_post.rb +72 -0
- data/app/controllers/concerns/decidim/posts/admin/filterable.rb +46 -0
- data/app/controllers/concerns/decidim/posts/reactionable.rb +31 -0
- data/app/controllers/decidim/posts/admin/application_controller.rb +26 -0
- data/app/controllers/decidim/posts/admin/posts_controller.rb +93 -0
- data/app/controllers/decidim/posts/application_controller.rb +18 -0
- data/app/controllers/decidim/posts/meetings_controller.rb +176 -0
- data/app/controllers/decidim/posts/posts_controller.rb +202 -0
- data/app/controllers/decidim/posts/reactions_controller.rb +54 -0
- data/app/controllers/decidim/posts/user_answers_controller.rb +36 -0
- data/app/events/decidim/posts/resource_reacted_event.rb +38 -0
- data/app/forms/decidim/posts/answer_form.rb +13 -0
- data/app/forms/decidim/posts/post_form.rb +121 -0
- data/app/forms/decidim/posts/question_form.rb +20 -0
- data/app/helpers/decidim/posts/admin/posts_helper.rb +8 -0
- data/app/helpers/decidim/posts/application_helper.rb +20 -0
- data/app/helpers/decidim/posts/post_cells_helper.rb +35 -0
- data/app/helpers/decidim/posts/posts_helper.rb +34 -0
- data/app/helpers/decidim/posts/reaction_helper.rb +22 -0
- data/app/models/decidim/posts/answer.rb +13 -0
- data/app/models/decidim/posts/application_record.rb +10 -0
- data/app/models/decidim/posts/post.rb +116 -0
- data/app/models/decidim/posts/question.rb +17 -0
- data/app/models/decidim/posts/reaction.rb +22 -0
- data/app/models/decidim/posts/reaction_type.rb +13 -0
- data/app/models/decidim/posts/user_answer.rb +11 -0
- data/app/packs/entrypoints/decidim_posts.js +5 -0
- data/app/packs/entrypoints/decidim_posts.scss +1 -0
- data/app/packs/images/decidim/posts/icon.svg +1 -0
- data/app/packs/src/decidim/posts/carousel.js +112 -0
- data/app/packs/src/decidim/posts/host_status.js +75 -0
- data/app/packs/src/decidim/posts/newFeeds.js +98 -0
- data/app/packs/src/decidim/posts/posts.js +272 -0
- data/app/packs/src/decidim/posts/submenu.js +46 -0
- data/app/packs/src/decidim/posts/survey.js +94 -0
- data/app/packs/stylesheets/decidim/posts/_variables.scss +10 -0
- data/app/packs/stylesheets/decidim/posts/posts.scss +415 -0
- data/app/permissions/decidim/posts/admin/permissions.rb +23 -0
- data/app/permissions/decidim/posts/permissions.rb +101 -0
- data/app/presenters/decidim/posts/post_presenter.rb +45 -0
- data/app/views/decidim/posts/admin/posts/_post-tr.html.erb +45 -0
- data/app/views/decidim/posts/admin/posts/index.html.erb +54 -0
- data/app/views/decidim/posts/meetings/edit.html.erb +24 -0
- data/app/views/decidim/posts/posts/_admin_options.html.erb +30 -0
- data/app/views/decidim/posts/posts/_attachment.html.erb +24 -0
- data/app/views/decidim/posts/posts/_edit_form.html.erb +16 -0
- data/app/views/decidim/posts/posts/_feed.html.erb +8 -0
- data/app/views/decidim/posts/posts/_form.html.erb +104 -0
- data/app/views/decidim/posts/posts/_index.html.erb +49 -0
- data/app/views/decidim/posts/posts/_meeting_form.erb +18 -0
- data/app/views/decidim/posts/posts/_new.html.erb +33 -0
- data/app/views/decidim/posts/posts/_new_survey.html.erb +20 -0
- data/app/views/decidim/posts/posts/_new_survey_answer.html.erb +11 -0
- data/app/views/decidim/posts/posts/_new_survey_question.html.erb +17 -0
- data/app/views/decidim/posts/posts/_post.html.erb +11 -0
- data/app/views/decidim/posts/posts/_post_form.html.erb +5 -0
- data/app/views/decidim/posts/posts/_sidebar.html.erb +36 -0
- data/app/views/decidim/posts/posts/edit.html.erb +34 -0
- data/app/views/decidim/posts/posts/index.html.erb +1 -0
- data/app/views/decidim/posts/posts/show.html.erb +12 -0
- data/app/views/decidim/posts/reactions/_update_buttons_and_counters.html.erb +1 -0
- data/config/assets.rb +9 -0
- data/config/i18n-tasks.yml +10 -0
- data/config/locales/bs.yml +215 -0
- data/config/locales/de.yml +217 -0
- data/config/locales/en.yml +216 -0
- data/config/locales/hr.yml +219 -0
- data/config/locales/it.yml +215 -0
- data/config/locales/sr.yml +220 -0
- data/config/locales/tr.yml +219 -0
- data/lib/decidim/posts/admin.rb +10 -0
- data/lib/decidim/posts/admin_engine.rb +25 -0
- data/lib/decidim/posts/component.rb +59 -0
- data/lib/decidim/posts/content_blocks/content_blocks_homepage.rb +19 -0
- data/lib/decidim/posts/engine.rb +84 -0
- data/lib/decidim/posts/test/factories.rb +14 -0
- data/lib/decidim/posts/version.rb +9 -0
- data/lib/decidim/posts.rb +13 -0
- metadata +183 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<% if participatory_space.admins.exists?(id: current_user.id) %>
|
|
2
|
+
<div class="bg-feeds-bg p-2 rounded-md flex flex-col">
|
|
3
|
+
<div class="toggle__switch-trigger p-2">
|
|
4
|
+
<%= form.label :highlighted, '', class: 'toggle__switch-toggle' do %>
|
|
5
|
+
<span>
|
|
6
|
+
<%= form.check_box :highlighted, label: false %>
|
|
7
|
+
<span class="toggle__switch-toggle-content"></span>
|
|
8
|
+
<%= icon "check-line", class: "toggle__switch-toggle-icon" %>
|
|
9
|
+
<%= icon "close-line", class: "toggle__switch-toggle-icon" %>
|
|
10
|
+
</span>
|
|
11
|
+
<span class="toggle__switch-trigger-text pl-2 font-bold">
|
|
12
|
+
<%= t("decidim.components.posts.newFeed.highlighted") %>
|
|
13
|
+
</span>
|
|
14
|
+
<% end %>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="toggle__switch-trigger p-2">
|
|
17
|
+
<%= form.label :fixed, '', class: 'toggle__switch-toggle' do %>
|
|
18
|
+
<span>
|
|
19
|
+
<%= form.check_box :fixed, label: false %>
|
|
20
|
+
<span class="toggle__switch-toggle-content"></span>
|
|
21
|
+
<%= icon "check-line", class: "toggle__switch-toggle-icon" %>
|
|
22
|
+
<%= icon "close-line", class: "toggle__switch-toggle-icon" %>
|
|
23
|
+
</span>
|
|
24
|
+
<span class="toggle__switch-trigger-text pl-2 font-bold">
|
|
25
|
+
<%= t("decidim.components.posts.newFeed.fixed") %>
|
|
26
|
+
</span>
|
|
27
|
+
<% end %>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
<% end %>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<div class="posts__post_newElement_Media">
|
|
2
|
+
<%= form.upload :documents,
|
|
3
|
+
titled: true,
|
|
4
|
+
label: false,
|
|
5
|
+
button_label: t("decidim.forms.upload.labels.add_file"),
|
|
6
|
+
button_edit_label: I18n.t("decidim.forms.upload.labels.replace"),
|
|
7
|
+
multiple: true,
|
|
8
|
+
# modal_only: false,
|
|
9
|
+
# show_current: true,
|
|
10
|
+
#label: false,
|
|
11
|
+
# id: field_id,
|
|
12
|
+
# disabled:,
|
|
13
|
+
# attribute:,
|
|
14
|
+
# resource_name: @object_name,
|
|
15
|
+
# resource_class: options[:resource_class]&.to_s || resource_class(attribute),
|
|
16
|
+
# show_current: true,
|
|
17
|
+
# max_file_size:,
|
|
18
|
+
# help: help_messages,
|
|
19
|
+
# label: label_for(attribute),
|
|
20
|
+
# button_label:,
|
|
21
|
+
# button_edit_label: I18n.t("decidim.forms.upload.labels.replace"),
|
|
22
|
+
button_class: "button button__sm button__transparent-primary w-full",
|
|
23
|
+
required: false %>
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<%= decidim_form_for(@form, url: Decidim::EngineRouter.main_proxy(@post.component).post_path(@post), method: :patch, html: { class: "posts_form new_post" }) do |form| %>
|
|
2
|
+
<div class="form__wrapper p-0">
|
|
3
|
+
<%#= render partial: "decidim/posts/posts/post_form", locals: { form: form } %>
|
|
4
|
+
<%= form.hidden_field :category, id: "post_edit_category" %>
|
|
5
|
+
<%= form.label :body do %>
|
|
6
|
+
<span><%= t("decidim.components.posts.newFeed.text") %></span>
|
|
7
|
+
<%= form.text_area :body, rows: 4, 'aria-required': true, label: false %>
|
|
8
|
+
<% end %>
|
|
9
|
+
</div>
|
|
10
|
+
<%= render partial: "decidim/posts/posts/attachment.html", locals: { form: form } %>
|
|
11
|
+
<%= render partial: "decidim/posts/posts/admin_options.html", locals: { form: form, participatory_space: @post.component.participatory_space } %>
|
|
12
|
+
<div class="form__wrapper-block flex-col-reverse md:flex-row justify-between">
|
|
13
|
+
<%= link_to t("decidim.components.posts.newFeed.cancel"), '/', class: "button button__sm button__transparent-secondary" %>
|
|
14
|
+
<%= form.submit "#{t("decidim.components.posts.newFeed.action")} #{icon('send-plane-line')}".html_safe, data: { disable: true }, class: "sndBtn button button__sm button__transparent-primary" %>
|
|
15
|
+
</div>
|
|
16
|
+
<% end %>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<% objects.each do |post| %>
|
|
2
|
+
<%= render partial: "post", locals: { post: post } %>
|
|
3
|
+
<% end %>
|
|
4
|
+
|
|
5
|
+
<% if objects.respond_to?(:next_page) && @non_fixed_objects.next_page %>
|
|
6
|
+
<div id="page_<%= @non_fixed_objects.next_page %>"></div>
|
|
7
|
+
<%= link_to t("decidim.posts.posts.load_more"), "#page_#{@non_fixed_objects.next_page}", id: "loadMoreBtn", class: "card__grid posts__post posts__post_newElement flex-row justify-between", data: { page: @non_fixed_objects.next_page, url: load_more_posts_path(request.query_parameters.merge(page: @non_fixed_objects.next_page)) } %>
|
|
8
|
+
<% end %>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<% if(posts_component = ((defined?(current_component) && current_component.manifest_name == "posts") ? current_component : Decidim::Component.where(manifest_name: "posts").select {|c| c.organization == current_organization }.first)) %>
|
|
2
|
+
<% activefilter = if current_user.admin? && params[:filter_post_category].blank?
|
|
3
|
+
'host'
|
|
4
|
+
else
|
|
5
|
+
params[:filter_post_category]
|
|
6
|
+
end %>
|
|
7
|
+
<div id="posts__post_newElement" class="posts__post_newElement_modal" role="dialog" aria-modal="true" aria-label="<%= t("decidim.components.posts.newFeed.title") %>" data-active-feed="" data-active-filter="<%= activefilter %>">
|
|
8
|
+
<div class="posts__post_newElement_modal_frame">
|
|
9
|
+
<div class="posts__post_newElement_modal_content">
|
|
10
|
+
<div class="close-button flex justify-end pb-2">
|
|
11
|
+
<button class="btn circle posts__post_newElement-closer" type="button">
|
|
12
|
+
<%= icon "close-circle-line" %>
|
|
13
|
+
<span class="sr-only"><%= t("decidim.components.posts.newFeed.close") %></span>
|
|
14
|
+
</button>
|
|
15
|
+
</div>
|
|
16
|
+
<% if current_user %>
|
|
17
|
+
<div class="category-selection">
|
|
18
|
+
<% filters = [
|
|
19
|
+
{ filter: 'post', icon: 'home-5-line' },
|
|
20
|
+
{ filter: 'sharecare', icon: 'shake-hands-line' },
|
|
21
|
+
{ filter: 'host', icon: 'home-gear-line' },
|
|
22
|
+
{ filter: 'survey', icon: 'draft-line' },
|
|
23
|
+
{ filter: 'calendar', icon: 'calendar-line' }
|
|
24
|
+
] %>
|
|
25
|
+
<% filters.each do |filter| %>
|
|
26
|
+
<button type="button" class="button button__sm button__transparent-primary" data-category="<%= filter[:filter] %>" aria-pressed="false"><%= t("decidim.components.posts.filter.#{filter[:filter]}_singular") %></button>
|
|
27
|
+
<% end %>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<% target_participatory_space = posts_component.participatory_space %>
|
|
31
|
+
<%
|
|
32
|
+
context = {
|
|
33
|
+
current_organization: @controller.try(:current_organization),
|
|
34
|
+
current_component: @controller.try(:current_component),
|
|
35
|
+
current_user: @controller.try(:current_user),
|
|
36
|
+
current_participatory_space: @controller.try(:current_participatory_space)
|
|
37
|
+
}
|
|
38
|
+
%>
|
|
39
|
+
<div id="posts__post_newElement_Form-LiveRegion" class="sr-only" aria-live="polite"></div>
|
|
40
|
+
<div id="posts__post_newElement_Meeting" aria-live="polite">
|
|
41
|
+
<%= decidim_form_for(Decidim::Meetings::MeetingForm.from_params(params).with_context(context), url: Decidim::EngineRouter.main_proxy(posts_component).meetings_path, html: { class: "meetings_form new_meeting" }) do |form| %>
|
|
42
|
+
<div class="form__wrapper p-0 gap-4">
|
|
43
|
+
<%= render partial: "decidim/posts/posts/meeting_form", locals: { form: form } %>
|
|
44
|
+
</div>
|
|
45
|
+
<div class="form__wrapper-block flex-col-reverse md:flex-row justify-between">
|
|
46
|
+
<%= form.submit "#{t("decidim.components.posts.newFeed.action")} #{icon('send-plane-line')}".html_safe, class: "sndBtn button button__sm button__transparent-primary", data: { disable: true } %>
|
|
47
|
+
</div>
|
|
48
|
+
<% end %>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div id="posts__post_newElement_Post" aria-live="polite">
|
|
52
|
+
<%= decidim_form_for(Decidim::Posts::PostForm.from_params(params).with_context(context), url: Decidim::EngineRouter.main_proxy(posts_component).posts_path, html: { class: "posts_form new_post" }) do |form| %>
|
|
53
|
+
<div class="form__wrapper p-0">
|
|
54
|
+
<%= render partial: "decidim/posts/posts/post_form", locals: { form: form } %>
|
|
55
|
+
</div>
|
|
56
|
+
<div id="extraFieldsForSurvey" class="posts__post_newElement_Xtra posts__post_newSurvey" aria-live="polite">
|
|
57
|
+
<%= render partial: 'decidim/posts/posts/new_survey.html', locals: { form: form } %>
|
|
58
|
+
</div>
|
|
59
|
+
<%= render partial: "decidim/posts/posts/attachment.html", locals: { form: form } %>
|
|
60
|
+
<%= render partial: "decidim/posts/posts/admin_options.html", locals: { form: form, participatory_space: target_participatory_space } %>
|
|
61
|
+
<div class="form__wrapper-block flex-col-reverse md:flex-row justify-between">
|
|
62
|
+
<%= form.submit "#{t("decidim.components.posts.newFeed.action")} #{icon('send-plane-line')}".html_safe, data: { disable: true }, class: "sndBtn button button__sm button__transparent-primary" %>
|
|
63
|
+
</div>
|
|
64
|
+
<% end %>
|
|
65
|
+
</div>
|
|
66
|
+
<% else %>
|
|
67
|
+
<div class="form__wrapper p-0">
|
|
68
|
+
<div class="flex flex-col items-center">
|
|
69
|
+
<p class="text-center">
|
|
70
|
+
<%= t("decidim.components.posts.newFeed.login") %>
|
|
71
|
+
</p>
|
|
72
|
+
<%= link_to t("decidim.components.posts.newFeed.loginLink"), decidim.new_user_session_path, class: "button button__sm button__primary" %>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
<% end %>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
<% end %>
|
|
80
|
+
|
|
81
|
+
<script>
|
|
82
|
+
window.translations = {
|
|
83
|
+
newSurvey: {
|
|
84
|
+
questionTitle : "<%= t('decidim.components.posts.newFeed.newSurvey.questionTitle') %>",
|
|
85
|
+
answerType : "<%= t('decidim.components.posts.newFeed.newSurvey.answerType') %>",
|
|
86
|
+
multipleChoice : "<%= t('decidim.components.posts.newFeed.newSurvey.multipleChoice') %>",
|
|
87
|
+
singleChoice : "<%= t('decidim.components.posts.newFeed.newSurvey.singleChoice') %>",
|
|
88
|
+
newAnswer : "<%= t('decidim.components.posts.newFeed.newSurvey.newAnswer') %>",
|
|
89
|
+
newQuestionResponse : "<%= t('decidim.components.posts.newFeed.newSurvey.newQuestionResponse') %>",
|
|
90
|
+
newAnswerResponse : "<%= t('decidim.components.posts.newFeed.newSurvey.newAnswerResponse') %>",
|
|
91
|
+
},
|
|
92
|
+
newFeedLiveRegion: {
|
|
93
|
+
calendar : "<%= t('decidim.components.posts.newFeed.aria-live.calendar') %>",
|
|
94
|
+
post : "<%= t('decidim.components.posts.newFeed.aria-live.post') %>",
|
|
95
|
+
survey : "<%= t('decidim.components.posts.newFeed.aria-live.survey') %>",
|
|
96
|
+
sharecare : "<%= t('decidim.components.posts.newFeed.aria-live.sharecare') %>",
|
|
97
|
+
host : "<%= t('decidim.components.posts.newFeed.aria-live.host') %>",
|
|
98
|
+
},
|
|
99
|
+
dialog: {
|
|
100
|
+
dialogBodyMsg : '<%= t('decidim.posts.posts.host.status.dialogBodyMsg') %>',
|
|
101
|
+
dialogBodyResponse : '<%= t('decidim.posts.posts.host.status.dialogBodyResponse') %>',
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
</script>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<main class="feeds__main home">
|
|
2
|
+
<!-- This is the sidebar that appears on the right side of the page -->
|
|
3
|
+
<%= render partial: "decidim/posts/posts/sidebar" %>
|
|
4
|
+
<div class="feeds__container">
|
|
5
|
+
<div class="feeds__body">
|
|
6
|
+
<div class="card__grid-home w-full lg:grid-cols-8 xl:grid-cols-12 gap-6">
|
|
7
|
+
<% if current_user %>
|
|
8
|
+
<div class="card__grid posts__post posts__post_newElement flex-row justify-between">
|
|
9
|
+
<button class="btn circle posts__post_newElement-opener" aria-expanded="false" aria-controls="posts__post_newElement" aria-haspopup="posts__post_newElement" type="button">
|
|
10
|
+
<%= icon "close-circle-line" %>
|
|
11
|
+
<span class="sr-only"><%= t("decidim.components.posts.newFeed.openButton") %></span>
|
|
12
|
+
</button>
|
|
13
|
+
</div>
|
|
14
|
+
<% end %>
|
|
15
|
+
<%= cell("decidim/posts/reaction_menu", @post).(:styles) %>
|
|
16
|
+
<%= render partial: "decidim/posts/posts/feed", locals: { objects: @fixed_posts } %>
|
|
17
|
+
<%= render partial: "decidim/posts/posts/feed", locals: { objects: @non_fixed_objects } %>
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<dialog id="confirmationModal" class="p-4 shadow-md rounded-md ring-1 ring-feeds-host" aria-labelledby="confirmationModal__Label">
|
|
24
|
+
<div class="flex flex-col gap-4">
|
|
25
|
+
<h2 id="confirmationModal__Label" class="text-center text-lg font-bold"><%=t('decidim.posts.posts.host.status.dialogTitle')%></h2>
|
|
26
|
+
<p class="confirmationModal__response" aria-live="assertive">
|
|
27
|
+
<%=t('decidim.posts.posts.host.status.dialogBodyMsg')%>
|
|
28
|
+
<br>
|
|
29
|
+
<%=t('decidim.posts.posts.host.status.dialogBodyMsgComments')%>
|
|
30
|
+
</p>
|
|
31
|
+
<div class="confirmationModal__buttons flex p-4 gap-4 justify-center">
|
|
32
|
+
<button id="confirmationModal__confirmButton" class="button button__sm button__transparent-primary">
|
|
33
|
+
<%= t('decidim.posts.posts.host.status.confirm') %>
|
|
34
|
+
<%= icon('check-line') %>
|
|
35
|
+
</button>
|
|
36
|
+
<button id="confirmationModal__cancelButton" class="button button__sm button__transparent-primary">
|
|
37
|
+
<%= t('decidim.posts.posts.host.status.cancel') %>
|
|
38
|
+
<%= icon('close-line') %>
|
|
39
|
+
</button>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</dialog>
|
|
43
|
+
<!-- In case the Module Decidim FeedsUi is present, the form will be installed in the footer of the application -->
|
|
44
|
+
<% unless defined?(Decidim::FeedsUi) %>
|
|
45
|
+
<%= render partial: "decidim/posts/posts/form.html" %>
|
|
46
|
+
<%= append_javascript_pack_tag "decidim_feeds" %>
|
|
47
|
+
<% end %>
|
|
48
|
+
</div>
|
|
49
|
+
</main>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<% if respond_to?(:text_editor_for) %>
|
|
2
|
+
<%= form.hidden_field :type_of_meeting, value: 'in_person' %>
|
|
3
|
+
<%= form.hidden_field :registration_type, value: 'on_this_platform' %>
|
|
4
|
+
<%= form.hidden_field :available_slots, value: '0' %>
|
|
5
|
+
<%= form.hidden_field :registration_terms, value: 'none' %>
|
|
6
|
+
<%= form.text_field :title, autofocus: true, class: "js-hashtags", hashtaggable: true %>
|
|
7
|
+
<%= text_editor_for(form, :description, hashtaggable: true) %>
|
|
8
|
+
<%= form.text_area :location %>
|
|
9
|
+
<%= form.datetime_field :start_time %>
|
|
10
|
+
<%= form.datetime_field :end_time %>
|
|
11
|
+
<%= form.select(
|
|
12
|
+
:user_group_id,
|
|
13
|
+
Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.map { |g| [g.name, g.id] },
|
|
14
|
+
prompt: current_user.name,
|
|
15
|
+
label: t(".create_as")
|
|
16
|
+
) %>
|
|
17
|
+
<%= append_javascript_pack_tag "decidim_meetings" %>
|
|
18
|
+
<% end %>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<form id="newElementForm">
|
|
2
|
+
<label for="body" class="sr-only"><%= t("decidim.components.posts.newFeed.text") %></label>
|
|
3
|
+
<textarea id="body" name="body" rows="4" aria-required="true" class="posts__post_newElement_Body"></textarea>
|
|
4
|
+
<fieldset>
|
|
5
|
+
<legend class="sr-only"><%= t("decidim.components.posts.newFeed.category") %></legend>
|
|
6
|
+
<div class="postType">
|
|
7
|
+
<input type="radio" id="post" name="category" value="post" class="sr-only" checked>
|
|
8
|
+
<label for="post" class="button button__sm button__transparent-primary"><%= t("decidim.components.posts.filter.post") %></label>
|
|
9
|
+
<input type="radio" id="sharecare" name="category" value="sharecare" class="sr-only">
|
|
10
|
+
<label for="sharecare" class="button button__sm button__transparent-primary"><%= t("decidim.components.posts.filter.sharecare") %></label>
|
|
11
|
+
<input type="radio" id="host" name="category" value="host" class="sr-only">
|
|
12
|
+
<label for="host" class="button button__sm button__transparent-primary"><%= t("decidim.components.posts.filter.host") %></label>
|
|
13
|
+
<input type="radio" id="calendar" name="category" value="calendar" class="sr-only" aria-controls="extraFieldsForCalendar" aria-expanded="false">
|
|
14
|
+
<label for="calendar" class="button button__sm button__transparent-primary"><%= t("decidim.components.posts.filter.calendar") %></label>
|
|
15
|
+
<input type="radio" id="survey" name="category" value="survey" class="sr-only" aria-controls="extraFieldsForSurvey" aria-expanded="false">
|
|
16
|
+
<label for="survey" class="button button__sm button__transparent-primary"><%= t("decidim.components.posts.filter.survey") %></label>
|
|
17
|
+
</div>
|
|
18
|
+
</fieldset>
|
|
19
|
+
|
|
20
|
+
<div id="extraFieldsForCalendar" class="posts__post_newElement_Xtra posts__post_newCalender">
|
|
21
|
+
<%= render partial: 'decidim/posts/posts/new_calendar.html' %>
|
|
22
|
+
</div>
|
|
23
|
+
<div id="extraFieldsForSurvey" class="posts__post_newElement_Xtra posts__post_newSurvey">
|
|
24
|
+
<%= render partial: 'decidim/posts/posts/new_survey.html' %>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<%= render partial: 'decidim/posts/posts/attachment.html' %>
|
|
28
|
+
|
|
29
|
+
<button class="sndBtn button button__sm button__transparent-primary" type="submit">
|
|
30
|
+
<%= t("decidim.components.posts.newFeed.action") %>
|
|
31
|
+
<%= icon "send-plane-line" %>
|
|
32
|
+
</button>
|
|
33
|
+
</form>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<button class="posts__post_newSurvey-btn" type="button" aria-haspopup="true" aria-controls="posts__post_newSurvey_questionsContainer">
|
|
2
|
+
<%= t("decidim.components.posts.newFeed.newSurvey.newQuestion") %>
|
|
3
|
+
<%= icon "add-line" %>
|
|
4
|
+
</button>
|
|
5
|
+
<div id="posts__post_newSurvey_liveRegion" aria-live="polite" class="sr-only"></div>
|
|
6
|
+
<div id="posts__post_newSurvey_questionsContainer" aria-live="polite">
|
|
7
|
+
<template id="question_template">
|
|
8
|
+
<%#= form.fields_for :questions, @form.questions.new, child_index: "NEW_RECORD" do |question_form| %>
|
|
9
|
+
<%= fields_for "post[questions][NEW_RECORD]", Decidim::Posts::Question.new do |question_form| %>
|
|
10
|
+
<%= render partial: "decidim/posts/posts/new_survey_question", locals: { form: question_form } %>
|
|
11
|
+
<% end %>
|
|
12
|
+
</template>
|
|
13
|
+
<template id="answer_template">
|
|
14
|
+
<%#= form.fields_for :answers, @form.answers.new, child_index: "NEW_RECORD" do |answer_form| %>
|
|
15
|
+
<%= fields_for "post[questions][QUESTION_RECORD][answers][NEW_RECORD]", Decidim::Posts::Answer.new do |answer_form| %>
|
|
16
|
+
<%= render partial: "decidim/posts/posts/new_survey_answer", locals: { form: answer_form } %>
|
|
17
|
+
<% end %>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<div class="flex gap-2 justify-betwee items-center p-2 bg-feeds-bg">
|
|
2
|
+
<%= form.label :title, '', class: 'flex gap-2 items-center py-2 w-full' do %>
|
|
3
|
+
<%= content_tag(:span, t("decidim.components.posts.newFeed.newSurvey.answerTitle"), class: "post_label font-bold sr-only") %>
|
|
4
|
+
<%= content_tag(:span, 'ANSWER_NR.', class: "post_label font-bold answer") %>
|
|
5
|
+
<%= form.text_field :title, class: 'form-control flex-auto', label:false, placeholder: t("decidim.components.posts.newFeed.newSurvey.answerTitle") %>
|
|
6
|
+
<% end %>
|
|
7
|
+
<%= link_to "#", class:'ml-auto' do %>
|
|
8
|
+
<%= content_tag(:span, t("decidim.components.posts.newFeed.newSurvey.deleteQuestion"), class: "sr-only") %>
|
|
9
|
+
<%= icon('delete-bin-line') %>
|
|
10
|
+
<% end %>
|
|
11
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<div id="posts__post_newSurvey_Question-NEW_RECORD" class="p-2 flex flex-col gap-2">
|
|
2
|
+
<%= form.label :title, '', class: 'flex flex-col gap-2 py-2' do %>
|
|
3
|
+
<%= content_tag(:span, t("decidim.components.posts.newFeed.newSurvey.questionTitle"), class: "post_label font-bold") %>
|
|
4
|
+
<%= form.text_field :title, class: 'form-control', label: false, placeholder: t("decidim.components.posts.newFeed.newSurvey.questionTitle") %>
|
|
5
|
+
<% end %>
|
|
6
|
+
<div class="flex gap-2 justify-betwee py-2">
|
|
7
|
+
<%= form.select :question_type, options_for_select(Decidim::Posts::Question.question_types.keys.map { |key| [t("decidim.components.posts.newFeed.newSurvey.questionTypes.#{key}"), key] }), {}, class: 'form-control' %>
|
|
8
|
+
<button class="posts__post_newAnswer-btn button button__sm button__transparent-primary ml-auto" type="button" aria-haspopup="true" aria-controls="posts__post_newSurvey_answersContainer" data-question-id="NEW_RECORD">
|
|
9
|
+
<%= t("decidim.components.posts.newFeed.newSurvey.newAnswer") %>
|
|
10
|
+
<%= icon "add-line" %>
|
|
11
|
+
</button>
|
|
12
|
+
</div>
|
|
13
|
+
<div id="posts__post_newSurvey_answersContainer-NEW_RECORD" class="posts__post_newSurvey_answersContainer" aria-live="polite" ></div>
|
|
14
|
+
<small>
|
|
15
|
+
<%#= link_to t("decidim.components.posts.newFeed.newSurvey.deleteQuestion"), "#" %>
|
|
16
|
+
</small>
|
|
17
|
+
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<% if post.is_a?(Decidim::Posts::Post) %>
|
|
2
|
+
<article id="feeds_post-<%= post.id %>" class="card__grid posts__post <%= 'host-highlight' if post.highlighted %>" data-content="<%= post.category %>" <%= 'aria-live="polite"' if post.category == 'host' %>>
|
|
3
|
+
<% if post.category == 'host' %>
|
|
4
|
+
<%= cell("decidim/posts/post_host", post) %>
|
|
5
|
+
<% else %>
|
|
6
|
+
<%= cell("decidim/posts/post", post) %>
|
|
7
|
+
<% end %>
|
|
8
|
+
</article>
|
|
9
|
+
<% elsif post.is_a?(Decidim::Meetings::Meeting) %>
|
|
10
|
+
<%= cell("decidim/posts/meeting", post) %>
|
|
11
|
+
<% end %>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<aside class="posts__aside">
|
|
2
|
+
<nav aria-label="<%= t("decidim.components.posts.filter.menuAriaLabel") %>">
|
|
3
|
+
<ul>
|
|
4
|
+
<% filters = [
|
|
5
|
+
{ filter: 'all', icon: 'function-line' },
|
|
6
|
+
{ filter: 'post', icon: 'home-5-line' },
|
|
7
|
+
{ filter: 'sharecare', icon: 'shake-hands-line' },
|
|
8
|
+
{ filter: 'calendar', icon: 'calendar-line' },
|
|
9
|
+
{ filter: 'survey', icon: 'draft-line' },
|
|
10
|
+
{ filter: 'host', icon: 'home-gear-line' }
|
|
11
|
+
] %>
|
|
12
|
+
<% posts_component = current_component.manifest_name == "posts" ? current_component : current_component.participatory_space.components.find_by(manifest_name: "posts") %>
|
|
13
|
+
<% current_posts_path = Decidim::EngineRouter.main_proxy(posts_component).posts_path %>
|
|
14
|
+
<% activefilter = if current_user.admin? && params[:filter_post_category].blank?
|
|
15
|
+
'host'
|
|
16
|
+
else
|
|
17
|
+
params[:filter_post_category]
|
|
18
|
+
end %>
|
|
19
|
+
<% filters.each do |filter| %>
|
|
20
|
+
<li>
|
|
21
|
+
<%= link_to "#{current_posts_path}?filter_post_category=#{filter[:filter]}", class: (activefilter == filter[:filter] ? 'active' : ''), data: { filter: filter[:filter] }, aria: { current: (params[:filter_post_category] == filter[:filter] ? 'page' : nil) } do %>
|
|
22
|
+
<%= icon "#{filter[:icon]}" %>
|
|
23
|
+
<span><%= t("decidim.components.posts.filter.#{filter[:filter]}") %></span>
|
|
24
|
+
<% end %>
|
|
25
|
+
</li>
|
|
26
|
+
<% end %>
|
|
27
|
+
</ul>
|
|
28
|
+
</nav>
|
|
29
|
+
<div class="posts__aside__footer mb-8 mt-auto lg:mt-12">
|
|
30
|
+
<div class="w-[72px] bg-white flex flex-col items-center justify-center gap-2">
|
|
31
|
+
<% current_component.participatory_space.attachments.each do |sponsor_logo| %>
|
|
32
|
+
<%= image_tag sponsor_logo.url, class: "max-w-full max-h-full object-contain", alt: translated_attribute(sponsor_logo.title) %>
|
|
33
|
+
<% end %>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</aside>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<main class="feeds__main home">
|
|
2
|
+
<!-- This is the sidebar that appears on the right side of the page -->
|
|
3
|
+
<%= render partial: "decidim/posts/posts/sidebar" %>
|
|
4
|
+
<div class="feeds__container">
|
|
5
|
+
<div class="feeds__body">
|
|
6
|
+
<div class="card__grid-home w-full lg:grid-cols-8 xl:grid-cols-12 gap-6">
|
|
7
|
+
<div class="card__grid posts__post p-2" data-content="<%= @post.category %>">
|
|
8
|
+
<%= render "edit_form" %>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<dialog id="confirmationModal" class="p-4 shadow-md rounded-md ring-1 ring-feeds-host" aria-labelledby="confirmationModal__Label">
|
|
14
|
+
<div class="flex flex-col gap-4">
|
|
15
|
+
<h2 id="confirmationModal__Label" class="text-center text-lg font-bold">Meldungsstatus ändern</h2>
|
|
16
|
+
<p class="confirmationModal__response" aria-live="assertive">Das Status der Meldung wird geändert und die Kommentarfunktion geschlossen.</p>
|
|
17
|
+
<div class="confirmationModal__buttons flex p-4 gap-4 justify-center">
|
|
18
|
+
<button id="confirmationModal__confirmButton" class="button button__sm button__transparent-primary">
|
|
19
|
+
<%= t('decidim.posts.posts.host.status.confirm') %>
|
|
20
|
+
<%= icon('check-line') %>
|
|
21
|
+
</button>
|
|
22
|
+
<button id="confirmationModal__cancelButton" class="button button__sm button__transparent-primary">
|
|
23
|
+
<%= t('decidim.posts.posts.host.status.cancel') %>
|
|
24
|
+
<%= icon('close-line') %>
|
|
25
|
+
</button>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</dialog>
|
|
29
|
+
<!-- In case the Module Decidim FeedsUi is present, the form will be installed in the footer of the application -->
|
|
30
|
+
<% unless defined?(Decidim::FeedsUi) %>
|
|
31
|
+
<%= append_javascript_pack_tag "decidim_feeds" %>
|
|
32
|
+
<% end %>
|
|
33
|
+
</div>
|
|
34
|
+
</main>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= render "index" %>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<main class="feeds__container">
|
|
2
|
+
<div class="feeds__body">
|
|
3
|
+
<div class="card__grid-home w-full lg:grid-cols-8 xl:grid-cols-12">
|
|
4
|
+
<%= link_to Decidim::EngineRouter.main_proxy(@post.component).posts_path, class: "btn btn--secondary btn--sm" do %>
|
|
5
|
+
<%= icon "arrow-left-line" %>
|
|
6
|
+
<%= t("decidim.posts.posts.back_to_feed") %>
|
|
7
|
+
<% end %>
|
|
8
|
+
|
|
9
|
+
<%= render partial: "post", locals: { post: @post } %>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</main>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= cell("decidim/posts/reactions", resource) %>
|
data/config/assets.rb
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
base_path = File.expand_path("..", __dir__)
|
|
4
|
+
|
|
5
|
+
Decidim::Webpacker.register_path("#{base_path}/app/packs")
|
|
6
|
+
Decidim::Webpacker.register_entrypoints(
|
|
7
|
+
decidim_feeds: "#{base_path}/app/packs/entrypoints/decidim_posts.js"
|
|
8
|
+
)
|
|
9
|
+
Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/posts/posts")
|