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

209 & 1349 - Permit CMS pages & news to have participation layout #1334

Merged
merged 14 commits into from
Jan 25, 2018

Conversation

amiedes
Copy link
Contributor

@amiedes amiedes commented Jan 15, 2018

Closes #209
Closes #1349

What does this PR do?

  • Splits controllers for app/controllers/gobierto_participation/pages_controller.rb and app/controllers/gobierto_participation/news_controller.rb, so now pages belonging to participation module can be routed to this controller and inherit the participation layout.
  • Fixes the scope of a uniqueness validation in app/models/gobierto_common/collection.rb, container_id should be scope in site.
  • Fixes the name of the app/views/gobierto_cms/templates/_new.html.erb partial. Should be _news. This was causing some exceptions.

How should this be manually tested?

I've done the following testing, but feel free to test other flows:

Doubts

I have doubts about the collection of pages Alvaro mentions in the issue (http:https://newalcobendas.gobify.net/paginas/acerca-de), since now it still has the normal layout. I understand the current behavior is the right one, since the collection is scoped on the site, not participation.

Future work

I think there's a good opportunity for refactor in the methods in app/models/gobierto_cms/page.rb that retrieve pages from a colleciton, module, site etc. Since refactoring this spans to many other files, I've limited myself to adding a few clarifying comments before the methods.

Does this PR changes any configuration file?

No

@furilo
Copy link
Member

furilo commented Jan 15, 2018

I've created a page collection inside a process, and get this error when trying to view the collection:

NoMethodError in GobiertoAdmin::GobiertoParticipation::Processes::ProcessPagesController#index
undefined method `news_in_collection' for nil:NilClass

@codecov-io
Copy link

codecov-io commented Jan 16, 2018

Codecov Report

Merging #1334 into master will decrease coverage by 0.13%.
The diff coverage is 64.91%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1334      +/-   ##
==========================================
- Coverage   77.55%   77.42%   -0.14%     
==========================================
  Files         490      491       +1     
  Lines       13039    13072      +33     
==========================================
+ Hits        10113    10121       +8     
- Misses       2926     2951      +25
Impacted Files Coverage Δ
app/models/gobierto_participation/process_stage.rb 68.23% <ø> (ø) ⬆️
...to_admin/gobierto_common/collections_controller.rb 87.35% <ø> (+0.83%) ⬆️
...rollers/gobierto_participation/pages_controller.rb 0% <0%> (-72%) ⬇️
...bierto_participation/processes/pages_controller.rb 90% <100%> (ø) ⬆️
...llers/gobierto_participation/welcome_controller.rb 100% <100%> (ø) ⬆️
app/models/gobierto_participation/process.rb 88.31% <100%> (+0.31%) ⬆️
app/controllers/application_controller.rb 92.42% <100%> (+0.11%) ⬆️
app/models/gobierto_common/collection.rb 89.79% <100%> (+0.21%) ⬆️
app/models/gobierto_cms/page.rb 77.55% <43.47%> (-7.64%) ⬇️
...trollers/gobierto_participation/news_controller.rb 75% <75%> (ø)
... and 3 more

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 800773d...59a9d1c. Read the comment docs.

…ages

* When dealing with process pages (not news), instead of redirecting to
admin process news view, use the default collection view we're using
for site and modules.
* When editing a process page (not news), show the default admin cms
edit menu, without process-specific breadcrumb.
 Conflicts:
	app/models/gobierto_common/collection.rb
	app/views/gobierto_participation/processes/pages/show.html.erb
@amiedes
Copy link
Contributor Author

amiedes commented Jan 18, 2018

I've done the following changes:

  • When listing pages in the admin from participation pages collection or a process pages collection, use the default list view we're using for showing a collection of pages.
  • When editing from the admin pages belonging to participation pages collection or a process pages collection, use the default edit view we're using for editing CMS pages instead of showing the breadcrumb used for editing news.
  • When showing in the front a page belonging to a process, use the same controller and views used for news (::GobiertoParticipation::Process::PagesController), but hide the left column which is shown for news. *1

*1 As discused with @apradillap and @ferblape, given that making a separate controller for pages and news in this case implies lots of renaming, and that #932 will be implemented, we will temporarily access process pages under the /noticias URL.

@amiedes amiedes added the wip label Jan 18, 2018
@amiedes amiedes changed the title 209 - Permit CMS pages & news to have participation layout 209 & 1349 - Permit CMS pages & news to have participation layout Jan 19, 2018
@amiedes amiedes removed the wip label Jan 19, 2018
@amiedes
Copy link
Contributor Author

amiedes commented Jan 19, 2018

Closes also #1349. This is ready.

@ferblape
Copy link
Member

@amiedes which is the difference between the page Alvaro created (http:https://newalcobendas.gobify.net/paginas/acerca-de) and yours (http:https://newalcobendas.gobify.net/participacion/paginas/pagina-estatica-participacion) ??

They look different

@ferblape ferblape merged commit 5904c29 into master Jan 25, 2018
@ferblape ferblape deleted the 209-fix-nav-menu branch January 25, 2018 16:51
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

4 participants