Move nonprofit app_data to jbuilder
This commit is contained in:
		
							parent
							
								
									d5c788f07b
								
							
						
					
					
						commit
						91a173052a
					
				
					 3 changed files with 14 additions and 2 deletions
				
			
		|  | @ -160,7 +160,7 @@ const view = state => { | |||
|       , class: {'u-hide': !state.params$().offsite || !state.params$().embedded} | ||||
|     }) | ||||
|   , h('div.titleRow', [ | ||||
|       h('img', {props: {src: app.nonprofit.logo.normal.url}}) | ||||
|       h('img', {props: {src: app.nonprofit.logo.normal}}) | ||||
|     , h('div.titleRow-info', [ | ||||
|         h('h2', app.campaign.name || app.nonprofit.name ) | ||||
|       , h('p', [ | ||||
|  |  | |||
							
								
								
									
										12
									
								
								app/views/app_data/_nonprofit.jbuilder
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								app/views/app_data/_nonprofit.jbuilder
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| # frozen_string_literal: true | ||||
| 
 | ||||
| # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later | ||||
| json.extract! nonprofit, :id, :name, #basics | ||||
|                 :brand_color, :brand_font, :tagline, #brand | ||||
|                 :zip_code, :state_code, :city, :latitude, :longitude, #location | ||||
|                 :slug, :state_code_slug, :city_slug, #slugs | ||||
|                 :no_anon #options | ||||
| json.url nonprofit_path(nonprofit) | ||||
| json.logo do | ||||
|     json.normal url_for(nonprofit.logo_by_size(:normal)) | ||||
| end | ||||
|  | @ -5,7 +5,7 @@ var app = { | |||
| , ip: "<%= request.remote_ip %>" | ||||
| , current_user: <%= current_user ? current_user.id : 'undefined' %> | ||||
| , current_admin: <%= !!(current_user && current_role?(:super_admin)) %> | ||||
| , nonprofit: <%= @nonprofit ? raw(@nonprofit.to_json(root:false)) : 'undefined' %> | ||||
| , nonprofit: <%= @nonprofit ? raw(render('app_data/nonprofit', nonprofit: @nonprofit)) : 'undefined' %> | ||||
| , nonprofit_id : <%= @nonprofit ? @nonprofit.id : 'undefined' %> | ||||
| , user: <%= current_user ? raw(render('app_data/user.json', user: current_user)) : 'undefined' %> | ||||
| , user_id: <%= current_user ? current_user.id : 'undefined' %> | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Eric
						Eric