|
| 1 | +<script type="text/javascript"> |
| 2 | + RED.nodes.registerType('send-sms', { |
| 3 | + category: 'twilio sms', |
| 4 | + color: '#a6bbcf', |
| 5 | + defaults: { |
| 6 | + name: { value: '' }, |
| 7 | + account: { value: '', type: 'account' }, |
| 8 | + text: { value: '', required: true }, |
| 9 | + from: { value: '', required: true, validate: RED.validators.typedInput('fromType') }, |
| 10 | + fromType: { value: 'num' }, |
| 11 | + to: { value: '', required: true, validate: RED.validators.typedInput('toType') }, |
| 12 | + toType: { value: 'num' }, |
| 13 | + }, |
| 14 | + inputs: 1, |
| 15 | + outputs: 1, |
| 16 | + icon: 'file.png', |
| 17 | + label: function() { |
| 18 | + return this.name || 'send-sms'; |
| 19 | + }, |
| 20 | + oneditprepare: function() { |
| 21 | + $('#node-input-from').typedInput({ default: this.fromType || 'num', types: ['num', 'msg'] }); |
| 22 | + $('#node-input-to').typedInput({ default: this.toType || 'num', types: ['num', 'msg'] }); |
| 23 | + }, |
| 24 | + oneditsave: function() { |
| 25 | + this.fromType = $('#node-input-from').typedInput('type'); |
| 26 | + this.toType = $('#node-input-to').typedInput('type'); |
| 27 | + }, |
| 28 | + }); |
| 29 | +</script> |
| 30 | + |
| 31 | +<script type="text/x-red" data-template-name="send-sms"> |
| 32 | + <div class="form-row"> |
| 33 | + <label for="node-input-account"><i class="fa fa-user"></i> Account</label> |
| 34 | + <input type="text" id="node-input-account"> |
| 35 | + </div> |
| 36 | + <div class="form-row"> |
| 37 | + <label for="node-input-text"><i class="fa fa-align-left"></i> Text</label> |
| 38 | + <textarea rows="10" style="width: 70%;" id="node-input-text"/> |
| 39 | + </div> |
| 40 | + <div class="form-row"> |
| 41 | + <label for="node-input-from"><i class="fa fa-tag"></i> From</label> |
| 42 | + <input type="text" id="node-input-from" style="width: 70%"/> |
| 43 | + </div> |
| 44 | + <div class="form-row"> |
| 45 | + <label for="node-input-to"><i class="fa fa-tag"></i> To</label> |
| 46 | + <input type="text" id="node-input-to" style="width: 70%"/> |
| 47 | + </div> |
| 48 | + <div class="form-row"> |
| 49 | + <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> |
| 50 | + <input type="text" id="node-input-name" placeholder="Name"> |
| 51 | + </div> |
| 52 | +</script> |
| 53 | + |
| 54 | +<script type="text/x-red" data-help-name="send-sms"> |
| 55 | + <p>Send an SMS.</p> |
| 56 | +</script> |
0 commit comments