Skip to content
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

Use components for complex UI elements #94

Open
joefitter opened this issue May 17, 2016 · 7 comments
Open

Use components for complex UI elements #94

joefitter opened this issue May 17, 2016 · 7 comments

Comments

@joefitter
Copy link
Contributor

joefitter commented May 17, 2016

For more complicated mixins, eg input-date, we should provide a fully packaged component, containing a view partial, rendering logic, process logic and tests. From speaking at length with @JoeChapman the tricky part will be where the processing logic will sit. One option could be to use a mixin, where the additional functionality will be mixed in to the base controller, the downside of this would be naming - last mixin methods would overwrite and conflicting previous mixins methods, and each mixin would also need to have access to the parent class to call any overwritten super methods.

Another solution would be to hook into POST requests before the controller POST process/save cycle is called, and manipulate the data that is represented by the 'field' - this would be more of a middleware approach I guess and seems cleaner than the mixin approach IMO.

Open to any other suggestions @JoeChapman @easternbloc @daniel-ac-martin

@joefitter
Copy link
Contributor Author

This is linked to comments on this PR - UKHomeOffice-attic/hof-controllers#39 (comment)

@JoeChapman
Copy link
Contributor

Can you expend on why the tricky part will be naming?

additional functionality will be mixed in to the base controller, the downside of this would be naming

@JoeChapman
Copy link
Contributor

Can you clarify what you mean by "mixin", a template mixin or programmaitcally mixing two more object together?

One option could be to use a mixin, where the additional functionality will be mixed in to the base controller, the downside of this would be naming - last mixin methods would overwrite and conflicting previous mixins methods, and each mixin would also need to have access to the parent class to call any overwritten super methods.

@joefitter
Copy link
Contributor Author

if we have a mixin which overrides the process prototype method of the parent, and another mixin that overrides the same method, the later will overwrite the former. Linear extension would avoid this, but seems unnecessary as the component controller wont need a lot of the functionality

@joefitter
Copy link
Contributor Author

mixin - mixing in the prototypal methods of a class into the controller

@JoeChapman
Copy link
Contributor

I thought perhaps you meant a template mixin with extra functionality, which might be a third option?

@joefitter
Copy link
Contributor Author

it will have a template mixin, this will be the rendering part. The controller will deal with processing the data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants