Skip to content

Commit

Permalink
improve suggestion summary
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienpoly committed Sep 16, 2024
1 parent 7b9502c commit 27df756
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
11 changes: 11 additions & 0 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,15 @@ def assign_canonical_event!(canonical_event:)
talks.update_all(event_id: canonical_event.id)
end
end

def suggestion_summary
<<~HEREDOC
Event: #{name}
#{description}
#{city}
#{country_code}
#{organisation.name}
#{date}
HEREDOC
end
end
10 changes: 10 additions & 0 deletions app/models/speaker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,14 @@ def rejected!
SpeakerTalk.where(speaker_id: id).destroy_all
end
end

def suggestion_summary
<<~HEREDOC
Speaker: #{name}
github: #{github}
twitter: #{twitter}
website: #{website}
bio: #{bio}
HEREDOC
end
end
8 changes: 8 additions & 0 deletions app/models/talk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,4 +219,12 @@ def update_from_yml_metadata!(event: nil)
def static_metadata
Static::Video.find_by(video_id: video_id)
end

def suggestion_summary
<<~HEREDOC
Talk: #{title} (#{date})
by #{speakers.map(&:name).to_sentence}
at #{event.name}
HEREDOC
end
end
8 changes: 6 additions & 2 deletions app/views/admin/suggestions/_suggestion.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<div class="card card-bordered">
<div class="card-body">
<div class="flex flex-col gap-4">
<% title = "#{suggestion.suggestable.class} : #{suggestion.suggestable.title}" %>
<%= link_to title, suggestion.suggestable, target: "_blank", class: "link" %>
<% title = suggestion.suggestable.try(:suggestion_summary) || "#{suggestion.suggestable.class} : #{suggestion.suggestable.title}" %>
<%= link_to suggestion.suggestable, target: "_blank", class: "" do %>
<%= simple_format title %>
<% end %>

<div class="font-semibold">Changes:</div>
<div class="grid grid-cols-2 gap-4">
<% suggestion.content.keys.each do |key| %>
<span><%= key %></span>
Expand Down

0 comments on commit 27df756

Please sign in to comment.