trusty-layouts-extension 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. data/MIT-LICENSE +98 -0
  2. data/README.md +115 -0
  3. data/Rakefile +144 -0
  4. data/VERSION +1 -0
  5. data/app/models/haml_filter.rb +5 -0
  6. data/app/models/rails_page.rb +39 -0
  7. data/app/views/layouts/trusty.html.haml +1 -0
  8. data/config/initializers/trusty_config.rb +1 -0
  9. data/config/routes.rb +0 -0
  10. data/layouts_extension.rb +21 -0
  11. data/lib/haml_layouts/models/layout.rb +33 -0
  12. data/lib/haml_layouts/models/page.rb +33 -0
  13. data/lib/layouts/engine.rb +5 -0
  14. data/lib/nested_layouts/tags/core.rb +150 -0
  15. data/lib/share_layouts/controllers/action_controller.rb +26 -0
  16. data/lib/share_layouts/helpers/action_view.rb +48 -0
  17. data/lib/tasks/layouts_extension_tasks.rake +55 -0
  18. data/lib/trusty-layouts-extension.rb +1 -0
  19. data/spec/controllers/share_controller_spec.rb +119 -0
  20. data/spec/datasets/layouts_layouts.rb +36 -0
  21. data/spec/datasets/layouts_pages.rb +43 -0
  22. data/spec/lib/haml_layouts/haml_layouts_extension_spec.rb +22 -0
  23. data/spec/lib/haml_layouts/models/layout_spec.rb +36 -0
  24. data/spec/lib/haml_layouts/models/page_spec.rb +40 -0
  25. data/spec/lib/nested_layouts/nested_layouts_extension_spec.rb +16 -0
  26. data/spec/lib/nested_layouts/tags/core_spec.rb +147 -0
  27. data/spec/lib/share_layouts/controllers/action_controller_spec.rb +44 -0
  28. data/spec/lib/share_layouts/helpers/action_view_spec.rb +171 -0
  29. data/spec/lib/share_layouts/share_layouts_extension_spec.rb +22 -0
  30. data/spec/models/haml_filter_spec.rb +0 -0
  31. data/spec/models/rails_page_spec.rb +63 -0
  32. data/spec/spec.opts +3 -0
  33. data/spec/spec_helper.rb +22 -0
  34. data/trusty-layouts-extension.gemspec +31 -0
  35. data/vendor/plugins/rails_upgrade/MIT-LICENSE +20 -0
  36. data/vendor/plugins/rails_upgrade/README.rdoc +26 -0
  37. data/vendor/plugins/rails_upgrade/Rakefile +22 -0
  38. data/vendor/plugins/rails_upgrade/init.rb +2 -0
  39. data/vendor/plugins/rails_upgrade/install.rb +38 -0
  40. data/vendor/plugins/rails_upgrade/lib/application_checker.rb +506 -0
  41. data/vendor/plugins/rails_upgrade/lib/gemfile_generator.rb +95 -0
  42. data/vendor/plugins/rails_upgrade/lib/new_configuration_generator.rb +59 -0
  43. data/vendor/plugins/rails_upgrade/lib/rails_upgrade.rb +0 -0
  44. data/vendor/plugins/rails_upgrade/lib/routes_upgrader.rb +344 -0
  45. data/vendor/plugins/rails_upgrade/lib/tasks/rails_upgrade_tasks.rake +79 -0
  46. data/vendor/plugins/rails_upgrade/test/application_checker_test.rb +344 -0
  47. data/vendor/plugins/rails_upgrade/test/gemfile_generator_test.rb +72 -0
  48. data/vendor/plugins/rails_upgrade/test/new_configuration_generator_test.rb +63 -0
  49. data/vendor/plugins/rails_upgrade/test/routes_upgrader_test.rb +218 -0
  50. data/vendor/plugins/rails_upgrade/test/test_helper.rb +5 -0
  51. data/vendor/plugins/rails_upgrade/uninstall.rb +1 -0
  52. metadata +134 -0
