Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: Kangaru/prima-rewal
base: b9736f665c
...
head fork: Kangaru/prima-rewal
compare: 565f9b9d59
Checking mergeability… Don't worry, you can still create the pull request.
  • 7 commits
  • 17 files changed
  • 0 commit comments
  • 1 contributor
View
27 app/assets/stylesheets/application/layout/footer.css.sass
@@ -39,4 +39,29 @@ footer
.fb-like-box
float: left
- margin-left: 100px
+
+ .menu-list
+ padding-top: 58px
+ font-size: 12px
+ position: absolute
+ list-style-type: none
+ margin: 0
+
+ li
+ float: left
+ padding-left: 15px
+
+ &:first-child
+ padding-left: 0px
+
+ a
+ color: #fff
+ text-shadow: 1px 1px 0px #509ab0
+ filter: dropshadow(color=#509ab0, offx=1, offy=1)
+
+ &:hover
+ color: #00BFFF
+ text-decoration: underline
+
+
View
101 app/assets/stylesheets/application/layout/header.css.sass
@@ -5,69 +5,68 @@
background: url('layout/header.png') center center
-.brand
- @include link-as-image('layout/logo.png')
+ .brand
+ @include link-as-image('layout/logo.png')
- float: left
- width: 150px
- height: 150px
-
-
-.right-side
- float: left
- width: 630
+ float: left
+ width: 150px
+ height: 150px
-.language-choose
- @include header-box
+ .right-side
+ float: left
+ width: 630
- width: 80px
- margin-left: 590px
-.kite-prima
- @include header-box
- width: 80px
- float: left
- margin-left: 470px
+ .language-choose
+ @include header-box
- a
- @include link-as-image('layout/kite-prima.png')
- height: 26px
width: 80px
- margin: 0 auto
-
+ margin-left: 590px
-.menu-list
- $menu-height: 48px
+ .kite-prima
+ @include header-box
+ width: 80px
+ float: left
+ margin-left: 470px
- @include header-box-background
- @include rounded-corners(3px, 3px, 3px, 3px)
- @include header-box-shadow
+ a
+ @include link-as-image('layout/kite-prima.png')
+ height: 26px
+ width: 80px
+ margin: 0 auto
- height: $menu-height
- list-style: none
- display: block
- float: right
- margin-top: 45px
+ .menu-list
+ $menu-height: 48px
- li
- @include hover-active
+ @include header-box-background
+ @include rounded-corners(3px, 3px, 3px, 3px)
+ @include header-box-shadow
+ height: $menu-height
+ list-style: none
display: block
- float: left
- border-right: 1px solid #c5c5c5
- font-size: 11px
- font-weight: bold
+ float: right
+ margin-top: 45px
- a
- display: block
- height: $menu-height
- line-height: $menu-height
- padding: 0 20px
- color: #585858
-
- &:first-child
- @include rounded-corners(3px, 0, 0, 3px)
+ li
+ @include hover-active
- &:last-child
- @include rounded-corners(0, 3px, 3px, 0)
+ float: left
+ border-right: 1px solid #c5c5c5
+ font-size: 11px
+ font-weight: bold
+
+ a
+ display: block
+ height: $menu-height
+ line-height: $menu-height
+ padding: 0 20px
+ color: #585858
+
+ &:first-child
+ @include rounded-corners(3px, 0, 0, 3px)
+
+ &:last-child
+ @include rounded-corners(0, 3px, 3px, 0)
View
2  app/cells/menu/display.html.haml
@@ -1,4 +1,4 @@
%ul.menu-list
= menu_link @main_page, main_page_path
- @flatpages.each_with_index do |flatpage|
- = menu_link flatpage, flatpage_path(flatpage)
+ = menu_link flatpage, flatpage_url(flatpage), title: "Apartamenty Rewal - #{flatpage.title}"
View
2  app/helpers/application_helper.rb
@@ -1,6 +1,6 @@
module ApplicationHelper
def main_page_path
- root_path i18n_locale: params[:i18n_locale]
+ root_url i18n_locale: params[:i18n_locale]
end
end
View
2  app/models/flatpage.rb
@@ -1,7 +1,7 @@
class Flatpage < ActiveRecord::Base
acts_as_list
- translates :title, :content
+ translates :title, :content, :meta_title, :meta_description, :meta_keywords
globalize_accessors
accepts_nested_attributes_for :translations
View
2  app/models/flatpage/translation.rb
@@ -1,4 +1,6 @@
class Flatpage::Translation < Globalize::ActiveRecord::Translation
validates :title, presence: true, length: { minimum: 3, allow_blank: true }
validates :content, presence: true, length: { minimum: 10, allow_blank: true }
+
+ validates_presence_of :meta_title, :meta_description, :meta_keywords
end
View
5 app/views/admin/flatpages/_form.html.haml
@@ -13,6 +13,11 @@
= tf.input :content, as: :text
= tf.input :locale, as: :hidden
+ = tf.inputs "SEO (#{tf.object.locale})" do
+ = tf.input :meta_title
+ = tf.input :meta_description
+ = tf.input :meta_keywords
+
= f.actions
:javascript
View
4 app/views/flatpages/show.html.haml
@@ -1,2 +1,6 @@
+- content_for :meta_title, @flatpage.meta_title
+- content_for :meta_description, @flatpage.meta_description
+- content_for :meta_keywords, @flatpage.meta_keywords
+
- present @flatpage do |flatpage|
= flatpage.content
View
12 app/views/layouts/application.html.erb
@@ -2,9 +2,11 @@
<html lang="<%= I18n.locale %>">
<head>
<meta charset="utf-8">
- <title>Prima Rewal</title>
- <meta name="description" content="">
- <meta name="author" content="">
+ <title><%= yield(:meta_title).presence || "Apartamenty Rewal :: Domki Rewal" %></title>
+
+ <meta name="description" content="<%= yield(:meta_description).presence || "Apartamenty Rewal :: Domki Rewal" %>">
+ <meta name='keywords' content="<%= yield(:meta_keywords).presence || 'apartamenty, domki, apartamenty Rewal, domki Rewal, apartamenty w rewalu' %>">
+ <meta name="author" content="Kangaru.pl">
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
@@ -26,7 +28,7 @@
<body>
<div class="header-container">
<div class="container">
- <%= link_to 'Prima Rewal', main_page_path, class: :brand %>
+ <%= link_to 'Apartamenty Rewal', main_page_path, class: :brand, title: 'Apartamenty Rewal' %>
<div class="right-side">
<div class="kite-prima">
<%= link_to 'kitePrima', 'http://kiteprima.pl', target: :_blank %>
@@ -56,6 +58,8 @@
Copyright &copy; Prima <%= Time.now.year %>. All rights reserved.
</p>
+ <%= render_cell :menu, :display %>
+
<h2>W Rewalu jest Prima!</h2>
</div>
</footer>
View
4 config/locales/vendor/formtastic/flatpage/flatpage.pl.yml
@@ -4,6 +4,10 @@ pl:
flatpage:
title: Tytuł
content: Treść
+
+ meta_title: Tytuł strony
+ meta_description: Opis
+ meta_keywords: Słowa kluczowe
hints:
flatpage:
title: 'Dla tytułu "Witaj świecie!" adres będzie wygladał - "witaj-swiecie"'
View
7 db/migrate/20120405225010_add_meta_fields_to_flatpage.rb
@@ -0,0 +1,7 @@
+class AddMetaFieldsToFlatpage < ActiveRecord::Migration
+ def change
+ add_column :flatpage_translations, :meta_title, :string
+ add_column :flatpage_translations, :meta_description, :string
+ add_column :flatpage_translations, :meta_keywords, :string
+ end
+end
View
9 db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120223124953) do
+ActiveRecord::Schema.define(:version => 20120405225010) do
create_table "active_admin_comments", :force => true do |t|
t.integer "resource_id", :null => false
@@ -33,8 +33,11 @@
t.string "locale"
t.string "title"
t.text "content"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "meta_title"
+ t.string "meta_description"
+ t.string "meta_keywords"
end
add_index "flatpage_translations", ["flatpage_id"], :name => "index_flatpage_translations_on_flatpage_id"
View
20 spec/cells/menu_cell_spec.rb
@@ -1,15 +1,15 @@
require 'spec_helper'
describe MenuCell do
- context "cell rendering" do
-
+ context "cell rendering" do
+
context "rendering display" do
it 'should render menu link to root path' do
Flatpage.should_receive(:for_menu).and_return [mock_model(Flatpage, title: 'Lorem ipsum')]
cell = render_cell :menu, :display
- cell.should have_selector 'ul.menu-list li a[href="/"]'
+ cell.should have_selector 'ul.menu-list li a[href="http://test.host/"]'
end
it 'should render menu link to few flatpages' do
@@ -18,18 +18,18 @@
cell = render_cell :menu, :display
- cell.should have_selector 'a[href="/"]'
- cell.should have_selector "a[href='#{flatpage_path(flatpages.last)}']", text: 'Ipsum'
+ cell.should have_selector 'a[href="http://test.host/"]'
+ cell.should have_selector "a[href='#{flatpage_url(flatpages.last)}']", text: 'Ipsum'
end
end
-
+
end
- context "cell instance" do
- subject { cell(:menu) }
-
+ context "cell instance" do
+ subject { cell(:menu) }
+
it { should respond_to(:display) }
-
+
end
end
View
10 spec/factories/flatpages.rb
@@ -4,12 +4,22 @@
factory :flatpage do
title_pl pl.title
content_pl pl.content
+ meta_title_pl pl.meta_title
+ meta_description_pl pl.meta_description
+ meta_keywords_pl pl.meta_keywords
+
title_en en.title
content_en en.content
+ meta_title_en en.meta_title
+ meta_description_en en.meta_description
+ meta_keywords_en en.meta_keywords
title_de de.title
content_de de.content
+ meta_title_de de.meta_title
+ meta_description_de de.meta_description
+ meta_keywords_de de.meta_keywords
position 1
end
View
4 spec/models/flatpage/translation_spec.rb
@@ -7,6 +7,10 @@
it { should validate_presence_of :content }
it { should ensure_length_of(:content).is_at_least(10) }
+ it { should validate_presence_of :meta_title }
+ it { should validate_presence_of :meta_description }
+ it { should validate_presence_of :meta_keywords }
+
it 'should inherit from Globalize::ActiveRecord::Translation' do
Flatpage::Translation.superclass.should be(Globalize::ActiveRecord::Translation)
end
View
4 spec/requests/admin/flatpages_spec.rb
@@ -38,6 +38,10 @@
within "div#lang-#{locale}" do
fill_in "Title", with: flatpage.title
fill_in "Content", with: flatpage.content
+
+ fill_in 'Meta title', with: flatpage.meta_title
+ fill_in 'Meta description', with: flatpage.meta_description
+ fill_in 'Meta keywords', with: flatpage.meta_keywords
end
end
View
9 spec/support/requests/flatpage.rb
@@ -4,5 +4,12 @@ def flatpage(locale)
title = "Lorem ipsum #{locale}"
content = "#{locale} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nisl mi, accumsan eu varius ac, facilisis in justo. Cras ipsum."
- OpenStruct.new({title: title, content: content})
+ meta_title = "Meta title #{locale}"
+ meta_description = "Meta description #{locale}"
+ meta_keywords = "Meta keywords #{locale}"
+
+ OpenStruct.new({
+ title: title, content: content,
+ meta_title: meta_title, meta_description: meta_description, meta_keywords: meta_keywords
+ })
end

No commit comments for this range

Something went wrong with that request. Please try again.