bbs 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/controllers/bbs/application_controller.rb +2 -2
- data/app/controllers/bbs/comments_controller.rb +2 -2
- data/app/controllers/bbs/concerns/authenticatable.rb +8 -8
- data/app/controllers/bbs/profiles_controller.rb +6 -6
- data/app/controllers/bbs/topics_controller.rb +2 -2
- data/app/views/bbs/profiles/edit.html.haml +1 -1
- data/lib/bbs/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53f3093c331e334c5e6195734bed223cdc4e9e1a
|
4
|
+
data.tar.gz: '067806696393bb6e1efecaf9c491f04ff34b0786'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4627da3dd64d6b6e8e063c92ad15793c857f1f9c2d84cc6cf45bcdc5b8136b0185c9ac01a37a8e6c21211d8dec99e97b5a2793c8ff12d0e5d62612612627b8f
|
7
|
+
data.tar.gz: 63770c6ef0462fa226835cfd24c5cf30210f8f85f6e714ed329c4d51dd6393a81de53aa9cda07c49d8bc78c20e3a58c628a6a9aab29efc43935f90260561a1e6
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Bbs
|
2
2
|
class CommentsController < Bbs::ApplicationController
|
3
|
-
before_action :
|
3
|
+
before_action :authenticate_bbs_user, only: %i(create)
|
4
4
|
before_action :set_topic
|
5
5
|
|
6
6
|
def create
|
@@ -26,7 +26,7 @@ module Bbs
|
|
26
26
|
|
27
27
|
def comment_params
|
28
28
|
params.require(:comment).permit(Bbs::Comment.permitted_attributes)
|
29
|
-
.merge(author:
|
29
|
+
.merge(author: current_bbs_user)
|
30
30
|
end
|
31
31
|
|
32
32
|
def comments
|
@@ -4,16 +4,16 @@ module Bbs
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
6
|
included do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
define_method(:current_bbs_user) do
|
8
|
+
raise NoMethodError, "undefined method #{Bbs.config.current_user} in #{self.class.to_s}." unless respond_to?(Bbs.config.current_user)
|
9
|
+
|
10
|
+
__send__ Bbs.config.current_user
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
define_method(:authenticate_bbs_user) do
|
14
|
+
raise NoMethodError, "undefined method #{Bbs.config.authenticate_user} in #{self.class.to_s}." unless respond_to?(Bbs.config.authenticate_user)
|
15
|
+
|
16
|
+
__send__ Bbs.config.authenticate_user
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -1,26 +1,26 @@
|
|
1
1
|
module Bbs
|
2
2
|
class ProfilesController < Bbs::ApplicationController
|
3
|
-
before_action :
|
3
|
+
before_action :authenticate_bbs_user
|
4
4
|
|
5
5
|
def edit
|
6
|
-
|
6
|
+
current_bbs_user.build_profile unless current_bbs_user.profile
|
7
7
|
end
|
8
8
|
|
9
9
|
def create
|
10
|
-
if
|
10
|
+
if current_bbs_user.create_profile(profile_params)
|
11
11
|
redirect_to edit_profile_path, notice: t('.success')
|
12
12
|
else
|
13
|
-
flash.now[:alert] =
|
13
|
+
flash.now[:alert] = current_bbs_user.profile.errors.full_messages
|
14
14
|
|
15
15
|
render :edit
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
def update
|
20
|
-
if
|
20
|
+
if current_bbs_user.profile.update(profile_params)
|
21
21
|
redirect_to edit_profile_path, notice: t('.success')
|
22
22
|
else
|
23
|
-
flash.now[:alert] =
|
23
|
+
flash.now[:alert] = current_bbs_user.profile.errors.full_messages
|
24
24
|
|
25
25
|
render :edit
|
26
26
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Bbs
|
2
2
|
class TopicsController < Bbs::ApplicationController
|
3
|
-
before_action :
|
3
|
+
before_action :authenticate_bbs_user, only: %i(create)
|
4
4
|
before_action :set_category
|
5
5
|
|
6
6
|
def new
|
@@ -29,7 +29,7 @@ module Bbs
|
|
29
29
|
|
30
30
|
def topic_params
|
31
31
|
params.require(:topic).permit(Bbs::Topic.permitted_attributes)
|
32
|
-
.merge(author:
|
32
|
+
.merge(author: current_bbs_user)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
data/lib/bbs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bbs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -277,7 +277,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
277
277
|
version: '0'
|
278
278
|
requirements: []
|
279
279
|
rubyforge_project:
|
280
|
-
rubygems_version: 2.5.
|
280
|
+
rubygems_version: 2.5.2
|
281
281
|
signing_key:
|
282
282
|
specification_version: 4
|
283
283
|
summary: Summary of Bbs.
|