Commit 6ae8903826d6cc279d6b7b98348f590f970e7f09

Authored by Rodrigo Souto
Committed by Daniela Feitosa
1 parent 8f1fdd18

Email request

* Features:
    - Extension of ActionMailer::Base so that it can append or prepend
      new paths to view_paths and each instance of it has it's own view
      paths. So if I define Mailer < ActionMailer::Base, my new class
      Mailer will have an independent view_path from ActionMailer,
      despite having a default value equal to it.
    - Adding new method root_path for Plugins.
  * Fixes:
    - select_country helper receive options too.
    - Passing request form through ajax serialize instead of hardcoded.
app/helpers/profile_editor_helper.rb
@@ -104,8 +104,8 @@ module ProfileEditorHelper @@ -104,8 +104,8 @@ module ProfileEditorHelper
104 @country_helper ||= CountriesHelper.instance 104 @country_helper ||= CountriesHelper.instance
105 end 105 end
106 106
107 - def select_country(title, object, method, options)  
108 - labelled_form_field(title, select(object, method, [[_('[Select ...]'), nil]] + country_helper.countries, {}, options)) 107 + def select_country(title, object, method, html_options = {}, options = {})
  108 + labelled_form_field(title, select(object, method, [[_('[Select ...]'), nil]] + country_helper.countries, options, html_options))
109 end 109 end
110 110
111 def select_schooling(object, method, options) 111 def select_schooling(object, method, options)
config/initializers/action_mailer_extensions.rb 0 → 100644
@@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
  1 +module ActionMailer
  2 + class Base
  3 + class_inheritable_accessor :view_paths
  4 +
  5 + def self.prepend_view_path(path)
  6 + view_paths.unshift(*path)
  7 + ActionView::TemplateFinder.process_view_paths(path)
  8 + end
  9 +
  10 + def self.append_view_path(path)
  11 + view_paths.push(*path)
  12 + ActionView::TemplateFinder.process_view_paths(path)
  13 + end
  14 +
  15 + def self.view_paths
  16 + @view_paths ||= [template_root]
  17 + end
  18 +
  19 + def view_paths
  20 + self.class.view_paths
  21 + end
  22 +
  23 + def initialize_template_class(assigns)
  24 + ActionView::Base.new(view_paths, assigns, self)
  25 + end
  26 +
  27 + end
  28 +end
lib/noosfero/plugin.rb
@@ -39,6 +39,9 @@ class Noosfero::Plugin @@ -39,6 +39,9 @@ class Noosfero::Plugin
39 compute_public_path((public_name + '/' + file), 'plugins') 39 compute_public_path((public_name + '/' + file), 'plugins')
40 end 40 end
41 41
  42 + def root_path
  43 + Rails.root+'/plugins/'+public_name
  44 + end
42 45
43 # Here the developer should specify the meta-informations that the plugin can 46 # Here the developer should specify the meta-informations that the plugin can
44 # inform. 47 # inform.
public/stylesheets/application.css
@@ -2979,6 +2979,7 @@ div#activation_enterprise div { @@ -2979,6 +2979,7 @@ div#activation_enterprise div {
2979 border: 1px solid #888; 2979 border: 1px solid #888;
2980 margin-bottom: 10px; 2980 margin-bottom: 10px;
2981 padding: 5px 10px; 2981 padding: 5px 10px;
  2982 + position: relative;
2982 } 2983 }
2983 2984
2984 #product_list .product-pic { 2985 #product_list .product-pic {