Disable the close poll functionality if allow_user_locale is enabled.

This commit is contained in:
Vikhyat Korrapati 2014-04-12 23:00:51 +05:30
parent 5de7d889fd
commit 83b46a6b88
4 changed files with 9 additions and 6 deletions

View File

@ -9,7 +9,7 @@ Allows you to add a poll to the first post of a topic.
## 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._
@ -21,12 +21,12 @@ list to be used like this:
```
Intro Text
- Item one
- Item two
Here are your choices:
[poll]
- Option 1
- Option 2

View File

@ -24,7 +24,7 @@
{{/if}}
</button>
{{#if poll.post.topic.details.can_edit}}
{{#if controller.showToggleClosePoll}}
<button {{action toggleClosePoll}} class="btn btn-small">
{{#if poll.closed}}
<i class="fa fa-unlock-alt"></i>

View File

@ -45,6 +45,9 @@ var PollController = Discourse.Controller.extend({
poll: null,
showResults: Em.computed.oneWay('poll.closed'),
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: {
selectOption: function(option) {

View File

@ -60,7 +60,7 @@ module ::PollPlugin
end
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
def options