thredded 0.8.4 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +48 -9
  3. data/app/assets/images/thredded/breadcrumb-chevron.svg +1 -1
  4. data/app/assets/images/thredded/follow.svg +1 -1
  5. data/app/assets/images/thredded/moderation.svg +1 -4
  6. data/app/assets/images/thredded/private-messages.svg +1 -4
  7. data/app/assets/images/thredded/settings.svg +1 -4
  8. data/app/assets/images/thredded/unfollow.svg +1 -1
  9. data/app/assets/javascripts/thredded/components/time_stamps.es6 +1 -1
  10. data/app/assets/javascripts/thredded/components/user_preferences_form.es6 +26 -49
  11. data/app/assets/javascripts/thredded/dependencies.js +2 -1
  12. data/app/assets/stylesheets/thredded/base/_grid.scss +4 -4
  13. data/app/assets/stylesheets/thredded/base/_typography.scss +18 -0
  14. data/app/assets/stylesheets/thredded/components/_base.scss +4 -0
  15. data/app/assets/stylesheets/thredded/components/_currently-online.scss +4 -0
  16. data/app/assets/stylesheets/thredded/components/_form-list.scss +5 -0
  17. data/app/assets/stylesheets/thredded/components/_messageboard.scss +3 -0
  18. data/app/assets/stylesheets/thredded/components/_post-form.scss +7 -4
  19. data/app/assets/stylesheets/thredded/components/_post.scss +3 -0
  20. data/app/assets/stylesheets/thredded/components/_topic-delete.scss +3 -0
  21. data/app/assets/stylesheets/thredded/components/_topic-header.scss +20 -0
  22. data/app/assets/stylesheets/thredded/components/_topics.scss +13 -1
  23. data/app/assets/stylesheets/thredded/layout/_main-navigation.scss +1 -1
  24. data/app/assets/stylesheets/thredded/layout/_navigation.scss +3 -1
  25. data/app/assets/stylesheets/thredded/layout/_search-navigation.scss +4 -0
  26. data/app/assets/stylesheets/thredded/layout/_user-navigation.scss +3 -0
  27. data/app/commands/thredded/at_notification_extractor.rb +1 -2
  28. data/app/commands/thredded/autofollow_mentioned_users.rb +0 -1
  29. data/app/commands/thredded/notify_following_users.rb +20 -11
  30. data/app/commands/thredded/notify_private_topic_users.rb +12 -28
  31. data/app/controllers/thredded/application_controller.rb +8 -4
  32. data/app/controllers/thredded/messageboards_controller.rb +2 -2
  33. data/app/controllers/thredded/moderation_controller.rb +12 -13
  34. data/app/controllers/thredded/posts_controller.rb +1 -1
  35. data/app/controllers/thredded/preferences_controller.rb +11 -7
  36. data/app/controllers/thredded/private_topics_controller.rb +13 -9
  37. data/app/controllers/thredded/topics_controller.rb +20 -12
  38. data/app/forms/thredded/user_preferences_form.rb +23 -4
  39. data/app/helpers/thredded/application_helper.rb +11 -1
  40. data/app/mailers/thredded/post_mailer.rb +2 -3
  41. data/app/mailers/thredded/private_topic_mailer.rb +2 -3
  42. data/app/models/concerns/thredded/content_moderation_state.rb +1 -1
  43. data/app/models/concerns/thredded/notifier_preference.rb +18 -0
  44. data/app/models/concerns/thredded/post_common.rb +5 -1
  45. data/{lib → app/models/concerns}/thredded/search_parser.rb +0 -0
  46. data/app/models/concerns/thredded/topic_common.rb +3 -3
  47. data/{lib → app/models/concerns}/thredded/topics_search.rb +2 -3
  48. data/app/models/thredded/messageboard.rb +11 -0
  49. data/app/models/thredded/messageboard_notifications_for_followed_topics.rb +29 -0
  50. data/app/models/thredded/notifications_for_followed_topics.rb +22 -0
  51. data/app/models/thredded/notifications_for_private_topics.rb +21 -0
  52. data/app/models/thredded/post.rb +5 -3
  53. data/app/models/thredded/post_moderation_record.rb +1 -1
  54. data/app/models/thredded/private_post.rb +1 -1
  55. data/app/models/thredded/private_topic.rb +8 -4
  56. data/app/models/thredded/stats.rb +1 -1
  57. data/app/models/thredded/topic.rb +10 -7
  58. data/app/models/thredded/user_detail.rb +1 -1
  59. data/app/models/thredded/user_extender.rb +3 -1
  60. data/app/models/thredded/user_preference.rb +16 -5
  61. data/app/models/thredded/user_private_topic_read_state.rb +1 -1
  62. data/app/models/thredded/user_topic_read_state.rb +1 -1
  63. data/app/notifiers/thredded/base_notifier.rb +28 -0
  64. data/app/notifiers/thredded/email_notifier.rb +34 -0
  65. data/app/policies/thredded/post_policy.rb +3 -4
  66. data/app/policies/thredded/private_post_policy.rb +2 -3
  67. data/app/policies/thredded/topic_policy.rb +1 -2
  68. data/app/view_hooks/thredded/all_view_hooks.rb +0 -3
  69. data/app/view_models/thredded/base_topic_view.rb +0 -1
  70. data/app/view_models/thredded/post_view.rb +0 -1
  71. data/app/view_models/thredded/posts_page_view.rb +1 -4
  72. data/app/view_models/thredded/private_topic_view.rb +3 -1
  73. data/app/view_models/thredded/private_topics_page_view.rb +8 -3
  74. data/app/view_models/thredded/topic_posts_page_view.rb +1 -2
  75. data/app/view_models/thredded/topic_view.rb +3 -3
  76. data/app/view_models/thredded/topics_page_view.rb +0 -1
  77. data/app/views/thredded/messageboard_groups/new.html.erb +5 -1
  78. data/app/views/thredded/messageboards/_form.html.erb +7 -2
  79. data/app/views/thredded/posts/_form.html.erb +2 -1
  80. data/app/views/thredded/posts/edit.html.erb +3 -2
  81. data/app/views/thredded/posts_common/_form.html.erb +6 -2
  82. data/app/views/thredded/preferences/_form.html.erb +41 -29
  83. data/app/views/thredded/private_posts/_form.html.erb +1 -0
  84. data/app/views/thredded/private_topics/_form.html.erb +3 -2
  85. data/app/views/thredded/private_topics/_header.html.erb +4 -0
  86. data/app/views/thredded/private_topics/_no_private_topics.html.erb +1 -1
  87. data/app/views/thredded/private_topics/_private_topic.html.erb +5 -2
  88. data/app/views/thredded/private_topics/edit.html.erb +2 -1
  89. data/app/views/thredded/private_topics/header/_participant.html.erb +1 -0
  90. data/app/views/thredded/private_topics/index.html.erb +6 -5
  91. data/app/views/thredded/private_topics/new.html.erb +0 -1
  92. data/app/views/thredded/private_topics/private_topic/_participant.html.erb +1 -0
  93. data/app/views/thredded/private_topics/show.html.erb +1 -3
  94. data/app/views/thredded/topics/_form.html.erb +1 -1
  95. data/app/views/thredded/topics/show.html.erb +4 -5
  96. data/config/locales/en.yml +22 -9
  97. data/config/locales/pt-BR.yml +22 -10
  98. data/config/routes.rb +1 -1
  99. data/db/migrate/20160329231848_create_thredded.rb +23 -3
  100. data/db/upgrade_migrations/20160410111522_upgrade_v0_2_to_v0_3.rb +1 -1
  101. data/db/upgrade_migrations/20161113161801_upgrade_v0_8_to_v0_9.rb +56 -0
  102. data/lib/generators/thredded/install/templates/initializer.rb +28 -0
  103. data/lib/thredded.rb +32 -8
  104. data/lib/thredded/content_formatter.rb +3 -2
  105. data/lib/thredded/database_seeder.rb +11 -8
  106. data/lib/thredded/db_tools.rb +82 -0
  107. data/lib/thredded/html_pipeline/wrap_iframes_filter.rb +12 -0
  108. data/lib/thredded/version.rb +1 -1
  109. metadata +18 -8
  110. data/app/models/thredded/null_preference.rb +0 -16
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  module Thredded
3
3
  class UserPrivateTopicReadState < ActiveRecord::Base
