Commit 9174020f14f622fcd5ae57bc7bcba0d067c0e88a

Authored by Dmitriy Zaporozhets
1 parent b3b9b756

Fix event image preview

app/assets/stylesheets/sections/events.scss
... ... @@ -68,12 +68,10 @@
68 68 margin: 0 20px;
69 69 }
70 70  
71   - .note-file-attach {
72   - .note-image-attach {
73   - margin-top: 4px;
74   - margin-left: 0px;
75   - max-width: 200px;
76   - }
  71 + .note-image-attach {
  72 + margin-top: 4px;
  73 + margin-left: 0px;
  74 + max-width: 200px;
77 75 }
78 76 }
79 77 .event-note-icon {
... ...
app/helpers/events_helper.rb
... ... @@ -121,4 +121,8 @@ module EventsHelper
121 121 end
122 122 end
123 123 end
  124 +
  125 + def event_note(text)
  126 + sanitize(markdown(truncate(text, length: 150)), tags: %w(a img b pre p))
  127 + end
124 128 end
... ...
app/views/events/event/_note.html.haml
... ... @@ -10,7 +10,7 @@
10 10 .event-note
11 11 .md
12 12 %i.icon-comment-alt.event-note-icon
13   - = sanitize(markdown(truncate(event.target.note, length: 150)), tags: %w(a img b pre p))
  13 + = event_note(event.target.note)
14 14 - note = event.target
15 15 - if note.attachment.url
16 16 - if note.attachment.image?
... ...