Skip to content
Snippets Groups Projects
Commit fa68735c authored by Arnaud Levy's avatar Arnaud Levy
Browse files

static

parent d2618af9
No related branches found
No related tags found
No related merge requests found
class Communication::Block::Post < Communication::Block::Abstract
def build_git_dependencies
# TODO dépendences ajoutées avec les posts
# byebug
add_dependency category unless category.nil?
add_dependency posts
posts.each do |post|
add_dependency post.active_storage_blobs
add_dependency post.active_storage_blobs
if post.author.present?
add_dependency [author, author.author]
add_dependency author.active_storage_blobs
end
end
end
def category
......
<% if block.data['category_id'] %>
category: <%= block.data['category_id'] %>
quantity: <%= block.data['posts_quantity'] %>
<% elsif block.data['elements'] %>
<% if block.template_class.category %>
category: <%= block.template_class.category.slug %>
<% end %>
posts:
<% block.data['elements'].each do |post|
<% block.template_class.posts.each do |post|
id = post['id']
unless id.blank?
post = block.about&.website.posts.find id
if post %>
- id: <%= post.id %>
- <%= post.slug %>
<% end %>
<% end %>
<% end %>
<% end %>
......@@ -12,17 +12,6 @@
<%= f.input :text, as: :summernote %>
</div>
</div>
<div class="card flex-fill w-100">
<div class="card-header">
<h5 class="card-title mb-0"><%= t('activerecord.attributes.communication/website/post.categories') %></h5>
</div>
<div class="card-body">
<%= f.association :categories,
label_text: false,
as: :check_boxes,
collection: collection_tree_for_checkboxes(@website.categories) if @website.categories.any? %>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card flex-fill w-100">
......@@ -57,6 +46,17 @@
<%= f.input :featured_image_alt %>
</div>
</div>
<div class="card flex-fill w-100">
<div class="card-header">
<h5 class="card-title mb-0"><%= t('activerecord.attributes.communication/website/post.categories') %></h5>
</div>
<div class="card-body">
<%= f.association :categories,
label_text: false,
as: :check_boxes,
collection: collection_tree_for_checkboxes(@website.categories) if @website.categories.any? %>
</div>
</div>
</div>
</div>
<% content_for :action_bar_right do %>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment