2014-08-13 07:04:36 +08:00
|
|
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
2013-07-15 05:44:50 +08:00
|
|
|
|
2014-08-13 07:04:36 +08:00
|
|
|
import DiscourseController from 'discourse/controllers/controller';
|
|
|
|
|
|
|
|
export default DiscourseController.extend(ModalFunctionality, {
|
2014-01-18 22:48:39 +08:00
|
|
|
remote: Em.computed.not("local"),
|
|
|
|
local: false,
|
2014-04-01 00:18:39 +08:00
|
|
|
showMore: false,
|
2014-01-18 22:48:39 +08:00
|
|
|
|
2014-06-28 02:48:39 +08:00
|
|
|
_initialize: function() {
|
2014-04-01 00:18:39 +08:00
|
|
|
this.setProperties({
|
|
|
|
local: this.get("allowLocal"),
|
|
|
|
showMore: false
|
|
|
|
});
|
2014-06-28 02:48:39 +08:00
|
|
|
}.on('init'),
|
2013-12-06 12:59:15 +08:00
|
|
|
|
2014-06-28 02:48:39 +08:00
|
|
|
maxSize: Discourse.computed.setting('max_attachment_size_kb'),
|
|
|
|
allowLocal: Em.computed.gt('maxSize', 0),
|
2013-07-15 05:44:50 +08:00
|
|
|
|
2013-09-17 02:08:55 +08:00
|
|
|
actions: {
|
2014-04-01 00:18:39 +08:00
|
|
|
useLocal: function() { this.setProperties({ local: true, showMore: false}); },
|
|
|
|
useRemote: function() { this.set("local", false); },
|
|
|
|
toggleShowMore: function() { this.toggleProperty("showMore"); }
|
2013-10-09 00:55:20 +08:00
|
|
|
}
|
2013-07-21 19:01:08 +08:00
|
|
|
|
|
|
|
});
|