infopark_rails_connector 6.8.3.174.51542603 → 6.9.0.3.197272233
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/README +0 -7
- data/app/controllers/crm_form_controller.rb +0 -1
- data/app/controllers/rails_connector/default_crm_form_controller.rb +0 -13
- data/app/controllers/rails_connector/default_rss_controller.rb +0 -2
- data/app/controllers/rails_connector/default_search_controller.rb +0 -2
- data/app/controllers/rails_connector/default_user_controller.rb +0 -10
- data/app/controllers/rss_controller.rb +0 -1
- data/app/controllers/search_controller.rb +0 -1
- data/app/controllers/seo_sitemap_controller.rb +0 -2
- data/app/controllers/user_controller.rb +0 -1
- data/app/helpers/crm_form_helper.rb +0 -1
- data/app/helpers/rails_connector/default_cms_routing_helper.rb +5 -1
- data/app/helpers/rails_connector/default_crm_form_helper.rb +0 -4
- data/app/helpers/rails_connector/default_user_helper.rb +0 -6
- data/app/helpers/rails_connector/seo_helper.rb +0 -2
- data/app/helpers/rails_connector/tracking_helper.rb +0 -2
- data/app/helpers/user_helper.rb +0 -1
- data/app/mailers/confirmation_mailer.rb +0 -3
- data/app/models/crm_form.rb +0 -1
- data/config/ca-bundle.crt +2 -2
- data/lib/rails_connector/cms_accessible.rb +1 -1
- data/lib/rails_connector/configuration.rb +1 -10
- data/lib/rails_connector/configuration/google_analytics.rb +0 -3
- data/lib/rails_connector/configuration/rss.rb +0 -6
- data/lib/rails_connector/crm.rb +0 -15
- data/lib/rails_connector/engine.rb +1 -1
- data/lib/rails_connector/seo.rb +0 -8
- data/lib/rails_connector/syndicateable.rb +0 -2
- data/lib/search_request.rb +0 -1
- metadata +7 -7
data/README
CHANGED
@@ -10,13 +10,6 @@ For more information about Infopark Rails Connector, please visit {http://kb.inf
|
|
10
10
|
Here is how the available addons can be enabled in the <tt>rails_connector.rb</tt> initializer file of your application:
|
11
11
|
|
12
12
|
RailsConnector::Configuration.enable(
|
13
|
-
:google_analytics,
|
14
|
-
:infopark_tracking,
|
15
|
-
:crm,
|
16
|
-
:pdf_generator,
|
17
|
-
:rss,
|
18
|
-
:search,
|
19
|
-
:seo_sitemap,
|
20
13
|
:time_machine
|
21
14
|
)
|
22
15
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module RailsConnector
|
2
2
|
# This class provides a default controller implementation for WebCRM form using custom attributes.
|
3
3
|
# It should be customized by subclassing.
|
4
|
-
# @api public
|
5
4
|
class DefaultCrmFormController < DefaultCmsController
|
6
5
|
|
7
6
|
include Crm::Localizable
|
@@ -14,7 +13,6 @@ module RailsConnector
|
|
14
13
|
:contact => [:gender, :first_name, :last_name, :email]
|
15
14
|
}
|
16
15
|
|
17
|
-
# @api public
|
18
16
|
def index
|
19
17
|
unless logged_in?
|
20
18
|
@user = Infopark::Crm::Contact.new(:language => default_language)
|
@@ -48,7 +46,6 @@ module RailsConnector
|
|
48
46
|
# Override this method for custom logic to get from a given OBJ to an activity kind.
|
49
47
|
#
|
50
48
|
# Defaults to +@obj[:activity_kind]+ or 'contact form' if the former is +nil+.
|
51
|
-
# @api public
|
52
49
|
def activity_kind
|
53
50
|
@obj[:activity_kind] || 'contact form'
|
54
51
|
end
|
@@ -56,7 +53,6 @@ module RailsConnector
|
|
56
53
|
# Returns the state of a new activity.
|
57
54
|
#
|
58
55
|
# Defaults to the first state assigned to +activity_kind+.
|
59
|
-
# @api public
|
60
56
|
def activity_state
|
61
57
|
Infopark::Crm::CustomType.find(activity_kind).states.first
|
62
58
|
end
|
@@ -68,7 +64,6 @@ module RailsConnector
|
|
68
64
|
# an additional form field to the corresponding view.
|
69
65
|
#
|
70
66
|
# Defaults to the current locale.
|
71
|
-
# @api public
|
72
67
|
def default_language
|
73
68
|
I18n.locale.to_s
|
74
69
|
end
|
@@ -80,7 +75,6 @@ module RailsConnector
|
|
80
75
|
# the behavior without having to override #index.
|
81
76
|
#
|
82
77
|
# By default, it assigns a default title if +has_title_input_field?+ is +false+.
|
83
|
-
# @api public
|
84
78
|
def before_saving_activity(activity)
|
85
79
|
activity.title = "Website form submission" unless has_title_input_field?
|
86
80
|
end
|
@@ -92,7 +86,6 @@ module RailsConnector
|
|
92
86
|
# The method is also available as helper in your views.
|
93
87
|
#
|
94
88
|
# By default, it renders crm_form/confirmation
|
95
|
-
# @api public
|
96
89
|
def after_saving_activity(activity)
|
97
90
|
render 'crm_form/confirmation'
|
98
91
|
end
|
@@ -101,7 +94,6 @@ module RailsConnector
|
|
101
94
|
# Override this method to return +false+ if you want to set the title programmatically.
|
102
95
|
#
|
103
96
|
# By default, it returns +true+
|
104
|
-
# @api public
|
105
97
|
def has_title_input_field?
|
106
98
|
true
|
107
99
|
end
|
@@ -113,7 +105,6 @@ module RailsConnector
|
|
113
105
|
# and custom attributes that are not to be set by users.
|
114
106
|
#
|
115
107
|
# By default, it returns a hash only with title and custom values.
|
116
|
-
# @api public
|
117
108
|
def sanitize_activity_params(activity_params_or_nil)
|
118
109
|
activity_params_whitelist = [:title]
|
119
110
|
(activity_params_or_nil || {}).reject do |attr, value|
|
@@ -127,7 +118,6 @@ module RailsConnector
|
|
127
118
|
#
|
128
119
|
# Drop a custom view to change the look, or override this method
|
129
120
|
# if you want different behavior, like a redirect.
|
130
|
-
# @api public
|
131
121
|
def authorize
|
132
122
|
render 'not_logged_in' unless logged_in? || allow_anonymous?
|
133
123
|
end
|
@@ -139,7 +129,6 @@ module RailsConnector
|
|
139
129
|
# The method is also available as helper in your views.
|
140
130
|
#
|
141
131
|
# By default, it returns +false+, i.e. only logged-in users can see the form
|
142
|
-
# @api public
|
143
132
|
def allow_anonymous?
|
144
133
|
false
|
145
134
|
end
|
@@ -152,7 +141,6 @@ module RailsConnector
|
|
152
141
|
#
|
153
142
|
# By default, it returns +true+ for any attribute, i.e. every custom attribute
|
154
143
|
# can be filled in by the user.
|
155
|
-
# @api public
|
156
144
|
def allow_custom_attribute?(attribute_name)
|
157
145
|
true
|
158
146
|
end
|
@@ -171,7 +159,6 @@ module RailsConnector
|
|
171
159
|
# }
|
172
160
|
#
|
173
161
|
# end
|
174
|
-
# @api public
|
175
162
|
def editable_attributes_on_register
|
176
163
|
self.class.editable_attributes_on_register
|
177
164
|
end
|
@@ -8,7 +8,6 @@ module RailsConnector
|
|
8
8
|
# Specify the RSS root in
|
9
9
|
# <code><em>RAILS_ROOT</em>/config/initializers/rails_connector.rb</code>:
|
10
10
|
# RailsConnector::Configuration::Rss.root = lambda { NamedLink.get_object('news') }
|
11
|
-
# @api public
|
12
11
|
class DefaultRssController < DefaultCmsController
|
13
12
|
#
|
14
13
|
# This action renders the built-in RSS feed.
|
@@ -16,7 +15,6 @@ module RailsConnector
|
|
16
15
|
# To customize feed's layout, override either this method, or the apropriate view.
|
17
16
|
#
|
18
17
|
# @return [void]
|
19
|
-
# @api public
|
20
18
|
def index
|
21
19
|
respond_to do |format|
|
22
20
|
format.rss
|
@@ -4,7 +4,6 @@ module RailsConnector
|
|
4
4
|
|
5
5
|
# This class provides a default controller implementation for searching.
|
6
6
|
# It should be customized by subclassing.
|
7
|
-
# @api public
|
8
7
|
class DefaultSearchController < ApplicationController
|
9
8
|
class_attribute :options
|
10
9
|
self.options = {:limit => 10}
|
@@ -28,7 +27,6 @@ module RailsConnector
|
|
28
27
|
# # * Flash on errors
|
29
28
|
# end
|
30
29
|
# end
|
31
|
-
# @api public
|
32
30
|
def search
|
33
31
|
unless (@query = params[:q]).blank?
|
34
32
|
@hits = WillPaginate::Collection.create(current_page, options[:limit]) do |pager|
|
@@ -14,7 +14,6 @@ module RailsConnector
|
|
14
14
|
# This can be done in your <tt>rails_connector.rb</tt> or in +UserController+ directly.
|
15
15
|
#
|
16
16
|
# By default, users can submit their first name, last name, email and company name.
|
17
|
-
# @api public
|
18
17
|
class DefaultUserController < ApplicationController
|
19
18
|
|
20
19
|
before_filter :check_editable_attribute_configuration
|
@@ -45,7 +44,6 @@ module RailsConnector
|
|
45
44
|
end
|
46
45
|
|
47
46
|
# Displays a profile page containing links to all available actions
|
48
|
-
# @api public
|
49
47
|
def profile
|
50
48
|
end
|
51
49
|
|
@@ -63,7 +61,6 @@ module RailsConnector
|
|
63
61
|
#
|
64
62
|
# If you merely want to change what happens before or after a user is authenticated,
|
65
63
|
# do not override this method but override +before_authenticate+ or +after_authenticate+.
|
66
|
-
# @api public
|
67
64
|
def login
|
68
65
|
if request.post?
|
69
66
|
@user = Infopark::Crm::Contact.new(params[:user] || {:login => nil, :password => nil})
|
@@ -90,7 +87,6 @@ module RailsConnector
|
|
90
87
|
#
|
91
88
|
# To change the behavior before or after invalidating the session,
|
92
89
|
# override +before_logout+ or +after_logout+.
|
93
|
-
# @api public
|
94
90
|
def logout
|
95
91
|
before_logout
|
96
92
|
self.current_user = nil
|
@@ -104,7 +100,6 @@ module RailsConnector
|
|
104
100
|
#
|
105
101
|
# If you merely want to change what happens before or after a user is registered,
|
106
102
|
# do not override this method but override +before_register+ or +after_register+.
|
107
|
-
# @api public
|
108
103
|
def new
|
109
104
|
@user = Infopark::Crm::Contact.new
|
110
105
|
# Load some default attributes so that form_for is working
|
@@ -124,12 +119,10 @@ module RailsConnector
|
|
124
119
|
flash.now[:error] = tcon('registration_failed')
|
125
120
|
end
|
126
121
|
|
127
|
-
# @api public
|
128
122
|
def register_pending
|
129
123
|
end
|
130
124
|
|
131
125
|
# Lets the user change his/her user details.
|
132
|
-
# @api public
|
133
126
|
def edit
|
134
127
|
@user = Infopark::Crm::Contact.find(current_user.id)
|
135
128
|
if request.post? || request.put?
|
@@ -145,7 +138,6 @@ module RailsConnector
|
|
145
138
|
# Lets the user change his/her password.
|
146
139
|
#
|
147
140
|
# Validates the new password using +validate_edit_password_params_for+.
|
148
|
-
# @api public
|
149
141
|
def edit_password
|
150
142
|
if request.post?
|
151
143
|
validate_edit_password_params_for(params[:user])
|
@@ -161,7 +153,6 @@ module RailsConnector
|
|
161
153
|
# Lets the user request a new password (double opt-in).
|
162
154
|
#
|
163
155
|
# Uses the +ConfirmationMailer+ for sending out the confirmation message.
|
164
|
-
# @api public
|
165
156
|
def forgot_password
|
166
157
|
if request.post?
|
167
158
|
user = Infopark::Crm::Contact.search(:params => {:login => params[:user][:login]}).first
|
@@ -176,7 +167,6 @@ module RailsConnector
|
|
176
167
|
end
|
177
168
|
end
|
178
169
|
|
179
|
-
# @api public
|
180
170
|
def set_password
|
181
171
|
if request.get? && params[:token].blank?
|
182
172
|
flash[:error] = tcon('token_url_invalid')
|
@@ -1,11 +1,9 @@
|
|
1
1
|
# Renders a search engine optimized sitemap.xml
|
2
2
|
# Enable via <tt>RailsConnector::Configuration.enable(:seo_sitemap)</tt>
|
3
|
-
# @api public
|
4
3
|
class SeoSitemapController < ApplicationController
|
5
4
|
layout nil
|
6
5
|
|
7
6
|
# Finds all objects which are to be shown in the SEO sitemap. Responds to xml only.
|
8
|
-
# @api public
|
9
7
|
def show
|
10
8
|
@objects = Obj.find_all_for_sitemap
|
11
9
|
respond_to { |format| format.xml }
|
@@ -59,7 +59,7 @@ module RailsConnector
|
|
59
59
|
__send__("root_#{path_or_url}", options)
|
60
60
|
else
|
61
61
|
if obj.body_data_url && !ignore_body_data_url
|
62
|
-
obj.body_data_url
|
62
|
+
enforce_protocol_from_request(obj.body_data_url)
|
63
63
|
elsif obj.binary? && !obj.file_extension.blank?
|
64
64
|
__send__("cms_id_#{path_or_url}",
|
65
65
|
options.merge(:id => obj.id, :slug => obj.slug.presence, :format => obj.file_extension))
|
@@ -112,5 +112,9 @@ module RailsConnector
|
|
112
112
|
parsed_url.to_s
|
113
113
|
end
|
114
114
|
|
115
|
+
def enforce_protocol_from_request(url)
|
116
|
+
request.ssl? && !url.starts_with?('https') ? url.gsub(/^http/, 'https') : url
|
117
|
+
end
|
118
|
+
|
115
119
|
end
|
116
120
|
end
|
@@ -1,13 +1,11 @@
|
|
1
1
|
module RailsConnector
|
2
2
|
|
3
|
-
# @api public
|
4
3
|
module DefaultCrmFormHelper
|
5
4
|
|
6
5
|
include ::RailsConnector::DefaultUserHelper
|
7
6
|
include ::RailsConnector::MandatoryLabelHelper
|
8
7
|
include ::RailsConnector::ErrorMessagesHelper
|
9
8
|
|
10
|
-
# @api public
|
11
9
|
def custom_fields_for(form)
|
12
10
|
activity = instance_variable_get("@#{form.object_name}")
|
13
11
|
custom_attribute_defs = Infopark::Crm::CustomType.find(activity.kind).custom_attributes
|
@@ -37,7 +35,6 @@ module RailsConnector
|
|
37
35
|
content
|
38
36
|
end
|
39
37
|
|
40
|
-
# @api public
|
41
38
|
def title_field_for(form)
|
42
39
|
content = "".html_safe
|
43
40
|
if has_title_input_field?
|
@@ -51,7 +48,6 @@ module RailsConnector
|
|
51
48
|
content
|
52
49
|
end
|
53
50
|
|
54
|
-
# @api public
|
55
51
|
def logged_in_as(user)
|
56
52
|
content_tag(:em) do
|
57
53
|
t('rails_connector.views.crm_form.logged_in_as',
|
@@ -3,7 +3,6 @@ require "recaptcha"
|
|
3
3
|
module RailsConnector
|
4
4
|
|
5
5
|
# This module contains helpers for the {UserController} and {DefaultUserController}
|
6
|
-
# @api public
|
7
6
|
module DefaultUserHelper
|
8
7
|
|
9
8
|
include ::ReCaptcha::ViewHelper
|
@@ -11,7 +10,6 @@ module RailsConnector
|
|
11
10
|
include ::RailsConnector::ErrorMessagesHelper
|
12
11
|
|
13
12
|
# Returns mandatory user fields as array of symbols.
|
14
|
-
# @api public
|
15
13
|
def mandatory_user_fields
|
16
14
|
[:email, :gender, :language, :last_name]
|
17
15
|
end
|
@@ -40,7 +38,6 @@ module RailsConnector
|
|
40
38
|
# user:
|
41
39
|
# first_name: First name
|
42
40
|
# last_name: Last name
|
43
|
-
# @api public
|
44
41
|
def user_fields_for(form, model_name, *attributes)
|
45
42
|
output = "".html_safe
|
46
43
|
attributes.flatten.each do |attr|
|
@@ -66,7 +63,6 @@ module RailsConnector
|
|
66
63
|
output
|
67
64
|
end
|
68
65
|
|
69
|
-
# @api public
|
70
66
|
def genders_for_select
|
71
67
|
[
|
72
68
|
['', 'N'],
|
@@ -75,7 +71,6 @@ module RailsConnector
|
|
75
71
|
]
|
76
72
|
end
|
77
73
|
|
78
|
-
# @api public
|
79
74
|
def languages_for_select_for(*languages)
|
80
75
|
options = []
|
81
76
|
languages.flatten.each do |lang|
|
@@ -84,7 +79,6 @@ module RailsConnector
|
|
84
79
|
options
|
85
80
|
end
|
86
81
|
|
87
|
-
# @api public
|
88
82
|
def profile_fields_for(form, editable_attributes={})
|
89
83
|
output = "".html_safe
|
90
84
|
output += user_fields_for(form, "contact", editable_attributes[:contact])
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module RailsConnector
|
2
2
|
|
3
3
|
# This helper provides methods for Search Engine Optimization.
|
4
|
-
# @api public
|
5
4
|
module SeoHelper
|
6
5
|
|
7
6
|
# Generate search engine optimized meta tags for the html head.
|
@@ -22,7 +21,6 @@ module RailsConnector
|
|
22
21
|
# <meta content="Rails Connector for Infopark CMS Fiona by Infopark AG (www.infopark.de); Version 6.7.1" name="generator" />
|
23
22
|
# <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
24
23
|
# <link href="http://test.host/2001/basisordner" rel="canonical" />
|
25
|
-
# @api public
|
26
24
|
def seo_header_tags(options = {})
|
27
25
|
html = content_tag('title', [@obj && @obj.display_title, options[:company_name]].compact.join(' | '))
|
28
26
|
html += tag('meta', :name => 'description', :content => @obj && @obj.seo_description || options[:default_description])
|
@@ -1,14 +1,12 @@
|
|
1
1
|
module RailsConnector
|
2
2
|
|
3
3
|
# This module contains helpers for Google Analytics and Infopark Tracking.
|
4
|
-
# @api public
|
5
4
|
module TrackingHelper
|
6
5
|
|
7
6
|
# This helper renders the Google Analytics snippet using the domain code
|
8
7
|
# for the current domain as configured via <tt>Configuration::GoogleAnalytics.domain_code</tt>.
|
9
8
|
# The helper is automatically run when using the +rails_connector_after_content_tags+,
|
10
9
|
# if the feature <tt>:google_analytics</tt> is enabled.
|
11
|
-
# @api public
|
12
10
|
def google_analytics
|
13
11
|
if domain_code = Configuration::GoogleAnalytics.domain_code(request.host)
|
14
12
|
raw %Q{
|
data/app/helpers/user_helper.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
# @api public
|
2
1
|
class ConfirmationMailer < ActionMailer::Base
|
3
2
|
# @return [void]
|
4
|
-
# @api public
|
5
3
|
def reset_password(recipient, confirmation_url)
|
6
4
|
@confirmation_url = confirmation_url
|
7
5
|
mail(:to => recipient, :subject =>
|
@@ -9,7 +7,6 @@ class ConfirmationMailer < ActionMailer::Base
|
|
9
7
|
end
|
10
8
|
|
11
9
|
# @return [void]
|
12
|
-
# @api public
|
13
10
|
def register_confirmation(recipient, confirmation_url)
|
14
11
|
@confirmation_url = confirmation_url
|
15
12
|
mail(:to => recipient, :subject =>
|
data/app/models/crm_form.rb
CHANGED
data/config/ca-bundle.crt
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
##
|
2
|
-
## /Network/Servers/xs2.infopark/Users/develop/dcc/tmp/
|
2
|
+
## /Network/Servers/xs2.infopark/Users/develop/dcc/tmp/Rails_Connector__Kris__dev__93/repos/rails_connector/config/ca-bundle.crt -- Bundle of CA Root Certificates
|
3
3
|
##
|
4
|
-
## Converted at:
|
4
|
+
## Converted at: Fri Apr 5 10:07:19 2013 UTC
|
5
5
|
##
|
6
6
|
## This is a bundle of X.509 certificates of public Certificate Authorities
|
7
7
|
## (CA). These were automatically extracted from Mozilla's root certificates
|
@@ -96,7 +96,7 @@ module RailsConnector
|
|
96
96
|
# @api public
|
97
97
|
def deliver_file
|
98
98
|
if @obj.body_data_url
|
99
|
-
redirect_to @obj.body_data_url
|
99
|
+
redirect_to enforce_protocol_from_request(@obj.body_data_url)
|
100
100
|
elsif stale?(:last_modified => @obj.last_changed.utc)
|
101
101
|
mime_type = @obj.mime_type
|
102
102
|
mime_type += '; charset=utf-8' if mime_type =~ /^text\//
|
@@ -10,10 +10,7 @@ module RailsConnector
|
|
10
10
|
# @api public
|
11
11
|
DEFAULT_MODE = :live
|
12
12
|
|
13
|
-
#
|
14
13
|
# Default fields which the {DefaultUserController} will store in the session.
|
15
|
-
#
|
16
|
-
# @api public
|
17
14
|
DEFAULT_STORE_USER_ATTRS_IN_SESSION = [:login, :first_name, :last_name, :email, :id]
|
18
15
|
|
19
16
|
#
|
@@ -38,7 +35,6 @@ module RailsConnector
|
|
38
35
|
attr_accessor :mode
|
39
36
|
|
40
37
|
# default options for {SearchRequest}
|
41
|
-
# @api public
|
42
38
|
attr_writer :search_options
|
43
39
|
|
44
40
|
# Include ReCaptcha tags in user registration form and validate the captcha
|
@@ -91,7 +87,6 @@ module RailsConnector
|
|
91
87
|
end
|
92
88
|
|
93
89
|
# default options for {SearchRequest}
|
94
|
-
# @api public
|
95
90
|
def search_options
|
96
91
|
@search_options || local_config_file["search"].symbolize_keys
|
97
92
|
end
|
@@ -117,14 +112,12 @@ module RailsConnector
|
|
117
112
|
# Sets the array of fields which the +DefaultUserController+ will store in the session.
|
118
113
|
# Defaults to {DEFAULT_STORE_USER_ATTRS_IN_SESSION}.
|
119
114
|
#
|
120
|
-
# @api public
|
121
115
|
attr_writer :store_user_attrs_in_session
|
122
116
|
|
123
117
|
#
|
124
118
|
# Returns fields which the {DefaultUserController} stores in the session.
|
125
119
|
# Defaults to {DEFAULT_STORE_USER_ATTRS_IN_SESSION}.
|
126
120
|
#
|
127
|
-
# @api public
|
128
121
|
def store_user_attrs_in_session
|
129
122
|
@store_user_attrs_in_session || DEFAULT_STORE_USER_ATTRS_IN_SESSION
|
130
123
|
end
|
@@ -151,9 +144,7 @@ module RailsConnector
|
|
151
144
|
# Rails Connector Addons can be enabled as follows (in <tt>config/rails_connector.rb</tt>):
|
152
145
|
#
|
153
146
|
# RailsConnector::Configuration.enable(
|
154
|
-
# :
|
155
|
-
# :time_machine,
|
156
|
-
# :crm
|
147
|
+
# :time_machine
|
157
148
|
# )
|
158
149
|
#
|
159
150
|
# @api public
|
@@ -1,5 +1,4 @@
|
|
1
1
|
module RailsConnector
|
2
|
-
# @api public
|
3
2
|
class Configuration
|
4
3
|
|
5
4
|
# This module is an extension to the rails connector configuration.
|
@@ -10,7 +9,6 @@ module RailsConnector
|
|
10
9
|
# 'www.example.de' => 'UA-example-1',
|
11
10
|
# 'www.example.com' => 'UA-example-2'
|
12
11
|
# )
|
13
|
-
# @api public
|
14
12
|
module GoogleAnalytics
|
15
13
|
@@domains = {}
|
16
14
|
|
@@ -18,7 +16,6 @@ module RailsConnector
|
|
18
16
|
@@domains = @@domains.merge(domains_and_codes)
|
19
17
|
end
|
20
18
|
|
21
|
-
# @api public
|
22
19
|
def self.domains(domains_and_codes)
|
23
20
|
self.domains = domains_and_codes
|
24
21
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
module RailsConnector
|
2
|
-
# @api public
|
3
2
|
class Configuration
|
4
3
|
|
5
4
|
# This module adds configuration options for the RSS feature.
|
@@ -7,21 +6,17 @@ module RailsConnector
|
|
7
6
|
# Specify the RSS root in
|
8
7
|
# <code><em>RAILS_ROOT</em>/config/initializers/rails_connector.rb</code>:
|
9
8
|
# RailsConnector::Configuration::Rss.root = lambda { NamedLink.get_object('news') }
|
10
|
-
# @api public
|
11
9
|
module Rss
|
12
10
|
|
13
11
|
# Raised if no RSS root object has been specified.
|
14
|
-
# @api public
|
15
12
|
class RootUndefined < StandardError; end
|
16
13
|
# Raised if the root is missing when accessing it
|
17
14
|
# Inherits from {RootUndefined} for compatibility reasons
|
18
|
-
# @api public
|
19
15
|
class RootNotFound < RootUndefined; end
|
20
16
|
|
21
17
|
@root_provider = nil
|
22
18
|
|
23
19
|
# Stores the obj providing lambda for later use
|
24
|
-
# @api public
|
25
20
|
def self.root=(obj_provider)
|
26
21
|
case obj_provider
|
27
22
|
when Obj
|
@@ -37,7 +32,6 @@ module RailsConnector
|
|
37
32
|
|
38
33
|
# Returns the RSS root object.
|
39
34
|
# If no RSS root has been specified then {Rss::RootUndefined} is raised.
|
40
|
-
# @api public
|
41
35
|
def self.root
|
42
36
|
raise RootUndefined unless @root_provider
|
43
37
|
begin
|
data/lib/rails_connector/crm.rb
CHANGED
@@ -8,7 +8,6 @@ module RailsConnector
|
|
8
8
|
# RailsConnector::Configuration.enable(
|
9
9
|
# :crm
|
10
10
|
# )
|
11
|
-
# @api public
|
12
11
|
module Crm
|
13
12
|
|
14
13
|
# This method requires the infopark_crm_connector gem.
|
@@ -26,7 +25,6 @@ module RailsConnector
|
|
26
25
|
ApplicationController.__send__(:include, AuthenticationSupport)
|
27
26
|
end
|
28
27
|
|
29
|
-
# @api public
|
30
28
|
module AuthenticationSupport
|
31
29
|
|
32
30
|
protected
|
@@ -58,7 +56,6 @@ module RailsConnector
|
|
58
56
|
# Determines if the user is logged in.
|
59
57
|
# Defined as helper method in +ApplicationController+ when enabling the Crm feature.
|
60
58
|
# @return bool
|
61
|
-
# @api public
|
62
59
|
def logged_in?
|
63
60
|
!session[:user].blank?
|
64
61
|
end
|
@@ -68,7 +65,6 @@ module RailsConnector
|
|
68
65
|
# To change which fields {DefaultUserController} stores in the session use
|
69
66
|
# {RailsConnector::Configuration.store_user_attrs_in_session}.
|
70
67
|
# @return [Infopark::Crm::Contact]
|
71
|
-
# @api public
|
72
68
|
def current_user
|
73
69
|
@current_user ||= if logged_in?
|
74
70
|
incorrect_encoding = session[:user].any? do |key, value|
|
@@ -91,7 +87,6 @@ module RailsConnector
|
|
91
87
|
# This can be helpful if you want to set a user for e.g. Googlebot.
|
92
88
|
# @param [Infopark::Crm::Contact] user
|
93
89
|
# @return [void]
|
94
|
-
# @api public
|
95
90
|
def current_user=(user)
|
96
91
|
@current_user = user
|
97
92
|
session[:user] = user.nil? ? nil : session_attributes_for(user)
|
@@ -100,7 +95,6 @@ module RailsConnector
|
|
100
95
|
# Reloads the +Contact+ object in +current_user+ from the WebCRM,
|
101
96
|
# and updates the user attribute cached in the session.
|
102
97
|
# @return [void]
|
103
|
-
# @api public
|
104
98
|
def reload_current_user
|
105
99
|
user = current_user
|
106
100
|
user.reload
|
@@ -123,7 +117,6 @@ module RailsConnector
|
|
123
117
|
#
|
124
118
|
# end
|
125
119
|
# @return bool
|
126
|
-
# @api public
|
127
120
|
def admin?
|
128
121
|
false
|
129
122
|
end
|
@@ -177,7 +170,6 @@ module RailsConnector
|
|
177
170
|
#
|
178
171
|
# If you want to add behavior before or after authentication, logout or register, override any of
|
179
172
|
# the methods included in this module in your {UserController}.
|
180
|
-
# @api public
|
181
173
|
module Callbacks
|
182
174
|
|
183
175
|
private
|
@@ -189,7 +181,6 @@ module RailsConnector
|
|
189
181
|
#
|
190
182
|
# By default, it doesn't do anything.
|
191
183
|
# @return [void]
|
192
|
-
# @api public
|
193
184
|
def before_authenticate
|
194
185
|
end
|
195
186
|
|
@@ -198,7 +189,6 @@ module RailsConnector
|
|
198
189
|
#
|
199
190
|
# By default, it doesn't do anything.
|
200
191
|
# @return [void]
|
201
|
-
# @api public
|
202
192
|
def before_logout
|
203
193
|
end
|
204
194
|
|
@@ -207,7 +197,6 @@ module RailsConnector
|
|
207
197
|
#
|
208
198
|
# By default, it doesn't do anything.
|
209
199
|
# @return [void]
|
210
|
-
# @api public
|
211
200
|
def before_register
|
212
201
|
end
|
213
202
|
|
@@ -216,7 +205,6 @@ module RailsConnector
|
|
216
205
|
#
|
217
206
|
# By default, it doesn't do anything.
|
218
207
|
# @return [void]
|
219
|
-
# @api public
|
220
208
|
def after_authenticate
|
221
209
|
end
|
222
210
|
|
@@ -225,7 +213,6 @@ module RailsConnector
|
|
225
213
|
#
|
226
214
|
# By default, it doesn't do anything.
|
227
215
|
# @return [void]
|
228
|
-
# @api public
|
229
216
|
def after_logout
|
230
217
|
end
|
231
218
|
|
@@ -234,7 +221,6 @@ module RailsConnector
|
|
234
221
|
#
|
235
222
|
# By default, it doesn't do anything.
|
236
223
|
# @return [void]
|
237
|
-
# @api public
|
238
224
|
def after_register
|
239
225
|
end
|
240
226
|
|
@@ -245,7 +231,6 @@ module RailsConnector
|
|
245
231
|
# By default, it raises an error so that administrators are notified immediately
|
246
232
|
# if the WebCRM is down or not configured properly.
|
247
233
|
# @return [void]
|
248
|
-
# @api public
|
249
234
|
def on_crm_error(exception)
|
250
235
|
raise exception
|
251
236
|
end
|
@@ -67,7 +67,7 @@ module ::RailsConnector
|
|
67
67
|
end
|
68
68
|
|
69
69
|
config.autoload_paths += paths['lib'].to_a
|
70
|
-
config.autoload_once_paths += paths['
|
70
|
+
config.autoload_once_paths += paths['lib'].to_a
|
71
71
|
|
72
72
|
RailsConnector.rack_middlewares.each { |middleware| config.app_middleware.use middleware }
|
73
73
|
end
|
data/lib/rails_connector/seo.rb
CHANGED
@@ -1,15 +1,12 @@
|
|
1
1
|
module RailsConnector
|
2
2
|
# Search Engine Optimization methods
|
3
|
-
# @api public
|
4
3
|
module SEO
|
5
4
|
|
6
5
|
# The methods contained herein are attached to the Obj model class.
|
7
|
-
# @api public
|
8
6
|
module ClassMethods
|
9
7
|
# Finds all objects that shall be included in the SEO <tt>sitemap.xml</tt>.
|
10
8
|
# On each exportable none-image object, {InstanceMethods#included_in_seo_sitemap?} is called.
|
11
9
|
# Overwrite <tt>included_in_seo_sitemap?</tt> in your {Obj} to adjust the criteria.
|
12
|
-
# @api public
|
13
10
|
def find_all_for_sitemap
|
14
11
|
start = Obj.homepage
|
15
12
|
children = start.toclist
|
@@ -20,32 +17,27 @@ module RailsConnector
|
|
20
17
|
end
|
21
18
|
|
22
19
|
# The methods contained herein are included in the Obj model.
|
23
|
-
# @api public
|
24
20
|
module InstanceMethods
|
25
21
|
|
26
22
|
# Returns +true+ by default. Overwrite in your {Obj} as you like.
|
27
|
-
# @api public
|
28
23
|
def readable_for_googlebots?
|
29
24
|
true
|
30
25
|
end
|
31
26
|
|
32
27
|
# Default implementation: objects have to be <tt>active?</tt> and at least of one of: permitted for anyone (<tt>permitted_groups = []</tt>), <tt>readable_for_googlebots?</tt>.
|
33
28
|
# Overwrite in your {Obj} as you like.
|
34
|
-
# @api public
|
35
29
|
def included_in_seo_sitemap?
|
36
30
|
(permitted_groups.empty? || readable_for_googlebots?) && active?
|
37
31
|
end
|
38
32
|
|
39
33
|
# Returns an html-stripped <tt>Obj#body</tt>, truncated to 300 chars.
|
40
34
|
# Overwrite in your {Obj} as you like. For example, point to a CMS field.
|
41
|
-
# @api public
|
42
35
|
def seo_description
|
43
36
|
HTML::FullSanitizer.new.sanitize(body.strip.gsub(%r{[\n|\r]}, " ")).mb_chars[0,300] if body
|
44
37
|
end
|
45
38
|
|
46
39
|
# Returns +nil+ by default. Overwrite in your {Obj} as you like.
|
47
40
|
# For example, point to a CMS field of your objects.
|
48
|
-
# @api public
|
49
41
|
def seo_keywords
|
50
42
|
nil
|
51
43
|
end
|
@@ -2,10 +2,8 @@ module RailsConnector
|
|
2
2
|
# This module is included if the <tt>:rss</tt> addon is
|
3
3
|
# enabled:
|
4
4
|
# RailsConnector::Configuration.enable(:rss)
|
5
|
-
# @api public
|
6
5
|
module Syndicateable
|
7
6
|
# Overwrite this method in your {Obj} in order to display another field in your feed.
|
8
|
-
# @api public
|
9
7
|
def rss_description
|
10
8
|
body
|
11
9
|
end
|
data/lib/search_request.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infopark_rails_connector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.9.0.3.197272233
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-04-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.2.
|
21
|
+
version: 3.2.13
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 3.2.
|
29
|
+
version: 3.2.13
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rake
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ! '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 1.
|
53
|
+
version: 1.7.7
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.7.7
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: maruku
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -362,7 +362,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
362
362
|
version: '0'
|
363
363
|
segments:
|
364
364
|
- 0
|
365
|
-
hash:
|
365
|
+
hash: 75344545
|
366
366
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
367
367
|
none: false
|
368
368
|
requirements:
|