mirror of
https://github.com/discourse/discourse.git
synced 2025-03-09 14:34:35 +00:00
Disable the close poll functionality if allow_user_locale is enabled.
This commit is contained in:
parent
5de7d889fd
commit
83b46a6b88
@ -9,7 +9,7 @@ Allows you to add a poll to the first post of a topic.
|
|||||||
|
|
||||||
## Closing the poll
|
## Closing the poll
|
||||||
|
|
||||||
Change the start of the topic title from "Poll: " to "Closed Poll: "
|
Change the start of the topic title from "Poll: " to "Closed Poll: ". This feature is disabled if the `allow_user_locale` site setting is enabled.
|
||||||
|
|
||||||
_Note: closing a topic will also close the poll._
|
_Note: closing a topic will also close the poll._
|
||||||
|
|
||||||
@ -21,12 +21,12 @@ list to be used like this:
|
|||||||
|
|
||||||
```
|
```
|
||||||
Intro Text
|
Intro Text
|
||||||
|
|
||||||
- Item one
|
- Item one
|
||||||
- Item two
|
- Item two
|
||||||
|
|
||||||
Here are your choices:
|
Here are your choices:
|
||||||
|
|
||||||
[poll]
|
[poll]
|
||||||
- Option 1
|
- Option 1
|
||||||
- Option 2
|
- Option 2
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{{#if poll.post.topic.details.can_edit}}
|
{{#if controller.showToggleClosePoll}}
|
||||||
<button {{action toggleClosePoll}} class="btn btn-small">
|
<button {{action toggleClosePoll}} class="btn btn-small">
|
||||||
{{#if poll.closed}}
|
{{#if poll.closed}}
|
||||||
<i class="fa fa-unlock-alt"></i>
|
<i class="fa fa-unlock-alt"></i>
|
||||||
|
@ -45,6 +45,9 @@ var PollController = Discourse.Controller.extend({
|
|||||||
poll: null,
|
poll: null,
|
||||||
showResults: Em.computed.oneWay('poll.closed'),
|
showResults: Em.computed.oneWay('poll.closed'),
|
||||||
disableRadio: Em.computed.any('poll.closed', 'loading'),
|
disableRadio: Em.computed.any('poll.closed', 'loading'),
|
||||||
|
showToggleClosePoll: function() {
|
||||||
|
return this.get('poll.post.topic.details.can_edit') && !Discourse.SiteSettings.allow_user_locale;
|
||||||
|
}.property('poll.post.topic.details.can_edit'),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
selectOption: function(option) {
|
selectOption: function(option) {
|
||||||
|
@ -60,7 +60,7 @@ module ::PollPlugin
|
|||||||
end
|
end
|
||||||
|
|
||||||
def is_closed?
|
def is_closed?
|
||||||
@post.topic.closed? || (@post.topic.title =~ /^#{I18n.t('poll.closed_prefix')}/i) === 0
|
@post.topic.closed? || (!SiteSetting.allow_user_locale? && (@post.topic.title =~ /^#{I18n.t('poll.closed_prefix')}/i) === 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
def options
|
def options
|
||||||
|
Loading…
x
Reference in New Issue
Block a user