publify_core 9.0.0.pre6 → 9.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.
Files changed (176) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +44 -0
  3. data/README.md +9 -0
  4. data/app/controllers/admin/base_controller.rb +0 -6
  5. data/app/controllers/admin/content_controller.rb +34 -15
  6. data/app/controllers/admin/dashboard_controller.rb +4 -9
  7. data/app/controllers/admin/feedback_controller.rb +1 -0
  8. data/app/controllers/admin/notes_controller.rb +1 -1
  9. data/app/controllers/admin/pages_controller.rb +3 -7
  10. data/app/controllers/admin/sidebar_controller.rb +1 -0
  11. data/app/controllers/admin/tags_controller.rb +1 -0
  12. data/app/controllers/articles_controller.rb +50 -55
  13. data/app/controllers/comments_controller.rb +2 -3
  14. data/app/controllers/content_controller.rb +8 -17
  15. data/app/controllers/feedback_controller.rb +5 -39
  16. data/app/controllers/notes_controller.rb +1 -3
  17. data/app/controllers/setup_controller.rb +14 -18
  18. data/app/controllers/tags_controller.rb +13 -15
  19. data/app/controllers/theme_controller.rb +7 -5
  20. data/app/controllers/xml_controller.rb +11 -59
  21. data/app/helpers/authors_helper.rb +2 -2
  22. data/app/helpers/base_helper.rb +11 -4
  23. data/app/helpers/xml_helper.rb +2 -2
  24. data/app/jobs/application_job.rb +2 -0
  25. data/app/models/archives_sidebar.rb +8 -11
  26. data/app/models/article.rb +53 -72
  27. data/app/models/article/factory.rb +1 -1
  28. data/app/models/blog.rb +17 -40
  29. data/app/models/comment.rb +4 -3
  30. data/app/models/content.rb +18 -21
  31. data/app/models/content_base.rb +0 -5
  32. data/app/models/feedback.rb +76 -54
  33. data/app/models/meta_sidebar.rb +1 -0
  34. data/app/models/note.rb +7 -0
  35. data/app/models/page.rb +10 -5
  36. data/app/models/ping.rb +0 -113
  37. data/app/models/post_type.rb +1 -0
  38. data/app/models/redirect.rb +1 -1
  39. data/app/models/resource.rb +1 -19
  40. data/app/models/sidebar.rb +1 -1
  41. data/app/models/static_sidebar.rb +1 -0
  42. data/app/models/tag.rb +13 -9
  43. data/app/models/tag_sidebar.rb +4 -4
  44. data/app/models/trackback.rb +1 -8
  45. data/app/models/trigger.rb +1 -15
  46. data/app/models/user.rb +2 -9
  47. data/app/uploaders/resource_uploader.rb +33 -2
  48. data/app/views/accounts/confirm.html.erb +0 -1
  49. data/app/views/admin/content/_article_list.html.erb +1 -1
  50. data/app/views/admin/content/_form.html.erb +3 -7
  51. data/app/views/admin/pages/_form.html.erb +2 -2
  52. data/app/views/admin/seo/_general.html.erb +33 -28
  53. data/app/views/admin/seo/_permalinks.html.erb +2 -2
  54. data/app/views/admin/seo/_titles.html.erb +36 -36
  55. data/app/views/admin/settings/display.html.erb +20 -27
  56. data/app/views/admin/settings/feedback.html.erb +44 -51
  57. data/app/views/admin/settings/index.html.erb +14 -14
  58. data/app/views/admin/settings/write.html.erb +12 -30
  59. data/app/views/admin/tags/_index_and_form.html.erb +1 -1
  60. data/app/views/articles/_archives_article.html.erb +9 -0
  61. data/app/views/articles/_article.html.erb +8 -6
  62. data/app/views/articles/_article_collection.html.erb +1 -1
  63. data/app/views/articles/_article_excerpt.html.erb +10 -8
  64. data/app/views/articles/_article_links.html.erb +4 -2
  65. data/app/views/articles/_comment_list.html.erb +5 -5
  66. data/app/views/articles/_full_article_content.html.erb +4 -2
  67. data/app/views/articles/archives.html.erb +10 -20
  68. data/app/views/articles/feedback_atom_feed.atom.builder +5 -5
  69. data/app/views/articles/feedback_rss_feed.rss.builder +12 -13
  70. data/app/views/articles/index_atom_feed.atom.builder +3 -4
  71. data/app/views/articles/index_rss_feed.rss.builder +9 -10
  72. data/app/views/articles/read.html.erb +5 -31
  73. data/app/views/articles/search.html.erb +1 -1
  74. data/app/views/articles/trackback.xml.builder +1 -1
  75. data/app/views/authors/show.html.erb +11 -21
  76. data/app/views/authors/show_atom_feed.atom.builder +3 -4
  77. data/app/views/authors/show_rss_feed.rss.builder +9 -10
  78. data/app/views/comments/_comment.html.erb +17 -16
  79. data/app/views/feedback/index.atom.builder +7 -0
  80. data/app/views/feedback/index.rss.builder +19 -0
  81. data/app/views/notes/_note.html.erb +16 -15
  82. data/app/views/notes/index.html.erb +1 -1
  83. data/app/views/notification_mailer/_mail_footer.html.erb +0 -2
  84. data/app/views/notification_mailer/_mail_header.html.erb +2 -0
  85. data/app/views/notification_mailer/article.html.erb +4 -3
  86. data/app/views/notification_mailer/comment.html.erb +7 -6
  87. data/app/views/notification_mailer/notif_user.html.erb +3 -8
  88. data/app/views/setup/index.html.erb +4 -0
  89. data/app/views/shared/_atom_header.atom.builder +3 -3
  90. data/app/views/shared/_atom_item_article.atom.builder +26 -19
  91. data/app/views/shared/_atom_item_comment.atom.builder +3 -5
  92. data/app/views/shared/_atom_item_trackback.atom.builder +3 -4
  93. data/app/views/shared/_page_header.html.erb +1 -1
  94. data/app/views/shared/_rss_item_article.rss.builder +10 -15
  95. data/app/views/shared/_rss_item_comment.rss.builder +1 -2
  96. data/app/views/shared/_rss_item_trackback.rss.builder +1 -1
  97. data/app/views/tags/index.html.erb +2 -2
  98. data/app/views/xml/sitemap.googlesitemap.builder +7 -0
  99. data/config/initializers/mime_types.rb +0 -1
  100. data/config/locales/da.yml +8 -37
  101. data/config/locales/de.yml +7 -36
  102. data/config/locales/en.yml +7 -36
  103. data/config/locales/es-MX.yml +8 -37
  104. data/config/locales/fr.yml +7 -36
  105. data/config/locales/he.yml +4 -33
  106. data/config/locales/it.yml +7 -36
  107. data/config/locales/ja.yml +5 -34
  108. data/config/locales/lt.yml +7 -36
  109. data/config/locales/nb-NO.yml +7 -36
  110. data/config/locales/nl.yml +9 -38
  111. data/config/locales/pl.yml +8 -37
  112. data/config/locales/pt-BR.yml +8 -37
  113. data/config/locales/ro.yml +9 -38
  114. data/config/locales/ru.yml +7 -36
  115. data/config/locales/zh-CN.yml +6 -35
  116. data/config/locales/zh-TW.yml +7 -36
  117. data/config/routes.rb +6 -28
  118. data/db/migrate/113_initial_schema.rb +191 -191
  119. data/db/migrate/114_fixes_buggy_articles_and_notes.rb +6 -7
  120. data/db/migrate/115_drops_categories_for_tags.rb +3 -3
  121. data/db/migrate/20150207131657_add_missing_indexes.rb +1 -1
  122. data/db/migrate/20150807134129_simplify_redirect_relations.rb +1 -1
  123. data/db/migrate/20150808052637_add_blog_ids.rb +3 -5
  124. data/db/migrate/20150808191127_add_blog_id_to_redirects.rb +1 -1
  125. data/db/migrate/20150810094754_add_blog_id_to_tags.rb +1 -1
  126. data/db/migrate/20160108111120_add_devise_to_users.rb +3 -3
  127. data/db/migrate/20160108184201_move_last_connection_to_last_sign_in_at.rb +1 -1
  128. data/db/migrate/20160110094906_remove_profiles_rights.rb +1 -1
  129. data/db/migrate/20160605103918_replace_profile_id_with_string.rb +1 -3
  130. data/db/migrate/20160605154632_remove_profiles.rb +2 -2
  131. data/db/migrate/20160701061851_demand_blog_id_on_contents.rb +1 -1
  132. data/db/migrate/20160701062604_add_blog_id_to_resources.rb +1 -1
  133. data/db/migrate/20170528093024_move_resources_to_content.rb +5 -0
  134. data/db/migrate/20170528094923_move_tags_to_content.rb +6 -0
  135. data/db/migrate/20170528201606_remove_separate_published_flag.rb +5 -0
  136. data/db/migrate/20170605071626_remove_extra_state_columns_from_feedback.rb +6 -0
  137. data/db/migrate/20170702105201_remove_published_at_from_feedback.rb +5 -0
  138. data/db/seeds.rb +1 -1
  139. data/lib/publify_core.rb +0 -1
  140. data/lib/publify_core/version.rb +1 -1
  141. data/lib/publify_guid.rb +1 -1
  142. data/lib/publify_time.rb +2 -2
  143. data/lib/sidebar_field.rb +19 -12
  144. data/lib/transforms.rb +1 -0
  145. metadata +102 -66
  146. data/.gitignore +0 -13
  147. data/.rspec +0 -2
  148. data/.rubocop.yml +0 -84
  149. data/.rubocop_todo.yml +0 -148
  150. data/.travis.yml +0 -27
  151. data/Gemfile +0 -17
  152. data/README.rdoc +0 -3
  153. data/Rakefile +0 -35
  154. data/app/assets/stylesheets/publify_core/.keep +0 -0
  155. data/app/controllers/.keep +0 -0
  156. data/app/controllers/admin/migrations_controller.rb +0 -19
  157. data/app/controllers/concerns/.keep +0 -0
  158. data/app/controllers/trackbacks_controller.rb +0 -36
  159. data/app/helpers/.keep +0 -0
  160. data/app/mailers/.keep +0 -0
  161. data/app/models/.keep +0 -0
  162. data/app/models/article/states.rb +0 -179
  163. data/app/models/concerns/.keep +0 -0
  164. data/app/models/feedback/states.rb +0 -256
  165. data/app/services/migrator.rb +0 -25
  166. data/app/views/.keep +0 -0
  167. data/app/views/comments/index.html.erb +0 -1
  168. data/app/views/comments/index_atom_feed.atom.builder +0 -8
  169. data/app/views/comments/index_rss_feed.rss.builder +0 -20
  170. data/app/views/trackbacks/index_atom_feed.atom.builder +0 -7
  171. data/app/views/trackbacks/index_rss_feed.rss.builder +0 -20
  172. data/app/views/trackbacks/trackback.xml.builder +0 -4
  173. data/app/views/xml/feed.googlesitemap.builder +0 -7
  174. data/app/views/xml/rsd.rsd.builder +0 -8
  175. data/lib/stateful.rb +0 -106
  176. data/publify_core.gemspec +0 -54