4
- include UserTopicReadStateCommon
4
+ include Thredded::UserTopicReadStateCommon
5
5
  belongs_to :user,
6
6
  class_name: Thredded.user_class,
7
7
  inverse_of: :thredded_private_topic_read_states
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  module Thredded
3
3
  class UserTopicReadState < ActiveRecord::Base
4
- include UserTopicReadStateCommon
4
+ include Thredded::UserTopicReadStateCommon
5
5
  belongs_to :user,
6
6
  class_name: Thredded.user_class,
7
7
  inverse_of: :thredded_topic_read_states
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Thredded
4
+ class BaseNotifier
5
+ def self.validate_notifier(notifier)
6
+ unless notifier.respond_to?(:key) && /^[a-z_]+$/.match(notifier.key)
7
+ fail "Notifier problem: #{notifier.class.name} must respond to #key with a snake_case string"
8
+ end
9
+ [:human_name, :new_post, :new_private_post].each do |m|
10
+ unless notifier.respond_to?(m)
11
+ fail "#{notifier.class.name} must respond to ##{m}"
12
+ end
13
+ end
14
+ end
15
+
16
+ class NotificationsDefault
17
+ def initialize(enabled)
18
+ @enabled = enabled
19
+ end
20
+
21
+ attr_reader :enabled
22
+
23
+ def enabled?
24
+ enabled
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+ module Thredded
3
+ class EmailNotifier
4
+ def human_name
5
+ I18n.t('thredded.email_notifier.by_email')
6
+ end
7
+
8
+ def key
9
+ 'email'
10
+ end
11
+
12
+ def new_post(post, users)
13
+ PostMailer.post_notification(post.id, users.map(&:email)).deliver_now
14
+ MembersMarkedNotified.new(post, users).run
15
+ end
16
+
17
+ def new_private_post(post, users)
18
+ users = exclude_previously_notified(post, users)
19
+ return unless users.present?
20
+ PrivateTopicMailer
21
+ .message_notification(post.postable.id, users.map(&:email))
22
+ .deliver_now
23
+ MembersMarkedNotified.new(post, users).run
24
+ end
25
+
26
+ def exclude_previously_notified(post, users)
27
+ emails_notified = post.post_notifications.map(&:email)
28
+
29
+ users.reject do |user|
30
+ emails_notified.include? user.email
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require_dependency 'thredded/topic_policy'
3
2
  module Thredded
