-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Widgets should be (more) self contained #107
Comments
So the widget.js fix is actually really trivial, based on the same trick to avoid the case block: render: function() {
var className = this.type[0].toUpperCase() + this.type.substring(1, 1000);
this.viewObj = new $[className]({
// standard initialization, not everything will be populated
imagesList: this.imagesList,
manifestId: this.manifestId,
element: this.content.element,
imageId: this.imageId,
openAt: this.openAt,
parent: this
});
this.viewObj.render();
}, |
@azaroth42 Makes sense. I'll add these changes to my list of custom widget improvements. Ideally, creating a new widget/view should be a one step process - dropping .js in the /js/src/ directory. |
And in viewer.js: loadView: function(type, manifestId, imageId, openAt) {
$.viewer.addWidget({
height: $.DEFAULT_SETTINGS[type].height,
manifestId: manifestId,
openAt: openAt,
imageId: imageId,
type: type,
width: $.DEFAULT_SETTINGS[type].width
});
}, Plus then the more tedious work of replacing all the loadFooView() functions with loadView("foo", ...) I'll rebase, fix and issue a pull request |
Thanks for accepting the pull :) Proposal: fooView.js becomes responsible for updating $.DEFAULT_SETTINGS with the information for itself. eg at the beginning of the function($) {, it would do... $.DEFAULT_SETTINGS.availableViews.imageView = {'label': 'Image View'};
$.DEFAULT_SETTINGS.imageView = {
'height': 600,
'width': 350,
'annotationsList': {
'display':true,
'width': 200
}
}; Also, at the same time, can we compact that down to just one object rather than two by putting all of the info into availableViews.fooView? Happy to do the legwork if the proposal is accepted. |
When starting to update my local, modified mirador to the latest github version, the interdependence of different files becomes apparent. It would be advantageous (IMO) to reduce the dependencies, such that developers have to touch as few files as possible in the core mirador code to add additional widgets.
As the project progresses, a widget library of contributed code will likely build up, and this should be kept as easy to maintain as possible.
For example:
Rob
The text was updated successfully, but these errors were encountered: