Skip to content

Commit

Permalink
added sub headings
Browse files Browse the repository at this point in the history
  • Loading branch information
kc7rwx committed Mar 21, 2012
1 parent d769fb7 commit f4eb011
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 20 deletions.
Binary file added ERD.pdf
Binary file not shown.
20 changes: 1 addition & 19 deletions app/overrides/add_banner_to_header.rb
@@ -1,22 +1,4 @@
Deface::Override.new(:virtual_path => 'spree/layouts/spree_application',
:name => 'add_banner_to_header',
:insert_after => '#nav-bar',
:text => "<%= render :partial => 'shared/banner'%>")

Deface::Override.new(:virtual_path => 'spree/static_content/show',
:name => 'remove_title_from_page',
:remove => 'h1')

Deface::Override.new(:virtual_path => 'spree/static_content/show',
:name => 'insert_page_title_for_static_content',
:insert_after => '#page_content',
:text => "<% content_for :banner do %>
<h1><%= @page.title %></h1>
<% end %>")

Deface::Override.new(:virtual_path => 'spree/products/index',
:name => 'insert_page_title_for_products_index',
:insert_after => "[data-hook='homepage_products']",
:text => "<% content_for :banner do %>
<h1>Products</h1>
<% end %>")
:text => "<%= render :partial => 'shared/banner'%>")
16 changes: 16 additions & 0 deletions app/overrides/add_sub_heading_field_to_admin.rb
@@ -0,0 +1,16 @@
Deface::Override.new(:virtual_path => 'spree/admin/pages/_form',
:name => 'add_sub_heading_to_admin_pages',
:insert_before => "code[erb-loud]:contains('f.field_container :slug')",
:text => "<%= f.field_container :sub_heading do %>
<%= f.label :sub_heading, t(:sub_heading) %> <br />
<%= f.text_field :sub_heading, :class => 'fullwidth title' %>
<%= f.error_message_on :title %>
<% end %>")
Deface::Override.new(:virtual_path => 'spree/admin/products/_form',
:name => 'add_sub_heading_to_admin_products',
:insert_before => "code[erb-loud]:contains('f.field_container :permalink')",
:text => "<%= f.field_container :sub_heading do %>
<%= f.label :sub_heading, t(:sub_heading) %> <br />
<%= f.text_field :sub_heading, :class => 'fullwidth title' %>
<%= f.error_message_on :title %>
<% end %>")
13 changes: 13 additions & 0 deletions app/overrides/products_banner.rb
@@ -0,0 +1,13 @@
Deface::Override.new(:virtual_path => 'spree/products/index',
:name => 'insert_page_title_for_products_index',
:insert_before => "[data-hook='homepage_products']",
:text => "<%= render 'shared/banner_content', :heading => 'Products', :sub_heading => 'Take a look at the goods' %>")

Deface::Override.new(:virtual_path => 'spree/products/show',
:name => 'insert_page_title_for_products_show',
:insert_before => "[data-hook='product_show']",
:text => "<%= render 'shared/banner_content', :heading => @product.name, :sub_heading => @product.sub_heading %>")

Deface::Override.new(:virtual_path => 'spree/products/show',
:name => 'remove_title_from_product'
:remove => '.product-title')
8 changes: 8 additions & 0 deletions app/overrides/static_pages_banner.rb
@@ -0,0 +1,8 @@
Deface::Override.new(:virtual_path => 'spree/static_content/show',
:name => 'remove_title_from_page',
:remove => 'h1')

Deface::Override.new(:virtual_path => 'spree/static_content/show',
:name => 'insert_page_title_for_static_content',
:insert_after => '#page_content',
:text => "<%= render 'shared/banner_content', :heading => @page.title, :sub_heading => @page.sub_heading %>")
3 changes: 3 additions & 0 deletions app/views/shared/_banner_content.html.erb
@@ -0,0 +1,3 @@
<% content_for :banner do %>
<h2><%= heading %> - <%= sub_heading%></h2>
<% end %>
5 changes: 5 additions & 0 deletions db/migrate/20120321030256_add_subheading_to_spree_pages.rb
@@ -0,0 +1,5 @@
class AddSubheadingToSpreePages < ActiveRecord::Migration
def change
add_column :spree_pages, :sub_heading, :string
end
end
@@ -0,0 +1,5 @@
class AddSubHeadingToSpreeProducts < ActiveRecord::Migration
def change
add_column :spree_products, :sub_heading, :string
end
end
4 changes: 3 additions & 1 deletion db/schema.rb
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20120219020344) do
ActiveRecord::Schema.define(:version => 20120321033730) do

create_table "spree_activators", :force => true do |t|
t.string "description"
Expand Down Expand Up @@ -249,6 +249,7 @@
t.string "layout"
t.boolean "show_in_sidebar", :default => false, :null => false
t.string "meta_title"
t.string "sub_heading"
end

add_index "spree_pages", ["slug"], :name => "index_pages_on_slug"
Expand Down Expand Up @@ -353,6 +354,7 @@
t.datetime "created_at"
t.datetime "updated_at"
t.integer "count_on_hand", :default => 0, :null => false
t.string "sub_heading"
end

add_index "spree_products", ["available_on"], :name => "index_products_on_available_on"
Expand Down

0 comments on commit f4eb011

Please sign in to comment.