Skip to content

Instantly share code, notes, and snippets.

@SylarRuby
Last active August 5, 2016 18:51
Show Gist options
  • Save SylarRuby/1379e5d3bf90e36da844546815add03d to your computer and use it in GitHub Desktop.
Save SylarRuby/1379e5d3bf90e36da844546815add03d to your computer and use it in GitHub Desktop.
Custom Faq page for Spree Store
<%# app/views/custom/_custom_application.html.erb %>
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="ie ie6" lang="<%= I18n.locale %>"> <![endif]-->
<!--[if IE 7 ]> <html class="ie ie7" lang="<%= I18n.locale %>"> <![endif]-->
<!--[if IE 8 ]> <html class="ie ie8" lang="<%= I18n.locale %>"> <![endif]-->
<!--[if IE 9 ]> <html class="ie ie9" lang="<%= I18n.locale %>"> <![endif]-->
<!--[if gt IE 9]><!--><html lang="<%= I18n.locale %>"><!--<![endif]-->
<html>
<head data-hook="inside_head">
<%= favicon_link_tag 'favicon.ico' %>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="My custom spree store">
<title><%= content_for?(:title) ? yield(:title) : "My title" %></title>
<%= stylesheet_link_tag 'application', media: 'all' %>
<%= javascript_include_tag 'application' %>
<%= javascript_include_tag 'spree/frontend/all' %>
<%= csrf_meta_tags %>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6/html5shiv.min.js"></script>
<![endif]-->
</head>
<body>
<%#
#
# Custom navbars. Up to you to have it.
#
%>
<%= render partial: 'nav/nav' %>
<%= render partial: 'nav/nav_below' %>
<div class="row">
<div class="container">
<% flash.each do | name, message | %>
<%= content_tag :div, class: "alert alert-#{name} alert-dismissible fade in", :data => { :role => 'alert' } do -%>
<%= message %>
<button class="close" data-dismiss="alert" type="button" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<% end -%>
<% end -%>
</div>
</div>
<%#
#
# Noticed I do not have my yield nor footer inside the class container; my preference.
# Do what you want, though
%>
<%= yield %>
<%= render partial: 'footer/footer' %>
</body>
</html>
<%# app/views/layouts/application.html.erb %>
<%= render partial: '/custom/custom_application' %>
<%# views/pages/faq.html.erb %>
<%= link_to "Faq", main_app.faq_path, class: "some_class" %>
<h1> My FAQ</h1>
# app/controller/pages_controller.rb %>
class PagesController < ApplicationController
def faq
#...
end
end
Rails.application.routes.draw do
mount Spree::Core::Engine, at: '/'
get '/faq' => 'pages#faq', as: 'faq'
end
<%# app/views/spree/layouts/spree_application.html.erb %>
<%= render partial: '/custom/custom_application' %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment