tkh_content 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/app/assets/javascripts/pages.js.coffee +3 -1
- data/app/controllers/comments_controller.rb +20 -12
- data/app/controllers/contacts_controller.rb +16 -11
- data/app/controllers/pages_controller.rb +27 -14
- data/app/helpers/pages_helper.rb +2 -0
- data/app/models/comment.rb +14 -17
- data/app/models/contact.rb +6 -8
- data/app/models/page.rb +30 -32
- data/app/models/tag.rb +11 -13
- data/app/views/pages/_form.html.erb +8 -9
- data/app/views/pages/_new_comment_section.html.erb +3 -3
- data/app/views/pages/_tab_admin_menu.html.erb +4 -2
- data/app/views/pages/edit.html.erb +0 -2
- data/app/views/pages/index.html.erb +14 -12
- data/app/views/pages/new.html.erb +0 -2
- data/lib/tkh_content/version.rb +1 -1
- data/lib/tkh_content.rb +3 -4
- metadata +33 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e327b5dcab57aa6cf9cd716eb3494b6afd95827a
|
4
|
+
data.tar.gz: a2996c313dec26737fc2ae43059306267d17f819
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 373a6a843e3f9c056c1a1c6266e3ca9d4979590531920200885e9d67f171fb7e8cd51f31d977ece1da302cb8cc831900ad03cccad1870f30f5391e02043f6a1e
|
7
|
+
data.tar.gz: 7ede317f6ed7af64bd6441ab60fe6cad3218cd6c57364b1866945fd76123a4d06b56e782081e4b2a3557cfcf7854d80c688bd14844ea1c24b86bd33fa587f21f
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,25 @@
|
|
1
1
|
# TKH Content
|
2
2
|
|
3
3
|
|
4
|
+
|
5
|
+
|
6
|
+
## 0.9.2
|
7
|
+
|
8
|
+
* Fixes and tweaks related to the update to Rails 4
|
9
|
+
* Connected gem to tkh_authentication partial in comment area
|
10
|
+
* Updated many gems/dependencies
|
11
|
+
|
12
|
+
|
4
13
|
## 0.9
|
5
14
|
|
6
15
|
* Upgraded to Ruby 2.0 and Rails 4
|
7
16
|
|
8
17
|
|
18
|
+
## 0.4.6
|
19
|
+
|
20
|
+
* Added a dynamic content variable for upcoming events list
|
21
|
+
|
22
|
+
|
9
23
|
## 0.4.5
|
10
24
|
|
11
25
|
* Configured CKEditor so that it does not override classes and other bits of HTML code created by the user in the source.
|
@@ -1,23 +1,23 @@
|
|
1
1
|
class CommentsController < ApplicationController
|
2
|
-
|
2
|
+
|
3
3
|
before_filter :authenticate, :except => ['for_feed']
|
4
4
|
before_filter :authenticate_with_admin, :except => ['create', 'for_feed']
|
5
|
-
|
5
|
+
|
6
6
|
def index
|
7
7
|
@comments = Comment.by_recent.paginate(:page => params[:page], :per_page => 50)
|
8
8
|
switch_to_admin_layout
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
# comments are shown within a page
|
12
12
|
# new comments are created by users from within a page
|
13
13
|
|
14
14
|
def edit
|
15
|
-
@comment = Comment.find
|
15
|
+
@comment = Comment.find(params[:id])
|
16
16
|
switch_to_admin_layout
|
17
17
|
end
|
18
18
|
|
19
19
|
def create
|
20
|
-
@comment = Comment.new
|
20
|
+
@comment = Comment.new(comment_params)
|
21
21
|
@comment.author_id = current_user.id
|
22
22
|
@comment.locale = I18n.locale.to_s
|
23
23
|
@comment.status = 'pending' # translation not done with globalize3 but with locale files upon showing status to user
|
@@ -30,7 +30,7 @@ class CommentsController < ApplicationController
|
|
30
30
|
|
31
31
|
def update
|
32
32
|
@comment = Comment.find(params[:id])
|
33
|
-
if @comment.update_attributes(
|
33
|
+
if @comment.update_attributes(comment_params)
|
34
34
|
redirect_to comments_path, notice: t('comments.update.notice')
|
35
35
|
else
|
36
36
|
render action: "edit", warning: t('comments.update.warning'), layout: 'admin'
|
@@ -42,7 +42,7 @@ class CommentsController < ApplicationController
|
|
42
42
|
@comment.destroy
|
43
43
|
redirect_to comments_url, notice: t('comments.destroy.notice')
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
def accept
|
47
47
|
@comment = Comment.find params[:id]
|
48
48
|
@comment.status = 'accepted'
|
@@ -52,7 +52,7 @@ class CommentsController < ApplicationController
|
|
52
52
|
redirect_to comments_path, warning: t('comments.moderation.accept.warning')
|
53
53
|
end
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
def block
|
57
57
|
@comment = Comment.find params[:id]
|
58
58
|
@comment.status = 'blocked'
|
@@ -62,12 +62,12 @@ class CommentsController < ApplicationController
|
|
62
62
|
redirect_to comments_path, warning: t('comments.moderation.block.warning')
|
63
63
|
end
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
def pending
|
67
67
|
@comments = Comment.pending.by_created.paginate(:page => params[:page], :per_page => 50)
|
68
68
|
switch_to_admin_layout
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
def accepted
|
72
72
|
@comments = Comment.accepted.by_recent.paginate(:page => params[:page], :per_page => 50)
|
73
73
|
switch_to_admin_layout
|
@@ -77,7 +77,7 @@ class CommentsController < ApplicationController
|
|
77
77
|
@comments = Comment.blocked.by_recent.paginate(:page => params[:page], :per_page => 50)
|
78
78
|
switch_to_admin_layout
|
79
79
|
end
|
80
|
-
|
80
|
+
|
81
81
|
def for_feed
|
82
82
|
@comments = Comment.showable.for_locale(I18n.locale).by_recently_created.limit(50)
|
83
83
|
respond_to do |format|
|
@@ -85,5 +85,13 @@ class CommentsController < ApplicationController
|
|
85
85
|
format.atom
|
86
86
|
end
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
|
+
private
|
90
|
+
|
91
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
92
|
+
def comment_params
|
93
|
+
params.require(:comment).permit(:body, :page_id)
|
94
|
+
# non-accessible attributes: author_id, :status, :locale
|
95
|
+
end
|
96
|
+
|
89
97
|
end
|
@@ -1,23 +1,23 @@
|
|
1
1
|
class ContactsController < ApplicationController
|
2
|
-
|
2
|
+
|
3
3
|
before_filter :authenticate, :except => 'create'
|
4
4
|
before_filter :authenticate_with_admin, :except => 'create'
|
5
|
-
|
5
|
+
|
6
6
|
def index
|
7
7
|
@contacts = Contact.by_recent.paginate(:page => params[:page], :per_page => 35)
|
8
8
|
switch_to_admin_layout
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def show
|
12
12
|
@contact = Contact.find(params[:id])
|
13
13
|
switch_to_admin_layout
|
14
14
|
end
|
15
15
|
|
16
16
|
def create
|
17
|
-
@contact = Contact.new(
|
17
|
+
@contact = Contact.new(contact_params)
|
18
18
|
saved = @contact.save
|
19
19
|
sent_email = send_message_to_admin(@contact)
|
20
|
-
|
20
|
+
|
21
21
|
if saved && sent_email == 'success'
|
22
22
|
redirect_to root_path, notice: t("contacts.create.notice")
|
23
23
|
elsif saved && sent_email == 'exception'
|
@@ -31,17 +31,17 @@ class ContactsController < ApplicationController
|
|
31
31
|
redirect_to :back
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def valid_email?(string)
|
36
36
|
(!string.blank? && string =~ /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i) ? true : false
|
37
37
|
end
|
38
38
|
# helper_method :valid_email?
|
39
|
-
|
39
|
+
|
40
40
|
private
|
41
|
-
|
41
|
+
|
42
42
|
def send_message_to_admin(contact)
|
43
43
|
# check email validity
|
44
|
-
if valid_email?(contact.sender_email)
|
44
|
+
if valid_email?(contact.sender_email)
|
45
45
|
# Actually send the email to the student
|
46
46
|
begin
|
47
47
|
ContactMailer.message_from_contact_form(contact).deliver
|
@@ -55,6 +55,11 @@ class ContactsController < ApplicationController
|
|
55
55
|
return 'invalid'
|
56
56
|
end
|
57
57
|
end
|
58
|
-
|
59
|
-
|
58
|
+
|
59
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
60
|
+
def contact_params
|
61
|
+
params.require(:contact).permit(:sender_name, :sender_email, :body)
|
62
|
+
end
|
63
|
+
|
64
|
+
|
60
65
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class PagesController < ApplicationController
|
2
|
-
|
2
|
+
|
3
3
|
before_filter :authenticate, :except => 'show'
|
4
4
|
before_filter :authenticate_with_admin, :except => 'show'
|
5
|
-
|
5
|
+
|
6
6
|
def index
|
7
7
|
@pages = Page.by_recent.paginate(:page => params[:page], :per_page => 35)
|
8
8
|
switch_to_admin_layout
|
@@ -24,18 +24,18 @@ class PagesController < ApplicationController
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def create
|
27
|
-
@page = Page.new(
|
27
|
+
@page = Page.new(page_params)
|
28
28
|
@page.author_id = current_user.id
|
29
29
|
if @page.save
|
30
30
|
redirect_to @page, notice: t('pages.create.notice')
|
31
31
|
else
|
32
|
-
render action: "new",
|
32
|
+
render action: "new", flash: { error: t('pages.create.warning') }, layout: 'admin'
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
def update
|
37
37
|
@page = Page.find(params[:id])
|
38
|
-
if @page.update_attributes(
|
38
|
+
if @page.update_attributes(page_params)
|
39
39
|
redirect_to @page, notice: t('pages.update.notice')
|
40
40
|
else
|
41
41
|
render action: "edit", warning: t('pages.update.warning'), layout: 'admin'
|
@@ -52,33 +52,46 @@ class PagesController < ApplicationController
|
|
52
52
|
redirect_to ( :back || pages_url )
|
53
53
|
end
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
def publish
|
57
57
|
page = Page.find(params[:id])
|
58
58
|
page.published_at = Time.now
|
59
|
-
page.save
|
60
|
-
|
59
|
+
if page.save
|
60
|
+
redirect_to pages_path, notice: t('pages.status.changed.published')
|
61
|
+
else
|
62
|
+
redirect_to :back, :flash => { :error => 'There was a problem while publishing this page.' }
|
63
|
+
end
|
61
64
|
end
|
62
|
-
|
65
|
+
|
63
66
|
def unpublish
|
64
67
|
page = Page.find(params[:id])
|
65
68
|
page.published_at = nil
|
66
|
-
page.save
|
67
|
-
|
69
|
+
if page.save
|
70
|
+
redirect_to pages_path, notice: t('pages.status.changed.unpublished')
|
71
|
+
else
|
72
|
+
redirect_to :back, :flash => { :error => 'There was a problem while unpublishing this page.' }
|
73
|
+
end
|
68
74
|
end
|
69
|
-
|
75
|
+
|
70
76
|
def toggle_for_blog
|
71
77
|
page = Page.find(params[:id])
|
72
78
|
page.for_blog? ? page.for_blog = false : page.for_blog = true
|
73
79
|
page.save
|
74
80
|
redirect_to pages_path notice: t('pages.status.changed.toggled')
|
75
81
|
end
|
76
|
-
|
82
|
+
|
77
83
|
def sort
|
78
84
|
params[:page].each_with_index do |id, index|
|
79
85
|
Page.update_all({ menu_position: index+1 }, { id: id })
|
80
86
|
end
|
81
87
|
render nothing: true
|
82
88
|
end
|
83
|
-
|
89
|
+
|
90
|
+
private
|
91
|
+
|
92
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
93
|
+
def page_params
|
94
|
+
params.require(:page).permit(:title, :short_title, :description, :body, :for_blog, :parent_id, :tag_list, :parent_page_title, :author_name)
|
95
|
+
end
|
96
|
+
|
84
97
|
end
|
data/app/helpers/pages_helper.rb
CHANGED
@@ -3,6 +3,8 @@ module PagesHelper
|
|
3
3
|
content = content.gsub /\(-: contact_us_form :-\)/, render('contacts/form') if content.match(/\(-: contact_us_form :-\)/)
|
4
4
|
# from what will be the tkh_yoga_center_gem
|
5
5
|
content = content.gsub /\(-: dropin_class_schedule :-\)/, render('dropin_classes/schedule') if content.match(/\(-: dropin_class_schedule :-\)/)
|
6
|
+
# from what will be the tkh_upcoming_events_gem
|
7
|
+
content = content.gsub /\(-: upcoming_events_list :-\)/, render('events/upcoming_events_list') if content.match(/\(-: upcoming_events_list :-\)/)
|
6
8
|
content
|
7
9
|
end
|
8
10
|
end
|
data/app/models/comment.rb
CHANGED
@@ -1,25 +1,22 @@
|
|
1
1
|
# this is needed for now to make mass assignment security compatible with the translation of globalize3
|
2
|
-
Globalize::ActiveRecord::Translation.class_eval do
|
3
|
-
|
4
|
-
end
|
2
|
+
# Globalize::ActiveRecord::Translation.class_eval do
|
3
|
+
# attr_accessible :locale
|
4
|
+
# end
|
5
5
|
|
6
6
|
class Comment < ActiveRecord::Base
|
7
|
-
|
7
|
+
|
8
8
|
belongs_to :author, class_name: 'User', foreign_key: 'author_id'
|
9
9
|
belongs_to :page
|
10
|
-
|
11
|
-
# non-accessible attributes: author_id, :status, :locale
|
12
|
-
attr_accessible :body, :page_id
|
13
|
-
|
10
|
+
|
14
11
|
validates_presence_of :page_id, :body
|
15
|
-
|
16
|
-
scope :showable, where('status = ? OR status = ?', 'pending', 'accepted')
|
17
|
-
scope :pending, where('status = ?', 'pending')
|
18
|
-
scope :accepted, where('status = ?', 'accepted')
|
19
|
-
scope :blocked, where('status = ?', 'blocked')
|
12
|
+
|
13
|
+
scope :showable, -> { where('status = ? OR status = ?', 'pending', 'accepted') }
|
14
|
+
scope :pending, -> { where('status = ?', 'pending') }
|
15
|
+
scope :accepted, -> { where('status = ?', 'accepted') }
|
16
|
+
scope :blocked, -> { where('status = ?', 'blocked') }
|
20
17
|
scope :for_locale, lambda { |locale| where('locale = ?', locale) }
|
21
|
-
scope :by_recent, order('updated_at desc')
|
22
|
-
scope :by_created, order('created_at')
|
23
|
-
scope :by_recently_created, order('created_at desc')
|
24
|
-
|
18
|
+
scope :by_recent, -> { order('updated_at desc') }
|
19
|
+
scope :by_created, -> { order('created_at') }
|
20
|
+
scope :by_recently_created, -> { order('created_at desc') }
|
21
|
+
|
25
22
|
end
|
data/app/models/contact.rb
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
# this is needed for now to make mass assignment security compatible with the translation of globalize3
|
2
|
-
Globalize::ActiveRecord::Translation.class_eval do
|
3
|
-
|
4
|
-
end
|
2
|
+
# Globalize::ActiveRecord::Translation.class_eval do
|
3
|
+
# attr_accessible :locale
|
4
|
+
# end
|
5
5
|
|
6
6
|
class Contact < ActiveRecord::Base
|
7
|
-
|
8
|
-
attr_accessible :sender_name, :sender_email, :body
|
9
|
-
|
7
|
+
|
10
8
|
validates_presence_of :sender_name
|
11
9
|
validates :sender_email, :presence => true, :format => { :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :on => :create }
|
12
10
|
validates_presence_of :body
|
13
11
|
|
14
|
-
scope :by_recent, order('updated_at desc')
|
15
|
-
|
12
|
+
scope :by_recent, -> { order('updated_at desc') }
|
13
|
+
|
16
14
|
end
|
data/app/models/page.rb
CHANGED
@@ -1,72 +1,70 @@
|
|
1
1
|
# this is needed for now to make mass assignment security compatible with the translation of globalize3
|
2
|
-
Globalize::ActiveRecord::Translation.class_eval do
|
3
|
-
|
4
|
-
end
|
2
|
+
# Globalize::ActiveRecord::Translation.class_eval do
|
3
|
+
# attr_accessible :locale
|
4
|
+
# end
|
5
5
|
|
6
6
|
class Page < ActiveRecord::Base
|
7
|
-
|
8
|
-
belongs_to :author, class_name: 'User'
|
7
|
+
|
8
|
+
belongs_to :author, class_name: 'User'
|
9
9
|
has_many :comments, :dependent => :destroy
|
10
|
-
|
11
|
-
attr_accessible :title, :short_title, :description, :body, :for_blog, :parent_id, :tag_list, :parent_page_title, :author_name
|
12
|
-
|
10
|
+
|
13
11
|
has_many :taggings
|
14
12
|
has_many :tags, through: :taggings
|
15
|
-
|
13
|
+
|
16
14
|
validates_presence_of :title
|
17
15
|
validates_presence_of :description
|
18
16
|
validates_presence_of :body
|
19
17
|
validates_presence_of :author_id
|
20
|
-
|
18
|
+
|
21
19
|
translates :title, :short_title, :description, :body
|
22
|
-
|
20
|
+
|
23
21
|
def to_param
|
24
22
|
title ? "#{id}-#{title.to_url}" : id
|
25
23
|
end
|
26
24
|
|
27
|
-
scope :by_recent, order('updated_at desc')
|
28
|
-
scope :for_blog, where('for_blog = ?', true)
|
29
|
-
scope :not_for_blog, where('for_blog = ?', false)
|
30
|
-
scope :published, where('published_at IS NOT ?', nil)
|
31
|
-
scope :by_recently_published, order('published_at desc')
|
25
|
+
scope :by_recent, -> { order('updated_at desc') }
|
26
|
+
scope :for_blog, -> { where('for_blog = ?', true) }
|
27
|
+
scope :not_for_blog, -> { where('for_blog = ?', false) }
|
28
|
+
scope :published, -> { where('published_at IS NOT ?', nil) }
|
29
|
+
scope :by_recently_published, -> { order('published_at desc') }
|
32
30
|
# tree scopes
|
33
|
-
scope :orphans, where('parent_id IS ?', nil)
|
31
|
+
scope :orphans, -> { where('parent_id IS ?', nil) }
|
34
32
|
scope :with_parent_id, lambda { |id| where('parent_id = ?', id) }
|
35
|
-
scope :by_title, order('title')
|
36
|
-
scope :by_menu_position, order('menu_position')
|
37
|
-
|
33
|
+
scope :by_title, -> { order('title') }
|
34
|
+
scope :by_menu_position, -> { order('menu_position') }
|
35
|
+
|
38
36
|
def nickname
|
39
37
|
@nickname ||= short_title || title
|
40
38
|
end
|
41
|
-
|
39
|
+
|
42
40
|
### menu related instance methods
|
43
|
-
|
41
|
+
|
44
42
|
def orphan?
|
45
43
|
parent_id == nil
|
46
44
|
end
|
47
|
-
|
45
|
+
|
48
46
|
def has_children?
|
49
47
|
Page.with_parent_id(id).published.count >= 1
|
50
48
|
end
|
51
|
-
|
49
|
+
|
52
50
|
def children
|
53
51
|
Page.published.with_parent_id(id)
|
54
52
|
end
|
55
|
-
|
53
|
+
|
56
54
|
def parent
|
57
55
|
Page.find(parent_id)
|
58
56
|
end
|
59
|
-
|
57
|
+
|
60
58
|
def has_siblings?
|
61
59
|
Page.with_parent_id(parent_id).published.count >= 1
|
62
60
|
end
|
63
|
-
|
61
|
+
|
64
62
|
def siblings
|
65
63
|
Page.published.with_parent_id(parent_id)
|
66
64
|
end
|
67
|
-
|
65
|
+
|
68
66
|
### tagging related methods
|
69
|
-
|
67
|
+
|
70
68
|
def self.tagged_with(name)
|
71
69
|
Tag.find_by_name!(name).pages
|
72
70
|
end
|
@@ -85,7 +83,7 @@ class Page < ActiveRecord::Base
|
|
85
83
|
Tag.where(name: n.strip).first_or_create!
|
86
84
|
end
|
87
85
|
end
|
88
|
-
|
86
|
+
|
89
87
|
### autocomplete related instance methods
|
90
88
|
def parent_page_title
|
91
89
|
parent.try(:title) unless self.orphan?
|
@@ -97,7 +95,7 @@ class Page < ActiveRecord::Base
|
|
97
95
|
self.parent_id = nil
|
98
96
|
end
|
99
97
|
end
|
100
|
-
|
98
|
+
|
101
99
|
def author_name
|
102
100
|
author.try(:formal_name)
|
103
101
|
end
|
@@ -107,5 +105,5 @@ class Page < ActiveRecord::Base
|
|
107
105
|
first_name = name_as_array[1].strip
|
108
106
|
self.author_id = User.where("last_name = ? AND first_name = ?", last_name, first_name).first.id
|
109
107
|
end
|
110
|
-
|
108
|
+
|
111
109
|
end
|
data/app/models/tag.rb
CHANGED
@@ -1,23 +1,21 @@
|
|
1
1
|
# this is needed for now to make mass assignment security compatible with the translation of globalize3
|
2
|
-
Globalize::ActiveRecord::Translation.class_eval do
|
3
|
-
|
4
|
-
end
|
2
|
+
# Globalize::ActiveRecord::Translation.class_eval do
|
3
|
+
# attr_accessible :locale
|
4
|
+
# end
|
5
5
|
|
6
6
|
class Tag < ActiveRecord::Base
|
7
|
-
|
8
|
-
attr_accessible :name
|
9
|
-
|
7
|
+
|
8
|
+
# attr_accessible :name
|
9
|
+
|
10
10
|
has_many :taggings
|
11
11
|
has_many :pages, through: :taggings
|
12
|
-
|
12
|
+
|
13
13
|
translates :name
|
14
|
-
|
15
|
-
scope :alphabetically, order('name')
|
16
|
-
|
14
|
+
|
15
|
+
scope :alphabetically, -> { order('name') }
|
16
|
+
|
17
17
|
def to_param
|
18
18
|
name ? "#{id}-#{name.to_url}" : id
|
19
19
|
end
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
20
|
|
21
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<%= simple_form_for @page, :html => { class: 'form-horizontal' } do |f| %>
|
1
|
+
<%= simple_form_for @page, :html => { class: 'form-horizontal', role: 'form' } do |f| %>
|
2
2
|
<%= f.error_notification %>
|
3
|
-
|
3
|
+
|
4
4
|
<div class="form-inputs">
|
5
5
|
<%= f.input :title, label: t('activerecord.attributes.pages.title'), hint: t('pages.hint.title') %>
|
6
6
|
<%= f.input :for_blog, label: t('activerecord.attributes.pages.for_the_blog') %>
|
@@ -10,27 +10,26 @@
|
|
10
10
|
as: :string,
|
11
11
|
:wrapper_html => { :id => 'parent-page-title' },
|
12
12
|
label: t('activerecord.attributes.pages.parent_title'),
|
13
|
-
:input_html => {
|
13
|
+
:input_html => {
|
14
14
|
:autocomplete => 'off',
|
15
15
|
:data => { provide: 'typeahead',
|
16
|
-
source: Page.not_for_blog.by_title.map(&:title).to_json }
|
16
|
+
source: Page.not_for_blog.by_title.map(&:title).to_json }
|
17
17
|
} %>
|
18
18
|
<%= f.input :description, label: t('activerecord.attributes.pages.description'), :input_html => { :rows => 3 } %>
|
19
19
|
<%= f.input :body, label: t('activerecord.attributes.pages.body'), :input_html => { :rows => 35, :class => 'ckeditor' } %>
|
20
|
-
|
20
|
+
|
21
21
|
<% if controller.action_name == 'edit' # the current_user is the page creator in create method %>
|
22
22
|
<%= f.input :author_name,
|
23
23
|
as: :string,
|
24
24
|
:wrapper_html => { :id => 'author-name' },
|
25
25
|
label: "author name",
|
26
|
-
:input_html => {
|
26
|
+
:input_html => {
|
27
27
|
:autocomplete => 'off',
|
28
|
-
:data => {
|
29
|
-
source: User.administrators.alphabetically.map(&:formal_name).to_json }
|
28
|
+
:data => { source: User.administrators.alphabetically.map(&:formal_name).to_json }
|
30
29
|
} %>
|
31
30
|
<% end -%>
|
32
31
|
</div>
|
33
|
-
|
32
|
+
|
34
33
|
<div class="form-actions">
|
35
34
|
<%= f.button :submit, :class => 'btn btn-primary' %>
|
36
35
|
</div>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<% if current_user %>
|
4
4
|
<%= render 'comments/form_in_page' %>
|
5
5
|
<% else %>
|
6
|
-
|
7
|
-
|
6
|
+
<p><label class="label label-info"><%= t('comments.login_needed') %></label></p>
|
7
|
+
<%= render 'shared/embedded_access_control' %>
|
8
8
|
<% end -%>
|
9
|
-
</div>
|
9
|
+
</div>
|
@@ -1,5 +1,7 @@
|
|
1
|
-
<
|
1
|
+
<h1><%= t 'activerecord.models.pages' %></h1>
|
2
|
+
|
3
|
+
<ul class="nav nav-tabs" id="admin-menu-tab">
|
2
4
|
<%= content_tag :li, link_to(t('new'), new_page_path), ({ class: 'active' } if controller.action_name.to_s == 'new' ) %>
|
3
5
|
<%= content_tag :li, link_to(t('list'), pages_path), ({ class: 'active' } if controller.action_name.to_s == 'index' ) %>
|
4
|
-
<%= content_tag :li, link_to(t('edit'), '#'), ({ class: 'active' }) if controller.action_name.to_s == 'edit' %>
|
6
|
+
<%= content_tag :li, link_to(t('edit'), '#'), ({ class: 'active' }) if controller.action_name.to_s == 'edit' %>
|
5
7
|
</ul>
|
@@ -1,44 +1,46 @@
|
|
1
|
-
<h1><%= t 'activerecord.models.pages' %></h1>
|
2
|
-
|
3
1
|
<%= render 'tab_admin_menu' %>
|
4
2
|
|
3
|
+
<%= will_paginate @pages, inner_window: 2 %>
|
4
|
+
|
5
5
|
<table class='table table-striped'>
|
6
6
|
<thead>
|
7
7
|
<tr>
|
8
8
|
<th><%= t 'activerecord.attributes.pages.title' %></th>
|
9
|
-
<th><%= t 'activerecord.attributes.pages.description' %></th>
|
10
9
|
<th><%= t 'pages.author' %></th>
|
11
10
|
<th><%= t 'activerecord.attributes.pages.for_the_blog' %>?</th>
|
12
11
|
<th><%= t 'pages.published' %></th>
|
13
12
|
<th><%= t('actions') %></th>
|
14
13
|
</tr>
|
15
14
|
</thead>
|
16
|
-
|
15
|
+
|
17
16
|
<tbody>
|
18
17
|
<% @pages.each do |page| %>
|
19
18
|
<tr>
|
20
19
|
<td><%= link_to page.title, page %></td>
|
21
|
-
<td><%= truncate page.description, length: 55, separator: ' ...' %></td>
|
22
20
|
<td><%= page.author.name %></td>
|
23
21
|
<td>
|
24
|
-
|
25
|
-
|
22
|
+
<% if page.for_blog? %>
|
23
|
+
<span class="label label-success"><span class="glyphicon glyphicon-ok"></span></span>
|
24
|
+
<% else %>
|
25
|
+
<span class="label label-info"><span class="glyphicon glyphicon-remove"></span></span>
|
26
|
+
<% end %>
|
26
27
|
</td>
|
27
28
|
<td>
|
28
29
|
<% if page.published_at %>
|
29
|
-
<span class="label label-success"
|
30
|
+
<span class="label label-success"><span class="glyphicon glyphicon-ok"></span></span><%= link_to t('pages.unpublish'), unpublish_page_path(page), class: 'btn btn-xs btn-default', method: :post %>
|
30
31
|
<% else %>
|
31
|
-
<span class="label label-
|
32
|
+
<span class="label label-info"><span class="glyphicon glyphicon-remove"></span></span><%= link_to t('pages.publish'), publish_page_path(page), class: 'btn btn-xs btn-default', method: :post %>
|
32
33
|
<% end -%>
|
33
34
|
</td>
|
34
|
-
<td
|
35
|
-
|
35
|
+
<td>
|
36
|
+
<%= link_to t('edit'), edit_page_path(page), class: 'btn btn-xs btn-default' %><%= link_to t('delete'), page, method: :delete, data: { confirm: t('are_you_sure') }, class: 'btn btn-xs btn-danger' %>
|
37
|
+
</td>
|
36
38
|
</tr>
|
37
39
|
<% end %>
|
38
40
|
</tbody>
|
39
41
|
</table>
|
40
42
|
|
41
|
-
<%= will_paginate @pages %>
|
43
|
+
<%= will_paginate @pages, inner_window: 2 %>
|
42
44
|
|
43
45
|
<%= link_to t('pages.create_new').capitalize, new_page_path, class: 'btn btn-primary' %>
|
44
46
|
|
data/lib/tkh_content/version.rb
CHANGED
data/lib/tkh_content.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
require "tkh_content/version"
|
2
|
+
require 'rails'
|
2
3
|
require 'bootstrap-sass'
|
4
|
+
require 'bootstrap-will_paginate'
|
3
5
|
require 'simple_form'
|
4
6
|
require 'stringex'
|
5
|
-
require '
|
7
|
+
require 'globalize'
|
6
8
|
require 'will_paginate'
|
7
|
-
require 'bootstrap-will_paginate'
|
8
|
-
# require 'bootstrap-wysihtml5-rails'
|
9
|
-
# require 'tkh_inline_editor'
|
10
9
|
require 'ckeditor_rails'
|
11
10
|
|
12
11
|
module TkhContent
|
metadata
CHANGED
@@ -1,101 +1,101 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tkh_content
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Swami Atma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>'
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.0
|
19
|
+
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>'
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.0
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: stringex
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bootstrap-sass
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: bootstrap-will_paginate
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: simple_form
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 3.0.1
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 3.0.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: globalize
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 4.0.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 4.0.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: will_paginate
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - '>='
|
@@ -112,16 +112,16 @@ dependencies:
|
|
112
112
|
name: ckeditor_rails
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 4.2.2
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ~>
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 4.2.2
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: sqlite3
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -262,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
262
262
|
version: '0'
|
263
263
|
requirements: []
|
264
264
|
rubyforge_project:
|
265
|
-
rubygems_version: 2.
|
265
|
+
rubygems_version: 2.1.10
|
266
266
|
signing_key:
|
267
267
|
specification_version: 4
|
268
268
|
summary: Rails engine running pages and blog posts.
|