tkh_content 0.1.9.2 → 0.1.9.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
 
4
4
 
5
+ ## 0.1.9.3
6
+
7
+ * Modified labels in contact_us form partial
8
+ * Improved styling and display for the show view of content pages and blog posts
9
+ * Added a new datetime locale format
10
+ * Administrators get an 'edit' button in the meta info of blog posts
11
+ * Added indices to page model
12
+ * Pages have a menu_position attribute and can easily be reordered in combination with the tkh_menus gem
13
+
14
+
5
15
  ## 0.1.9.1 & 0.1.9.2
6
16
 
7
17
  * Debugging
@@ -74,4 +74,11 @@ class PagesController < ApplicationController
74
74
  redirect_to pages_path notice: "The blog status of the page has been changed"
75
75
  end
76
76
 
77
+ def sort
78
+ params[:page].each_with_index do |id, index|
79
+ Page.update_all({ menu_position: index+1 }, { id: id })
80
+ end
81
+ render nothing: true
82
+ end
83
+
77
84
  end
@@ -1,6 +1,6 @@
1
1
  module PagesHelper
2
2
  def tkhed(content)
3
- content = content.gsub /\(-: contact_us_form :-\)/, render('contacts/form') if content.match(/(-: contact_us_form :-)/)
3
+ content = content.gsub /\(-: contact_us_form :-\)/, render('contacts/form') if content.match(/\(-: contact_us_form :-\)/)
4
4
  content
5
5
  end
6
6
  end
data/app/models/page.rb CHANGED
@@ -32,6 +32,7 @@ class Page < ActiveRecord::Base
32
32
  scope :orphans, where('parent_id IS ?', nil)
33
33
  scope :with_parent_id, lambda { |id| where('parent_id = ?', id) }
34
34
  scope :by_title, order('title')
35
+ scope :by_menu_position, order('menu_position')
35
36
 
36
37
  def nickname
37
38
  short_title || title
@@ -1,13 +1,10 @@
1
- <% content_for :meta_title, 'Home' %>
2
-
3
- <% unless @posts.blank? %>
4
- <% for post in @posts %>
5
- <div class="individual-post">
6
- <h1><%= link_to post.title, post %></h1>
7
- <p class="meta-info">by <%= post.author.name %> on <%= l post.published_at, format: :default %> | <%= link_to 'Permalink.', post %></p>
8
- <%= raw post.body %>
9
- </div>
10
- <% end %>
1
+ <% content_for :meta_title, Setting.first.blog_name %>
2
+ <%= content_for :meta_description, "#{Setting.first.blog_tagline} - #{Setting.first.company_name}: the official blog" %>
3
+
4
+
5
+ <% for post in @posts %>
6
+ <%= render '/pages/individual_blog_post_in_list', post: post %>
11
7
  <% end %>
12
8
 
9
+
13
10
  <%= will_paginate @posts %>
@@ -2,9 +2,9 @@
2
2
  <%= f.error_notification %>
3
3
 
4
4
  <div class="form-inputs">
5
- <%= f.input :sender_name %>
6
- <%= f.input :sender_email %>
7
- <%= f.input :body, :input_html => { :rows => 10 } %>
5
+ <%= f.input :sender_name, label: 'your name' %>
6
+ <%= f.input :sender_email, label: 'your email' %>
7
+ <%= f.input :body, label: 'your message', :input_html => { :rows => 10 } %>
8
8
  </div>
9
9
 
10
10
  <div class="form-actions">
@@ -0,0 +1,4 @@
1
+ <p class="meta-info">
2
+ by <%= post.author.name %> on <%= l post.published_at, format: :tkh_default %> | <%= link_to 'Permalink', post %>
3
+ <%="| #{link_to 'edit', edit_page_path(post), class: 'btn btn-mini'}".html_safe if administrator? %>
4
+ </p>
@@ -0,0 +1,5 @@
1
+ <div class="individual-post">
2
+ <h1><%= link_to post.title, post %></h1>
3
+ <%= render '/pages/blog_post_meta', post: post %>
4
+ <%= raw post.body %>
5
+ </div>
@@ -1,12 +1,17 @@
1
1
  <% content_for :meta_title, @page.title %>
2
2
  <% content_for :meta_description, @page.description %>
3
3
 
4
- <%= content_tag(:h1, @page.title) if @page.for_blog? %>
4
+ <% unless @page.for_blog? %>
5
5
 
6
- <%= raw tkhed(@page.body) %>
6
+ <%= raw tkhed(@page.body) %>
7
7
 
8
- <!-- remove this once DSL has been created -->
9
- <%# = render 'contacts/form' if params[:id].to_i == 5 %>
8
+ <% else %>
9
+
10
+ <%= content_tag(:h1, @page.title) %>
11
+ <%= render '/pages/blog_post_meta', post: @page %>
12
+ <%= raw tkhed(@page.body) %>
13
+
14
+ <% end -%>
10
15
 
11
16
  <%# partial in tkh_menus gem or has to be added in host app %>
12
17
  <%= render './shared/menus' %>
data/config/routes.rb CHANGED
@@ -6,6 +6,9 @@ Rails.application.routes.draw do
6
6
  post :unpublish
