bootybox 0.0.91

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +7 -0
  2. data/app/assets/images/alchemy/element_thumbnails/bootybox/defaults/default_image.png +0 -0
  3. data/app/assets/images/alchemy/element_thumbnails/bootybox/defaults/default_textbox.png +0 -0
  4. data/app/assets/images/alchemy/element_thumbnails/bootybox/grid/four_columns_25_25_25_25.png +0 -0
  5. data/app/assets/images/alchemy/element_thumbnails/bootybox/grid/one_column_100.png +0 -0
  6. data/app/assets/images/alchemy/element_thumbnails/bootybox/grid/three_columns_33_33_33.png +0 -0
  7. data/app/assets/images/alchemy/element_thumbnails/bootybox/grid/two_columns_25_75.png +0 -0
  8. data/app/assets/images/alchemy/element_thumbnails/bootybox/grid/two_columns_50_50.png +0 -0
  9. data/app/assets/images/alchemy/element_thumbnails/bootybox/grid/two_columns_75_25.png +0 -0
  10. data/app/assets/images/alchemy/element_thumbnails/bootybox/layout/element_container.png +0 -0
  11. data/app/assets/images/alchemy/element_thumbnails/bootybox/layout/seperator.png +0 -0
  12. data/app/assets/javascripts/bootybox/defaults.js +6 -0
  13. data/app/assets/javascripts/bootybox/modal.js.coffee +14 -0
  14. data/app/assets/javascripts/bootybox/portfolio.js.coffee +96 -0
  15. data/app/assets/javascripts/bootybox/slideshow.js.coffee +12 -0
  16. data/app/assets/javascripts/bootybox/templates/modal/buttons/cancel.hbs +1 -0
  17. data/app/assets/javascripts/bootybox/templates/modal/default.hbs +18 -0
  18. data/app/assets/javascripts/bootybox/templates/modal/modal_target.hbs +1 -0
  19. data/app/assets/javascripts/bootybox/templates/portfolio/portfolio_item.hbs +4 -0
  20. data/app/assets/javascripts/bootybox/vendor/flip.js +298 -0
  21. data/app/assets/stylesheets/bootybox/_elements.scss +54 -0
  22. data/app/assets/stylesheets/bootybox/_fixes.scss +22 -0
  23. data/app/assets/stylesheets/bootybox/_navi.scss +4 -0
  24. data/app/assets/stylesheets/bootybox/_portfolio.scss +37 -0
  25. data/app/assets/stylesheets/bootybox/_slides.scss +41 -0
  26. data/app/assets/stylesheets/bootybox/defaults.scss +7 -0
  27. data/app/assets/templates/framework.scss +50 -0
  28. data/app/helpers/bootybox_content_helper.rb +44 -0
  29. data/app/helpers/bootybox_form_helper.rb +39 -0
  30. data/app/helpers/bootybox_grid_helper.rb +112 -0
  31. data/app/services/bootybox/elements_config_service.rb +21 -0
  32. data/app/services/bootybox/navigational_context_pages_service.rb +15 -0
  33. data/app/services/bootybox/page_layout_config_service.rb +4 -0
  34. data/app/views/alchemy/elements/_contactform_editor.html.erb +6 -0
  35. data/app/views/alchemy/elements/_contactform_view.html.erb +48 -0
  36. data/app/views/alchemy/elements/bootybox/defaults/_button_editor.html.erb +8 -0
  37. data/app/views/alchemy/elements/bootybox/defaults/_button_view.html.erb +5 -0
  38. data/app/views/alchemy/elements/bootybox/defaults/_default_image_editor.html.erb +5 -0
  39. data/app/views/alchemy/elements/bootybox/defaults/_default_image_view.html.erb +8 -0
  40. data/app/views/alchemy/elements/bootybox/defaults/_default_textbox_editor.html.erb +5 -0
  41. data/app/views/alchemy/elements/bootybox/defaults/_default_textbox_view.html.erb +7 -0
  42. data/app/views/alchemy/elements/bootybox/defaults/_subheader_editor.html.erb +8 -0
  43. data/app/views/alchemy/elements/bootybox/defaults/_subheader_view.html.erb +10 -0
  44. data/app/views/alchemy/elements/bootybox/fancy/_flip_content_box_editor.html.erb +17 -0
  45. data/app/views/alchemy/elements/bootybox/fancy/_flip_content_box_view.html.erb +19 -0
  46. data/app/views/alchemy/elements/bootybox/grid/_four_columns_25_25_25_25_editor.html.haml +2 -0
  47. data/app/views/alchemy/elements/bootybox/grid/_four_columns_25_25_25_25_view.html.haml +10 -0
  48. data/app/views/alchemy/elements/bootybox/grid/_one_column_100_editor.html.haml +2 -0
  49. data/app/views/alchemy/elements/bootybox/grid/_one_column_100_view.html.haml +5 -0
  50. data/app/views/alchemy/elements/bootybox/grid/_three_columns_33_33_33_editor.html.haml +2 -0
  51. data/app/views/alchemy/elements/bootybox/grid/_three_columns_33_33_33_view.html.haml +8 -0
  52. data/app/views/alchemy/elements/bootybox/grid/_two_columns_25_75_editor.html.haml +2 -0
  53. data/app/views/alchemy/elements/bootybox/grid/_two_columns_25_75_view.html.haml +6 -0
  54. data/app/views/alchemy/elements/bootybox/grid/_two_columns_50_50_editor.html.haml +2 -0
  55. data/app/views/alchemy/elements/bootybox/grid/_two_columns_50_50_view.html.haml +6 -0
  56. data/app/views/alchemy/elements/bootybox/grid/_two_columns_66_33_editor.html.haml +3 -0
  57. data/app/views/alchemy/elements/bootybox/grid/_two_columns_66_33_view.html.haml +6 -0
  58. data/app/views/alchemy/elements/bootybox/grid/_two_columns_75_25_editor.html.haml +3 -0
  59. data/app/views/alchemy/elements/bootybox/grid/_two_columns_75_25_view.html.haml +6 -0
  60. data/app/views/alchemy/elements/bootybox/layout/_element_container_editor.html.erb +4 -0
  61. data/app/views/alchemy/elements/bootybox/layout/_element_container_view.html.erb +8 -0
  62. data/app/views/alchemy/elements/bootybox/layout/_page_header_editor.html.erb +3 -0
  63. data/app/views/alchemy/elements/bootybox/layout/_page_header_view.html.erb +6 -0
  64. data/app/views/alchemy/elements/bootybox/layout/_seperator_editor.html.erb +4 -0
  65. data/app/views/alchemy/elements/bootybox/layout/_seperator_view.html.erb +4 -0
  66. data/app/views/alchemy/elements/bootybox/navi/_sub_navi_container_editor.html.erb +3 -0
  67. data/app/views/alchemy/elements/bootybox/navi/_sub_navi_container_view.html.erb +5 -0
  68. data/app/views/alchemy/elements/bootybox/navi/_sub_navi_item_editor.html.erb +4 -0
  69. data/app/views/alchemy/elements/bootybox/navi/_sub_navi_item_view.html.erb +3 -0
  70. data/app/views/alchemy/elements/bootybox/portfolio/_portfolio_container_editor.html.erb +8 -0
  71. data/app/views/alchemy/elements/bootybox/portfolio/_portfolio_container_view.html.erb +12 -0
  72. data/app/views/alchemy/elements/bootybox/portfolio/_portfolio_item_editor.html.erb +7 -0
  73. data/app/views/alchemy/elements/bootybox/portfolio/_portfolio_item_view.html.erb +13 -0
  74. data/app/views/alchemy/elements/bootybox/slideshow/_image_slideshow_editor.html.erb +3 -0
  75. data/app/views/alchemy/elements/bootybox/slideshow/_image_slideshow_slide_editor.html.erb +4 -0
  76. data/app/views/alchemy/elements/bootybox/slideshow/_image_slideshow_slide_view.html.erb +4 -0
  77. data/app/views/alchemy/elements/bootybox/slideshow/_image_slideshow_view.html.erb +37 -0
  78. data/app/views/alchemy/elements/bootybox/slideshow_top/_slideshow_slide_container_editor.html.erb +4 -0
  79. data/app/views/alchemy/elements/bootybox/slideshow_top/_slideshow_slide_container_view.html.erb +10 -0
  80. data/app/views/alchemy/elements/bootybox/slideshow_top/_slideshow_slide_top_editor.html.erb +10 -0
  81. data/app/views/alchemy/elements/bootybox/slideshow_top/_slideshow_slide_top_view.html.erb +26 -0
  82. data/app/views/alchemy/elements/bootybox/slideshow_top/_slideshow_teaser_top_editor.html.erb +4 -0
  83. data/app/views/alchemy/elements/bootybox/slideshow_top/_slideshow_teaser_top_view.html.erb +28 -0
  84. data/app/views/alchemy/page_layouts/_default.html.erb +4 -0
  85. data/app/views/bootybox/forms/_form_group_container.html.erb +12 -0
  86. data/app/views/bootybox/forms/_form_group_input.html.erb +14 -0
  87. data/app/views/bootybox/forms/_form_group_select.html.erb +2 -0
  88. data/app/views/layouts/_footer.html.erb +5 -0
  89. data/app/views/layouts/_navigation.html.erb +32 -0
  90. data/app/views/layouts/_navigational_footer.html.erb +19 -0
  91. data/app/views/layouts/application.html.erb +42 -0
  92. data/config/elements.yml +274 -0
  93. data/config/locales/bootybox.de.yml +54 -0
  94. data/lib/bootybox.rb +19 -0
  95. data/lib/bootybox/engine.rb +41 -0
  96. data/lib/generators/bootybox/views/application_layout_generator.rb +20 -0
  97. data/lib/tasks/bootybox.rake +88 -0
  98. metadata +224 -0
