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
**/
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); },

View File

@ -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>