Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add admin link to notes #8103

Closed
wants to merge 2 commits into from
Closed
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
21 changes: 15 additions & 6 deletions app/helpers/notes_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ def render_notes(notes, batch: false, **options)

tag.aside(**options.merge(id: 'notes')) do
notes.each do |note|
note_classes = ['note']
note_classes << "tag-#{note.notable_tag}" if note.notable_tag

concat tag.article sanitize(note.body, tags: allowed_tags),
id: dom_id(note),
class: note_classes
concat render_note(note, allowed_tags: allowed_tags)
end
end
end
Expand All @@ -25,4 +20,18 @@ def notes_allowed_tags
def batch_notes_allowed_tags
notes_allowed_tags - %w(pre h1 h2 h3 h4 h5 h6 img blockquote font iframe)
end

private

def render_note(note, allowed_tags: notes_allowed_tags)
note_classes = ['note']
note_classes << "tag-#{note.notable_tag}" if note.notable_tag

locals = {
note_classes: note_classes,
allowed_tags: allowed_tags
}

render partial: note, locals: locals
end
end
9 changes: 9 additions & 0 deletions app/views/notes/_note.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<%= tag.article(id: dom_id(note), class: note_classes) do %>
<%= sanitize(note.body, tags: allowed_tags) %>

<% if @user&.admin_page_links? %>
<p class="event_actions">
<%= link_to 'Admin', edit_admin_note_path(note) %>
</p>
<% end %>
<% end %>
1 change: 1 addition & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Highlighted Features

* Add admin link to notes (Gareth Rees)
* Display metadata on admin attachment views (Graeme Porteous)
* Change request URL patterns to be member routes (Alexander Griffen, Graeme
Porteous)
Expand Down
Loading