fuck_comments 2.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +30 -0
  3. data/.ruby-gemset.example +1 -0
  4. data/.ruby-version.example +1 -0
  5. data/.rvmrc.example +1 -0
  6. data/.travis.yml +5 -0
  7. data/Gemfile +4 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +338 -0
  10. data/Rakefile +1 -0
  11. data/app/assets/javascripts/the_comments.js.coffee +108 -0
  12. data/app/assets/javascripts/the_comments_manage.js.coffee +27 -0
  13. data/app/assets/stylesheets/the_comments.css.scss +248 -0
  14. data/app/controllers/_templates_/comments_controller.rb +44 -0
  15. data/app/controllers/concerns/the_comments/controller.rb +197 -0
  16. data/app/controllers/concerns/the_comments/view_token.rb +20 -0
  17. data/app/helpers/render_comments_tree_helper.rb +111 -0
  18. data/app/models/_templates_/comment.rb +38 -0
  19. data/app/models/concerns/the_comments/comment.rb +116 -0
  20. data/app/models/concerns/the_comments/comment_states.rb +80 -0
  21. data/app/models/concerns/the_comments/commentable.rb +69 -0
  22. data/app/models/concerns/the_comments/user.rb +56 -0
  23. data/app/views/the_comments/_tree.html.erb +3 -0
  24. data/app/views/the_comments/haml/_additional_info.html.haml +13 -0
  25. data/app/views/the_comments/haml/_comment.html.haml +1 -0
  26. data/app/views/the_comments/haml/_comment_body.html.haml +25 -0
  27. data/app/views/the_comments/haml/_comment_edit.html.haml +26 -0
  28. data/app/views/the_comments/haml/_form.html.haml +8 -0
  29. data/app/views/the_comments/haml/_guest_form.html.haml +22 -0
  30. data/app/views/the_comments/haml/_logined_form.html.haml +18 -0
  31. data/app/views/the_comments/haml/_manage_controls.html.haml +30 -0
  32. data/app/views/the_comments/haml/_sidebar.html.haml +9 -0
  33. data/app/views/the_comments/haml/_sidebar_admin.html.haml +12 -0
  34. data/app/views/the_comments/haml/_sidebar_backlink.html.haml +3 -0
  35. data/app/views/the_comments/haml/_sidebar_user.html.haml +29 -0
  36. data/app/views/the_comments/haml/_tree.html.haml +16 -0
  37. data/app/views/the_comments/haml/manage.html.haml +26 -0
  38. data/app/views/the_comments/slim/_additional_info.html.slim +13 -0
  39. data/app/views/the_comments/slim/_comment.html.slim +1 -0
  40. data/app/views/the_comments/slim/_comment_body.html.slim +24 -0
  41. data/app/views/the_comments/slim/_comment_edit.html.slim +26 -0
  42. data/app/views/the_comments/slim/_form.html.slim +8 -0
  43. data/app/views/the_comments/slim/_guest_form.html.slim +22 -0
  44. data/app/views/the_comments/slim/_logined_form.html.slim +18 -0
  45. data/app/views/the_comments/slim/_manage_controls.html.slim +30 -0
  46. data/app/views/the_comments/slim/_sidebar.html.slim +9 -0
  47. data/app/views/the_comments/slim/_sidebar_admin.html.slim +12 -0
  48. data/app/views/the_comments/slim/_sidebar_backlink.html.slim +3 -0
  49. data/app/views/the_comments/slim/_sidebar_user.html.slim +29 -0
  50. data/app/views/the_comments/slim/_tree.html.slim +16 -0
  51. data/app/views/the_comments/slim/index.html.slim +18 -0
  52. data/app/views/the_comments/slim/manage.html.slim +26 -0
  53. data/app/views/the_comments/slim/my_comments.html.slim +28 -0
  54. data/config/initializers/the_comments.rb +15 -0
  55. data/config/locales/en.yml +68 -0
  56. data/config/locales/ru.yml +71 -0
  57. data/config/routes.rb +38 -0
  58. data/db/migrate/20130101010101_the_comments_change_user.rb +18 -0
  59. data/db/migrate/20130101010102_the_comments_create_comments.rb +50 -0
  60. data/db/migrate/20130101010103_the_comments_change_commentable.rb +13 -0
  61. data/docs/admin_ui_installation.md +145 -0
  62. data/docs/advanced_installation.md +185 -0
  63. data/docs/comment_api.md +58 -0
  64. data/docs/commentable_api.md +59 -0
  65. data/docs/config_file.md +27 -0
  66. data/docs/content_preprocessors.md +73 -0
  67. data/docs/customazation_of_views.md +30 -0
  68. data/docs/denormalization_and_recent_comments.md +40 -0
  69. data/docs/documentation.md +29 -0
  70. data/docs/generators.md +74 -0
  71. data/docs/pagination.md +123 -0
  72. data/docs/routes.md +77 -0
  73. data/docs/screencast.jpg +0 -0
  74. data/docs/the_comments.jpg +0 -0
  75. data/docs/the_comments_view_1.gif +0 -0
  76. data/docs/the_comments_view_2.gif +0 -0
  77. data/docs/the_comments_view_3.gif +0 -0
  78. data/docs/the_comments_view_4.gif +0 -0
  79. data/docs/the_comments_view_5.gif +0 -0
  80. data/docs/user_api.md +75 -0
  81. data/docs/what_is_comcoms.md +63 -0
  82. data/docs/whats_wrong_with_other_gems.md +28 -0
  83. data/docs/where_is_example_application.md +37 -0
  84. data/gem_version.rb +3 -0
  85. data/lib/generators/the_comments/USAGE +44 -0
  86. data/lib/generators/the_comments/the_comments_generator.rb +56 -0
  87. data/lib/generators/the_comments/views_generator.rb +79 -0
  88. data/lib/the_comments/config.rb +39 -0
  89. data/lib/the_comments/version.rb +1 -0
  90. data/lib/the_comments.rb +27 -0
  91. data/spec/dummy_app/.gitignore +18 -0
  92. data/spec/dummy_app/.rspec +1 -0
  93. data/spec/dummy_app/Gemfile +43 -0
  94. data/spec/dummy_app/README.md +33 -0
  95. data/spec/dummy_app/Rakefile +6 -0
  96. data/spec/dummy_app/app/assets/images/.keep +0 -0
  97. data/spec/dummy_app/app/assets/javascripts/admin_panel.js +5 -0
  98. data/spec/dummy_app/app/assets/javascripts/application.js +16 -0
  99. data/spec/dummy_app/app/assets/stylesheets/admin_panel.css +3 -0
  100. data/spec/dummy_app/app/assets/stylesheets/app.css.scss +4 -0
  101. data/spec/dummy_app/app/assets/stylesheets/application.css +16 -0
  102. data/spec/dummy_app/app/controllers/application_controller.rb +7 -0
  103. data/spec/dummy_app/app/controllers/comments_controller.rb +28 -0
  104. data/spec/dummy_app/app/controllers/concerns/.keep +0 -0
  105. data/spec/dummy_app/app/controllers/posts_controller.rb +13 -0
  106. data/spec/dummy_app/app/controllers/users_controller.rb +7 -0
  107. data/spec/dummy_app/app/helpers/application_helper.rb +2 -0
  108. data/spec/dummy_app/app/mailers/.keep +0 -0
  109. data/spec/dummy_app/app/models/.keep +0 -0
  110. data/spec/dummy_app/app/models/comment.rb +32 -0
  111. data/spec/dummy_app/app/models/concerns/.keep +0 -0
  112. data/spec/dummy_app/app/models/post.rb +17 -0
  113. data/spec/dummy_app/app/models/user.rb +21 -0
  114. data/spec/dummy_app/app/views/layouts/admin.html.haml +25 -0
  115. data/spec/dummy_app/app/views/layouts/application.html.haml +20 -0
  116. data/spec/dummy_app/app/views/posts/index.html.haml +22 -0
  117. data/spec/dummy_app/app/views/posts/show.html.haml +7 -0
  118. data/spec/dummy_app/bin/bundle +3 -0
  119. data/spec/dummy_app/bin/rails +4 -0
  120. data/spec/dummy_app/bin/rake +4 -0
  121. data/spec/dummy_app/config/application.rb +23 -0
  122. data/spec/dummy_app/config/boot.rb +4 -0
  123. data/spec/dummy_app/config/database.yml +11 -0
  124. data/spec/dummy_app/config/environment.rb +5 -0
  125. data/spec/dummy_app/config/environments/development.rb +29 -0
  126. data/spec/dummy_app/config/environments/production.rb +80 -0
  127. data/spec/dummy_app/config/environments/test.rb +36 -0
  128. data/spec/dummy_app/config/initializers/backtrace_silencers.rb +7 -0
  129. data/spec/dummy_app/config/initializers/filter_parameter_logging.rb +4 -0
  130. data/spec/dummy_app/config/initializers/inflections.rb +16 -0
  131. data/spec/dummy_app/config/initializers/mime_types.rb +5 -0
  132. data/spec/dummy_app/config/initializers/secret_token.rb +12 -0
  133. data/spec/dummy_app/config/initializers/session_store.rb +3 -0
  134. data/spec/dummy_app/config/initializers/sorcery.rb +437 -0
  135. data/spec/dummy_app/config/initializers/the_comments.rb +15 -0
  136. data/spec/dummy_app/config/initializers/wrap_parameters.rb +14 -0
  137. data/spec/dummy_app/config/locales/en.yml +23 -0
  138. data/spec/dummy_app/config/routes.rb +19 -0
  139. data/spec/dummy_app/config.ru +4 -0
  140. data/spec/dummy_app/db/migrate/20130712061503_sorcery_core.rb +16 -0
  141. data/spec/dummy_app/db/migrate/20130712065951_create_posts.rb +11 -0
  142. data/spec/dummy_app/db/migrate/20131027185332_change_user.the_comments_engine.rb +19 -0
  143. data/spec/dummy_app/db/migrate/20131027185333_create_comments.the_comments_engine.rb +51 -0
  144. data/spec/dummy_app/db/migrate/20131027185334_change_commentable.the_comments_engine.rb +14 -0
  145. data/spec/dummy_app/db/schema.rb +74 -0
  146. data/spec/dummy_app/db/seeds.rb +42 -0
  147. data/spec/dummy_app/lib/assets/.keep +0 -0
  148. data/spec/dummy_app/lib/tasks/.keep +0 -0
  149. data/spec/dummy_app/lib/tasks/app_bootstrap.rake +15 -0
  150. data/spec/dummy_app/log/.keep +0 -0
  151. data/spec/dummy_app/public/404.html +58 -0
  152. data/spec/dummy_app/public/422.html +58 -0
  153. data/spec/dummy_app/public/500.html +57 -0
  154. data/spec/dummy_app/public/favicon.ico +0 -0
  155. data/spec/dummy_app/public/robots.txt +5 -0
  156. data/spec/dummy_app/spec/factories/post.rb +6 -0
  157. data/spec/dummy_app/spec/factories/user.rb +6 -0
  158. data/spec/dummy_app/spec/models/user_counters_spec.rb +339 -0
  159. data/spec/dummy_app/spec/spec_helper.rb +29 -0
  160. data/spec/dummy_app/test/controllers/.keep +0 -0
  161. data/spec/dummy_app/test/fixtures/.keep +0 -0
  162. data/spec/dummy_app/test/helpers/.keep +0 -0
  163. data/spec/dummy_app/test/integration/.keep +0 -0
  164. data/spec/dummy_app/test/mailers/.keep +0 -0
  165. data/spec/dummy_app/test/models/.keep +0 -0
  166. data/spec/dummy_app/test/test_helper.rb +15 -0
  167. data/spec/dummy_app/vendor/assets/javascripts/.keep +0 -0
  168. data/spec/dummy_app/vendor/assets/stylesheets/.keep +0 -0
  169. data/the_comments.gemspec +23 -0
  170. data/views_converter.rb +16 -0
  171. metadata +332 -0
