This repository has been archived by the owner on Mar 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Badge Based Access - Addressed comments from PR
See: #33
- Loading branch information
Showing
6 changed files
with
54 additions
and
13 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
...ts/javascripts/discourse/connectors/user-preferences-interface/show-quick-messages.js.es6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default { | ||
shouldRender(args, component) { | ||
return Discourse.SiteSettings.quick_messages_enabled && | ||
Discourse.SiteSettings.quick_message_user_preference && | ||
args.model.quick_messages_access | ||
} | ||
} |
16 changes: 6 additions & 10 deletions
16
...scripts/discourse/templates/connectors/user-preferences-interface/show-quick-messages.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
{{#if siteSettings.quick_message_enabled }} | ||
{{#if siteSettings.quick_message_user_preference }} | ||
<div class="controls"> | ||
<label class="checkbox-label"> | ||
{{input type="checkbox" checked=model.custom_fields.show_quick_messages}} | ||
{{i18n "user_preferences.quick_messages_preference"}} | ||
</label> | ||
</div> | ||
{{/if}} | ||
{{/if}} | ||
<div class="controls"> | ||
<label class="checkbox-label"> | ||
{{input type="checkbox" checked=model.custom_fields.show_quick_messages}} | ||
{{i18n "user_preferences.quick_messages_preference"}} | ||
</label> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require_dependency 'enum_site_setting' | ||
|
||
# Adds an Enum type used in the Admin to select a badge by name. | ||
# Examples see: https://github.com/discourse/discourse/blob/master/config/site_settings.yml | ||
|
||
class SettingQuickMessagesBadge < EnumSiteSetting | ||
def self.valid_value?(any) | ||
true | ||
end | ||
|
||
def self.values | ||
@values ||= begin | ||
@values = Badge.where(enabled: true).map{ |b| { name: b.name, value: b.id } } | ||
@values.unshift(name: 'None', value: 0) | ||
end | ||
end | ||
|
||
def self.translate_names? | ||
false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters