Use proxy-only urls for all ActiveStorage images
This commit is contained in:
		
							parent
							
								
									4819ff3c7e
								
							
						
					
					
						commit
						3d92560e7a
					
				
					 19 changed files with 28 additions and 28 deletions
				
			
		|  | @ -9,5 +9,5 @@ json.extract! nonprofit, :id, :name, #basics | ||||||
|                 :no_anon #options |                 :no_anon #options | ||||||
| json.url nonprofit_path(nonprofit) | json.url nonprofit_path(nonprofit) | ||||||
| json.logo do | json.logo do | ||||||
|     json.normal url_for(nonprofit.logo_by_size(:normal)) |     json.normal rails_storage_proxy_url(nonprofit.logo_by_size(:normal)) | ||||||
| end | end | ||||||
|  | @ -4,4 +4,4 @@ | ||||||
| # Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE | # Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE | ||||||
| json.extract! profile, :id, :name, :country, :picture | json.extract! profile, :id, :name, :country, :picture | ||||||
| json.url profile_path(profile) | json.url profile_path(profile) | ||||||
| json.pic_tiny url_for(profile.picture_by_size(:tiny)) if profile.picture.attached? | json.pic_tiny rails_storage_proxy_url(profile.picture_by_size(:tiny)) if profile.picture.attached? | ||||||
|  |  | ||||||
|  | @ -12,15 +12,15 @@ json.url campaign_url(nonprofit) | ||||||
| 
 | 
 | ||||||
| if campaign.main_image.attached? | if campaign.main_image.attached? | ||||||
|     json.main_image do |     json.main_image do | ||||||
|         json.full url_for(campaign.main_image) |         json.full rails_storage_proxy_url(campaign.main_image) | ||||||
|         json.normal url_for(campaign.main_image_by_size(:normal)) |         json.normal rails_storage_proxy_url(campaign.main_image_by_size(:normal)) | ||||||
|         json.thumb url_for(campaign.main_image_by_size(:thumb)) |         json.thumb rails_storage_proxy_url(campaign.main_image_by_size(:thumb)) | ||||||
|     end |     end | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| if campaign.background_image.attached? | if campaign.background_image.attached? | ||||||
|     json.background_image do  |     json.background_image do  | ||||||
|         json.full url_for(campaign.background_image) |         json.full rails_storage_proxy_url(campaign.background_image) | ||||||
|         json.normal url_for(campaign.background_image_by_size(:normal)) |         json.normal rails_storage_proxy_url(campaign.background_image_by_size(:normal)) | ||||||
|     end |     end | ||||||
| end | end | ||||||
|  | @ -69,7 +69,7 @@ | ||||||
|             <label>Main Image <small>(at least 500x400)</small></label> |             <label>Main Image <small>(at least 500x400)</small></label> | ||||||
|             <p><small>Used for previews and social media</small></p> |             <p><small>Used for previews and social media</small></p> | ||||||
|             <div class='image-upload u-inlineBlock' style='background-image: url("<%= @campaign.main_image.attached?  |             <div class='image-upload u-inlineBlock' style='background-image: url("<%= @campaign.main_image.attached?  | ||||||
|             ? url_for(@campaign.main_image_by_size(:thumb)) : '' %>");'> |             ? rails_storage_proxy_url(@campaign.main_image_by_size(:thumb)) : '' %>");'> | ||||||
|               <span><i class='fa  fa-pencil'></i> Edit</span> |               <span><i class='fa  fa-pencil'></i> Edit</span> | ||||||
|               <input type='file' name='campaign[main_image]'> |               <input type='file' name='campaign[main_image]'> | ||||||
|             </div> |             </div> | ||||||
|  |  | ||||||
|  | @ -46,13 +46,13 @@ | ||||||
| <%= content_for :facebook_tags do %> | <%= content_for :facebook_tags do %> | ||||||
| 	<meta property="og:title" content="<%= raw @campaign.name %>"> | 	<meta property="og:title" content="<%= raw @campaign.name %>"> | ||||||
| 	<meta property="og:description" content="<%= @campaign.summary.present? ? raw(@campaign.summary) : raw(@campaign.name) %>"> | 	<meta property="og:description" content="<%= @campaign.summary.present? ? raw(@campaign.summary) : raw(@campaign.name) %>"> | ||||||
| 	<meta property="og:image" content="<%= @campaign.main_image.attached? ? @campaign.main_image_by_size(:normal) : "" %>"> | 	<meta property="og:image" content="<%= @campaign.main_image.attached? ? rails_storage_proxy_url(@campaign.main_image_by_size(:normal)) : "" %>"> | ||||||
| <% end %> | <% end %> | ||||||
| 
 | 
 | ||||||