7
7
  post :toggle_for_blog
8
8
  end
9
+ collection do
10
+ post :sort
11
+ end
9
12
  end
10
13
  get 'blog' => 'blog#index', as: :blog
11
14
  get 'tags/:tag', to: 'blog#index', as: :tag
@@ -1,5 +1,11 @@
1
1
  de:
2
2
 
3
+ time:
4
+ formats:
5
+ # eventually this should be abstracted to a tkh_utilities gem together with all
6
+ # standard helpers and functionality
7
+ tkh_default: '%A, %d. %B %Y, %H:%M Uhr'
8
+
3
9
  are_you_sure: 'Bist Du sicher?'
4
10
  delete: 'löschen'
5
11
  edit: 'bearbeiten'
@@ -1,5 +1,11 @@
1
1
  en:
2
2
 
3
+ time:
4
+ formats:
5
+ # eventually this should be abstracted to a tkh_utilities gem together with all
6
+ # standard helpers and functionality
7
+ tkh_default: "%b. %-d, '%y at %l:%M %P"
8
+
3
9
  activerecord:
4
10
  attributes:
5
11
  pages:
@@ -1,5 +1,11 @@
1
1
  es:
2
2
 
3
+ time:
4
+ formats:
5
+ # eventually this should be abstracted to a tkh_utilities gem together with all
6
+ # standard helpers and functionality
7
+ tkh_default: "%d de %B de %Y %H:%M"
8
+
3
9
  are_you_sure: '¿estás seguro?'
4
10
  delete: 'borrar'
5
11
  edit: 'editar'
@@ -1,5 +1,11 @@
1
1
  fr:
2
2
 
3
+ time:
4
+ formats:
5
+ # eventually this should be abstracted to a tkh_utilities gem together with all
6
+ # standard helpers and functionality
7
+ tkh_default: "%d %b %Y à %H:%M"
8
+
3
9
  are_you_sure: 'êtes vous sûr ?'
4
10
  delete: 'supprimer'
5
11
  edit: 'modifier'
@@ -23,6 +23,7 @@ module TkhContent
23
23
  migration_template "create_tags.rb", "db/migrate/create_tags.rb"
24
24
  migration_template "create_taggings.rb", "db/migrate/create_taggings.rb"
25
25
  migration_template "create_contacts.rb", "db/migrate/create_contacts.rb"
26
+ migration_template "add_various_indices_to_pages.rb", "db/migrate/add_various_indices_to_pages.rb"
26
27
  end
27
28
 
28
29
  end
@@ -0,0 +1,14 @@
1
+ class AddVariousIndicesToPages < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ add_index :pages, :updated_at
5
+ add_index :pages, :for_blog
6
+ add_index :pages, :title
7
+ end
8
+
9
+ def self.down
10
+ remove_index :pages, :updated_at
11
+ remove_index :pages, :for_blog
12
+ remove_index :pages, :title
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module TkhContent
2
- VERSION = "0.1.9.2"
2
+ VERSION = "0.1.9.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tkh_content
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9.2
4
+ version: 0.1.9.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-04 00:00:00.000000000 Z
12
+ date: 2013-01-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -161,7 +161,9 @@ files:
161
161
  - app/views/contact_mailer/message_from_contact_form.text.erb
162
162
  - app/views/contacts/_form.html.erb
163
163
  - app/views/contacts/index.html.erb
164
+ - app/views/pages/_blog_post_meta.html.erb
164
165
  - app/views/pages/_form.html.erb
166
+ - app/views/pages/_individual_blog_post_in_list.html.erb
165
167
  - app/views/pages/edit.html.erb
166
168
  - app/views/pages/index.html.erb
167
169
  - app/views/pages/new.html.erb
@@ -178,6 +180,7 @@ files:
178
180
  - lib/generators/tkh_content/create_or_update_migrations/create_or_update_migrations_generator.rb
179
181
  - lib/generators/tkh_content/create_or_update_migrations/templates/add_author_to_pages.rb
180
182
  - lib/generators/tkh_content/create_or_update_migrations/templates/add_parent_id_to_pages.rb
183
+ - lib/generators/tkh_content/create_or_update_migrations/templates/add_various_indices_to_pages.rb
181
184
  - lib/generators/tkh_content/create_or_update_migrations/templates/create_contacts.rb
182
185
  - lib/generators/tkh_content/create_or_update_migrations/templates/create_pages.rb
183
186
  - lib/generators/tkh_content/create_or_update_migrations/templates/create_taggings.rb
@@ -233,7 +236,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
233
236
  version: '0'
234
237
  segments:
235
238
  - 0
236
- hash: -1015600408546556615
239
+ hash: -3837185877085223117
237
240
  required_rubygems_version: !ruby/object:Gem::Requirement
238
241
  none: false
239
242
  requirements:
@@ -242,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
245
  version: '0'
243
246
  segments:
244
247
  - 0
245
- hash: -1015600408546556615
248
+ hash: -3837185877085223117
246
249
  requirements: []
247
250
  rubyforge_project:
248
251
  rubygems_version: 1.8.23