26
26
< ul class ="nav ">
27
27
< li > < a href ="#/ " id ="entryPointLink "> Go To Entry Point</ a > </ li >
28
28
< li > < a href ="https://github.com/mikekelly/hal-browser "> About The HAL Browser</ a > </ li >
29
- < li > < a href ="/ "> Pact Broker Home</ a > </ li >
29
+ < li > < a href ="/ "> Pact Broker Home</ a > </ li > <!-- pact_broker -->
30
30
</ ul >
31
31
</ div >
32
32
</ div >
38
38
< script id ="location-bar-template " type ="text/template ">
39
39
< form >
40
40
< div class = "input-append span12 location-bar-container" >
41
- < input class = "span11" id = "appendedInputButton" type = "text" value = "<%= url %>" >
41
+ < input class = "span11" id = "appendedInputButton" type = "text" value = "<%= _.escape( url) %>" >
42
42
< button class = "btn" type = "submit" > Go!</ button >
43
43
< span class = "ajax-loader" > </ span >
44
44
</ div >
@@ -63,24 +63,23 @@ <h2>Links</h2>
63
63
< % if ( $ . isArray ( obj ) ) { % >
64
64
< % _ . each ( obj , function ( link , i ) { % >
65
65
< tr >
66
- < % tdStyle = i > 0 ? "border-top:none" : "" %>
67
- < td style = "<%= tdStyle %>" > < strong > < %= i = == 0 ? HAL . truncateIfUrl ( rel ) : '' % > </strong > < / td >
66
+ < td > < strong > < %= HAL . truncateIfUrl ( rel ) % > </strong > < / td >
68
67
< td > < %= link . title || '' % > </ td >
69
68
< td > < %= link . name ? 'name : ' + link . name : 'index : ' + i % > </ a > </ td >
70
69
< td >
71
70
< % if ( HAL . isUrl ( rel ) ) { % >
72
- < a class = "dox" href = "<%= HAL.buildUrl(rel) %>" > < i class = "icon-book" > </ i > </ a >
71
+ < a class = "dox" href = "<%= HAL.normalizeUrl(HAL. buildUrl(rel) ) %>" > < i class = "icon-book" > </ i > </ a >
73
72
< % } % >
74
73
</ td >
75
74
< td >
76
75
< % if ( link . templated = == true ) { % >
77
- < a class = "query btn btn-success" href = "<%= link.href %>" title = "Query URI template" > < i class = "icon-question-sign" > </ i > </ a >
76
+ < a class = "query btn btn-success" href = "<%= HAL.normalizeUrl( link.href) %>" title = "Query URI template" > < i class = "icon-question-sign" > </ i > </ a >
78
77
< % } else { % >
79
- < a class = "follow btn btn-success" href = "<%= link.href %>" title = "Follow link" > < i class = "icon-arrow-right" > </ i > </ a >
78
+ < a class = "follow btn btn-success" href = "<%= HAL.normalizeUrl( link.href) %>" title = "Follow link" > < i class = "icon-arrow-right" > </ i > </ a >
80
79
< % } %>
81
80
</ td >
82
81
< td >
83
- < a class = "non-get btn btn-warning" href = "<%= link.href %>" title = "Perform non-GET request" > !</ a >
82
+ < a class = "non-get btn btn-warning" href = "<%= HAL.normalizeUrl( link.href) %>" title = "Perform non-GET request" > !</ a >
84
83
</ td >
85
84
</ tr >
86
85
< % } ) ; % >
@@ -91,18 +90,18 @@ <h2>Links</h2>
91
90
< td > < %= obj . name || '' % > </ td >
92
91
< td >
93
92
< % if ( HAL . isUrl ( rel ) ) { % >
94
- < a class = "dox" href = "<%= HAL.buildUrl(rel) %>" > < i class = "icon-book" > </ i > </ a >
93
+ < a class = "dox" href = "<%= HAL.normalizeUrl(HAL. buildUrl(rel) ) %>" > < i class = "icon-book" > </ i > </ a >
95
94
< % } % >
96
95
</ td >
97
96
< td >
98
97
< % if ( obj . templated = == true ) { % >
99
- < a class = "query btn btn-success" href = "<%= obj.href %>" title = "Query URI template" > < i class = "icon-question-sign" > </ i > </ a >
98
+ < a class = "query btn btn-success" href = "<%= HAL.normalizeUrl( obj.href) %>" title = "Query URI template" > < i class = "icon-question-sign" > </ i > </ a >
100
99
< % } else { % >
101
- < a class = "follow btn btn-success" href = "<%= obj.href %>" title = "Follow link" > < i class = "icon-arrow-right" > </ i > </ a >
100
+ < a class = "follow btn btn-success" href = "<%= HAL.normalizeUrl( obj.href) %>" title = "Follow link" > < i class = "icon-arrow-right" > </ i > </ a >
102
101
< % } %>
103
102
</ td >
104
103
< td >
105
- < a class = "non-get btn btn-warning" href = "<%= obj.href %>" title = "Perform non-GET request" > !</ a >
104
+ < a class = "non-get btn btn-warning" href = "<%= HAL.normalizeUrl( obj.href) %>" title = "Perform non-GET request" > !</ a >
106
105
</ td >
107
106
</ tr >
108
107
< % } % >
@@ -113,7 +112,7 @@ <h2>Links</h2>
113
112
114
113
< script id ="properties-template " type ="text/template ">
115
114
< h2 > Properties</ h2 >
116
- < pre > < %= _ . escape ( JSON . stringify ( properties , null , HAL . jsonIndent ) ) % > </pre >
115
+ < pre > < %= properties % > </ pre >
117
116
</ script >
118
117
119
118
< script id ="request-headers-template " type ="text/template ">
@@ -125,7 +124,16 @@ <h2>Custom Request Headers</h2>
125
124
< h2 > Response Headers</ h2 >
126
125
< pre > < %= status . code % > < %= status . text % >
127
126
128
- < %= _ . escape ( headers ) % > </ pre >
127
+ < % _ . each ( headers , function ( value , name ) {
128
+ % > < %= _ . escape ( name ) % > : < %
129
+ if ( HAL . isFollowableHeader ( name ) ) {
130
+ % > < a href = "<%= HAL.normalizeUrl(value) %>" class = "follow" > < %
131
+ }
132
+ % > < %= _ . escape ( value )
133
+ % > < % if ( HAL . isFollowableHeader ( name ) ) {
134
+ % > </ a > < %
135
+ } % >
136
+ < % } ) % > </ pre >
129
137
</ script >
130
138
131
139
< script id ="response-body-template " type ="text/template ">
@@ -142,7 +150,7 @@ <h3>Expand URI Template</h3>
142
150
< form id = "query" action = "<%= href %>" >
143
151
< div class = "modal-body" >
144
152
< p > URI Template:</ p >
145
- < pre > < %= href % > </pre >
153
+ < pre > < % - href % > </ pre >
146
154
< p > Input (JSON):</ p >
147
155
< textarea > < %= input % > </ textarea >
148
156
< p > Expanded URI:</ p >
@@ -193,21 +201,22 @@ <h2>Embedded Resources</h2>
193
201
194
202
< script id ="embedded-resource-template " type ="text/template ">
195
203
< div class = "accordion-heading" >
204
+ <!-- pact_broker -->
196
205
< a class = "accordion-toggle" href = "#" > < %= resource . identifier % > < % if ( resource . name || resource . title ) { % > : < span class = "embedded-resource-title" > < % - resource . name || resource . title % > </ span > < % } % >
197
206
< % if ( HAL . isUrl ( resource . embed_rel ) ) { % >
198
- < span class = "dox pull-right" data-href = "<%= HAL.buildUrl(resource.embed_rel) %>" >
207
+ < span class = "dox pull-right" data-href = "<%= HAL.normalizeUrl(HAL. buildUrl(resource.embed_rel) ) %>" >
199
208
< i class = "icon-book" > </ i >
200
209
</ span >
201
210
< % } % >
202
211
</ a >
203
212
</ div >
204
213
</ script >
205
214
206
-
207
215
< script src ="vendor/js/jquery-1.10.2.min.js "> </ script >
208
216
< script src ="vendor/js/underscore.js "> </ script >
209
217
< script src ="vendor/js/backbone.js "> </ script >
210
218
< script src ="vendor/js/uritemplates.js "> </ script >
219
+ < script src ="vendor/js/URI.min.js "> </ script >
211
220
< script src ="vendor/js/bootstrap.js "> </ script >
212
221
213
222
< script src ="js/hal.js "> </ script >
0 commit comments