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,14 +1,16 @@
<div class="modal-body"> <div class="modal-body">
<div class="radios"> {{#if allowLocal}}
<input type="radio" id="local" value="local" name="upload" {{action useLocal}}> <div class="radios">
<label class="radio" for="local">{{i18n upload_selector.from_my_computer}}</label> <input type="radio" id="local" value="local" name="upload" {{action useLocal}}>
{{#if controller.local}} <label class="radio" for="local">{{i18n upload_selector.from_my_computer}}</label>
<div class="inputs"> {{#if controller.local}}
<input type="file" id="filename-input"><br> <div class="inputs">
<span class="description">{{unbound view.tip}}</span> <input type="file" id="filename-input"><br>
</div> <span class="description">{{unbound view.tip}}</span>
{{/if}} </div>
</div> {{/if}}
</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>