infopark_rails_connector 6.9.1.3.22208381 → 6.9.2.1.125136549

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 (132) hide show
  1. data/README +2 -14
  2. data/app/assets/javascripts/infopark_rails_connector.js.erb +0 -3
  3. data/app/assets/stylesheets/infopark_rails_connector.css.erb +0 -4
  4. data/app/controllers/rails_connector/default_cms_controller.rb +0 -1
  5. data/app/helpers/rails_connector/default_cms_helper.rb +0 -6
  6. data/app/helpers/rails_connector/layout_helper.rb +2 -7
  7. data/app/views/cms/index.html.erb +0 -2
  8. data/app/views/errors/410_gone.html.erb +2 -2
  9. data/config/ca-bundle.crt +1 -1
  10. data/config/cms_routes.rb +2 -1
  11. data/config/locales/de.rails_connector.views.yml +0 -78
  12. data/config/locales/en.rails_connector.views.yml +0 -78
  13. data/lib/generators/rails_connector/install/install_generator.rb +0 -1
  14. data/lib/generators/rails_connector/install/templates/initializers/rails_connector.rb +0 -27
  15. data/lib/rails_connector/cms_accessible.rb +0 -4
  16. data/lib/rails_connector/configuration.rb +9 -72
  17. data/lib/rails_connector/engine.rb +0 -18
  18. metadata +3 -181
  19. data/app/assets/images/ratings/star.gif +0 -0
  20. data/app/assets/images/time_machine/calendar-menuarrow.gif +0 -0
  21. data/app/assets/images/time_machine/calendar_bg.png +0 -0
  22. data/app/assets/images/time_machine/icon.png +0 -0
  23. data/app/assets/images/time_machine/slider_bg.png +0 -0
  24. data/app/assets/images/time_machine/slider_handle.png +0 -0
  25. data/app/assets/images/time_machine/timemachine_bg.png +0 -0
  26. data/app/assets/javascripts/comments.js +0 -29
  27. data/app/assets/javascripts/initializer.js +0 -9
  28. data/app/assets/javascripts/ratings.js +0 -26
  29. data/app/assets/javascripts/time_machine.js +0 -8
  30. data/app/assets/javascripts/time_machine/calendar-setup.js +0 -200
  31. data/app/assets/javascripts/time_machine/calendar.js +0 -1806
  32. data/app/assets/javascripts/time_machine/lang/calendar-de.js +0 -127
  33. data/app/assets/javascripts/time_machine/lang/calendar-en.js +0 -127
  34. data/app/assets/javascripts/time_machine/lang/calendar-es.js +0 -129
  35. data/app/assets/javascripts/time_machine/lang/calendar-fr.js +0 -125
  36. data/app/assets/javascripts/time_machine/lang/calendar-it.js +0 -124
  37. data/app/assets/javascripts/time_machine/slider.js +0 -278
  38. data/app/assets/stylesheets/ratings.css +0 -97
  39. data/app/assets/stylesheets/time_machine.css +0 -6
  40. data/app/assets/stylesheets/time_machine/time_machine.css +0 -292
  41. data/app/controllers/comments_controller.rb +0 -6
  42. data/app/controllers/crm_form_controller.rb +0 -6
  43. data/app/controllers/rails_connector/default_comments_controller.rb +0 -70
  44. data/app/controllers/rails_connector/default_crm_form_controller.rb +0 -167
  45. data/app/controllers/rails_connector/default_ratings_controller.rb +0 -84
  46. data/app/controllers/rails_connector/default_rss_controller.rb +0 -30
  47. data/app/controllers/rails_connector/default_search_controller.rb +0 -60
  48. data/app/controllers/rails_connector/default_user_controller.rb +0 -269
  49. data/app/controllers/rails_connector/time_machine_controller.rb +0 -48
  50. data/app/controllers/ratings_controller.rb +0 -6
  51. data/app/controllers/rss_controller.rb +0 -6
  52. data/app/controllers/search_controller.rb +0 -6
  53. data/app/controllers/seo_sitemap_controller.rb +0 -12
  54. data/app/controllers/user_controller.rb +0 -6
  55. data/app/helpers/crm_form_helper.rb +0 -6
  56. data/app/helpers/rails_connector/default_crm_form_helper.rb +0 -58
  57. data/app/helpers/rails_connector/default_ratings_helper.rb +0 -38
  58. data/app/helpers/rails_connector/default_user_helper.rb +0 -90
  59. data/app/helpers/rails_connector/error_messages_helper.rb +0 -23
  60. data/app/helpers/rails_connector/link_helper.rb +0 -93
  61. data/app/helpers/rails_connector/mandatory_label_helper.rb +0 -10
  62. data/app/helpers/rails_connector/menu_helper.rb +0 -73
  63. data/app/helpers/rails_connector/micronav_helper.rb +0 -109
  64. data/app/helpers/rails_connector/seo_helper.rb +0 -44
  65. data/app/helpers/rails_connector/time_machine_helper.rb +0 -26
  66. data/app/helpers/rails_connector/tracking_helper.rb +0 -32
  67. data/app/helpers/ratings_helper.rb +0 -4
  68. data/app/helpers/user_helper.rb +0 -6
  69. data/app/mailers/confirmation_mailer.rb +0 -15
  70. data/app/models/crm_form.rb +0 -2
  71. data/app/models/rails_connector/default_comment.rb +0 -30
  72. data/app/models/rails_connector/default_rating.rb +0 -22
  73. data/app/views/cms/_comments.html.erb +0 -44
  74. data/app/views/cms/_rating.html.erb +0 -31
  75. data/app/views/comments/_comment.html.erb +0 -28
  76. data/app/views/confirmation_mailer/register_confirmation.erb +0 -5
  77. data/app/views/confirmation_mailer/reset_password.erb +0 -5
  78. data/app/views/crm_form/_flash_messages.html.erb +0 -11
  79. data/app/views/crm_form/_form.html.erb +0 -17
  80. data/app/views/crm_form/confirmation.html.erb +0 -3
  81. data/app/views/crm_form/index.html.erb +0 -5
  82. data/app/views/crm_form/not_logged_in.html.erb +0 -1
  83. data/app/views/layouts/rails_connector/time_machine.html.erb +0 -12
  84. data/app/views/rails_connector/time_machine/index.html.erb +0 -88
  85. data/app/views/rss/_item.rss.builder +0 -11
  86. data/app/views/rss/index.rss.builder +0 -11
  87. data/app/views/search/_hit.html.erb +0 -11
  88. data/app/views/search/_hits.html.erb +0 -11
  89. data/app/views/search/_mini_panel.html.erb +0 -4
  90. data/app/views/search/_pagination.html.erb +0 -5
  91. data/app/views/search/_panel.html.erb +0 -4
  92. data/app/views/search/search.html.erb +0 -12
  93. data/app/views/seo_sitemap/show.xml.builder +0 -16
  94. data/app/views/user/_flash_messages.html.erb +0 -11
  95. data/app/views/user/edit.html.erb +0 -6
  96. data/app/views/user/edit_password.html.erb +0 -11
  97. data/app/views/user/forgot_password.html.erb +0 -7
  98. data/app/views/user/login.html.erb +0 -15
  99. data/app/views/user/new.html.erb +0 -13
  100. data/app/views/user/profile.html.erb +0 -8
  101. data/app/views/user/register_pending.html.erb +0 -1
  102. data/app/views/user/set_password.html.erb +0 -14
  103. data/config/locales/de.rails_connector.controllers.yml +0 -28
  104. data/config/locales/de.rails_connector.helpers.yml +0 -9
  105. data/config/locales/de.rails_connector.models.yml +0 -8
  106. data/config/locales/en.rails_connector.controllers.yml +0 -28
  107. data/config/locales/en.rails_connector.helpers.yml +0 -9
  108. data/config/locales/en.rails_connector.models.yml +0 -8
  109. data/config/routes.rb +0 -31
  110. data/lib/generators/rails_connector/comments/comments_generator.rb +0 -20
  111. data/lib/generators/rails_connector/comments/templates/migration.rb +0 -16
  112. data/lib/generators/rails_connector/install/templates/initializers/crm_connector.rb +0 -22
  113. data/lib/generators/rails_connector/ratings/ratings_generator.rb +0 -20
  114. data/lib/generators/rails_connector/ratings/templates/migration.rb +0 -14
  115. data/lib/rails_connector/commentable.rb +0 -23
  116. data/lib/rails_connector/configuration/google_analytics.rb +0 -29
  117. data/lib/rails_connector/configuration/rss.rb +0 -46
  118. data/lib/rails_connector/crm.rb +0 -282
  119. data/lib/rails_connector/googlebot_checker.rb +0 -46
  120. data/lib/rails_connector/liquid_support.rb +0 -25
  121. data/lib/rails_connector/liquid_support/field_value_drop.rb +0 -22
  122. data/lib/rails_connector/liquid_support/general_helper_tag.rb +0 -44
  123. data/lib/rails_connector/liquid_support/link_drop.rb +0 -22
  124. data/lib/rails_connector/liquid_support/liquid_template_handler.rb +0 -162
  125. data/lib/rails_connector/liquid_support/named_object_drop.rb +0 -14
  126. data/lib/rails_connector/liquid_support/obj_drop.rb +0 -43
  127. data/lib/rails_connector/liquid_support/obj_filters.rb +0 -77
  128. data/lib/rails_connector/rateable.rb +0 -57
  129. data/lib/rails_connector/seo.rb +0 -52
  130. data/lib/rails_connector/ses.rb +0 -81
  131. data/lib/rails_connector/syndicateable.rb +0 -11
  132. data/lib/search_request.rb +0 -2
