mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Merge pull request #1723 from vikhyat/disable-uploads
Don't show uploading forms if the relevant site settings are disabled
This commit is contained in:
commit
a7eced3a06
4 changed files with 27 additions and 13 deletions
|
@ -7,6 +7,10 @@
|
|||
@module Discourse
|
||||
**/
|
||||
Discourse.PreferencesController = Discourse.ObjectController.extend({
|
||||
allowAvatarUpload: function() {
|
||||
return Discourse.SiteSetting.allow_uploaded_avatars;
|
||||
}.property(),
|
||||
|
||||
// By default we haven't saved anything
|
||||
saved: false,
|
||||
|
||||
|
|
|
@ -8,8 +8,12 @@
|
|||
@module Discourse
|
||||
**/
|
||||
Discourse.UploadSelectorController = Discourse.Controller.extend(Discourse.ModalFunctionality, {
|
||||
local: true,
|
||||
remote: Em.computed.not("local"),
|
||||
local: Em.computed.not("remote"),
|
||||
remote: Em.computed.not("allowLocal"),
|
||||
|
||||
allowLocal: function() {
|
||||
return Discourse.SiteSettings.max_attachment_size_kb > 0;
|
||||
}.property(),
|
||||
|
||||
actions: {
|
||||
useLocal: function() { this.set("local", true); },
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
<div class="modal-body">
|
||||
<div class="radios">
|
||||
<input type="radio" id="local" value="local" name="upload" {{action useLocal}}>
|
||||
<label class="radio" for="local">{{i18n upload_selector.from_my_computer}}</label>
|
||||
{{#if controller.local}}
|
||||
<div class="inputs">
|
||||
<input type="file" id="filename-input"><br>
|
||||
<span class="description">{{unbound view.tip}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{#if allowLocal}}
|
||||
<div class="radios">
|
||||
<input type="radio" id="local" value="local" name="upload" {{action useLocal}}>
|
||||
<label class="radio" for="local">{{i18n upload_selector.from_my_computer}}</label>
|
||||
{{#if controller.local}}
|
||||
<div class="inputs">
|
||||
<input type="file" id="filename-input"><br>
|
||||
<span class="description">{{unbound view.tip}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="radios">
|
||||
<input type="radio" id="remote" value="remote" name="upload" {{action useRemote}}>
|
||||
<label class="radio" for="remote">{{i18n upload_selector.from_the_web}}</label>
|
||||
|
|
|
@ -49,7 +49,11 @@
|
|||
<label class="control-label">{{i18n user.avatar.title}}</label>
|
||||
<div class="controls">
|
||||
{{boundAvatar model imageSize="large"}}
|
||||
<button {{action showAvatarSelector}} class="btn pad-left"><i class="icon-pencil"></i></button>
|
||||
{{#if allowAvatarUpload}}
|
||||
<button {{action showAvatarSelector}} class="btn pad-left"><i class="icon-pencil"></i></button>
|
||||
{{else}}
|
||||
<a href="//gravatar.com/emails" target="_blank" title="{{i18n user.change_avatar.gravatar_title}}" class="btn"><i class="icon-pencil"></i></a>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue