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

feat: implement bhHiddenField #2278

Merged

Conversation

jniles
Copy link
Collaborator

@jniles jniles commented Nov 5, 2017

This commit implements the bhHiddenField component which hides any transcluded HTML behind a toggle and lets the user decide when to show it and to hide it after. The use case is for option fields in forms that do not need to be considered by default. For example, many reports have complex options that should not be presented on the outset, but can instead by added in later.

Closes #933.

clientsreportclosed
Fig 1: Closed Hidden Field

clientsreportopen
Fig 2: Open Hidden Field

@jniles jniles force-pushed the feat-bh-hidden-field-component branch from 6c44827 to 850f64e Compare November 6, 2017 05:21
@jniles jniles force-pushed the feat-bh-hidden-field-component branch 2 times, most recently from 8c265a6 to ae2d165 Compare November 11, 2017 13:29
@jniles
Copy link
Collaborator Author

jniles commented Nov 14, 2017

@DedrickEnc, can I get a review?

@DedrickEnc
Copy link
Contributor

@jniles
Will do it this evening

Copy link
Contributor

@DedrickEnc DedrickEnc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jniles

This feature is very important, it avoids information pollution in the system which very crucial for novices in computer system using (Vanga and Lukonga users).
Information pollution can easily unoriente users.

However, it will be good to see a test for this component. It should expose a method to toggle the view for viewing/hiding components which are inside.

Great idea!

*/

var template =
'<p>' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so small but since we are not using ECMA 6 syntax to make string templating at the client side, you can create a separate file to make it easy to read.

@jniles
Copy link
Collaborator Author

jniles commented Nov 14, 2017

@DedrickEnc, good idea. Tests are always a good thing 👍

I'll work on this in the next couple days - my internet connection is giving me a hard time at the moment!

@jniles jniles force-pushed the feat-bh-hidden-field-component branch 2 times, most recently from 54e644c to b4b3631 Compare November 16, 2017 10:52
This commit implements the `bhHiddenField` component which hides any
transcluded HTML behind a toggle and lets the user decide when to show
it and to hide it after.  The use case is for option fields in forms
that do not need to be considered by default.  For example, many reports
have complex options that should not be presented on the outset, but can
instead by added in later.

Closes Third-Culture-Software#933.
This commit adds unit tests for the `bhHiddenField` component.  The
component is relatively simple - is only shows and hides transcluded
data.  These tests assert that the data is hidden by default and visible
when toggled on.
@jniles jniles force-pushed the feat-bh-hidden-field-component branch from b4b3631 to caa8e1c Compare November 16, 2017 10:53
@jniles
Copy link
Collaborator Author

jniles commented Nov 16, 2017

@DedrickEnc, thank you for your review.

You will need to run yarn install or npm install to get chai-dom to run the unit tests locally.

I've implemented unit tests in Karma for the bhHiddenField component. We should do this for all directives and components in the future. I've also moved the template into modules/templates. We should probably figure out how to put the JS and component templates side by side in the future.

Let me know what you think!

@DedrickEnc
Copy link
Contributor

Thanks for the feedback, I am working on the stock at Pax. Will review it this evening.

Copy link
Contributor

@DedrickEnc DedrickEnc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DedrickEnc
Copy link
Contributor

bors r+

bors bot added a commit that referenced this pull request Nov 16, 2017
2278: feat: implement bhHiddenField r=DedrickEnc a=jniles

This commit implements the `bhHiddenField` component which hides any transcluded HTML behind a toggle and lets the user decide when to show it and to hide it after.  The use case is for option fields in forms that do not need to be considered by default.  For example, many reports have complex options that should not be presented on the outset, but can instead by added in later.

Closes #933.

![clientsreportclosed](https://user-images.githubusercontent.com/896472/32426507-81521b88-c2c3-11e7-957f-bc9240fafa0d.PNG)
_Fig 1: Closed Hidden Field_

![clientsreportopen](https://user-images.githubusercontent.com/896472/32426508-82157466-c2c3-11e7-877f-009598a09204.PNG)
_Fig 2: Open Hidden Field_
@bors
Copy link
Contributor

bors bot commented Nov 16, 2017

Build succeeded

@bors bors bot merged commit caa8e1c into Third-Culture-Software:master Nov 16, 2017
@jniles jniles deleted the feat-bh-hidden-field-component branch November 17, 2017 06:37
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

Successfully merging this pull request may close these issues.

(Feature) Optional (important) field selection
2 participants