@@ -1,6 +0,0 @@
1
- # This controller inherits all of its behavior from
2
- # RailsConnector::DefaultRatingsController.
3
- #
4
- # RatingsController is referenced by the Rails Connector routes.
5
- class RatingsController < RailsConnector::DefaultRatingsController
6
- end
@@ -1,6 +0,0 @@
1
- # This controller inherits all of its behavior from
2
- # RailsConnector::DefaultRssController.
3
- #
4
- # RssController is referenced by the Rails Connector routes.
5
- class RssController < RailsConnector::DefaultRssController
6
- end
@@ -1,6 +0,0 @@
1
- # This controller inherits all of its behavior from
2
- # {RailsConnector::DefaultSearchController}.
3
- #
4
- # {SearchController} is referenced by the Rails Connector routes.
5
- class SearchController < RailsConnector::DefaultSearchController
6
- end
@@ -1,12 +0,0 @@
1
- # Renders a search engine optimized sitemap.xml
2
- # Enable via <tt>RailsConnector::Configuration.enable(:seo_sitemap)</tt>
3
- class SeoSitemapController < ApplicationController
4
- layout nil
5
-
6
- # Finds all objects which are to be shown in the SEO sitemap. Responds to xml only.
7
- def show
8
- @objects = Obj.find_all_for_sitemap
9
- respond_to { |format| format.xml }
10
- end
11
-
12
- end
@@ -1,6 +0,0 @@
1
- # This controller inherits all of its behavior from
2
- # {RailsConnector::DefaultUserController}.
3
- #
4
- # {UserController} is referenced by the Rails Connector routes.
5
- class UserController < RailsConnector::DefaultUserController
6
- end
@@ -1,6 +0,0 @@
1
- # {CrmFormHelper} is a wrapper around {RailsConnector::DefaultCrmFormHelper}.
2
- # It can be replaced in your application in order to add or
3
- # modify helpers.
4
- module CrmFormHelper
5
- include RailsConnector::DefaultCrmFormHelper
6
- end
@@ -1,58 +0,0 @@
1
- module RailsConnector
2
-
3
- module DefaultCrmFormHelper
4
-
5
- include ::RailsConnector::DefaultUserHelper
6
- include ::RailsConnector::MandatoryLabelHelper
7
- include ::RailsConnector::ErrorMessagesHelper
8
-
9
- def custom_fields_for(form)
10
- activity = instance_variable_get("@#{form.object_name}")
11
- custom_attribute_defs = Infopark::Crm::CustomType.find(activity.kind).custom_attributes
12
- content = "".html_safe
13
- custom_attribute_defs.each do |attribute|
14
- custom_attr = "custom_#{attribute.name}"
15
- next unless allow_custom_attribute?(custom_attr)
16
- value = activity.__send__(custom_attr).to_s
17
- input_field =
18
- case attribute.type
19
- when 'enum'
20
- form.select(custom_attr, [''] + attribute.valid_values, :value => value)
21
- when 'text'
22
- form.text_area(custom_attr, :value => value, :cols => 50, :rows => 5)
23
- else
24
- form.text_field(custom_attr, :value => value, :size => "40")
25
- end
26
- content << content_tag(:div, :class => 'label') do
27
- if attribute.mandatory
28
- mandatory_label_for(form, custom_attr, h(attribute.title))
29
- else
30
- form.label(custom_attr, h(attribute.title))
31
- end
32
- end
33
- content << content_tag(:div, input_field, :class => 'field')
34
- end
35
- content
36
- end
37
-
38
- def title_field_for(form)
39
- content = "".html_safe
40
- if has_title_input_field?
41
- content << content_tag(:div, :class => 'label') do
42
- mandatory_label_for(form, :title, t(:"rails_connector.views.crm_form.title"))
43
- end
44
- content << content_tag(:div, :class => 'field') do
45
- form.text_field :title
46
- end
47
- end
48
- content
49
- end
50
-
51
- def logged_in_as(user)
52
- content_tag(:em) do
53
- t('rails_connector.views.crm_form.logged_in_as',
54
- :user => content_tag(:strong, user)).html_safe
55
- end
56
- end
57
- end
58
- end
@@ -1,38 +0,0 @@
1
- module RailsConnector
2
- #
3
- # This helper provides methods for use with ratings.
4
- module DefaultRatingsHelper
5
- # Determines whether the current user has rated a CMS object.
6
- def rated_by_current_user?(obj)
7
- session[:rated_objs] && session[:rated_objs][obj.id]
8
- end
9
-
10
- # Builds the HTML markup for the ratings section.
11
- def stars_for_rating(obj)
12
- stars = "".html_safe
13
- (Rating::MINIMUM..Rating::MAXIMUM).collect do |score|
14
- stars << content_tag(:li, link_a_star(score, obj))
15
- end
16
- stars
17
- end
18
-
19
- private
20
-
21
- def link_a_star(score, obj)
22
- css_classes = ["", "one-star", "two-stars", "three-stars", "four-stars", "five-stars"]
23
- descriptions = ["",
24
- t(:"rails_connector.helpers.ratings.bad"),
25
- t(:"rails_connector.helpers.ratings.mediocre"),
26
- t(:"rails_connector.helpers.ratings.average"),
27
- t(:"rails_connector.helpers.ratings.good"),
28
- t(:"rails_connector.helpers.ratings.very_good")
29
- ]
30
- html_options = {
31
- :title => "#{score} von #{Rating::MAXIMUM} Sternen",
32
- :class => css_classes[score],
33
- "data-description" => descriptions[score]
34
- }
35
- link_to(score.to_s, ratings_url(:action => :rate, :id => obj.id, :score => score), html_options)
36
- end
37
- end
38
- end
@@ -1,90 +0,0 @@
1
- require "recaptcha"
2
-
3
- module RailsConnector
4
-
5
- # This module contains helpers for the {UserController} and {DefaultUserController}
6
- module DefaultUserHelper
7
-
8
- include ::ReCaptcha::ViewHelper
9
- include ::RailsConnector::MandatoryLabelHelper
10
- include ::RailsConnector::ErrorMessagesHelper
11
-
12
- # Returns mandatory user fields as array of symbols.
13
- def mandatory_user_fields
14
- [:email, :gender, :language, :last_name]
15
- end
16
-
17
- # Generates part of a form for the given attributes:
18
- #
19
- # In your view, use:
20
- #
21
- # <%= form_for @user, :as => :user do |f| -%>
22
- # <%= user_fields_for(f, 'contact', :first_name, :last_name) %>
23
- # <% end -%>
24
- #
25
- # to generate labels and fields for the contact:
26
- #
27
- # <form>
28
- # <div class="label"><label for="user_first_name">First name</label></div>
29
- # <div class="field"><input id="user_first_name" name="user[first_name]" size="30" type="text" /></div>
30
- # <div class="label"><label for="user_last_name">Last name</label></div>
31
- # <div class="field"><input id="user_last_name" name="user[last_name]" size="30" type="text" /></div>
32
- # </form>
33
- #
34
- # Labels are localized automatically, using the scope views.contact and views.location,
35
- # respectively. For example:
36
- #
37
- # views:
38
- # user:
39
- # first_name: First name
40
- # last_name: Last name
41
- def user_fields_for(form, model_name, *attributes)
42
- output = "".html_safe
43
- attributes.flatten.each do |attr|
44
- output += content_tag(:div, :class => 'label') do
45
- if mandatory_user_fields.include?(attr)
46
- mandatory_label_for(form, attr, t("rails_connector.views.user.#{model_name}.#{attr}"))
47
- else
48
- form.label(attr, t("rails_connector.views.user.#{model_name}.#{attr}"))
49
- end
50
- end
51
- form_field = case attr
52
- when :gender
53
- form.select(:gender, genders_for_select)
54
- when :language
55
- languages = Infopark::Crm::CustomType.find('contact').languages
56
- form.select(:language, languages_for_select_for(languages),
57
- :selected => (@user ? @user.language : I18n.locale.to_s) )
58
- else
59
- form.text_field(attr)
60
- end
61
- output += content_tag(:div, form_field, :class => 'field')
62
- end
63
- output
64
- end
65
-
66
- def genders_for_select
67
- [
68
- ['', 'N'],
69
- [t('rails_connector.views.user.gender_female'),'F'],
70
- [t('rails_connector.views.user.gender_male'), 'M']
71
- ]
72
- end
73
-
74
- def languages_for_select_for(*languages)
75
- options = []
76
- languages.flatten.each do |lang|
77
- options << [t(:"rails_connector.views.user.languages.#{lang}"), lang]
78
- end
79
- options
80
- end
81
-
82
- def profile_fields_for(form, editable_attributes={})
83
- output = "".html_safe
84
- output += user_fields_for(form, "contact", editable_attributes[:contact])
85
- output
86
- end
87
-
88
- end
89
-
90
- end
@@ -1,23 +0,0 @@
1
- module RailsConnector
2
- module ErrorMessagesHelper
3
- # Shortened error_messages_for from git://github.com/rails/dynamic_form.git
4
- def error_messages(*objects)
5
- objects.compact!
6
- count = objects.inject(0) {|sum, object| sum + object.errors.count }
7
- return '' if count.zero?
8
-
9
- content_tag(:div, :class => 'errorExplanation') do
10
- c = ''.html_safe
11
- c << content_tag(:ul) do
12
- li = ''.html_safe
13
- objects.each do |object|
14
- object.errors.full_messages.each do |msg|
15
- li << content_tag(:li, msg)
16
- end
17
- end
18
- li
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,93 +0,0 @@
1
- require "uri"
2
-
3
- module RailsConnector
4
-
5
- # This module contains a helper that can be used to build markup for a link, e.g. a download link.
6
- # @api public
7
- module LinkHelper
8
- # Generates a link by producing the corresponding HTML markup.
9
- # <em>link</em> is the Link to be rendered, you may specify the following <em>options</em>:
10
- #
11
- # [:file_extension] specifies the file extension if the link object is an internal link.
12
- # An external link has no file extension since there is no destination object from which
13
- # the file extension could be taken. File extensions are, for example, 'pdf', 'zip', or 'doc'.
14
- #
15
- # The HTML text generated depends on the kind of Link passed to the helper:
16
- #
17
- # <%= link(@myLinkObject) %>
18
- #
19
- # [With an internal Link] The helper will produce the following HTML where path is
20
- # the path created by the PageHelper, file extension is the file_extension of the
21
- # destination object. For a Content, the display title is the Link's display_title and
22
- # size is the size of its body (in KB or MB):
23
- # <a href='path' class='link'>
24
- # <span class='file extension'>
25
- # display title
26
- # <span class='link_size'> (size)</span>
27
- # </span>
28
- # </a></tt>
29
- #
30
- # [With an external Link] The helper will produce the following HTML where url
31
- # is the external url of the link and display title is the display_title of the Link:
32
- #
33
- # <a class='link' href='url'>
34
- # <span>display title</span>
35
- # </a>
36
- #
37
- # Normally, you do not know the file extension of the external source, so by default
38
- # there will be no CSS class generated for the nested <tt><span></tt> tag. In the case
39
- # that you do know it or want some external links to have a special style, you can
40
- # specify the file extension with the :file_extension option:
41
- #
42
- # <%= link(@myLinkObject, :file_extension => 'file_extension' %>
43
- #
44
- # The helper would then produce the following:
45
- #
46
- # <a class='link' href='destination'>
47
- # <span class='file_extension'>title</span>
48
- # </a>
49
- # @api public
50
- def link(link, options = {})
51
- link_attributes = {
52
- :href => cms_path(link),
53
- :class => 'link'
54
- }
55
- link_attributes[:target] = link.target unless link.target.blank?
56
- content_tag(:a,
57
- content_tag(:span,
58
- display_value(link.display_title) + size_content(link),
59
- :class => options[:file_extension] || link.file_extension
60
- ),
61
- link_attributes
62
- )
63
- end
64
-
65
- # Displays a link list as an HTML list.
66
- # <em>link_list</em> is the link list to be rendered. For each link #link is called.
67
- # For a list of valid <em>options</em> see #link.
68
- #
69
- # The generated list element has the CSS class 'linklist'.
70
- # @api public
71
- def link_list(link_list, options = {})
72
- return if link_list.blank?
73
- markup = "<ul class='linklist'>"
74
- link_list.each do |l|
75
- markup << "<li>#{link l, options}</li>"
76
- end
77
- markup << "</ul>"
78
-
79
- markup.html_safe
80
- end
81
-
82
- private
83
-
84
- def size_content(link)
85
- return "" unless link.internal? && link.destination_object && link.destination_object.binary?
86
- size = ' (' + number_to_human_size(link.destination_object.body_length) + ')'
87
- content_tag(:span, size, :class => 'link_size')
88
- end
89
-
90
- include DisplayHelper
91
- end
92
-
93
- end
@@ -1,10 +0,0 @@
1
- module RailsConnector
2
- module MandatoryLabelHelper
3
- def mandatory_label_for(form, object, label)
4
- html = "".html_safe
5
- html += label
6
- html += content_tag(:span, " *", :class => "mandatory_star")
7
- form.label(object, html, :class => "mandatory")
8
- end
9
- end
10
- end
@@ -1,73 +0,0 @@
1
- module RailsConnector
2
-
3
- # This module contains helpers that can be used to build all kinds of menus.
4
- # @api public
5
- module MenuHelper
6
- include DisplayHelper
7
-
8
- # The <tt>build_menu</tt> method should serve as an example of how to build navigational
9
- # menus using Infopark Rails Connector. If you need to extend this method, copy it into
10
- # the relevant helper for your application.
11
- #
12
- # Example 1 - Single-tier menu:
13
- #
14
- # build_menu(Obj.find(123), nil, :id => "menu")
15
- #
16
- # produces:
17
- #
18
- # <ul id="menu">
19
- # <li>
20
- # <a href="path/to/history">History</a>
21
- # </li>
22
- # <li>
23
- # <a href="path/to/services">Services</a>
24
- # </li>
25
- # </ul>
26
- #
27
- # <tt>build_menu</tt> also takes a block so you can use it recursively for multiple levels
28
- # (<tt>current_page</tt> returns the Obj for "Insurance" in this example):
29
- #
30
- # Example 2 - Two-tier Menu:
31
- #
32
- # build_menu(Obj.find(123), current_page, :id => "main_menu") do |entry|
33
- # build_menu(entry, current_page, :id => "sub_menu")
34
- # end
35
- #
36
- # produces:
37
- #
38
- # <ul id="main_menu">
39
- # <li>
40
- # <a href="path/to/history">History</a>
41
- # </li>
42
- # <li>
43
- # <a href="path/to/products">Services</a>
44
- # <ul id="sub_menu">
45
- # <li>
46
- # <a href="path/to/products/insurance">Insurance</a>
47
- # </li>
48
- # <li>
49
- # <a href="path/to/products/finance">Finance</a>
50
- # </li>
51
- # </ul>
52
- # </li>
53
- # </ul>
54
- #
55
- # @api public
56
- def build_menu(start_obj, current_obj, html_options, &block)
57
- children = table_of_contents(start_obj)
58
- content_tag(:ul, html_options) do
59
- content = "".html_safe
60
- children.each do |child|
61
- content << content_tag(:li) do
62
- list_entry = link_to(child.display_title, cms_path(child))
63
- list_entry += block.call(child) if block_given? && current_obj &&
64
- (current_obj == child || current_obj.ancestors.include?(child))
65
- list_entry
66
- end
67
- end
68
- content
69
- end
70
- end
71
- end
72
-
73
- end
@@ -1,109 +0,0 @@
1
- module RailsConnector
2
-
3
- # This module contains a helper that can be used to build a micronavigation.
4
- # @api public
5
- module MicronavHelper
6
-
7
- # Generates a micronavigation by producing HTML markup.
8
- # <em>obj</em> becomes the rightmost Obj in the micronavigation since it is the one
9
- # for which the micronavigation is built. Assume that all the ancestors of this obj are
10
- # available as an array starting with the root object at index 1.
11
- # The following <em>options</em> exist:
12
- #
13
- # [:start] index of the ancestor object to start with. Default is 1, i.e. the object Obj::root.
14
- # [:micronav_id] ID of the micronavigation. Default is 'micronav'.
15
- #
16
- # All ancestors of <em>obj</em> are linked to the respective objects. <em>obj</em>
17
- # has no linkage. The first and the last <tt><li></tt> tags have apropriate CSS classes.
18
- #
19
- # For example, assume that you have the following object hierarchy:
20
- #
21
- # * Root
22
- # * Ancestor_1
23
- # * Ancestor_2
24
- # * Current_Object
25
- #
26
- # Normal usage with the context Obj set to <tt>@obj</tt>:
27
- #
28
- # <%= micronav(@obj) %>
29
- #
30
- # The helper will start with the Root and will generate the follwing HTML if <tt>@obj</tt> is set to Current_Object:
31
- #
32
- # <ul id='micronav'>
33
- # <li class='first'>
34
- # <a href='/2001/Root'>
35
- # Root
36
- # </a>
37
- # </li>
38
- # <li>
39
- # <a href='/2011/Ancestor_1'>
40
- # Ancestor_1
41
- # </a>
42
- # </li>
43
- # <li>
44
- # <a href='/2012/Ancestor_2'>
45
- # Ancestor_2
46
- # </a>
47
- # </li>
48
- # <li class='last'>
49
- # <span>
50
- # Current_Object
51
- # </span>
52
- # </li>
53
- # </ul>
54
- #
55
- # If the <tt>:start</tt> option is set to 2
56
- #
57
- # <%= micronav(@obj, :start => 2) %>
58
- #
59
- # then the helper will start with Ancestor_1 and will generate:
60
- #
61
- # <ul id='micronav'>
62
- # <li class='first'>
63
- # <a href='/2011/Ancestor_1'>
64
- # Ancestor_1
65
- # </a>
66
- # </li>
67
- # <li>
68
- # <a href='/2012/Ancestor_2'>
69
- # Ancestor_2
70
- # </a>
71
- # </li>
72
- # <li class='last'>
73
- # <span>
74
- # Current_Object
75
- # </span>
76
- # </li>
77
- # </ul>
78
- #
79
- # If you specify the <tt>:micronav_id</tt> option as in
80
- #
81
- # <%= micronav(@obj, :micronav_id => '<em><b>micronav_below_banner</b></em>') %>
82
- #
83
- # then the <tt><ul></tt> tag of the micronavigation will get your custom ID:
84
- #
85
- # <ul id='<em><b>micronav_below_banner</b></em>'></tt>
86
- # ...
87
- # </ul>
88
- # @api public
89
- def micronav(obj, options = {})
90
- options.reverse_merge!({:start => 1, :micronav_id => 'micronav'})
91
- ancestors = obj.ancestors
92
- start = options[:start] - 1
93
- start = 0 if start < 0
94
- ancestors = ancestors[start..-1]
95
- ancestors ||= []
96
- li_tags = "".html_safe
97
- ancestors.each do |ancestor|
98
- tag_options = {}
99
- tag_options[:class] = "first" if li_tags.empty?
100
- li_tags << content_tag(:li, link_to(display_value(ancestor.display_title), cms_path(ancestor)), tag_options)
101
- end
102
- li_tags << content_tag(:li, content_tag(:span, display_value(obj.display_title)), :class => 'last')
103
- content_tag(:ul, li_tags, :id => options[:micronav_id])
104
- end
105
-
106
- include DisplayHelper
107
- end
108
-
109
- end