Don't show the upload option if max_attachment_size_kb is 0.

This commit is contained in:
Vikhyat Korrapati 2013-12-06 10:29:15 +05:30
parent 2db3cfb16b
commit 2850279c45
2 changed files with 18 additions and 12 deletions

View File

@ -8,8 +8,12 @@
@module Discourse @module Discourse
**/ **/
Discourse.UploadSelectorController = Discourse.Controller.extend(Discourse.ModalFunctionality, { Discourse.UploadSelectorController = Discourse.Controller.extend(Discourse.ModalFunctionality, {
local: true, local: Em.computed.not("remote"),
remote: Em.computed.not("local"), remote: Em.computed.not("allowLocal"),
allowLocal: function() {
return Discourse.SiteSettings.max_attachment_size_kb > 0;
}.property(),
actions: { actions: {
useLocal: function() { this.set("local", true); }, useLocal: function() { this.set("local", true); },

View File

@ -1,4 +1,5 @@
<div class="modal-body"> <div class="modal-body">
{{#if allowLocal}}
<div class="radios"> <div class="radios">
<input type="radio" id="local" value="local" name="upload" {{action useLocal}}> <input type="radio" id="local" value="local" name="upload" {{action useLocal}}>
<label class="radio" for="local">{{i18n upload_selector.from_my_computer}}</label> <label class="radio" for="local">{{i18n upload_selector.from_my_computer}}</label>
@ -9,6 +10,7 @@
</div> </div>
{{/if}} {{/if}}
</div> </div>
{{/if}}
<div class="radios"> <div class="radios">
<input type="radio" id="remote" value="remote" name="upload" {{action useRemote}}> <input type="radio" id="remote" value="remote" name="upload" {{action useRemote}}>
<label class="radio" for="remote">{{i18n upload_selector.from_the_web}}</label> <label class="radio" for="remote">{{i18n upload_selector.from_the_web}}</label>