infopark_rails_connector 6.8.0.210.ed204b0 → 6.8.0.322.c003f11
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.
- data/.yardopts +5 -0
- data/README +9 -20
- data/app/controllers/cms_controller.rb +3 -2
- data/app/controllers/comments_controller.rb +2 -2
- data/app/controllers/crm_form_controller.rb +5 -0
- data/app/controllers/pdf_controller.rb +1 -0
- data/app/controllers/rails_connector/default_cms_controller.rb +8 -4
- data/app/controllers/rails_connector/default_comments_controller.rb +1 -2
- data/app/controllers/rails_connector/default_crm_form_controller.rb +13 -0
- data/app/controllers/rails_connector/default_pdf_controller.rb +2 -0
- data/app/controllers/rails_connector/default_rss_controller.rb +4 -1
- data/app/controllers/rails_connector/default_search_controller.rb +2 -0
- data/app/controllers/rails_connector/default_user_controller.rb +10 -0
- data/app/controllers/rails_connector/pdf_external_controller.rb +2 -1
- data/app/controllers/rails_connector/time_machine_controller.rb +1 -1
- data/app/controllers/rss_controller.rb +1 -0
- data/app/controllers/search_controller.rb +5 -0
- data/app/controllers/seo_sitemap_controller.rb +2 -0
- data/app/controllers/user_controller.rb +5 -0
- data/app/helpers/cms_helper.rb +2 -1
- data/app/helpers/cms_routing_helper.rb +2 -1
- data/app/helpers/crm_form_helper.rb +4 -0
- data/app/helpers/rails_connector/cms_asset_helper.rb +3 -0
- data/app/helpers/rails_connector/default_cms_helper.rb +1 -1
- data/app/helpers/rails_connector/default_cms_routing_helper.rb +10 -5
- data/app/helpers/rails_connector/default_crm_form_helper.rb +4 -0
- data/app/helpers/rails_connector/default_user_helper.rb +7 -1
- data/app/helpers/rails_connector/display_helper.rb +7 -5
- data/app/helpers/rails_connector/layout_helper.rb +3 -0
- data/app/helpers/rails_connector/link_helper.rb +3 -0
- data/app/helpers/rails_connector/mandatory_label_helper.rb +1 -1
- data/app/helpers/rails_connector/menu_helper.rb +2 -1
- data/app/helpers/rails_connector/micronav_helper.rb +2 -0
- data/app/helpers/rails_connector/seo_helper.rb +2 -0
- data/app/helpers/rails_connector/table_of_contents_helper.rb +2 -0
- data/app/helpers/rails_connector/time_machine_helper.rb +2 -0
- data/app/helpers/rails_connector/tracking_helper.rb +2 -0
- data/app/helpers/ratings_helper.rb +1 -1
- data/app/helpers/user_helper.rb +4 -0
- data/app/mailers/confirmation_mailer.rb +5 -0
- data/app/models/crm_form.rb +1 -0
- data/app/models/rails_connector/default_comment.rb +1 -1
- data/app/models/rails_connector/link_list.rb +3 -1
- data/lib/generators/rails_connector/comments/comments_generator.rb +0 -1
- data/lib/generators/rails_connector/comments/templates/migration.rb +0 -1
- data/lib/generators/rails_connector/install/install_generator.rb +0 -1
- data/lib/generators/rails_connector/install/templates/obj_extensions.rb +2 -1
- data/lib/generators/rails_connector/ratings/ratings_generator.rb +0 -1
- data/lib/generators/rails_connector/ratings/templates/migration.rb +0 -1
- data/lib/infopark_rails_connector.rb +4 -2
- data/lib/rails_connector/authenticable.rb +2 -2
- data/lib/rails_connector/cms_accessible.rb +14 -10
- data/lib/rails_connector/cms_dispatch_controller.rb +0 -1
- data/lib/rails_connector/cms_env.rb +0 -1
- data/lib/rails_connector/cms_test_request.rb +1 -1
- data/lib/rails_connector/commentable.rb +2 -2
- data/lib/rails_connector/configuration/google_analytics.rb +7 -4
- data/lib/rails_connector/configuration/pdf_generator.rb +3 -0
- data/lib/rails_connector/configuration/rss.rb +8 -2
- data/lib/rails_connector/configuration.rb +56 -27
- data/lib/rails_connector/core_extensions/time.rb +1 -1
- data/lib/rails_connector/crm.rb +54 -46
- data/lib/rails_connector/engine.rb +1 -1
- data/lib/rails_connector/fop.rb +2 -2
- data/lib/rails_connector/fop_on_rails/document/dom_tree.rb +1 -1
- data/lib/rails_connector/fop_on_rails/document/images.rb +1 -1
- data/lib/rails_connector/fop_on_rails/document/tables.rb +1 -1
- data/lib/rails_connector/fop_on_rails/document.rb +1 -1
- data/lib/rails_connector/fop_on_rails.rb +2 -2
- data/lib/rails_connector/googlebot_checker.rb +0 -1
- data/lib/rails_connector/html_string.rb +2 -2
- data/lib/rails_connector/link_resolvable.rb +1 -1
- data/lib/rails_connector/liquid_support/field_value_drop.rb +1 -1
- data/lib/rails_connector/liquid_support/link_drop.rb +1 -1
- data/lib/rails_connector/liquid_support/liquid_template_handler.rb +6 -6
- data/lib/rails_connector/liquid_support/named_object_drop.rb +1 -1
- data/lib/rails_connector/liquid_support/obj_drop.rb +1 -1
- data/lib/rails_connector/liquid_support/obj_filters.rb +1 -1
- data/lib/rails_connector/liquid_support.rb +4 -2
- data/lib/rails_connector/markdown_string.rb +2 -2
- data/lib/rails_connector/rateable.rb +1 -1
- data/lib/rails_connector/seo.rb +15 -7
- data/lib/rails_connector/ses.rb +13 -5
- data/lib/rails_connector/string_tagging.rb +1 -1
- data/lib/rails_connector/syndicateable.rb +3 -1
- data/lib/search_request.rb +1 -0
- metadata +15 -66
@@ -1,6 +1,7 @@
|
|
1
1
|
module RailsConnector
|
2
2
|
|
3
3
|
# This module contains a helper that can be used to render attributes of the CMS models.
|
4
|
+
# @api public
|
4
5
|
module DisplayHelper
|
5
6
|
|
6
7
|
# For a consistent look of your site and easy maintenance, only the display helpers
|
@@ -9,10 +10,11 @@ module RailsConnector
|
|
9
10
|
# <%= display_value @obj.title %>
|
10
11
|
# Renders the value, taking its type into account.
|
11
12
|
# * An HtmlString will be exported by converting its links
|
12
|
-
# * A Time will be exported in an international form: Year-
|
13
|
+
# * A Time will be exported in an international form: Year-Month-Day Hour:Minutes
|
13
14
|
# * A non-HTML String will be quoted
|
14
15
|
# * other values will be rendered unchanged
|
15
16
|
#
|
17
|
+
# @api public
|
16
18
|
def display_value(value)
|
17
19
|
case value
|
18
20
|
when MarkdownString then markdown(convert_links(value)).html_safe
|
@@ -24,12 +26,13 @@ module RailsConnector
|
|
24
26
|
end
|
25
27
|
|
26
28
|
# Renders a field from the CMS, including an edit marker for the preview
|
27
|
-
# If the option :marker is false
|
29
|
+
# If the option :marker is +false+, no edit marker will be rendered.
|
28
30
|
#
|
29
31
|
# <%= display_field @obj, :title %>
|
30
32
|
#
|
31
|
-
# When creating an edit marker, all options except :marker are passed to MarkerHelper
|
33
|
+
# When creating an edit marker, all options except :marker are passed to {MarkerHelper#edit_marker}.
|
32
34
|
#
|
35
|
+
# @api public
|
33
36
|
def display_field(obj, attr, options = {})
|
34
37
|
options.reverse_merge!({
|
35
38
|
:marker => ![:id, :path, :created, :last_changed, :version].include?(attr.to_sym)
|
@@ -46,8 +49,7 @@ module RailsConnector
|
|
46
49
|
# Legacy method - deprecated
|
47
50
|
#
|
48
51
|
# Use display_value and display_field instead
|
49
|
-
|
50
|
-
def display(*args) #:nodoc:
|
52
|
+
def display(*args)
|
51
53
|
if args.last.kind_of? Hash
|
52
54
|
options = args.pop
|
53
55
|
else
|
@@ -2,10 +2,12 @@ module RailsConnector
|
|
2
2
|
|
3
3
|
# This module contains helpers that render tags for the html head
|
4
4
|
# and the end of the html body.
|
5
|
+
# @api public
|
5
6
|
module LayoutHelper
|
6
7
|
include TrackingHelper
|
7
8
|
|
8
9
|
# Renders all tags needed in the html head for the enabled features.
|
10
|
+
# @api public
|
9
11
|
def rails_connector_header_tags
|
10
12
|
html = "".html_safe
|
11
13
|
html += tag('meta', :name => 'generator',
|
@@ -19,6 +21,7 @@ module RailsConnector
|
|
19
21
|
end
|
20
22
|
|
21
23
|
# Renders all tags needed at the end of the body tag for the enabled features.
|
24
|
+
# @api public
|
22
25
|
def rails_connector_after_content_tags
|
23
26
|
html = "".html_safe
|
24
27
|
html += render_marker_code
|
@@ -3,6 +3,7 @@ require "uri"
|
|
3
3
|
module RailsConnector
|
4
4
|
|
5
5
|
# This module contains a helper that can be used to build markup for a link, e.g. a download link.
|
6
|
+
# @api public
|
6
7
|
module LinkHelper
|
7
8
|
# Generates a link by producing the corresponding HTML markup.
|
8
9
|
# <em>link</em> is the Link to be rendered, you may specify the following <em>options</em>:
|
@@ -45,6 +46,7 @@ module RailsConnector
|
|
45
46
|
# <a class='link' href='destination'>
|
46
47
|
# <span class='file_extension'>title</span>
|
47
48
|
# </a>
|
49
|
+
# @api public
|
48
50
|
def link(link, options = {})
|
49
51
|
link_attributes = {
|
50
52
|
:href => cms_path(link),
|
@@ -65,6 +67,7 @@ module RailsConnector
|
|
65
67
|
# For a list of valid <em>options</em> see #link.
|
66
68
|
#
|
67
69
|
# The generated list element has the CSS class 'linklist'.
|
70
|
+
# @api public
|
68
71
|
def link_list(link_list, options = {})
|
69
72
|
return if link_list.blank?
|
70
73
|
markup = "<ul class='linklist'>"
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module RailsConnector
|
2
2
|
|
3
3
|
# This module contains helpers that can be used to build all kinds of menus.
|
4
|
+
# @api public
|
4
5
|
module MenuHelper
|
5
6
|
include DisplayHelper
|
6
7
|
|
@@ -51,7 +52,7 @@ module RailsConnector
|
|
51
52
|
# </li>
|
52
53
|
# </ul>
|
53
54
|
#
|
54
|
-
|
55
|
+
# @api public
|
55
56
|
def build_menu(start_obj, current_obj, html_options, &block)
|
56
57
|
children = table_of_contents(start_obj)
|
57
58
|
content_tag(:ul, html_options) do
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module RailsConnector
|
2
2
|
|
3
3
|
# This module contains a helper that can be used to build a micronavigation.
|
4
|
+
# @api public
|
4
5
|
module MicronavHelper
|
5
6
|
|
6
7
|
# Generates a micronavigation by producing HTML markup.
|
@@ -84,6 +85,7 @@ module RailsConnector
|
|
84
85
|
# <ul id='<em><b>micronav_below_banner</b></em>'></tt>
|
85
86
|
# ...
|
86
87
|
# </ul>
|
88
|
+
# @api public
|
87
89
|
def micronav(obj, options = {})
|
88
90
|
options.reverse_merge!({:start => 1, :micronav_id => 'micronav'})
|
89
91
|
ancestors = obj.ancestors
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module RailsConnector
|
2
2
|
|
3
3
|
# This helper provides methods for Search Engine Optimization.
|
4
|
+
# @api public
|
4
5
|
module SeoHelper
|
5
6
|
|
6
7
|
# Generate search engine optimized meta tags for the html head.
|
@@ -21,6 +22,7 @@ module RailsConnector
|
|
21
22
|
# <meta content="Rails Connector for Infopark CMS Fiona by Infopark AG (www.infopark.de); Version 6.7.1" name="generator" />
|
22
23
|
# <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
23
24
|
# <link href="http://test.host/2001/basisordner" rel="canonical" />
|
25
|
+
# @api public
|
24
26
|
def seo_header_tags(options = {})
|
25
27
|
html = content_tag('title', [@obj && @obj.display_title, options[:company_name]].compact.join(' | '))
|
26
28
|
html += tag('meta', :name => 'description', :content => @obj && @obj.seo_description || options[:default_description])
|
@@ -3,6 +3,7 @@ module RailsConnector
|
|
3
3
|
#
|
4
4
|
# This module contains a helper that can be used to build a table of contents of an object.
|
5
5
|
#
|
6
|
+
# @api public
|
6
7
|
module TableOfContentsHelper
|
7
8
|
|
8
9
|
#
|
@@ -13,6 +14,7 @@ module RailsConnector
|
|
13
14
|
# The array is sorted according to the configured sort order and the sort keys.
|
14
15
|
# It also contains only objects which the current user is permitted to view.
|
15
16
|
#
|
17
|
+
# @api public
|
16
18
|
def table_of_contents(obj)
|
17
19
|
obj.sorted_toclist.reject { |o| not o.permitted_for_user?(current_user) }
|
18
20
|
end
|
@@ -1,9 +1,11 @@
|
|
1
1
|
module RailsConnector
|
2
2
|
|
3
3
|
# A helper to access the preview time machine.
|
4
|
+
# @api public
|
4
5
|
module TimeMachineHelper
|
5
6
|
|
6
7
|
# Renders a link to open the time machine.
|
8
|
+
# @api public
|
7
9
|
def time_machine_link(content)
|
8
10
|
if Configuration.enabled?(:time_machine) && Configuration.editor_interface_enabled?
|
9
11
|
(<<-EOF).html_safe
|
@@ -1,12 +1,14 @@
|
|
1
1
|
module RailsConnector
|
2
2
|
|
3
3
|
# This module contains helpers for Google Analytics and Infopark Tracking.
|
4
|
+
# @api public
|
4
5
|
module TrackingHelper
|
5
6
|
|
6
7
|
# This helper renders the Google Analytics snippet using the domain code
|
7
8
|
# for the current domain as configured via <tt>Configuration::GoogleAnalytics.domain_code</tt>.
|
8
9
|
# The helper is automatically run when using the +rails_connector_after_content_tags+,
|
9
10
|
# if the feature <tt>:google_analytics</tt> is enabled.
|
11
|
+
# @api public
|
10
12
|
def google_analytics
|
11
13
|
if domain_code = Configuration::GoogleAnalytics.domain_code(request.host)
|
12
14
|
raw %Q{
|
data/app/helpers/user_helper.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
|
+
# @api public
|
1
2
|
class ConfirmationMailer < ActionMailer::Base
|
3
|
+
# @return [void]
|
4
|
+
# @api public
|
2
5
|
def reset_password(recipient, confirmation_url)
|
3
6
|
@confirmation_url = confirmation_url
|
4
7
|
mail(:to => recipient, :subject =>
|
5
8
|
I18n.t("rails_connector.views.user.forgot_password_subject"))
|
6
9
|
end
|
7
10
|
|
11
|
+
# @return [void]
|
12
|
+
# @api public
|
8
13
|
def register_confirmation(recipient, confirmation_url)
|
9
14
|
@confirmation_url = confirmation_url
|
10
15
|
mail(:to => recipient, :subject =>
|
data/app/models/crm_form.rb
CHANGED
@@ -5,7 +5,7 @@ module RailsConnector
|
|
5
5
|
# Abstract base class for Comment.
|
6
6
|
#
|
7
7
|
# Objects do only have comments if the addon <tt>:comments</tt> is enabled
|
8
|
-
# and the module Commentable is thereby included.
|
8
|
+
# and the module {Commentable} is thereby included.
|
9
9
|
#
|
10
10
|
# A comment must have a name, email, subject, and body.
|
11
11
|
class DefaultComment < ActiveRecord::Base
|
@@ -1,8 +1,9 @@
|
|
1
1
|
module RailsConnector
|
2
2
|
|
3
|
+
# @api public
|
3
4
|
class LinkList < Array
|
4
5
|
|
5
|
-
def initialize(link_definitions)
|
6
|
+
def initialize(link_definitions)
|
6
7
|
if link_definitions.blank?
|
7
8
|
super([])
|
8
9
|
else
|
@@ -10,6 +11,7 @@ module RailsConnector
|
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
14
|
+
# @api public
|
13
15
|
def destination_objects
|
14
16
|
self.map {|link| link.destination_object}.compact
|
15
17
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# @api public
|
1
2
|
module ObjExtensions
|
2
3
|
|
3
4
|
# Infopark Rails Connector enables the developer to define specific behavior for Fiona CMS
|
@@ -7,7 +8,7 @@ module ObjExtensions
|
|
7
8
|
#
|
8
9
|
# Be careful only to use methods and classes that are part of the documented api.
|
9
10
|
# Other methods and classes may change without warning.
|
10
|
-
|
11
|
+
# @api public
|
11
12
|
def self.enable
|
12
13
|
return if Obj.respond_to? :obj_extensions_enabled
|
13
14
|
|
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'rails_connector/core_extensions'
|
2
2
|
|
3
|
+
# @api public
|
3
4
|
module ::RailsConnector
|
4
|
-
def self.load_platform_gem_if_present(name)
|
5
|
+
def self.load_platform_gem_if_present(name)
|
5
6
|
if Gem.loaded_specs["infopark_#{name}_connector"]
|
6
7
|
gem_name = "infopark_#{name}_connector"
|
7
8
|
|
@@ -14,7 +15,8 @@ module ::RailsConnector
|
|
14
15
|
end
|
15
16
|
end
|
16
17
|
|
17
|
-
# return either
|
18
|
+
# return either <tt>:fiona</tt> or <tt>:cloud</tt> depending on the app's configuration.
|
19
|
+
# @return [Symbol]
|
18
20
|
def self.platform
|
19
21
|
@platform
|
20
22
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module RailsConnector
|
2
|
-
module Authenticable
|
2
|
+
module Authenticable
|
3
3
|
def self.included(mod)
|
4
4
|
%w(logged_in? admin? current_user).each do |method_name|
|
5
5
|
unless instance_method_defined?(mod, method_name)
|
@@ -13,7 +13,7 @@ module RailsConnector
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
module InstanceMethods
|
16
|
+
module InstanceMethods
|
17
17
|
def self.logged_in?; false; end
|
18
18
|
def self.admin?; false; end
|
19
19
|
def self.current_user; nil; end
|
@@ -1,10 +1,11 @@
|
|
1
1
|
module RailsConnector
|
2
2
|
|
3
|
+
# @api public
|
3
4
|
module CmsAccessible
|
4
5
|
|
5
6
|
protected
|
6
7
|
|
7
|
-
def set_preview_time
|
8
|
+
def set_preview_time
|
8
9
|
Obj.preview_time = session[:preview_time]
|
9
10
|
end
|
10
11
|
|
@@ -12,7 +13,7 @@ module RailsConnector
|
|
12
13
|
#
|
13
14
|
# To require the loading for all actions, use this in your controllers:
|
14
15
|
# before_filter :load_object
|
15
|
-
def load_object
|
16
|
+
def load_object
|
16
17
|
CmsEnv.new(request.env).load
|
17
18
|
loaded_obj = request.env[CmsEnv::OBJ_ENV_KEY]
|
18
19
|
raise loaded_obj if loaded_obj.is_a?(StandardError)
|
@@ -25,7 +26,7 @@ module RailsConnector
|
|
25
26
|
# To require the check for all actions, use this in your controllers:
|
26
27
|
# before_filter :load_object
|
27
28
|
# before_filter :ensure_object_is_active
|
28
|
-
def ensure_object_is_active
|
29
|
+
def ensure_object_is_active
|
29
30
|
unless @obj.active?
|
30
31
|
@valid_from = @obj.valid_from
|
31
32
|
@valid_until = @obj.valid_until
|
@@ -42,7 +43,7 @@ module RailsConnector
|
|
42
43
|
# To require the check for all actions, use this in your controllers:
|
43
44
|
# before_filter :load_object
|
44
45
|
# before_filter :ensure_object_is_permitted
|
45
|
-
def ensure_object_is_permitted
|
46
|
+
def ensure_object_is_permitted
|
46
47
|
unless is_permitted(@obj)
|
47
48
|
@obj = nil
|
48
49
|
render_obj_error(403, "forbidden")
|
@@ -51,10 +52,11 @@ module RailsConnector
|
|
51
52
|
return true
|
52
53
|
end
|
53
54
|
|
54
|
-
# This method is called when rendering an error caused by either ensure_object_is_permitted
|
55
|
-
# or ensure_object_is_active before filter. It renders an error template located in
|
55
|
+
# This method is called when rendering an error caused by either {ensure_object_is_permitted}
|
56
|
+
# or {ensure_object_is_active} before filter. It renders an error template located in
|
56
57
|
# "errors/*.html.erb" with given HTTP status and content type "text/html" and with no layout.
|
57
58
|
# Overwrite this method to change the error page.
|
59
|
+
# @api public
|
58
60
|
def render_obj_error(status, name)
|
59
61
|
force_html_format
|
60
62
|
render(
|
@@ -66,23 +68,24 @@ module RailsConnector
|
|
66
68
|
end
|
67
69
|
|
68
70
|
# Enforce "html" as template format.
|
69
|
-
|
71
|
+
# @api public
|
72
|
+
def force_html_format
|
70
73
|
request.format = :html
|
71
74
|
end
|
72
75
|
|
73
76
|
# Inclusion hook to make is_permitted available as helper method.
|
74
|
-
def self.included(base)
|
77
|
+
def self.included(base)
|
75
78
|
base.__send__ :helper_method, :is_permitted
|
76
79
|
end
|
77
80
|
|
78
81
|
# Helper method to check live permissions
|
79
|
-
def is_permitted(obj)
|
82
|
+
def is_permitted(obj)
|
80
83
|
obj.permitted_for_user?(current_user)
|
81
84
|
end
|
82
85
|
|
83
86
|
# Filter method which sets the header 'X-Robots-Tag: unavailable_after'
|
84
87
|
# to the valid_until date of the current object.
|
85
|
-
def set_google_expire_header
|
88
|
+
def set_google_expire_header
|
86
89
|
if @obj && (date = @obj.valid_until)
|
87
90
|
headers['X-Robots-Tag: unavailable_after'] = date.rfc822
|
88
91
|
end
|
@@ -90,6 +93,7 @@ module RailsConnector
|
|
90
93
|
|
91
94
|
# Deliver the obj's body as response by file or data.
|
92
95
|
# May respond with status 304 if a If-Modified-Since header is found.
|
96
|
+
# @api public
|
93
97
|
def deliver_file
|
94
98
|
if @obj.body_data_url
|
95
99
|
redirect_to @obj.body_data_url
|
@@ -9,13 +9,13 @@ module RailsConnector
|
|
9
9
|
end
|
10
10
|
|
11
11
|
# Returns +true+ by default.
|
12
|
-
# Implement your own conditions by overwriting this method in your
|
12
|
+
# Implement your own conditions by overwriting this method in your {ObjExtensions}.
|
13
13
|
def allow_comments?
|
14
14
|
true
|
15
15
|
end
|
16
16
|
|
17
17
|
# Returns +true+ by default.
|
18
|
-
# Implement your own conditions by overwriting this method in your
|
18
|
+
# Implement your own conditions by overwriting this method in your {ObjExtensions}.
|
19
19
|
def allow_anonymous_comments?
|
20
20
|
true
|
21
21
|
end
|
@@ -1,14 +1,16 @@
|
|
1
1
|
module RailsConnector
|
2
|
+
# @api public
|
2
3
|
class Configuration
|
3
4
|
|
4
5
|
# This module is an extension to the rails connector configuration.
|
5
6
|
#
|
6
7
|
# Configuration example:
|
7
8
|
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
9
|
+
# RailsConnector::Configuration::GoogleAnalytics.domains(
|
10
|
+
# 'www.example.de' => 'UA-example-1',
|
11
|
+
# 'www.example.com' => 'UA-example-2'
|
12
|
+
# )
|
13
|
+
# @api public
|
12
14
|
module GoogleAnalytics
|
13
15
|
@@domains = {}
|
14
16
|
|
@@ -16,6 +18,7 @@ module RailsConnector
|
|
16
18
|
@@domains = @@domains.merge(domains_and_codes)
|
17
19
|
end
|
18
20
|
|
21
|
+
# @api public
|
19
22
|
def self.domains(domains_and_codes)
|
20
23
|
self.domains = domains_and_codes
|
21
24
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
module RailsConnector
|
2
|
+
# @api public
|
2
3
|
class Configuration
|
3
4
|
|
4
5
|
# This module adds configuration options for the RSS feature.
|
@@ -6,17 +7,21 @@ module RailsConnector
|
|
6
7
|
# Specify the RSS root in
|
7
8
|
# <code><em>RAILS_ROOT</em>/config/initializers/rails_connector.rb</code>:
|
8
9
|
# RailsConnector::Configuration::Rss.root = lambda { NamedLink.get_object('news') }
|
10
|
+
# @api public
|
9
11
|
module Rss
|
10
12
|
|
11
13
|
# Raised if no RSS root object has been specified.
|
14
|
+
# @api public
|
12
15
|
class RootUndefined < StandardError; end
|
13
16
|
# Raised if the root is missing when accessing it
|
14
|
-
# Inherits from RootUndefined for compatibility reasons
|
17
|
+
# Inherits from {RootUndefined} for compatibility reasons
|
18
|
+
# @api public
|
15
19
|
class RootNotFound < RootUndefined; end
|
16
20
|
|
17
21
|
@root_provider = nil
|
18
22
|
|
19
23
|
# Stores the obj providing lambda for later use
|
24
|
+
# @api public
|
20
25
|
def self.root=(obj_provider)
|
21
26
|
case obj_provider
|
22
27
|
when Obj
|
@@ -31,7 +36,8 @@ module RailsConnector
|
|
31
36
|
end
|
32
37
|
|
33
38
|
# Returns the RSS root object.
|
34
|
-
# If no RSS root has been specified then Rss::RootUndefined is raised.
|
39
|
+
# If no RSS root has been specified then {Rss::RootUndefined} is raised.
|
40
|
+
# @api public
|
35
41
|
def self.root
|
36
42
|
raise RootUndefined unless @root_provider
|
37
43
|
begin
|