4
3
  class PostPolicy
5
4
  # The scope of readable posts.
@@ -30,7 +29,7 @@ module Thredded
30
29
  end
31
30
 
32
31
  def read?
33
- TopicPolicy.new(@user, @post.postable).read? && @post.moderation_state_visible_to_user?(@user)
32
+ Thredded::TopicPolicy.new(@user, @post.postable).read? && @post.moderation_state_visible_to_user?(@user)
34
33
  end
35
34
 
36
35
  def update?
@@ -38,7 +37,7 @@ module Thredded
38
37
  end
39
38
 
40
39
  def destroy?
41
- @post.postable.first_post != @post && update?
40
+ !@post.first_post_in_topic? && update?
42
41
  end
43
42
 
44
43
  delegate :moderate?, to: :messageboard_policy
@@ -46,7 +45,7 @@ module Thredded
46
45
  private
47
46
 
48
47
  def messageboard_policy
49
- @messageboard_policy ||= MessageboardPolicy.new(@user, @post.messageboard)
48
+ @messageboard_policy ||= Thredded::MessageboardPolicy.new(@user, @post.messageboard)
50
49
  end
51
50
 
52
51
  def own_post?
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require_dependency 'thredded/private_topic_policy'
3
2
  module Thredded
4
3
  class PrivatePostPolicy
