Skip to content

Instantly share code, notes, and snippets.

@ramrrr
Last active March 14, 2016 15:13
Show Gist options
  • Select an option

  • Save ramrrr/ee0449ba79e0b5f772f1 to your computer and use it in GitHub Desktop.

Select an option

Save ramrrr/ee0449ba79e0b5f772f1 to your computer and use it in GitHub Desktop.
Facebook
/**
* Created by svein on 08/05/15.
*/
var App = require("core/App");
var HasModal = require("core/HasModal");
var FacebookChannelConfig = require("alertComposer/facebook/FacebookChannelConfig");
var AttachedFile = require("alertComposer/attachment/AttachedFile");
require("alertComposer/facebook/FacebookView");
var defaultKey = "heimdall.channel.facebook.FacebookChannelConfig.default";
module.exports = App.FacebookController = Ember.ObjectController.extend(HasModal, {
availableConfigs: [],
defaultConfigs : [],
mainMessageBinding:"target.mainMessage",
useMainMessageBinding:'target.useMainMessage',
channelSpecificMessageBinding : "model.message.message",
messageDescription:null,
infoConfig: function(config) {
this.set("activeModal", "channelConfigInfo");
},
setConfig: function(config) {
this.set("model.channelConfig.name", config.get("name"));
this.set("model.channelConfig.description", config.get("description"));
},
msgObs: function() {
this.set("messageDescription", this.get("model.message.message"));
}.observes("model.message.message"),
addAttachments : function(fileName, key){
var store=this.store;
var attach = store.createRecord(AttachedFile);
attach.set('fileName',fileName);
attach.set('key',key);
this.get("model.message.attachedFiles").pushObject(attach);
},
setAttachmentChangeModal:function(fileTobeRemoved){
this.set("fileToBeRemoved",fileTobeRemoved);
this.setModal('deleteAttachmentChange')
},
removeUploadedFile : function(){
this.get("message.attachedFiles").removeObject(this.get('fileToBeRemoved'))
this.set("fileToBeRemoved","");
this.setModal('none')
},
cancelDelete:function() {
this.set("fileToBeRemoved","");
this.setModal('none')
}
})
<div {{bindAttr class=":voiceCallFlow callFlowSOS model.message.validationErrors.messageInvalid:error"}}>
<div class="row-fluid" style="margin-top:30px;">
<div {{bindAttr class=":control-group callFlowTopMargin model.message.validationErrors.messageInvalid:error"}}>
<label class="control-label labelWithNoMargin">
{{t alert.summary.facebook.message}}<span class="required">*</span>:
</label>
<div id="callFlowSelect">
{{view App.FacebookInputView valueBinding="model.message.message" targetBinding=view.controller.target}}
{{#if view.channel.message.validationErrors.message}}
<span class="help-inline">{{view.channel.message.validationErrors.message}}</span>
{{/if}}
</div>
<div class="control-group">
<label class="control-label labelWithNoMargin">
{{t email.attachments}} :
</label>
<div class="control-group">
{{view UI.FileUploadView title="Photo" url="/utility/fileUpload" valueBinding="controller.model.message.attachedFiles" channel="facebook"}}
</div>
</div>
</div>
</div>
</div>
{{#view UI.ModalView name="deleteAttachmentChange" activeModalBinding="activeModal"}}
<div class="modal-header">
<button type="button" class="close" {{action setModal "none" }} {{translateAttr title="tooltip.directory.close"}}
aria-hidden="true">&times;</button>
<h3 class="modal-heading">
{{t common.delete}}
</h3>
</div>
<div id='add_Modal_body' class="modal-body">
<form class="row-fluid" >
<div class="span3" style="padding-left: 35px">
<i class="icon-16 icon-trash icon-5x"></i>
</div>
<div class="span8" style="margin-left: 0px;">
<p style="color:red; margin-left: 25px;">
{{t composer.delete.attachment}}
</p>
<br/>
</div>
</form>
</div>
<div id="add_modal_footer" class="modal-footer">
<button {{action removeUploadedFile }} class="btn btn-primary btn-primary-secondary" style="margin-right: 5px" tabindex="1">{{ t common.delete}}</button>
<button class="btn btn-secondary btn-secondary-secondary" style="margin-left: 5px" {{action cancelDelete}} tabindex="2">{{ t send.wizard.cancel}}</button>
</div>
{{/view}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment