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

Fixed contact update after propertyGroup refactor #425

Merged
merged 3 commits into from Nov 6, 2017

Conversation

skjnldsv
Copy link
Member

@skjnldsv skjnldsv commented Nov 2, 2017

Signed-off-by: John Molakvoæ skjnldsv@protonmail.com

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
@skjnldsv skjnldsv added 2. developing Work in progress Hackweek regression Regression of a previous working feature labels Nov 2, 2017
@skjnldsv skjnldsv added this to the 2.0.2 milestone Nov 2, 2017
@skjnldsv skjnldsv self-assigned this Nov 2, 2017
@codecov
Copy link

codecov bot commented Nov 2, 2017

Codecov Report

Merging #425 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #425   +/-   ##
=======================================
  Coverage   16.62%   16.62%           
=======================================
  Files          61       61           
  Lines        1311     1311           
=======================================
  Hits          218      218           
  Misses       1093     1093
Impacted Files Coverage Δ
js/models/contact_model.js 38.38% <ø> (ø) ⬆️
...onents/contactDetails/contactDetails_controller.js 1.96% <ø> (+0.07%) ⬆️
...s/components/detailsItem/detailsItem_controller.js 1.42% <0%> (-0.05%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 892eccf...58828c1. Read the comment docs.

@@ -42,7 +42,7 @@
</div>
</header>
<section>
<propertyGroup ng-repeat="prop in ctrl.contact.props | toArray | orderDetailItems:'$key'" model="ctrl.contact" data="prop" name="prop.$key"></propertyGroup>
<propertyGroup ng-repeat="prop in ctrl.contact.props | toArray | orderDetailItems:'$key'" model="ctrl.contact" addressBook="ctrl.addressBook" data="prop" name="prop.$key"></propertyGroup>
Copy link
Member Author

Choose a reason for hiding this comment

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

@Henni this doesn't work and fails with a Error: [$compile:multidir]
Can you help?

Copy link
Member

Choose a reason for hiding this comment

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

Adding the attribute addressBook breaks this.
We have a directive which is called addressBook, so Angular doesn't know if it should now render the addressBook or the propertyGroup directive.
You have to choose a different attribute name.

@@ -8,6 +8,7 @@ angular.module('contactsApp')
name: '=',
data: '=',
contact: '=model',
addressBook: '=addressBook',
Copy link
Member

Choose a reason for hiding this comment

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

Just FYI this line is to specific: addressBook: '=' would suffice.
You only need to write something after the = if the attribute should be named differently to the controller variable.

<option ng-repeat="option in ctrl.availableOptions" value="{{option.id}}">{{option.name}}</option>
</select>
<button ng-click="ctrl.deleteField()" class="icon-delete" title="{{ctrl.t.delete}}" ng-if="!ctrl.model.addressBook.readOnly"></button>
<button ng-click="ctrl.deleteField()" class="icon-delete" title="{{ctrl.t.delete}}" ng-if="!ctrl.addressBook.readOnly"></button>
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest that we offer a readOnly property for contacts, which reflects the readOnly property of the addressbook.
This way we also don't have to pass the addressbook to the propertyGroup

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
@skjnldsv skjnldsv added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Nov 3, 2017
@skjnldsv
Copy link
Member Author

skjnldsv commented Nov 3, 2017

All clear! @irgendwie @Henni Please review! :)
cc @MorrisJobke @jancborchardt

@skjnldsv skjnldsv removed their assignment Nov 3, 2017
Copy link
Member

@irgendwie irgendwie left a comment

Choose a reason for hiding this comment

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

Code changes seem reasonable, every field update gets pushed to the server and read-only view is also working again! 👍

@MorrisJobke
Copy link
Member

Code changes seem reasonable, every field update gets pushed to the server and read-only view is also working again! 👍

Then merge it ;)

@irgendwie
Copy link
Member

@MorrisJobke Was waiting for another 👍 😉

@irgendwie irgendwie merged commit 005f607 into master Nov 6, 2017
@irgendwie irgendwie deleted the fix-contact-update branch November 6, 2017 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews regression Regression of a previous working feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants