Skip to content

Commit 6ea0506

Browse files
committed
Re-add missing logo field for communities
1 parent c7fc710 commit 6ea0506

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

app/views/better_together/communities/_community_fields.html.erb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,32 @@
100100
<div class="my-3 text-center preview-target" data-better_together--image-preview-target="preview" data-image-classes="cover-image" data-url="<%= community.cover_image.url if community.cover_image.attached? %>">
101101
</div>
102102
</div>
103+
104+
<div id="community-logo-image-fields" class="mb-3" data-controller="better_together--image-preview"
105+
data-image-preview-clear-value="<%= t('globals.clear') %>"
106+
data-image-preview-undo-clear-value="<%= t('globals.undo_clear') %>">
107+
<%= label_tag do %>
108+
<%= community.class.human_attribute_name(:logo) %>
109+
<% if community.logo.attached? %>
110+
: <%= community.logo.filename %>
111+
<% end %>
112+
<% end %>
113+
114+
<div class="input-group">
115+
<%= form.file_field :logo, accept: acceptable_image_file_types, "data-better_together--image-preview-target" => 'input', data: { 'action' => "better_together--image-preview#preview" }, class: "form-control" %>
116+
<%# Hidden field to track removal state %>
117+
<%= form.hidden_field :remove_logo, value: '0', "data-better_together--image-preview-target" => "deleteField" %>
118+
119+
<%= button_tag t('globals.clear'), { type: 'button', class: 'btn btn-secondary', "data-better_together--image-preview-target" => "deleteButton", data: { 'action' => "better_together--image-preview#toggleDelete", 'clear-value' => t('globals.clear'), 'undo-clear-value' => t('globals.undo_clear'), 'no-image-value' => t('globals.no_image') } } %>
120+
</div>
121+
122+
<small class="form-text text-muted"><%= t('helpers.hint.community.logo') %></small>
123+
124+
<!-- Image preview container -->
125+
<div class="my-3 text-center preview-target" data-better_together--image-preview-target="preview" data-image-classes="profile-image" data-url="<%= community.logo.url if community.logo.attached? %>">
126+
<!-- The image preview will be dynamically inserted here -->
127+
</div>
128+
</div>
103129
</div>
104130

105131
<!-- Contact Details Tab -->

0 commit comments

Comments
 (0)