File without changes
@@ -1,256 +0,0 @@
1
- module Feedback::States
2
- class Base < Stateful::State
3
- # Give the default 'model' a more meaningful name
4
- alias content model
5
-
6
- # Callback handlers
7
- def before_save_handler
8
- true
9
- end
10
-
11
- def after_initialize_handler
12
- true
13
- end
14
-
15
- def post_trigger
16
- true
17
- end
18
-
19
- def send_notifications
20
- true
21
- end
22
-
23
- def report_classification
24
- true
25
- end
26
-
27
- def withdraw; end
28
-
29
- def confirm_classification; end
30
-
31
- def mark_as_spam
32
- content.state = :just_marked_as_spam
33
- end
34
-
35
- def mark_as_ham
36
- content.state = :just_marked_as_ham
37
- end
38
- end
39
-
40
- class Unclassified < Base
41
- def after_initialize_handler
42
- enter_hook
43
- true
44
- end
45
-
46
- def enter_hook
47
- super
48
- content[:published] = false
49
- content[:status_confirmed] = false
50
- end
51
-
52
- def published?
53
- classify_content
54
- content.published?
55
- end
56
-
57
- def just_published?
58
- classify_content
59
- content.just_published?
60
- end
61
-
62
- def spam?
63
- classify_content
64
- content.spam?
65
- end
66
-
67
- def classify_content
68
- content.state = case content.classify
69
- when :ham then :just_presumed_ham
70
- when :spam then :presumed_spam
71
- else :presumed_spam
72
- end
73
- end
74
-
75
- def before_save_handler
76
- classify_content
77
- end
78
-
79
- def to_s
80
- 'unclassified'
81
- end
82
- end
83
-
84
- class JustPresumedHam < Base
85
- def enter_hook
86
- super
87
- content.just_changed_published_status = true
88
- content.state = :presumed_ham unless content.user_id
89
- content.state = :just_marked_as_ham if content.user_id
90
- end
91
-
92
- def to_s
93
- 'just_presumed_ham'
94
- end
95
- end
96
-
97
- class PresumedHam < Base
98
- def enter_hook
99
- super
100
- content[:published] = true
101
- content[:status_confirmed] = false
102
- end
103
-
104
- def published?
105
- true
106
- end
107
-
108
- def just_published?
109
- content.just_changed_published_status?
110
- end
111
-
112
- def withdraw
113
- mark_as_spam
114
- end
115
-
116
- def confirm_classification
117
- mark_as_ham
118
- end
119
-
120
- def mark_as_ham
121
- content.state = :ham
122
- end
123
-
124
- def to_s
125
- 'presumed_ham'
126
- end
127
-
128
- def send_notifications
129
- content.really_send_notifications if content.just_changed_published_status
130
- true
131
- end
132
- end
133
-
134
- class JustMarkedAsHam < Base
135
- def enter_hook
136
- super
137
- content.just_changed_published_status = true
138
- content.state = :ham
139
- end
140
-
141
- def to_s
142
- 'just_marked_as_ham'
143
- end
144
- end
145
-
146
- class Ham < Base
147
- def enter_hook
148
- super
149
- content[:published] = true
150
- content[:status_confirmed] = true
151
- end
152
-
153
- def published?
154
- true
155
- end
156
-
157
- def status_confirmed?
158
- true
159
- end
160
-
161
- def mark_as_ham; end
162
-
163
- def just_published?
164
- content.just_changed_published_status?
165
- end
166
-
167
- def withdraw
168
- mark_as_spam
169
- end
170
-
171
- def report_classification
172
- content.report_as_ham if content.just_changed_published_status?
173
- true
174
- end
175
-
176
- def send_notifications
177
- content.really_send_notifications if content.just_changed_published_status?
178
- true
179
- end
180
-
181
- def to_s
182
- 'ham'
183
- end
184
- end
185
-
186
- class PresumedSpam < Base
187
- def enter_hook
188
- super
189
- content[:published] = false
190
- content[:status_confirmed] = false
191
- end
192
-
193
- def spam?
194
- true
195
- end
196
-
197
- def mark_as_ham
198
- content.state = :just_marked_as_ham
199
- end
200
-
201
- def mark_as_spam
202
- content.state = :spam
203
- end
204
-
205
- def withdraw
206
- mark_as_spam
207
- end
208
-
209
- def confirm_classification
210
- mark_as_spam
211
- end
212
-
213
- def to_s
214
- 'presumed_spam'
215
- end
216
- end
217
-
218
- class JustMarkedAsSpam < Base
219
- def enter_hook
220
- super
221
- content.just_changed_published_status = true
222
- content.state = :spam
223
- end
224
-
225
- def to_s
226
- 'just_marked_as_spam'
227
- end
228
- end
229
-
230
- class Spam < Base
231
- def enter_hook
232
- super
233
- content[:published] = false
234
- content[:status_confirmed] = true
235
- end
236
-
237
- def spam?
238
- true
239
- end
240
-
241
- def status_confirmed?
242
- true
243
- end
244
-
245
- def mark_as_spam; end
246
-
247
- def report_classification
248
- content.report_as_spam if content.just_changed_published_status?
249
- true
250
- end
251
-
252
- def to_s
253
- 'spam'
254
- end
255
- end
256
- end
@@ -1,25 +0,0 @@
1
- class Migrator
2
- def current_schema_version
3
- ActiveRecord::Migrator.current_version
4
- end
5
-
6
- def migrations_pending?
7
- pending_migrations.any?
8
- end
9
-
10
- def pending_migrations
11
- all_migrations = ActiveRecord::Migrator.migrations(migrations_paths)
12
- migrator = ActiveRecord::Migrator.new(:up, all_migrations)
13
- migrator.pending_migrations
14
- end
15
-
16
- def migrate
17
- ActiveRecord::Migrator.migrate(migrations_paths)
18
- end
19
-
20
- private
21
-
22
- def migrations_paths
23
- ActiveRecord::Migrator.migrations_paths
24
- end
25
- end
data/app/views/.keep DELETED
File without changes
@@ -1 +0,0 @@
1
- This space intentionally left blank for now
@@ -1,8 +0,0 @@
1
- atom_feed do |feed|
2
- render "shared/atom_header", {feed: feed, items: @items}
3
-
4
- @items.each do |item|
5
- render "shared/atom_item_comment", {feed: feed, item: item}
6
- end
7
- end
8
-
@@ -1,20 +0,0 @@
1
- xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
2
- xml.instruct! 'xml-stylesheet', :type=>"text/css", :href => url_for("/stylesheets/rss.css")
3
-
4
- xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/",
5
- "xmlns:atom" => "http://www.w3.org/2005/Atom",
6
- "xmlns:trackback" => "http://madskills.com/public/xml/rss/module/trackback/" do
7
- xml.channel do
8
- xml.title feed_title
9
- xml.link this_blog.base_url
10
- xml.atom :link, :href => request.url, :rel => 'self', :type => 'application/rss+xml'
11
- xml.language this_blog.lang.gsub("_", "-").downcase
12
- xml.ttl "40"
13
- xml.description this_blog.blog_subtitle
14
-
15
- @items.each do |item|
16
- render "shared/rss_item_comment", {feed: xml, item: item}
17
- end
18
- end
19
- end
20
-
@@ -1,7 +0,0 @@
1
- atom_feed do |feed|
2
- render "shared/atom_header", {feed: feed, items: @items}
3
-
4
- @items.each do |item|
5
- render "shared/atom_item_trackback", {feed: feed, item: item}
6
- end
7
- end
@@ -1,20 +0,0 @@
1
- xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
2
- xml.instruct! 'xml-stylesheet', :type=>"text/css", :href => url_for("/stylesheets/rss.css")
3
-
4
- xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/",
5
- "xmlns:atom" => "http://www.w3.org/2005/Atom",
6
- "xmlns:trackback" => "http://madskills.com/public/xml/rss/module/trackback/" do
7
- xml.channel do
8
- xml.title feed_title
9
- xml.link this_blog.base_url
10
- xml.atom :link, :href => request.url, :rel => 'self', :type => 'application/rss+xml'
11
- xml.language this_blog.lang.gsub("_", "-").downcase
12
- xml.ttl "40"
13
- xml.description this_blog.blog_subtitle
14
-
15
- @items.each do |item|
16
- render "shared/rss_item_trackback", {feed: xml, item: item}
17
- end
18
- end
19
- end
20
-
@@ -1,4 +0,0 @@
1
- xml.instruct! :xml, :version => '1.0', :encoding => 'UTF-8'
2
- xml.response do |res|
3
- res.error 0
4
- end
@@ -1,7 +0,0 @@
1
- xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
2
- xml.urlset "xmlns"=>"http://www.google.com/schemas/sitemap/0.84" do
3
- @items.each do |item|
4
- render "googlesitemap_item_#{item.class.name.to_s.downcase}",
5
- {:item => item, :xm => xml}
6
- end
7
- end
@@ -1,8 +0,0 @@
1
- xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
2
- xml.rsd "version"=>"1.0", "xmlns"=>"http://archipelago.phrasewise.com/rsd" do
3
- xml.service do
4
- xml.engineName "Publify"
5
- xml.engineLink "http://www.publify.co"
6
- xml.homePageLink url_for(:controller => "articles")
7
- end
8
- end
data/lib/stateful.rb DELETED
@@ -1,106 +0,0 @@
1
- module Stateful
2
- class State
3
- def initialize(model)
4
- @model = model
5
- end
6
-
7
- def to_s
8
- self.class.to_s.demodulize
9
- end
10
-
11
- def exit_hook(_target_state)
12
- ::Rails.logger.debug("#{model} leaving state #{self}")
13
- end
14
-
15
- def enter_hook
16
- ::Rails.logger.debug("#{model} entering state #{self}")
17
- end
18
-
19
- def method_missing(predicate, *args)
20
- if predicate.to_s.last == '?'
21
- self.class.to_s.demodulize.underscore == predicate.to_s.chop
22
- else
23
- super
24
- end
25
- end
26
-
27
- def ==(other)
28
- self.class == other.class
29
- end
30
-
31
- def hash
32
- self.class.hash
33
- end
34
-
35
- private
36
-
37
- attr_reader :model
38
- end
39
-
40
- def self.included(base)
41
- base.extend ClassMethods
42
- end
43
-
44
- module ClassMethods
45
- def has_state(field, options = {})
46
- options.assert_valid_keys(:valid_states, :handles, :initial_state)
47
-
48
- unless (states = options[:valid_states])
49
- raise 'You must specify at least one state'
50
- end
51
-
52
- states = states.map(&:to_sym)
53
- delegations = Set.new(options[:handles]) + states.map { |value| "#{value}?" }
54
- initial_state = options[:initial_state] || states.first
55
-
56
- state_writer_method(field, states, initial_state)
57
- state_reader_method(field, states, initial_state)
58
-
59
- delegations.each do |value|
60
- delegate value, to: field
61
- end
62
- end
63
-
64
- def state_reader_method(name, states, initial_state)
65
- module_eval <<-end_meth
66
- def #{name}(force_reload = false)
67
- if @#{name}_obj.nil? || force_reload
68
- memento = read_attribute(#{name.inspect}) || #{initial_state.inspect}
69
- unless #{states.inspect}.include? memento.to_sym
70
- raise \"Invalid state: \#{memento} in the database.\"
71
- end
72
- @#{name}_obj = self.class.class_eval(memento.to_s.classify).new(self)
73
- end
74
- @#{name}_obj
75
- end
76
- end_meth
77
- end
78
-
79
- def state_writer_method(name, states, _initial_state)
80
- module_eval <<-end_meth
81
- def #{name}=(state)
82
- case state
83
- when Symbol
84
- set_#{name}_from_symbol state
85
- when String
86
- set_#{name}_from_symbol state.to_sym
87
- else
88
- raise "You must set the state with a symbol or a string"
89
- end
90
- end
91
-
92
- def set_#{name}_from_symbol(memento)
93
- unless #{states.inspect}.include?(memento)
94
- raise "Invalid state: " + memento
95
- end
96
- self[:#{name}] = memento.to_s
97
- new_state = self.class.class_eval(memento.to_s.classify).new(self)
98
- @#{name}_obj.exit_hook(new_state) if @#{name}_obj
99
- @#{name}_obj = new_state
100
- @#{name}_obj.enter_hook
101
- @#{name}_obj
102
- end
103
- end_meth
104
- end
105
- end
106
- end