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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide participatory space link from menu if no element is published #2074

Merged
merged 4 commits into from
Oct 20, 2017

Conversation

mrcasals
Copy link
Contributor

馃帺 What? Why?

This PR hides the link to the spaces engine from the main menu if no element from that space is published. This means that if there are no published assemblies, there will be no link to the engine.

馃搶 Related Issues

馃摲 Screenshots (optional)

http://recordit.co/EGYedzRDvr
Description

@mrcasals mrcasals self-assigned this Oct 19, 2017
@mrcasals mrcasals force-pushed the spaces/hide-link-from-menu-when-none-published branch from ec9d640 to 54d8add Compare October 19, 2017 09:58
@@ -55,6 +55,7 @@ class Engine < ::Rails::Engine
menu.item I18n.t("menu.assemblies", scope: "decidim"),
decidim_assemblies.assemblies_path,
position: 2.5,
if: Decidim::Assembly.published.any?,
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be scoped to the current organization?

@@ -57,6 +57,7 @@ class Engine < ::Rails::Engine
menu.item I18n.t("menu.processes", scope: "decidim"),
decidim_participatory_processes.participatory_processes_path,
position: 2,
if: Decidim::ParticipatoryProcess.published.any?,
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto

@mrcasals mrcasals force-pushed the spaces/hide-link-from-menu-when-none-published branch from 54d8add to d23262a Compare October 19, 2017 10:10
@codecov
Copy link

codecov bot commented Oct 19, 2017

Codecov Report

Merging #2074 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #2074      +/-   ##
==========================================
+ Coverage   98.55%   98.56%   +<.01%     
==========================================
  Files        1174     1174              
  Lines       26760    26766       +6     
==========================================
+ Hits        26373    26381       +8     
+ Misses        387      385       -2

@mrcasals
Copy link
Contributor Author

mrcasals commented Oct 19, 2017

@oriolgual solved! I've also added tests for the case you pointed out.

oriolgual
oriolgual previously approved these changes Oct 19, 2017
Copy link
Contributor

@josepjaume josepjaume left a comment

Choose a reason for hiding this comment

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

Nice! If that's the case, I'd remove all the handling of empty collection views (including locales) as well.

@mrcasals mrcasals changed the title Hide space link from menu if no element is published Hide participatory space link from menu if no element is published Oct 19, 2017
@mrcasals mrcasals force-pushed the spaces/hide-link-from-menu-when-none-published branch from d23262a to eaf8b77 Compare October 19, 2017 13:09
josepjaume
josepjaume previously approved these changes Oct 19, 2017
@mrcasals mrcasals force-pushed the spaces/hide-link-from-menu-when-none-published branch from c3bdf10 to dfcc081 Compare October 20, 2017 09:32
@mrcasals mrcasals merged commit 123ae9d into master Oct 20, 2017
@ghost ghost removed the in-review label Oct 20, 2017
@mrcasals mrcasals deleted the spaces/hide-link-from-menu-when-none-published branch October 20, 2017 12:18
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.

None yet

3 participants