<% javascript 'backend/sortable' %> <% javascript 'backend/flexible_content' %>
<% rows = model.content_rows.where(locale: locale) %> <% if rows.empty? %>
<%= t 'b.flexible_content' %>
<%= t 'b.msg.flexible_content.explanation' %>
<% end %> <% rows.decorate.each do |row| %>
<%= link_to icon(:trash, t('b.msg.flexible_content.delete_row')), backend_content_row_path(row), class: 'btn btn-secondary', method: :delete, data: { confirm: t('b.msg.confirm') } %>
<% row.columns.each do |column| %> <% content = column.content.decorate %>
<% Udongo.config.flexible_content.types.each do |content_type| %> <%= render("backend/content/#{content_type}", object: content) if content.content_type_is?(content_type) %> <% end %>
<% end %> <% unless row.column_limit_reached? %> <% if row.columns.blank? %> <%= link_to icon(:plus, t('b.msg.flexible_content.add_column')), new_backend_content_row_column_path(row), class: 'btn btn-secondary btn-block' %> <% else %> <%= link_to icon(:plus, t('b.msg.flexible_content.add_column')), new_backend_content_row_column_path(row), class: 'btn btn-secondary hidden-xl-up full-width' %> <%= link_to icon(:plus), new_backend_content_row_column_path(row), class: 'btn btn-secondary hidden-lg-down block' %> <% end %> <% end %>
<% end %>
<%= link_to icon(:plus, t('b.msg.flexible_content.add_row')), new_backend_content_row_path(klass: @model.class, id: @model.id, locale: locale), class: 'btn btn-secondary btn-block' %>