5
4
  # @param user [Thredded.user_class]
@@ -14,7 +13,7 @@ module Thredded
14
13
  end
15
14
 
16
15
  def read?
17
- PrivateTopicPolicy.new(@user, @post.postable).read?
16
+ Thredded::PrivateTopicPolicy.new(@user, @post.postable).read?
18
17
  end
19
18
 
20
19
  def update?
@@ -22,7 +21,7 @@ module Thredded
22
21
  end
23
22
 
24
23
  def destroy?
25
- @post.postable.first_post != @post && update?
24
+ !@post.first_post_in_topic? && update?
26
25
  end
27
26
 
28
27
  private
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require_dependency 'thredded/messageboard_policy'
3
2
  module Thredded
4
3
  class TopicPolicy
5
4
  # The scope of readable topics.
@@ -23,7 +22,7 @@ module Thredded
23
22
  def initialize(user, topic)
24
23
  @user = user
25
24
  @topic = topic
26
- @messageboard_policy = MessageboardPolicy.new(user, topic.messageboard)
25
+ @messageboard_policy = Thredded::MessageboardPolicy.new(user, topic.messageboard)
27
26
  end
28
27
 
29
28
  def create?
@@ -1,7 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'thredded/view_hooks/config'
3
- require 'thredded/view_hooks/renderer'
4
-
5
2
  module Thredded
6
3
  class AllViewHooks
7
4
  # @return [PostForm]
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require_dependency 'thredded/urls_helper'
3
2
  module Thredded
4
3
  # A view model for TopicCommon.
5
4
  class BaseTopicView
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require_dependency 'thredded/urls_helper'
3
2
  module Thredded
4
3
  # A view model for PostCommon.
5
4
  class PostView
@@ -1,7 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require_dependency 'thredded/post_view'
3
- require_dependency 'thredded/topic_view'
4
- require_dependency 'thredded/private_topic_view'
5
2
  module Thredded
6
3
  # A view model for a page of PostViews.
7
4
  class PostsPageView
@@ -20,7 +17,7 @@ module Thredded
20
17
  # @param paginated_scope [ActiveRecord::Relation<Thredded::PostCommon>]
21
18
  def initialize(user, paginated_scope)
22
19
  @paginated_scope = paginated_scope
23
- @post_views = paginated_scope.map { |post| PostView.new(post, Pundit.policy!(user, post)) }
20
+ @post_views = paginated_scope.map { |post| Thredded::PostView.new(post, Pundit.policy!(user, post)) }
24
21
  end
25
22
  end
26
23
  end
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
  module Thredded
3
3
  # A view model for PrivateTopic.
4
- class PrivateTopicView < BaseTopicView
4
+ class PrivateTopicView < Thredded::BaseTopicView
5
+ delegate :users, to: :@topic
6
+
5
7
  def edit_path
6
8
  Thredded::UrlsHelper.edit_private_topic_path(@topic)
7
9
  end
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require_dependency 'thredded/private_topic_view'
3
2
  module Thredded
4
3
  # A view model for a page of BaseTopicViews.
5
4
  class PrivateTopicsPageView
@@ -15,10 +14,16 @@ module Thredded
15
14
  # @param user [Thredded.user_class] the user who is viewing the posts page
16
15
  # @param topics_page_scope [ActiveRecord::Relation<Thredded::Topic>]
17
16
  def initialize(user, topics_page_scope)
