simple_discussion 0.9.3 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/FUNDING.yml +12 -0
- data/CHANGELOG.md +3 -0
- data/README.md +3 -1
- data/app/assets/stylesheets/simple_discussion.scss +40 -2
- data/app/controllers/simple_discussion/application_controller.rb +14 -2
- data/app/controllers/simple_discussion/forum_posts_controller.rb +9 -3
- data/app/controllers/simple_discussion/forum_threads_controller.rb +2 -2
- data/app/models/forum_thread.rb +5 -5
- data/app/views/layouts/simple_discussion.html.erb +61 -18
- data/app/views/simple_discussion/forum_posts/_form.html.erb +2 -2
- data/app/views/simple_discussion/forum_posts/_forum_post.html.erb +17 -10
- data/app/views/simple_discussion/forum_posts/edit.html.erb +7 -3
- data/app/views/simple_discussion/forum_threads/_form.html.erb +8 -8
- data/app/views/simple_discussion/forum_threads/_forum_thread.html.erb +5 -5
- data/app/views/simple_discussion/forum_threads/edit.html.erb +1 -1
- data/app/views/simple_discussion/forum_threads/index.html.erb +11 -9
- data/app/views/simple_discussion/forum_threads/new.html.erb +1 -1
- data/app/views/simple_discussion/forum_threads/show.html.erb +15 -10
- data/config/locales/en.yml +45 -0
- data/config/locales/es.yml +41 -0
- data/config/locales/fr.yml +47 -0
- data/db/migrate/20170417012930_create_forum_categories.rb +1 -1
- data/db/migrate/20170417012931_create_forum_threads.rb +1 -1
- data/db/migrate/20170417012932_create_forum_posts.rb +1 -1
- data/db/migrate/20170417012933_create_forum_subscriptions.rb +1 -1
- data/lib/simple_discussion/version.rb +1 -1
- data/simple_discussion.gemspec +1 -1
- metadata +13 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 20ef7fd5da8bb052ef36f73fbbd24661032fe5e14453e611a208a6f0f405e80a
|
4
|
+
data.tar.gz: 1e4c484430c87b3122358dce54c744c7c5611710d3175b27c24dad9c58f39257
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29755f4463b66a8420840b4639c520441b9c9820e2759e351d4d4e8056f2c0f867cf635f771b5f13f5393bd2ce86bb340307cb9367635eec0ab60d67a86e80ee
|
7
|
+
data.tar.gz: d7a0af8b494062a347310281a22a7f41b79ba10a060a82130586160f584a007c1166ff294b6881da3b05c5f9ee4ab2f9ae5d14110e6461e6b10d4b2bfa93d786
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# These are supported funding model platforms
|
2
|
+
|
3
|
+
github: [excid3] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
4
|
+
patreon: # Replace with a single Patreon username
|
5
|
+
open_collective: # Replace with a single Open Collective username
|
6
|
+
ko_fi: # Replace with a single Ko-fi username
|
7
|
+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
8
|
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
9
|
+
liberapay: # Replace with a single Liberapay username
|
10
|
+
issuehunt: # Replace with a single IssueHunt username
|
11
|
+
otechie: # Replace with a single Otechie username
|
12
|
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -4,6 +4,8 @@ SimpleDiscussion is a Rails forum gem extracting the [forum from GoRails](https:
|
|
4
4
|
|
5
5
|
Out of the box, SimpleDiscussion comes with styling for Boostrap v4 but you're free to customize the UI as much as you like by installing the views and tweaking the HTML.
|
6
6
|
|
7
|
+
[![GoRails Forum](https://d3vv6lp55qjaqc.cloudfront.net/items/3j2p3o1j0d1O0R1w2j1Y/Screen%20Shot%202017-08-08%20at%203.12.01%20PM.png?X-CloudApp-Visitor-Id=51470&v=d439dcae)](https://d3vv6lp55qjaqc.cloudfront.net/items/3j2p3o1j0d1O0R1w2j1Y/Screen%20Shot%202017-08-08%20at%203.12.01%20PM.png?X-CloudApp-Visitor-Id=51470&v=d439dcae)
|
8
|
+
|
7
9
|
## Installation
|
8
10
|
|
9
11
|
Before you get started, SimpleDiscussion requires a `User` model in your application (for now).
|
@@ -119,4 +121,4 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
119
121
|
|
120
122
|
## Code of Conduct
|
121
123
|
|
122
|
-
Everyone interacting in the SimpleDiscussion project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
124
|
+
Everyone interacting in the SimpleDiscussion project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/excid3/simple_discussion/blob/master/CODE_OF_CONDUCT.md).
|
@@ -20,8 +20,28 @@
|
|
20
20
|
|
21
21
|
/* Formatting for the forum threads */
|
22
22
|
.forum-thread {
|
23
|
-
|
24
|
-
|
23
|
+
margin-bottom: -20px;
|
24
|
+
|
25
|
+
h4 {
|
26
|
+
margin-bottom: 4px;
|
27
|
+
|
28
|
+
a {
|
29
|
+
color: #222;
|
30
|
+
font-size: 16px;
|
31
|
+
font-weight: normal;
|
32
|
+
line-height: 1.1;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
.forum-thread-filters a {
|
38
|
+
color: #555555;
|
39
|
+
display: block;
|
40
|
+
|
41
|
+
&:hover {
|
42
|
+
color: #222222;
|
43
|
+
font-weight: bold;
|
44
|
+
text-decoration: none
|
25
45
|
}
|
26
46
|
}
|
27
47
|
|
@@ -45,6 +65,11 @@
|
|
45
65
|
font-weight: 300;
|
46
66
|
line-height: 1em;
|
47
67
|
}
|
68
|
+
|
69
|
+
&:hover {
|
70
|
+
color: #222;
|
71
|
+
text-decoration: none;
|
72
|
+
}
|
48
73
|
}
|
49
74
|
|
50
75
|
/* Formatting for the forum posts themselves */
|
@@ -64,3 +89,16 @@
|
|
64
89
|
border: 2px solid #5cb85c;
|
65
90
|
}
|
66
91
|
}
|
92
|
+
|
93
|
+
/* Formatting for the forum hr to match card border */
|
94
|
+
.simple_discussion hr {
|
95
|
+
border: 0;
|
96
|
+
border-top: 1px solid rgba(0, 0, 0, 0.125);
|
97
|
+
margin: 24px -20px;
|
98
|
+
}
|
99
|
+
|
100
|
+
.simple_discussion .text-muted {
|
101
|
+
color: #999;
|
102
|
+
margin-top: 6px;
|
103
|
+
font-size: 13px;
|
104
|
+
}
|
@@ -17,9 +17,21 @@ class SimpleDiscussion::ApplicationController < ::ApplicationController
|
|
17
17
|
end
|
18
18
|
helper_method :is_moderator?
|
19
19
|
|
20
|
-
def
|
20
|
+
def require_mod_or_author_for_post!
|
21
|
+
unless is_moderator_or_owner?(@forum_post)
|
22
|
+
redirect_to_root
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def require_mod_or_author_for_thread!
|
21
27
|
unless is_moderator_or_owner?(@forum_thread)
|
22
|
-
|
28
|
+
redirect_to_root
|
23
29
|
end
|
24
30
|
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def redirect_to_root
|
35
|
+
redirect_to simple_discussion.root_path, alert: "You aren't allowed to do that."
|
36
|
+
end
|
25
37
|
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
class SimpleDiscussion::ForumPostsController < SimpleDiscussion::ApplicationController
|
2
2
|
before_action :authenticate_user!
|
3
3
|
before_action :set_forum_thread
|
4
|
-
before_action :set_forum_post, only: [:edit, :update]
|
5
|
-
before_action :
|
4
|
+
before_action :set_forum_post, only: [:edit, :update, :destroy]
|
5
|
+
before_action :require_mod_or_author_for_post!, only: [:edit, :update, :destroy]
|
6
|
+
before_action :require_mod_or_author_for_thread!, only: [:solved, :unsolved]
|
6
7
|
|
7
8
|
def create
|
8
9
|
@forum_post = @forum_thread.forum_posts.new(forum_post_params)
|
@@ -27,6 +28,11 @@ class SimpleDiscussion::ForumPostsController < SimpleDiscussion::ApplicationCont
|
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
31
|
+
def destroy
|
32
|
+
@forum_post.destroy!
|
33
|
+
redirect_to simple_discussion.forum_thread_path(@forum_thread)
|
34
|
+
end
|
35
|
+
|
30
36
|
def solved
|
31
37
|
@forum_post = @forum_thread.forum_posts.find(params[:id])
|
32
38
|
|
@@ -53,7 +59,7 @@ class SimpleDiscussion::ForumPostsController < SimpleDiscussion::ApplicationCont
|
|
53
59
|
end
|
54
60
|
|
55
61
|
def set_forum_post
|
56
|
-
if
|
62
|
+
if is_moderator?
|
57
63
|
@forum_post = @forum_thread.forum_posts.find(params[:id])
|
58
64
|
else
|
59
65
|
@forum_post = current_user.forum_posts.find(params[:id])
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class SimpleDiscussion::ForumThreadsController < SimpleDiscussion::ApplicationController
|
2
2
|
before_action :authenticate_user!, only: [:mine, :participating, :new, :create]
|
3
3
|
before_action :set_forum_thread, only: [:show, :edit, :update]
|
4
|
-
before_action :
|
4
|
+
before_action :require_mod_or_author_for_thread!, only: [:edit, :update]
|
5
5
|
|
6
6
|
def index
|
7
7
|
@forum_threads = ForumThread.pinned_first.sorted.includes(:user, :forum_category).paginate(page: page_number)
|
@@ -54,7 +54,7 @@ class SimpleDiscussion::ForumThreadsController < SimpleDiscussion::ApplicationCo
|
|
54
54
|
|
55
55
|
def update
|
56
56
|
if @forum_thread.update(forum_thread_params)
|
57
|
-
redirect_to simple_discussion.forum_thread_path(@forum_thread), notice:
|
57
|
+
redirect_to simple_discussion.forum_thread_path(@forum_thread), notice: I18n.t('your_changes_were_saved')
|
58
58
|
else
|
59
59
|
render action: :edit
|
60
60
|
end
|
data/app/models/forum_thread.rb
CHANGED
@@ -56,20 +56,20 @@ class ForumThread < ApplicationRecord
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def subscribed_reason(user)
|
59
|
-
return
|
59
|
+
return I18n.t('.not_receiving_notifications') if user.nil?
|
60
60
|
|
61
61
|
subscription = subscription_for(user)
|
62
62
|
|
63
63
|
if subscription.present?
|
64
64
|
if subscription.subscription_type == "optout"
|
65
|
-
|
65
|
+
I18n.t('.ignoring_thread')
|
66
66
|
elsif subscription.subscription_type == "optin"
|
67
|
-
|
67
|
+
I18n.t('.receiving_notifications_because_subscribed')
|
68
68
|
end
|
69
69
|
elsif forum_posts.where(user_id: user.id).any?
|
70
|
-
|
70
|
+
I18n.t('.receiving_notifications_because_posted')
|
71
71
|
else
|
72
|
-
|
72
|
+
I18n.t('.not_receiving_notifications')
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
@@ -1,30 +1,68 @@
|
|
1
|
-
<div class="row">
|
2
|
-
<
|
1
|
+
<div class="row col-md-12">
|
2
|
+
<h1>
|
3
|
+
<%= t('community') %>
|
4
|
+
</h1>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<div class="row simple_discussion">
|
8
|
+
<div class="col-md-3 mb-3">
|
3
9
|
|
4
|
-
<div class="card card-
|
5
|
-
<%= link_to '
|
10
|
+
<div class="card card-body">
|
11
|
+
<%= link_to t('ask_a_question'), simple_discussion.new_forum_thread_path, class: "btn btn-outline-primary btn-block" %>
|
6
12
|
<hr />
|
7
13
|
|
8
14
|
<div class="forum-thread-filters">
|
9
|
-
<h5
|
10
|
-
|
15
|
+
<h5>
|
16
|
+
<strong>
|
17
|
+
<%= t('filters') %>
|
18
|
+
</strong>
|
19
|
+
</h5>
|
20
|
+
<div>
|
21
|
+
<%= forum_link_to simple_discussion.forum_threads_path, exact: true do %>
|
22
|
+
<%= icon "fa-fw fas", "bars" %>
|
23
|
+
<%= t('.all_threads') %>
|
24
|
+
<% end %>
|
25
|
+
</div>
|
11
26
|
<% if user_signed_in? %>
|
12
|
-
<div
|
13
|
-
|
27
|
+
<div>
|
28
|
+
<%= forum_link_to simple_discussion.mine_forum_threads_path do %><%= icon "fa-fw far", "user-circle" %>
|
29
|
+
<%= t('.my_questions') %>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
32
|
+
<div>
|
33
|
+
<%= forum_link_to simple_discussion.participating_forum_threads_path do %>
|
34
|
+
<%= icon "fa-fw far", "comments" %>
|
35
|
+
<%= t('.participating') %>
|
36
|
+
<% end %>
|
37
|
+
</div>
|
14
38
|
<% end %>
|
15
|
-
<div
|
16
|
-
|
39
|
+
<div>
|
40
|
+
<%= forum_link_to simple_discussion.answered_forum_threads_path do %>
|
41
|
+
<%= icon "fa-fw fas", "check" %>
|
42
|
+
<%= t('.answered') %>
|
43
|
+
<% end %>
|
44
|
+
</div>
|
45
|
+
<div>
|
46
|
+
<%= forum_link_to simple_discussion.unanswered_forum_threads_path do %>
|
47
|
+
<%= icon "fa-fw fas", "question" %>
|
48
|
+
<%= t('.unanswered') %>
|
49
|
+
<% end %>
|
50
|
+
</div>
|
17
51
|
</div>
|
18
52
|
|
19
53
|
<hr />
|
20
54
|
|
21
55
|
<div class="forum-thread-filters">
|
22
|
-
<
|
23
|
-
|
56
|
+
<h6>
|
57
|
+
<strong>
|
58
|
+
<%= t('.by_category') %>
|
59
|
+
</strong>
|
60
|
+
</h6>
|
61
|
+
<div><%= forum_link_to simple_discussion.forum_threads_path, exact: true do %><%= icon "fa-fw fas", "circle" %> All<% end %></div>
|
24
62
|
<% ForumCategory.sorted.each do |category| %>
|
25
63
|
<div>
|
26
64
|
<%= forum_link_to simple_discussion.forum_category_forum_threads_path(category) do %>
|
27
|
-
<%= icon "circle", style: "color: #{category.color}" %>
|
65
|
+
<%= icon "fa-fw fas", "circle", style: "color: #{category.color}" %>
|
28
66
|
<%= category.name %>
|
29
67
|
<% end %>
|
30
68
|
</div>
|
@@ -35,13 +73,14 @@
|
|
35
73
|
<hr />
|
36
74
|
|
37
75
|
<%# User has not posted in the thread or subscribed %>
|
38
|
-
<h5
|
76
|
+
<h5><%= t('.notifications') %></h5>
|
39
77
|
|
40
78
|
<%= link_to simple_discussion.forum_thread_notifications_path(@forum_thread), method: :post, class: "btn btn-secondary btn-sm btn-block mb-2" do %>
|
41
79
|
<% if @forum_thread.subscribed? current_user %>
|
42
|
-
<%= icon "bell-slash" %>
|
80
|
+
<%= icon "fa-fw fas", "bell-slash" %> <%= t('.unsubscribe') %>
|
43
81
|
<% else %>
|
44
|
-
<%= icon "bell" %>
|
82
|
+
<%= icon "fa-fw fas", "bell" %>
|
83
|
+
<%= t('.suscribe') %>
|
45
84
|
<% end %>
|
46
85
|
<% end %>
|
47
86
|
|
@@ -51,8 +90,12 @@
|
|
51
90
|
|
52
91
|
</div>
|
53
92
|
|
54
|
-
<div class="col">
|
55
|
-
|
93
|
+
<div class="col-md-9 mb-3">
|
94
|
+
|
95
|
+
<div class="card card-body">
|
96
|
+
<%= yield %>
|
97
|
+
</div>
|
98
|
+
|
56
99
|
</div>
|
57
100
|
</div>
|
58
101
|
|
@@ -15,7 +15,7 @@
|
|
15
15
|
<% end %>
|
16
16
|
|
17
17
|
<div class="form-group">
|
18
|
-
<%= f.text_area :body, placeholder:
|
18
|
+
<%= f.text_area :body, placeholder: t('add_a_comment'), rows: 8, class: "form-control simplemde", data: { behavior: "comment-body" } %>
|
19
19
|
</div>
|
20
20
|
|
21
21
|
<div class="text-right">
|
@@ -26,7 +26,7 @@
|
|
26
26
|
</small>
|
27
27
|
</div>
|
28
28
|
|
29
|
-
<%= f.button "#{
|
29
|
+
<%= f.button "#{f.object.new_record? ? t('comment') : t('update_comment') }", class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> #{t('saving_comment')}"} %>
|
30
30
|
</div>
|
31
31
|
|
32
32
|
<% end %>
|
@@ -4,11 +4,18 @@
|
|
4
4
|
<div class="card-header">
|
5
5
|
|
6
6
|
<% if is_moderator_or_owner?(forum_post) %>
|
7
|
-
<div class="
|
8
|
-
<%= link_to icon("
|
7
|
+
<div class="float-right">
|
8
|
+
<%= link_to icon("fas","edit"), simple_discussion.edit_forum_thread_forum_post_path(@forum_thread, forum_post),
|
9
9
|
class: "text-muted",
|
10
10
|
data: { toggle: "tooltip", placement: "left" },
|
11
|
-
title:
|
11
|
+
title: t('edit_this_post')
|
12
|
+
%>
|
13
|
+
|
14
|
+
<%= link_to icon("fas","trash"), simple_discussion.forum_thread_forum_post_path(@forum_thread, forum_post),
|
15
|
+
class: "text-muted",
|
16
|
+
method: :delete,
|
17
|
+
data: { toggle: "tooltip", placement: "left", confirm: "Are you sure you want to delete this post?" },
|
18
|
+
title: t('edit_this_post')
|
12
19
|
%>
|
13
20
|
</div>
|
14
21
|
<% end %>
|
@@ -20,25 +27,25 @@
|
|
20
27
|
<%= forum_post.user.name %> <%= forum_user_badge(forum_post.user) %>
|
21
28
|
</strong>
|
22
29
|
<small>
|
23
|
-
|
30
|
+
<%= t('commented_on') %>
|
24
31
|
<%= link_to forum_post.created_at.strftime("%b %d, %Y"), simple_discussion.forum_thread_path(@forum_thread, anchor: "forum_post_#{forum_post.id}") %>:
|
25
32
|
</small>
|
26
33
|
</div>
|
27
34
|
</div>
|
28
35
|
|
29
|
-
<div class="card-
|
36
|
+
<div class="card-body">
|
30
37
|
<%= formatted_content forum_post.body %>
|
31
38
|
</div>
|
32
39
|
|
33
40
|
<% if @forum_thread.solved? && forum_post.solved? %>
|
34
41
|
<div class="card-footer">
|
35
42
|
<div class="pull-right">
|
36
|
-
<strong class="text-success"><%= icon("check") %>
|
43
|
+
<strong class="text-success"><%= icon("fas","check") %> <%= t('solved') %></strong>
|
37
44
|
|
38
45
|
<% if is_moderator_or_owner?(@forum_thread) %>
|
39
46
|
<small>
|
40
|
-
<%= link_to
|
41
|
-
</small
|
47
|
+
<%= link_to t('undo'), simple_discussion.unsolved_forum_thread_forum_post_path(@forum_thread, forum_post), method: :put %>
|
48
|
+
</small>
|
42
49
|
<% end %>
|
43
50
|
</div>
|
44
51
|
</div>
|
@@ -48,8 +55,8 @@
|
|
48
55
|
<div class="pull-right">
|
49
56
|
<small>
|
50
57
|
<%= link_to simple_discussion.solved_forum_thread_forum_post_path(@forum_thread, forum_post), method: :put do %>
|
51
|
-
<%= icon("check") %>
|
52
|
-
|
58
|
+
<%= icon("fas","fas","check") %>
|
59
|
+
<%= t('this_solved_my_question') %>
|
53
60
|
<% end %>
|
54
61
|
</small>
|
55
62
|
</div>
|
@@ -4,7 +4,8 @@
|
|
4
4
|
|
5
5
|
<p class="thread-details">
|
6
6
|
<strong><%= category_link(@forum_thread.forum_category) %></strong>
|
7
|
-
•
|
7
|
+
• <%= t('asked_time_ago', time: time_ago_in_words(@forum_thread.created_at), author: @forum_thread.user.name) %>
|
8
|
+
</p>
|
8
9
|
</p>
|
9
10
|
|
10
11
|
<br />
|
@@ -14,11 +15,14 @@
|
|
14
15
|
<div>
|
15
16
|
<%= avatar_tag(@forum_post.user.email) %>
|
16
17
|
<strong class="forum-post-user"><%= @forum_post.user.name %></strong>
|
17
|
-
<small>
|
18
|
+
<small>
|
19
|
+
<%= t('commented_on')%>
|
20
|
+
<%= link_to @forum_post.created_at.strftime("%b %d, %Y"), simple_discussion.forum_thread_url(@forum_thread, anchor: "forum_post_#{@forum_post.id}") %>:
|
21
|
+
</small>
|
18
22
|
</div>
|
19
23
|
</div>
|
20
24
|
|
21
|
-
<div class="card-
|
25
|
+
<div class="card-body">
|
22
26
|
<%= render "form" %>
|
23
27
|
</div>
|
24
28
|
<% end %>
|
@@ -15,29 +15,29 @@
|
|
15
15
|
<% end %>
|
16
16
|
|
17
17
|
<div class="form-group">
|
18
|
-
<%= f.label :forum_category_id,
|
19
|
-
<%= f.collection_select :forum_category_id, ForumCategory.sorted, :id, :name, {include_blank:
|
18
|
+
<%= f.label :forum_category_id, t('choose_a_category') %>
|
19
|
+
<%= f.collection_select :forum_category_id, ForumCategory.sorted, :id, :name, {include_blank: t('pick_a_category')}, {autofocus: true, class: "form-control"} %>
|
20
20
|
</div>
|
21
21
|
|
22
22
|
<div class="form-group">
|
23
|
-
<%= f.label
|
24
|
-
<%= f.text_field :title, placeholder:
|
23
|
+
<%= f.label t('title') %>
|
24
|
+
<%= f.text_field :title, placeholder: t('how_do_i'), class: "form-control" %>
|
25
25
|
</div>
|
26
26
|
|
27
27
|
<% if local_assigns.fetch(:posts, true) %>
|
28
28
|
<%= f.fields_for :forum_posts do |p| %>
|
29
29
|
<div class="form-group">
|
30
|
-
<%= p.label :body,
|
31
|
-
<%= p.text_area :body, placeholder:
|
30
|
+
<%= p.label :body, t('what_help_needed') %>
|
31
|
+
<%= p.text_area :body, placeholder: t('add_a_comment'), rows: 10, class: "form-control simplemde", data: { behavior: "comment-body" } %>
|
32
32
|
</div>
|
33
33
|
<% end %>
|
34
34
|
<% end %>
|
35
35
|
|
36
36
|
<div class="form-group text-right">
|
37
37
|
<% if f.object.new_record? %>
|
38
|
-
<%= f.button
|
38
|
+
<%= f.button t('ask_your_question'), class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> #{t('saving')}"} %>
|
39
39
|
<% else %>
|
40
|
-
<%= f.button "Update Thread", class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i>
|
40
|
+
<%= f.button "Update Thread", class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> #{t('saving')}"} %>
|
41
41
|
<% end %>
|
42
42
|
</div>
|
43
43
|
|
@@ -9,26 +9,26 @@
|
|
9
9
|
<div class="col">
|
10
10
|
<h4>
|
11
11
|
<% if forum_thread.solved? %>
|
12
|
-
<span class="text-success"><%= icon "check-circle" %></span>
|
12
|
+
<span class="text-success"><%= icon "fas", "check-circle" %></span>
|
13
13
|
<% end %>
|
14
14
|
|
15
15
|
<%= link_to simple_discussion.forum_thread_path(forum_thread) do %>
|
16
|
-
<%= icon "thumb-tack", class: "text-muted" if forum_thread.pinned? %> <%= forum_thread.title %>
|
16
|
+
<%= icon "fas", "thumb-tack", class: "text-muted" if forum_thread.pinned? %> <%= forum_thread.title %>
|
17
17
|
<% end %>
|
18
18
|
</h4>
|
19
19
|
|
20
20
|
<div class="thread-details">
|
21
21
|
<strong><%= category_link(forum_thread.forum_category) %></strong>
|
22
|
-
•
|
22
|
+
• <%= t('asked_time_ago', time: time_ago_in_words(forum_thread.created_at), author: forum_thread.user.name) %>
|
23
23
|
</div>
|
24
24
|
|
25
25
|
<p class="text-muted"><%= truncate(forum_thread.forum_posts.first.body, length: 200) %></p>
|
26
26
|
</div>
|
27
27
|
|
28
|
-
<div class="col-sm-
|
28
|
+
<div class="col-sm-2 text-center">
|
29
29
|
<%= link_to simple_discussion.forum_thread_path(forum_thread), class: "thread-posts-count" do %>
|
30
30
|
<span class="count"><%= forum_thread.forum_posts_count %></span>
|
31
|
-
<small><%= "post"
|
31
|
+
<small><%= t("post", count: forum_thread.forum_posts_count) %></small>
|
32
32
|
<% end %>
|
33
33
|
</div>
|
34
34
|
|
@@ -1,11 +1,13 @@
|
|
1
|
-
|
2
|
-
<%= render partial: "simple_discussion/forum_threads/forum_thread", collection: @forum_threads, spacer_template: "shared/spacer" %>
|
1
|
+
<% if @forum_threads.none? %>
|
3
2
|
|
4
|
-
|
5
|
-
<div>No results found for your search. Check out <%= link_to "the latest questions", simple_discussion.forum_threads_path %> instead?</div>
|
6
|
-
<% end %>
|
7
|
-
</div>
|
3
|
+
<div><%= t('search_not_found') %>. <%= t('check_out') %> <%= link_to t('latest_questions'), simple_discussion.forum_threads_path %> <%= t('instead') %> </div>
|
8
4
|
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
<% else %>
|
6
|
+
|
7
|
+
<%= render partial: "simple_discussion/forum_threads/forum_thread", collection: @forum_threads, spacer_template: "shared/spacer" %>
|
8
|
+
|
9
|
+
<div class="forum-threads-nav text-center">
|
10
|
+
<%= will_paginate @forum_threads, url_builder: simple_discussion, renderer: SimpleDiscussion::BootstrapLinkRenderer %>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<% end %>
|
@@ -1,17 +1,22 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
|
4
|
-
<div class="pull-right">
|
5
|
-
<%= link_to icon("pencil"), simple_discussion.edit_forum_thread_path(@forum_thread),
|
6
|
-
class: "text-muted",
|
7
|
-
data: { toggle: "tooltip", placement: "left" },
|
8
|
-
title: "Edit this thread" %>
|
1
|
+
<div class="row">
|
2
|
+
<div class="col-md-11">
|
3
|
+
<h1><%= icon "fas", "thumb-tack", class: "text-muted" if @forum_thread.pinned? %> <%= @forum_thread.title %></h1>
|
9
4
|
</div>
|
10
|
-
|
5
|
+
|
6
|
+
<% if is_moderator_or_owner?(@forum_thread) %>
|
7
|
+
<div class="col-md-1">
|
8
|
+
<%= link_to icon("fas","pencil"), simple_discussion.edit_forum_thread_path(@forum_thread),
|
9
|
+
class: "text-muted",
|
10
|
+
data: { toggle: "tooltip", placement: "left" },
|
11
|
+
title: t('edit_this_thread') %>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
</div>
|
11
16
|
|
12
17
|
<p class="thread-details">
|
13
18
|
<strong><%= category_link(@forum_thread.forum_category) %></strong>
|
14
|
-
•
|
19
|
+
• <%= t('asked_time_ago', time: time_ago_in_words(@forum_thread.created_at), author: @forum_thread.user.name) %>
|
15
20
|
</p>
|
16
21
|
|
17
22
|
<%= render partial: "simple_discussion/forum_posts/forum_post", collection: @forum_thread.forum_posts.includes(:user).sorted %>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
en:
|
2
|
+
start_a_discussion: Start A Discussion
|
3
|
+
add_a_comment: Add A Comment
|
4
|
+
ask_a_question: Ask A Question
|
5
|
+
asked_time_ago: "Asked %{time} ago by %{author}"
|
6
|
+
choose_a_category: Choose a Category
|
7
|
+
comment: Comment
|
8
|
+
commented_on: Commented on
|
9
|
+
community: Community
|
10
|
+
edit_this_post: Edit this post
|
11
|
+
edit_this_thread: Edit this thread
|
12
|
+
edit_thread: Edit thread
|
13
|
+
filters: Filters
|
14
|
+
how_do_i: How do I...?
|
15
|
+
ignoring_thread: You're ignoring this thread.
|
16
|
+
not_receiving_notifications: You’re not receiving notifications from this thread.
|
17
|
+
layouts:
|
18
|
+
simple_discussion:
|
19
|
+
all_threads: All Threads
|
20
|
+
answered: Answered
|
21
|
+
by_category: By Category
|
22
|
+
my_questions: My Questions
|
23
|
+
notifications: Notifications
|
24
|
+
participating: Participating
|
25
|
+
suscribe: Subscribe
|
26
|
+
unsubscribe: Unsubscribe
|
27
|
+
unanswered: Unanswered
|
28
|
+
pick_a_category: Pick a category...
|
29
|
+
post:
|
30
|
+
one: post
|
31
|
+
other: posts
|
32
|
+
receiving_notifications_because_subscribed: You're receiving notifications because you've subscribed to this thread.
|
33
|
+
receiving_notifications_because_posted: You're receiving notifications because you've posted in this thread.
|
34
|
+
saving_comment: Saving comment...
|
35
|
+
saving: Saving
|
36
|
+
this_solved_my_question: This solved my question
|
37
|
+
title: title
|
38
|
+
what_help_needed: What do you need help with?
|
39
|
+
ask_your_question: Ask Your Question
|
40
|
+
update_comment: Update comment
|
41
|
+
your_changes_were_saved: Your changes were saved
|
42
|
+
search_not_found: No results found for your search
|
43
|
+
check_out: Check out
|
44
|
+
latest_questions: the latest questions
|
45
|
+
instead: instead?
|
@@ -0,0 +1,41 @@
|
|
1
|
+
es:
|
2
|
+
start_a_discussion: Iniciar una discusión
|
3
|
+
add_a_comment: Añade un comentario
|
4
|
+
ask_a_question: HAZ UNA PREGUNTA
|
5
|
+
asked_time_ago: "Preguntado hace %{time} por %{author}"
|
6
|
+
choose_a_category: Selecciona una categoría
|
7
|
+
comment: comenta
|
8
|
+
commented_on: Comentado en
|
9
|
+
community: Comunidad
|
10
|
+
edit_this_post: Edita esta publicación
|
11
|
+
edit_this_thread: Edita este tema
|
12
|
+
edit_thread: Edita el tema
|
13
|
+
filters: Filtros
|
14
|
+
how_do_i: Cómo puedo...?
|
15
|
+
ignoring_thread: "Estás ignorando este tema"
|
16
|
+
not_receiving_notifications: "No estás recibiendo notificaciones de este tema."
|
17
|
+
layouts:
|
18
|
+
simple_discussion:
|
19
|
+
all_threads: Todos Los Temas
|
20
|
+
answered: Respondidas
|
21
|
+
by_category: Por Categoría
|
22
|
+
my_questions: Mis Preguntas
|
23
|
+
notifications: Notificaciones
|
24
|
+
participating: Participando
|
25
|
+
suscribe: Suscribirse
|
26
|
+
unsubscribe: Desuscribirse
|
27
|
+
unanswered: Sin Responder
|
28
|
+
pick_a_category: Elige una categoría...
|
29
|
+
post:
|
30
|
+
one: publicación
|
31
|
+
other: publicaciones
|
32
|
+
receiving_notifications_because_subscribed: Estás recibiendo notificaciones porque te suscribiste a este tema.
|
33
|
+
receiving_notifications_because_posted: Estás recibiendo notificaciones porque publicaste en este tema.
|
34
|
+
saving_comment: Guardando comentario...
|
35
|
+
saving: Guardando
|
36
|
+
this_solved_my_question: Esto resolvió mi pregunta
|
37
|
+
title: Título
|
38
|
+
what_help_needed: Con qué necesitas ayuda?
|
39
|
+
ask_your_question: Haz tu pregunta
|
40
|
+
update_comment: Actualiza tu comentario
|
41
|
+
your_changes_were_saved: Tus cambios fueron guardados
|
@@ -0,0 +1,47 @@
|
|
1
|
+
fr:
|
2
|
+
start_a_discussion: Débuter une conversation
|
3
|
+
add_a_comment: Ajouter un Commentaire
|
4
|
+
ask_a_question: Poser une question
|
5
|
+
asked_time_ago: "Demandé il y a %{time} par %{author}"
|
6
|
+
choose_a_category: Choisir une catégorie
|
7
|
+
comment: commenter
|
8
|
+
commented_on: Commenté le
|
9
|
+
community: Communauté
|
10
|
+
edit_this_post: Modifier ce message
|
11
|
+
edit_this_thread: Modifier ce fil
|
12
|
+
edit_thread: Modifier le fil
|
13
|
+
filters: Les filtres
|
14
|
+
how_do_i: Comment puis-je ...?
|
15
|
+
ignoring_thread: Vous avez ignoré ce fil.
|
16
|
+
not_receiving_notifications: Vous ne recevez plus les notifications de ce fil.
|
17
|
+
layouts:
|
18
|
+
simple_discussion:
|
19
|
+
all_threads: Toutes les discussions
|
20
|
+
answered: Résolues
|
21
|
+
by_category: Par catégorie
|
22
|
+
my_questions: Mes Questions
|
23
|
+
notifications: Les notifications
|
24
|
+
participating: Participant
|
25
|
+
suscribe: S'abonner
|
26
|
+
unsubscribe: Désabonner
|
27
|
+
unanswered: Non Résolues
|
28
|
+
pick_a_category: Choisissez une catégorie ...
|
29
|
+
post:
|
30
|
+
one: message
|
31
|
+
other: messages
|
32
|
+
receiving_notifications_because_subscribed: Vous recevez les notifications parce que vous êtes abonné à ce fil.
|
33
|
+
receiving_notifications_because_posted: Vous recevez les notifications parce que vous avez posté dans ce fil.
|
34
|
+
saving_comment: Envois du commentaire ...
|
35
|
+
saving: Enregistrer
|
36
|
+
this_solved_my_question: Résolu?
|
37
|
+
title: titre
|
38
|
+
what_help_needed: Quel problème voulez-vous résoudre ?
|
39
|
+
ask_your_question: 'Poser votre question'
|
40
|
+
update_comment: Mettre à jour le commentaire
|
41
|
+
your_changes_were_saved: Vos modifications ont été enregistrées
|
42
|
+
solved: Résolu
|
43
|
+
undo: annuler
|
44
|
+
search_not_found: Aucun résultat trouvé pour votre recherche
|
45
|
+
check_out: Voir
|
46
|
+
latest_questions: les dernières questions
|
47
|
+
instead: à la place
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class CreateForumThreads < ActiveRecord::Migration[4.2]
|
2
2
|
def change
|
3
|
-
create_table :forum_threads
|
3
|
+
create_table :forum_threads do |t|
|
4
4
|
t.references :forum_category, foreign_key: true
|
5
5
|
t.references :user, foreign_key: true
|
6
6
|
t.string :title, null: false
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class CreateForumSubscriptions < ActiveRecord::Migration[4.2]
|
2
2
|
def change
|
3
|
-
create_table :forum_subscriptions
|
3
|
+
create_table :forum_subscriptions do |t|
|
4
4
|
t.references :forum_thread, foreign_key: true
|
5
5
|
t.references :user, foreign_key: true
|
6
6
|
t.string :subscription_type
|
data/simple_discussion.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.add_dependency 'font-awesome-sass', '~>
|
24
|
+
spec.add_dependency 'font-awesome-sass', '~> 5.13.0'
|
25
25
|
spec.add_dependency 'friendly_id', '>= 5.2.0'
|
26
26
|
spec.add_dependency 'gravatar_image_tag'
|
27
27
|
spec.add_dependency 'rails', '>= 4.2'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_discussion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Oliver
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: font-awesome-sass
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.13.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 5.13.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: friendly_id
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,8 +87,10 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".github/FUNDING.yml"
|
90
91
|
- ".gitignore"
|
91
92
|
- ".travis.yml"
|
93
|
+
- CHANGELOG.md
|
92
94
|
- CODE_OF_CONDUCT.md
|
93
95
|
- Gemfile
|
94
96
|
- LICENSE.txt
|
@@ -124,6 +126,9 @@ files:
|
|
124
126
|
- app/views/simple_discussion/user_mailer/new_thread.html.erb
|
125
127
|
- bin/console
|
126
128
|
- bin/setup
|
129
|
+
- config/locales/en.yml
|
130
|
+
- config/locales/es.yml
|
131
|
+
- config/locales/fr.yml
|
127
132
|
- config/routes.rb
|
128
133
|
- db/migrate/20170417012930_create_forum_categories.rb
|
129
134
|
- db/migrate/20170417012931_create_forum_threads.rb
|
@@ -143,7 +148,7 @@ homepage: https://github.com/excid3/simple_discussion
|
|
143
148
|
licenses:
|
144
149
|
- MIT
|
145
150
|
metadata: {}
|
146
|
-
post_install_message:
|
151
|
+
post_install_message:
|
147
152
|
rdoc_options: []
|
148
153
|
require_paths:
|
149
154
|
- lib
|
@@ -158,9 +163,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
163
|
- !ruby/object:Gem::Version
|
159
164
|
version: '0'
|
160
165
|
requirements: []
|
161
|
-
|
162
|
-
|
163
|
-
signing_key:
|
166
|
+
rubygems_version: 3.1.2
|
167
|
+
signing_key:
|
164
168
|
specification_version: 4
|
165
169
|
summary: A simple, extensible Rails forum
|
166
170
|
test_files: []
|