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 +5 -0
- data/app/controllers/pages_controller.rb +1 -1
- data/app/views/pages/index.html.erb +1 -1
- data/app/views/pages/show.html.erb +2 -0
- data/config/routes.rb +7 -1
- data/lib/generators/tkh_content/create_or_update_files/create_or_update_files_generator.rb +14 -0
- data/{app/views/layouts → lib/generators/tkh_content/create_or_update_files/templates}/blog.html.erb +0 -0
- data/lib/tasks/tkh_content_tasks.rake +10 -2
- data/lib/tkh_content/version.rb +1 -1
- metadata +6 -5
data/CHANGELOG.md
CHANGED
@@ -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,
|
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' %>
|
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
|
data/{app/views/layouts → lib/generators/tkh_content/create_or_update_files/templates}/blog.html.erb
RENAMED
File without changes
|
@@ -1,7 +1,15 @@
|
|
1
1
|
namespace :tkh_content do
|
2
|
-
desc "Create migrations and
|
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
|
data/lib/tkh_content/version.rb
CHANGED
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.
|
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-
|
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: -
|
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: -
|
178
|
+
hash: -2978963987227375249
|
178
179
|
requirements: []
|
179
180
|
rubyforge_project:
|
180
181
|
rubygems_version: 1.8.23
|