@@ -0,0 +1,98 @@
1
+ # Layouts Extension
2
+
3
+ Is a collaboration of many parties that solves some common shortcomings with standard Radiant layouts
4
+
5
+ http://github.com/squaretalent/radiant-layouts-extension/
6
+
7
+ ## Nested Layouts
8
+
9
+ lib/nested_layouts/core.rb
10
+
11
+ spec/lib/nested_layouts/nested_layouts_extension_spec.rb
12
+ spec/lib/nested_layouts/tags/core_spec.rb
13
+
14
+ == MIT License
15
+
16
+ Copyright (c) 2008 Michael O. Klett.
17
+
18
+ Permission is hereby granted, free of charge, to any person obtaining a copy
19
+ of this software and associated documentation files (the "Software"), to deal
20
+ in the Software without restriction, including without limitation the rights
21
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
22
+ copies of the Software, and to permit persons to whom the Software is
23
+ furnished to do so, subject to the following conditions:
24
+
25
+ The above copyright notice and this permission notice shall be included in all
26
+ copies or substantial portions of the Software.
27
+
28
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
33
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34
+ SOFTWARE.
35
+
36
+ ## Shared Layouts
37
+
38
+ lib/share_layouts/controllers/action_controller.rb
39
+ lib/share_layouts/helpers/action_view.rb
40
+ app/models/rails_page/action_view.rb
41
+
42
+ spec/controllers/share_controller_spec.rb
43
+ spec/lib/share_layouts/share_layouts_extension_spec.rb
44
+ spec/lib/share_layouts/controllers/action_controller_spec.rb
45
+ spec/lib/share_layouts/helpers/action_view_spec.rb
46
+
47
+ == MIT Licence
48
+
49
+ Copyright (c) 2010 Radiant - Jim Gay, William Ross
50
+
51
+ Permission is hereby granted, free of charge, to any person obtaining a copy
52
+ of this software and associated documentation files (the "Software"), to deal
53
+ in the Software without restriction, including without limitation the rights
54
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
55
+ copies of the Software, and to permit persons to whom the Software is
56
+ furnished to do so, subject to the following conditions:
57
+
58
+ The above copyright notice and this permission notice shall be included in all
59
+ copies or substantial portions of the Software.
60
+
61
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
62
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
63
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
64
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
65
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
66
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
67
+ SOFTWARE.
68
+
69
+ ## HAML Layouts
70
+
71
+ lib/haml_layouts/models/layout.rb
72
+ lib/haml_layouts/models/page.rb
73
+
74
+ spec/lib/haml_layouts/haml_layouts_extension_spec.rb
75
+ spec/lib/haml_layouts/models/layout_spec.rb
76
+ spec/lib/haml_layouts/models/layout_spec.rb
77
+
78
+ == MIT Licence
79
+
80
+ Copyright (c) 2010 The Frontier Group Pty. Ltd - Dirk Kelly, Tony Issakov
81
+
82
+ Permission is hereby granted, free of charge, to any person obtaining a copy
83
+ of this software and associated documentation files (the "Software"), to deal
84
+ in the Software without restriction, including without limitation the rights
85
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
86
+ copies of the Software, and to permit persons to whom the Software is
87
+ furnished to do so, subject to the following conditions:
88
+
89
+ The above copyright notice and this permission notice shall be included in all
90
+ copies or substantial portions of the Software.
91
+
92
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
93
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
94
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
95
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
96
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
97
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
98
+ SOFTWARE.
@@ -0,0 +1,115 @@
1
+ # Layouts
2
+
3
+ Merges share_layouts and nested_layouts, making the whole layout adventure a lot more enjoyable
4
+
5
+ ## Share Layouts
6
+
7
+ ### Introduction
8
+
9
+ Allows Rails controllers/actions to use Trusty CMS layouts as their "layout".
10
+ content_for blocks are mapped to page parts, with the exception of :title and
11
+ :breadcrumbs, which map to their specific default tags. The default content,
12
+ or @content_for_layout, is mapped to the 'body' part.
13
+
14
+ #### Inside a controller Controller
15
+
16
+ SomeController < SiteController
17
+ trusty_layout 'Layout name'
18
+
19
+ # or
20
+
21
+ trusty_layout { |controller| c.action_name == "index" ? "main" : "alt" }
22
+
23
+ # and
24
+
25
+ def delete
26
+ @trusty_layout = 'delete'
27
+ end
28
+
29
+ end
30
+
31
+ trusty_layout takes the same options as the built-in layout. To specifically
32
+ override the Trusty CMS layout and use a standard Rails one use
33
+ :layout => "mine", or :layout => false for no layout, as options to render.
34
+
35
+ To choose a different Trusty CMS layout, set the @trusty_layout instance
36
+ variable to the name of a Trusty CMS layout in your controller or view.
37
+
38
+ ### Acknowledgments
39
+
40
+ * Merged into radiant-layouts-extension, Dirk Kelly, August 2010
41
+ * Updated to work with 0.8 RC1 by: Johannes Fahrenkrug (http://springenwerk.com), May 22, 2009
42
+ * Created by: Sean Cribbs (seancribbs AT gmail DOT com), September 20, 2007
43
+
44
+ * Thanks to John Long for clarifying and simplifying the process for me!
45
+ * Thanks to xtoddx for improving the tests and support for tags that use the request and response.
46
+ * Thanks to Digital Pulp, Inc. for funding the initial development of this extension as part of the Redken.com project.
47
+
48
+ ## Nested Layouts
49
+
50
+ ### Introduction
51
+
52
+ Nested Layouts enables reuse of a top-level "master" layout (one that contains your <html> tags and the overall
53
+ structure/wrapper of your site) for several different "nested" layouts (i.e. a one-column layout and a
54
+ two-column layout). Keep your layouts DRY!
55
+
56
+ A simple example is of the following wrapper and page layout
57
+
58
+ <!-- Application Layout -->
59
+ <!html>
60
+ <body class="<r:layout />">
61
+ <r:content_for_layout />
62
+ </body>
63
+ </html>
64
+
65
+ <!-- Page Layout -->
66
+ <r:inside_layout name='Application'>
67
+ <h1>Hi</h1>
68
+ </r:inside_layout>
69
+
70
+ This would render the following if Page Layout was called
71
+
72
+ <!html>
73
+ <body class="<r:layout />">
74
+ <h1>Hi</h1>
75
+ </body>
76
+ </html>
77
+
78
+ ### Acknowledgments
79
+
80
+ * Merged into radiant-layouts-extension, Dirk Kelly, August 2010
81
+ * Original Source: http://github.com/moklett/radiant-nested-layouts-extension
82
+
83
+ ## Haml Layouts
84
+
85
+ [http://haml-lang.com/](http://haml-lang.com/)
86
+
87
+ ### Introduction
88
+
89
+ Write your layouts and radius tags in haml, with support for nested layouts and radius attributes
90
+
91
+ // Parent Layout - with content/type set as 'haml'
92
+ %div{:id=>"parent",:title=>"<r:title />"}
93
+ %r:content_for_layout
94
+
95
+ // Child Layout - with content/type set as 'haml'
96
+ %r:inside_layout{:name=>"Parent"}
97
+ %h2
98
+ %:title
99
+
100
+ <div id="parent" title="some title">
101
+ <h2>
102
+ some title
103
+ </h2>
104
+ </div>
105
+
106
+ Integrates the work of [SaturnFlyer](http://github.com/saturnflyer) creating a haml_filter on pages and snippets. Additional task involved.
107
+
108
+ changing the order which objects with this type are renders. The content is turned into html before the
109
+ radius tags are passed.
110
+
111
+ ### Acknowledgments
112
+
113
+ * [SaturnFlyer](http://github.com/saturnflyer) [@SaturnFlyer](http://twitter.com/saturnflyer) (Jim Gay) | Original idea http://github.com/saturnflyer/radiant-haml_filter-extension
114
+ * [Tissak](http://github.com/tissak) [@Tissak](http://twitter.com/tissak) (Tony Issakov) | Insisted that this was possible, and then wrote up an implementation in 10 minutes
115
+ * [DirkKelly](http://github.com/dirkkelly) [@DirkKelly](http://twitter.com/dirkkelly) (Dirk Kelly) | Merged into radiant-layouts-extension and hooked page parse_object to support snippets and content haml radius tags
@@ -0,0 +1,144 @@
1
+ # I think this is the one that should be moved to the extension Rakefile template
2
+
3
+ # In rails 1.2, plugins aren't available in the path until they're loaded.
4
+ # Check to see if the rspec plugin is installed first and require
5
+ # it if it is. If not, use the gem version.
6
+
7
+ # Determine where the RSpec plugin is by loading the boot
8
+ unless defined? TRUSTY_CMS_ROOT
9
+ ENV["RAILS_ENV"] = "test"
10
+ case
11
+ when ENV["TRUSTY_ENV_FILE"]
12
+ require File.dirname(ENV["TRUSTY_ENV_FILE"]) + "/boot"
13
+ when File.dirname(__FILE__) =~ %r{vendor/trusty_cms/vendor/extensions}
14
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../")}/config/boot"
15
+ else
16
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../")}/config/boot"
17
+ end
18
+ end
19
+
20
+ require 'rake'
21
+ require 'rake/rdoctask'
22
+ require 'rake/testtask'
23
+
24
+ # In rails 1.2, plugins aren't available in the path until they're loaded.
25
+ # Check to see if the rspec plugin is installed first and require
26
+ # it if it is. If not, use the gem version.
27
+
28
+ # Determine where the TRUSTY_CMS_ROOT plugin is by loading the boot
29
+ unless defined? TRUSTY_CMS_ROOT
30
+ ENV["RAILS_ENV"] = "test"
31
+ case
32
+ when ENV["TRUSTY_ENV_FILE"]
33
+ require File.dirname(ENV["TRUSTY_ENV_FILE"]) + "/boot"
34
+ when File.dirname(__FILE__) =~ %r{vendor/trusty/vendor/extensions}
35
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../")}/config/boot"
36
+ else
37
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../")}/config/boot"
38
+ end
39
+ end
40
+
41
+ require 'rake'
42
+ require 'rake/rdoctask'
43
+ require 'rake/testtask'
44
+
45
+ rspec_base = File.expand_path(TRUSTY_CMS_ROOT + '/vendor/plugins/rspec/lib')
46
+ $LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
47
+ require 'spec/rake/spectask'
48
+ require 'cucumber'
49
+ require 'cucumber/rake/task'
50
+
51
+ # Cleanup the TRUSTY_CMS_ROOT constant so specs will load the environment
52
+ Object.send(:remove_const, :TRUSTY_CMS_ROOT)
53
+
54
+ extension_root = File.expand_path(File.dirname(__FILE__))
55
+
56
+ task :default => :spec
57
+ task :stats => "spec:statsetup"
58
+
59
+ desc "Run all specs in spec directory"
60
+ Spec::Rake::SpecTask.new(:spec) do |t|
61
+ t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
62
+ t.spec_files = FileList['spec/**/*_spec.rb']
63
+ end
64
+
65
+ task :features => 'spec:integration'
66
+
67
+ namespace :spec do
68
+ desc "Run all specs in spec directory with RCov"
69
+ Spec::Rake::SpecTask.new(:rcov) do |t|
70
+ t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
71
+ t.spec_files = FileList['spec/**/*_spec.rb']
72
+ t.rcov = true
73
+ t.rcov_opts = ['--exclude', 'spec', '--rails']
74
+ end
75
+
76
+ desc "Print Specdoc for all specs"
77
+ Spec::Rake::SpecTask.new(:doc) do |t|
78
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
79
+ t.spec_files = FileList['spec/**/*_spec.rb']
80
+ end
81
+
82
+ [:models, :controllers, :views, :helpers].each do |sub|
83
+ desc "Run the specs under spec/#{sub}"
84
+ Spec::Rake::SpecTask.new(sub) do |t|
85
+ t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
86
+ t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
87
+ end
88
+ end
89
+
90
+ desc "Run the Cucumber features"
91
+ Cucumber::Rake::Task.new(:integration) do |t|
92
+ t.fork = true
93
+ t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'pretty')]
94
+ # t.feature_pattern = "#{extension_root}/features/**/*.feature"
95
+ t.profile = "default"
96
+ end
97
+
98
+ # Setup specs for stats
99
+ task :statsetup do
100
+ require 'code_statistics'
101
+ ::STATS_DIRECTORIES << %w(Model\ specs spec/models)
102
+ ::STATS_DIRECTORIES << %w(View\ specs spec/views)
103
+ ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers)
104
+ ::STATS_DIRECTORIES << %w(Helper\ specs spec/views)
105
+ ::CodeStatistics::TEST_TYPES << "Model specs"
106
+ ::CodeStatistics::TEST_TYPES << "View specs"
107
+ ::CodeStatistics::TEST_TYPES << "Controller specs"
108
+ ::CodeStatistics::TEST_TYPES << "Helper specs"
109
+ ::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
110
+ end
111
+
112
+ namespace :db do
113
+ namespace :fixtures do
114
+ desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y"
115
+ task :load => :environment do
116
+ require 'active_record/fixtures'
117
+ ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
118
+ (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'spec', 'fixtures', '*.{yml,csv}'))).each do |fixture_file|
119
+ Fixtures.create_fixtures('spec/fixtures', File.basename(fixture_file, '.*'))
120
+ end
121
+ end
122
+ end
123
+ end
124
+ end
125
+
126
+ desc 'Generate documentation for the layouts extension.'
127
+ Rake::RDocTask.new(:rdoc) do |rdoc|
128
+ rdoc.rdoc_dir = 'rdoc'
129
+ rdoc.title = 'LayoutsExtension'
130
+ rdoc.options << '--line-numbers' << '--inline-source'
131
+ rdoc.rdoc_files.include('README')
132
+ rdoc.rdoc_files.include('lib/**/*.rb')
133
+ end
134
+
135
+ # For extensions that are in transition
136
+ desc 'Test the Layout extension.'
137
+ Rake::TestTask.new(:test) do |t|
138
+ t.libs << 'lib'
139
+ t.pattern = 'test/**/*_test.rb'
140
+ t.verbose = true
141
+ end
142
+
143
+ # Load any custom rakefiles for extension
144
+ Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f }
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.1.3
@@ -0,0 +1,5 @@
1
+ class HamlFilter < TextFilter
2
+ def filter(text)
3
+ Haml::Engine.new(text).render.gsub(/&lt;(\/)?r:(.+?)\s*(\/?\\?)&gt;/m,"<\\1r:\\2\\3>")
4
+ end
5
+ end
@@ -0,0 +1,39 @@
1
+ class RailsPage < Page
2
+
3
+ display_name "Application"
4
+ attr_accessor :breadcrumbs
5
+
6
+ def find_by_url(url, live=true, clean=true)
7
+ found_page = super
8
+ if found_page.nil? || found_page.is_a?(FileNotFoundPage)
9
+ url = clean_url(url) if clean
10
+ self if url.starts_with?(self.url)
11
+ else
12
+ found_page
13
+ end
14
+ end
15
+
16
+ def url=(path)
17
+ @url = path
18
+ end
19
+
20
+ def url
21
+ @url || super
22
+ end
23
+
24
+ def build_parts_from_hash!(content)
25
+ content.each do |k,v|
26
+ (part(k) || parts.build(:name => k.to_s, :filter_id => "")).content = v
27
+ end
28
+ end
29
+
30
+ alias_method "tag:old_breadcrumbs", "tag:breadcrumbs"
31
+ tag 'breadcrumbs' do |tag|
32
+ if tag.locals.page.is_a?(RailsPage) && tag.locals.page.breadcrumbs
33
+ tag.locals.page.breadcrumbs
34
+ else
35
+ render_tag('old_breadcrumbs', tag)
36
+ end
37
+ end
38
+
39
+ end
@@ -0,0 +1 @@
1
+ = trusty_layout.html_safe
@@ -0,0 +1 @@
1
+ require 'layouts/engine'
File without changes
@@ -0,0 +1,21 @@
1
+ class LayoutsExtension < TrustyCms::Extension
2
+ version YAML::load_file(File.join(File.dirname(__FILE__), 'VERSION'))
3
+ description "A set of useful extensions to standard Layouts."
4
+ url "http://github.com/squaretalent/trusty-share-layouts-extension"
5
+
6
+ def activate
7
+ # Shared Layouts
8
+ RailsPage
9
+ ActionController::Base.send :include, ShareLayouts::Controllers::ActionController
10
+ ActionView::Base.send :include, ShareLayouts::Helpers::ActionView
11
+
12
+ # Nested Layouts
13
+ Page.send :include, NestedLayouts::Tags::Core
14
+
15
+ # HAML Layouts
16
+ Layout.send :include, HamlLayouts::Models::Layout
17
+ Page.send :include, HamlLayouts::Models::Page
18
+ HamlFilter
19
+ end
20
+
21
+ end
@@ -0,0 +1,33 @@
1
+ module HamlLayouts
2
+ module Models
3
+ module Layout
4
+
5
+ def self.included(base)
6
+ base.class_eval do
7
+
8
+ # Will render html from haml if necessary
9
+ def rendered_content
10
+ if is_haml?
11
+ # The gsub will replace all escaped radius tags with html
12
+ HamlFilter.filter(content)
13
+ else
14
+ content
15
+ end
16
+ end
17
+
18
+ # Returns 'text/html' to the browser (if haml)
19
+ def content_type
20
+ self[:content_type] == 'haml' ? 'text/html' : self[:content_type]
21
+ end
22
+
23
+ # Overwrites the standard Trusty CMS Render and pumps out haml if necessary
24
+ def is_haml?
25
+ self[:content_type] == 'haml'
26
+ end
27
+
28
+ end
29
+ end
30
+
31
+ end
32
+ end
33
+ end