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
data/.yardopts
ADDED
data/README
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
= Infopark Rails Connector
|
2
2
|
|
3
|
-
Infopark Rails Connector
|
3
|
+
Infopark Rails Connector integrates Infopark’s CMS into your Rails application.
|
4
|
+
|
5
|
+
It connects either to Infopark Cloud Express CMS via {https://rubygems.org/gems/infopark_cloud_connector infopark_cloud_connector} or to Infopark CMS Fiona via {https://rubygems.org/gems/infopark_fiona_connector infopark_fiona_connector}. It also enables you to integrate various ready-to-run features.
|
6
|
+
|
7
|
+
For more information about Infopark Rails Connector, please visit {http://kb.infopark.de/ Infopark’s Knowledge Base}.
|
4
8
|
|
5
9
|
== Configuration
|
6
|
-
Here is how all available addons
|
10
|
+
Here is how all available addons can be enabled in the <tt>rails_connector.rb</tt> initializer file of your application:
|
7
11
|
|
8
12
|
RailsConnector::Configuration.enable(
|
9
|
-
:comments,
|
10
13
|
:google_analytics,
|
11
14
|
:infopark_tracking,
|
12
|
-
:
|
15
|
+
:crm,
|
13
16
|
:pdf_generator,
|
14
|
-
:ratings,
|
15
17
|
:rss,
|
16
18
|
:search,
|
17
19
|
:seo_sitemap,
|
@@ -37,23 +39,10 @@ That helper is to be put right before the closing body tag.
|
|
37
39
|
== Generators
|
38
40
|
Infopark Rails Connector comes with three generators to help you get up and running quickly:
|
39
41
|
|
40
|
-
|
42
|
+
> rails generate rails_connector:install
|
41
43
|
|
42
44
|
Adds Time machine assets, a +rails_connector.rb+ initializer and rake tasks specific to the gem to your application.
|
43
45
|
|
44
|
-
<tt>rails generate rails_connector:comments</tt>
|
45
|
-
|
46
|
-
Specific to the +comments+ feature. Adds a comments migration to your application.
|
47
|
-
|
48
|
-
<tt>rails generate rails_connector:ratings</tt>
|
49
|
-
|
50
|
-
Specific to the +ratings+ feature. Adds a ratings migration to your application as well as an example stylesheet and background image.
|
51
|
-
|
52
|
-
== Infopark Tracking
|
53
|
-
|
54
|
-
If you enable the infopark_tracking, please refer to the OMC documentation for further details,
|
55
|
-
e.g. Apache logging options.
|
56
|
-
|
57
46
|
== Seo Sitemap
|
58
47
|
|
59
|
-
The default implementation for the seo sitemap will feature all files from your CMS in the generated <tt>sitemap.xml</tt>. For a large number of files, this can slow down your server. Please refer to
|
48
|
+
The default implementation for the seo sitemap will feature all files from your CMS in the generated <tt>sitemap.xml</tt>. For a large number of files, this can slow down your server. Please refer to {RailsConnector::SEO::ClassMethods#find_all_for_sitemap} for advise on optimization.
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# This controller inherits all of its behavior from
|
2
|
-
# RailsConnector::DefaultCmsController.
|
2
|
+
# {RailsConnector::DefaultCmsController}.
|
3
3
|
#
|
4
|
-
# CmsController is referenced by the Rails Connector routes.
|
4
|
+
# {CmsController} is referenced by the Rails Connector routes.
|
5
|
+
# @api public
|
5
6
|
class CmsController < RailsConnector::DefaultCmsController
|
6
7
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# This controller inherits all of its behavior from
|
2
|
-
# RailsConnector::DefaultCommentsController.
|
2
|
+
# {RailsConnector::DefaultCommentsController}.
|
3
3
|
#
|
4
|
-
# CommentsController is referenced by the Rails Connector routes.
|
4
|
+
# {CommentsController} is referenced by the Rails Connector routes.
|
5
5
|
class CommentsController < RailsConnector::DefaultCommentsController
|
6
6
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module RailsConnector
|
2
2
|
|
3
|
-
# This controller provides some default includes (
|
3
|
+
# This controller provides some default includes ({CmsAccessible}),
|
4
4
|
# before filters (+load_object+, among others), and actions to simplify
|
5
5
|
# CMS object handling. It should never be used directly, but only as a
|
6
|
-
# super class to CmsController.
|
6
|
+
# super class to {CmsController}.
|
7
|
+
# @api public
|
7
8
|
class DefaultCmsController < ApplicationController
|
8
9
|
include CmsAccessible
|
9
10
|
before_filter :set_preview_time
|
@@ -13,11 +14,13 @@ module RailsConnector
|
|
13
14
|
before_filter :set_google_expire_header
|
14
15
|
|
15
16
|
# Default Action. Delivers files directly if their mime type is not text/html
|
17
|
+
# @api public
|
16
18
|
def index
|
17
19
|
deliver_file if @obj.mime_type != "text/html"
|
18
20
|
end
|
19
21
|
|
20
22
|
# Toggles edit markers. The current status is stored in the session.
|
23
|
+
# @api public
|
21
24
|
def toggle_editmarkers
|
22
25
|
session[:hide_editmarkers] = !session[:hide_editmarkers]
|
23
26
|
redirect_to cms_id_url(@obj)
|
@@ -28,10 +31,11 @@ module RailsConnector
|
|
28
31
|
#
|
29
32
|
# Overwrite it to return false if you do want your controller to be excluded from Obj dispatching.
|
30
33
|
#
|
31
|
-
# You may also implement a method with the name
|
32
|
-
# descending from
|
34
|
+
# You may also implement a method with the name {use_for_obj_dispatch?} in controllers not
|
35
|
+
# descending from {DefaultCmsController} to include them in Obj dispatching.
|
33
36
|
#
|
34
37
|
# @see Obj#controller_name
|
38
|
+
# @api public
|
35
39
|
def self.use_for_obj_dispatch?
|
36
40
|
true
|
37
41
|
end
|
@@ -1,10 +1,9 @@
|
|
1
1
|
module RailsConnector
|
2
2
|
#
|
3
3
|
# This class provides a default controller implementation for comment creation.
|
4
|
-
# It should only be used indirectly via a subclass named CommentsController.
|
4
|
+
# It should only be used indirectly via a subclass named {CommentsController}.
|
5
5
|
#
|
6
6
|
# The controller actions only respond to XMLHttpRequests (Ajax).
|
7
|
-
#
|
8
7
|
class DefaultCommentsController < ApplicationController
|
9
8
|
layout nil
|
10
9
|
|
@@ -1,6 +1,7 @@
|
|
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
|
4
5
|
class DefaultCrmFormController < DefaultCmsController
|
5
6
|
|
6
7
|
include Crm::Localizable
|
@@ -13,6 +14,7 @@ module RailsConnector
|
|
13
14
|
:contact => [:gender, :first_name, :last_name, :email]
|
14
15
|
}
|
15
16
|
|
17
|
+
# @api public
|
16
18
|
def index
|
17
19
|
unless logged_in?
|
18
20
|
@user = Infopark::Crm::Contact.new(:language => default_language)
|
@@ -46,6 +48,7 @@ module RailsConnector
|
|
46
48
|
# Override this method for custom logic to get from a given OBJ to an activity kind.
|
47
49
|
#
|
48
50
|
# Defaults to +@obj[:activity_kind]+ or 'contact form' if the former is +nil+.
|
51
|
+
# @api public
|
49
52
|
def activity_kind
|
50
53
|
@obj[:activity_kind] || 'contact form'
|
51
54
|
end
|
@@ -53,6 +56,7 @@ module RailsConnector
|
|
53
56
|
# Returns the state of a new activity.
|
54
57
|
#
|
55
58
|
# Defaults to the first state assigned to +activity_kind+.
|
59
|
+
# @api public
|
56
60
|
def activity_state
|
57
61
|
Infopark::Crm::CustomType.find(activity_kind).states.first
|
58
62
|
end
|
@@ -64,6 +68,7 @@ module RailsConnector
|
|
64
68
|
# an additional form field to the corresponding view.
|
65
69
|
#
|
66
70
|
# Defaults to the current locale.
|
71
|
+
# @api public
|
67
72
|
def default_language
|
68
73
|
I18n.locale.to_s
|
69
74
|
end
|
@@ -75,6 +80,7 @@ module RailsConnector
|
|
75
80
|
# the behavior without having to override #index.
|
76
81
|
#
|
77
82
|
# By default, it assigns a default title if +has_title_input_field?+ is +false+.
|
83
|
+
# @api public
|
78
84
|
def before_saving_activity(activity)
|
79
85
|
activity.title = "Website form submission" unless has_title_input_field?
|
80
86
|
end
|
@@ -86,6 +92,7 @@ module RailsConnector
|
|
86
92
|
# The method is also available as helper in your views.
|
87
93
|
#
|
88
94
|
# By default, it renders crm_form/confirmation
|
95
|
+
# @api public
|
89
96
|
def after_saving_activity(activity)
|
90
97
|
render 'crm_form/confirmation'
|
91
98
|
end
|
@@ -94,6 +101,7 @@ module RailsConnector
|
|
94
101
|
# Override this method to return +false+ if you want to set the title programmatically.
|
95
102
|
#
|
96
103
|
# By default, it returns +true+
|
104
|
+
# @api public
|
97
105
|
def has_title_input_field?
|
98
106
|
true
|
99
107
|
end
|
@@ -105,6 +113,7 @@ module RailsConnector
|
|
105
113
|
# and custom attributes that are not to be set by users.
|
106
114
|
#
|
107
115
|
# By default, it returns a hash only with title and custom values.
|
116
|
+
# @api public
|
108
117
|
def sanitize_activity_params(activity_params_or_nil)
|
109
118
|
activity_params_whitelist = [:title]
|
110
119
|
(activity_params_or_nil || {}).reject do |attr, value|
|
@@ -118,6 +127,7 @@ module RailsConnector
|
|
118
127
|
#
|
119
128
|
# Drop a custom view to change the look, or override this method
|
120
129
|
# if you want different behavior, like a redirect.
|
130
|
+
# @api public
|
121
131
|
def authorize
|
122
132
|
render 'not_logged_in' unless logged_in? || allow_anonymous?
|
123
133
|
end
|
@@ -129,6 +139,7 @@ module RailsConnector
|
|
129
139
|
# The method is also available as helper in your views.
|
130
140
|
#
|
131
141
|
# By default, it returns +false+, i.e. only logged-in users can see the form
|
142
|
+
# @api public
|
132
143
|
def allow_anonymous?
|
133
144
|
false
|
134
145
|
end
|
@@ -141,6 +152,7 @@ module RailsConnector
|
|
141
152
|
#
|
142
153
|
# By default, it returns +true+ for any attribute, i.e. every custom attribute
|
143
154
|
# can be filled in by the user.
|
155
|
+
# @api public
|
144
156
|
def allow_custom_attribute?(attribute_name)
|
145
157
|
true
|
146
158
|
end
|
@@ -159,6 +171,7 @@ module RailsConnector
|
|
159
171
|
# }
|
160
172
|
#
|
161
173
|
# end
|
174
|
+
# @api public
|
162
175
|
def editable_attributes_on_register
|
163
176
|
self.class.editable_attributes_on_register
|
164
177
|
end
|
@@ -58,6 +58,7 @@ module RailsConnector
|
|
58
58
|
# "white list", then an error message will be rendered as inline text with response status "403
|
59
59
|
# Forbidden".
|
60
60
|
#
|
61
|
+
# @api public
|
61
62
|
class DefaultPdfController < DefaultCmsController
|
62
63
|
# Returns false by default to exclude this controller from regular Obj dispatch.
|
63
64
|
# @see DefaultCmsController#use_for_obj_dispatch?
|
@@ -92,6 +93,7 @@ module RailsConnector
|
|
92
93
|
# <%= link_to 'Generate PDF', pdf_path(@obj) %>
|
93
94
|
# # This will generate a PDF containing the title and the body of the current object
|
94
95
|
#
|
96
|
+
# @api public
|
95
97
|
def index
|
96
98
|
end
|
97
99
|
|
@@ -8,12 +8,15 @@ 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
|
11
12
|
class DefaultRssController < DefaultCmsController
|
12
13
|
#
|
13
14
|
# This action renders the built-in RSS feed.
|
14
15
|
#
|
15
16
|
# To customize feed's layout, override either this method, or the apropriate view.
|
16
17
|
#
|
18
|
+
# @return [void]
|
19
|
+
# @api public
|
17
20
|
def index
|
18
21
|
respond_to do |format|
|
19
22
|
format.rss
|
@@ -22,7 +25,7 @@ module RailsConnector
|
|
22
25
|
|
23
26
|
protected
|
24
27
|
|
25
|
-
def load_object
|
28
|
+
def load_object
|
26
29
|
@obj = Configuration::Rss.root
|
27
30
|
end
|
28
31
|
end
|
@@ -4,6 +4,7 @@ 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
|
7
8
|
class DefaultSearchController < ApplicationController
|
8
9
|
class_attribute :options
|
9
10
|
self.options = {:limit => 10}
|
@@ -27,6 +28,7 @@ module RailsConnector
|
|
27
28
|
# # * Flash on errors
|
28
29
|
# end
|
29
30
|
# end
|
31
|
+
# @api public
|
30
32
|
def search
|
31
33
|
unless (@query = params[:q]).blank?
|
32
34
|
@hits = WillPaginate::Collection.create(current_page, options[:limit]) do |pager|
|
@@ -14,6 +14,7 @@ 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
|
17
18
|
class DefaultUserController < ApplicationController
|
18
19
|
|
19
20
|
before_filter :check_editable_attribute_configuration
|
@@ -44,6 +45,7 @@ module RailsConnector
|
|
44
45
|
end
|
45
46
|
|
46
47
|
# Displays a profile page containing links to all available actions
|
48
|
+
# @api public
|
47
49
|
def profile
|
48
50
|
end
|
49
51
|
|
@@ -61,6 +63,7 @@ module RailsConnector
|
|
61
63
|
#
|
62
64
|
# If you merely want to change what happens before or after a user is authenticated,
|
63
65
|
# do not override this method but override +before_authenticate+ or +after_authenticate+.
|
66
|
+
# @api public
|
64
67
|
def login
|
65
68
|
if request.post?
|
66
69
|
@user = Infopark::Crm::Contact.new(params[:user] || {:login => nil, :password => nil})
|
@@ -87,6 +90,7 @@ module RailsConnector
|
|
87
90
|
#
|
88
91
|
# To change the behavior before or after invalidating the session,
|
89
92
|
# override +before_logout+ or +after_logout+.
|
93
|
+
# @api public
|
90
94
|
def logout
|
91
95
|
before_logout
|
92
96
|
self.current_user = nil
|
@@ -100,6 +104,7 @@ module RailsConnector
|
|
100
104
|
#
|
101
105
|
# If you merely want to change what happens before or after a user is registered,
|
102
106
|
# do not override this method but override +before_register+ or +after_register+.
|
107
|
+
# @api public
|
103
108
|
def new
|
104
109
|
@user = Infopark::Crm::Contact.new
|
105
110
|
# Load some default attributes so that form_for is working
|
@@ -119,10 +124,12 @@ module RailsConnector
|
|
119
124
|
flash.now[:error] = tcon('registration_failed')
|
120
125
|
end
|
121
126
|
|
127
|
+
# @api public
|
122
128
|
def register_pending
|
123
129
|
end
|
124
130
|
|
125
131
|
# Lets the user change his/her user details.
|
132
|
+
# @api public
|
126
133
|
def edit
|
127
134
|
@user = Infopark::Crm::Contact.find(current_user.id)
|
128
135
|
if request.post? || request.put?
|
@@ -138,6 +145,7 @@ module RailsConnector
|
|
138
145
|
# Lets the user change his/her password.
|
139
146
|
#
|
140
147
|
# Validates the new password using +validate_edit_password_params_for+.
|
148
|
+
# @api public
|
141
149
|
def edit_password
|
142
150
|
if request.post?
|
143
151
|
validate_edit_password_params_for(params[:user])
|
@@ -153,6 +161,7 @@ module RailsConnector
|
|
153
161
|
# Lets the user request a new password (double opt-in).
|
154
162
|
#
|
155
163
|
# Uses the +ConfirmationMailer+ for sending out the confirmation message.
|
164
|
+
# @api public
|
156
165
|
def forgot_password
|
157
166
|
if request.post?
|
158
167
|
user = Infopark::Crm::Contact.search(:params => {:login => params[:user][:login]}).first
|
@@ -167,6 +176,7 @@ module RailsConnector
|
|
167
176
|
end
|
168
177
|
end
|
169
178
|
|
179
|
+
# @api public
|
170
180
|
def set_password
|
171
181
|
if request.get? && params[:token].blank?
|
172
182
|
flash[:error] = tcon('token_url_invalid')
|
@@ -1,9 +1,11 @@
|
|
1
1
|
# Renders a search engine optimized sitemap.xml
|
2
2
|
# Enable via <tt>RailsConnector::Configuration.enable(:seo_sitemap)</tt>
|
3
|
+
# @api public
|
3
4
|
class SeoSitemapController < ApplicationController
|
4
5
|
layout nil
|
5
6
|
|
6
7
|
# Finds all objects which are to be shown in the SEO sitemap. Responds to xml only.
|
8
|
+
# @api public
|
7
9
|
def show
|
8
10
|
@objects = Obj.find_all_for_sitemap
|
9
11
|
respond_to { |format| format.xml }
|
data/app/helpers/cms_helper.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
# CmsHelper is a wrapper around RailsConnector::DefaultCmsHelper.
|
1
|
+
# {CmsHelper} is a wrapper around {RailsConnector::DefaultCmsHelper}.
|
2
2
|
# It can be replaced in your application in order to add or
|
3
3
|
# modify helpers.
|
4
|
+
# @api public
|
4
5
|
module CmsHelper
|
5
6
|
include RailsConnector::DefaultCmsHelper
|
6
7
|
end
|
@@ -1,6 +1,7 @@
|
|
1
|
-
# CmsRoutingHelper is a wrapper around RailsConnector::DefaultCmsRoutingHelper.
|
1
|
+
# {CmsRoutingHelper} is a wrapper around {RailsConnector::DefaultCmsRoutingHelper}.
|
2
2
|
# It can be replaced in your application in order to add or
|
3
3
|
# modify helpers.
|
4
|
+
# @api public
|
4
5
|
module CmsRoutingHelper
|
5
6
|
include RailsConnector::DefaultCmsRoutingHelper
|
6
7
|
end
|
@@ -5,6 +5,7 @@ module RailsConnector
|
|
5
5
|
# Use this helper to take advantage of rails' asset host mechanism.
|
6
6
|
# (See http://api.rubyonrails.com/classes/ActionView/Helpers/AssetTagHelper.html for details about asset hosts.)
|
7
7
|
# If your application does not use any asset hosts, the helper will generate regular (=non asset host) pathes.
|
8
|
+
# @api public
|
8
9
|
module CmsAssetHelper
|
9
10
|
|
10
11
|
# Returns an html image tag for an image stored in the CMS.
|
@@ -16,6 +17,7 @@ module RailsConnector
|
|
16
17
|
# +target+'s +display_title+ as the html alt attribute.
|
17
18
|
# If your application is configured to use asset hosts, the images tag will reference
|
18
19
|
# the image using one of your asset hosts.
|
20
|
+
# @api public
|
19
21
|
def cms_image_tag(target, options = {})
|
20
22
|
options.symbolize_keys!
|
21
23
|
|
@@ -31,6 +33,7 @@ module RailsConnector
|
|
31
33
|
# +target+ can be an +Obj+ or a +Link+ or a +LinkList+.
|
32
34
|
# If your application is configured to use asset hosts, the path will reference
|
33
35
|
# the object using one of your asset hosts.
|
36
|
+
# @api public
|
34
37
|
def cms_asset_path(target)
|
35
38
|
regular_path = cms_path(target)
|
36
39
|
return regular_path if regular_path.first == "#"
|
@@ -1,11 +1,14 @@
|
|
1
1
|
module RailsConnector
|
2
2
|
|
3
|
+
# @api public
|
3
4
|
module DefaultCmsRoutingHelper
|
4
5
|
# Returns the path for +target+ using the +CmsController+ routes.
|
5
6
|
# +target+ can be an +Obj+ or a +Link+ or a +LinkList+.
|
6
7
|
# If +target+ is a +Linklist+, it must be non-empty. The first +Link+ from the +LinkList+ will be used.
|
7
8
|
# +options+ are optional and include url settings such as path parameters or protocol
|
8
9
|
# +options+ are only passed on if +target+ is an +Obj+.
|
10
|
+
# @return [String]
|
11
|
+
# @api public
|
9
12
|
def cms_path(target, options = {})
|
10
13
|
cms_path_or_url(target, "path", options)
|
11
14
|
end
|
@@ -15,14 +18,16 @@ module RailsConnector
|
|
15
18
|
# If +target+ is a +Linklist+, it must be non-empty. The first +Link+ from the +LinkList+ will be used.
|
16
19
|
# +options+ are optional and include url settings such as path parameters or protocol
|
17
20
|
# +options+ are only passed on if +target+ is an +Obj+.
|
21
|
+
# @return [String]
|
22
|
+
# @api public
|
18
23
|
def cms_url(target, options = {})
|
19
24
|
cms_path_or_url(target, "url", options)
|
20
25
|
end
|
21
26
|
|
22
|
-
LINK_TO_UNREACHABLE = "#__target_object_not_reachable"
|
23
|
-
LINK_TO_EMPTY_LINKLIST = "#__empty_linklist"
|
27
|
+
LINK_TO_UNREACHABLE = "#__target_object_not_reachable"
|
28
|
+
LINK_TO_EMPTY_LINKLIST = "#__empty_linklist"
|
24
29
|
|
25
|
-
def cms_path_or_url(target, path_or_url, options = {})
|
30
|
+
def cms_path_or_url(target, path_or_url, options = {})
|
26
31
|
if target.is_a?(Link)
|
27
32
|
cms_path_or_url_for_links(target, path_or_url)
|
28
33
|
elsif target.is_a?(Obj)
|
@@ -39,14 +44,14 @@ module RailsConnector
|
|
39
44
|
end
|
40
45
|
end
|
41
46
|
|
42
|
-
def cms_path_or_url_for_links(link, path_or_url)
|
47
|
+
def cms_path_or_url_for_links(link, path_or_url)
|
43
48
|
return LINK_TO_UNREACHABLE if link.internal? && link.destination_object.nil?
|
44
49
|
append_search_and_fragment(
|
45
50
|
basic_url_or_path_for_link(link, path_or_url), link
|
46
51
|
)
|
47
52
|
end
|
48
53
|
|
49
|
-
def cms_path_or_url_for_objs(obj, path_or_url, options = {})
|
54
|
+
def cms_path_or_url_for_objs(obj, path_or_url, options = {})
|
50
55
|
permalink = obj.permalink
|
51
56
|
if permalink && !Configuration.editor_interface_enabled?
|
52
57
|
__send__("cms_permalink_#{path_or_url}", options.merge(:permalink => permalink))
|
@@ -1,11 +1,13 @@
|
|
1
1
|
module RailsConnector
|
2
2
|
|
3
|
+
# @api public
|
3
4
|
module DefaultCrmFormHelper
|
4
5
|
|
5
6
|
include ::RailsConnector::DefaultUserHelper
|
6
7
|
include ::RailsConnector::MandatoryLabelHelper
|
7
8
|
include ::RailsConnector::ErrorMessagesHelper
|
8
9
|
|
10
|
+
# @api public
|
9
11
|
def custom_fields_for(form)
|
10
12
|
activity = instance_variable_get("@#{form.object_name}")
|
11
13
|
custom_attribute_defs = Infopark::Crm::CustomType.find(activity.kind).custom_attributes
|
@@ -35,6 +37,7 @@ module RailsConnector
|
|
35
37
|
content
|
36
38
|
end
|
37
39
|
|
40
|
+
# @api public
|
38
41
|
def title_field_for(form)
|
39
42
|
content = "".html_safe
|
40
43
|
if has_title_input_field?
|
@@ -48,6 +51,7 @@ module RailsConnector
|
|
48
51
|
content
|
49
52
|
end
|
50
53
|
|
54
|
+
# @api public
|
51
55
|
def logged_in_as(user)
|
52
56
|
content_tag(:em) do
|
53
57
|
t('rails_connector.views.crm_form.logged_in_as',
|
@@ -2,7 +2,8 @@ require "recaptcha"
|
|
2
2
|
|
3
3
|
module RailsConnector
|
4
4
|
|
5
|
-
# This module contains helpers for the
|
5
|
+
# This module contains helpers for the {UserController} and {DefaultUserController}
|
6
|
+
# @api public
|
6
7
|
module DefaultUserHelper
|
7
8
|
|
8
9
|
include ::ReCaptcha::ViewHelper
|
@@ -10,6 +11,7 @@ module RailsConnector
|
|
10
11
|
include ::RailsConnector::ErrorMessagesHelper
|
11
12
|
|
12
13
|
# Returns mandatory user fields as array of symbols.
|
14
|
+
# @api public
|
13
15
|
def mandatory_user_fields
|
14
16
|
[:email, :gender, :language, :last_name]
|
15
17
|
end
|
@@ -38,6 +40,7 @@ module RailsConnector
|
|
38
40
|
# user:
|
39
41
|
# first_name: First name
|
40
42
|
# last_name: Last name
|
43
|
+
# @api public
|
41
44
|
def user_fields_for(form, model_name, *attributes)
|
42
45
|
output = "".html_safe
|
43
46
|
attributes.flatten.each do |attr|
|
@@ -63,6 +66,7 @@ module RailsConnector
|
|
63
66
|
output
|
64
67
|
end
|
65
68
|
|
69
|
+
# @api public
|
66
70
|
def genders_for_select
|
67
71
|
[
|
68
72
|
['', 'N'],
|
@@ -71,6 +75,7 @@ module RailsConnector
|
|
71
75
|
]
|
72
76
|
end
|
73
77
|
|
78
|
+
# @api public
|
74
79
|
def languages_for_select_for(*languages)
|
75
80
|
options = []
|
76
81
|
languages.flatten.each do |lang|
|
@@ -79,6 +84,7 @@ module RailsConnector
|
|
79
84
|
options
|
80
85
|
end
|
81
86
|
|
87
|
+
# @api public
|
82
88
|
def profile_fields_for(form, editable_attributes={})
|
83
89
|
output = "".html_safe
|
84
90
|
output += user_fields_for(form, "contact", editable_attributes[:contact])
|