decidim-comments 0.23.2 → 0.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/decidim/comments/bundle.js.map +1 -1
- data/app/assets/javascripts/decidim/comments/comments.component.js.es6 +292 -0
- data/app/assets/javascripts/decidim/comments/comments.component.test.js +581 -0
- data/app/assets/javascripts/decidim/comments/comments.js.erb +1 -1
- data/app/cells/decidim/comments/comment/actions.erb +7 -0
- data/app/cells/decidim/comments/comment/alignment_badge.erb +4 -0
- data/app/cells/decidim/comments/comment/author.erb +1 -0
- data/app/cells/decidim/comments/comment/show.erb +40 -0
- data/app/cells/decidim/comments/comment/utilities.erb +13 -0
- data/app/cells/decidim/comments/comment/votes.erb +25 -0
- data/app/cells/decidim/comments/comment_card_cell.rb +22 -0
- data/app/cells/decidim/comments/comment_cell.rb +142 -8
- data/app/cells/decidim/comments/comment_form/comment_as.erb +10 -0
- data/app/cells/decidim/comments/comment_form/show.erb +24 -0
- data/app/cells/decidim/comments/comment_form_cell.rb +94 -0
- data/app/cells/decidim/comments/comment_m/top.erb +1 -1
- data/app/cells/decidim/comments/comment_thread/show.erb +6 -0
- data/app/cells/decidim/comments/comment_thread/title.erb +3 -0
- data/app/cells/decidim/comments/comment_thread_cell.rb +30 -0
- data/app/cells/decidim/comments/comments/add_comment.erb +30 -0
- data/app/cells/decidim/comments/comments/blocked_comments_warning.erb +3 -0
- data/app/cells/decidim/comments/comments/order_control.erb +37 -0
- data/app/cells/decidim/comments/comments/show.erb +32 -0
- data/app/cells/decidim/comments/comments/single_comment_warning.erb +9 -0
- data/app/cells/decidim/comments/comments/user_comments_blocked_warning.erb +3 -0
- data/app/cells/decidim/comments/comments_cell.rb +134 -0
- data/app/commands/decidim/comments/vote_comment.rb +34 -10
- data/app/controllers/decidim/comments/application_controller.rb +16 -0
- data/app/controllers/decidim/comments/comments_controller.rb +122 -0
- data/app/controllers/decidim/comments/votes_controller.rb +41 -0
- data/app/events/decidim/comments/comment_created_event.rb +1 -1
- data/app/events/decidim/comments/comment_downvoted_event.rb +8 -0
- data/app/events/decidim/comments/comment_upvoted_event.rb +8 -0
- data/app/events/decidim/comments/comment_voted_event.rb +26 -0
- data/app/forms/decidim/comments/comment_form.rb +6 -2
- data/app/models/decidim/comments/comment.rb +22 -6
- data/app/models/decidim/comments/seed.rb +1 -1
- data/app/permissions/decidim/comments/permissions.rb +59 -0
- data/app/queries/decidim/comments/metrics/comment_participants_metric_measure.rb +2 -2
- data/app/queries/decidim/comments/metrics/comments_metric_manage.rb +5 -6
- data/app/queries/decidim/comments/sorted_comments.rb +18 -14
- data/app/views/decidim/comments/comments/_comment.html.erb +5 -0
- data/app/views/decidim/comments/comments/_comments.html.erb +1 -0
- data/app/views/decidim/comments/comments/create.js.erb +16 -0
- data/app/views/decidim/comments/comments/error.js.erb +1 -0
- data/app/views/decidim/comments/comments/index.js.erb +24 -0
- data/app/views/decidim/comments/comments/reload.js.erb +21 -0
- data/app/views/decidim/comments/votes/create.js.erb +23 -0
- data/app/views/decidim/comments/votes/error.js.erb +1 -0
- data/config/locales/ar.yml +0 -2
- data/config/locales/ca.yml +17 -2
- data/config/locales/cs.yml +19 -2
- data/config/locales/de.yml +17 -2
- data/config/locales/el.yml +0 -2
- data/config/locales/en.yml +17 -2
- data/config/locales/es-MX.yml +17 -2
- data/config/locales/es-PY.yml +17 -2
- data/config/locales/es.yml +17 -2
- data/config/locales/eu.yml +0 -2
- data/config/locales/fi-plain.yml +17 -2
- data/config/locales/fi.yml +17 -2
- data/config/locales/fr-CA.yml +17 -2
- data/config/locales/fr.yml +17 -2
- data/config/locales/gl.yml +7 -2
- data/config/locales/hu.yml +0 -2
- data/config/locales/id-ID.yml +0 -2
- data/config/locales/is-IS.yml +0 -1
- data/config/locales/it.yml +4 -2
- data/config/locales/ja.yml +9 -5
- data/config/locales/lv.yml +0 -2
- data/config/locales/nl.yml +0 -2
- data/config/locales/no.yml +0 -2
- data/config/locales/pl.yml +21 -4
- data/config/locales/pt-BR.yml +0 -2
- data/config/locales/pt.yml +0 -2
- data/config/locales/ro-RO.yml +15 -2
- data/config/locales/ru.yml +0 -2
- data/config/locales/sk.yml +0 -2
- data/config/locales/sv.yml +7 -2
- data/config/locales/tr-TR.yml +7 -2
- data/config/locales/uk.yml +0 -1
- data/config/locales/zh-CN.yml +0 -2
- data/lib/decidim/api/add_comment_type.rb +13 -0
- data/lib/decidim/api/comment_mutation_type.rb +22 -0
- data/lib/decidim/api/comment_type.rb +89 -0
- data/lib/decidim/api/commentable_interface.rb +50 -0
- data/lib/decidim/api/commentable_mutation_type.rb +30 -0
- data/{app/types/decidim/comments → lib/decidim/api}/commentable_type.rb +2 -5
- data/lib/decidim/comments.rb +1 -3
- data/lib/decidim/comments/api.rb +12 -0
- data/lib/decidim/comments/comments_helper.rb +10 -52
- data/lib/decidim/comments/engine.rb +9 -7
- data/lib/decidim/comments/mutation_extensions.rb +22 -22
- data/lib/decidim/comments/query_extensions.rb +12 -14
- data/lib/decidim/comments/test.rb +1 -0
- data/lib/decidim/comments/test/shared_examples/comment_voted_event.rb +65 -0
- data/lib/decidim/comments/version.rb +1 -1
- metadata +65 -64
- data/app/assets/javascripts/decidim/comments/bundle.js +0 -268
- data/app/frontend/application/apollo_client.ts +0 -12
- data/app/frontend/application/application.component.test.tsx +0 -23
- data/app/frontend/application/application.component.tsx +0 -35
- data/app/frontend/application/icon.component.test.tsx +0 -38
- data/app/frontend/application/icon.component.tsx +0 -46
- data/app/frontend/comments/add_comment_form.component.test.tsx +0 -265
- data/app/frontend/comments/add_comment_form.component.tsx +0 -482
- data/app/frontend/comments/comment.component.test.tsx +0 -490
- data/app/frontend/comments/comment.component.tsx +0 -677
- data/app/frontend/comments/comment_order_selector.component.test.tsx +0 -29
- data/app/frontend/comments/comment_order_selector.component.tsx +0 -106
- data/app/frontend/comments/comment_thread.component.test.tsx +0 -82
- data/app/frontend/comments/comment_thread.component.tsx +0 -81
- data/app/frontend/comments/comments.component.test.tsx +0 -150
- data/app/frontend/comments/comments.component.tsx +0 -289
- data/app/frontend/comments/down_vote_button.component.test.tsx +0 -59
- data/app/frontend/comments/down_vote_button.component.tsx +0 -133
- data/app/frontend/comments/up_vote_button.component.test.tsx +0 -59
- data/app/frontend/comments/up_vote_button.component.tsx +0 -133
- data/app/frontend/comments/vote_button.component.tsx +0 -50
- data/app/frontend/comments/vote_button_component.test.tsx +0 -64
- data/app/frontend/entry.ts +0 -38
- data/app/frontend/entry_test.ts +0 -6
- data/app/frontend/fragments/add_comment_form_commentable.fragment.graphql +0 -4
- data/app/frontend/fragments/add_comment_form_session.fragment.graphql +0 -6
- data/app/frontend/fragments/comment.fragment.graphql +0 -14
- data/app/frontend/fragments/comment_data.fragment.graphql +0 -27
- data/app/frontend/fragments/comment_thread.fragment.graphql +0 -6
- data/app/frontend/fragments/down_vote_button.fragment.graphql +0 -6
- data/app/frontend/fragments/up_vote_button.fragment.graphql +0 -6
- data/app/frontend/mutations/add_comment.mutation.graphql +0 -9
- data/app/frontend/mutations/down_vote.mutation.graphql +0 -9
- data/app/frontend/mutations/up_vote.mutation.graphql +0 -9
- data/app/frontend/queries/comments.query.graphql +0 -26
- data/app/frontend/support/asset_url.ts +0 -11
- data/app/frontend/support/generate_comments_data.ts +0 -49
- data/app/frontend/support/generate_user_data.ts +0 -14
- data/app/frontend/support/generate_user_group_data.ts +0 -14
- data/app/frontend/support/graphql_transformer.js +0 -32
- data/app/frontend/support/load_translations.ts +0 -48
- data/app/frontend/support/require_all.ts +0 -10
- data/app/frontend/support/resolve_graphql_query.ts +0 -37
- data/app/frontend/support/schema.ts +0 -2026
- data/app/types/decidim/comments/commentable_interface.rb +0 -61
- data/app/types/decidim/comments/commentable_mutation_type.rb +0 -33
- data/lib/decidim/comments/api/add_comment_type.rb +0 -13
- data/lib/decidim/comments/api/comment_mutation_type.rb +0 -20
- data/lib/decidim/comments/api/comment_type.rb +0 -89
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Comments
|
5
|
+
# Controller that manages the comment votes.
|
6
|
+
#
|
7
|
+
class VotesController < Decidim::Comments::ApplicationController
|
8
|
+
before_action :authenticate_user!
|
9
|
+
before_action :set_comment
|
10
|
+
|
11
|
+
helper_method :comment
|
12
|
+
|
13
|
+
def create
|
14
|
+
raise ActionController::RoutingError, "Not Found" unless comment
|
15
|
+
|
16
|
+
enforce_permission_to :vote, :comment, comment: comment
|
17
|
+
|
18
|
+
Decidim::Comments::VoteComment.call(comment, current_user, weight: params[:weight].to_i) do
|
19
|
+
on(:ok) do
|
20
|
+
respond_to do |format|
|
21
|
+
format.js { render :create }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
on(:invalid) do
|
25
|
+
respond_to do |format|
|
26
|
+
format.js { render :error }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
attr_reader :comment
|
35
|
+
|
36
|
+
def set_comment
|
37
|
+
@comment = Decidim::Comments::Comment.find_by(id: params[:comment_id])
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Comments
|
5
|
+
class CommentVotedEvent < Decidim::Events::SimpleEvent
|
6
|
+
include Decidim::Comments::CommentEvent
|
7
|
+
|
8
|
+
i18n_attributes :upvotes
|
9
|
+
i18n_attributes :downvotes
|
10
|
+
|
11
|
+
def upvotes
|
12
|
+
extra[:upvotes]
|
13
|
+
end
|
14
|
+
|
15
|
+
def downvotes
|
16
|
+
extra[:downvotes]
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def resource_url_params
|
22
|
+
{ anchor: "comment_#{comment.id}" }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -5,10 +5,11 @@ module Decidim
|
|
5
5
|
# A form object used to create comments from the graphql api.
|
6
6
|
#
|
7
7
|
class CommentForm < Form
|
8
|
-
attribute :body,
|
8
|
+
attribute :body, Decidim::Attributes::CleanString
|
9
9
|
attribute :alignment, Integer
|
10
10
|
attribute :user_group_id, Integer
|
11
11
|
attribute :commentable
|
12
|
+
attribute :commentable_gid
|
12
13
|
|
13
14
|
mimic :comment
|
14
15
|
|
@@ -18,7 +19,10 @@ module Decidim
|
|
18
19
|
validate :max_depth
|
19
20
|
|
20
21
|
def max_length
|
21
|
-
|
22
|
+
if current_component&.settings.respond_to?(:comments_max_length)
|
23
|
+
component_length = current_component.try { settings.comments_max_length.positive? }
|
24
|
+
return current_component.settings.comments_max_length if component_length
|
25
|
+
end
|
22
26
|
return current_organization.comments_max_length if current_organization.comments_max_length.positive?
|
23
27
|
|
24
28
|
1000
|
@@ -55,11 +55,13 @@ module Decidim
|
|
55
55
|
delegate :organization, to: :commentable
|
56
56
|
|
57
57
|
translatable_fields :body
|
58
|
-
searchable_fields(
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
searchable_fields({
|
59
|
+
participatory_space: :itself,
|
60
|
+
A: :body,
|
61
|
+
datetime: :created_at
|
62
|
+
},
|
63
|
+
index_on_create: true,
|
64
|
+
index_on_update: ->(comment) { comment.visible? })
|
63
65
|
|
64
66
|
def self.positive
|
65
67
|
where(alignment: 1)
|
@@ -73,6 +75,10 @@ module Decidim
|
|
73
75
|
where(alignment: -1)
|
74
76
|
end
|
75
77
|
|
78
|
+
def visible?
|
79
|
+
participatory_space.try(:visible?) && component.try(:published?)
|
80
|
+
end
|
81
|
+
|
76
82
|
def participatory_space
|
77
83
|
return root_commentable if root_commentable.is_a?(Decidim::Participable)
|
78
84
|
|
@@ -130,6 +136,16 @@ module Decidim
|
|
130
136
|
end
|
131
137
|
end
|
132
138
|
|
139
|
+
# Public: Overrides the `reported_attributes` Reportable concern method.
|
140
|
+
def reported_attributes
|
141
|
+
[:body]
|
142
|
+
end
|
143
|
+
|
144
|
+
# Public: Overrides the `reported_searchable_content_extras` Reportable concern method.
|
145
|
+
def reported_searchable_content_extras
|
146
|
+
[normalized_author.name]
|
147
|
+
end
|
148
|
+
|
133
149
|
def self.export_serializer
|
134
150
|
Decidim::Comments::CommentSerializer
|
135
151
|
end
|
@@ -169,7 +185,7 @@ module Decidim
|
|
169
185
|
end
|
170
186
|
|
171
187
|
def comment_maximum_length
|
172
|
-
return unless commentable.commentable?
|
188
|
+
return 0 unless commentable.commentable?
|
173
189
|
return component.settings.comments_max_length if component_settings_comments_max_length?
|
174
190
|
return organization.comments_max_length if organization.comments_max_length.positive?
|
175
191
|
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Comments
|
5
|
+
class Permissions < Decidim::DefaultPermissions
|
6
|
+
def permissions
|
7
|
+
return permission_action if permission_action.subject != :comment
|
8
|
+
|
9
|
+
case permission_action.action
|
10
|
+
when :read
|
11
|
+
can_read_comments?
|
12
|
+
when :create
|
13
|
+
can_create_comment?
|
14
|
+
when :vote
|
15
|
+
can_vote_comment?
|
16
|
+
end
|
17
|
+
|
18
|
+
permission_action
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def can_read_comments?
|
24
|
+
return disallow! unless commentable.commentable?
|
25
|
+
|
26
|
+
allow!
|
27
|
+
end
|
28
|
+
|
29
|
+
def can_create_comment?
|
30
|
+
return disallow! unless user
|
31
|
+
return disallow! unless commentable.commentable?
|
32
|
+
return disallow! unless commentable&.user_allowed_to_comment?(user)
|
33
|
+
|
34
|
+
allow!
|
35
|
+
end
|
36
|
+
|
37
|
+
def can_vote_comment?
|
38
|
+
return disallow! unless user
|
39
|
+
return disallow! unless commentable&.user_allowed_to_comment?(user)
|
40
|
+
|
41
|
+
allow!
|
42
|
+
end
|
43
|
+
|
44
|
+
def commentable
|
45
|
+
@commentable ||= begin
|
46
|
+
if comment
|
47
|
+
comment.root_commentable
|
48
|
+
else
|
49
|
+
context.fetch(:commentable, nil)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def comment
|
55
|
+
@comment ||= context.fetch(:comment, nil)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -41,8 +41,8 @@ module Decidim
|
|
41
41
|
user_ids = Decidim::User.where(organization: @resource.organization).pluck(:id)
|
42
42
|
Decidim::Comments::Comment.includes(:root_commentable).not_hidden
|
43
43
|
.where("decidim_comments_comments.created_at <= ?", end_time)
|
44
|
-
.where(
|
45
|
-
.where(
|
44
|
+
.where(decidim_comments_comments: { decidim_author_id: user_ids })
|
45
|
+
.where(decidim_comments_comments: { decidim_author_type: "Decidim::UserBaseEntity" })
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -80,12 +80,11 @@ module Decidim
|
|
80
80
|
|
81
81
|
# Gets current ParticipatorySpace of a given 'related_object'
|
82
82
|
def retrieve_participatory_space(related_object)
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
participatory_space
|
83
|
+
if related_object.respond_to?(:participatory_space)
|
84
|
+
related_object.participatory_space
|
85
|
+
elsif related_object.is_a?(Decidim::Participable)
|
86
|
+
related_object
|
87
|
+
end
|
89
88
|
end
|
90
89
|
end
|
91
90
|
end
|
@@ -33,21 +33,25 @@ module Decidim
|
|
33
33
|
scope = base_scope
|
34
34
|
.not_hidden
|
35
35
|
.includes(:author, :user_group, :up_votes, :down_votes)
|
36
|
+
if @options[:after]
|
37
|
+
scope = scope.where(
|
38
|
+
"decidim_comments_comments.id > ?",
|
39
|
+
@options[:after]
|
40
|
+
)
|
41
|
+
end
|
36
42
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
scope
|
43
|
+
case @options[:order_by]
|
44
|
+
when "older"
|
45
|
+
order_by_older(scope)
|
46
|
+
when "recent"
|
47
|
+
order_by_recent(scope)
|
48
|
+
when "best_rated"
|
49
|
+
order_by_best_rated(scope)
|
50
|
+
when "most_discussed"
|
51
|
+
order_by_most_discussed(scope)
|
52
|
+
else
|
53
|
+
order_by_older(scope)
|
54
|
+
end
|
51
55
|
end
|
52
56
|
|
53
57
|
private
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= inline_comments_for(commentable, order: order) %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
(function() {
|
2
|
+
var rootCommentableId = <%== "comments-for-#{@comment.root_commentable.commentable_type.demodulize}-#{@comment.root_commentable.id}".to_json %>;
|
3
|
+
var commentHtml = '<%== j(render @comment).strip %>';
|
4
|
+
var inReplyTo = <%== (reply?(@comment) ? @commentable.id : nil).to_json %>;
|
5
|
+
|
6
|
+
var $comments = $("#" + rootCommentableId);
|
7
|
+
var component = $comments.data("comments");
|
8
|
+
if (inReplyTo) {
|
9
|
+
component.addReply(inReplyTo, commentHtml);
|
10
|
+
} else {
|
11
|
+
component.addThread(commentHtml);
|
12
|
+
}
|
13
|
+
|
14
|
+
// Update the comments count
|
15
|
+
$(".comments-count", $comments).text(<%== t("decidim.components.comments.title", count: @comments_count).to_json %>);
|
16
|
+
}());
|
@@ -0,0 +1 @@
|
|
1
|
+
alert("Comment creation error");
|
@@ -0,0 +1,24 @@
|
|
1
|
+
(function() {
|
2
|
+
var rootCommentableId = <%== "comments-for-#{commentable.commentable_type.demodulize}-#{commentable.id}".to_json %>;
|
3
|
+
|
4
|
+
var $comments = $("#" + rootCommentableId);
|
5
|
+
var component = $comments.data("comments");
|
6
|
+
|
7
|
+
<% @comments.each do |comment| %>
|
8
|
+
var commentId = <%= comment.id.to_json %>;
|
9
|
+
var commentHtml = '<%== j(render comment).strip %>';
|
10
|
+
var inReplyTo = <%== (reply?(comment) ? comment.commentable.id : nil).to_json %>;
|
11
|
+
|
12
|
+
var $comment = $("#comment_" + commentId);
|
13
|
+
if (1 > $comment.length) {
|
14
|
+
if (inReplyTo) {
|
15
|
+
component.addReply(inReplyTo, commentHtml);
|
16
|
+
} else {
|
17
|
+
component.addThread(commentHtml);
|
18
|
+
}
|
19
|
+
}
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
// Update the comments count
|
23
|
+
$(".comments-count", $comments).text(<%== t("decidim.components.comments.title", count: @comments_count).to_json %>);
|
24
|
+
}());
|
@@ -0,0 +1,21 @@
|
|
1
|
+
(function() {
|
2
|
+
var rootCommentableId = <%== "comments-for-#{commentable.commentable_type.demodulize}-#{commentable.id}".to_json %>;
|
3
|
+
|
4
|
+
var $comments = $("#" + rootCommentableId);
|
5
|
+
var component = $comments.data("comments");
|
6
|
+
component.unmountComponent();
|
7
|
+
|
8
|
+
var commentsHtml = '<%== j(render partial: "comments").strip %>';
|
9
|
+
$comments.replaceWith(commentsHtml);
|
10
|
+
|
11
|
+
$comments = $("#" + rootCommentableId);
|
12
|
+
$comments.foundation();
|
13
|
+
|
14
|
+
// Re-create the component
|
15
|
+
component = new Decidim.CommentsComponent($comments, $comments.data("decidim-comments"));
|
16
|
+
component.mountComponent();
|
17
|
+
$comments.data("comments", component);
|
18
|
+
|
19
|
+
// Update the comments count
|
20
|
+
$(".comments-count", $comments).text(<%== t("decidim.components.comments.title", count: @comments_count).to_json %>);
|
21
|
+
}());
|
@@ -0,0 +1,23 @@
|
|
1
|
+
(function() {
|
2
|
+
var commentId = <%= comment.id.to_json %>;
|
3
|
+
var upVotes = <%= comment.up_votes.count.to_json %>;
|
4
|
+
var downVotes = <%= comment.down_votes.count.to_json %>;
|
5
|
+
var $comment = $("#comment_" + commentId);
|
6
|
+
var $votes = $("> .comment__footer .comment__votes", $comment);
|
7
|
+
var $upVote = $(".comment__votes--up", $votes);
|
8
|
+
var $downVote = $(".comment__votes--down", $votes);
|
9
|
+
|
10
|
+
$(".comment__votes--count", $upVote).text(upVotes);
|
11
|
+
$(".comment__votes--count", $downVote).text(downVotes);
|
12
|
+
|
13
|
+
$upVote.removeClass("is-vote-selected is-vote-notselected").removeAttr("disabled");
|
14
|
+
$downVote.removeClass("is-vote-selected is-vote-notselected").removeAttr("disabled");
|
15
|
+
|
16
|
+
<% if comment.up_voted_by?(current_user) %>
|
17
|
+
$upVote.addClass("is-vote-selected");
|
18
|
+
$downVote.addClass("is-vote-notselected").attr("disabled", "disabled");
|
19
|
+
<% elsif comment.down_voted_by?(current_user) %>
|
20
|
+
$upVote.addClass("is-vote-notselected").attr("disabled", "disabled");
|
21
|
+
$downVote.addClass("is-vote-selected");
|
22
|
+
<% end %>
|
23
|
+
}());
|
@@ -0,0 +1 @@
|
|
1
|
+
alert(<%== I18n.t("votes.create.error", scope: "decidim.comments").to_json %>);
|
data/config/locales/ar.yml
CHANGED
@@ -24,7 +24,6 @@ ar:
|
|
24
24
|
other: الأصوات
|
25
25
|
decidim:
|
26
26
|
comments:
|
27
|
-
comments: تعليقات
|
28
27
|
last_activity:
|
29
28
|
new_comment_at_html: "<span>تعليق جديد على %{link}</span>"
|
30
29
|
votes:
|
@@ -81,7 +80,6 @@ ar:
|
|
81
80
|
loading: جارٍ تحميل التعليقات ...
|
82
81
|
single_comment_warning: يمكنك الإطلاع على التعليقات المتبقية الأخرى <a href="%{url}">هنا</a>.
|
83
82
|
single_comment_warning_title: إنك ترى تعليقا واحدا
|
84
|
-
title: "%{count} تعليقات"
|
85
83
|
events:
|
86
84
|
comments:
|
87
85
|
comment_by_followed_user:
|