Commit ee8510cb1fdf394809925e881408cd387e08067a

Authored by Braulio Bhavamitra
1 parent f3f08e74

custom_domain: Add profile to some plugins' control panel

lib/noosfero/plugin.rb
@@ -13,6 +13,10 @@ class Noosfero::Plugin @@ -13,6 +13,10 @@ class Noosfero::Plugin
13 context.environment if self.context 13 context.environment if self.context
14 end 14 end
15 15
  16 + def profile
  17 + context.send :profile if self.context
  18 + end
  19 +
16 class << self 20 class << self
17 21
18 include Noosfero::Plugin::ParentMethods 22 include Noosfero::Plugin::ParentMethods
plugins/analytics/lib/analytics_plugin/base.rb
@@ -42,7 +42,7 @@ class AnalyticsPlugin::Base &lt; Noosfero::Plugin @@ -42,7 +42,7 @@ class AnalyticsPlugin::Base &lt; Noosfero::Plugin
42 { 42 {
43 title: I18n.t('analytics_plugin.lib.plugin.panel_button'), 43 title: I18n.t('analytics_plugin.lib.plugin.panel_button'),
44 icon: 'analytics-access', 44 icon: 'analytics-access',
45 - url: {controller: 'analytics_plugin/stats', action: :index} 45 + url: {controller: 'analytics_plugin/stats', profile: profile.identifier, action: :index}
46 } 46 }
47 end 47 end
48 48
plugins/custom_forms/lib/custom_forms_plugin.rb
@@ -13,7 +13,7 @@ class CustomFormsPlugin &lt; Noosfero::Plugin @@ -13,7 +13,7 @@ class CustomFormsPlugin &lt; Noosfero::Plugin
13 end 13 end
14 14
15 def control_panel_buttons 15 def control_panel_buttons
16 - {:title => _('Manage Forms'), :icon => 'custom-forms', :url => {:controller => 'custom_forms_plugin_myprofile'}} 16 + {title: _('Manage Forms'), icon: 'custom-forms', url: {profile: profile.identifier, controller: 'custom_forms_plugin_myprofile'}}
17 end 17 end
18 18
19 end 19 end
plugins/sub_organizations/lib/sub_organizations_plugin.rb
@@ -20,7 +20,7 @@ class SubOrganizationsPlugin &lt; Noosfero::Plugin @@ -20,7 +20,7 @@ class SubOrganizationsPlugin &lt; Noosfero::Plugin
20 20
21 def control_panel_buttons 21 def control_panel_buttons
22 if context.profile.organization? && Organization.parents(context.profile).blank? 22 if context.profile.organization? && Organization.parents(context.profile).blank?
23 - { :title => _('Manage sub-groups'), :icon => 'groups', :url => {:controller => 'sub_organizations_plugin_myprofile'} } 23 + { title: _('Manage sub-groups'), icon: 'groups', url: {profile: profile.identifier, controller: :sub_organizations_plugin_myprofile} }
24 end 24 end
25 end 25 end
26 26