Skip to content

Add a setting for assemblies to toggle the visibility of the organization chart#6040

Merged
microstudi merged 25 commits intodevelopfrom
5731
May 22, 2020
Merged

Add a setting for assemblies to toggle the visibility of the organization chart#6040
microstudi merged 25 commits intodevelopfrom
5731

Conversation

@anaghavl
Copy link
Copy Markdown
Contributor

@anaghavl anaghavl commented Apr 28, 2020

🎩 What? Why?

📌 Related Issues

📋 Subtasks

  • Add CHANGELOG entry
  • If there's a new public field, add it to GraphQL API
  • Add documentation regarding the feature
  • Add/modify seeds
  • Add tests
  • Another subtask

📷 Screenshots (optional)

Description
Screenshot 2020-05-01 at 2 22 46 AM
Screenshot 2020-05-01 at 2 22 29 AM
Screenshot 2020-05-01 at 2 22 15 AM

@anaghavl anaghavl changed the title WIP: Visibility of organization chart Visibility of organization chart May 5, 2020
@anaghavl anaghavl force-pushed the 5731 branch 2 times, most recently from cf75e6b to 7a81272 Compare May 8, 2020 11:39
@anaghavl anaghavl requested review from agustibr, leio10 and mrcasals May 8, 2020 18:09
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.

Code look good to me so far! Let's check what's going on eith the asets file 😄

@mrcasals mrcasals added the project: PAM2020 Barcelona City Council contract label May 11, 2020
Copy link
Copy Markdown
Contributor

@agustibr agustibr left a comment

Choose a reason for hiding this comment

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

great work! please check the comments 😃

module Assemblies
module Admin
# A command with all the business logic when updating assemblies
# settings in the system.
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.

As this command is performed from the /admin, not the /system, I suggest to change the doc to admin:

Suggested change
# settings in the system.
# settings in the admin area.

private

def current_assemblies_settings
@current_assemblies_settings = Decidim::AssembliesSetting.find_or_create_by!(decidim_organization_id: current_organization.id)
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.

Here I'd suggest to memoize, so the cached result is returned when the method is called the second time:

Suggested change
@current_assemblies_settings = Decidim::AssembliesSetting.find_or_create_by!(decidim_organization_id: current_organization.id)
@current_assemblies_settings ||= Decidim::AssembliesSetting.find_or_create_by!(decidim_organization_id: current_organization.id)

module Admin
# A form object used to create assembly setting from the admin dashboard.
class AssembliesSettingForm < Form
include TranslatableAttributes
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.

Not sure if TranslatableAttributes is needed as the attribute is Boolean, can you check it?

end

def current_assemblies_settings
@current_assemblies_settings = Decidim::AssembliesSetting.find_or_create_by(decidim_organization_id: current_organization.id)
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.

As commented in the other controller, I'd suggest to memoize this one also:

Suggested change
@current_assemblies_settings = Decidim::AssembliesSetting.find_or_create_by(decidim_organization_id: current_organization.id)
@current_assemblies_settings ||= Decidim::AssembliesSetting.find_or_create_by(decidim_organization_id: current_organization.id)

leio10
leio10 previously approved these changes May 11, 2020
Copy link
Copy Markdown
Contributor

@leio10 leio10 left a comment

Choose a reason for hiding this comment

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

Nice job! 🔝 👍

agustibr
agustibr previously approved these changes May 11, 2020
Copy link
Copy Markdown
Contributor

@agustibr agustibr left a comment

Choose a reason for hiding this comment

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

👍

mrcasals
mrcasals previously approved these changes May 11, 2020
@anaghavl
Copy link
Copy Markdown
Contributor Author

@decidim/core can you please review the PR?

leio10
leio10 previously approved these changes May 11, 2020
@anaghavl anaghavl dismissed stale reviews from leio10, mrcasals, and agustibr via 2693737 May 11, 2020 14:19
@mrcasals
Copy link
Copy Markdown
Contributor

@decidim/core this has been approved by @decidim/product, can you review it please? 😄

@microstudi microstudi self-requested a review May 20, 2020 21:23
@microstudi microstudi changed the title Visibility of organization chart Add a setting for assemblies to toggle the visibility of the organization chart May 21, 2020
Copy link
Copy Markdown
Contributor

@microstudi microstudi left a comment

Choose a reason for hiding this comment

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

Hi @anaghavl the code looks good to me.
I have only some concerns regarding the semantics of the words used in classes and methods.

I think we should use the concept "assembly settings" instead of "assemblies setting". I think that because these are setting that apply to each assembly independently (which is different that assemblies_types for instance).

What do you think, do you agree?

@@ -1,2 +1,3 @@
//= link_directory ../images/decidim/assemblies
//= link_directory ../javascripts/decidim/assemblies
//= require decidim/assemblies/orgchart.js
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.

Is this necessary? shouldn't the previous line include it automatically?

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.

yes, that makes sense. Removed.

@microstudi
Copy link
Copy Markdown
Contributor

@anaghavl if you can check that line in the manifest and resolve conflicts, we're done here. Thanks!

@microstudi microstudi merged commit dbfe19f into develop May 22, 2020
@microstudi microstudi deleted the 5731 branch May 22, 2020 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in-review project: PAM2020 Barcelona City Council contract

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Visibility of the organization chart

5 participants