From 822705c54cf59df6fb200a1688853afcd247a151 Mon Sep 17 00:00:00 2001 From: Nicolas Florentin Date: Tue, 24 May 2016 11:43:47 +0200 Subject: [PATCH] adds necessary code to permit navi gami plugin to add data in user profile view --- app/assets/javascripts/controllers/members.coffee | 2 +- app/assets/templates/shared/publicProfile.html.erb | 3 ++- app/views/api/members/show.json.jbuilder | 2 +- lib/plugin/instance.rb | 4 ++++ lib/plugin_registry.rb | 4 ++++ 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/controllers/members.coffee b/app/assets/javascripts/controllers/members.coffee index 7c7e4bf98..1dfe2cd99 100644 --- a/app/assets/javascripts/controllers/members.coffee +++ b/app/assets/javascripts/controllers/members.coffee @@ -214,7 +214,7 @@ Application.Controllers.controller "EditProfileController", ["$scope", "$rootSco Application.Controllers.controller "ShowProfileController", ["$scope", 'memberPromise', 'SocialNetworks', ($scope, memberPromise, SocialNetworks) -> ## Selected user's informations - $scope.user = memberPromise + $scope.user = memberPromise # DEPENDENCY WITH NAVINUM GAMIFICATION PLUGIN !!!! ## List of social networks associated with this user and toggle 'show all' state $scope.social = diff --git a/app/assets/templates/shared/publicProfile.html.erb b/app/assets/templates/shared/publicProfile.html.erb index 28a8b938a..fadb25a65 100644 --- a/app/assets/templates/shared/publicProfile.html.erb +++ b/app/assets/templates/shared/publicProfile.html.erb @@ -37,6 +37,7 @@
+ <%= PluginRegistry.code_insertions["html.user.profile"] %>
@@ -126,4 +127,4 @@ - \ No newline at end of file + diff --git a/app/views/api/members/show.json.jbuilder b/app/views/api/members/show.json.jbuilder index 5c23588dd..bdc715b02 100644 --- a/app/views/api/members/show.json.jbuilder +++ b/app/views/api/members/show.json.jbuilder @@ -1,4 +1,4 @@ -json.extract! @member, :id, :username, :email, :group_id, :slug, :invoicing_disabled, :is_allow_contact +json.extract! @member, :id, :uid, :username, :email, :group_id, :slug, :invoicing_disabled, :is_allow_contact json.role @member.roles.first.name json.name @member.profile.full_name json.need_completion @member.need_completion? diff --git a/lib/plugin/instance.rb b/lib/plugin/instance.rb index e951ed35f..b56eea9bb 100644 --- a/lib/plugin/instance.rb +++ b/lib/plugin/instance.rb @@ -62,6 +62,10 @@ module Plugin assets << [full_path, opts] end + def register_html_code_insertion(key, html_code) + PluginRegistry.code_insertions[key] = html_code + end + def register_css(style) # useless ? styles << style end diff --git a/lib/plugin_registry.rb b/lib/plugin_registry.rb index dfb81e05e..acc0e6d38 100644 --- a/lib/plugin_registry.rb +++ b/lib/plugin_registry.rb @@ -14,6 +14,10 @@ class PluginRegistry def stylesheets @stylesheets ||= Set.new end + + def code_insertions + @code_insertions ||= {} + end end def self.register_glob(root, extension, options=nil)