Correct render bugs with the user and profile json

This commit is contained in:
Eric 2020-05-14 11:54:28 -05:00
parent c2c166dd1b
commit 1b68d6e04c
3 changed files with 5 additions and 5 deletions

View file

@ -3,4 +3,4 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
json.extract! profile, :id, :name, :country, :picture
json.url profile_path(profile)
json.pic_tiny profile.get_profile_pic(:tiny)
json.pic_tiny profile.get_profile_picture(:tiny)

View file

@ -5,4 +5,4 @@ json.extract! user, :id, :created_at, :updated_at
json.unconfirmed_email user.unconfirmed_email
json.confirmed user.confirmed?
json.partial! render 'app_data/profile', profile: user.profile
json.partial! 'app_data/profile.json', profile: user.profile

View file

@ -7,10 +7,10 @@ var app = {
, current_admin: <%= !!(current_user && current_role?(:super_admin)) %>
, nonprofit: <%= @nonprofit ? raw(@nonprofit.to_json(root:false)) : 'undefined' %>
, nonprofit_id : <%= @nonprofit ? @nonprofit.id : 'undefined' %>
, user: <%= current_user ? raw("render('app_data/user', user: current_user)") : 'undefined' %>
, user: <%= current_user ? raw(render('app_data/user.json', user: current_user)) : 'undefined' %>
, user_id: <%= current_user ? current_user.id : 'undefined' %>
, profile: <%= current_user ? raw("render('app_data/profile', profile: current_user.profile)") : 'undefined' %>
, profile_id: <%= current_user ? current_user.profile.id : 'undefined' %>
, profile: <%= current_user&.profile ? raw(render('app_data/profile.json', profile: current_user.profile)) : 'undefined' %>
, profile_id: <%= current_user&.profile ? current_user.profile.id : 'undefined' %>
, asset_path: "<%= Rails.application.config.assets.prefix %>"
, host_with_port: "//<%= request.host_with_port %>"
, google_api: "<%= ENV['GOOGLE_API_KEY'] %>"