Merge branch 'feature/widgets' of https://dev.finn.de/git/reporting-engine into feature/widgets

pull/6827/head
jwollert 14 years ago
commit a4de687b89
  1. 4
      init.rb
  2. 14
      lib/widget.rb
  3. 2
      lib/widget/settings.rb

@ -4,4 +4,6 @@ fail "upgrade ruby version, ruby < 1.8.7 suffers from Hash#hash bug" if {:a => 1
require 'big_decimal_patch' require 'big_decimal_patch'
require 'to_date_patch' require 'to_date_patch'
config.middleware.use ::ActionDispatch::Static, "#{root}/assets" if Rails.version.start_with? "3"
config.middleware.use ::ActionDispatch::Static, "#{root}/assets"
end

@ -1,14 +1,22 @@
class ActionView::Base class ActionView::Base
def render_widget(widget, subject, options = {}, &block) def render_widget(widget, subject, options = {}, &block)
i = widget.new(subject) i = widget.new(subject)
i.config = config if Rails.version.start_with? "3"
i.controller = controller i.config = config
i._routes = _routes
else
i.output_buffer = ""
end
i._content_for = @_content_for i._content_for = @_content_for
i._routes = _routes i.controller = controller
i.render_with_options(options, &block).html_safe i.render_with_options(options, &block).html_safe
end end
end end
if Rails.version.start_with? "2"
class ::String; def html_safe; self; end; end
end
class Widget < ActionView::Base class Widget < ActionView::Base
include ActionView::Helpers::TagHelper include ActionView::Helpers::TagHelper
include ActionView::Helpers::AssetTagHelper include ActionView::Helpers::AssetTagHelper

@ -1,6 +1,6 @@
class Widget::Settings < Widget::Base class Widget::Settings < Widget::Base
def render def render
form_for @query, :url => "#", :html => {:id => 'query_form', :method => :post} do |query_form| form_tag("#", {:id => 'query_form', :method => :post}) do |query_form|
content_tag :div, :id => "query_form_content" do content_tag :div, :id => "query_form_content" do
fieldsets = render_widget Widget::Settings::Fieldset, @query, { :type => "filter" } do fieldsets = render_widget Widget::Settings::Fieldset, @query, { :type => "filter" } do

Loading…
Cancel
Save