tkh_content 0.0.2 → 0.0.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,11 @@
2
2
 
3
3
 
4
4
 
5
+ ## 0.0.3
6
+
7
+ * The blog layout file is being copied to the host app during install or update
8
+ * The pages show route does not show controller name
9
+
5
10
 
6
11
  ## 0.0.2
7
12
 
@@ -35,7 +35,7 @@ class PagesController < ApplicationController
35
35
  def update
36
36
  @page = Page.find(params[:id])
37
37
  if @page.update_attributes(params[:page])
38
- redirect_to @page, notice: t('pages.update.notice')
38
+ redirect_to url_for(action: :show, id: @page), notice: t('pages.update.notice')
39
39
  else
40
40
  render action: "edit", warning: t('pages.update.warning'), layout: 'admin'
41
41
  end
@@ -13,7 +13,7 @@
13
13
  <tbody>
14
14
  <% @pages.each do |page| %>
15
15
  <tr>
16
- <td><%= link_to page.title, page_path(page) %></td>
16
+ <td><%= link_to page.title, page.to_param %></td>
17
17
  <td><%= truncate page.description, length: 55, separator: ' ...' %></td>
18
18
  <td><%= page.for_blog? ? '✓' : 'X' %></td>
19
19
  <td><%= link_to t('edit'), edit_page_path(page), class: 'btn btn-mini' %>
@@ -1,4 +1,6 @@
1
1
  <% @meta_title = @page.title %>
2
2
  <% @meta_description = @page.description %>
3
3
 
4
+ <h1><%= @page.title %></h1>
5
+
4
6
  <%= raw @page.body %>
data/config/routes.rb CHANGED
@@ -1,5 +1,11 @@
1
1
  Rails.application.routes.draw do
2
2
  scope "(:locale)", locale: /#{I18n.available_locales.join("|")}/ do
3
- resources :pages
3
+ resources :pages, except: :show
4
+ # this is a bit funky
5
+ # in order to show pages without the controller name
6
+ # this line should be at the end of the routes file
7
+ # nothing to do when in context of tkh_cms
8
+ # working on this.
9
+ resources :pages, only: :show, path: ''
4
10
  end
5
11
  end
@@ -0,0 +1,14 @@
1
+ module TkhContent
2
+ module Generators
3
+ class CreateOrUpdateFilesGenerator < ::Rails::Generators::Base
4
+ source_root File.expand_path('../templates', __FILE__)
5
+ desc "copying blog layout"
6
+ def copy_files
7
+ puts 'creating blog layout'
8
+ I18n.available_locales.each do |l|
9
+ copy_file "blog.html.erb", "app/views/layouts/blog.html.erb"
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,7 +1,15 @@
1
1
  namespace :tkh_content do
2
- desc "Create migrations and locale files"
2
+ desc "Create migrations, locale, and other files"
3
3
  task :install do
4
4
  system 'rails g tkh_content:create_migration'
5
- system 'rails g tkh_content:create_or_update_locales'
5
+ system 'rails g tkh_content:create_or_update_locales -f'
6
+ system 'rails g tkh_content:create_or_update_files -f'
7
+ end
8
+
9
+ desc "Update files. Skip existing migrations and blog layout. Force overwrite locales"
10
+ task :update do
11
+ system 'rails g tkh_content:create_migration -s'
12
+ system 'rails g tkh_content:create_or_update_locales -f'
13
+ system 'rails g tkh_content:create_or_update_files -s'
6
14
  end
7
15
  end
@@ -1,3 +1,3 @@
1
1
  module TkhContent
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.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.0.2
4
+ version: 0.0.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: 2012-08-03 00:00:00.000000000 Z
12
+ date: 2012-08-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -100,7 +100,6 @@ extra_rdoc_files: []
100
100
  files:
101
101
  - app/controllers/pages_controller.rb
102
102
  - app/models/page.rb
103
- - app/views/layouts/blog.html.erb
104
103
  - app/views/pages/_form.html.erb
105
104
  - app/views/pages/edit.html.erb
106
105
  - app/views/pages/index.html.erb
@@ -110,6 +109,8 @@ files:
110
109
  - config/routes.rb
111
110
  - lib/generators/tkh_content/create_migration/create_migration_generator.rb
112
111
  - lib/generators/tkh_content/create_migration/templates/create_pages.rb
112
+ - lib/generators/tkh_content/create_or_update_files/create_or_update_files_generator.rb
113
+ - lib/generators/tkh_content/create_or_update_files/templates/blog.html.erb
113
114
  - lib/generators/tkh_content/create_or_update_locales/create_or_update_locales_generator.rb
114
115
  - lib/generators/tkh_content/create_or_update_locales/templates/en.yml
115
116
  - lib/generators/tkh_content/create_or_update_locales/templates/es.yml
@@ -165,7 +166,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
166
  version: '0'
166
167
  segments:
167
168
  - 0
168
- hash: -4206250643872968901
169
+ hash: -2978963987227375249
169
170
  required_rubygems_version: !ruby/object:Gem::Requirement
170
171
  none: false
171
172
  requirements:
@@ -174,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
175
  version: '0'
175
176
  segments:
176
177
  - 0
177
- hash: -4206250643872968901
178
+ hash: -2978963987227375249
178
179
  requirements: []
179
180
  rubyforge_project:
180
181
  rubygems_version: 1.8.23