Skip to content

Commit 6bbc982

Browse files
authored
DEV: Plugin rename (#126)
Update metadata, Rename ruby module, Rename folders and filenames, Rename i18n keys
1 parent f42dc20 commit 6bbc982

File tree

81 files changed

+177
-175
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+177
-175
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Discourse Voting
1+
## Discourse Topic Voting
22

33
Adds the ability for voting on a topic within a specified category.
44

app/controllers/discourse_voting/votes_controller.rb app/controllers/discourse_topic_voting/votes_controller.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
module DiscourseVoting
3+
module DiscourseTopicVoting
44
class VotesController < ::ApplicationController
55
before_action :ensure_logged_in
66

@@ -23,7 +23,7 @@ def vote
2323

2424
unless current_user.reached_voting_limit?
2525

26-
DiscourseVoting::Vote.find_or_create_by(user: current_user, topic_id: topic_id)
26+
DiscourseTopicVoting::Vote.find_or_create_by(user: current_user, topic_id: topic_id)
2727

2828
topic.update_vote_count
2929
voted = true
@@ -47,7 +47,7 @@ def unvote
4747

4848
guardian.ensure_can_see!(topic)
4949

50-
DiscourseVoting::Vote.destroy_by(user: current_user, topic_id: topic_id)
50+
DiscourseTopicVoting::Vote.destroy_by(user: current_user, topic_id: topic_id)
5151

5252
topic.update_vote_count
5353

app/models/discourse_voting/category_setting.rb app/models/discourse_topic_voting/category_setting.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
module DiscourseVoting
3+
module DiscourseTopicVoting
44
class CategorySetting < ActiveRecord::Base
55
self.table_name = 'discourse_voting_category_settings'
66

app/models/discourse_voting/topic_vote_count.rb app/models/discourse_topic_voting/topic_vote_count.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
module DiscourseVoting
3+
module DiscourseTopicVoting
44
class TopicVoteCount < ActiveRecord::Base
55
self.table_name = 'discourse_voting_topic_vote_count'
66

app/models/discourse_voting/vote.rb app/models/discourse_topic_voting/vote.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
module DiscourseVoting
3+
module DiscourseTopicVoting
44
class Vote < ActiveRecord::Base
55
self.table_name = 'discourse_voting_votes'
66

assets/javascripts/discourse/initializers/discourse-voting.js.es6 assets/javascripts/discourse/initializers/discourse-topic-voting.js.es6

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { withPluginApi } from "discourse/lib/plugin-api";
33
import NavItem from "discourse/models/nav-item";
44

55
export default {
6-
name: "discourse-voting",
6+
name: "discourse-topic-voting",
77

88
initialize() {
99
withPluginApi("0.8.32", (api) => {

assets/javascripts/discourse/pre-initializers/extend-category-for-voting.js.es6

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ function initialize(api) {
1818

1919
let title = "";
2020
if (topic.user_voted) {
21-
title = ` title='${I18n.t("voting.voted")}'`;
21+
title = ` title='${I18n.t("topic_voting.voted")}'`;
2222
}
2323

2424
let userVotedClass = topic.user_voted ? " voted" : "";
2525
buffer.push(
2626
`<a href='${topic.url}' class='list-vote-count vote-count-${topic.vote_count} discourse-tag simple${userVotedClass}'${title}>`
2727
);
2828

29-
buffer.push(I18n.t("voting.votes", { count: topic.vote_count }));
29+
buffer.push(I18n.t("topic_voting.votes", { count: topic.vote_count }));
3030
buffer.push("</a>");
3131

3232
if (buffer.length > 0) {

assets/javascripts/discourse/routes/user-activity-votes.js.es6

+4-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ export default UserTopicListRoute.extend({
2020
emptyState() {
2121
const user = this.modelFor("user");
2222
const title = this.isCurrentUser(user)
23-
? I18n.t("voting.no_votes_title_self")
24-
: I18n.t("voting.no_votes_title_others", { username: user.username });
23+
? I18n.t("topic_voting.no_votes_title_self")
24+
: I18n.t("topic_voting.no_votes_title_others", {
25+
username: user.username,
26+
});
2527

2628
return {
2729
title,
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<h3>{{i18n "voting.title"}}</h3>
1+
<h3>{{i18n "topic_voting.title"}}</h3>
22
<section class="field">
33
<div class="enable-topic-voting">
44
<label class="checkbox-label">
55
{{input type="checkbox" checked=category.custom_fields.enable_topic_voting}}
6-
{{i18n "voting.allow_topic_voting"}}
6+
{{i18n "topic_voting.allow_topic_voting"}}
77
</label>
88
</div>
99
</section>
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{#if siteSettings.voting_show_votes_on_profile}}
22
{{#link-to "userActivity.votes"}}
3-
{{d-icon "heart"}} {{i18n "voting.vote_title_plural"}}
3+
{{d-icon "heart"}} {{i18n "topic_voting.vote_title_plural"}}
44
{{/link-to}}
55
{{/if}}

assets/javascripts/discourse/widgets/remove-vote.js.es6

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default createWidget("remove-vote", {
1010
},
1111

1212
html() {
13-
return [iconNode("times"), I18n.t("voting.remove_vote")];
13+
return [iconNode("times"), I18n.t("topic_voting.remove_vote")];
1414
},
1515

1616
click() {

assets/javascripts/discourse/widgets/vote-box.js.es6

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default createWidget("vote-box", {
2727
if (state.votesAlert > 0) {
2828
const html =
2929
"<div class='voting-popup-menu vote-options popup-menu'>" +
30-
I18n.t("voting.votes_left", {
30+
I18n.t("topic_voting.votes_left", {
3131
count: state.votesAlert,
3232
path: this.currentUser.get("path") + "/activity/votes",
3333
}) +

assets/javascripts/discourse/widgets/vote-button.js.es6

+7-7
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,27 @@ export default createWidget("vote-button", {
2929
buildButtonTitle(attrs) {
3030
if (this.currentUser) {
3131
if (attrs.closed) {
32-
return I18n.t("voting.voting_closed_title");
32+
return I18n.t("topic_voting.voting_closed_title");
3333
}
3434

3535
if (attrs.user_voted) {
36-
return I18n.t("voting.voted_title");
36+
return I18n.t("topic_voting.voted_title");
3737
}
3838

3939
if (this.currentUser.votes_exceeded) {
40-
return I18n.t("voting.voting_limit");
40+
return I18n.t("topic_voting.voting_limit");
4141
}
4242

43-
return I18n.t("voting.vote_title");
43+
return I18n.t("topic_voting.vote_title");
4444
}
4545

4646
if (attrs.vote_count) {
47-
return I18n.t("voting.anonymous_button", {
47+
return I18n.t("topic_voting.anonymous_button", {
4848
count: attrs.vote_count,
4949
});
5050
}
5151

52-
return I18n.t("voting.anonymous_button", { count: 1 });
52+
return I18n.t("topic_voting.anonymous_button", { count: 1 });
5353
},
5454

5555
html(attrs) {
@@ -58,7 +58,7 @@ export default createWidget("vote-button", {
5858
{
5959
attributes: {
6060
title: this.currentUser
61-
? I18n.t("voting.votes_left_button_title", {
61+
? I18n.t("topic_voting.votes_left_button_title", {
6262
count: this.currentUser.votes_left,
6363
})
6464
: "",

assets/javascripts/discourse/widgets/vote-options.js.es6

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ export default createWidget("vote-options", {
2020
!attrs.user_voted
2121
) {
2222
contents.push([
23-
h("div", I18n.t("voting.reached_limit")),
23+
h("div", I18n.t("topic_voting.reached_limit")),
2424
h(
2525
"p",
2626
h(
2727
"a",
2828
{ href: this.currentUser.get("path") + "/activity/votes" },
29-
I18n.t("voting.list_votes")
29+
I18n.t("topic_voting.list_votes")
3030
)
3131
),
3232
]);

config/locales/client.ar.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ar:
99
category:
1010
sort_options:
1111
votes: "الأصوات"
12-
voting:
12+
topic_voting:
1313
title: "التصويت"
1414
reached_limit: "لم يعُد بإمكانك التصويت الآن، يُرجى إزالة صوت حالي!"
1515
list_votes: "قائمة بأصواتك"

config/locales/client.be.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ be:
99
category:
1010
sort_options:
1111
votes: "Галасоў"
12-
voting:
12+
topic_voting:
1313
title: "Галасаванне"
1414
reached_limit: "Вы выкарысталі свае галасы, выдаліце адзін з іх для перагаласавання!"
1515
list_votes: "Спіс вашых галасаванняў"

config/locales/client.bg.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
bg:
88
js:
9-
voting:
9+
topic_voting:
1010
vote_title: "Гласуване"
1111
voting_closed_title: "Затворена"

config/locales/client.bs_BA.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ bs_BA:
99
category:
1010
sort_options:
1111
votes: "Glasovi"
12-
voting:
12+
topic_voting:
1313
title: "Glasanje"
1414
reached_limit: "Ostali ste bez glasova, odstrani postojeći glas!"
1515
list_votes: "Izlistaj svoje glasove"

config/locales/client.ca.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ca:
99
category:
1010
sort_options:
1111
votes: "Vots"
12-
voting:
12+
topic_voting:
1313
title: "Votació"
1414
reached_limit: "Us heu quedat sense vots. Elimineu un vot existent."
1515
list_votes: "Llista els vots"

config/locales/client.cs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cs:
99
category:
1010
sort_options:
1111
votes: "Hlasy"
12-
voting:
12+
topic_voting:
1313
reached_limit: "Došly ti hlasy. Odeber si existující hlas."
1414
list_votes: "Seznam tvých hlasů"
1515
votes_nav_help: "témata s nejvíce hlasy"

config/locales/client.da.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ da:
99
category:
1010
sort_options:
1111
votes: "Stemmer"
12-
voting:
12+
topic_voting:
1313
title: "Stemmer"
1414
reached_limit: "Du kan ikke afgive flere stemmer, fjern venligst en og prøv igen!"
1515
list_votes: "Vis dine stemmer"

config/locales/client.de.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ de:
99
category:
1010
sort_options:
1111
votes: "Stimmen"
12-
voting:
12+
topic_voting:
1313
title: "Abstimmung"
1414
reached_limit: "Du hast keine Stimmen mehr. Entferne eine bestehende Stimme!"
1515
list_votes: "Deine Stimmen auflisten"

config/locales/client.el.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ el:
99
category:
1010
sort_options:
1111
votes: "Ψήφοι"
12-
voting:
12+
topic_voting:
1313
title: "Ψηφοφορία"
1414
reached_limit: "Έχετε χρησιμοποιήσει όλες τις ψήφους σας, καταργήστε μια υπάρχουσα ψήφο!"
1515
list_votes: "Λίστα των ψήφων σας"

config/locales/client.en.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ en:
33
category:
44
sort_options:
55
votes: "Votes"
6-
voting:
7-
title: "Voting"
6+
topic_voting:
7+
title: "Topic Voting"
88
reached_limit: "You are out of votes, remove an existing vote!"
99
list_votes: "List your votes"
1010
votes_nav_help: "topics with the most votes"

config/locales/client.es.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ es:
99
category:
1010
sort_options:
1111
votes: "Votos"
12-
voting:
12+
topic_voting:
1313
title: "Votación"
1414
reached_limit: "Se te acabaron los votos, ¡elimina un voto existente!"
1515
list_votes: "Lista de tus votos"

config/locales/client.et.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ et:
99
category:
1010
sort_options:
1111
votes: "HInnangud"
12-
voting:
12+
topic_voting:
1313
voted: "Sa hindasid seda teemat"
1414
vote_title: "Hinda"
1515
vote_title_plural: "HInnangud"

config/locales/client.fa_IR.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fa_IR:
99
category:
1010
sort_options:
1111
votes: "آرا"
12-
voting:
12+
topic_voting:
1313
title: "رأی دادن"
1414
list_votes: "آرای خود را فهرست کنید"
1515
votes_nav_help: "موضوعات با بیشترین آرا"

config/locales/client.fi.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fi:
99
category:
1010
sort_options:
1111
votes: "Äänet"
12-
voting:
12+
topic_voting:
1313
title: "Äänestys"
1414
reached_limit: "Sinulla ei ole enempää ääniä, poista antamasi ääni!"
1515
list_votes: "Kaikki antamasi äänet"

config/locales/client.fr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fr:
99
category:
1010
sort_options:
1111
votes: "Votes"
12-
voting:
12+
topic_voting:
1313
title: "Vote"
1414
reached_limit: "Vous n'avez plus de votes disponibles, enlevez-en un !"
1515
list_votes: "Lister vos votes"

config/locales/client.gl.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ gl:
99
category:
1010
sort_options:
1111
votes: "Votos"
12-
voting:
12+
topic_voting:
1313
vote_title: "Votar"
1414
vote_title_plural: "Votos"
1515
voting_closed_title: "Pechado"

config/locales/client.he.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ he:
99
category:
1010
sort_options:
1111
votes: "הצבעות"
12-
voting:
12+
topic_voting:
1313
title: "הצבעה"
1414
reached_limit: "נגמרו לך ההצבעות, עליך להסיר הצבעה קיימת!"
1515
list_votes: "הצגת ההצבעות שלך"

config/locales/client.hr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ hr:
99
category:
1010
sort_options:
1111
votes: "Glasovi"
12-
voting:
12+
topic_voting:
1313
title: "Glasanje"
1414
reached_limit: "Ponestalo vam je glasova, uklonite postojeći glas!"
1515
list_votes: "Prikažite svoje glasove"

config/locales/client.hu.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ hu:
99
category:
1010
sort_options:
1111
votes: "Szavazatok"
12-
voting:
12+
topic_voting:
1313
title: "Szavazás "
1414
reached_limit: "Kifogytál a szavazatokból, törölj egy korábbi szavazatot!"
1515
list_votes: "Szavazataid listázása"

config/locales/client.hy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ hy:
99
category:
1010
sort_options:
1111
votes: "Քվեներ"
12-
voting:
12+
topic_voting:
1313
reached_limit: "Դուք գերազանցել եք քվեների քանակը, հեռացրեք որևէ գոյույթուն ունեցող քվե!"
1414
list_votes: "Ցուցակագրել Ձեր քվեները"
1515
votes_nav_help: "ամենաշատ քվեներով թեմաները"

config/locales/client.id.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66

77
id:
88
js:
9-
voting:
9+
topic_voting:
1010
voting_closed_title: "Tertutup"

config/locales/client.it.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ it:
99
category:
1010
sort_options:
1111
votes: "Voti"
12-
voting:
12+
topic_voting:
1313
title: "Votazione"
1414
reached_limit: "Hai terminato i voti, rimuovi un voto esistente!"
1515
list_votes: "Elenca i tuoi voti"

config/locales/client.ja.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ja:
99
category:
1010
sort_options:
1111
votes: "票数"
12-
voting:
12+
topic_voting:
1313
title: "投票"
1414
reached_limit: "票数が不足しています。既存の投票を削除してください!"
1515
list_votes: "投票をリスト"

0 commit comments

Comments
 (0)