mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
refactor image headers
This commit is contained in:
parent
4783fc452f
commit
94a73e9bda
@ -9,11 +9,11 @@ module HasImageUploads
|
||||
# todo: destroy from s3 on destroy
|
||||
|
||||
def public_image_uploads
|
||||
self.image_uploads.where(privacy: 'public')
|
||||
self.image_uploads.where(privacy: 'public').presence || ["card-headers/#{self.class.name.downcase.pluralize}.jpg"]
|
||||
end
|
||||
|
||||
def private_image_uploads
|
||||
self.image.uploads.where(privacy: 'private')
|
||||
self.image.uploads.where(privacy: 'private').presence || ["card-headers/#{self.class.name.downcase.pluralize}.jpg"]
|
||||
end
|
||||
|
||||
def random_image_including_private(format: :medium)
|
||||
|
||||
@ -2,10 +2,7 @@
|
||||
<%= render partial: 'content/display/favorite_control', locals: { content: @content } %>
|
||||
|
||||
<ul class="slides">
|
||||
<% image_uploads = @content.image_uploads.map { |image| image.src.url(:large) } %>
|
||||
<% image_uploads = ["card-headers/#{@content.class.name.downcase.pluralize}.jpg"] if image_uploads.empty? %>
|
||||
|
||||
<% image_uploads.each do |image_source| %>
|
||||
<% @content.public_image_uploads.each do |image_source| %>
|
||||
<li>
|
||||
<%= image_tag image_source %>
|
||||
<div class="caption bordered-text center">
|
||||
|
||||
@ -3,10 +3,6 @@
|
||||
editing = defined?(editing) && editing
|
||||
%>
|
||||
|
||||
<%
|
||||
raw_model = content.is_a?(ContentSerializer) ? content.raw_model : content
|
||||
%>
|
||||
|
||||
<div>
|
||||
<%= render partial: 'content/display/sidebar/categories', locals: { content: content, creating: creating, editing: editing } %>
|
||||
<%= render partial: 'content/display/sidebar/references', locals: { content: content, creating: creating, editing: editing } %>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user