@@ -4,12 +4,13 @@ $(function() {
4
4
5
5
if ( $ ( 'form.print_box' ) . length > 0 ) {
6
6
var server = $ ( 'form.print_box' ) . attr ( 'action' ) . replace ( / \/ ? $ / , '/' ) ;
7
+ var tracker = $ ( 'select#issue_tracker_id option:selected' ) . text ( ) ;
7
8
8
9
$ . getJSON ( server + "print/apps.json" , function ( data ) {
9
10
$ . each ( data , function ( key , value ) {
10
11
// "default" profile does not really work for some reason
11
- if ( value != "default" && value . split ( "_" ) [ 0 ] != "DEMO" ) {
12
- var option = $ ( "<option></option>" ) . attr ( "value" , value ) . text ( value . split ( "_" ) [ 1 ] ) ;
12
+ if ( value === tracker ) {
13
+ var option = $ ( "<option></option>" ) . attr ( "value" , value ) . text ( value ) ;
13
14
$ ( 'form.print_box select[name=template]' ) . append ( option ) ;
14
15
}
15
16
} ) ;
@@ -22,7 +23,7 @@ $(function() {
22
23
apikey = $ ( '#content > div.box > pre' , $ ( data ) ) . first ( ) . text ( ) ;
23
24
} ) ;
24
25
25
- $ ( 'form.print_box select' ) . on ( 'change' , function ( e ) {
26
+ $ ( 'form.print_box select[name=template] ' ) . on ( 'change' , function ( e ) {
26
27
$ . ajax ( {
27
28
type : 'GET' ,
28
29
url : server + "print/" + $ ( 'form.print_box select' ) . val ( ) + "/capabilities.json" ,
@@ -52,7 +53,8 @@ $(function() {
52
53
url : server + "print/" + appId + "/exampleRequest.json" ,
53
54
dataType : 'json' ,
54
55
success : function ( data ) {
55
- requestPrint ( appId , capabilities , JSON . parse ( data . requestData ) ) ;
56
+ var layout = $ ( 'form.print_box select[name=layout] option:selected' ) . text ( ) ;
57
+ requestPrint ( appId , capabilities , JSON . parse ( data [ layout ] ) ) ;
56
58
}
57
59
} ) ;
58
60
} ) ;
@@ -63,11 +65,6 @@ $(function() {
63
65
var format = $ ( 'form.print_box select[name=format]' ) . val ( ) ;
64
66
var layout = $ ( 'form.print_box select[name=layout]' ) . val ( ) ;
65
67
66
- // var paramObj = {};
67
- // $.each($('#issue-form').serializeArray(), function(_, kv) {
68
- // paramObj[kv.name] = kv.value;
69
- // });
70
-
71
68
$ . ajax ( {
72
69
type : 'GET' ,
73
70
url : $ ( '#issue-form' ) . attr ( "action" ) + ".json" ,
0 commit comments