David Ostrovsky | e877140 | 2016-02-13 12:23:53 +0100 | [diff] [blame] | 1 | // Copyright (C) 2016 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | (function() { |
| 15 | 'use strict'; |
| 16 | |
| 17 | Polymer({ |
| 18 | is: 'gr-confirm-cherrypick-dialog', |
| 19 | |
| 20 | /** |
| 21 | * Fired when the confirm button is pressed. |
| 22 | * |
| 23 | * @event confirm |
| 24 | */ |
| 25 | |
| 26 | /** |
| 27 | * Fired when the cancel button is pressed. |
| 28 | * |
| 29 | * @event cancel |
| 30 | */ |
| 31 | |
| 32 | properties: { |
| 33 | branch: String, |
Becky Siegel | f5d2e88 | 2016-11-16 12:59:59 -0800 | [diff] [blame] | 34 | changeStatus: String, |
| 35 | commitMessage: String, |
| 36 | commitNum: String, |
Becky Siegel | 013648f | 2017-03-10 14:19:08 -0800 | [diff] [blame] | 37 | message: String, |
Becky Siegel | f5d2e88 | 2016-11-16 12:59:59 -0800 | [diff] [blame] | 38 | }, |
| 39 | |
Becky Siegel | 013648f | 2017-03-10 14:19:08 -0800 | [diff] [blame] | 40 | observers: [ |
| 41 | '_computeMessage(changeStatus, commitNum, commitMessage)', |
| 42 | ], |
| 43 | |
Becky Siegel | f5d2e88 | 2016-11-16 12:59:59 -0800 | [diff] [blame] | 44 | _computeMessage: function(changeStatus, commitNum, commitMessage) { |
| 45 | var newMessage = commitMessage; |
| 46 | |
| 47 | if (changeStatus === 'MERGED') { |
| 48 | newMessage += '(cherry picked from commit ' + commitNum + ')'; |
| 49 | } |
Becky Siegel | 013648f | 2017-03-10 14:19:08 -0800 | [diff] [blame] | 50 | this.message = newMessage; |
David Ostrovsky | e877140 | 2016-02-13 12:23:53 +0100 | [diff] [blame] | 51 | }, |
| 52 | |
| 53 | _handleConfirmTap: function(e) { |
| 54 | e.preventDefault(); |
| 55 | this.fire('confirm', null, {bubbles: false}); |
| 56 | }, |
| 57 | |
| 58 | _handleCancelTap: function(e) { |
| 59 | e.preventDefault(); |
| 60 | this.fire('cancel', null, {bubbles: false}); |
| 61 | }, |
| 62 | }); |
| 63 | })(); |