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

Add a 'in cooperation with' field to site submissions #120

Closed
wants to merge 6 commits into from

Conversation

thijskramer
Copy link
Contributor

@thijskramer thijskramer commented May 4, 2018

This feature adds an 'in cooperation with' field to site submissions, so that is possible to provide a 'partner' that co-developed on a project.

It looks like this in the admin:

screen shot 2018-05-04 at 14 40 23

Which renders on the website like this:
screen shot 2018-05-04 at 14 37 44

And on a company page, all sites the company co-developed on are shown as well:
screen shot 2018-05-04 at 14 38 02

@maartenkling
Copy link

@mojeto Any change to review this PR?

@mojeto mojeto requested review from mojeto and loicteixeira May 8, 2018 22:35
@mojeto
Copy link
Contributor

mojeto commented May 8, 2018

Hi @maartenkling, thank you for the PR. Last few days were busy for me. I'll do a proper review sometime later this week. Stay tuned and sorry for delay.

Copy link
Contributor

@loicteixeira loicteixeira left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution 🎉

The code looks good and I was about to just hit approve but remembered about the configurable site ordering (see comments).

Also, contributions aren't taken into account for sites/children count which is used in several places:

  • Within the map markers on the developers index page (see javascript, page context and api)
  • To order the developers below the map (see [template][map-tpl] and python)

Although to be fair, we can see there already are some comment indicating that the count my be off so this can probably be tackled in a separate PR.

@@ -3,10 +3,13 @@
from operator import itemgetter

from bs4 import BeautifulSoup
from core import panels
from core.forms import SubmitFormBuilder
from core.utilities import has_recaptcha, validate_only_one_instance
Copy link
Contributor

@loicteixeira loicteixeira May 14, 2018

Choose a reason for hiding this comment

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

Those imports should stay where they were as it is enforced by isort.

I'm not sure why the CI didn't run on this PR. If it still doesn't run on next commit, you can run make lint-py from within the Vagrant box to verify that it's all good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Allright I'll revert that change.

pages = self.children()
pages = WagtailSitePage.objects.filter(
Q(path__startswith=self.path) | Q(in_cooperation_with=self)
).distinct()
Copy link
Contributor

@loicteixeira loicteixeira May 14, 2018

Choose a reason for hiding this comment

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

This is losing the custom ordering defined in the children method (controlled in the admin via the sites_ordering field).

It should be possible to re-add the ordering without much issue for the alphabetical and created options. However it might be problematic for the path option as it was meant to allow manual ordering of pages but you won't be able to control the contributions (i.e. site not owned directly) would all appear either first or last (depending on whether the other developer profile was created before or after yours). Any ideas?

Copy link
Contributor Author

@thijskramer thijskramer May 25, 2018

Choose a reason for hiding this comment

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

Maybe I can add an option to a CompanyPage, whether to 'mix' the cooperations with self-developed sites, or show cooperations separately from developed sites.
When the sorting preference is 'alphabetical' or 'created', the option can be applied on the separate queries / whole query.
When the sorting preference is 'path (manual)', maybe always show the self-developed sites (manually ordered) first, and then the cooperations (ordered by creation_date) after that?

Copy link
Contributor

Choose a reason for hiding this comment

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

While adding an additional option would indeed help covering all the use-cases, I would rather keep it simple for now (until we have a need for more control):

  • alphabetical: order all sites together by title
  • created: order all sites together by first_published_at
  • path: order all self-developed sites by path first, then all cooperations sites by path

How does that sound?

@loicteixeira
Copy link
Contributor

Continuing work in #125. Thanks @thijskramer and @maartenkling.

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.

4 participants