| <%= content_for :twitter_tags do %> | <%= content_for :twitter_tags do %> | ||||||
| 	<meta property="twitter:title" content="<%= raw @campaign.name %>"> | 	<meta property="twitter:title" content="<%= raw @campaign.name %>"> | ||||||
| 	<meta property="twitter:description" content="<%= raw @campaign.summary %>"> | 	<meta property="twitter:description" content="<%= raw @campaign.summary %>"> | ||||||
| 	<meta property="twitter:image" content="<%= @campaign.main_image.attached? ? @campaign.main_image_by_size(:normal) : "" %>"> | 	<meta property="twitter:image" content="<%= @campaign.main_image.attached? ? rails_storage_proxy_url(@campaign.main_image_by_size(:normal)) : "" %>"> | ||||||
| <% end %> | <% end %> | ||||||
| 
 | 
 | ||||||
| <% if current_campaign_editor? %> | <% if current_campaign_editor? %> | ||||||
|  |  | ||||||
|  | @ -85,7 +85,7 @@ | ||||||
|         <fieldset class='u-marginTop--5'> |         <fieldset class='u-marginTop--5'> | ||||||
|           <label>Preview Image</label> |           <label>Preview Image</label> | ||||||
|           <p><small>Used for sharing on social media</small></p> |           <p><small>Used for sharing on social media</small></p> | ||||||
|           <div class='image-upload  u-inlineBlock' style='background-image: url("<%= @event.main_image.attached? ? url_for(@event.main_image_by_size(:thumb)) : '' %>")'> |           <div class='image-upload  u-inlineBlock' style='background-image: url("<%= @event.main_image.attached? ? rails_storage_proxy_url(@event.main_image_by_size(:thumb))) : '' %>")'> | ||||||
|             <span><i class='fa fa-pencil'></i> Edit</span> |             <span><i class='fa fa-pencil'></i> Edit</span> | ||||||
|             <input type='file' name='event[main_image]'> |             <input type='file' name='event[main_image]'> | ||||||
|           </div> |           </div> | ||||||
|  |  | ||||||
|  | @ -10,13 +10,13 @@ | ||||||
| <%= content_for :facebook_tags do %> | <%= content_for :facebook_tags do %> | ||||||
| 	<meta property="og:title" content="<%= raw @event.name %>" /> | 	<meta property="og:title" content="<%= raw @event.name %>" /> | ||||||
| 	<meta property="og:description" content="<%= @event.summary.present? ? raw(@event.summary) : raw(@event.name) %>" /> | 	<meta property="og:description" content="<%= @event.summary.present? ? raw(@event.summary) : raw(@event.name) %>" /> | ||||||
| 	<meta property="og:image" content="<%= @event.main_image.attached? ? @event.main_image_by_size(:normal) : "" %>" /> | 	<meta property="og:image" content="<%= @event.main_image.attached? ? rails_storage_proxy_url(@event.main_image_by_size(:normal)) : "" %>" /> | ||||||
| <% end %> | <% end %> | ||||||
| 
 | 
 | ||||||
| <%= content_for :twitter_tags do %> | <%= content_for :twitter_tags do %> | ||||||
| 	<meta property="twitter:title" content="<%= raw @event.name %>" /> | 	<meta property="twitter:title" content="<%= raw @event.name %>" /> | ||||||
| 	<meta property="twitter:description" content="<%= raw @event.summary %>" /> | 	<meta property="twitter:description" content="<%= raw @event.summary %>" /> | ||||||
| 	<meta property="twitter:image" content="<%= @event.main_image.attached? ? @event.main_image_by_size(:normal) : "" %>" /> | 	<meta property="twitter:image" content="<%= @event.main_image.attached? ? rails_storage_proxy_url(@event.main_image_by_size(:normal)) : "" %>" /> | ||||||
| <% end %> | <% end %> | ||||||
| 
 | 
 | ||||||
