-
Notifications
You must be signed in to change notification settings - Fork 90
About modal directive and unit tests #299
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
About modal directive and unit tests #299
Conversation
@jeff-phillips-18 @dtaylor113 please take a look. |
transclude: true, | ||
controller: ['$scope', '$modal', '$transclude', function ($scope, $modal, $transclude) { | ||
// watching isOpen attribute to dispay modal when needed | ||
$scope.$watch( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to put $watch calls in the link function so that it is executed after the compile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm...I thought $watch goes in controller, and $observe goes in the link function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to be in link so that it occurs after compilation.
Could we add the capability to add list of product/versions to aid with their display? In the simplest case this would require not additional html by the application. |
LGTM. Appreciate the screenshot in the PR :-) |
Thanks for the comments. @jeff-phillips-18 In regard to product/versions, I'm not quite sure what you're looking for? |
I'm thinking an array of objects containing productTitle and productVersion fields. Then the directive could iterate over them and display them appropriately saving the app from having to transclude some built up html. |
So, get rid of the transclude? I used this thinking this would be a customizable area. Although, I didn't get any mockups. I'll check with @leslie to see if this area needs to customizable. Otherwise, I'll replace the transclude with an array. |
I would leave the transclude for the case where an applications wants special text/formatting. Something like:
|
I was just thinking we can keep the transclude. Thanks for the code! |
1668ef7
to
cff2817
Compare
I updated the watch and added support for an array of objects containing product title and version info. I also added support for a two column layout (i.e., for an array length > 4) per the design spec. The transclude was left in place for custom layouts. FYI, the two column layout depends on patternfly/patternfly/pull/428. @jeff-phillips-18 please review/merge. |
I'm not sure why the two column layout is necessary. I think it should be left as a single column as the version info may be long. Actually, thinking about it now, I'm not sure product/version is the correct terminology (sorry my bad). We should probably call in name/value since it is likely products will list more than just products and versions (ManageIQ for instance lists server name, username, browser OS, etc). The additional info could just be a paragraph of text explaining or expanding upon the version or copyright. So, I'm thinking more along the lines of: |
cff2817
to
9711084
Compare
@jeff-phillips-18 Regarding the two columns, I was following the design document which described the layout with a couple statements and showed screenshots. However, after speaking with @LHinson, she agreed it should have been one column and the design doc is incorrect. That said, I've made the name/value changes and added an additionalInfo attribute. The custom example now mimics the screen shot you provided above. All good feedback -- thanks! |
9711084
to
0e6fb83
Compare
LGTM |
PTNFLY-1011 About Screen - AngularJS
The pfAboutModal directive wraps UI Bootstrap’s modal, which (as is) only supports either template or templateUrl as a way to specify the content. When content is retrieved, it is compiled and linked against the provided scope by the $modal service. Unfortunately, there is no way to provide transclusion there.
The solution for pfAboutModal embeds a placeholder directive (i.e., pfAboutModalTransclude) to append the transcluded DOM. The transcluded DOM is from a different location than the modal, so it needs to be handed over to the placeholder directive.