simple_discussion 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 834ccd97ab1cd0bbbe2aeade6fd0ca57dbbb9239
4
- data.tar.gz: cdba66f70c1574b9cfca22c31d97f8004994ffd8
3
+ metadata.gz: a3254bbe940b1d74626469b008b0189eff8b48e6
4
+ data.tar.gz: 15d14fde5ff8912b9f70c207dd42a80f66305776
5
5
  SHA512:
6
- metadata.gz: 2efe0ca3c21542774ee8398cfaec7c5e3c03674c0976c42146769bc1762237f8d2d70dbd9700f25f6d11663665b8423e15903e2e4ef8a6d87b9fb75495514f4d
7
- data.tar.gz: 0bd0377abdf023db1527498d353d819d30de644f19ff909cc6b3e74d774aa53119418f0677fd77cf64c13b83e817060b398511a13143dbeda7c9d74258405924
6
+ metadata.gz: 4df44f369de7e7aced89967bc5cf9d4aba9cbcd1f02cf301c0c3a2238f43d21897153741e78e0db60c22b82410824e6d9b225d03ba803d5495479a7f972c0ed9
7
+ data.tar.gz: 716f93eb02108af2ba09ad8a98fe5ab7885cb4f931d73db438eddf357be886d3c64120fa0e7ef68b07e2777e67805f49fd27ebed389cbbbeab499fce7208faf1
@@ -20,8 +20,28 @@
20
20
 
21
21
  /* Formatting for the forum threads */
22
22
  .forum-thread {
23
- h4 a {
24
- color: #222;
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 require_moderator_or_author!
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
- redirect_to simple_discussion.root_path, alert: "You aren't allowed to do that."
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
@@ -2,7 +2,8 @@ class SimpleDiscussion::ForumPostsController < SimpleDiscussion::ApplicationCont
2
2
  before_action :authenticate_user!
3
3
  before_action :set_forum_thread
4
4
  before_action :set_forum_post, only: [:edit, :update]
5
- before_action :require_moderator_or_author!, only: [:edit, :update, :solved, :unsolved]
5
+ before_action :require_mod_or_author_for_post!, only: [:edit, :update]
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)
@@ -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 :require_moderator_or_author!, only: [:edit, :update]
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)
@@ -1,7 +1,11 @@
1
- <div class="row">
2
- <div class="col-sm-3">
1
+ <div class="row col-md-12">
2
+ <h1>Community</h1>
3
+ </div>
4
+
5
+ <div class="row simple_discussion">
6
+ <div class="col-md-3 mb-3">
3
7
 
4
- <div class="card card-block">
8
+ <div class="card card-body">
5
9
  <%= link_to 'Ask A Question', simple_discussion.new_forum_thread_path, class: "btn btn-outline-primary btn-block" %>
6
10
  <hr />
7
11
 
@@ -19,7 +23,7 @@
19
23
  <hr />
20
24
 
21
25
  <div class="forum-thread-filters">
22
- <p><strong>By Category</strong></p>
26
+ <h6><strong>By Category</strong></h6>
23
27
  <div><%= forum_link_to simple_discussion.forum_threads_path, exact: true do %><%= icon "circle" %> All<% end %></div>
24
28
  <% ForumCategory.sorted.each do |category| %>
25
29
  <div>
@@ -51,8 +55,12 @@
51
55
 
52
56
  </div>
53
57
 
54
- <div class="col">
55
- <%= yield %>
58
+ <div class="col-md-9 mb-3">
59
+
60
+ <div class="card card-body">
61
+ <%= yield %>
62
+ </div>
63
+
56
64
  </div>
57
65
  </div>
58
66
 
@@ -26,7 +26,7 @@
26
26
  </div>
27
27
  </div>
28
28
 
29
- <div class="card-block">
29
+ <div class="card-body">
30
30
  <%= formatted_content forum_post.body %>
31
31
  </div>
32
32
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  <p class="thread-details">
6
6
  <strong><%= category_link(@forum_thread.forum_category) %></strong>
7
- • Asked <%= time_ago_in_words @forum_thread.created_at %> by <%= @forum_thread.user.name %>
7
+ • Asked <%= time_ago_in_words(@forum_thread.created_at) + ' ago' %> by <%= @forum_thread.user.name %>
8
8
  </p>
9
9
 
10
10
  <br />
@@ -18,7 +18,7 @@
18
18
  </div>
19
19
  </div>
20
20
 
21
- <div class="card-block">
21
+ <div class="card-body">
22
22
  <%= render "form" %>
23
23
  </div>
24
24
  <% end %>
@@ -19,7 +19,7 @@
19
19
 
20
20
  <div class="thread-details">
21
21
  <strong><%= category_link(forum_thread.forum_category) %></strong>
22
- • Asked <%= time_ago_in_words forum_thread.created_at %> by <%= forum_thread.user.name %>
22
+ • Asked <%= time_ago_in_words(forum_thread.created_at) + ' ago' %> by <%= 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>
@@ -1,11 +1,13 @@
1
- <div class="card card-block mb-3">
2
- <%= render partial: "simple_discussion/forum_threads/forum_thread", collection: @forum_threads, spacer_template: "shared/spacer" %>
1
+ <% if @forum_threads.none? %>
3
2
 
4
- <% if @forum_threads.none? %>
5
3
  <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>
8
4
 
9
- <div class="forum-threads-nav text-center">
10
- <%= will_paginate @forum_threads, url_builder: simple_discussion, renderer: SimpleDiscussion::BootstrapLinkRenderer %>
11
- </div>
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
- <h1><%= icon "thumb-tack", class: "text-muted" if @forum_thread.pinned? %> <%= @forum_thread.title %></h1>
2
-
3
- <% if is_moderator_or_owner?(@forum_thread) %>
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 "thumb-tack", class: "text-muted" if @forum_thread.pinned? %> <%= @forum_thread.title %></h1>
9
4
  </div>
10
- <% end %>
5
+
6
+ <% if is_moderator_or_owner?(@forum_thread) %>
7
+ <div class="col-md-1">
8
+ <%= link_to icon("pencil"), simple_discussion.edit_forum_thread_path(@forum_thread),
9
+ class: "text-muted",
10
+ data: { toggle: "tooltip", placement: "left" },
11
+ title: "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
- • Asked <%= time_ago_in_words @forum_thread.created_at %> by <%= @forum_thread.user.name %>
19
+ • Asked <%= time_ago_in_words(@forum_thread.created_at) + ' ago' %> by <%= @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 %>
@@ -1,3 +1,3 @@
1
1
  module SimpleDiscussion
2
- VERSION = "0.9.4"
2
+ VERSION = "0.9.5"
3
3
  end
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: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-16 00:00:00.000000000 Z
11
+ date: 2017-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: font-awesome-sass
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  requirements: []
161
161
  rubyforge_project:
162
- rubygems_version: 2.6.11
162
+ rubygems_version: 2.6.13
163
163
  signing_key:
164
164
  specification_version: 4
165
165
  summary: A simple, extensible Rails forum