| <%= content_for :javascripts do %> | <%= content_for :javascripts do %> | ||||||
|  |  | ||||||
|  | @ -9,13 +9,13 @@ | ||||||
| <%= content_for :facebook_tags do %> | <%= content_for :facebook_tags do %> | ||||||
|   <meta property="og:title" content="<%= raw @event.name %>" /> |   <meta property="og:title" content="<%= raw @event.name %>" /> | ||||||
|   <meta property="og:description" content="<%= raw @event.summary %>" /> |   <meta property="og:description" content="<%= raw @event.summary %>" /> | ||||||
|   <meta property="og:image" content="<%= @event.main_image.attached? ? @event.main_image_by_size(:normal) : "" %>" /> |   <meta property="og:image" content="<%= @event.main_image.attached? ? rails_storage_proxy_url(@event.main_image_by_size(:normal)) : "" %>" /> | ||||||
| <% end %> | <% end %> | ||||||
| 
 | 
 | ||||||
| <%= content_for :twitter_tags do %> | <%= content_for :twitter_tags do %> | ||||||
|   <meta property="twitter:title" content="<%= raw @event.name %>" /> |   <meta property="twitter:title" content="<%= raw @event.name %>" /> | ||||||
|   <meta property="twitter:description" content="<%= raw @event.summary %>" /> |   <meta property="twitter:description" content="<%= raw @event.summary %>" /> | ||||||
|   <meta property="twitter:image" content="<%= @event.main_image.attached? ? @event.main_image_by_size(:normal) : "" %>" /> |   <meta property="twitter:image" content="<%= @event.main_image.attached? ? rails_storage_proxy_url(@event.main_image_by_size(:normal)) : "" %>" /> | ||||||
| <% end %> | <% end %> | ||||||
| 
 | 
 | ||||||
| <%= content_for :javascripts do %> | <%= content_for :javascripts do %> | ||||||
|  |  | ||||||
|  | @ -3,7 +3,7 @@ | ||||||
| <% if current_role?([:nonprofit_admin,:nonprofit_associate]) %> | <% if current_role?([:nonprofit_admin,:nonprofit_associate]) %> | ||||||
| 	<section class='sideNav-section'> | 	<section class='sideNav-section'> | ||||||
| 		<a class='sideNav-link' href='<%= administered_nonprofit.url%>'> | 		<a class='sideNav-link' href='<%= administered_nonprofit.url%>'> | ||||||
| 			<%= image_tag administered_nonprofit.logo_by_size(:small), class:"sideNav-profile" %> | 			<%= image_tag rails_storage_proxy_url(administered_nonprofit.logo_by_size(:small)), class:"sideNav-profile" %> | ||||||
| 			<span class='sideNav-text'><%= administered_nonprofit.name %></span> | 			<span class='sideNav-text'><%= administered_nonprofit.name %></span> | ||||||
| 		</a> | 		</a> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -5,7 +5,7 @@ | ||||||
| 	<section class='sideNav-section'> | 	<section class='sideNav-section'> | ||||||
| 		<a class='sideNav-link' href='<%= profile_url(current_user.profile) %>'> | 		<a class='sideNav-link' href='<%= profile_url(current_user.profile) %>'> | ||||||
| 		<% if current_user.profile.picture.attached? %> | 		<% if current_user.profile.picture.attached? %> | ||||||
| 			<%= image_tag  current_user.profile.picture_by_size(:tiny), class: 'sideNav-profile' %> | 			<%= image_tag  rails_storage_proxy_url(current_user.profile.picture_by_size(:tiny)), class: 'sideNav-profile' %> | ||||||
| 			<% else %> | 			<% else %> | ||||||
| 				<i class="sideNav-icon icon-user-1"></i> | 				<i class="sideNav-icon icon-user-1"></i> | ||||||
| 			<% end %> | 			<% end %> | ||||||
|  |  | ||||||
|  | @ -99,7 +99,7 @@ | ||||||
|       <div class='layout--two'> |       <div class='layout--two'> | ||||||
|         <fieldset> |         <fieldset> | ||||||
|           <label class='u-marginBottom--10'>Logo</label> |           <label class='u-marginBottom--10'>Logo</label> | ||||||
|           <div class='image-upload u-margin--0' style='background-image:url("<%= @nonprofit.logo.attached? ? url_for(@nonprofit.logo_by_size(:normal)) : '' %>")'> |           <div class='image-upload u-margin--0' style='background-image:url("<%= @nonprofit.logo.attached? ? rails_storage_proxy_url(@nonprofit.logo_by_size(:normal)) : '' %>")'> | ||||||
|             <span><i class='fa fa-image'></i> Upload</span> |             <span><i class='fa fa-image'></i> Upload</span> | ||||||
|             <input type='file' name='nonprofit[logo]'> |             <input type='file' name='nonprofit[logo]'> | ||||||
|           </div> |           </div> | ||||||
|  |  | ||||||
|  | @ -4,7 +4,7 @@ | ||||||
| <table> | <table> | ||||||
| 	<tr> | 	<tr> | ||||||
| 		<td class='fundraisingHeader-content-sideElementTd'> | 		<td class='fundraisingHeader-content-sideElementTd'> | ||||||
| 			<div class='fundraisingHeader-content-logo' style="background-image:url('<%= @nonprofit.logo.attached? ? url_for(@nonprofit.logo_by_size(:normal)) : "" %>');"> | 			<div class='fundraisingHeader-content-logo' style="background-image:url('<%= @nonprofit.logo.attached? ? rails_storage_proxy_url(@nonprofit.logo_by_size(:normal)) : "" %>');"> | ||||||
| 			</div> | 			</div> | ||||||
| 		</td> | 		</td> | ||||||
| 		<td class='fundraisingHeader-content-textTd'> | 		<td class='fundraisingHeader-content-textTd'> | ||||||
|  |  | ||||||
|  | @ -6,7 +6,7 @@ | ||||||
| 
 | 
 | ||||||
