publify_core 9.2.10 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 315c96f6777f5d761c19b1b78a37aa38fdddb337522c56059813be2340f835cd
|
|
4
|
+
data.tar.gz: cd54077be1d63bfd63e385e2dd61e2f23e2928ba3e19ef9aa04f69ab94e00263
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: af4a6c89bc46ba69993175cbc0245c8cda50e5818a0d809322c5ff9a3431848c8c3b1e5b38db15e8a1ec2e226f3127978b25d312c4e91039af436eba950d2889
|
|
7
|
+
data.tar.gz: 114fd493221442b2d93dd40cf8c2766cd7b18e1d07a843fe14b605a44e1745a38b4481ccf4f83bf24afd378bb7d525ebd812e4b2bb8dfef3bcff6b7b18db13ba
|
data/CHANGELOG.md
CHANGED
|
@@ -1,33 +1,72 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 10.0.0 / 2023-06-25
|
|
4
|
+
|
|
5
|
+
### Updated dependencies
|
|
6
|
+
|
|
7
|
+
* Upgrade to Rails 6.1 and Ruby 2.7 to 3.2
|
|
8
|
+
[publify#987](https://github.com/publify/publify/pull/987),
|
|
9
|
+
[publify#1014](https://github.com/publify/publify/pull/1014),
|
|
10
|
+
[publify_core#71](https://github.com/publify/publify_core/pull/71), and
|
|
11
|
+
[publify_core#78](https://github.com/publify/publify_core/pull/78)
|
|
12
|
+
* Update various other dependencies (various pull requests)
|
|
13
|
+
|
|
14
|
+
### Breaking changes
|
|
15
|
+
|
|
16
|
+
* Remove support for Textile as a text format [publify#1001](https://github.com/publify/publify/pull/1001)
|
|
17
|
+
|
|
18
|
+
### Other changes
|
|
19
|
+
|
|
20
|
+
* Improve feedback listings [publify#1005](https://github.com/publify/publify/pull/1005)
|
|
21
|
+
* Link to article from article feedback admin page [publify#1007](https://github.com/publify/publify/pull/1007)
|
|
22
|
+
* Link to blog from admin menu [publify#1008](https://github.com/publify/publify/pull/1008)
|
|
23
|
+
* Handle markdown links in notes correctly [publify#1009](https://github.com/publify/publify/pull/1009)
|
|
24
|
+
* Make notes twitterfilter robust [publify#1010](https://github.com/publify/publify/pull/1010)
|
|
25
|
+
* Miscellaneous admin fixes [publify#1012](https://github.com/publify/publify/pull/1012)
|
|
26
|
+
* Add arabic language to the project [publify#1060](https://github.com/publify/publify/pull/1060) by [ahmedhamid13](https://github.com/ahmedhamid13)
|
|
27
|
+
|
|
28
|
+
### Internal changes
|
|
29
|
+
|
|
30
|
+
* Remove use of 'notextile' [publify#1002](https://github.com/publify/publify/pull/1002)
|
|
31
|
+
* Remove `TextFilter.filter_text` in favor of `#filter_text` [publify#1003](https://github.com/publify/publify/pull/1003)
|
|
32
|
+
* Replace BlueCloth with CommonMarker for Markdown processing [publify#810](https://github.com/publify/publify/pull/810)
|
|
33
|
+
* Rename Admin::ContentController to Admin::ArticlesController [publify#1004](https://github.com/publify/publify/pull/1004)
|
|
34
|
+
* Remove unneeded wrapping elements from admin layout [publify#1006](https://github.com/publify/publify/pull/1006)
|
|
35
|
+
* Split the factories into individual files [publify#1031](https://github.com/publify/publify/pull/1031) by [VictorPS](https://github.com/VictorPS)
|
|
36
|
+
* Ensure `auto_link` helper is loaded on time [publify#1040](https://github.com/publify/publify/pull/1040)
|
|
37
|
+
* Remove `sitealizer` table [publify#1089](https://github.com/publify/publify/pull/1089) by [SupriyaMedankar](https://github.com/SupriyaMedankar)
|
|
38
|
+
* Remove itunes fields from resources [publify#1092](https://github.com/publify/publify/pull/1092) by [SupriyaMedankar](https://github.com/SupriyaMedankar)
|
|
39
|
+
* Remove `page_caches` table [publify#1090](https://github.com/publify/publify/pull/1090) by [SupriyaMedankar](https://github.com/SupriyaMedankar)
|
|
40
|
+
* Remove obsolete Sidebar code [publify#58](https://github.com/publify/publify/pull/58)
|
|
41
|
+
|
|
3
42
|
## 9.2.10 / 2023-01-08
|
|
4
43
|
|
|
5
|
-
* Bump Rails version to 5.2.8.1 [#1070](https://github.com/publify/publify/pull/1070)
|
|
6
|
-
* Limit length of settings values [#1072](https://github.com/publify/publify/pull/1072)
|
|
7
|
-
* Require login to stay unique when updating a User [#1073](https://github.com/publify/publify/pull/1073)
|
|
8
|
-
* Validate lengths of string attributes [#1077](https://github.com/publify/publify/pull/1077)
|
|
9
|
-
* Strip EXIF data from resource uploads [#1078](https://github.com/publify/publify/pull/1078)
|
|
10
|
-
* Require user passwords to be strong [#1086](https://github.com/publify/publify/pull/1086)
|
|
44
|
+
* Bump Rails version to 5.2.8.1 [publify#1070](https://github.com/publify/publify/pull/1070)
|
|
45
|
+
* Limit length of settings values [publify#1072](https://github.com/publify/publify/pull/1072)
|
|
46
|
+
* Require login to stay unique when updating a User [publify#1073](https://github.com/publify/publify/pull/1073)
|
|
47
|
+
* Validate lengths of string attributes [publify#1077](https://github.com/publify/publify/pull/1077)
|
|
48
|
+
* Strip EXIF data from resource uploads [publify#1078](https://github.com/publify/publify/pull/1078)
|
|
49
|
+
* Require user passwords to be strong [publify#1086](https://github.com/publify/publify/pull/1086)
|
|
11
50
|
|
|
12
51
|
## 9.2.9 / 2022-05-22
|
|
13
52
|
|
|
14
|
-
* Fix admin article access control [#1065](https://github.com/publify/publify/pull/1065)
|
|
15
|
-
* Refuse html files as resources even if declared to be plain text [#1066](https://github.com/publify/publify/pull/1066)
|
|
53
|
+
* Fix admin article access control [publify#1065](https://github.com/publify/publify/pull/1065)
|
|
54
|
+
* Refuse html files as resources even if declared to be plain text [publify#1066](https://github.com/publify/publify/pull/1066)
|
|
16
55
|
|
|
17
56
|
## 9.2.8 / 2022-05-14
|
|
18
57
|
|
|
19
|
-
* Fix password protected article reveal [#1049](https://github.com/publify/publify/pull/1049)
|
|
20
|
-
* Disallow comments on draft articles [#1048](https://github.com/publify/publify/pull/1048)
|
|
21
|
-
* Clean up Feedback validation [#1051](https://github.com/publify/publify/pull/1051)
|
|
22
|
-
* Disallow images in comments [#1054](https://github.com/publify/publify/pull/1054)
|
|
23
|
-
* Fix password reset process [#1055](https://github.com/publify/publify/pull/1055)
|
|
24
|
-
* Hide bodies of password-protected articles in search results [#1057](https://github.com/publify/publify/pull/1057)
|
|
25
|
-
* Provide correct `article_id` input in bulkops form [#1058](https://github.com/publify/publify/pull/1058)
|
|
26
|
-
* Do not create article meta description for password-protected articles [#1061](https://github.com/publify/publify/pull/1061)
|
|
58
|
+
* Fix password protected article reveal [publify#1049](https://github.com/publify/publify/pull/1049)
|
|
59
|
+
* Disallow comments on draft articles [publify#1048](https://github.com/publify/publify/pull/1048)
|
|
60
|
+
* Clean up Feedback validation [publify#1051](https://github.com/publify/publify/pull/1051)
|
|
61
|
+
* Disallow images in comments [publify#1054](https://github.com/publify/publify/pull/1054)
|
|
62
|
+
* Fix password reset process [publify#1055](https://github.com/publify/publify/pull/1055)
|
|
63
|
+
* Hide bodies of password-protected articles in search results [publify#1057](https://github.com/publify/publify/pull/1057)
|
|
64
|
+
* Provide correct `article_id` input in bulkops form [publify#1058](https://github.com/publify/publify/pull/1058)
|
|
65
|
+
* Do not create article meta description for password-protected articles [publify#1061](https://github.com/publify/publify/pull/1061)
|
|
27
66
|
|
|
28
67
|
## 9.2.7 / 2022-02-07
|
|
29
68
|
|
|
30
|
-
* Fix setting the article password from the Admin [#1044](https://github.com/publify/publify/pull/1044)
|
|
69
|
+
* Fix setting the article password from the Admin [publify#1044](https://github.com/publify/publify/pull/1044)
|
|
31
70
|
|
|
32
71
|
## 9.2.6 / 2022-01-07
|
|
33
72
|
|
|
@@ -57,7 +96,7 @@ Additionally, it includes the following changes:
|
|
|
57
96
|
## 9.2.3 / 2021-05-22
|
|
58
97
|
|
|
59
98
|
* Bump Rails dependency to 5.2.6
|
|
60
|
-
* Replace mimemagic with marcel
|
|
99
|
+
* Replace mimemagic with marcel [publify#996](https://github.com/publify/publify/pull/996)
|
|
61
100
|
|
|
62
101
|
## 9.2.2 / 2021-03-21
|
|
63
102
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
window._lang = "ar_AR" ;
|
|
2
|
+
window._l10s = window._l10s || { } ;
|
|
3
|
+
window._l10s["ar_AR"] = {
|
|
4
|
+
|
|
5
|
+
"#{0} from now": "#{0} من الآن",
|
|
6
|
+
"#{0} ago": "#{0} منذ",
|
|
7
|
+
"on #{0}": "خلال #{0}",
|
|
8
|
+
"less than a minute": "أقل من دفيقة",
|
|
9
|
+
"#{0} minute": "#{0} دقيقة",
|
|
10
|
+
"#{0} minutes": "#{0} دقائق",
|
|
11
|
+
"about one hour": "خلال ساعة",
|
|
12
|
+
"#{0} hours": "#{0} ساعات",
|
|
13
|
+
"one day": "يوم",
|
|
14
|
+
"about one day": "خلال يوم",
|
|
15
|
+
"#{0} days": "#{0} أيام"
|
|
16
|
+
|
|
17
|
+
} ;
|
|
@@ -4,11 +4,11 @@ require "base64"
|
|
|
4
4
|
|
|
5
5
|
module Admin; end
|
|
6
6
|
|
|
7
|
-
class Admin::
|
|
7
|
+
class Admin::ArticlesController < Admin::BaseController
|
|
8
8
|
def index
|
|
9
9
|
@search = params[:search] || {}
|
|
10
|
-
@articles = this_blog.articles.search_with(@search).page(params[:page])
|
|
11
|
-
per(this_blog.admin_display_elements)
|
|
10
|
+
@articles = this_blog.articles.search_with(@search).page(params[:page])
|
|
11
|
+
.per(this_blog.admin_display_elements)
|
|
12
12
|
|
|
13
13
|
if request.xhr?
|
|
14
14
|
respond_to do |format|
|
|
@@ -29,7 +29,7 @@ class Admin::ContentController < Admin::BaseController
|
|
|
29
29
|
return unless access_granted?(params[:id])
|
|
30
30
|
|
|
31
31
|
@article = Article.find(params[:id])
|
|
32
|
-
@article.
|
|
32
|
+
@article.text_filter_name ||= default_text_filter
|
|
33
33
|
@article.keywords = Tag.collection_to_string @article.tags
|
|
34
34
|
load_resources
|
|
35
35
|
render layout: "editor"
|
|
@@ -48,7 +48,7 @@ class Admin::ContentController < Admin::BaseController
|
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
if @article.save
|
|
51
|
-
flash[:success] = I18n.t("admin.
|
|
51
|
+
flash[:success] = I18n.t("admin.articles.create.success")
|
|
52
52
|
redirect_to action: "index"
|
|
53
53
|
else
|
|
54
54
|
@article.keywords = Tag.collection_to_string @article.tags
|
|
@@ -79,7 +79,7 @@ class Admin::ContentController < Admin::BaseController
|
|
|
79
79
|
|
|
80
80
|
if @article.save
|
|
81
81
|
Article.where(parent_id: @article.id).map(&:destroy) unless @article.draft
|
|
82
|
-
flash[:success] = I18n.t("admin.
|
|
82
|
+
flash[:success] = I18n.t("admin.articles.update.success")
|
|
83
83
|
redirect_to action: "index"
|
|
84
84
|
else
|
|
85
85
|
@article.keywords = Tag.collection_to_string @article.tags
|
|
@@ -113,7 +113,7 @@ class Admin::ContentController < Admin::BaseController
|
|
|
113
113
|
@article.author = current_user
|
|
114
114
|
@article.save_attachments!(params[:attachments])
|
|
115
115
|
@article.state = "draft" unless @article.withdrawn?
|
|
116
|
-
@article.
|
|
116
|
+
@article.text_filter_name ||= default_text_filter
|
|
117
117
|
|
|
118
118
|
if @article.title.blank?
|
|
119
119
|
lastid = Article.order("id desc").first.id
|
|
@@ -121,7 +121,7 @@ class Admin::ContentController < Admin::BaseController
|
|
|
121
121
|
end
|
|
122
122
|
|
|
123
123
|
if @article.save
|
|
124
|
-
flash[:success] = I18n.t("admin.
|
|
124
|
+
flash[:success] = I18n.t("admin.articles.autosave.success")
|
|
125
125
|
@must_update_calendar =
|
|
126
126
|
(params[:article][:published_at] and
|
|
127
127
|
params[:article][:published_at].to_time.to_i < Time.zone.now.to_time.to_i and
|
|
@@ -157,7 +157,7 @@ class Admin::ContentController < Admin::BaseController
|
|
|
157
157
|
if article.access_by? current_user
|
|
158
158
|
true
|
|
159
159
|
else
|
|
160
|
-
flash[:error] = I18n.t("admin.
|
|
160
|
+
flash[:error] = I18n.t("admin.articles.access_granted.error")
|
|
161
161
|
redirect_to action: "index"
|
|
162
162
|
false
|
|
163
163
|
end
|
|
@@ -171,23 +171,23 @@ class Admin::ContentController < Admin::BaseController
|
|
|
171
171
|
end
|
|
172
172
|
|
|
173
173
|
def update_params
|
|
174
|
-
params
|
|
175
|
-
require(:article)
|
|
176
|
-
permit(:allow_comments,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
174
|
+
params
|
|
175
|
+
.require(:article)
|
|
176
|
+
.permit(:allow_comments,
|
|
177
|
+
:allow_pings,
|
|
178
|
+
:body,
|
|
179
|
+
:body_and_extended,
|
|
180
|
+
:draft,
|
|
181
|
+
:extended,
|
|
182
|
+
:password,
|
|
183
|
+
:permalink,
|
|
184
|
+
:published_at,
|
|
185
|
+
:text_filter_name,
|
|
186
|
+
:title,
|
|
187
|
+
:keywords)
|
|
188
188
|
end
|
|
189
189
|
|
|
190
190
|
def default_text_filter
|
|
191
|
-
current_user.
|
|
191
|
+
current_user.text_filter_name || this_blog.text_filter
|
|
192
192
|
end
|
|
193
193
|
end
|
|
@@ -18,15 +18,15 @@ class Admin::DashboardController < Admin::BaseController
|
|
|
18
18
|
@statsdrafts = Article.drafts.where("created_at > ?", today).count
|
|
19
19
|
@statspages = Page.where("published_at > ?", today).count
|
|
20
20
|
@statuses = Note.where("published_at > ?", today).count
|
|
21
|
-
@statuserposts = Article.published.where("published_at > ?", today)
|
|
22
|
-
where(user_id: current_user.id).count
|
|
21
|
+
@statuserposts = Article.published.where("published_at > ?", today)
|
|
22
|
+
.where(user_id: current_user.id).count
|
|
23
23
|
@statcomments = Comment.where("created_at > ?", today).count
|
|
24
24
|
@presumedspam = Comment.presumed_spam.where("created_at > ?", today).count
|
|
25
25
|
@confirmed = Comment.ham.where("created_at > ?", today).count
|
|
26
26
|
@unconfirmed = Comment.unconfirmed.where("created_at > ?", today).count
|
|
27
27
|
|
|
28
28
|
@comments = Comment.last_published
|
|
29
|
-
@drafts = Article.drafts.where(
|
|
29
|
+
@drafts = Article.drafts.where(user_id: current_user.id).limit(5)
|
|
30
30
|
|
|
31
31
|
@statspam = Comment.spam.count
|
|
32
32
|
end
|
|
@@ -16,20 +16,13 @@ class Admin::FeedbackController < Admin::BaseController
|
|
|
16
16
|
@feedback = scoped_feedback.paginated(params[:page], this_blog.admin_display_elements)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def
|
|
20
|
-
@
|
|
21
|
-
|
|
22
|
-
unless @
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
begin
|
|
27
|
-
@record.destroy
|
|
28
|
-
flash[:success] = I18n.t("admin.feedback.destroy.success")
|
|
29
|
-
rescue ActiveRecord::RecordNotFound
|
|
30
|
-
flash[:error] = I18n.t("admin.feedback.destroy.error")
|
|
19
|
+
def edit
|
|
20
|
+
@comment = Comment.find(params[:id])
|
|
21
|
+
@article = @comment.article
|
|
22
|
+
unless @article.access_by? current_user
|
|
23
|
+
redirect_to admin_feedback_index_url
|
|
24
|
+
nil
|
|
31
25
|
end
|
|
32
|
-
redirect_to action: "article", id: @record.article.id
|
|
33
26
|
end
|
|
34
27
|
|
|
35
28
|
def create
|
|
@@ -47,15 +40,6 @@ class Admin::FeedbackController < Admin::BaseController
|
|
|
47
40
|
redirect_to action: "article", id: @article.id
|
|
48
41
|
end
|
|
49
42
|
|
|
50
|
-
def edit
|
|
51
|
-
@comment = Comment.find(params[:id])
|
|
52
|
-
@article = @comment.article
|
|
53
|
-
unless @article.access_by? current_user
|
|
54
|
-
redirect_to admin_feedback_index_url
|
|
55
|
-
nil
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
43
|
def update
|
|
60
44
|
comment = Comment.find(params[:id])
|
|
61
45
|
unless comment.article.access_by? current_user
|
|
@@ -71,6 +55,22 @@ class Admin::FeedbackController < Admin::BaseController
|
|
|
71
55
|
end
|
|
72
56
|
end
|
|
73
57
|
|
|
58
|
+
def destroy
|
|
59
|
+
@record = Feedback.find params[:id]
|
|
60
|
+
|
|
61
|
+
unless @record.article.user_id == current_user.id
|
|
62
|
+
return redirect_to admin_feedback_index_url unless current_user.admin?
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
begin
|
|
66
|
+
@record.destroy
|
|
67
|
+
flash[:success] = I18n.t("admin.feedback.destroy.success")
|
|
68
|
+
rescue ActiveRecord::RecordNotFound
|
|
69
|
+
flash[:error] = I18n.t("admin.feedback.destroy.error")
|
|
70
|
+
end
|
|
71
|
+
redirect_to action: "article", id: @record.article.id
|
|
72
|
+
end
|
|
73
|
+
|
|
74
74
|
def article
|
|
75
75
|
@article = this_blog.articles.find(params[:id])
|
|
76
76
|
@feedback = @article.comments
|
|
@@ -125,7 +125,7 @@ class Admin::FeedbackController < Admin::BaseController
|
|
|
125
125
|
count: ids.size)
|
|
126
126
|
when "Delete all spam"
|
|
127
127
|
if request.post?
|
|
128
|
-
Feedback.where(
|
|
128
|
+
Feedback.where(state: "spam").delete_all
|
|
129
129
|
flash[:success] = I18n.t("admin.feedback.bulkops.success_deleted_spam")
|
|
130
130
|
end
|
|
131
131
|
else
|
|
@@ -8,8 +8,8 @@ class Admin::PagesController < Admin::BaseController
|
|
|
8
8
|
|
|
9
9
|
def index
|
|
10
10
|
@search = params[:search] || {}
|
|
11
|
-
@pages = Page.search_with(@search).page(params[:page])
|
|
12
|
-
per(this_blog.admin_display_elements)
|
|
11
|
+
@pages = Page.search_with(@search).page(params[:page])
|
|
12
|
+
.per(this_blog.admin_display_elements)
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def new
|
|
@@ -16,7 +16,9 @@ class Admin::PostTypesController < Admin::BaseController
|
|
|
16
16
|
@post_type = PostType.new(post_type_params)
|
|
17
17
|
|
|
18
18
|
if @post_type.save
|
|
19
|
-
|
|
19
|
+
flash[:notice] = I18n.t("admin.base.successfully_created",
|
|
20
|
+
name: PostType.model_name.human)
|
|
21
|
+
redirect_to admin_post_types_url
|
|
20
22
|
else
|
|
21
23
|
render :index
|
|
22
24
|
end
|
|
@@ -24,7 +26,9 @@ class Admin::PostTypesController < Admin::BaseController
|
|
|
24
26
|
|
|
25
27
|
def update
|
|
26
28
|
if @post_type.update(post_type_params)
|
|
27
|
-
|
|
29
|
+
flash[:notice] = I18n.t("admin.base.successfully_updated",
|
|
30
|
+
name: PostType.model_name.human)
|
|
31
|
+
redirect_to admin_post_types_url
|
|
28
32
|
else
|
|
29
33
|
render :edit
|
|
30
34
|
end
|
|
@@ -34,13 +38,15 @@ class Admin::PostTypesController < Admin::BaseController
|
|
|
34
38
|
# Reset all Articles from the PostType we're destroying to the default PostType
|
|
35
39
|
# Wrap it in a transaction for safety
|
|
36
40
|
@post_type.transaction do
|
|
37
|
-
Article.where(
|
|
41
|
+
Article.where(post_type: @post_type.permalink).each do |article|
|
|
38
42
|
article.post_type = "read"
|
|
39
43
|
article.save
|
|
40
44
|
end
|
|
41
45
|
@post_type.destroy
|
|
42
46
|
end
|
|
43
|
-
|
|
47
|
+
flash[:notice] = I18n.t("admin.base.successfully_deleted",
|
|
48
|
+
name: PostType.model_name.human)
|
|
49
|
+
redirect_to admin_post_types_url
|
|
44
50
|
end
|
|
45
51
|
|
|
46
52
|
private
|
|
@@ -4,21 +4,23 @@ class Admin::RedirectsController < Admin::BaseController
|
|
|
4
4
|
before_action :set_redirect, only: [:edit, :update, :destroy]
|
|
5
5
|
|
|
6
6
|
def index
|
|
7
|
-
@redirects = Redirect.where(content_id: nil).order("id desc").page(params[:page])
|
|
8
|
-
per(this_blog.admin_display_elements)
|
|
7
|
+
@redirects = Redirect.where(content_id: nil).order("id desc").page(params[:page])
|
|
8
|
+
.per(this_blog.admin_display_elements)
|
|
9
9
|
@redirect = Redirect.new
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def edit
|
|
13
|
-
@redirects = Redirect.where(content_id: nil).order("id desc").page(params[:page])
|
|
14
|
-
per(this_blog.admin_display_elements)
|
|
13
|
+
@redirects = Redirect.where(content_id: nil).order("id desc").page(params[:page])
|
|
14
|
+
.per(this_blog.admin_display_elements)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def create
|
|
18
18
|
@redirect = this_blog.redirects.build(redirect_params)
|
|
19
19
|
|
|
20
20
|
if @redirect.save
|
|
21
|
-
|
|
21
|
+
flash[:notice] = I18n.t("admin.base.successfully_created",
|
|
22
|
+
name: Redirect.model_name.human)
|
|
23
|
+
redirect_to admin_redirects_url
|
|
22
24
|
else
|
|
23
25
|
render :index
|
|
24
26
|
end
|
|
@@ -26,7 +28,9 @@ class Admin::RedirectsController < Admin::BaseController
|
|
|
26
28
|
|
|
27
29
|
def update
|
|
28
30
|
if @redirect.update(redirect_params)
|
|
29
|
-
|
|
31
|
+
flash[:notice] = I18n.t("admin.base.successfully_updated",
|
|
32
|
+
name: Redirect.model_name.human)
|
|
33
|
+
redirect_to admin_redirects_url
|
|
30
34
|
else
|
|
31
35
|
render :edit
|
|
32
36
|
end
|
|
@@ -18,8 +18,8 @@ class Admin::ResourcesController < Admin::BaseController
|
|
|
18
18
|
|
|
19
19
|
def index
|
|
20
20
|
@r = Resource.new
|
|
21
|
-
@resources = Resource.order("created_at DESC").page(params[:page])
|
|
22
|
-
per(this_blog.admin_display_elements)
|
|
21
|
+
@resources = Resource.order("created_at DESC").page(params[:page])
|
|
22
|
+
.per(this_blog.admin_display_elements)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def destroy
|
|
@@ -45,8 +45,8 @@ class Admin::SidebarController < Admin::BaseController
|
|
|
45
45
|
# IT'S OVER NINE THOUSAND! considering we'll never reach 9K Sidebar
|
|
46
46
|
# instances or Sidebar specializations
|
|
47
47
|
sidebar = if sidebar_id >= 9000
|
|
48
|
-
SidebarRegistry.available_sidebars[sidebar_id - 9000]
|
|
49
|
-
new(blog: this_blog)
|
|
48
|
+
SidebarRegistry.available_sidebars[sidebar_id - 9000]
|
|
49
|
+
.new(blog: this_blog)
|
|
50
50
|
else
|
|
51
51
|
Sidebar.valid.find(sidebar_id)
|
|
52
52
|
end
|
|
@@ -14,7 +14,9 @@ class Admin::TagsController < Admin::BaseController
|
|
|
14
14
|
@tag = this_blog.tags.new(tag_params)
|
|
15
15
|
|
|
16
16
|
if @tag.save
|
|
17
|
-
|
|
17
|
+
flash[:notice] = I18n.t("admin.base.successfully_created",
|
|
18
|
+
name: PostType.model_name.human)
|
|
19
|
+
redirect_to admin_tags_url
|
|
18
20
|
else
|
|
19
21
|
fetch_tags
|
|
20
22
|
render :index
|
|
@@ -49,7 +51,7 @@ class Admin::TagsController < Admin::BaseController
|
|
|
49
51
|
end
|
|
50
52
|
|
|
51
53
|
def fetch_tags
|
|
52
|
-
@tags = Tag.order("display_name").page(params[:page])
|
|
53
|
-
per(this_blog.admin_display_elements)
|
|
54
|
+
@tags = Tag.order("display_name").page(params[:page])
|
|
55
|
+
.per(this_blog.admin_display_elements)
|
|
54
56
|
end
|
|
55
57
|
end
|
|
@@ -9,8 +9,7 @@ class Admin::ThemesController < Admin::BaseController
|
|
|
9
9
|
@themes = Theme.find_all
|
|
10
10
|
@themes.each do |theme|
|
|
11
11
|
# TODO: Move to Theme
|
|
12
|
-
theme.description_html = TextFilter.filter_text(theme.description
|
|
13
|
-
[:markdown, :smartypants])
|
|
12
|
+
theme.description_html = TextFilter.none.filter_text(theme.description)
|
|
14
13
|
end
|
|
15
14
|
@active = this_blog.current_theme
|
|
16
15
|
end
|
|
@@ -4,8 +4,8 @@ class Admin::UsersController < Admin::BaseController
|
|
|
4
4
|
before_action :set_user, only: [:edit, :update, :destroy]
|
|
5
5
|
|
|
6
6
|
def index
|
|
7
|
-
@users = User.order("login asc").page(params[:page])
|
|
8
|
-
per(this_blog.admin_display_elements)
|
|
7
|
+
@users = User.order("login asc").page(params[:page])
|
|
8
|
+
.per(this_blog.admin_display_elements)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def new
|
|
@@ -29,7 +29,9 @@ class Admin::UsersController < Admin::BaseController
|
|
|
29
29
|
|
|
30
30
|
def update
|
|
31
31
|
if @user.update(update_params)
|
|
32
|
-
|
|
32
|
+
flash[:notice] = I18n.t("admin.base.successfully_updated",
|
|
33
|
+
name: User.model_name.human)
|
|
34
|
+
redirect_to admin_users_url
|
|
33
35
|
else
|
|
34
36
|
render :edit
|
|
35
37
|
end
|
|
@@ -7,7 +7,7 @@ class ArticlesController < ContentController
|
|
|
7
7
|
|
|
8
8
|
layout :theme_layout, except: [:trackback]
|
|
9
9
|
|
|
10
|
-
helper :
|
|
10
|
+
helper :"admin/base"
|
|
11
11
|
|
|
12
12
|
def index
|
|
13
13
|
wanted_types = this_blog.statuses_in_timeline ? ["Article", "Note"] : ["Article"]
|
|
@@ -18,8 +18,8 @@ class ArticlesController < ContentController
|
|
|
18
18
|
else
|
|
19
19
|
this_blog.contents.published_at(params.values_at(:year, :month, :day))
|
|
20
20
|
end
|
|
21
|
-
@articles = articles_base.includes(:user, :resources, :tags)
|
|
22
|
-
where(type: wanted_types).page(params[:page]).per(limit)
|
|
21
|
+
@articles = articles_base.includes(:user, :resources, :tags)
|
|
22
|
+
.where(type: wanted_types).page(params[:page]).per(limit)
|
|
23
23
|
|
|
24
24
|
respond_to do |format|
|
|
25
25
|
format.html do
|
|
@@ -167,8 +167,8 @@ class ArticlesController < ContentController
|
|
|
167
167
|
@comment = Comment.new
|
|
168
168
|
@page_title = this_blog.article_title_template.to_title(@article, this_blog, params)
|
|
169
169
|
if @article.password.blank?
|
|
170
|
-
@description = this_blog.article_desc_template
|
|
171
|
-
to_title(@article, this_blog, params)
|
|
170
|
+
@description = this_blog.article_desc_template
|
|
171
|
+
.to_title(@article, this_blog, params)
|
|
172
172
|
end
|
|
173
173
|
|
|
174
174
|
@keywords = @article.tags.map(&:name).join(", ")
|
|
@@ -7,8 +7,8 @@ class AuthorsController < ContentController
|
|
|
7
7
|
@author = User.find_by(login: params[:id])
|
|
8
8
|
raise ActiveRecord::RecordNotFound unless @author
|
|
9
9
|
|
|
10
|
-
@articles = @author.articles.published.page(params[:page])
|
|
11
|
-
per(this_blog.per_page(params[:format]))
|
|
10
|
+
@articles = @author.articles.published.page(params[:page])
|
|
11
|
+
.per(this_blog.per_page(params[:format]))
|
|
12
12
|
@page_title = this_blog.author_title_template.to_title(@author, this_blog, params)
|
|
13
13
|
@keywords = this_blog.meta_keywords
|
|
14
14
|
@description = this_blog.author_desc_template.to_title(@author, this_blog, params)
|
|
@@ -13,9 +13,6 @@ class BaseController < ApplicationController
|
|
|
13
13
|
|
|
14
14
|
def set_paths
|
|
15
15
|
prepend_view_path this_blog.current_theme.view_path
|
|
16
|
-
Dir.glob(File.join(::Rails.root.to_s, "lib", "*_sidebar/app/views")).select do |file|
|
|
17
|
-
append_view_path file
|
|
18
|
-
end
|
|
19
16
|
end
|
|
20
17
|
|
|
21
18
|
def fire_triggers
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
class FeedbackController < BaseController
|
|
4
4
|
def index
|
|
5
|
-
@feedback = Feedback.ham
|
|
6
|
-
newest_first
|
|
7
|
-
limit(this_blog.per_page(params[:format]))
|
|
5
|
+
@feedback = Feedback.ham
|
|
6
|
+
.newest_first
|
|
7
|
+
.limit(this_blog.per_page(params[:format]))
|
|
8
8
|
respond_to do |format|
|
|
9
9
|
format.atom { render "index", format: "atom" }
|
|
10
10
|
format.rss { render "index", format: "rss" }
|
|
@@ -14,9 +14,9 @@ class TagsController < ContentController
|
|
|
14
14
|
def show
|
|
15
15
|
@tag = Tag.find_by!(name: params[:id])
|
|
16
16
|
|
|
17
|
-
@articles = @tag
|
|
18
|
-
contents.includes(:blog, :user, :tags, :resources)
|
|
19
|
-
published.page(params[:page]).per(10)
|
|
17
|
+
@articles = @tag
|
|
18
|
+
.contents.includes(:blog, :user, :tags, :resources)
|
|
19
|
+
.published.page(params[:page]).per(10)
|
|
20
20
|
|
|
21
21
|
respond_to do |format|
|
|
22
22
|
format.html do
|
data/app/helpers/base_helper.rb
CHANGED
|
@@ -41,8 +41,8 @@ module BaseHelper
|
|
|
41
41
|
controller.send(:render_to_string, *args, &block)
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
def link_to_permalink(item, title,
|
|
45
|
-
only_path
|
|
44
|
+
def link_to_permalink(item, title,
|
|
45
|
+
anchor: nil, style: nil, nofollow: nil, only_path: false)
|
|
46
46
|
options = {}
|
|
47
47
|
options[:class] = style if style
|
|
48
48
|
options[:rel] = "nofollow" if nofollow
|
|
@@ -66,7 +66,7 @@ module BaseHelper
|
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
def meta_tag(name, value)
|
|
69
|
-
tag
|
|
69
|
+
tag.meta(name: name, content: value) if value.present?
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
def markup_help_popup(markup, text)
|
|
@@ -226,8 +226,8 @@ module BaseHelper
|
|
|
226
226
|
# show the excerpt, or else we show the body
|
|
227
227
|
def fetch_html_content_for_feeds(item, this_blog)
|
|
228
228
|
if item.password_protected?
|
|
229
|
-
"<p>This article is password protected. Please
|
|
230
|
-
"<a href='#{item.permalink_url}'>fill in your password</a> to read it</p>"
|
|
229
|
+
"<p>This article is password protected. Please" \
|
|
230
|
+
" <a href='#{item.permalink_url}'>fill in your password</a> to read it</p>"
|
|
231
231
|
elsif this_blog.hide_extended_on_rss
|
|
232
232
|
if item.excerpt? && !item.excerpt.empty?
|
|
233
233
|
item.excerpt
|
|
@@ -248,7 +248,7 @@ module BaseHelper
|
|
|
248
248
|
followify_scrubber = Loofah::Scrubber.new do |node|
|
|
249
249
|
node.set_attribute "rel", "nofollow" if node.name == "a"
|
|
250
250
|
end
|
|
251
|
-
sanitize
|
|
251
|
+
sanitize string, scrubber: followify_scrubber
|
|
252
252
|
end
|
|
253
253
|
end
|
|
254
254
|
|