Skip to content

Conferences related to other spaces#4339

Merged
mrcasals merged 8 commits intomasterfrom
conferences_related_to_other_spaces
Oct 25, 2018
Merged

Conferences related to other spaces#4339
mrcasals merged 8 commits intomasterfrom
conferences_related_to_other_spaces

Conversation

@isaacmg410
Copy link
Copy Markdown
Contributor

@isaacmg410 isaacmg410 commented Oct 23, 2018

🎩 What? Why?

This PR adds the Relationship with other spaces. Each Conference-page should potentially be related to participatory processes, consultations and assemblies.

📌 Related Issues

📋 Subtasks

  • Add CHANGELOG entry
  • Related with participatory processes
  • Related with consultations
  • Related with Assemblies
  • Add tests

📷 Screenshots (optional)

Description
screenshot-localhost-3000-2018 10 23-10-24-20
screenshot-localhost-3000-2018 10 23-10-24-34
screenshot-localhost-3000-2018 10 23-10-24-43

@ghost ghost assigned isaacmg410 Oct 23, 2018
@ghost ghost added the status: WIP label Oct 23, 2018
@isaacmg410
Copy link
Copy Markdown
Contributor Author

@decidim/lot-px @decidim/product Can you review the screenshots attached to the description ti see if the design of the related spaces is correct? If it is not, we need the design soon...

module ConferencesHelper
include Decidim::ResourceHelper

def participatory_processes_for_conference(conference_participatory_processes)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Move these new methods to cells


<%= attachments_for current_participatory_space %>

<%= participatory_processes_for_conference(conference_participatory_processes) if conference_participatory_processes.present? %>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use the new cells here

@carolromero
Copy link
Copy Markdown
Member

@decidim/lot-px @decidim/product Can you review the screenshots attached to the description ti see if the design of the related spaces is correct? If it is not, we need the design soon...

@isaacmg410 it is fine

@isaacmg410 isaacmg410 force-pushed the conferences_related_to_other_spaces branch 2 times, most recently from b5215a3 to 445b7ca Compare October 23, 2018 13:14
@isaacmg410
Copy link
Copy Markdown
Contributor Author

@mrcasals requested changes applied 😄

@ghost ghost added the status: WIP label Oct 23, 2018
@ghost ghost added the status: WIP label Oct 23, 2018
@isaacmg410
Copy link
Copy Markdown
Contributor Author

@decidim/lot-core ready to be merged 😄

Copy link
Copy Markdown
Contributor

@mrcasals mrcasals left a comment

Choose a reason for hiding this comment

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

The current solution is linked to processes/assemblies/consultations. There's no way to use external participatory spaces, which I think would be nice.

Also, why not include initiatives here too? 😕


module Decidim
module Conferences
# This cell renders the participatory spaces card for an instance of a Participatory Space
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These docs seem wrong, as reading this it seems it receives a single participatory space as model, but it in fact receives a collection of participatory spaces. Can you add a line explaining this please? 😄

def consultations(conference)
@consultations ||= conference.participatory_space_sibling_scope(:consultations)
.includes(:consultation)
.where(decidim_consultation_id: @form.consultations_ids)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure about this, since it implies it knows a lot about how consultations work internally 😕

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

when you make conference.participatory_space_sibling_scope(:consultations) it returns questions. The Consultations module says that Question is a participatory space 😕

)
end

def participatory_processes(conference)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No need to pass conference around as a parameter, you have access to it globally already.

.perform_later(@conference.id, checksum)
end

def participatory_processes(conference)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same, remove the param

def consultations(conference)
@consultations ||= conference.participatory_space_sibling_scope(:consultations)
.includes(:consultation)
.where(decidim_consultation_id: @form.consultations_ids)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same problem, I think we know too much about how consultations work. What happens if the app doesn't have decidim-consultations? It's an optional gem, and it's not bundled with decidim metagem 😕

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So the principal concern here is: why can't you use a simple where(id: @form.consultation_ids) here? Why all these includes and collects?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is more or less what I say before. The Participatory Space in Consultations mdoule is Question. FI we need to related Conference with Consultation we need to do something like that

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Although I agree it's weird, both Consultations and Questions are participatory spaces, how come if you ask for consultations you get questions?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The issue seems to be here:

https://github.com/decidim/decidim/blob/master/decidim-consultations/lib/decidim/consultations/participatory_space.rb#L3-L27

I don't know why questions are the space and consultations the resource.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What happens if you change the model_class_name to Consultation @isaacmg410?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will many things break up? Then we will change the register_resource to Question?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm going to try it at my machine.

Copy link
Copy Markdown
Contributor

@oriolgual oriolgual Oct 24, 2018

Choose a reason for hiding this comment

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

I changed:

participatory_space.model_class_name = "Decidim::Consultations::Question"

To

participatory_space.model_class_name = "Decidim::Consultation"

And

Decidim::Consultations::Question.where(organization: organization)

To

Decidim::Consultation.where(organization: organization)

At
https://github.com/decidim/decidim/blob/master/decidim-consultations/lib/decidim/consultations/participatory_space.rb

And all tests pass and the navigation seems to work OK. Now conference.participatory_space_sibling_scope(:consultations) returns consultations as expected.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I will try also, and if all is okey. Go for it?

end

def conference_consultations
@conference_consultations ||= @current_participatory_space.linked_participatory_space_resources("Consultation", "included_consultations")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why are you using a String here instead of a Symbol?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

because if I use a symbol :consultations it returns a Question

end

def consultations_for_select
@consultations_for_select ||= Decidim.find_participatory_space_manifest(:consultations)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same, what happens with this collect if decidim-consultations is not installed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The same as I said before

include Decidim::ResourceHelper

def participatory_spaces_for_conference(conference_participatory_spaces)
cell("decidim/conferences/participatory_spaces", conference_participatory_spaces)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you can safely replace the method call with the cell "blabla" one, so we can remove this whole file

@stats ||= ConferenceStatsPresenter.new(conference: current_participatory_space)
end

def conference_participatory_processes
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This logic could be wrapped in cells too. Those cells can render ParticipatorySpacesCell directly.

What do you think about this?

@isaacmg410
Copy link
Copy Markdown
Contributor Author

@mrcasals

The current solution is linked to processes/assemblies/consultations. There's no way to use external participatory spaces, which I think would be nice.

Also, why not include initiatives here too? confused

How we can add here external participatory spaces?
The issue only says, processes, assemblies and consultations.

@isaacmg410 isaacmg410 force-pushed the conferences_related_to_other_spaces branch from bd923b6 to 317ff39 Compare October 24, 2018 09:36
@ghost ghost added the status: WIP label Oct 24, 2018
@isaacmg410 isaacmg410 force-pushed the conferences_related_to_other_spaces branch from 317ff39 to 3cfd22c Compare October 24, 2018 10:55
@isaacmg410
Copy link
Copy Markdown
Contributor Author

@decidim/lot-core, requested changes applied 😄

<%= participatory_spaces_for_conference(conference_assemblies) if conference_assemblies.present? %>
<%= participatory_spaces_for_conference(conference_consultations) if conference_consultations.present? %>
<%= cell("decidim/conferences/linked_participatory_spaces", current_participatory_space) %>
<%#= participatory_spaces_for_conference(conference_participatory_processes) if conference_participatory_processes.present? %>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you remove this commented code please? 😄

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done! Sorry man! 😃

@ghost ghost added the status: WIP label Oct 24, 2018
@isaacmg410
Copy link
Copy Markdown
Contributor Author

@decidim/lot-core all checks are green 😄 🎉

@mrcasals mrcasals merged commit f2a53ba into master Oct 25, 2018
@mrcasals mrcasals deleted the conferences_related_to_other_spaces branch October 25, 2018 07:11
@ghost ghost removed the status: WIP label Oct 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants