publify_core 9.2.10 → 10.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +57 -18
- data/app/assets/javascripts/lang/ar_AR.js +17 -0
- data/app/controllers/admin/{content_controller.rb → articles_controller.rb} +24 -24
- data/app/controllers/admin/dashboard_controller.rb +3 -3
- data/app/controllers/admin/feedback_controller.rb +23 -23
- data/app/controllers/admin/pages_controller.rb +2 -2
- data/app/controllers/admin/post_types_controller.rb +10 -4
- data/app/controllers/admin/redirects_controller.rb +10 -6
- data/app/controllers/admin/resources_controller.rb +2 -2
- data/app/controllers/admin/sidebar_controller.rb +2 -2
- data/app/controllers/admin/tags_controller.rb +5 -3
- data/app/controllers/admin/themes_controller.rb +1 -2
- data/app/controllers/admin/users_controller.rb +5 -3
- data/app/controllers/articles_controller.rb +5 -5
- data/app/controllers/authors_controller.rb +2 -2
- data/app/controllers/base_controller.rb +0 -3
- data/app/controllers/feedback_controller.rb +3 -3
- data/app/controllers/tags_controller.rb +3 -3
- data/app/helpers/authors_helper.rb +1 -1
- data/app/helpers/base_helper.rb +6 -6
- data/app/models/ability.rb +1 -1
- data/app/models/archives_sidebar.rb +3 -3
- data/app/models/article.rb +13 -13
- data/app/models/blog.rb +3 -6
- data/app/models/content.rb +1 -3
- data/app/models/content_base.rb +2 -13
- data/app/models/feedback.rb +1 -2
- data/app/models/meta_sidebar.rb +1 -1
- data/app/models/note.rb +2 -2
- data/app/models/redirect.rb +0 -1
- data/app/models/sidebar.rb +1 -1
- data/app/models/static_sidebar.rb +1 -1
- data/app/models/tag.rb +7 -8
- data/app/models/tag_sidebar.rb +3 -3
- data/app/models/text_filter.rb +17 -43
- data/app/models/user.rb +2 -2
- data/app/services/title_builder.rb +4 -4
- data/app/views/admin/{content → articles}/_article_list.html.erb +3 -3
- data/app/views/admin/{content → articles}/_form.html.erb +11 -1
- data/app/views/admin/{content → articles}/index.html.erb +1 -1
- data/app/views/admin/dashboard/_drafts.html.erb +2 -2
- data/app/views/admin/dashboard/_overview.html.erb +1 -1
- data/app/views/admin/dashboard/_welcome.html.erb +4 -4
- data/app/views/admin/dashboard/index.html.erb +0 -7
- data/app/views/admin/feedback/article.html.erb +12 -6
- data/app/views/admin/feedback/edit.html.erb +14 -2
- data/app/views/admin/feedback/index.html.erb +6 -7
- data/app/views/admin/pages/_form.html.erb +13 -14
- data/app/views/admin/seo/show.html.erb +12 -1
- data/app/views/admin/shared/_menu.html.erb +5 -4
- data/app/views/admin/tags/_index_and_form.html.erb +2 -1
- data/app/views/articles/_comment_errors.html.erb +11 -1
- data/app/views/articles/read.html.erb +1 -1
- data/app/views/layouts/administration.html.erb +9 -17
- data/config/i18n-tasks.yml +8 -1
- data/config/initializers/devise.rb +1 -1
- data/config/locales/ar.yml +885 -0
- data/config/locales/da.yml +12 -12
- data/config/locales/de.yml +12 -12
- data/config/locales/en.yml +12 -12
- data/config/locales/es-MX.yml +12 -12
- data/config/locales/fr.yml +12 -12
- data/config/locales/he.yml +12 -12
- data/config/locales/it.yml +12 -12
- data/config/locales/ja.yml +13 -13
- data/config/locales/lt.yml +12 -12
- data/config/locales/{nb-NO.yml → nb.yml} +13 -13
- data/config/locales/nl.yml +13 -13
- data/config/locales/pl.yml +12 -12
- data/config/locales/pt-BR.yml +12 -12
- data/config/locales/ro.yml +12 -12
- data/config/locales/ru.yml +13 -13
- data/config/locales/sidebars.ar.yml +20 -0
- data/config/locales/{sidebars.nb-NO.yml → sidebars.nb.yml} +1 -1
- data/config/locales/zh-CN.yml +12 -12
- data/config/locales/zh-TW.yml +12 -12
- data/config/routes.rb +2 -2
- data/db/migrate/20150807134129_simplify_redirect_relations.rb +1 -0
- data/db/migrate/20150808052637_add_blog_ids.rb +3 -1
- data/db/migrate/20160605103918_replace_profile_id_with_string.rb +1 -0
- data/db/migrate/20160701062604_add_blog_id_to_resources.rb +2 -0
- data/db/migrate/20190208152646_move_text_filter_to_name.rb +17 -17
- data/db/migrate/20221007091049_remove_table_sitealizer.rb +19 -0
- data/db/migrate/20221010092846_remove_page_caches_table.rb +15 -0
- data/db/migrate/20221012163214_remove_itunes_fields_from_resources.rb +14 -0
- data/db/seeds.rb +0 -4
- data/lib/publify_core/content_text_helpers.rb +11 -0
- data/lib/publify_core/lang.rb +1 -1
- data/lib/publify_core/testing_support/factories/articles.rb +55 -0
- data/lib/publify_core/testing_support/factories/blogs.rb +24 -0
- data/lib/publify_core/testing_support/factories/comments.rb +40 -0
- data/lib/publify_core/testing_support/factories/contents.rb +7 -0
- data/lib/publify_core/testing_support/factories/notes.rb +17 -0
- data/lib/publify_core/testing_support/factories/pages.rb +13 -0
- data/lib/publify_core/testing_support/factories/post_types.rb +8 -0
- data/lib/publify_core/testing_support/factories/redirects.rb +9 -0
- data/lib/publify_core/testing_support/factories/resources.rb +16 -0
- data/lib/publify_core/testing_support/factories/sequences.rb +12 -0
- data/lib/publify_core/testing_support/factories/sidebars.rb +10 -0
- data/lib/publify_core/testing_support/factories/tags.rb +9 -0
- data/lib/publify_core/testing_support/factories/trackbacks.rb +13 -0
- data/lib/publify_core/testing_support/factories/users.rb +43 -0
- data/lib/publify_core/version.rb +1 -1
- data/lib/publify_core.rb +3 -3
- data/lib/publify_textfilter_markdown.rb +8 -9
- data/lib/publify_textfilter_markdown_smartquotes.rb +20 -0
- data/lib/publify_textfilter_twitterfilter.rb +36 -18
- data/lib/sidebar_field.rb +2 -2
- data/lib/sidebar_registry.rb +0 -12
- data/lib/text_filter_plugin.rb +23 -30
- metadata +213 -105
- data/lib/publify_core/testing_support/factories.rb +0 -240
- data/lib/publify_textfilter_textile.rb +0 -24
- data/lib/tasks/i18n.rake +0 -9
- /data/app/views/admin/{content → articles}/autosave.js.erb +0 -0
- /data/app/views/admin/{content → articles}/edit.html.erb +0 -0
- /data/app/views/admin/{content → articles}/index.js.erb +0 -0
- /data/app/views/admin/{content → articles}/new.html.erb +0 -0
@@ -10,7 +10,7 @@ class ArchivesSidebar < Sidebar
|
|
10
10
|
|
11
11
|
def self.date_funcs
|
12
12
|
@date_funcs ||=
|
13
|
-
if
|
13
|
+
if Content.connection.class.name.include?("SQLite3Adapter")
|
14
14
|
["strftime('%Y', published_at) as year", "strftime('%m', published_at) as month"]
|
15
15
|
else
|
16
16
|
["extract(year from published_at) as year",
|
@@ -26,8 +26,8 @@ class ArchivesSidebar < Sidebar
|
|
26
26
|
# DB-specific code.
|
27
27
|
date_funcs = self.class.date_funcs
|
28
28
|
|
29
|
-
article_counts = Article.published.select("count(*) as count", *date_funcs)
|
30
|
-
group(:year, :month).reorder("year desc", "month desc").limit(count.to_i)
|
29
|
+
article_counts = Article.published.select("count(*) as count", *date_funcs)
|
30
|
+
.group(:year, :month).reorder("year desc", "month desc").limit(count.to_i)
|
31
31
|
|
32
32
|
@archives = article_counts.map do |entry|
|
33
33
|
month = entry.month.to_i
|
data/app/models/article.rb
CHANGED
@@ -31,13 +31,13 @@ class Article < Content
|
|
31
31
|
scope :pending, -> { where(state: "publication_pending").order(default_order) }
|
32
32
|
|
33
33
|
scope :bestof, lambda {
|
34
|
-
joins(:feedback)
|
35
|
-
where("feedback.type" => "Comment",
|
36
|
-
|
37
|
-
group("contents.id")
|
38
|
-
select("contents.*, count(feedback.id) as comment_count")
|
39
|
-
order("comment_count DESC")
|
40
|
-
limit(5)
|
34
|
+
joins(:feedback)
|
35
|
+
.where("feedback.type" => "Comment",
|
36
|
+
"contents.state" => "published")
|
37
|
+
.group("contents.id")
|
38
|
+
.select("contents.*, count(feedback.id) as comment_count")
|
39
|
+
.order("comment_count DESC")
|
40
|
+
.limit(5)
|
41
41
|
}
|
42
42
|
|
43
43
|
setting :password, :string, ""
|
@@ -140,13 +140,13 @@ class Article < Content
|
|
140
140
|
end
|
141
141
|
|
142
142
|
def next
|
143
|
-
Article.where("published_at > ?", published_at).order("published_at asc")
|
144
|
-
limit(1).first
|
143
|
+
Article.where("published_at > ?", published_at).order("published_at asc")
|
144
|
+
.limit(1).first
|
145
145
|
end
|
146
146
|
|
147
147
|
def previous
|
148
|
-
Article.where("published_at < ?", published_at).order("published_at desc")
|
149
|
-
limit(1).first
|
148
|
+
Article.where("published_at < ?", published_at).order("published_at desc")
|
149
|
+
.limit(1).first
|
150
150
|
end
|
151
151
|
|
152
152
|
def publication_month
|
@@ -154,7 +154,7 @@ class Article < Content
|
|
154
154
|
end
|
155
155
|
|
156
156
|
def self.publication_months
|
157
|
-
result = select("published_at").where(
|
157
|
+
result = select("published_at").where.not(published_at: nil).where(type: "Article")
|
158
158
|
result.map { |it| [it.publication_month] }.uniq
|
159
159
|
end
|
160
160
|
|
@@ -289,7 +289,7 @@ class Article < Content
|
|
289
289
|
format_url.gsub!("%day%", sprintf("%<day>.2d", day: published_at.day))
|
290
290
|
format_url.gsub!("%title%", URI::DEFAULT_PARSER.escape(permalink.to_s))
|
291
291
|
if format_url[0, 1] == "/"
|
292
|
-
format_url[1
|
292
|
+
format_url[1..]
|
293
293
|
else
|
294
294
|
format_url
|
295
295
|
end
|
data/app/models/blog.rb
CHANGED
@@ -77,7 +77,7 @@ class Blog < ApplicationRecord
|
|
77
77
|
setting :meta_keywords, :string, ""
|
78
78
|
setting :google_analytics, :string, ""
|
79
79
|
setting :rss_description, :boolean, false
|
80
|
-
setting :rss_description_text, :text,
|
80
|
+
setting :rss_description_text, :text, <<~HTML
|
81
81
|
<hr />
|
82
82
|
<p><small>Original article written by %author% and published on <a href='%blog_url%'>%blog_name%</a>
|
83
83
|
| <a href='%permalink_url%'>direct link to this article</a>
|
@@ -86,7 +86,7 @@ class Blog < ApplicationRecord
|
|
86
86
|
HTML
|
87
87
|
setting :permalink_format, :string, "/%year%/%month%/%day%/%title%"
|
88
88
|
setting :robots, :text, 'User-agent: *\nAllow: /\nDisallow: /admin\n'
|
89
|
-
setting :humans, :text,
|
89
|
+
setting :humans, :text, <<~TEXT
|
90
90
|
/* TEAM */
|
91
91
|
Your title: Your name.
|
92
92
|
Site: email, link to a contact form, etc.
|
@@ -191,10 +191,7 @@ class Blog < ApplicationRecord
|
|
191
191
|
host: host_with_port,
|
192
192
|
script_name: root_path)
|
193
193
|
cache_key = merged_opts.values.prepend("blog-urlfor-withbaseurl").join("-")
|
194
|
-
|
195
|
-
Rails.cache.write(cache_key, super(merged_opts))
|
196
|
-
end
|
197
|
-
Rails.cache.read(cache_key)
|
194
|
+
Rails.cache.fetch(cache_key) { super(merged_opts) }
|
198
195
|
else
|
199
196
|
raise "Invalid URL in url_for: #{options.inspect}"
|
200
197
|
end
|
data/app/models/content.rb
CHANGED
@@ -10,15 +10,13 @@ class Content < ApplicationRecord
|
|
10
10
|
belongs_to :user, optional: true, touch: true
|
11
11
|
belongs_to :blog
|
12
12
|
|
13
|
-
validates :blog, presence: true
|
14
|
-
|
15
13
|
has_one :redirect, dependent: :destroy, inverse_of: :content
|
16
14
|
|
17
15
|
has_many :triggers, as: :pending_item, dependent: :delete_all
|
18
16
|
has_many :resources, inverse_of: :content, dependent: :nullify
|
19
17
|
has_and_belongs_to_many :tags
|
20
18
|
|
21
|
-
scope :user_id, ->(user_id) { where(
|
19
|
+
scope :user_id, ->(user_id) { where(user_id: user_id) }
|
22
20
|
scope :published, -> { where(state: "published").order(default_order) }
|
23
21
|
scope :published_at, lambda { |time_params|
|
24
22
|
published.where(published_at: PublifyTime.delta(*time_params))
|
data/app/models/content_base.rb
CHANGED
@@ -5,12 +5,6 @@ module ContentBase
|
|
5
5
|
base.extend ClassMethods
|
6
6
|
end
|
7
7
|
|
8
|
-
class ContentTextHelpers
|
9
|
-
include ActionView::Helpers::UrlHelper
|
10
|
-
include ActionView::Helpers::TextHelper
|
11
|
-
include ActionView::Helpers::SanitizeHelper
|
12
|
-
end
|
13
|
-
|
14
8
|
attr_accessor :just_changed_published_status
|
15
9
|
alias just_changed_published_status? just_changed_published_status
|
16
10
|
|
@@ -40,21 +34,16 @@ module ContentBase
|
|
40
34
|
# object.
|
41
35
|
def generate_html(field, text = nil)
|
42
36
|
text ||= self[field].to_s
|
43
|
-
|
44
|
-
html = (text_filter || default_text_filter).filter_text(prehtml) || prehtml
|
37
|
+
html = (text_filter || default_text_filter).filter_text(text) || text
|
45
38
|
html_postprocess(field, html).to_s
|
46
39
|
end
|
47
40
|
|
48
41
|
# Post-process the HTML
|
49
42
|
def html_postprocess(_field, html)
|
50
|
-
helper = ContentTextHelpers.new
|
43
|
+
helper = PublifyCore::ContentTextHelpers.new
|
51
44
|
helper.sanitize html
|
52
45
|
end
|
53
46
|
|
54
|
-
def html_preprocess(_field, html)
|
55
|
-
html
|
56
|
-
end
|
57
|
-
|
58
47
|
def html_map(field)
|
59
48
|
content_fields.include? field
|
60
49
|
end
|
data/app/models/feedback.rb
CHANGED
@@ -13,7 +13,6 @@ class Feedback < ApplicationRecord
|
|
13
13
|
include StringLengthLimit
|
14
14
|
|
15
15
|
validate :feedback_allowed, on: :create
|
16
|
-
validates :article, presence: true
|
17
16
|
|
18
17
|
validates_default_string_length :title, :author, :email, :url, :blog_name,
|
19
18
|
:user_agent, :text_filter_name
|
@@ -94,7 +93,7 @@ class Feedback < ApplicationRecord
|
|
94
93
|
end
|
95
94
|
|
96
95
|
def html_postprocess(_field, html)
|
97
|
-
helper = ContentTextHelpers.new
|
96
|
+
helper = PublifyCore::ContentTextHelpers.new
|
98
97
|
helper.sanitize(helper.auto_link(html), tags: self.class.allowed_tags)
|
99
98
|
end
|
100
99
|
|
data/app/models/meta_sidebar.rb
CHANGED
data/app/models/note.rb
CHANGED
@@ -43,8 +43,8 @@ class Note < Content
|
|
43
43
|
[]
|
44
44
|
end
|
45
45
|
|
46
|
-
def
|
47
|
-
PublifyApp::Textfilter::Twitterfilter.filtertext(html)
|
46
|
+
def html_postprocess(field, html)
|
47
|
+
super(field, PublifyApp::Textfilter::Twitterfilter.filtertext(html))
|
48
48
|
end
|
49
49
|
|
50
50
|
def truncate(message, length)
|
data/app/models/redirect.rb
CHANGED
data/app/models/sidebar.rb
CHANGED
@@ -13,7 +13,7 @@ class StaticSidebar < Sidebar
|
|
13
13
|
TEXT
|
14
14
|
|
15
15
|
description "Static content, like links to other sites, advertisements," \
|
16
|
-
|
16
|
+
" or blog meta-information"
|
17
17
|
|
18
18
|
setting :title, "Links"
|
19
19
|
setting :body, DEFAULT_TEXT, input_type: :text_area
|
data/app/models/tag.rb
CHANGED
@@ -7,7 +7,6 @@ class Tag < ApplicationRecord
|
|
7
7
|
has_and_belongs_to_many :contents, order: "created_at DESC"
|
8
8
|
|
9
9
|
validates :name, uniqueness: { scope: :blog_id }
|
10
|
-
validates :blog, presence: true
|
11
10
|
validates :name, presence: true
|
12
11
|
validates_default_string_length :display_name
|
13
12
|
|
@@ -40,11 +39,11 @@ class Tag < ApplicationRecord
|
|
40
39
|
end
|
41
40
|
|
42
41
|
def self.find_all_with_content_counters
|
43
|
-
Tag.joins(:contents)
|
44
|
-
where(contents: { state: "published" })
|
45
|
-
select(*Tag.column_names, "COUNT(contents_tags.content_id) as content_counter")
|
46
|
-
group(*Tag.column_names)
|
47
|
-
order("content_counter DESC").limit(1000)
|
42
|
+
Tag.joins(:contents)
|
43
|
+
.where(contents: { state: "published" })
|
44
|
+
.select(*Tag.column_names, "COUNT(contents_tags.content_id) as content_counter")
|
45
|
+
.group(*Tag.column_names)
|
46
|
+
.order("content_counter DESC").limit(1000)
|
48
47
|
end
|
49
48
|
|
50
49
|
def self.find_with_char(char)
|
@@ -52,8 +51,8 @@ class Tag < ApplicationRecord
|
|
52
51
|
end
|
53
52
|
|
54
53
|
def self.collection_to_string(tags)
|
55
|
-
tags.map(&:display_name).sort
|
56
|
-
map { |name|
|
54
|
+
tags.map(&:display_name).sort
|
55
|
+
.map { |name| name.include?(" ") ? "\"#{name}\"" : name }.join ", "
|
57
56
|
end
|
58
57
|
|
59
58
|
def published_contents
|
data/app/models/tag_sidebar.rb
CHANGED
@@ -7,8 +7,8 @@ class TagSidebar < Sidebar
|
|
7
7
|
setting :maximum_tags, 20
|
8
8
|
|
9
9
|
def tags
|
10
|
-
@tags ||= Tag.find_all_with_content_counters
|
11
|
-
take(maximum_tags.to_i).sort_by(&:name)
|
10
|
+
@tags ||= Tag.find_all_with_content_counters
|
11
|
+
.take(maximum_tags.to_i).sort_by(&:name)
|
12
12
|
end
|
13
13
|
|
14
14
|
def sizes
|
@@ -18,7 +18,7 @@ class TagSidebar < Sidebar
|
|
18
18
|
average = total.to_f / @tags.size
|
19
19
|
@sizes = tags.reduce({}) do |h, tag|
|
20
20
|
size = tag.content_counter.to_f / average
|
21
|
-
h.merge tag =>
|
21
|
+
h.merge tag => size.clamp(2.0 / 3.0, 2) * 100
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
data/app/models/text_filter.rb
CHANGED
@@ -17,48 +17,34 @@ class TextFilter
|
|
17
17
|
@params = params
|
18
18
|
end
|
19
19
|
|
20
|
-
def sanitize(
|
21
|
-
self.class.sanitize(
|
20
|
+
def sanitize(...)
|
21
|
+
self.class.sanitize(...)
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.find_or_default(name)
|
25
25
|
make_filter(name) || none
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
29
|
-
|
30
|
-
|
31
|
-
filters.each do |filter|
|
32
|
-
next if filter.nil?
|
33
|
-
|
34
|
-
filter_class = map[filter.to_s]
|
35
|
-
next unless filter_class
|
28
|
+
def filter_text(text)
|
29
|
+
all_filters = TextFilterPlugin
|
30
|
+
.expand_filter_list([:macropre, markup, :macropost, filters].flatten)
|
36
31
|
|
37
|
-
|
32
|
+
all_filters.each do |filter|
|
33
|
+
text = filter.filtertext(text)
|
38
34
|
end
|
39
35
|
|
40
36
|
text
|
41
37
|
end
|
42
38
|
|
43
|
-
def filter_text(text)
|
44
|
-
self.class.filter_text(text, [:macropre, markup, :macropost, filters].flatten)
|
45
|
-
end
|
46
|
-
|
47
39
|
def help
|
48
|
-
|
49
|
-
|
40
|
+
help_filters = TextFilterPlugin
|
41
|
+
.expand_filter_list([markup, :macropre, :macropost, filters].flatten)
|
50
42
|
|
51
|
-
|
52
|
-
help.push(filter_map[markup])
|
53
|
-
filter_types["macropre"].sort_by(&:short_name).each { |f| help.push f }
|
54
|
-
filter_types["macropost"].sort_by(&:short_name).each { |f| help.push f }
|
55
|
-
filters.each { |f| help.push(filter_map[f.to_s]) }
|
56
|
-
|
57
|
-
help_text = help.map do |f|
|
43
|
+
help_text = help_filters.map do |f|
|
58
44
|
if f.help_text.blank?
|
59
45
|
""
|
60
46
|
else
|
61
|
-
"<h3>#{f.display_name}</h3>\n#{
|
47
|
+
"<h3>#{f.display_name}</h3>\n#{CommonMarker.render_html(f.help_text, :DEFAULT)}"
|
62
48
|
end
|
63
49
|
end
|
64
50
|
|
@@ -66,13 +52,11 @@ class TextFilter
|
|
66
52
|
end
|
67
53
|
|
68
54
|
def commenthelp
|
69
|
-
|
70
|
-
|
71
|
-
help = [filter_map[markup]]
|
72
|
-
filters.each { |f| help.push(filter_map[f.to_s]) }
|
55
|
+
help_filters = TextFilterPlugin
|
56
|
+
.expand_filter_list([markup, filters].flatten)
|
73
57
|
|
74
|
-
|
75
|
-
f.help_text.blank? ? "" :
|
58
|
+
help_filters.map do |f|
|
59
|
+
f.help_text.blank? ? "" : CommonMarker.render_html(f.help_text)
|
76
60
|
end.join("\n")
|
77
61
|
end
|
78
62
|
|
@@ -81,7 +65,6 @@ class TextFilter
|
|
81
65
|
markdown,
|
82
66
|
smartypants,
|
83
67
|
markdown_smartypants,
|
84
|
-
textile,
|
85
68
|
none,
|
86
69
|
]
|
87
70
|
end
|
@@ -94,8 +77,6 @@ class TextFilter
|
|
94
77
|
smartypants
|
95
78
|
when "markdown smartypants"
|
96
79
|
markdown_smartypants
|
97
|
-
when "textile"
|
98
|
-
textile
|
99
80
|
when "none"
|
100
81
|
none
|
101
82
|
end
|
@@ -116,15 +97,8 @@ class TextFilter
|
|
116
97
|
|
117
98
|
def self.markdown_smartypants
|
118
99
|
new(name: "markdown smartypants",
|
119
|
-
description: "Markdown with
|
120
|
-
markup: "
|
121
|
-
filters: [:smartypants])
|
122
|
-
end
|
123
|
-
|
124
|
-
def self.textile
|
125
|
-
new(name: "textile",
|
126
|
-
description: "Textile",
|
127
|
-
markup: "textile")
|
100
|
+
description: "Markdown with smart quotes",
|
101
|
+
markup: "markdownsmartquotes")
|
128
102
|
end
|
129
103
|
|
130
104
|
def self.none
|
data/app/models/user.rb
CHANGED
@@ -69,8 +69,8 @@ class User < ApplicationRecord
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def display_names
|
72
|
-
[:login, :nickname, :firstname, :lastname, :first_and_last_name]
|
73
|
-
map { |f| send(f) }.delete_if(&:empty?)
|
72
|
+
[:login, :nickname, :firstname, :lastname, :first_and_last_name]
|
73
|
+
.map { |f| send(f) }.delete_if(&:empty?)
|
74
74
|
end
|
75
75
|
|
76
76
|
# Authenticate users with old password hashes
|
@@ -60,9 +60,9 @@ class TitleBuilder
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def substitute_parameters(str, parameters)
|
63
|
-
str = str.gsub("%date%", parse_date(str, parameters)) if
|
63
|
+
str = str.gsub("%date%", parse_date(str, parameters)) if str.include?("%date%")
|
64
64
|
str = str.gsub("%search%", parameters[:q]) if parameters[:q]
|
65
|
-
str = str.gsub("%page%", parse_page(str, parameters)) if
|
65
|
+
str = str.gsub("%page%", parse_page(str, parameters)) if str.include?("%page%")
|
66
66
|
|
67
67
|
str
|
68
68
|
end
|
@@ -75,8 +75,8 @@ class TitleBuilder
|
|
75
75
|
format << "%B " if params[:month]
|
76
76
|
format << "%Y" if params[:year]
|
77
77
|
|
78
|
-
string.gsub("%date%", Time.zone.local(*params.values_at(:year, :month, :day))
|
79
|
-
strftime(format))
|
78
|
+
string.gsub("%date%", Time.zone.local(*params.values_at(:year, :month, :day))
|
79
|
+
.strftime(format))
|
80
80
|
end
|
81
81
|
|
82
82
|
def parse_page(_string, params)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% if @articles.empty? %>
|
2
2
|
<tr>
|
3
|
-
<td colspan="
|
3
|
+
<td colspan="7">
|
4
4
|
<%= t('.no_articles') %>
|
5
5
|
</td>
|
6
6
|
</tr>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
<tr>
|
10
10
|
<td>
|
11
11
|
<% if article.published? %>
|
12
|
-
<%= link_to_permalink(article, article.title,
|
12
|
+
<%= link_to_permalink(article, article.title, style: 'published') %>
|
13
13
|
<% else %>
|
14
14
|
<%= link_to(article.title, { controller: '/articles', action: 'preview', id: article.id }, { class: 'unpublished', target: '_new' }) %>
|
15
15
|
<% end %>
|
@@ -38,4 +38,4 @@
|
|
38
38
|
</td>
|
39
39
|
</tr>
|
40
40
|
<% end %>
|
41
|
-
<%= display_pagination(@articles,
|
41
|
+
<%= display_pagination(@articles, 7, 'first', 'last') %>
|
@@ -21,7 +21,17 @@
|
|
21
21
|
<div class="row">
|
22
22
|
<div class="col-md-8 col-md-offset-2" id="error-message-article">
|
23
23
|
<%= render 'shared/flash', flash: flash %>
|
24
|
-
|
24
|
+
<% if @article.errors.any? %>
|
25
|
+
<div id="error_explanation">
|
26
|
+
<h2><%= t("errors.template.header", model: 'article', count: @article.errors.count) %></h2>
|
27
|
+
<p><%= t("errors.template.body") %></p>
|
28
|
+
<ul>
|
29
|
+
<% @article.errors.full_messages.each do |message| %>
|
30
|
+
<li><%= message %></li>
|
31
|
+
<% end %>
|
32
|
+
</ul>
|
33
|
+
</div>
|
34
|
+
<% end %>
|
25
35
|
</div>
|
26
36
|
</div>
|
27
37
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% content_for :page_heading do %>
|
2
2
|
<h2>
|
3
3
|
<%= t('.manage_articles') %>
|
4
|
-
<%= link_to(t('.new_article'), { controller: '
|
4
|
+
<%= link_to(t('.new_article'), { controller: 'articles', action: 'new' }, { id: 'dialog-link', class: 'btn btn-info pull-right' }) %>
|
5
5
|
</h2>
|
6
6
|
<% end %>
|
7
7
|
|
@@ -6,13 +6,13 @@
|
|
6
6
|
<ul class='list-unstyled'>
|
7
7
|
<% if @drafts.empty? %>
|
8
8
|
<li class='alert alert-info'>
|
9
|
-
<%= link_to t('.no_drafts_yet'), controller: '
|
9
|
+
<%= link_to t('.no_drafts_yet'), controller: 'articles', action: 'new' %> ?
|
10
10
|
</li>
|
11
11
|
<% else %>
|
12
12
|
<% for post in @drafts %>
|
13
13
|
<li>
|
14
14
|
<h5>
|
15
|
-
<%= link_to(post.title, controller: 'admin/
|
15
|
+
<%= link_to(post.title, controller: 'admin/articles', action: 'edit', id: post.id) %>
|
16
16
|
<%= display_date_and_time(post.created_at) %>
|
17
17
|
</h5>
|
18
18
|
<p><%= post.body&.strip_html&.slice(0, 300) %></p>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<span class="sr-only">Close</span>
|
5
5
|
</button>
|
6
6
|
<% links = []
|
7
|
-
links << link_to(t('.write_a_post'), controller: '
|
7
|
+
links << link_to(t('.write_a_post'), controller: 'articles', action: 'new') if can? :new, 'admin/articles'
|
8
8
|
links << link_to(t('.write_a_page'), controller: 'pages', action: 'new') if can? :new, 'admin/pages'
|
9
9
|
links << link_to(t('.update_your_profile_or_change_your_password'), controller: 'profiles', action: 'index') %>
|
10
10
|
<p>
|
@@ -6,11 +6,11 @@
|
|
6
6
|
<p><%= t('.articles_and_comments_count_since', articles_count: @newposts_count, comments_count: @newcomments_count) %></p>
|
7
7
|
<p><%= t('.running_publify', version: PublifyCore::VERSION) %> <%= @version_message %></p>
|
8
8
|
<div class='col-md-6'>
|
9
|
-
<% if can? :index, 'admin/
|
9
|
+
<% if can? :index, 'admin/articles' %>
|
10
10
|
<h4 class='page-header'><%= t('.content') %></h4>
|
11
|
-
<p><%= link_to(t('.articles_count', count: @statposts), controller: 'admin/
|
12
|
-
<p><%= link_to(t('.your_articles_count', count: @statuserposts), controller: 'admin/
|
13
|
-
<p><%= link_to(t('.drafts_count', count: @statsdrafts), controller: 'admin/
|
11
|
+
<p><%= link_to(t('.articles_count', count: @statposts), controller: 'admin/articles') %></p>
|
12
|
+
<p><%= link_to(t('.your_articles_count', count: @statuserposts), controller: 'admin/articles', 'search[user_id]' => current_user.id) %></p>
|
13
|
+
<p><%= link_to(t('.drafts_count', count: @statsdrafts), controller: 'admin/articles', 'search[state]' => 'drafts') %></p>
|
14
14
|
<p><%= link_to(t('.pages_count', count: @statspages), controller: 'admin/pages') %></p>
|
15
15
|
<p><%= link_to(t('.notes_count', count: @statuses), controller: 'admin/notes') %></p>
|
16
16
|
<% end %>
|
@@ -3,13 +3,6 @@
|
|
3
3
|
<% end %>
|
4
4
|
|
5
5
|
<%= render 'overview' %>
|
6
|
-
<% if Content.where(text_filter_name: "textile").any? || Feedback.where(text_filter_name: "textile").any? %>
|
7
|
-
<div class="alert alert-warning">
|
8
|
-
<p>
|
9
|
-
<%= t('.textile_deprecated_html') %>
|
10
|
-
</p>
|
11
|
-
</div>
|
12
|
-
<% end %>
|
13
6
|
|
14
7
|
<div class='row'>
|
15
8
|
<div class='col-md-6'>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% content_for :page_heading do %>
|
2
2
|
<h2 class="page-title">
|
3
|
-
<%= t('.comments_for_html', title: @article.title) %>
|
3
|
+
<%= t('.comments_for_html', title: link_to_permalink(@article, @article.title)) %>
|
4
4
|
</h2>
|
5
5
|
<% end %>
|
6
6
|
|
@@ -8,18 +8,24 @@
|
|
8
8
|
|
9
9
|
<%= hidden_field_tag 'article_id', @article.id %>
|
10
10
|
|
11
|
-
|
11
|
+
<% if @feedback.any? %>
|
12
|
+
<%= render 'button', position: 'top' %>
|
13
|
+
<% end %>
|
12
14
|
|
13
|
-
<br class='clear' />
|
14
15
|
<table class='table hover'>
|
15
16
|
<thead>
|
16
17
|
<tr class='noborder'>
|
17
|
-
<th
|
18
|
+
<th>
|
18
19
|
<input type="checkbox" name="checkall" id="checkall" onclick="check_all(this);" />
|
19
|
-
<%= t('.select_all') %>
|
20
20
|
</th>
|
21
|
+
<th><%= t(".author") %></th>
|
22
|
+
<th><%= t(".created_at") %></th>
|
23
|
+
<th><%= t(".status") %></th>
|
24
|
+
<th><%= t(".content") %></th>
|
25
|
+
<th><%= t(".actions") %></th>
|
21
26
|
</tr>
|
22
27
|
</thead>
|
28
|
+
|
23
29
|
<% if @feedback.empty? %>
|
24
30
|
<tr>
|
25
31
|
<td colspan="5">
|
@@ -62,7 +68,7 @@
|
|
62
68
|
<%= text_area 'comment', 'body', rows: '10', class: 'form-control' %>
|
63
69
|
</div>
|
64
70
|
</div>
|
65
|
-
<div
|
71
|
+
<div>
|
66
72
|
<%= t('.action_or_other_html', first_action: link_to(t('.cancel'), action: 'index'), second_action: submit_tag(t('.save'), class: 'btn btn-primary')) %>
|
67
73
|
</div>
|
68
74
|
</fieldset>
|
@@ -1,12 +1,24 @@
|
|
1
1
|
<% content_for :page_heading do %>
|
2
2
|
<h2 class="page-title">
|
3
|
-
<%= t('.comments_for_html', article_link: link_to(h(@comment.article.title), controller: '/admin/
|
3
|
+
<%= t('.comments_for_html', article_link: link_to(h(@comment.article.title), controller: '/admin/articles', action: 'edit', id: @comment.article.id).html_safe) %>
|
4
4
|
</h2>
|
5
5
|
<% end %>
|
6
6
|
|
7
7
|
<%= form_tag action: 'update', id: @comment.id do %>
|
8
8
|
|
9
|
-
<%=
|
9
|
+
<%= render 'shared/flash', flash: flash %>
|
10
|
+
<% if @comment.errors.any? %>
|
11
|
+
<div id="error_explanation">
|
12
|
+
<h2><%= t("errors.template.header", model: 'comment', count: @comment.errors.count) %></h2>
|
13
|
+
<p><%= t("errors.template.body") %></p>
|
14
|
+
<ul>
|
15
|
+
<% @comment.errors.full_messages.each do |message| %>
|
16
|
+
<li><%= message %></li>
|
17
|
+
<% end %>
|
18
|
+
</ul>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
21
|
+
|
10
22
|
<%= hidden_field_tag 'article_id', @article.id %>
|
11
23
|
|
12
24
|
<fieldset>
|