|     <div> |     <div> | ||||||
| 			<div style='overflow: hidden; height: initial;'> | 			<div style='overflow: hidden; height: initial;'> | ||||||
|         <%= image_tag @nonprofit.main_image_by_size(:nonprofit_carousel) %> |         <%= image_tag rails_storage_proxy_url(@nonprofit.main_image_by_size(:nonprofit_carousel)) %> | ||||||
| 			</div> | 			</div> | ||||||
| 		</div> | 		</div> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -24,7 +24,7 @@ | ||||||
| 				</p> | 				</p> | ||||||
| 
 | 
 | ||||||
| 			<div class='u-inlineBlock'> | 			<div class='u-inlineBlock'> | ||||||
| 				<div class='image-upload' style='background-image:url("<%= @nonprofit.main_image.attached? ? url_for(@nonprofit.main_image_by_size(:thumb_explore)) : '' %>")'> | 				<div class='image-upload' style='background-image:url("<%= @nonprofit.main_image.attached? ? rails_storage_proxy_url(@nonprofit.main_image_by_size(:thumb_explore)) : '' %>")'> | ||||||
| 					<span><i class='fa fa-image'></i> Select</span> | 					<span><i class='fa fa-image'></i> Select</span> | ||||||
| 					<input type='file' name='nonprofit[main_image]'> | 					<input type='file' name='nonprofit[main_image]'> | ||||||
| 				</div> | 				</div> | ||||||
|  |  | ||||||
|  | @ -34,13 +34,13 @@ | ||||||
| <%= content_for :facebook_tags do %> | <%= content_for :facebook_tags do %> | ||||||
| 	<meta property='og:title' content='I support <%= @nonprofit.name %>!'> | 	<meta property='og:title' content='I support <%= @nonprofit.name %>!'> | ||||||
| 	<meta property='og:description' content='<%= @nonprofit.summary %>'> | 	<meta property='og:description' content='<%= @nonprofit.summary %>'> | ||||||
| 	<meta property='og:image' content='<%= @nonprofit.main_image.attached? ? @nonprofit.main_image_by_size(:nonprofit_carousel) : "" %>'> | 	<meta property='og:image' content='<%= @nonprofit.main_image.attached? ? rails_storage_proxy_url(@nonprofit.main_image_by_size(:nonprofit_carousel) : "" %>'> | ||||||
| <% end %> | <% end %> | ||||||
| 
 | 
 | ||||||
| <%= content_for :twitter_tags do %> | <%= content_for :twitter_tags do %> | ||||||
| 	<meta property="twitter:title" content="I support <%= raw @nonprofit.name %>!"> | 	<meta property="twitter:title" content="I support <%= raw @nonprofit.name %>!"> | ||||||
| 	<meta property="twitter:description" content="<%= raw @nonprofit.summary %>"> | 	<meta property="twitter:description" content="<%= raw @nonprofit.summary %>"> | ||||||
| 	<meta property="twitter:image" content="<%= @nonprofit.main_image.attached? ? @nonprofit.main_image_by_size(:nonprofit_carousel) : "" %>" /> | 	<meta property="twitter:image" content="<%= @nonprofit.main_image.attached? ? rails_storage_proxy_url(@nonprofit.main_image_by_size(:nonprofit_carousel)) : "" %>" /> | ||||||
| <% end %> | <% end %> | ||||||
| 
 | 
 | ||||||