@@ -0,0 +1,3 @@
1
+ <%= render partial: "the_comments/#{TheComments.config.template_engine}/tree",
2
+ locals: { commentable: commentable, comments_tree: comments_tree }
3
+ %>
@@ -0,0 +1,13 @@
1
+ .additional_info{ style: "display:none" }
2
+ %br
3
+ %table.table.table-striped.table-hover
4
+ %tr
5
+ %th Tolerance time:
6
+ %th IP:
7
+ %th User Agent:
8
+ %th Referer:
9
+ %tr
10
+ %td= comment.tolerance_time || :none
11
+ %td= comment.ip
12
+ %td= comment.user_agent
13
+ %td= comment.referer
@@ -0,0 +1 @@
1
+ = build_server_tree(tree, render_module: RenderCommentsTreeHelper, controller: controller)
@@ -0,0 +1,25 @@
1
+ %table.comment_body.table.table-striped.table-hover
2
+ %tr
3
+ %td{ style: "width: 120px;"}
4
+ %b= comment.commentable_type
5
+ &rarr;
6
+ %td
7
+ = link_to comment.commentable_title, comment.commentable_url
8
+ (#{comment.try(:commentable_state)})
9
+ %tr
10
+ %td
11
+ %b= t('the_comments.title')
12
+ %td
13
+ - if comment.try(:user)
14
+ = link_to comment.user_name, comment.user
15
+ - else
16
+ = comment.header_title
17
+ %tr
18
+ %td
19
+ %b= t('the_comments.contacts')
20
+ %td= comment.contacts
21
+ %tr.success
22
+ %td
23
+ %b= t('the_comments.content')
24
+ %td{ style: 'word-break: break-all;' }= raw comment.content
25
+
@@ -0,0 +1,26 @@
1
+ .edit_form{ style: "display:none" }
2
+ = form_for comment, remote: true, html:{ role: :form } do |f|
3
+ %table.table.table-striped.table-hover
4
+ %tr{ style: "width: 100px;"}
5
+ %td
6
+ %b= comment.commentable_type
7
+ &rarr;
8
+ %td
9
+ = link_to comment.commentable_title, comment.commentable_url
10
+ (#{comment.try(:commentable_state)})
11
+ %tr
12
+ %td
13
+ %b= t('the_comments.title')
14
+ %td= f.text_field :title, class: "form-control"
15
+ %tr
16
+ %td
17
+ %b= t('the_comments.contacts')
18
+ %td= f.text_field :contacts, class: "form-control"
19
+ %tr
20
+ %td
21
+ %b= t('the_comments.content')
22
+ %td= f.text_area :raw_content, class: "form-control", rows: 7
23
+ %tr
24
+ %td
25
+ %td= f.submit t('the_comments.update'), class: "btn btn-success"
26
+ %hr
@@ -0,0 +1,8 @@
1
+ %h3
2
+ = link_to t('the_comments.new'), '#', id: :new_root_comment
3
+
4
+ = form_for Comment.new, remote: true, authenticity_token: true do |f|
5
+ - if current_user
6
+ = render partial: 'the_comments/haml/logined_form', locals: { f: f, commentable: commentable }
7
+ - else
8
+ = render partial: 'the_comments/haml/guest_form', locals: { f: f, commentable: commentable }
@@ -0,0 +1,22 @@
1
+ %label= t('the_comments.form.title')
2
+ %p= f.text_field :title, class: 'form-control'
3
+
4
+ %label= t('the_comments.form.contacts')
5
+ %p= f.text_field :contacts, class: 'form-control'
6
+
7
+ %label= t('the_comments.form.content')
8
+ %p= f.text_area :raw_content, class: 'form-control'
9
+
10
+ %p.trap
11
+ - TheComments.config.empty_inputs.each do |name|
12
+ = text_field_tag name, nil, autocomplete: :off, tabindex: -1, id: nil
13
+
14
+ = hidden_field_tag :tolerance_time, 0, id: nil, class: :tolerance_time
15
+
16
+ = f.hidden_field :commentable_type, value: commentable.class
17
+ = f.hidden_field :commentable_id, value: commentable.id
18
+ = f.hidden_field :parent_id, class: :parent_id
19
+
20
+ %p
21
+ = f.submit t('the_comments.form.create'), class: :btn
22
+ = t('the_comments.form.thank_you')
@@ -0,0 +1,18 @@
1
+ .logined_comment_form
2
+ .user_data
3
+ = link_to user_path(current_user), nopin: :nopin do
4
+ = image_tag current_user.try(:avatar).try(:url, :thumb)
5
+ .comment_data
6
+ = hidden_field_tag :tolerance_time, 0, id: nil, class: :tolerance_time
7
+ = f.hidden_field :commentable_type, value: commentable.class
8
+ = f.hidden_field :commentable_id, value: commentable.id
9
+ = f.hidden_field :parent_id, class: :parent_id
10
+
11
+ .user_name
12
+ %b= current_user.username.present? ? current_user.username : current_user.login
13
+ %label= t('the_comments.form.content')
14
+ %p= f.text_area :raw_content
15
+
16
+ %p
17
+ = f.submit t('the_comments.form.create'), class: :btn
18
+ = t('the_comments.form.thank_you')
@@ -0,0 +1,30 @@
1
+ - hidden = "display:none"
2
+
3
+ .row.controls
4
+ .col-md-9.action_btns
5
+ = link_to '#', class: "edit btn btn-success" do
6
+ = t('the_comments.edit')
7
+
8
+ = link_to '#', class: "btn btn-warning edit", style: "display:none" do
9
+ = t('the_comments.cancel')
10
+
11
+ - unless to_hide = comment.published? ? hidden : nil
12
+ - opts = { remote: true, style: to_hide, method: :post }
13
+ = link_to [:to_published, comment], opts.merge(class: "btn btn-primary to_published") do
14
+ = t('the_comments.to_published')
15
+
16
+ - unless to_hide = comment.draft? ? hidden : nil
17
+ - opts = { remote: true, style: to_hide, method: :post }
18
+ = link_to [:to_draft, comment], opts.merge(class: "btn btn-warning to_draft") do
19
+ = t('the_comments.to_draft')
20
+
21
+ - unless to_hide = comment.deleted? ? hidden : nil
22
+ - opts = { remote: true, style: to_hide, method: :delete, data: { confirm: t('the_comments.delete_confirm') } }
23
+ = link_to [:to_deleted, comment], opts.merge(class: "btn btn-danger to_deleted") do
24
+ = t('the_comments.to_deleted')
25
+
26
+ - opts = { remote: true, method: :post}
27
+ = link_to [:to_spam, comment], opts.merge(class: "btn btn-danger to_spam") do
28
+ = t('the_comments.to_spam')
29
+ .col-md-3.text-right
30
+ = link_to t('the_comments.additional_info'), "#", class: "additional_info btn btn-info"
@@ -0,0 +1,9 @@
1
+ .panel.panel-default
2
+ .panel-heading= t "the_comments.nav.header"
3
+ .panel-body
4
+ = render partial: 'the_comments/haml/sidebar_backlink'
5
+
6
+ - if current_user.comments_admin?
7
+ = render partial: 'the_comments/haml/sidebar_admin'
8
+ - else
9
+ = render partial: 'the_comments/haml/sidebar_user'
@@ -0,0 +1,12 @@
1
+ - cuser = current_user
2
+
3
+ = render partial: 'the_comments/haml/sidebar_user'
4
+
5
+ - if cuser.comments_admin?
6
+ %br
7
+ %h5= t 'the_comments.in_system', num: Comment.count
8
+ %p= link_to t("the_comments.published_comments", num: Comment.with_state(:published).count), [:total_published, :comments], class: 'btn btn-success btn-sm'
9
+ %p= link_to t("the_comments.draft_comments", num: Comment.with_state(:draft).count), [:total_draft, :comments], class: 'btn btn-info btn-sm'
10
+ %p
11
+ = link_to t("the_comments.deleted_comments", num: Comment.with_state(:deleted).count), [:total_deleted, :comments], class: 'btn btn-default btn-sm'
12
+ = link_to t("the_comments.spam_comments", num: Comment.where(spam: true).count), [:total_spam, :comments], class: 'btn btn-default btn-sm'
@@ -0,0 +1,3 @@
1
+ %p= link_to t('the_comments.nav.to_root'), root_path
2
+ %p= link_to t('the_comments.nav.all_incoming'), manage_comments_url
3
+ %hr
@@ -0,0 +1,29 @@
1
+ - cuser = current_user
2
+
3
+ %h5=t 'the_comments.written_by_me', num: cuser.my_comments.count
4
+
5
+ %p= link_to t("the_comments.published_comments", num: cuser.my_published_comments.count), [:my_published, :comments], class: 'btn btn-success btn-sm'
6
+ %p= link_to t("the_comments.draft_comments", num: cuser.my_draft_comments.count), [:my_draft, :comments], class: 'btn btn-info btn-sm'
7
+
8
+ %p
9
+ - if cuser.comments_admin?
10
+ = link_to t("the_comments.deleted_comments", num: cuser.my_deleted_comments.count), [:my_deleted, :comments], class: 'btn btn-default btn-sm'
11
+ = link_to t("the_comments.spam_comments", num: cuser.my_spam_comments.count), [:my_spam, :comments], class: 'btn btn-default btn-sm'
12
+ - else
13
+ %span.btn.btn-default.btn-sm= t("the_comments.deleted_comments", num: cuser.my_deleted_comments.count)
14
+ %span.btn.btn-default.btn-sm= t("the_comments.spam_comments", num: cuser.my_spam_comments.count)
15
+
16
+ %br
17
+ %h5= t 'the_comments.for_my_posts', num: cuser.comcoms.count
18
+
19
+ %p= link_to t("the_comments.published_comments", num: cuser.published_comcoms_count), [:published, :comments], class: 'btn btn-success btn-sm'
20
+ %p= link_to t("the_comments.draft_comments", num: cuser.draft_comcoms_count), [:draft, :comments], class: 'btn btn-info btn-sm'
21
+ %p
22
+ - if cuser.comments_admin?
23
+ = link_to t("the_comments.deleted_comments", num: cuser.deleted_comcoms_count), [:deleted, :comments], class: 'btn btn-default btn-sm'
24
+ = link_to t("the_comments.spam_comments", num: cuser.spam_comcoms_count), [:spam, :comments], class: 'btn btn-default btn-sm'
25
+ - else
26
+ %span.btn.btn-default.btn-sm= t("the_comments.deleted_comments", num: cuser.deleted_comcoms_count)
27
+ %span.btn.btn-default.btn-sm= t("the_comments.spam_comments", num: cuser.spam_comcoms_count)
28
+
29
+
@@ -0,0 +1,16 @@
1
+ - if commentable.try(:comments_on?) || true
2
+ %h4.comments_sum
3
+ - if commentable.comments_sum.zero?
4
+ Вы можете стать первым, кто оставит комментарий!
5
+ - else
6
+ Комментариев: #{ commentable.comments_sum }
7
+
8
+ - unless current_user
9
+ .comments_description
10
+ %p &mdash; Комментарий можно оставить <b>без регистрации</b>, для этого достаточно заполнить одно обязательное поле <b class='nobr'>Текст комментария</b>. Анонимные комментарии проходят модерацию и до момента одобрения видны только в браузере автора
11
+ %p &mdash; Комментарии зарегистрированных пользователей публикуются сразу после создания
12
+
13
+ .comments#comments
14
+ %ol.comments_tree{ data: { comments: { tolarance_time: TheComments.config.tolerance_time } } }
15
+ = render partial: 'the_comments/haml/comment', locals: { tree: comments_tree }
16
+ = render partial: 'the_comments/haml/form', locals: { commentable: commentable }
@@ -0,0 +1,26 @@
1
+ - content_for :title do
2
+ = t "the_comments.management"
3
+
4
+ - content_for :comments_sidebar do
5
+ = render partial: 'the_comments/haml/sidebar'
6
+
7
+ - content_for :comments_main do
8
+ = paginate @comments
9
+
10
+ - if @comments.blank?
11
+ .alert.alert-info= t 'the_comments.no_comments_here'
12
+
13
+ .comments
14
+ - @comments.each do |comment|
15
+ - klass = { published: :success, draft: :info, deleted: :danger }[comment.state.to_sym]
16
+ .panel{ class: "panel-#{klass}" }
17
+ .panel-heading= comment.header_title
18
+ .panel-body
19
+ = render partial: 'the_comments/haml/comment_body', locals: { comment: comment }
20
+
21
+ - if current_user.comments_admin?
22
+ = render partial: 'the_comments/haml/comment_edit', locals: { comment: comment }
23
+ = render partial: 'the_comments/haml/manage_controls', locals: { comment: comment }
24
+ = render partial: 'the_comments/haml/additional_info', locals: { comment: comment }
25
+
26
+ = paginate @comments
@@ -0,0 +1,13 @@
1
+ .additional_info style: "display:none"
2
+ br
3
+ table.table.table-striped.table-hover
4
+ tr
5
+ th Tolerance time:
6
+ th IP:
7
+ th User Agent:
8
+ th Referer:
9
+ tr
10
+ td= comment.tolerance_time || :none
11
+ td= comment.ip
12
+ td= comment.user_agent
13
+ td= comment.referer
@@ -0,0 +1 @@
1
+ = build_server_tree(tree, render_module: RenderCommentsTreeHelper, controller: controller)
@@ -0,0 +1,24 @@
1
+ table.comment_body.table.table-striped.table-hover
2
+ tr
3
+ td style: "width: 120px;"
4
+ b= comment.commentable_type
5
+ | &rarr;
6
+ td
7
+ = link_to comment.commentable_title, comment.commentable_url
8
+ | (#{comment.try(:commentable_state)})
9
+ tr
10
+ td
11
+ b= t('the_comments.title')
12
+ td
13
+ - if comment.try(:user)
14
+ = link_to comment.user_name, comment.user
15
+ - else
16
+ = comment.header_title
17
+ tr
18
+ td
19
+ b= t('the_comments.contacts')
20
+ td= comment.contacts
21
+ tr.success
22
+ td
23
+ b= t('the_comments.content')
24
+ td= comment.content
@@ -0,0 +1,26 @@
1
+ .edit_form style: "display:none"
2
+ = form_for comment, remote: true, html:{ role: :form } do |f|
3
+ table.table.table-striped.table-hover
4
+ tr style: "width: 100px;"
5
+ td
6
+ b= comment.commentable_type
7
+ | &rarr;
8
+ td
9
+ = link_to comment.commentable_title, comment.commentable_url
10
+ | (#{comment.try(:commentable_state)})
11
+ tr
12
+ td
13
+ b= t('the_comments.title')
14
+ td= f.text_field :title, class: "form-control"
15
+ tr
16
+ td
17
+ b= t('the_comments.contacts')
18
+ td= f.text_field :contacts, class: "form-control"
19
+ tr
20
+ td
21
+ b= t('the_comments.content')
22
+ td= f.text_area :raw_content, class: "form-control", rows: 7
23
+ tr
24
+ td
25
+ td= f.submit t('the_comments.update'), class: "btn btn-success"
26
+ hr
@@ -0,0 +1,8 @@
1
+ h3
2
+ = link_to t('the_comments.new'), '#', id: :new_root_comment
3
+
4
+ = form_for Comment.new, remote: true, authenticity_token: true do |f|
5
+ - if current_user
6
+ = render partial: 'the_comments/slim/logined_form', locals: { f: f, commentable: commentable }
7
+ - else
8
+ = render partial: 'the_comments/slim/guest_form', locals: { f: f, commentable: commentable }
@@ -0,0 +1,22 @@
1
+ label= t('the_comments.form.title')
2
+ p= f.text_field :title, class: 'form-control'
3
+
4
+ label= t('the_comments.form.contacts')
5
+ p= f.text_field :contacts, class: 'form-control'
6
+
7
+ label= t('the_comments.form.content')
8
+ p= f.text_area :raw_content, class: 'form-control'
9
+
10
+ p.trap
11
+ - TheComments.config.empty_inputs.each do |name|
12
+ = text_field_tag name, nil, autocomplete: :off, tabindex: -1, id: nil
13
+
14
+ = hidden_field_tag :tolerance_time, 0, id: nil, class: :tolerance_time
15
+
16
+ = f.hidden_field :commentable_type, value: commentable.class
17
+ = f.hidden_field :commentable_id, value: commentable.id
18
+ = f.hidden_field :parent_id, class: :parent_id
19
+
20
+ p
21
+ = f.submit t('the_comments.form.create'), class: :btn
22
+ = t('the_comments.form.thank_you')
@@ -0,0 +1,18 @@
1
+ .logined_comment_form
2
+ .user_data
3
+ = link_to user_path(current_user), nopin: :nopin do
4
+ = image_tag current_user.avatar.url(:thumb)
5
+ .comment_data
6
+ = hidden_field_tag :tolerance_time, 0, id: nil, class: :tolerance_time
7
+ = f.hidden_field :commentable_type, value: commentable.class
8
+ = f.hidden_field :commentable_id, value: commentable.id
9
+ = f.hidden_field :parent_id, class: :parent_id
10
+
11
+ .user_name
12
+ b= current_user.username.present? ? current_user.username : current_user.login
13
+ label= t('the_comments.form.content')
14
+ p= f.text_area :raw_content
15
+
16
+ p
17
+ = f.submit t('the_comments.form.create'), class: :btn
18
+ = t('the_comments.form.thank_you')
@@ -0,0 +1,30 @@
1
+ - hidden = "display:none"
2
+
3
+ .row.controls
4
+ .col-md-9.action_btns
5
+ = link_to '#', class: "edit btn btn-success" do
6
+ = t('the_comments.edit')
7
+
8
+ = link_to '#', class: "btn btn-warning edit", style: "display:none" do
9
+ = t('the_comments.cancel')
10
+
11
+ - unless to_hide = comment.published? ? hidden : nil
12
+ - opts = { remote: true, style: to_hide, method: :post }
13
+ = link_to [:to_published, comment], opts.merge(class: "btn btn-primary to_published") do
14
+ = t('the_comments.to_published')
15
+
16
+ - unless to_hide = comment.draft? ? hidden : nil
17
+ - opts = { remote: true, style: to_hide, method: :post }
18
+ = link_to [:to_draft, comment], opts.merge(class: "btn btn-warning to_draft") do
19
+ = t('the_comments.to_draft')
20
+
21
+ - unless to_hide = comment.deleted? ? hidden : nil
22
+ - opts = { remote: true, style: to_hide, method: :delete, data: { confirm: t('the_comments.delete_confirm') } }
23
+ = link_to [:to_deleted, comment], opts.merge(class: "btn btn-danger to_deleted") do
24
+ = t('the_comments.to_deleted')
25
+
26
+ - opts = { remote: true, method: :post}
27
+ = link_to [:to_spam, comment], opts.merge(class: "btn btn-danger to_spam") do
28
+ = t('the_comments.to_spam')
29
+ .col-md-3.text-right
30
+ = link_to t('the_comments.additional_info'), "#", class: "additional_info btn btn-info"
@@ -0,0 +1,9 @@
1
+ .panel.panel-default
2
+ .panel-heading= t "the_comments.nav.header"
3
+ .panel-body
4
+ = render partial: 'the_comments/slim/sidebar_backlink'
5
+
6
+ - if current_user.comments_admin?
7
+ = render partial: 'the_comments/slim/sidebar_admin'
8
+ - else
9
+ = render partial: 'the_comments/slim/sidebar_user'
@@ -0,0 +1,12 @@
1
+ - cuser = current_user
2
+
3
+ = render partial: 'the_comments/slim/sidebar_user'
4
+
5
+ - if cuser.comments_admin?
6
+ br
7
+ h5= t 'the_comments.in_system', num: Comment.count
8
+ p= link_to t("the_comments.published_comments", num: Comment.with_state(:published).count), [:total_published, :comments], class: 'btn btn-success btn-sm'
9
+ p= link_to t("the_comments.draft_comments", num: Comment.with_state(:draft).count), [:total_draft, :comments], class: 'btn btn-info btn-sm'
10
+ p
11
+ = link_to t("the_comments.deleted_comments", num: Comment.with_state(:deleted).count), [:total_deleted, :comments], class: 'btn btn-default btn-sm'
12
+ = link_to t("the_comments.spam_comments", num: Comment.where(spam: true).count), [:total_spam, :comments], class: 'btn btn-default btn-sm'