@@ -23,13 +23,7 @@ cls.ResourceDetailView = function(id, name, container_class, html, default_handl
2323 if ( this . data )
2424 this . go_to_line ( container , this . data ) ;
2525
26- // if (this.resource && this.resource.type in {'markup':1,})
27- {
28- //this.text_search.set_query_selector(".resource-detail-container");
29- this . text_search . update_search ( ) ;
30- }
31-
32- this . data = null ;
26+ this . text_search . update_search ( ) ;
3327 } ;
3428
3529 this . create_disabled_view = function ( container )
@@ -140,9 +134,16 @@ cls.ResourceDetailView = function(id, name, container_class, html, default_handl
140134
141135 this . _show_resource_by_instance = function ( resource )
142136 {
143- this . resource = resource ;
144- if ( resource && ! resource . data )
145- resource . fetch_data ( cls . ResourceDetailView . instance . update . bind ( cls . ResourceDetailView . instance ) ) ;
137+ this . resource = resource ;
138+ if ( ! resource )
139+ return ;
140+
141+ this . _service . highlight_resource ( resource . id ) ;
142+
143+ if ( resource . data )
144+ this . update ( ) ;
145+ else
146+ this . _show_resource_by_url ( resource . url ) ;
146147 }
147148
148149 this . _show_resource_by_id = function ( id )
@@ -151,13 +152,13 @@ cls.ResourceDetailView = function(id, name, container_class, html, default_handl
151152 this . _show_resource_by_instance ( resource ) ;
152153 }
153154
154- this . _show_resource_url = function ( url )
155+ this . _show_resource_by_url = function ( url )
155156 {
156157 var resource = this . _service . get_resource_for_url ( url ) ;
157- if ( resource )
158+ if ( resource && resource . data )
158159 this . _show_resource_by_instance ( resource ) ;
159160 else
160- new cls . ResourceRequest ( url , this . show_resource . bind ( this ) , this . data ) ;
161+ this . _service . request_resource ( url , this . show_resource . bind ( this ) , this . data ) ;
161162 }
162163
163164 this . show_resource = function ( resource , data )
@@ -170,10 +171,11 @@ cls.ResourceDetailView = function(id, name, container_class, html, default_handl
170171 else if ( resource == Number ( resource ) )
171172 this . _show_resource_by_id ( resource ) ;
172173 else if ( resource == String ( resource ) )
173- this . _show_resource_url ( resource ) ;
174+ this . _show_resource_by_url ( resource ) ;
175+ else
176+ this . update ( ) ;
174177
175- this . update ( ) ;
176- window . UI . instance . show_view ( window . views . resource_detail_view . id ) ;
178+ window . UI . instance . show_view ( this . id ) ;
177179 }
178180
179181 this . init ( id , name , container_class , html , default_handler ) ;
0 commit comments