Picture of Timo R
Plugin development: I could use some tips to get started! :)
by Timo R - Monday, 12 September 2022, 7:58 PM
 

Hi everyone,

I am in the process of creating an e-learning using Adapt framework. I've read a lot about it and installed the Authoring Tool to play around with it and created some pages already. It works very well and I have explored and tried almost all options.

However, I can't map all the client's requirements with the existing components and would like to create my own extensions for it. This currently confronts me with some problems. I am a developer, but I do not have extensive experience in working with Bower packages. Therefore, I am not very familiar with the whole architecture of Adapt.

I looked at the tutorial on creating your own plugins, but it doesn't really seem very serious. E.g. nowhere does it mention that a schema is necessary (which is requested during installation of a plugin) and how to create it. So I looked at other plugins and derived one of my own (specifically from the Narrative component). 

At least I can install this successfully now and put my component in a block. Now when loading the page I get the error "View 630fbc9efea5ff81b3aabc8c (article), 631e4711d031507438c52298 (block) failed to become ready, forcing ready status."

I looked at the ComponentView code and tried setting _isReady and _isRendered to true in my component, but that doesn't help. It still comes to the logReadyError in the preRender, I assume. I googled for it but couldn't find anything. 

Maybe I didn't find the real docs. I don't know of any tutorial that would cover all these issues that arise when developing an extension and explain the architecture of the framework to me. 

What I'm also wondering is how to test my extension properly. Currently I install it via the upload function in the authoring tool and test it. If I make a change, I have to delete it and install it again.

If I change the installed code it has no effect because I would have to restart the build process, as changing my templates has no effect without re-build / re-start because they are integrated into the global build/templates.js.

If someone could give me some essential workflow tips for developing my own extension, I would be very grateful! :-)

Picture of Oliver Foster
Re: Plugin development: I could use some tips to get started! :)
by Oliver Foster - Tuesday, 13 September 2022, 6:47 AM
 

Hi Timo,

would like to create my own extensions for it.

Awesome.

I do not have extensive experience in working with Bower packages

Bower is effectively the package management system for front end development that existed before npm was a thing. It works in exactly the same way as npm for the most part but our current use of it is still a huge deviation from its intended purpose. You don't need to understand anything about bower or our implementation to create plugins in adapt, except that the bower.json can be thought of as the package.json equivalent.

> I looked at the tutorial on creating your own plugins, but it doesn't really seem very serious.

That's a fair critique. The documents aren't very full and do need updating and are reasonably old and out of date.

I looked at the ComponentView code and tried setting _isReady and _isRendered to true in my component, but that doesn't help.

You should never change the values of _isReady and _isRendered by hand. In/after the postRender function of your view, call this.model.setReadyStatus() to signify that your component is finished rendering. _isRendered is used by the core to check if a component has been rendered.

Maybe I didn't find the real docs. I don't know of any tutorial that would cover all these issues that arise when developing an extension and explain the architecture of the framework to me. 

You're more than welcome to help us update the documents.

What I'm also wondering is how to test my extension properly. Currently I install it via the upload function in the authoring tool and test it. If I make a change, I have to delete it and install it again.

Please read this https://github.com/adaptlearning/adapt_framework/wiki/Git-flow#create-editing-and-testing-plugins

And come visit in gitter https://gitter.im/adaptlearning/general_chat

 

 

 

 

Picture of Timo R
Re: Plugin development: I could use some tips to get started! :)
by Timo R - Tuesday, 13 September 2022, 8:45 PM
 

Hi Oliver,

Thanks for your direct feedback and the hint with setReadyStatus. That helped!

I will take a close look at the workflow for "Create, editing and testing plugins" and hope to be able to understand and apply the principle. For now, it seems like a lot of effort to test a simple component. ;) If I will fail at this, I'll get back to you, gladly in gitter. :)

Picture of Oliver Foster
Re: Plugin development: I could use some tips to get started! :)
by Oliver Foster - Wednesday, 14 September 2022, 8:02 AM
 

Hi Timo,

All of our core plugin development happens along those lines, without the Authoring Tool.

Picture of Timo R
Re: Plugin development: I could use some tips to get started! :)
by Timo R - Wednesday, 14 September 2022, 6:21 PM
 

Ok, cool. I will definitely take a closer look!