import Route from '@ember/routing/route';
import getFullVersion from 'ember-api-docs/utils/get-full-version';
import { inject as service } from '@ember/service';
import { get } from '@ember/object';

export default Route.extend({

  headData: service(),
  metaStore: service(),
  scrollPositionReset: service(),

  titleToken(model) {
    return get(model, 'fn.name');
  },

  async model(params, transition) {
    let projectID = transition.params['project-version'].project;
    let projectObj = await this.store.findRecord('project', projectID);
    let compactVersion = transition.params['project-version'].project_version;
    let projectVersion = getFullVersion(compactVersion, projectID, projectObj, this.get('metaStore'));
    let className = params['module'];
    let functionName = params['fn'];
    let classObj = await this.store.find('class', `${projectID}-${projectVersion}-${className}`)
    return {
      fnModule: classObj,
      fn: this.getFunctionObjFromList(classObj, functionName)
    };
  },

  getFunctionObjFromList(classObj, functionName) {
    return classObj.get('methods').find(fn => {
      return fn.name === functionName;
    })
  },

  activate() {
    this.get('scrollPositionReset').doReset();
  }

});

@@ -732,22 +732,17 @@
     let 
-classN
+n
 ame = pa
@@ -802,24 +802,100 @@
     let 
-classObj
+fnModule;%0A    let fn;%0A    if (name === 'rsvp' %7C%7C name === 'jquery') %7B%0A      fnModule
  = await
@@ -912,21 +912,22 @@
 e.find('
-class
+module
 ', %60$%7Bpr
@@ -959,59 +959,217 @@
 %7D-$%7B
-className%7D%60)%0A    return %7B%0A      fnModule: classObj,
+name%7D%60);%0A      fn = fnModule.get(%60allstaticfunctions.$%7Bname%7D%60).find(elem =%3E elem.name === functionName);%0A%0A    %7D else %7B%0A      fnModule = await this.store.find('class', %60$%7BprojectID%7D-$%7BprojectVersion%7D-$%7Bname%7D%60);
 %0A   
@@ -1173,17 +1173,18 @@
       fn
-:
+ =
  this.ge
@@ -1200,32 +1200,32 @@
 ObjFromList(
-classObj
+fnModule
 , functionNa
@@ -1227,16 +1227,61 @@
 ionName)
+;%0A    %7D%0A    return %7B%0A      fnModule,%0A      fn
 %0A    %7D;%0A

Fix broken function links for rsvp and jquery