18
- @topics_page_scope = topics_page_scope
17
+ @topics_page_scope = refine_scope(topics_page_scope)
19
18
  @topic_views = @topics_page_scope.with_read_states(user).map do |(topic, read_state)|
20
- PrivateTopicView.new(topic, read_state, Pundit.policy!(user, topic))
19
+ Thredded::PrivateTopicView.new(topic, read_state, Pundit.policy!(user, topic))
21
20
  end
22
21
  end
22
+
23
+ protected
24
+
25
+ def refine_scope(topics_page_scope)
26
+ topics_page_scope.includes(:user, :last_user, :users)
27
+ end
23
28
  end
24
29
  end
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
- require_dependency 'thredded/posts_page_view'
3
2
  module Thredded
4
3
  # A view model for a page of PostViews of a Topic.
5
- class TopicPostsPageView < PostsPageView
4
+ class TopicPostsPageView < Thredded::PostsPageView
6
5
  # @return [Thredded::BaseTopicView]
7
6
  attr_reader :topic
8
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  module Thredded
3
3
  # A view model for Topic.
4
- class TopicView < BaseTopicView
4
+ class TopicView < Thredded::BaseTopicView
5
5
  delegate :categories, :id, :blocked?, :last_moderation_record, :followers,
6
6
  :last_post, :messageboard_id, :messageboard_name,
7
7
  to: :@topic
@@ -17,8 +17,8 @@ module Thredded
17
17
  def self.from_user(topic, user)
18
18
  read_state = follow = nil
19
19
  if user && !user.thredded_anonymous?
20
- read_state = UserTopicReadState.find_by(user_id: user.id, postable_id: topic.id)
21
- follow = UserTopicFollow.find_by(user_id: user.id, topic_id: topic.id)
20
+ read_state = Thredded::UserTopicReadState.find_by(user_id: user.id, postable_id: topic.id)
21
+ follow = Thredded::UserTopicFollow.find_by(user_id: user.id, topic_id: topic.id)
22
22
  end
23
23
  new(topic, read_state, follow, Pundit.policy!(user, topic))
24
24
  end
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require_dependency 'thredded/topic_view'
3
2
  module Thredded
4
3
  # A view model for a page of BaseTopicViews.
5
4
  class TopicsPageView
@@ -16,7 +16,11 @@
16
16
  <%= f.text_field :name, required: true %>
17
17
  </li>
18
18
 
19
- <li><%= f.submit t('thredded.messageboard_group.create'), class: 'thredded--form--submit' %></li>
19
+ <li>
20
+ <%= f.submit t('thredded.messageboard_group.create'),
21
+ class: 'thredded--form--submit',
22
+ 'data-disable-with' => t('thredded.messageboard_group.form.create_btn_submitting') %>
23
+ </li>
20
24
  </ul>
21
25
  <% end %>
22
26
  <% end %>
@@ -13,7 +13,12 @@
13
13
  <%= f.collection_select :messageboard_group_id, Thredded::MessageboardGroup.all, :id, :name,
14
14
  include_blank: t('thredded.messageboard.form.no_group') %>
15
15
  </li>
16
- <li><%= f.submit @messageboard.persisted? ? t('thredded.messageboard.update') : t('thredded.messageboard.create'),
17
- class: 'thredded--form--submit' %></li>
16
+ <li>
17
+ <%= f.submit @messageboard.persisted? ? t('thredded.messageboard.update') : t('thredded.messageboard.create'),
18
+ class: 'thredded--form--submit',
19
+ 'data-disable-with' => @messageboard.persisted? ?
20
+ t('thredded.messageboard.form.update_btn_submitting') :
21
+ t('thredded.messageboard.form.create_btn_submitting') %>
22
+ </li>
18
23
  </ul>
19
24
  <% end %>
@@ -2,4 +2,5 @@
2
2
  topic: topic,
3
3
  post: post,
4
4
  content_label: t('thredded.posts.form.content_label'),
