add theme1 with subnavigation first setup kind of ugly layout
This commit is contained in:
@@ -94,6 +94,10 @@ body
|
|||||||
margin: 0
|
margin: 0
|
||||||
padding: 0
|
padding: 0
|
||||||
margin-bottom: 12px
|
margin-bottom: 12px
|
||||||
|
&.with-subnavigation
|
||||||
|
.container
|
||||||
|
.main-inner
|
||||||
|
margin: 0
|
||||||
a
|
a
|
||||||
color: $green
|
color: $green
|
||||||
text-decoration: none
|
text-decoration: none
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ $green: #7BB459 //Heineken
|
|||||||
$header-color: #AE571F
|
$header-color: #AE571F
|
||||||
$text-color: #333
|
$text-color: #333
|
||||||
$font-family-content: Georgia, serif
|
$font-family-content: Georgia, serif
|
||||||
|
$active-color: #fc3
|
||||||
@import font-awesome
|
@import font-awesome
|
||||||
@import ./mixins
|
@import ./mixins
|
||||||
@import ./foundation_and_overrides
|
@import ./foundation_and_overrides
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
#page-subnavigation
|
||||||
|
ul
|
||||||
|
list-style: none
|
||||||
|
background-color: white
|
||||||
|
margin: 0
|
||||||
|
li
|
||||||
|
padding-left: 14px
|
||||||
|
&.subpage
|
||||||
|
a
|
||||||
|
&:before
|
||||||
|
content: " - "
|
||||||
|
&.current
|
||||||
|
padding-left: 8px
|
||||||
|
padding-bottom: 10px
|
||||||
|
border-bottom: 2px solid #667
|
||||||
|
margin-bottom: 10px
|
||||||
|
a
|
||||||
|
color: $active-color
|
||||||
|
&.ancestor
|
||||||
|
padding-left: 3px
|
||||||
@@ -36,10 +36,14 @@ private
|
|||||||
end
|
end
|
||||||
|
|
||||||
def go_to_page_path(record, locale: I18n.locale)
|
def go_to_page_path(record, locale: I18n.locale)
|
||||||
str = case record
|
case record
|
||||||
when Page then record.name
|
when Page
|
||||||
else record
|
str = record.name
|
||||||
|
locale = record.locale
|
||||||
|
else
|
||||||
|
str = record
|
||||||
end
|
end
|
||||||
|
locale ||= I18n.locale
|
||||||
main_app.page_path(str, locale: locale)
|
main_app.page_path(str, locale: locale)
|
||||||
end
|
end
|
||||||
helper_method :go_to_page_path
|
helper_method :go_to_page_path
|
||||||
|
|||||||
@@ -221,4 +221,35 @@ module ApplicationHelper
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# used for rendering page trees
|
||||||
|
def tree_ul(acts_as_tree_set, options = {}, &block)
|
||||||
|
# If only one option is given, a select is assumed
|
||||||
|
options = {:select => options} unless options.is_a?(Hash)
|
||||||
|
# Ensure a select option
|
||||||
|
options[:select] ||= lambda{|p| true}
|
||||||
|
options[:select] = options[:select].to_proc if options[:select].is_a?(Symbol)
|
||||||
|
block ||= lambda{|item| item.name }
|
||||||
|
acts_as_tree_set.reject!{|m| not options[:select].call(m)}
|
||||||
|
ret = ''
|
||||||
|
if acts_as_tree_set.size > 0
|
||||||
|
if list_id = options.delete(:list_id).presence
|
||||||
|
ret = %|<ul id="#{list_id}">|
|
||||||
|
else
|
||||||
|
ret = "<ul>"
|
||||||
|
end
|
||||||
|
acts_as_tree_set.collect do |item|
|
||||||
|
#next if item.parent_id && init
|
||||||
|
ret += '<li>'
|
||||||
|
ret += capture(item, &block)
|
||||||
|
#tmp = tree_ul(item.children, checker, &block) if item.children.size > 0
|
||||||
|
#return "#{tmp} is no valid result\n\n" unless tmp.is_a?(String)
|
||||||
|
#ret += tmp
|
||||||
|
ret += tree_ul(item.children, options, &block) if item.children.size > 0
|
||||||
|
ret += '</li>'
|
||||||
|
end
|
||||||
|
ret += '</ul>'
|
||||||
|
end
|
||||||
|
ret.html_safe
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ class Page
|
|||||||
include Cmtool::Includes::Page
|
include Cmtool::Includes::Page
|
||||||
include ActiveModel::SerializerSupport
|
include ActiveModel::SerializerSupport
|
||||||
def self.layouts
|
def self.layouts
|
||||||
%w[theme1 theme1-home]
|
%w[theme1 theme1-home theme1-with-subnavigation]
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.suppliers_page(name, locale: :en)
|
def self.suppliers_page(name, locale: :en)
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
doctype html
|
||||||
|
html lang=I18n.locale
|
||||||
|
head
|
||||||
|
title= site_page_title
|
||||||
|
= render 'meta'
|
||||||
|
= csrf_meta_tags
|
||||||
|
/! Le HTML5 shim, for IE6-8 support of HTML elements
|
||||||
|
/[if lt IE 9]
|
||||||
|
= javascript_include_tag "http://html5shim.googlecode.com/svn/trunk/html5.js"
|
||||||
|
= stylesheet_link_tag "theme1/application", :media => "all"
|
||||||
|
link href="/favicon.ico" rel="shortcut icon"
|
||||||
|
link href='http://fonts.googleapis.com/css?family=Pacifico' rel='stylesheet' type='text/css'
|
||||||
|
|
||||||
|
body
|
||||||
|
.header-nav-banner
|
||||||
|
= render 'theme1/header'
|
||||||
|
#content-header.show-for-large-up
|
||||||
|
.left
|
||||||
|
.right
|
||||||
|
.container
|
||||||
|
.top-ribbon
|
||||||
|
#main-wrap.with-subnavigation
|
||||||
|
.container
|
||||||
|
.row
|
||||||
|
.small-12.medium-4.large-3.columns
|
||||||
|
#page-subnavigation= render "theme1/sub_navigation"
|
||||||
|
.small-12.medium-8.large-9.columns.main-inner
|
||||||
|
= render 'theme1/alerts'
|
||||||
|
- if @page && @page.title.present?
|
||||||
|
h1.page-title= @page.title
|
||||||
|
= yield
|
||||||
|
= render 'theme1/footer'
|
||||||
|
= javascript_include_tag "theme1/application"
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
ul
|
||||||
|
- for ancestor in @page.ancestors
|
||||||
|
li.ancestor= link_to ancestor.menu_text.presence || ancestor.title, go_to_page_path(ancestor)
|
||||||
|
/li.current[class=(@sub_pages.present? ? :ancestor : nil)]= link_to @page.menu_text.presence || @page.title, go_to_page_path(@page)
|
||||||
|
- for sub_page in @sub_pages || []
|
||||||
|
li[ class=(sub_page == @page ? [:current, :subpage] : [:subpage])]= link_to sub_page.menu_text.presence || sub_page.title, go_to_page_path(sub_page)
|
||||||
Reference in New Issue
Block a user