| <% content_for :body_id do %>donate<% end %> | <% content_for :body_id do %>donate<% end %> | ||||||
|  |  | ||||||
|  | @ -31,7 +31,7 @@ | ||||||
| 		<tr> | 		<tr> | ||||||
| 			<% if @nonprofit.logo.attached? %> | 			<% if @nonprofit.logo.attached? %> | ||||||
| 			<td style='width: 100px; padding: 10px;'> | 			<td style='width: 100px; padding: 10px;'> | ||||||
| 				<%= image_tag @nonprofit.logo_by_size(:normal), style:'border: 1px solid rgba(0,0,0,0.05);'%> | 				<%= image_tag rails_storage_proxy_url(@nonprofit.logo_by_size(:normal)), style:'border: 1px solid rgba(0,0,0,0.05);'%> | ||||||
| 			</td> | 			</td> | ||||||
| 			<% end %> | 			<% end %> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -8,12 +8,12 @@ | ||||||
| <%= content_for :facebook_tags do %> | <%= content_for :facebook_tags do %> | ||||||
| 	<meta property="og:title" content="<%= raw @nonprofit.name %>" /> | 	<meta property="og:title" content="<%= raw @nonprofit.name %>" /> | ||||||
| 	<meta property="og:description" content="<%= raw @nonprofit.tagline %>" /> | 	<meta property="og:description" content="<%= raw @nonprofit.tagline %>" /> | ||||||
| 	<meta property="og:image" content="<%= @nonprofit.main_image.attached? ? @nonprofit.main_image_by_size(:nonprofit_carousel) : "" %>" /> | 	<meta property="og:image" content="<%= @nonprofit.main_image.attached? ? rails_storage_proxy_url(@nonprofit.main_image_by_size(:nonprofit_carousel)) : "" %>" /> | ||||||
| <% end %> | <% end %> | ||||||
| <%= content_for :twitter_tags do %> | <%= content_for :twitter_tags do %> | ||||||
| 	<meta property="twitter:title" content="<%= raw @nonprofit.name %>" /> | 	<meta property="twitter:title" content="<%= raw @nonprofit.name %>" /> | ||||||
| 	<meta property="twitter:description" content="<%= raw @nonprofit.tagline %>" /> | 	<meta property="twitter:description" content="<%= raw @nonprofit.tagline %>" /> | ||||||
| 	<meta property="twitter:image" content="<%= @nonprofit.main_image.attached? ? @nonprofit.main_image_by_size(:nonprofit_carousel) : "" %>" /> | 	<meta property="twitter:image" content="<%= @nonprofit.main_image.attached? ? rails_storage_proxy_url(@nonprofit.main_image_by_size(:nonprofit_carousel)) : "" %>" /> | ||||||
| <% end %> | <% end %> | ||||||
| 
 | 
 | ||||||
| <%= content_for :stylesheets do %> | <%= content_for :stylesheets do %> | ||||||
|  |  | ||||||
|  | @ -18,7 +18,7 @@ | ||||||
| 
 | 
 | ||||||
|     <br> |     <br> | ||||||
|     <% if @nonprofit.logo.attached? %> |     <% if @nonprofit.logo.attached? %> | ||||||
|       <%= image_tag url_for(@nonprofit.logo_by_size(:normal)) %> |       <%= image_tag rails_storage_proxy_url(@nonprofit.logo_by_size(:normal)) %> | ||||||
|     <% end %> |     <% end %> | ||||||
|     <% if params[:title] %> |     <% if params[:title] %> | ||||||
|       <h4><%= params[:title] %></h4> |       <h4><%= params[:title] %></h4> | ||||||
|  |  | ||||||
|  | @ -15,7 +15,7 @@ | ||||||
| 		<table> | 		<table> | ||||||
| 			<tr> | 			<tr> | ||||||
| 				<td> | 				<td> | ||||||
| 					<span class='donorProfileHeader-photo' style="background-image: url('<%= @profile.picture.attached? && url_for(@profile.picture_by_size(:normal)) %>');"></span> | 					<span class='donorProfileHeader-photo' style="background-image: url('<%= @profile.picture.attached? && rails_storage_proxy_url(@profile.picture_by_size(:normal)) %>');"></span> | ||||||
| 				</td> | 				</td> | ||||||
| 				<td class='u-paddingLeft--15'> | 				<td class='u-paddingLeft--15'> | ||||||
| 					<% supporter = (@profile.supporters && @profile.supporters.length != 0) ? supporter : false %> | 					<% supporter = (@profile.supporters && @profile.supporters.length != 0) ? supporter : false %> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Eric Schultz
						Eric Schultz