[Git][noosfero/noosfero][master] custom_domain: Add profile to some plugins' control panel

Bráulio Bhavamitra gitlab at mg.gitlab.com
Wed Jun 8 20:39:43 BRT 2016


Bráulio Bhavamitra pushed to branch master at Noosfero / noosfero


Commits:
ee8510cb by Braulio Bhavamitra at 2016-06-08T20:39:14-03:00
custom_domain: Add profile to some plugins' control panel

- - - - -


4 changed files:

- lib/noosfero/plugin.rb
- plugins/analytics/lib/analytics_plugin/base.rb
- plugins/custom_forms/lib/custom_forms_plugin.rb
- plugins/sub_organizations/lib/sub_organizations_plugin.rb


Changes:

=====================================
lib/noosfero/plugin.rb
=====================================
--- a/lib/noosfero/plugin.rb
+++ b/lib/noosfero/plugin.rb
@@ -13,6 +13,10 @@ class Noosfero::Plugin
     context.environment if self.context
   end
 
+  def profile
+    context.send :profile if self.context
+  end
+
   class << self
 
     include Noosfero::Plugin::ParentMethods


=====================================
plugins/analytics/lib/analytics_plugin/base.rb
=====================================
--- a/plugins/analytics/lib/analytics_plugin/base.rb
+++ b/plugins/analytics/lib/analytics_plugin/base.rb
@@ -42,7 +42,7 @@ class AnalyticsPlugin::Base < Noosfero::Plugin
     {
       title: I18n.t('analytics_plugin.lib.plugin.panel_button'),
       icon: 'analytics-access',
-      url: {controller: 'analytics_plugin/stats', action: :index}
+      url: {controller: 'analytics_plugin/stats', profile: profile.identifier, action: :index}
     }
   end
 


=====================================
plugins/custom_forms/lib/custom_forms_plugin.rb
=====================================
--- a/plugins/custom_forms/lib/custom_forms_plugin.rb
+++ b/plugins/custom_forms/lib/custom_forms_plugin.rb
@@ -13,7 +13,7 @@ class CustomFormsPlugin < Noosfero::Plugin
   end
 
   def control_panel_buttons
-    {:title => _('Manage Forms'), :icon => 'custom-forms', :url => {:controller => 'custom_forms_plugin_myprofile'}}
+    {title: _('Manage Forms'), icon: 'custom-forms', url: {profile: profile.identifier, controller: 'custom_forms_plugin_myprofile'}}
   end
 
 end


=====================================
plugins/sub_organizations/lib/sub_organizations_plugin.rb
=====================================
--- a/plugins/sub_organizations/lib/sub_organizations_plugin.rb
+++ b/plugins/sub_organizations/lib/sub_organizations_plugin.rb
@@ -20,7 +20,7 @@ class SubOrganizationsPlugin < Noosfero::Plugin
 
   def control_panel_buttons
     if context.profile.organization? && Organization.parents(context.profile).blank?
-      { :title => _('Manage sub-groups'), :icon => 'groups', :url => {:controller => 'sub_organizations_plugin_myprofile'} }
+      { title: _('Manage sub-groups'), icon: 'groups', url: {profile: profile.identifier, controller: :sub_organizations_plugin_myprofile} }
     end
   end
 



View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/ee8510cb1fdf394809925e881408cd387e08067a
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160608/be364705/attachment-0001.html>


More information about the Noosfero-dev mailing list