From 5087a3e3f1587429729b8b00fd50c2f559278850 Mon Sep 17 00:00:00 2001 From: Sagarpreet Chadha Date: Mon, 22 Jan 2018 20:03:36 +0530 Subject: [PATCH] Maps added to profile page #1940 (#1965) * Added maps * Created _userLeaflet.html.erb * Maps added * Maps added * Share Location button added * Changed local variable to meaningful name * Static image for sharing location . * Uploaded static image of map * Small change * Static image deleted * Changes done +code indentation done --- app/controllers/users_controller.rb | 12 ++++++++++++ app/views/map/_userLeaflet.html.erb | 24 ++++++++++++++++++++++++ app/views/users/profile.html.erb | 14 +++++++++----- 3 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 app/views/map/_userLeaflet.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 8af78a30e3..494ee7c95f 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -132,6 +132,18 @@ def profile @facebook = @profile_user.social_link("facebook") @instagram = @profile_user.social_link("instagram") + + @map_lat = nil + @map_lon = nil + @map_blurred = nil + if(@profile_user.has_power_tag("lat") && @profile_user.has_power_tag("lon")) + @map_lat = @profile_user.get_value_of_power_tag("lat").to_f + @map_lon = @profile_user.get_value_of_power_tag("lon").to_f + if(@profile_user.has_power_tag("blurred")) + @map_blurred = @profile_user.get_value_of_power_tag("blurred") + end + end + if @user.status == 0 if current_user && (current_user.role == "admin" || current_user.role == "moderator") flash.now[:error] = I18n.t('users_controller.user_has_been_banned') diff --git a/app/views/map/_userLeaflet.html.erb b/app/views/map/_userLeaflet.html.erb new file mode 100644 index 0000000000..0c71a01d12 --- /dev/null +++ b/app/views/map/_userLeaflet.html.erb @@ -0,0 +1,24 @@ +<% if haslocation == true %> + <% unique_id = rand(100) %> + +
+ +<% else %> +
+ + +
+ +<% end %> diff --git a/app/views/users/profile.html.erb b/app/views/users/profile.html.erb index bd6a236e43..6032fa2223 100644 --- a/app/views/users/profile.html.erb +++ b/app/views/users/profile.html.erb @@ -127,7 +127,7 @@