5
- button_text: button_text %>
5
+ button_text: button_text,
6
+ button_submitting_text: local_assigns.key?(:button_submitting_text) ? button_submitting_text : nil %>
@@ -9,9 +9,10 @@
9
9
  <%= thredded_page do %>
10
10
  <section class="thredded--main-section">
11
11
  <%= render 'thredded/posts/form',
12
- messageboard: messageboard,
12
+ messageboard: (messageboard unless @post.private_topic_post?),
13
13
  topic: topic,
14
14
  post: @post,
15
- button_text: t('thredded.posts.form.update_btn') %>
15
+ button_text: t('thredded.posts.form.update_btn'),
16
+ button_submitting_text: t('thredded.posts.form.update_btn_submitting')%>
16
17
  </section>
17
18
  <% end %>
@@ -1,3 +1,4 @@
1
+ <%# locals: messageboard, topic, post, content_label, button_text, button_submitting_text. %>
1
2
  <%= form_for (post.private_topic_post? ? [topic, post] : [messageboard, topic, post]), as: :post,
2
3
  html: {
3
4
  class: 'thredded--form thredded--post-form',
@@ -7,9 +8,12 @@
7
8
  } do |form| %>
8
9
  <ul class="thredded--form-list">
9
10
  <%= render 'thredded/posts_common/form/content_field', form: form, content_label: content_label %>
10
-
11
11
  <li>
12
- <%= form.submit button_text, class: 'thredded--form--submit' %>
12
+ <% button_submitting_text ||=
13
+ post.persisted? ? t('thredded.form.update_btn_submitting') : t('thredded.form.create_btn_submitting') %>
14
+ <button type="submit" class="thredded--form--submit" data-disable-with="<%= button_submitting_text %>">
15
+ <%= button_text %>
16
+ </button>
13
17
  </li>
14
18
  </ul>
15
19
  <% end %>
@@ -11,31 +11,37 @@
11
11
  <ul class="thredded--form-list">
12
12
  <li>
13
13
  <%= f.label :follow_topics_on_mention do %>
14
- <%= f.check_box :follow_topics_on_mention %>
14
+ <%= f.check_box :follow_topics_on_mention, 'data-thredded-bound-messageboard-pref' => 'user_preferences_form[messageboard_follow_topics_on_mention]' %>
15
15
  <%= t 'thredded.preferences.form.follow_topics_on_mention.label' %>
16
16
  <p class="thredded--form-list--hint">
17
17
  <%= t 'thredded.preferences.form.follow_topics_on_mention.hint' %>
18
18
  </p>
19
19
  <% end %>
20
20
  </li>
21
- <li>
22
- <%= f.label :followed_topic_emails do %>
23
- <%= f.check_box :followed_topic_emails %>
24
- <%= t 'thredded.preferences.form.followed_topic_emails.label' %>
25
- <p class="thredded--form-list--hint">
26
- <%= t 'thredded.preferences.form.followed_topic_emails.hint' %>
27
- </p>
28
- <% end %>
29
- </li>
30
- <li>
31
- <%= f.label :notify_on_message do %>
32
- <%= f.check_box :notify_on_message %>
33
- <%= t 'thredded.preferences.form.notify_on_message.label' %>
34
- <p class="thredded--form-list--hint">
35
- <%= t 'thredded.preferences.form.notify_on_message.hint' %>
36
- </p>
37
- <% end %>
38
- </li>
21
+ <% if Thredded.notifiers.present? %>
22
+ <li>
23
+ <label><%= t 'thredded.preferences.form.notifications_for_followed_topics.label' %></label>
24
+ <%= f.fields_for :notifications_for_followed_topics, preferences.notifications_for_followed_topics do |fn| %>
25
+ <%= fn.label :enabled do %>
26
+ <%= fn.hidden_field :notifier_key %>
27
+ <%= fn.check_box :enabled,
28
+ 'data-thredded-bound-messageboard-pref' =>
29
+ "user_preferences_form[messageboard_notifications_for_followed_topics_attributes][#{fn.index}][enabled]" %>
30
+ <%= fn.object.notifier_human_name %>
31
+ <%- end %>
32
+ <%- end %>
33
+ </li>
34
+ <li>
35
+ <label><%= t 'thredded.preferences.form.notifications_for_private_topics.label' %></label>
36
+ <%= f.fields_for :notifications_for_private_topics, preferences.notifications_for_private_topics do |fn| %>
37
+ <%= fn.label :enabled do %>
38
+ <%= fn.hidden_field :notifier_key %>
39
+ <%= fn.check_box :enabled %>
40
+ <%= fn.object.notifier_human_name %>
41
+ <% end %>
42
+ <% end %>
43
+ </li>
44
+ <% end %>
39
45
  </ul>
