rails_interact 0.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 +7 -0
- data/LICENSE +20 -0
- data/README.md +23 -0
- data/Rakefile +32 -0
- data/app/controllers/interact/admin/abuses_controller.rb +54 -0
- data/app/controllers/interact/admin/attitudes_controller.rb +55 -0
- data/app/controllers/interact/admin/base_controller.rb +3 -0
- data/app/controllers/interact/admin/comments_controller.rb +42 -0
- data/app/controllers/interact/admin/stars_controller.rb +55 -0
- data/app/controllers/interact/attitudes_controller.rb +81 -0
- data/app/controllers/interact/base_controller.rb +3 -0
- data/app/controllers/interact/comments_controller.rb +59 -0
- data/app/controllers/interact/my/abuses_controller.rb +46 -0
- data/app/controllers/interact/my/attitudes_controller.rb +70 -0
- data/app/controllers/interact/my/base_controller.rb +3 -0
- data/app/controllers/interact/my/comments_controller.rb +60 -0
- data/app/controllers/interact/my/stars_controller.rb +43 -0
- data/app/models/interact/abuse.rb +5 -0
- data/app/models/interact/attitude.rb +5 -0
- data/app/models/interact/comment.rb +6 -0
- data/app/models/interact/ext/commentable.rb +16 -0
- data/app/models/interact/ext/like.rb +19 -0
- data/app/models/interact/ext/user.rb +10 -0
- data/app/models/interact/model/abuse.rb +13 -0
- data/app/models/interact/model/attitude.rb +69 -0
- data/app/models/interact/model/comment.rb +58 -0
- data/app/models/interact/model/star.rb +13 -0
- data/app/models/interact/star.rb +5 -0
- data/app/models/interact.rb +11 -0
- data/app/views/application/_interact_nav.html.erb +13 -0
- data/app/views/interact/admin/abuses/_form.html.erb +4 -0
- data/app/views/interact/admin/abuses/_index/_index_tbody.html.erb +7 -0
- data/app/views/interact/admin/abuses/_index/_index_thead.html.erb +7 -0
- data/app/views/interact/admin/abuses/_show_table.html.erb +16 -0
- data/app/views/interact/admin/attitudes/_form.html.erb +4 -0
- data/app/views/interact/admin/attitudes/index.html.erb +50 -0
- data/app/views/interact/admin/attitudes/show.html.erb +26 -0
- data/app/views/interact/admin/comments/_filter_form.html.erb +8 -0
- data/app/views/interact/admin/comments/_filter_table.html.erb +11 -0
- data/app/views/interact/admin/comments/_form.html.erb +3 -0
- data/app/views/interact/admin/comments/index.html.erb +49 -0
- data/app/views/interact/admin/comments/show.html.erb +22 -0
- data/app/views/interact/admin/stars/_form.html.erb +3 -0
- data/app/views/interact/admin/stars/_search_form.html.erb +7 -0
- data/app/views/interact/admin/stars/index.html.erb +48 -0
- data/app/views/interact/admin/stars/show.html.erb +22 -0
- data/app/views/interact/comments/_comment.json.jbuilder +17 -0
- data/app/views/interact/comments/index.json.jbuilder +2 -0
- data/app/views/interact/comments/show.json.jbuilder +1 -0
- data/app/views/interact/my/attitudes/_form.html.erb +4 -0
- data/app/views/interact/my/attitudes/_search_form.html.erb +7 -0
- data/app/views/interact/my/attitudes/dislike.js.erb +1 -0
- data/app/views/interact/my/attitudes/index.html.erb +41 -0
- data/app/views/interact/my/attitudes/like.js.erb +1 -0
- data/app/views/interact/my/attitudes/show.html.erb +10 -0
- data/app/views/interact/my/comments/_comment.html.erb +27 -0
- data/app/views/interact/my/comments/_comment.json.jbuilder +17 -0
- data/app/views/interact/my/comments/_form.html.erb +4 -0
- data/app/views/interact/my/comments/create.js.erb +5 -0
- data/app/views/interact/my/comments/index.html.erb +41 -0
- data/app/views/interact/my/comments/index.json.jbuilder +2 -0
- data/app/views/interact/my/comments/show.html.erb +10 -0
- data/app/views/interact/my/comments/show.json.jbuilder +1 -0
- data/app/views/interact/my/stars/_star.json.jbuilder +8 -0
- data/app/views/interact/my/stars/index.json.jbuilder +2 -0
- data/app/views/interact/my/stars/show.json.jbuilder +1 -0
- data/config/locales/en.notify.yml +11 -0
- data/config/locales/zh.notify.yml +11 -0
- data/config/routes.rb +45 -0
- data/lib/rails_interact/config.rb +9 -0
- data/lib/rails_interact/engine.rb +20 -0
- data/lib/rails_interact.rb +2 -0
- metadata +156 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
module Interact
|
2
|
+
module Ext::Commentable
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
attribute :comments_count, :integer, default: 0
|
7
|
+
|
8
|
+
has_many :comments, class_name: 'Interact::Comment', as: :commentable
|
9
|
+
end
|
10
|
+
|
11
|
+
def commentable?(user_id)
|
12
|
+
user_id ? !comments.exists?(user_id: user_id) : true
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Interact
|
2
|
+
module Ext::Like
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
attribute :liked_count, :integer, default: 0
|
7
|
+
has_many :attitudes, class_name: 'Interact::Attitude', as: :attitudinal, dependent: :delete_all
|
8
|
+
end
|
9
|
+
|
10
|
+
def liked?(user_id)
|
11
|
+
user_id ? attitudes.liked.exists?(user_id: user_id) : false
|
12
|
+
end
|
13
|
+
|
14
|
+
def disliked?(user_id)
|
15
|
+
user_id ? attitudes.disliked.exists?(user_id: user_id) : false
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module Interact
|
2
|
+
module Model::Attitude
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
attribute :opinion, :string
|
7
|
+
|
8
|
+
belongs_to :user
|
9
|
+
belongs_to :attitudinal, polymorphic: true
|
10
|
+
|
11
|
+
after_save :update_attitudinal_counter
|
12
|
+
after_save_commit :sync_to_notification, if: -> { saved_change_to_opinion? && liked? }
|
13
|
+
|
14
|
+
delegate :name, to: :user, prefix: true
|
15
|
+
|
16
|
+
enum opinion: {
|
17
|
+
liked: 'liked',
|
18
|
+
disliked: 'disliked',
|
19
|
+
like_canceled: 'like_canceled',
|
20
|
+
dislike_canceled: 'dislike_canceled'
|
21
|
+
}
|
22
|
+
acts_as_notify(
|
23
|
+
:default,
|
24
|
+
only: [:opinion, :attitudinal_type],
|
25
|
+
methods: [:user_name, :attitudinal_type_i18n]
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
def update_attitudinal_counter
|
30
|
+
if attitudinal_id && self.saved_change_to_opinion?
|
31
|
+
if self.attitudinal.respond_to?('liked_count')
|
32
|
+
if self.liked?
|
33
|
+
self.attitudinal.class.increment_counter('liked_count', attitudinal_id)
|
34
|
+
elsif ['like_canceled', 'disliked'].include?(self.opinion)
|
35
|
+
self.attitudinal.class.decrement_counter('liked_count', attitudinal_id)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
if self.attitudinal.respond_to?('disliked_count')
|
39
|
+
if self.disliked?
|
40
|
+
self.attitudinal.class.increment_counter('disliked_count', attitudinal_id)
|
41
|
+
elsif ['dislike_canceled', 'liked'].include?(self.opinion)
|
42
|
+
self.attitudinal.class.decrement_counter('disliked_count', attitudinal_id)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
standby_attitudinal_counter
|
47
|
+
end
|
48
|
+
|
49
|
+
def standby_attitudinal_counter
|
50
|
+
if self.saved_change_to_attitudinal_id? && attitudinal_id_before_last_save
|
51
|
+
if self.opinion_before_last_save == 'liked' && self.attitudinal.respond_to?('liked_count')
|
52
|
+
self.attitudinal.class.decrement_counter('liked_count', attitudinal_id_before_last_save)
|
53
|
+
elsif self.opinion_before_last_save == 'disliked' && self.attitudinal.respond_to?('disliked_count')
|
54
|
+
self.attitudinal.class.decrement_counter('disliked_count', attitudinal_id_before_last_save)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def sync_to_notification
|
60
|
+
to_notification(
|
61
|
+
receiver: self.attitudinal.user,
|
62
|
+
sender: self.user,
|
63
|
+
linked: self.attitudinal,
|
64
|
+
verbose: true
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Interact
|
2
|
+
module Model::Comment
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
attribute :title, :string
|
7
|
+
attribute :content, :string
|
8
|
+
attribute :state, :string
|
9
|
+
attribute :score, :float, default: 0
|
10
|
+
attribute :liked_count, :integer, default: 0
|
11
|
+
attribute :star_count, :integer, default: 0
|
12
|
+
|
13
|
+
belongs_to :user
|
14
|
+
belongs_to :parent, optional: true
|
15
|
+
belongs_to :commentable, polymorphic: true, counter_cache: true
|
16
|
+
|
17
|
+
default_scope -> { order(id: :desc) }
|
18
|
+
|
19
|
+
before_validation :sync_commentable, if: -> { commentable_type.blank? && commentable_id.blank? }
|
20
|
+
before_save :compute_score, if: -> { star_count_changed? }
|
21
|
+
after_commit :sync_to_notification, on: [:create]
|
22
|
+
|
23
|
+
delegate :name, to: :user, prefix: true
|
24
|
+
|
25
|
+
acts_as_notify(
|
26
|
+
:default,
|
27
|
+
only: [:content],
|
28
|
+
methods: [:user_name])
|
29
|
+
end
|
30
|
+
|
31
|
+
def sync_commentable
|
32
|
+
if parent
|
33
|
+
self.commentable_type = parent.commentable_type
|
34
|
+
self.commentable_id = parent.commentable_id
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def compute_score
|
39
|
+
self.score = self.star_count.to_i * 2
|
40
|
+
end
|
41
|
+
|
42
|
+
def sync_to_notification
|
43
|
+
to_notification(
|
44
|
+
receiver: self.commentable.user,
|
45
|
+
sender: self.user,
|
46
|
+
linked: self.commentable,
|
47
|
+
verbose: true
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
class_methods do
|
52
|
+
def commentable_types
|
53
|
+
self.unscoped.distinct(:commentable_type).pluck(:commentable_type)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<div class="<%= active_helper(modules: 'interact/admin', active: 'menu ex-accordion is-active', item: 'menu ex-accordion') %>" data-controller="menu">
|
2
|
+
<%= content_tag :div, class: 'menu-list' do %>
|
3
|
+
<%= link_to '收藏管理', admin_stars_path, class: active_helper(controllers: 'stars', active: 'is-active') %>
|
4
|
+
<%= link_to '评论管理', admin_comments_path, class: active_helper(controllers: 'comments', active: 'is-active') %>
|
5
|
+
<%= link_to '点赞管理', admin_attitudes_path, class: active_helper(controllers: 'attitudes', active: 'is-active') %>
|
6
|
+
<%= link_to '举报管理', admin_abuses_path, class: active_helper(controllers: 'abuses', active: 'is-active') -%>
|
7
|
+
<% end %>
|
8
|
+
<a class="menu-label">
|
9
|
+
<i class="fa-light fa-star"></i>
|
10
|
+
<span>收藏</span>
|
11
|
+
<i class="fa-light dropdown"></i>
|
12
|
+
</a>
|
13
|
+
</div>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<th>
|
2
|
+
<p><%= Interact::Abuse.human_attribute_name(:abusement_type) %></p>
|
3
|
+
<p><%= Interact::Abuse.human_attribute_name(:abusement_id) %></p>
|
4
|
+
</th>
|
5
|
+
<th><%= Interact::Abuse.human_attribute_name(:state) %></th>
|
6
|
+
<th><%= Interact::Abuse.human_attribute_name(:note) %></th>
|
7
|
+
<th><%= Interact::Abuse.human_attribute_name(:user) %></th>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<tr>
|
2
|
+
<td class="has-text-right"><%= Interact::Abuse.human_attribute_name(:abusement) %></td>
|
3
|
+
<td><%= @abuse.abusement %></td>
|
4
|
+
</tr>
|
5
|
+
<tr>
|
6
|
+
<td class="has-text-right"><%= Interact::Abuse.human_attribute_name(:state) %></td>
|
7
|
+
<td><%= @abuse.state %></td>
|
8
|
+
</tr>
|
9
|
+
<tr>
|
10
|
+
<td class="has-text-right"><%= Interact::Abuse.human_attribute_name(:note) %></td>
|
11
|
+
<td><%= @abuse.note %></td>
|
12
|
+
</tr>
|
13
|
+
<tr>
|
14
|
+
<td class="has-text-right"><%= Interact::Abuse.human_attribute_name(:user) %></td>
|
15
|
+
<td><%= @abuse.user %></td>
|
16
|
+
</tr>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<div class="ui top attached borderless menu">
|
2
|
+
<div class="header item">Admin Attitudes</div>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<div class="ui attached segment">
|
6
|
+
<%= render 'search_form' %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<table class="table is-hoverable is-fullwidth">
|
10
|
+
<thead>
|
11
|
+
<tr>
|
12
|
+
<th><%= Attitude.human_attribute_name(:id) %></th>
|
13
|
+
<th><%= Attitude.human_attribute_name(:user) %></th>
|
14
|
+
<th><%= Attitude.human_attribute_name(:opinion) %></th>
|
15
|
+
<th>
|
16
|
+
<p><%= Attitude.human_attribute_name(:attitudinal_type) %></p>
|
17
|
+
<p><%= Attitude.human_attribute_name(:attitudinal_id) %></p>
|
18
|
+
</th>
|
19
|
+
<th>Actions</th>
|
20
|
+
</tr>
|
21
|
+
</thead>
|
22
|
+
<tbody>
|
23
|
+
<% @attitudes.each do |attitude| %>
|
24
|
+
<tr>
|
25
|
+
<td><%= attitude.id %></td>
|
26
|
+
<td>
|
27
|
+
<%= link_to attitude.user.name, admin_user_path(attitude.user_id) %>
|
28
|
+
</td>
|
29
|
+
<td><%= attitude.opinion %></td>
|
30
|
+
<td>
|
31
|
+
<p><%= attitude.attitudinal_type %></p>
|
32
|
+
<p><%= attitude.attitudinal_id %></p>
|
33
|
+
</td>
|
34
|
+
<td class="ui labels">
|
35
|
+
<%= link_to admin_attitude_path(attitude), aria: { label: t('.show') }, class: 'ui blue mini icon button' do %>
|
36
|
+
<i class="location arrow icon"></i>
|
37
|
+
<% end %>
|
38
|
+
<%= link_to edit_admin_attitude_path(attitude), aria: { label: t('.edit') }, class: 'ui pink mini icon button' do %>
|
39
|
+
<i class="pencil alternate icon"></i>
|
40
|
+
<% end %>
|
41
|
+
<%= link_to admin_attitude_path(attitude), method: :delete, aria: { label: t('.destroy') }, data: { confrim: t('.confirm') }, class: 'ui red mini icon button' do %>
|
42
|
+
<i class="times icon"></i>
|
43
|
+
<% end %>
|
44
|
+
</td>
|
45
|
+
</tr>
|
46
|
+
<% end %>
|
47
|
+
</tbody>
|
48
|
+
</table>
|
49
|
+
|
50
|
+
<%= paginate @attitudes %>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<div class="ui segment breadcrumb">
|
2
|
+
<%= link_to 'Back', admin_attitudes_path, class: 'section' %>
|
3
|
+
<div class="divider">/</div>
|
4
|
+
<div class="active section">Show</div>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<table class="table is-hoverable is-fullwidth">
|
8
|
+
<tbody>
|
9
|
+
<tr>
|
10
|
+
<td class="has-text-right"><%= Attitude.human_attribute_name(:user_id) %></td>
|
11
|
+
<td><%= @attitude.user_id %></td>
|
12
|
+
</tr>
|
13
|
+
<tr>
|
14
|
+
<td class="has-text-right"><%= Attitude.human_attribute_name(:opinion) %></td>
|
15
|
+
<td><%= @attitude.opinion %></td>
|
16
|
+
</tr>
|
17
|
+
<tr>
|
18
|
+
<td class="has-text-right"><%= Attitude.human_attribute_name(:attitudinal_type) %></td>
|
19
|
+
<td><%= @attitude.attitudinal_type %></td>
|
20
|
+
</tr>
|
21
|
+
<tr>
|
22
|
+
<td class="has-text-right"><%= Attitude.human_attribute_name(:attitudinal_id) %></td>
|
23
|
+
<td><%= @attitude.attitudinal_id %></td>
|
24
|
+
</tr>
|
25
|
+
</tbody>
|
26
|
+
</table>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<table class="as-search">
|
2
|
+
<tr>
|
3
|
+
<th><%= Comment.human_attribute_name(:commentable_type) %></th>
|
4
|
+
<td>
|
5
|
+
<%= link_to t('.all'), filter_params(except: [:commentable_type]), class: active_params(type: '', active: 'button is-info', item: 'button is-light') %>
|
6
|
+
<% Comment.commentable_types.each do |value| %>
|
7
|
+
<%= link_to Comment.enum_i18n(:commentable_type, value), filter_params(commentable_type: value), class: active_params(commentable_type: value, active: 'button is-info', item: 'button is-light') %>
|
8
|
+
<% end %>
|
9
|
+
</td>
|
10
|
+
</tr>
|
11
|
+
</table>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<%= render 'filter_form' %>
|
2
|
+
<%= render 'filter_table' %>
|
3
|
+
|
4
|
+
<table class="table is-hoverable is-fullwidth">
|
5
|
+
<thead>
|
6
|
+
<tr>
|
7
|
+
<th><%= Comment.human_attribute_name(:id) %></th>
|
8
|
+
<th><%= Comment.human_attribute_name(:title) %></th>
|
9
|
+
<th><%= Comment.human_attribute_name(:content) %></th>
|
10
|
+
<th><%= Comment.human_attribute_name(:state) %></th>
|
11
|
+
<th><%= Comment.human_attribute_name(:user) %></th>
|
12
|
+
<th>
|
13
|
+
<p><%= Comment.human_attribute_name(:commentable_type) %></p>
|
14
|
+
<p><%= Comment.human_attribute_name(:commentable_id) %></p>
|
15
|
+
</th>
|
16
|
+
<th>Actions</th>
|
17
|
+
</tr>
|
18
|
+
</thead>
|
19
|
+
<tbody>
|
20
|
+
<% @comments.each do |comment| %>
|
21
|
+
<tr>
|
22
|
+
<td><%= comment.id %></td>
|
23
|
+
<td><%= comment.title %></td>
|
24
|
+
<td><%= comment.content %></td>
|
25
|
+
<td><%= comment.state %></td>
|
26
|
+
<td>
|
27
|
+
<%= link_to comment.user.name, admin_user_path(comment.user_id) %>
|
28
|
+
</td>
|
29
|
+
<td>
|
30
|
+
<p><%= comment.commentable_type %></p>
|
31
|
+
<p><%= comment.commentable_id %></p>
|
32
|
+
</td>
|
33
|
+
<td>
|
34
|
+
<%= link_to admin_comment_path(comment), aria: { label: t('.show') }, class: 'ui blue mini icon button' do %>
|
35
|
+
<i class="fa-light fa-circle-info"></i>
|
36
|
+
<% end %>
|
37
|
+
<%= link_to edit_admin_comment_path(comment), aria: { label: t('.edit') }, remote: true, class: 'ui pink mini icon button' do %>
|
38
|
+
<i class="fa-light pencil-alt"></i>
|
39
|
+
<% end %>
|
40
|
+
<%= link_to admin_comment_path(comment), method: :delete, aria: { label: t('.destroy') }, data: { confrim: t('.confirm') }, remote: true, class: 'ui red mini icon button' do %>
|
41
|
+
<i class="fa-light fa-trash"></i>
|
42
|
+
<% end %>
|
43
|
+
</td>
|
44
|
+
</tr>
|
45
|
+
<% end %>
|
46
|
+
</tbody>
|
47
|
+
</table>
|
48
|
+
|
49
|
+
<%= paginate @comments %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<div class="ui segment breadcrumb">
|
2
|
+
<%= link_to 'Back', comments_path, class: 'section' %>
|
3
|
+
<div class="divider">/</div>
|
4
|
+
<div class="active section">Show</div>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<table class="table is-hoverable is-fullwidth">
|
8
|
+
<tbody>
|
9
|
+
<tr>
|
10
|
+
<td class="has-text-right"><%= Comment.human_attribute_name(:title) %></td>
|
11
|
+
<td><%= @comment.title %></td>
|
12
|
+
</tr>
|
13
|
+
<tr>
|
14
|
+
<td class="has-text-right"><%= Comment.human_attribute_name(:content) %></td>
|
15
|
+
<td><%= @comment.content %></td>
|
16
|
+
</tr>
|
17
|
+
<tr>
|
18
|
+
<td class="has-text-right"><%= Comment.human_attribute_name(:state) %></td>
|
19
|
+
<td><%= @comment.state %></td>
|
20
|
+
</tr>
|
21
|
+
</tbody>
|
22
|
+
</table>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<div class="ui top attached borderless menu">
|
2
|
+
<div class="header item">Admin Stars</div>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<div class="ui attached segment">
|
6
|
+
<%= render 'search_form' %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<table class="table is-hoverable is-fullwidth">
|
10
|
+
<thead>
|
11
|
+
<tr>
|
12
|
+
<th><%= Star.human_attribute_name(:id) %></th>
|
13
|
+
<th><%= Star.human_attribute_name(:user) %></th>
|
14
|
+
<th>
|
15
|
+
<p><%= Star.human_attribute_name(:starred_type) %></p>
|
16
|
+
<p><%= Star.human_attribute_name(:starred_id) %></p>
|
17
|
+
</th>
|
18
|
+
<th>Actions</th>
|
19
|
+
</tr>
|
20
|
+
</thead>
|
21
|
+
<tbody>
|
22
|
+
<% @stars.each do |star| %>
|
23
|
+
<tr>
|
24
|
+
<td><%= star.id %></td>
|
25
|
+
<td>
|
26
|
+
<%= link_to star.user.name, admin_user_path(star.user_id) %>
|
27
|
+
</td>
|
28
|
+
<td>
|
29
|
+
<p><%= star.starred_type %></p>
|
30
|
+
<p><%= star.starred_id %></p>
|
31
|
+
</td>
|
32
|
+
<td class="ui labels">
|
33
|
+
<%= link_to admin_star_path(star), aria: { label: t('.show') }, class: 'ui blue mini icon button' do %>
|
34
|
+
<i class="location arrow icon"></i>
|
35
|
+
<% end %>
|
36
|
+
<%= link_to edit_admin_star_path(star), aria: { label: t('.edit') }, class: 'ui pink mini icon button' do %>
|
37
|
+
<i class="pencil alternate icon"></i>
|
38
|
+
<% end %>
|
39
|
+
<%= link_to admin_star_path(star), method: :delete, aria: { label: t('.destroy') }, data: { confrim: t('.confirm') }, class: 'ui red mini icon button' do %>
|
40
|
+
<i class="times icon"></i>
|
41
|
+
<% end %>
|
42
|
+
</td>
|
43
|
+
</tr>
|
44
|
+
<% end %>
|
45
|
+
</tbody>
|
46
|
+
</table>
|
47
|
+
|
48
|
+
<%= paginate @stars %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<div class="ui segment breadcrumb">
|
2
|
+
<%= link_to 'Back', admin_stars_path, class: 'section' %>
|
3
|
+
<div class="divider">/</div>
|
4
|
+
<div class="active section">Show</div>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<table class="table is-hoverable is-fullwidth">
|
8
|
+
<tbody>
|
9
|
+
<tr>
|
10
|
+
<td class="has-text-right"><%= Star.human_attribute_name(:user_id) %></td>
|
11
|
+
<td><%= @star.user_id %></td>
|
12
|
+
</tr>
|
13
|
+
<tr>
|
14
|
+
<td class="has-text-right"><%= Star.human_attribute_name(:starred_type) %></td>
|
15
|
+
<td><%= @star.starred_type %></td>
|
16
|
+
</tr>
|
17
|
+
<tr>
|
18
|
+
<td class="has-text-right"><%= Star.human_attribute_name(:starred_id) %></td>
|
19
|
+
<td><%= @star.starred_id %></td>
|
20
|
+
</tr>
|
21
|
+
</tbody>
|
22
|
+
</table>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
json.extract!(
|
2
|
+
comment,
|
3
|
+
:id,
|
4
|
+
:title,
|
5
|
+
:content,
|
6
|
+
:state,
|
7
|
+
:score,
|
8
|
+
:star_count,
|
9
|
+
:created_at
|
10
|
+
)
|
11
|
+
if comment.user
|
12
|
+
json.commenter comment.user, :id, :name, :avatar_url
|
13
|
+
end
|
14
|
+
if current_user
|
15
|
+
json.liked comment.liked?(current_user.id)
|
16
|
+
end
|
17
|
+
json.liked_count comment.liked_count.to_i
|
@@ -0,0 +1 @@
|
|
1
|
+
json.comment @comment, partial: 'comment', as: :comment
|
@@ -0,0 +1 @@
|
|
1
|
+
$(".dislike-app").replaceWith("<%= j(image_tag 'sad_click.png', class: 'faceImg dislike-app') %>")
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<div class="ui top attached borderless menu">
|
2
|
+
<div class="header item">My Attitudes</div>
|
3
|
+
<div class="right menu">
|
4
|
+
<div class="item">
|
5
|
+
<%= link_to 'New My Attitude', new_my_attitude_path, class: 'ui teal button' %>
|
6
|
+
</div>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="ui attached segment">
|
11
|
+
<%= render 'search_form' %>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<table class="table is-hoverable is-fullwidth">
|
15
|
+
<thead>
|
16
|
+
<tr>
|
17
|
+
<th><%= Attitude.human_attribute_name(:id) %></th>
|
18
|
+
<th>Actions</th>
|
19
|
+
</tr>
|
20
|
+
</thead>
|
21
|
+
<tbody>
|
22
|
+
<% @attitudes.each do |attitude| %>
|
23
|
+
<tr>
|
24
|
+
<td><%= attitude.id %></td>
|
25
|
+
<td class="ui labels">
|
26
|
+
<%= link_to my_attitude_path(attitude), aria: { label: t('.show') }, class: 'ui blue mini icon button' do %>
|
27
|
+
<i class="location arrow icon"></i>
|
28
|
+
<% end %>
|
29
|
+
<%= link_to edit_my_attitude_path(attitude), aria: { label: t('.edit') }, class: 'ui pink mini icon button' do %>
|
30
|
+
<i class="pencil alternate icon"></i>
|
31
|
+
<% end %>
|
32
|
+
<%= link_to my_attitude_path(attitude), method: :delete, aria: { label: t('.destroy') }, data: { confrim: t('.confirm') }, class: 'ui red mini icon button' do %>
|
33
|
+
<i class="times icon"></i>
|
34
|
+
<% end %>
|
35
|
+
</td>
|
36
|
+
</tr>
|
37
|
+
<% end %>
|
38
|
+
</tbody>
|
39
|
+
</table>
|
40
|
+
|
41
|
+
<%= paginate @attitudes %>
|
@@ -0,0 +1 @@
|
|
1
|
+
$(".like-app").replaceWith("<%= j(image_tag 'smile_click.png', class: 'faceImg like-app') %>")
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<div class="ui segment breadcrumb">
|
2
|
+
<%= link_to 'Back', my_attitudes_path, class: 'section' %>
|
3
|
+
<div class="divider">/</div>
|
4
|
+
<div class="active section">Show</div>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<table class="table is-hoverable is-fullwidth">
|
8
|
+
<tbody>
|
9
|
+
</tbody>
|
10
|
+
</table>
|