diff options
| author | Miquel Sabaté Solà <msabate@suse.com> | 2024-03-13 18:03:43 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <msabate@suse.com> | 2024-03-13 18:03:43 +0100 |
| commit | a7791635aa98f012d35f97c3c5288494bbb28e38 (patch) | |
| tree | bad987e6b4d10ad2f7cd02e40658d464907595ee /app/views/comments/_list.html.erb | |
| download | operum-a7791635aa98f012d35f97c3c5288494bbb28e38.tar.gz operum-a7791635aa98f012d35f97c3c5288494bbb28e38.zip | |
Initial commit
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'app/views/comments/_list.html.erb')
| -rw-r--r-- | app/views/comments/_list.html.erb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/app/views/comments/_list.html.erb b/app/views/comments/_list.html.erb new file mode 100644 index 0000000..2396140 --- /dev/null +++ b/app/views/comments/_list.html.erb @@ -0,0 +1,30 @@ +<div id="comment-list" data-controller="comment"> + <h5><%= I18n.t('comments.title-plural') %></h5> + + <div> + <% if thing.comments.any? %> + <% thing.comments.each_with_index do |comment, idx| %> + <%= render comment, from: from, idx: idx %> + <% end %> + <% else %> + <p><%= I18n.t('comments.none') %>.</p> + <% end %> + </div> + + <div id="comment-new-section"> + <a id="comment-new-button" class="button" href="#" data-action="comment#toggleNewComment"><%= I18n.t('comments.new') %></a> + + <div id="comment-new-body" class="hidden"> + <%= form_with model: [thing, Comment.new] do |form| %> + <%= form.rich_text_area :content, size: "20x5", autofocus: true %> + + <%= form.hidden_field :from, value: from %> + + <%= render "tags/taggable", tag_references: [], form: form %> + + <%= form.submit %> + <span><%= I18n.t('general.or') %> <a title="<%= I18n.t('general.cancel') %>" href="#" data-action="comment#toggleNewComment"><%= I18n.t('general.cancel') %></a></span> + <% end %> + </div> + </div> +</div> |