40
46
  <% if preferences.messageboard %>
41
47
  <h3>
@@ -51,18 +57,24 @@
51
57
  </p>
52
58
  <% end %>
53
59
  </li>
54
- <li>
55
- <%= f.label :messageboard_followed_topic_emails do %>
56
- <%= f.check_box :messageboard_followed_topic_emails %>
57
- <%= t 'thredded.preferences.form.messageboard_followed_topic_emails.label' %>
58
- <p class="thredded--form-list--hint">
59
- <%= t 'thredded.preferences.form.messageboard_followed_topic_emails.hint' %>
60
- </p>
61
- <% end %>
62
- </li>
60
+ <% if Thredded.notifiers.present? %>
61
+ <li>
62
+ <label><%= t 'thredded.preferences.form.messageboard_notifications_for_followed_topics.label' %></label>
63
+ <%= f.fields_for :messageboard_notifications_for_followed_topics,
64
+ preferences.messageboard_notifications_for_followed_topics do |fn| %>
65
+ <%= fn.label :enabled do %>
66
+ <%= fn.hidden_field :notifier_key %>
67
+ <%= fn.hidden_field :messageboard_id %>
68
+ <%= fn.check_box :enabled %>
69
+ <%= fn.object.notifier_human_name %>
70
+ <% end %>
71
+ <%- end %>
72
+ </li>
73
+ <% end %>
63
74
  </ul>
64
75
  <% end %>
65
- <button type="submit" class="thredded--form--submit">
76
+ <button type="submit" class="thredded--form--submit"
77
+ data-disable-with="<%= t 'thredded.preferences.form.update_btn_submitting' %>">
66
78
  <%= t 'thredded.preferences.form.submit_btn' %>
67
79
  </button>
68
80
  <% end %>
@@ -2,4 +2,5 @@
2
2
  topic: topic,
3
3
  post: post,
4
4
  button_text: t('thredded.private_posts.form.create_btn'),
5
+ button_submitting_text: t('thredded.private_posts.form.create_btn_submitting'),
5
6
  content_label: t('thredded.private_posts.form.content_label') %>
@@ -1,6 +1,6 @@
1
1
  <%= form_for private_topic,
2
2
  url: private_topics_path(@private_topic),
3
- html: { class: "thredded--form #{local_assigns[:css_class]}", 'data-thredded-topic-form' => true } do |form| %>
3
+ html: { class: "thredded--form thredded--new-private-topic-form #{local_assigns[:css_class]}", 'data-thredded-topic-form' => true } do |form| %>
4
4
 
5
5
  <ul class="thredded--form-list on-top">
6
6
  <li class="title">
@@ -21,7 +21,8 @@
21
21
  content_label: t('thredded.private_topics.form.content_label') %>
22
22
 
23
23
  <li>
24
- <button type="submit" class="thredded--form--submit">
24
+ <button type="submit" class="thredded--form--submit"
25
+ data-disable-with="<%= t 'thredded.private_topics.form.create_btn_submitting' %>">
25
26
  <%= t('thredded.private_topics.form.create_btn') %>
26
27
  </button>
27
28
  </li>