@@ -0,0 +1,54 @@
1
+ .text {
2
+ &.teaser {
3
+ font-family: serif;
4
+ text-align: center; font-size: 1.8em;
5
+ color: #333; font-style: italic;
6
+ }
7
+ &.metainfo { color: #666;}
8
+ }
9
+
10
+ .image {
11
+ img { width: 100%;}
12
+ &.no-margin {
13
+ margin-bottom: 0 !important; margin-top: 0 !important;
14
+ img { margin-bottom: 0 !important; margin-top: 0 !important; }
15
+ }
16
+ }
17
+
18
+ .seperator-line {
19
+ height: 1px; width: 100%; border-top: solid 1px #666;
20
+
21
+ &.sep-invisible {border-top: none;}
22
+ &.sep-small {margin: 1em 0;}
23
+ &.sep-medium {margin: 2em 0;}
24
+ &.sep-large {margin: 3em 0;}
25
+
26
+ }
27
+
28
+ .image_slideshow .carousel {
29
+ border-bottom: solid 1px #ddd;
30
+ margin-bottom: 10px;
31
+ }
32
+
33
+
34
+ @mixin clearfix {
35
+ &:after {
36
+ content: ".";
37
+ clear: both;
38
+ display: block;
39
+ visibility: hidden;
40
+ height: 0px;
41
+ }
42
+ }
43
+
44
+
45
+ .equal {
46
+ display: flex;
47
+ flex-wrap: wrap;
48
+ width: 100%;
49
+ }
50
+
51
+ .equal > div[class*='col-'] {
52
+ display: flex;
53
+ flex-direction: column;
54
+ }
@@ -0,0 +1,22 @@
1
+ @import "bootstrap/variables";
2
+
3
+ @media (max-width: $screen-xs-max) {
4
+ .col-xs-4 { width: 33%; }
5
+ .col-xs-6 { width: 49.9%; }
6
+ }
7
+
8
+
9
+ @media (min-width: $screen-sm-min) and (max-width: $screen-sm-max) {
10
+ .col-sm-4 { width: 33%; }
11
+ .col-sm-6 { width: 49.9%; }
12
+ }
13
+
14
+ @media (min-width: $screen-md-min) and (max-width: $screen-md-max) {
15
+ .col-md-4 { width: 33%; }
16
+ .col-md-6 { width: 49.9%; }
17
+ }
18
+
19
+ @media (min-width: $screen-lg-min) {
20
+ .col-lg-4 { width: 33%; }
21
+ .col-lg-6 { width: 49.9%; }
22
+ }
@@ -0,0 +1,4 @@
1
+ .main-sub-navi {
2
+ text-align: center;
3
+ li.subnavi-item { display: inline-block; padding: 6px 24px;}
4
+ }
@@ -0,0 +1,37 @@
1
+ .bootybox-portfolio {
2
+
3
+ margin: 0 auto;
4
+
5
+ &.portfolio-vert .portfolio-item img { width: 100%;}
6
+ &.portfolio-horiz .portfolio-item img { width: auto;}
7
+
8
+ ul {vertical-align: top; padding: 0; position: relative ;}
9
+
10
+ .portfolio-item {
11
+ border: solid 1px #aaa; padding: 10px; list-style: none; display: inline-block; cursor: pointer;
12
+ img { opacity: .6;}
13
+
14
+ .name { position: absolute; padding: 3px; background: rgba(255,255,255,0.9); display: none; border-radius: 5px; text-align: center;
15
+ max-width: 50%;
16
+ }
17
+
18
+ .text { display:none;}
19
+ }
20
+
21
+ .portfolio-item:hover {
22
+ border: solid 1px #666;
23
+ img { opacity: 1;}
24
+ }
25
+
26
+ &.portfolio-vert .portfolio-item {
27
+ position: absolute; opacity: 0;
28
+ }
29
+
30
+ &.portfolio-horiz .portfolio-item {
31
+ margin-bottom: 5px;
32
+ }
33
+ }
34
+
35
+ .portfolio-modal-item {
36
+ img {width: 100%;}
37
+ }
@@ -0,0 +1,41 @@
1
+ // Adding default styles for slideshows
2
+ // Dimensions should be adjustest in the projects styles..
3
+ #top-slideshow {
4
+
5
+ width: 100%;
6
+
7
+ .carousel { position: relative; }
8
+ .carousel-inner { overflow: initial; }
9
+
10
+ ul.carousel-inner, li.item { padding: 0px; }
11
+ li.item {
12
+ background-size: cover !important;
13
+ background-position: center !important;
14
+ a.slideshow-link { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 20;}
15
+ }
16
+
17
+ .slide-textbox {
18
+ .panel-heading {
19
+ &>h2 { text-transform: uppercase; }
20
+ }
21
+ .panel-body {
22
+ margin-top: 0px;
23
+ padding-top: 0px;
24
+ position: relative;
25
+
26
+ h1, h2, h3, h4, h5, h6 { font-size: 16px; font-weight: bold; }
27
+ }
28
+ .slide-text-content { overflow: hidden; }
29
+
30
+ .panel-footer { background: none; border-top: none; padding-top: 20px; padding-bottom: 0px; }
31
+ .pricing { font-size: 14px; }
32
+ }
33
+ }
34
+
35
+
36
+ .slideshow-preview-pics {
37
+ li {
38
+ list-style: none;
39
+ display: inline-block;
40
+ }
41
+ }
@@ -0,0 +1,7 @@
1
+ @import "_slides";
2
+ @import "_elements";
3
+ @import "_portfolio";
4
+ @import "_navi";
5
+ @import "_fixes";
6
+
7
+
@@ -0,0 +1,50 @@
1
+ // Core variables and mixins
2
+ @import "bootstrap/variables";
3
+
4
+ // Overwrite the gutter for custom width if required
5
+ // $grid-gutter-width: 50px;
6
+
7
+
8
+ @import "bootstrap/mixins";
9
+ // Reset and dependencies
10
+ @import "bootstrap/normalize";
11
+ @import "bootstrap/print";
12
+ @import "bootstrap/glyphicons";
13
+ // Core CSS
14
+ @import "bootstrap/scaffolding";
15
+ @import "bootstrap/type";
16
+ @import "bootstrap/code";
17
+ @import "bootstrap/grid";
18
+ @import "bootstrap/tables";
19
+ @import "bootstrap/forms";
20
+ @import "bootstrap/buttons";
21
+ // Components
22
+ @import "bootstrap/component-animations";
23
+ @import "bootstrap/dropdowns";
24
+ @import "bootstrap/button-groups";
25
+ @import "bootstrap/input-groups";
26
+ @import "bootstrap/navs";
27
+ @import "bootstrap/navbar";
28
+ @import "bootstrap/breadcrumbs";
29
+ @import "bootstrap/pagination";
30
+ @import "bootstrap/pager";
31
+ @import "bootstrap/labels";
32
+ @import "bootstrap/badges";
33
+ @import "bootstrap/jumbotron";
34
+ @import "bootstrap/thumbnails";
35
+ @import "bootstrap/alerts";
36
+ @import "bootstrap/progress-bars";
37
+ @import "bootstrap/media";
38
+ @import "bootstrap/list-group";
39
+ @import "bootstrap/panels";
40
+ @import "bootstrap/responsive-embed";
41
+ @import "bootstrap/wells";
42
+ @import "bootstrap/close";
43
+ // Components w/ JavaScript
44
+ @import "bootstrap/modals";
45
+ @import "bootstrap/tooltip";
46
+ @import "bootstrap/popovers";
47
+ @import "bootstrap/carousel";
48
+ // Utility classes
49
+ @import "bootstrap/utilities";
50
+ @import "bootstrap/responsive-utilities";
@@ -0,0 +1,44 @@
1
+ module BootyboxContentHelper
2
+
3
+
4
+ def icon(css)
5
+ content_tag :span, " ".html_safe, :class => "bb-icon #{css}"
6
+ end
7
+
8
+ def glyphicon(name)
9
+ content_tag :span, " ".html_safe, :class => "glyphicon glyphicon-#{name}"
10
+ end
11
+
12
+ def slideshow_top_slide_wrapper(sub_el, options = {tag: :li})
13
+ sub_el.sub_element_index == 0 ? item_active_class = "active" : item_active_class = ""
14
+
15
+ element_view_for(sub_el, :tag => nil) do |el|
16
+ content_tag options[:tag], :class => "item #{item_active_class}",
17
+ :style => "background: url('#{asset_path(sub_el.content_by_name(:image, :preview => session[:page_preview_mode]).essence.picture_url(:size => el.render(:image_format).strip, :crop => true))}') left top no-repeat; background-size: 100%",
18
+ :title => "#{sub_el.content_by_name(:image, :preview => session[:page_preview_mode]).essence.alt_content}" do
19
+
20
+ yield
21
+
22
+ end
23
+ end
24
+ end
25
+
26
+ def content_wrapper_row
27
+ content_tag :div, id:'page-wrapper', class: 'content-wrapper-row' do
28
+ yield
29
+ end
30
+ end
31
+
32
+ def row(options={})
33
+ content_tag :div, class: ['row', options[:class]].join(' ') do
34
+ yield
35
+ end
36
+ end
37
+
38
+ def seperator
39
+ "<hr></hr>".html_safe
40
+ end
41
+
42
+
43
+
44
+ end
@@ -0,0 +1,39 @@
1
+ module BootyboxFormHelper
2
+
3
+
4
+ # TODO: Convert this into a form helper that works with form_for etc...
5
+
6
+ def form_input_field(form, method, options = {})
7
+
8
+ if options[:validation].blank?
9
+ options[:validation] = []
10
+ end
11
+
12
+ options[:type] ||= :text_field
13
+
14
+ render :partial => "/bootybox/forms/form_group_input", :locals => {
15
+ :form => form, :method => method,
16
+ :label_text => options[:label] || I18n.t(method.to_s, :scope => :form_labels),
17
+ :value => (options[:value] || (form.object.send(method) rescue nil) ),
18
+ :validation => options[:validation], :title => options[:title], :type => options[:type],
19
+ :tooltip => options[:tooltip]
20
+ }
21
+ end
22
+
23
+ def form_group_container(form, method, options = {}, &block)
24
+ render "/bootybox/forms/form_group_container", :form => form, :method => method,
25
+ :id => options[:id].to_s, :css_class => options[:class], :label_text => options[:label] || I18n.t(method.to_s, :scope => :form_labels),
26
+ :content => capture(&block)
27
+ end
28
+
29
+ def form_select_field(form, method, options = {})
30
+
31
+ options[:collection] ||= []
32
+
33
+ render :partial => "/bootybox/forms/form_group_select", :locals => {
34
+ :form => form, :method => method, :label_text => options[:label] || I18n.t(method.to_s, :scope => :form_labels),
35
+ :value => options[:value], :title => options[:title], :collection => options[:collection]
36
+ }
37
+ end
38
+
39
+ end
@@ -0,0 +1,112 @@
1
+ module BootyboxGridHelper
2
+
3
+ def col(w={:lg => 4}, title ="col", options = {}, &block)
4
+ # fallback for old syntax
5
+ if title.is_a?(Hash)
6
+ options = title
7
+ title = options[:title]
8
+ end
9
+
10
+ col_css = [column_classes(w, options[:mode], options[:framework]).strip, options[:class].try(:strip), 'is-bootybox-col'].compact.join(" ")
11
+
12
+ if options[:header] != true
13
+ content_tag(:div, :class => col_css) do
14
+ capture(&block)
15
+ end
16
+ else
17
+ options[:color] ||= "dark-blue"
18
+
19
+ content = options[:inner_content] == true ? content_tag(:div, raw(capture(&block)), :class => "inner-content-body") : capture(&block)
20
+
21
+ html_content = content_tag(:header, content_tag(:h3, title), :class => options[:color])
22
+ html_content += content_tag(:div, raw(content), :class => "content-body")
23
+
24
+ content_tag(:div, :class => col_css) do
25
+ content_tag(:section, :class => "content-box") do
26
+ raw(html_content)
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ def column_classes(w ={:lg => 4}, mode = nil, framework = nil )
33
+
34
+ default = case (framework || Bootybox.configuration.css_framework.to_sym)
35
+ when :bootstrap
36
+ :lg
37
+ when :foundation
38
+ :large
39
+ end
40
+
41
+ # auto-determine settings if no framework given
42
+ if framework.nil?
43
+ settings = convert_col_settings!(w, framework)
44
+ else
45
+ settings = w
46
+ end
47
+
48
+ column_key_values.each do |v|
49
+ if !settings[v.to_sym]
50
+ settings[v.to_sym] = settings[default]
51
+ end
52
+ end
53
+
54
+ col_css = case (framework || Bootybox.configuration.css_framework.to_sym)
55
+ when :bootstrap
56
+ [""]
57
+ when :foundation
58
+ ["columns"]
59
+ end
60
+
61
+ settings.each do |c,s|
62
+ c = "col-#{c}" if (framework == :bootstrap || Bootybox.configuration.css_framework.to_sym == :bootstrap)
63
+ col_css << [c, mode, s].compact.join("-")
64
+ end
65
+
66
+ return col_css.join(" ")
67
+ end
68
+
69
+ private
70
+
71
+ def convert_col_settings!(settings = {}, framework = nil)
72
+ setting_keys = settings.keys.map(&:to_s)
73
+
74
+ current_given_framework = if framework.present?
75
+ framework
76
+ elsif (setting_keys - column_key_values(:bootstrap)).empty?
77
+ :bootstrap
78
+ elsif (setting_keys - column_key_values(:foundation)).empty?
79
+ :foundation
80
+ end
81
+
82
+ if current_given_framework != Bootybox.configuration.css_framework
83
+ case current_given_framework
84
+ when :foundation
85
+ return {
86
+ large: settings[:lg],
87
+ medium: settings[:md],
88
+ small: (settings[:sm] || settings[:xs]),
89
+ }
90
+ when :bootstrap
91
+ return {
92
+ lg: settings[:large],
93
+ md: settings[:medium],
94
+ sm: settings[:small],
95
+ xs: settings[:small],
96
+ }
97
+ end
98
+ else
99
+ settings
100
+ end
101
+ end
102
+
103
+ def column_key_values(framework = nil)
104
+ case framework || Bootybox.configuration.css_framework.to_sym
105
+ when :bootstrap
106
+ %w(lg md sm xs)
107
+ when :foundation
108
+ %w(small medium large)
109
+ end
110
+ end
111
+
112
+ end
@@ -0,0 +1,21 @@
1
+ # This class does all things related to elements and the config file
2
+ class Bootybox::ElementsConfigService
3
+
4
+ def target_element_file
5
+ File.join(Rails.root, "config/alchemy/elements.yml")
6
+ end
7
+
8
+
9
+ def source_elements_file
10
+ File.expand_path("../../../../config/elements.yml", __FILE__)
11
+ end
12
+
13
+ def source_elements_data
14
+ YAML::load(File.open(source_elements_file).read)
15
+ end
16
+
17
+ def source_elements_name
18
+ source_elements_data.map {|s| s['name'] }
19
+ end
20
+
21
+ end
@@ -0,0 +1,15 @@
1
+ class Bootybox::NavigationalContextPagesService
2
+
3
+ ALLOWED_NAVIGATION_LINKS = [:parent, :previous, :next]
4
+
5
+ def self.get(page, nav_type = :parent)
6
+ raise "Wrong navigational type '#{nav_type.inspect}' use #{ALLOWED_NAVIGATION_LINKS.inspect}" if ALLOWED_NAVIGATION_LINKS.index(nav_type).nil?
7
+ nav_page = page.send(nav_type)
8
+ if nav_page && !nav_page.link_container && nav_page.public && nav_page.urlname.present?
9
+ return nav_page
10
+ else
11
+ return nil
12
+ end
13
+ end
14
+
15
+ end