Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library script_ref_element; | 5 library script_ref_element; |
| 6 | 6 |
| 7 import 'package:polymer/polymer.dart'; | 7 import 'package:polymer/polymer.dart'; |
| 8 import 'service_ref.dart'; | 8 import 'service_ref.dart'; |
| 9 | 9 |
| 10 @CustomTag('script-ref') | 10 @CustomTag('script-ref') |
| 11 class ScriptRefElement extends ServiceRefElement { | 11 class ScriptRefElement extends ServiceRefElement { |
| 12 @published int line = -1; | 12 @published int line = -1; |
| 13 | 13 |
| 14 String get url { | 14 String get objectId { |
| 15 if ((app != null) && (ref != null)) { | 15 if (line < 0) { |
| 16 var baseUrl = relativeLink(ref['id']); | 16 return super.objectId; |
| 17 if (line < 0) { | |
| 18 return baseUrl; | |
| 19 } else { | |
| 20 return '$baseUrl?line=$line'; | |
| 21 } | |
| 22 } | 17 } |
| 23 return ''; | 18 return '${super.objectId}?line=$line'; |
|
turnidge
2014/03/05 21:02:47
Maybe put a TODO here to revisit how we are doing
Cutch
2014/03/05 21:54:23
Done.
| |
| 24 } | 19 } |
| 25 | 20 |
| 26 String get hoverText { | 21 String get hoverText { |
| 27 if (ref == null) { | 22 if (ref == null) { |
| 28 return ''; | 23 return ''; |
| 29 } | 24 } |
| 30 if (line < 0) { | 25 if (line < 0) { |
| 31 return ref['user_name']; | 26 return ref['user_name']; |
| 32 } else { | 27 } else { |
| 33 return "${ref['user_name']}:$line"; | 28 return "${ref['user_name']}:$line"; |
| 34 } | 29 } |
| 35 } | 30 } |
| 36 | 31 |
| 37 String get name { | 32 String get name { |
| 38 if (ref == null) { | 33 if (ref == null) { |
| 39 return ''; | 34 return ''; |
| 40 } | 35 } |
| 41 var scriptUrl = ref['user_name']; | 36 var scriptUrl = ref['user_name']; |
| 42 var shortScriptUrl = scriptUrl.substring(scriptUrl.lastIndexOf('/') + 1); | 37 var shortScriptUrl = scriptUrl.substring(scriptUrl.lastIndexOf('/') + 1); |
| 43 if (line < 0) { | 38 if (line < 0) { |
| 44 return shortScriptUrl; | 39 return shortScriptUrl; |
| 45 } else { | 40 } else { |
| 46 return "$shortScriptUrl:$line"; | 41 return "$shortScriptUrl:$line"; |
| 47 } | 42 } |
| 48 } | 43 } |
| 49 | 44 |
| 50 ScriptRefElement.created() : super.created(); | 45 ScriptRefElement.created() : super.created(); |
| 51 } | 46 } |
| OLD | NEW |