Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ edit_link(
</div>

<section class="participatory-space__block-reference">
<%= resource_reference(current_participatory_space) %>
<p><%= resource_reference(current_participatory_space) %></p>
</section>
</main>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<span class="<%= alignment_badge_classes %> comment__content--label"><%= alignment_badge_label %></span>
<p class="<%= alignment_badge_classes %> comment__content--label"><%= alignment_badge_label %></p>
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<% metadata_valued_items.each do |item| %>
<div class="participatory-space__metadata-item">
<div class="participatory-space__metadata-item-title">
<span><%= item[:title] %></span>
<p><%= item[:title] %></p>
</div>
<span><%= item[:value] %></span>
<p><%= item[:value] %></p>
</div>
<% end %>
</div>
12 changes: 6 additions & 6 deletions decidim-core/app/cells/decidim/statistic/show.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<div class="statistic <%= stat_dom_class %>" data-statistic>
<div class="statistic__header">
<div class="statistic__metric">
<div class="statistic__title" title="<%= stat_title %>">
<p class="statistic__title" title="<%= stat_title %>">
<%= stat_title %>
</div>
</p>
<div class="statistic__tooltip">
<%= information_tooltip %>
</div>
Expand All @@ -13,14 +13,14 @@
</div>
</div>
<% if second_stat_number %>
<div class="statistic__second-number">
<p class="statistic__second-number">
<%= stat_sub_title %>
<span class="font-semibold"><%= second_stat_number %></span>
</div>
</p>
<% else %>
<p class="h-[21px]"></p>
<% end %>
<div class="statistic__number">
<p class="statistic__number">
<%= stat_number %>
</div>
</p>
</div>
9 changes: 5 additions & 4 deletions decidim-core/app/cells/decidim/upload_modal/files.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<div class="upload-modal__files-container upload-container-for-<%= attribute %> <%= with_title %>">
<div>
<%= label %>
<%# proposals option is only set in proposals and collaborative_drafts edit_form_fields partials %>
<%= options[:proposals] == true ? paragraph : label %>

<% if options[:help_text].present? %>
<span class="help-text"><%= options[:help_text] %></span>
<p class="help-text"><%= options[:help_text] %></p>
<% end %>

<%# NOTE: this block is about wrapping a default image for the avatar with the new styles,
Expand Down Expand Up @@ -31,11 +32,11 @@
<% end %>

<% if has_title? %>
<span><%= title_for(attachment) %></span>
<p><%= title_for(attachment) %></p>
<%= form.hidden_field attribute, multiple: true, value: attachment.id, id: attachment.id %>
<% else %>
<% if blob(attachment).image? %>
<span><%= title_for(attachment) %></span>
<p><%= title_for(attachment) %></p>
<% else %>
<%= link_to title_for(attachment), file_attachment_path(attachment), class: "w-full break-all mb-2" %>
<% end %>
Expand Down
4 changes: 4 additions & 0 deletions decidim-core/app/cells/decidim/upload_modal_cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ def label
form.send(:custom_label, attribute, options[:label], { required: required?, for: nil })
end

def paragraph
form.send(:custom_paragraph, attribute, options[:label], { required: required? })
end

def button_label
return button_edit_label if attachments.count.positive?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const updateActiveUploads = (modal) => {
const template = `
<div ${attachmentIdOrHiddenField} data-filename="${escapeQuotes(file.name)}" data-title="${escapeQuotes(title)}">
${(/image/).test(file.type) && "<div><img src=\"data:,\" role=\"presentation\" /></div>" || ""}
<span>${escapeHtml(title)}</span>
<p>${escapeHtml(title)}</p>
${hidden}
</div>
`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
@apply w-full rounded bg-background flex items-center justify-center py-4 [&_img]:object-cover [&_img]:h-[200px];
}

span {
p {
@apply text-sm text-gray-2 mx-auto w-full break-all mb-2;
}
}
Expand Down
26 changes: 25 additions & 1 deletion decidim-core/lib/decidim/form_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -615,9 +615,33 @@ def custom_label(attribute, text, options, field_before_label: false, show_requi
else
text
end

label(attribute, text, options || {})
end

# render p tag instead of label for proposals "add a document"
def custom_paragraph(attribute, text, options, field_before_label: false, show_required: true)
return "".html_safe if text == false

required = options.is_a?(Hash) && options.delete(:required)
text = attribute.to_s.humanize if text.nil? || text == true
if show_required
text +=
if required
required_indicator
else
required_for_attribute(attribute)
end
end

text = if field_before_label && block_given?
safe_join([yield, text.html_safe])
elsif block_given?
safe_join([text.html_safe, yield])
else
text
end
"<p class='text-lg font-semibold'>#{text}</p>".html_safe
end
# rubocop:enable Metrics/PerceivedComplexity
# rubocop:enable Metrics/CyclomaticComplexity

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
</div>

<section class="participatory-space__block-reference">
<%= resource_reference(current_participatory_space) %>
<p><%= resource_reference(current_participatory_space) %></p>
</section>
</main>
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
button_edit_label: t("decidim.proposals.collaborative_drafts.new.edit_file"),
button_class: "button button__lg button__transparent-secondary w-full",
help_text: t("attachment_legend", scope: "decidim.proposals.collaborative_drafts.edit"),
help_i18n_scope: "decidim.forms.file_help.file" %>
help_i18n_scope: "decidim.forms.file_help.file",
proposals: true %>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<%= filter_taxonomy_items_select_field form, :taxonomies, filter %>
<% end %>
<% end %>

<% if component_settings.attachments_allowed? && (new_proposal || @proposal) %>
<%= form.attachment :documents,
multiple: true,
Expand All @@ -31,5 +30,6 @@
button_edit_label: t("decidim.proposals.proposals.edit.edit_attachments"),
button_class: "button button__lg button__transparent-secondary w-full",
help_i18n_scope: "decidim.forms.file_help.file",
help_text: t("attachment_legend", scope: "decidim.proposals.proposals.edit") %>
help_text: t("attachment_legend", scope: "decidim.proposals.proposals.edit"),
proposals: true %>
<% end %>
Loading