Created
August 21, 2014 13:00
-
-
Save ramrrr/e4b10ef22044ff66bd4c to your computer and use it in GitHub Desktop.
Tab sequence
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var App = require("core/App"); | |
| require("./messageForChannels"); | |
| require("./ChannelTabView"); | |
| module.exports = App.MessageForChannelsView = Ember.View.extend({ | |
| templateName: "alertComposer/messagesForChannels/messageForChannels", | |
| channelIds : ["Voice","SMS","Email"], | |
| willDestroyElement:function() { | |
| if (this.shouldCallfacade()) { | |
| this.get('controller').createTts(this.get('controller.voiceChannel.message')); | |
| } | |
| }, | |
| shouldCallfacade:function() { | |
| var voiceMessage = this.get('controller.voiceChannel.message'); | |
| if(voiceMessage) { | |
| if(voiceMessage.get('audios.length') != 0){ | |
| return false; | |
| } else { | |
| return true; | |
| } | |
| } | |
| return false; | |
| }, | |
| getChannelObjects:function(){ | |
| var previousChannelArray = []; | |
| var tempChannelArray = []; | |
| this.get("controller.target.model.channels").forEach(function (channel) { | |
| previousChannelArray.push(channel); | |
| }) | |
| for (var i = 0; i < previousChannelArray.length; i++) { | |
| if (previousChannelArray[i] instanceof App.VoiceChannel) { | |
| tempChannelArray[0] = previousChannelArray[i] | |
| } | |
| else if (previousChannelArray[i] instanceof App.SmsChannel) { | |
| tempChannelArray[ 1] = previousChannelArray[i] | |
| } | |
| else if (previousChannelArray[i] instanceof App.EmailChannel) { | |
| tempChannelArray[2] = previousChannelArray[i] | |
| } | |
| } | |
| previousChannelArray.clear(); | |
| for (var i = 0; i < tempChannelArray.length; i++) { | |
| if (tempChannelArray[i]!= undefined) { | |
| previousChannelArray.pushObject(tempChannelArray[i]); | |
| } | |
| } | |
| return previousChannelArray; | |
| }.property("target.model.channels.@each"), | |
| didInsertElement: function() { | |
| debugger | |
| var tempChannels = this.get("getChannelObjects"); | |
| self.get('controller.target.model.channels').clear() | |
| self.get('controller.target.model.channels').pushObjects(tempChannels) | |
| }, | |
| keyUp: function(event) { | |
| //check if main message has crossed the word limit then show error | |
| if($(event.target).is("textArea.mainMessageDivMargin")) { | |
| if(!this.get('controller.hasMainMessageLimitCrossed')) { | |
| if ($(event.target).val().length >= window.MaxLimitForMessage) { | |
| this.set('controller.hasMainMessageLimitCrossed', true) | |
| } else { | |
| this.set('controller.hasMainMessageLimitCrossed', false) | |
| } | |
| } | |
| } | |
| } | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment