thredded 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. metadata +7 -114
  3. data/MIT-LICENSE +0 -20
  4. data/README.mkdn +0 -72
  5. data/Rakefile +0 -31
  6. data/app/assets/javascripts/thredded/application.js +0 -15
  7. data/app/assets/stylesheets/thredded/application.css +0 -13
  8. data/app/controllers/thredded/application_controller.rb +0 -60
  9. data/app/controllers/thredded/emails_controller.rb +0 -4
  10. data/app/controllers/thredded/messageboards_controller.rb +0 -7
  11. data/app/controllers/thredded/posts_controller.rb +0 -85
  12. data/app/controllers/thredded/preferences_controller.rb +0 -28
  13. data/app/controllers/thredded/private_topics_controller.rb +0 -58
  14. data/app/controllers/thredded/setups_controller.rb +0 -44
  15. data/app/controllers/thredded/topics_controller.rb +0 -99
  16. data/app/decorators/thredded/messageboard_decorator.rb +0 -74
  17. data/app/decorators/thredded/post_decorator.rb +0 -61
  18. data/app/decorators/thredded/topic_decorator.rb +0 -94
  19. data/app/decorators/thredded/user_topic_decorator.rb +0 -88
  20. data/app/helpers/thredded/application_helper.rb +0 -4
  21. data/app/helpers/thredded/posts_helper.rb +0 -7
  22. data/app/helpers/thredded/topics_helper.rb +0 -4
  23. data/app/mailers/thredded/post_mailer.rb +0 -28
  24. data/app/mailers/thredded/topic_mailer.rb +0 -29
  25. data/app/models/thredded/ability.rb +0 -66
  26. data/app/models/thredded/attachment.rb +0 -23
  27. data/app/models/thredded/category.rb +0 -9
  28. data/app/models/thredded/image.rb +0 -26
  29. data/app/models/thredded/messageboard.rb +0 -117
  30. data/app/models/thredded/messageboard_preference.rb +0 -14
  31. data/app/models/thredded/null_preference.rb +0 -11
  32. data/app/models/thredded/null_topic.rb +0 -16
  33. data/app/models/thredded/null_topic_read.rb +0 -19
  34. data/app/models/thredded/null_user.rb +0 -35
  35. data/app/models/thredded/post.rb +0 -120
  36. data/app/models/thredded/post_notification.rb +0 -5
  37. data/app/models/thredded/private_topic.rb +0 -42
  38. data/app/models/thredded/private_user.rb +0 -6
  39. data/app/models/thredded/role.rb +0 -16
  40. data/app/models/thredded/topic.rb +0 -154
  41. data/app/models/thredded/topic_category.rb +0 -6
  42. data/app/models/thredded/user_detail.rb +0 -6
  43. data/app/models/thredded/user_extender.rb +0 -21
  44. data/app/models/thredded/user_preference.rb +0 -6
  45. data/app/models/thredded/user_topic_read.rb +0 -9
  46. data/app/uploaders/thredded/attachment_uploader.rb +0 -30
  47. data/app/uploaders/thredded/image_uploader.rb +0 -16
  48. data/app/views/thredded/attachments/_attachment.html.erb +0 -7
  49. data/app/views/thredded/messageboards/_messageboard.html.erb +0 -20
  50. data/app/views/thredded/messageboards/index.html.erb +0 -18
  51. data/app/views/thredded/post_mailer/at_notification.html.erb +0 -17
  52. data/app/views/thredded/post_mailer/at_notification.text.erb +0 -13
  53. data/app/views/thredded/posts/_form.html.erb +0 -17
  54. data/app/views/thredded/posts/_null_user.html.erb +0 -0
  55. data/app/views/thredded/posts/_post.html.erb +0 -29
  56. data/app/views/thredded/posts/_user.html.erb +0 -7
  57. data/app/views/thredded/posts/edit.html.erb +0 -31
  58. data/app/views/thredded/posts/index.html.erb +0 -64
  59. data/app/views/thredded/preferences/edit.html.erb +0 -22
  60. data/app/views/thredded/private_topics/_form.html.erb +0 -15
  61. data/app/views/thredded/private_topics/index.html.erb +0 -34
  62. data/app/views/thredded/private_topics/new.html.erb +0 -28
  63. data/app/views/thredded/search/_form.html.erb +0 -9
  64. data/app/views/thredded/setups/_form.html.erb +0 -35
  65. data/app/views/thredded/setups/new.html.erb +0 -6
  66. data/app/views/thredded/shared/_currently_online.html.erb +0 -10
  67. data/app/views/thredded/shared/_error_msgs.html.erb +0 -7
  68. data/app/views/thredded/shared/_google_analytics.html.erb +0 -10
  69. data/app/views/thredded/shared/_topic_nav.html.erb +0 -21
  70. data/app/views/thredded/topic_mailer/message_notification.html.erb +0 -17
  71. data/app/views/thredded/topic_mailer/message_notification.text.erb +0 -13
  72. data/app/views/thredded/topics/_form.html.erb +0 -6
  73. data/app/views/thredded/topics/_recent_topics_by_user.html.erb +0 -8
  74. data/app/views/thredded/topics/_topic_condensed.html.erb +0 -24
  75. data/app/views/thredded/topics/_topic_form.html.erb +0 -27
  76. data/app/views/thredded/topics/by_category.html.erb +0 -54
  77. data/app/views/thredded/topics/edit.html.erb +0 -28
  78. data/app/views/thredded/topics/index.html.erb +0 -34
  79. data/app/views/thredded/topics/menu/_new_topic.html.erb +0 -3
  80. data/app/views/thredded/topics/new.html.erb +0 -21
  81. data/app/views/thredded/topics/search.html.erb +0 -34
  82. data/config/initializers/griddler.rb +0 -4
  83. data/config/routes.rb +0 -29
  84. data/db/migrate/20130425230852_create_thredded_tables.rb +0 -143
  85. data/db/migrate/20131005032727_prevent_null_sticky_and_locked.rb +0 -15
  86. data/db/migrate/20131014014258_uniqs_on_user_topic_read.rb +0 -9
  87. data/db/migrate/20131019014258_index_necessary_columns.rb +0 -24
  88. data/db/migrate/20131026202621_move_filter_to_messageboards.rb +0 -11
  89. data/db/migrate/20131029034507_convert_textile_to_markdown.rb +0 -7
  90. data/lib/html/pipeline/at_mention_filter.rb +0 -19
  91. data/lib/html/pipeline/attached_image_filter.rb +0 -59
  92. data/lib/html/pipeline/bbcode_filter.rb +0 -19
  93. data/lib/tasks/thredded_tasks.rake +0 -4
  94. data/lib/thredded.rb +0 -58
  95. data/lib/thredded/at_notification_extractor.rb +0 -15
  96. data/lib/thredded/at_notifier.rb +0 -67
  97. data/lib/thredded/at_users.rb +0 -19
  98. data/lib/thredded/email_processor.rb +0 -76
  99. data/lib/thredded/engine.rb +0 -17
  100. data/lib/thredded/errors.rb +0 -40
  101. data/lib/thredded/messageboard_user_permissions.rb +0 -27
  102. data/lib/thredded/post_sql_builder.rb +0 -34
  103. data/lib/thredded/post_user_permissions.rb +0 -41
  104. data/lib/thredded/private_topic_notifier.rb +0 -56
  105. data/lib/thredded/private_topic_user_permissions.rb +0 -38
  106. data/lib/thredded/search_parser.rb +0 -45
  107. data/lib/thredded/search_sql_builder.rb +0 -25
  108. data/lib/thredded/setup_thredded.rb +0 -7
  109. data/lib/thredded/table_sql_builder.rb +0 -105
  110. data/lib/thredded/topic_sql_builder.rb +0 -32
  111. data/lib/thredded/topic_user_permissions.rb +0 -55
  112. data/lib/thredded/version.rb +0 -3
@@ -1,28 +0,0 @@
1
- module Thredded
2
- class PreferencesController < Thredded::ApplicationController
3
- helper_method :preference
4
-
5
- def edit
6
- end
7
-
8
- def update
9
- preference.update_attributes(preference_params)
10
-
11
- redirect_to :back, flash: { notice: 'Your preferences are updated' }
12
- end
13
-
14
- def preference
15
- @preference ||= MessageboardPreference
16
- .where(messageboard_id: messageboard.id, user_id: current_user.id)
17
- .first_or_create!
18
- end
19
-
20
- private
21
-
22
- def preference_params
23
- params
24
- .require(:messageboard_preference)
25
- .permit(:notify_on_mention, :notify_on_message, :filter)
26
- end
27
- end
28
- end
@@ -1,58 +0,0 @@
1
- module Thredded
2
- class PrivateTopicsController < Thredded::ApplicationController
3
- def index
4
- if cannot? :read, messageboard
5
- error = 'You are not authorized access to this messageboard.'
6
- redirect_to default_home, flash: { error: error }
7
- end
8
-
9
- @private_topics = private_topics
10
- end
11
-
12
- def new
13
- @private_topic = messageboard.private_topics.build
14
- @private_topic.posts.build
15
-
16
- unless can? :create, @private_topic
17
- error = 'Sorry, you are not authorized to post on this messageboard.'
18
- redirect_to messageboard_topics_url(messageboard),
19
- flash: { error: error }
20
- end
21
- end
22
-
23
- def create
24
- @private_topic = messageboard.private_topics.create(private_topics_params)
25
-
26
- redirect_to messageboard_topics_url(messageboard)
27
- end
28
-
29
- def private_topics
30
- PrivateTopic
31
- .for_messageboard(messageboard)
32
- .including_roles_for(current_user)
33
- .for_user(current_user)
34
- .order_by_stuck_and_updated_time
35
- .on_page(params[:page])
36
- end
37
-
38
- private
39
-
40
- def private_topics_params
41
- params[:topic][:user_id] << current_user.id
42
-
43
- params
44
- .require(:topic)
45
- .permit!
46
- .deep_merge!({
47
- user: current_user,
48
- last_user: current_user,
49
- posts_attributes: {
50
- '0' => {
51
- messageboard: messageboard,
52
- user: current_user,
53
- }
54
- }
55
- })
56
- end
57
- end
58
- end
@@ -1,44 +0,0 @@
1
- module Thredded
2
- class SetupsController < Thredded::ApplicationController
3
- def new
4
- @messageboard = Messageboard.new
5
- end
6
-
7
- def create
8
- @messageboard = Messageboard.create(messageboard_params)
9
-
10
- if @messageboard.valid?
11
- @messageboard.add_member(current_user, 'admin')
12
- @messageboard.topics.create(topic_params)
13
-
14
- redirect_to root_path
15
- else
16
- render action: :new
17
- end
18
- end
19
-
20
- private
21
-
22
- def messageboard_params
23
- params
24
- .require(:messageboard)
25
- .permit(:description, :name, :posting_permissions, :security)
26
- end
27
-
28
- def topic_params
29
- {
30
- user: current_user,
31
- last_user: current_user,
32
- title: "Welcome to your messageboard's very first thread",
33
- posts_attributes: {
34
- '0' => {
35
- content: "There's not a whole lot here for now.",
36
- ip: '127.0.0.1',
37
- messageboard: @messageboard,
38
- user: current_user,
39
- }
40
- }
41
- }
42
- end
43
- end
44
- end
@@ -1,99 +0,0 @@
1
- module Thredded
2
- class TopicsController < Thredded::ApplicationController
3
- helper_method :current_page, :topic
4
- before_filter :update_user_activity
5
-
6
- def index
7
- authorize_reading messageboard
8
-
9
- @topics = topics
10
- end
11
-
12
- def search
13
- @topics = Topic.search(params[:q], messageboard)
14
- end
15
-
16
- def new
17
- @topic = messageboard.topics.build
18
- @topic.posts.build
19
-
20
- authorize_creating @topic
21
- end
22
-
23
- def by_category
24
- @topics = topics_by_category(params[:category_id])
25
- @category_name = Category.find(params[:category_id]).name
26
- end
27
-
28
- def create
29
- @topic = messageboard.topics.create(topic_and_post_params)
30
- redirect_to messageboard_topics_path(messageboard)
31
- end
32
-
33
- def edit
34
- authorize! :update, topic
35
- end
36
-
37
- def update
38
- topic.update_attributes(topic_params)
39
- redirect_to messageboard_topic_posts_url(messageboard, topic)
40
- end
41
-
42
- private
43
-
44
- def topic
45
- @topic ||= messageboard.topics.find_by_slug(params[:id])
46
- end
47
-
48
- def topics
49
- Topic
50
- .public
51
- .for_messageboard(messageboard)
52
- .includes(:user_topic_reads, :categories, :messageboard, :last_user, :user)
53
- .order_by_stuck_and_updated_time
54
- .on_page(current_page)
55
- end
56
-
57
- def topic_params
58
- params
59
- .require(:topic)
60
- .permit!
61
- .deep_merge!({
62
- user: current_user,
63
- last_user: current_user
64
- })
65
- end
66
-
67
- def topic_and_post_params
68
- params
69
- .require(:topic)
70
- .permit!
71
- .deep_merge!({
72
- last_user: current_user,
73
- user: current_user,
74
- posts_attributes: {
75
- '0' => {
76
- messageboard: messageboard,
77
- ip: request.remote_ip,
78
- user: current_user,
79
- filter: messageboard.filter,
80
- }
81
- }
82
- })
83
- end
84
-
85
- def topics_by_category(category_id)
86
- topics = Category.find(category_id)
87
- .topics
88
- .unstuck
89
- .public
90
- .for_messageboard(messageboard)
91
- .order_by_updated
92
- .on_page(current_page)
93
- end
94
-
95
- def current_page
96
- params[:page] || 1
97
- end
98
- end
99
- end
@@ -1,74 +0,0 @@
1
- module Thredded
2
- class MessageboardDecorator < SimpleDelegator
3
- include ActionView::Helpers::NumberHelper
4
- include ActionView::Helpers::TagHelper
5
-
6
- def initialize(messageboard)
7
- super
8
- @messageboard = messageboard
9
- end
10
-
11
- def original
12
- messageboard
13
- end
14
-
15
- def meta
16
- topics_count = number_to_human(messageboard.topics_count)
17
- posts_count = number_to_human(messageboard.posts_count)
18
-
19
- "#{topics_count} topics, #{posts_count} posts".downcase
20
- end
21
-
22
- def description
23
- if messageboard.description.blank?
24
- ''
25
- else
26
- content_tag :p, messageboard.description
27
- end
28
- end
29
-
30
- def latest_topic_timeago
31
- if latest_topic.updated_at.nil?
32
- <<-eohtml.html_safe
33
- <abbr>
34
- a little while ago
35
- </abbr>
36
- eohtml
37
- else
38
- <<-eohtml.html_safe
39
- <abbr class="timeago" title="#{topic_updated_at_utc}">
40
- #{topic_updated_at_str}
41
- </abbr>
42
- eohtml
43
- end
44
- end
45
-
46
- def latest_topic
47
- @latest_topic ||= messageboard.topics.order('updated_at DESC').first || Thredded::NullTopic.new
48
- end
49
-
50
- def latest_user
51
- latest_topic.last_user
52
- end
53
-
54
- def category_options
55
- messageboard.categories.map { |cat| [cat.name, cat.id] }
56
- end
57
-
58
- def users_options
59
- messageboard.users.map { |user| [user.to_s, user.id] }
60
- end
61
-
62
- private
63
-
64
- attr_reader :messageboard
65
-
66
- def topic_updated_at_utc
67
- latest_topic.updated_at.getutc.iso8601
68
- end
69
-
70
- def topic_updated_at_str
71
- latest_topic.updated_at.to_s
72
- end
73
- end
74
- end
@@ -1,61 +0,0 @@
1
- module Thredded
2
- class PostDecorator < SimpleDelegator
3
- attr_reader :post
4
-
5
- def initialize(post)
6
- super
7
- @post = post
8
- end
9
-
10
- def user_name
11
- if user
12
- user.to_s
13
- else
14
- 'Anonymous'
15
- end
16
- end
17
-
18
- def user_link
19
- if post.user
20
- user_path = Thredded.user_path(post.user)
21
- "<a href='#{user_path}'>#{post.user}</a>".html_safe
22
- else
23
- '<a href="#">?</a>'.html_safe
24
- end
25
- end
26
-
27
- def original
28
- post
29
- end
30
-
31
- def created_at_timeago
32
- if created_at.nil?
33
- <<-eohtml.strip_heredoc.html_safe
34
- <abbr>
35
- a little while ago
36
- </abbr>
37
- eohtml
38
- else
39
- <<-eohtml.strip_heredoc.html_safe
40
- <abbr class="timeago" title="#{created_at_utc}">
41
- #{created_at_str}
42
- </abbr>
43
- eohtml
44
- end
45
- end
46
-
47
- def gravatar_url
48
- super.gsub(/http:/, '')
49
- end
50
-
51
- private
52
-
53
- def created_at_str
54
- created_at.getutc.to_s
55
- end
56
-
57
- def created_at_utc
58
- created_at.getutc.iso8601
59
- end
60
- end
61
- end
@@ -1,94 +0,0 @@
1
- module Thredded
2
- class TopicDecorator < SimpleDelegator
3
- include Rails.application.routes.url_helpers
4
- include ActionView::Helpers::UrlHelper
5
-
6
- attr_reader :topic
7
-
8
- def initialize(topic)
9
- super
10
- @topic = topic
11
- end
12
-
13
- def slug
14
- topic.slug.nil? ? topic.id : topic.slug
15
- end
16
-
17
- def css_class
18
- classes = []
19
- classes << 'locked' if locked?
20
- classes << 'sticky' if sticky?
21
- classes << 'private' if private?
22
- classes += ['category'] + categories.map(&:name) if categories.present?
23
- classes.join(' ')
24
- end
25
-
26
- def last_user_link
27
- if last_user && last_user.to_s != 'Anonymous User'
28
- last_user_path = Thredded.user_path(last_user)
29
-
30
- "<a href='#{last_user_path}'>#{last_user}</a>".html_safe
31
- else
32
- last_user.to_s
33
- end
34
- end
35
-
36
- def original
37
- topic
38
- end
39
-
40
- def updated_at_timeago
41
- if updated_at.nil?
42
- <<-eohtml.html_safe
43
- <abbr>
44
- a little while ago
45
- </abbr>
46
- eohtml
47
- else
48
- <<-eohtml.html_safe
49
- <abbr class="timeago" title="#{updated_at_utc}">
50
- #{updated_at_str}
51
- </abbr>
52
- eohtml
53
- end
54
- end
55
-
56
- def created_at_timeago
57
- if created_at.nil?
58
- <<-eohtml.html_safe
59
- <abbr class="started_at">
60
- a little while ago
61
- </abbr>
62
- eohtml
63
- else
64
- <<-eohtml.html_safe
65
- <abbr class="started_at timeago" title="#{created_at_utc}">
66
- #{created_at_str}
67
- </abbr>
68
- eohtml
69
- end
70
- end
71
-
72
- def gravatar_url
73
- super.gsub /http:/, ''
74
- end
75
-
76
- private
77
-
78
- def updated_at_str
79
- updated_at.to_s
80
- end
81
-
82
- def updated_at_utc
83
- updated_at.getutc.iso8601
84
- end
85
-
86
- def created_at_str
87
- created_at.to_s
88
- end
89
-
90
- def created_at_utc
91
- created_at.getutc.iso8601
92
- end
93
- end
94
- end