Redesign / Introduce concern to pick redesign layouts when activate#9229
Redesign / Introduce concern to pick redesign layouts when activate#9229
Conversation
61b6e7a to
7979d75
Compare
ee73106 to
6f44b36
Compare
1f91262 to
b0c45d3
Compare
decidim-admin/app/controllers/decidim/admin/application_controller.rb
Outdated
Show resolved
Hide resolved
decidim-assemblies/app/controllers/decidim/assemblies/assemblies_controller.rb
Outdated
Show resolved
Hide resolved
decidim-assemblies/app/views/layouts/decidim/redesigned_assembly.html.erb
Outdated
Show resolved
Hide resolved
decidim-core/app/views/layouts/decidim/redesigned_application.html.erb
Outdated
Show resolved
Hide resolved
decidim-meetings/app/packs/stylesheets/decidim/meetings/_redesigned_meetings.scss
Outdated
Show resolved
Hide resolved
92a1067 to
d588534
Compare
|
@decidim/maintainers this is ready to review. We'd like this to be merged in develop to simplify further development of the redesign features |
94e04d5 to
2b0e23a
Compare
b62877f to
22a676b
Compare
aaea092 to
a8c43ad
Compare
|
@ferblape @Crashillo @furilo I just merged #9340 into this branch. Can you please fix the conflicts, mark this ready and I'll merge this into develop? We agreed today that we are going to merge these blocking PRs first and then handle the issues from the review separately. |
|
Hi, @ahukkanen, now is ready for review after last updates |
ahukkanen
left a comment
There was a problem hiding this comment.
I have checked this through and left some new comments along with the comments I provided at #9340 which lists the major issues I noticed during testing it in action.
I've had another go and also left few comments regarding some lines of code.
As agreed, I will merge this for now and leave the comments open for your review for the upcoming PRs.
| paginate collection, theme: "decidim", params: paginate_params | ||
| return if collection.total_pages == 1 | ||
|
|
||
| content_tag :div, class: "flex flex-col-reverse md:flex-row items-center justify-between gap-1 py-8 md:py-16", data: { pagination: "" } do |
There was a problem hiding this comment.
I would rather see this in a cell/partial in order to make customization easier.
| @@ -0,0 +1,13 @@ | |||
| /** | |||
| * Handler to allow ONLY ONE dropdown (details HTML tag) open at once. | |||
| @@ -0,0 +1,32 @@ | |||
| import icon from "src/decidim/icon" | |||
|
|
|||
| export default class ExternalLink { | |||
There was a problem hiding this comment.
With this I believe we are losing one useful feature of the current external link elements, i.e. configuring the target element within the link for the external link. This is highly useful when e.g. the whole card is a link (as it generally should be and as it is in some customized instances), to be able to put the external link indicator anywhere within the card.
| @apply bg-tertiary text-white; | ||
| } | ||
|
|
||
| &.white{ |
| remote: data-remote -%> | ||
| <li class="page<%= " current" if page.current? %>"<%== ' aria-current="page"' if page.current? %>> | ||
| <%= link_to_unless page.current?, page, url, { remote: remote, rel: page.rel, title: t("views.pagination.title") << page.to_s } %> | ||
| <li class="w-6 h-6 rounded-full hover:bg-background-3 transition<%= "mx-2 bg-background-3 grid place-items-center" if page.current? %>" <%== 'aria-current="page"' if page.current? %> data-page> |
| allow(controller).to receive(:current_user).and_return(user) | ||
| allow(controller).to receive(:redesign_enabled?).and_return(redesign_enabled) | ||
| # rubocop:disable RSpec/AnyInstance | ||
| allow_any_instance_of(ActionView::Base).to receive(:redesign_enabled?).and_return(redesign_enabled) |
There was a problem hiding this comment.
Could we move this to a shared context that is included in the target spec as this seems to be repeated across multiple specs?
|
|
||
| before do | ||
| # rubocop:disable RSpec/AnyInstance | ||
| allow_any_instance_of(ActionView::Base).to receive(:redesign_enabled?).and_return(redesign_enabled) |
There was a problem hiding this comment.
Could we move this to a shared context that is included in the target spec as this seems to be repeated across multiple specs?
|
|
||
| before do | ||
| # rubocop:disable RSpec/AnyInstance | ||
| allow_any_instance_of(ActionView::Base).to receive(:redesign_enabled?).and_return(redesign_enabled) |
There was a problem hiding this comment.
Could we move this to a shared context that is included in the target spec as this seems to be repeated across multiple specs?
|
|
||
| before do | ||
| # rubocop:disable RSpec/AnyInstance | ||
| allow_any_instance_of(ActionView::Base).to receive(:redesign_enabled?).and_return(redesign_enabled) |
There was a problem hiding this comment.
Could we move this to a shared context that is included in the target spec as this seems to be repeated across multiple specs?
| # A controller that holds the logic to show Assemblies in a public layout. | ||
| class AssembliesController < Decidim::Assemblies::ApplicationController | ||
| include ParticipatorySpaceContext | ||
|
|
There was a problem hiding this comment.
I would avoid changing files unless it is necessary. Here you probably did some changes at first and then reverted the changes which caused this issue but if you revert stuff, revert back to the original in the future please. 🙏
…ecidim#9229) * Add RedesignLayout concern * Include redesign layout in some controllers * Improve RedesignLayout concern * Add new entrypoint for redesigned decidim_core and use it in dedesigned layout * Enable redesign in homepage controller * Add task to create redesigned entrypoints * Test redesigned scss partial * Test imports of redesigned scss from js entrypoints * Create a redesigned_app group and a specific method to import scss partials * Add task to create redesigned entrypoints * Create a redesigned_app group and a specific method to import scss partials * Improve redesign_entrypoint task to register also scss partials * Redesigned layotu calls redesign CSS packs * Allow cells to use redesigned versions if redesign is enabled in controller and redesigned cell exists * Test redesigned cells in meetings author * Add some redesign helper methods * Delegate some redesign methods on controller on cells * Add some redesign helper methods * include redesign concern in admin controllers with feature disabled * Add redesign layout to devise controllers concern * Disable redesign in all controllers * Disable redesign explicitly in assemblies controller to avoid redesign_participatory_space_layout default behavior * Fix tests * Define a redesign_active Decidim setting and take its value from an environment variable * Remove duplicated line * Use redesign_active initializer setting in redesign concern and use a class variable With a class variable the setting can be inherited by controllers and ovewritten if required with a redesign active: true/false * Remove no longer required redesign_defined? method * Revert redesign in assemblies participatory space * Don't disable redesign in main application controller * Remove testing text * Revert redesign in meetings stylesheets assets * Disable rubocop Style/ClassVars in redesign layout * Move javascript to footer * Load redesigned app styles in redesigned stylesheet * Redesign: Install tailwind (decidim#9274) * [skip ci] testing commit * testing files * Copy tailwind configuration * clean files to run tailwind * remove the package-locks references * restore default import to override * Fix decidim gem path in tailwind configuration * testing files * Remove not required file * Update package-lock * Fix quotes * Update package-lock design app * Update plugin order * Simplify plugins * Fix import order * Define paths that don't include packs/ folder to prevent infinite loops * Revert "Simplify plugins" This reverts commit 1d53c00. * Load node_modules styles with JS * JS offense * CSS offense * Detailed configuration * Use explicit list of paths Avoid using the star in the paths to prevent infinite loops * Add clarification * Remove package-lock file Co-authored-by: Eduardo Martinez Echevarria <eduardomech@gmail.com> Co-authored-by: Fernando Blat <fernando@blat.es> * Revert definition of @@enable_redesign class variable and use an instance variable * Enable redesign by default * Fix redesigned cell name detection * Redesign: main layout, header & footer (decidim#9340) * [skip ci] testing commit * testing files * clean files to run tailwind * remove the package-locks references * Fix decidim gem path in tailwind configuration * testing files * Remove not required file * Fix import order * Load node_modules styles with JS * Use explicit list of paths Avoid using the star in the paths to prevent infinite loops * clean files to run tailwind * typography * add colors & update typography * add new icons support * header desktop-mobile & css toggler * easier legacy css toggler * footer response new desgins * a11y issues * refactor external link js * tailwind config in ERB & fix external_link position * add fonts in new design * buttons component * [skip ci] button hover * first dropdown * position dropdown * sort files into more descriptive folders * second dropdown * [skip ci] second dropdown tablet/mobile * [skip ci] rearrage files * fix header links variants (desktop/mobile) * [skip ci] overlaps among dropdowns * [skip ci] tailwind dropdown component * [skip ci] restore files * most accurate naming * Import ExternalLink from redesigned version * Update selector in tests * Fix external_link test * Remove package-lock from packages * Remove duplicated tailwind config * Enable redesign for main layout * Fix some tests related with icons * Fix some elections tests related with icons * Recover yield in redesigned wrapper * Recover detection of redesign in icon method * Define redesign_enabled? on menu_helper test * Revert "Fix some elections tests related with icons" This reverts commit 09de3dc. * Fix tests to take into account redesign_enabled? * Fix tests to take into account redesign_enabled? * fix stylelint * fix erblint * Disable completely redesign in admin section * fix footer glitches * enhacement decidim paginate * pagination * results per page & some generalizations turn into specifications * fix pagination * two-columns layout * one column layout + decorator * button should be an inline element * update the real tailwind config file * replace status with colors (to match tailwind classes) * label component * fix gray colors tailwind * fix footer color (unique) * Fix translation * fix stylelint * Hide results_per_page if there is only one page * Hide pagination if there is only one page * Add some identifiers to pagination elements * Fix pagination shared examples * new tailwind color setup * update classes accordingly new setup * replace old css classes * Remove unused translations * Increase default per page in pagination on some tests with filters * Fix some pagination tests * Fix default per_page test * Include LayoutHelper in some cells using icon * Fix pagination tests * Fix cell test * Fix pagination test * fix erblint * fix stylelint * fix a11y * fix bug on existing avatar * Add admin dashboard link to main links dropdown * Add URLs to main links in header * Fix path * Fix dropdown * add layout * responsive layout Co-authored-by: Eduardo Martinez Echevarria <eduardomech@gmail.com> Co-authored-by: Fernando Blat <fernando@blat.es> * Replace TODOs * fix center layout fallback only children * Fix test providing redesign_enabled? method * alter tailwind setup * typo * common forms styling * fix lint offenses * Fix links in redesigned_main_links_dropdown Co-authored-by: Eduardo Martinez Echevarria <eduardomech@gmail.com> Co-authored-by: Hugoren Martinako <aumpfbahn@gmail.com>
This PR is the base branch where the redesign is integrated. It could be understood as the
developbranch of the redesign process.Read more about the redesign in this page for contributors
The changes happening in this branch are described below:
How to enable redesign
By default the use of redesign files is disabled, even if they are expressly activated from a controller. To allow the use of these files there must be an environment variable named
DECIDIM_REDESIGN_ACTIVEset totrueor this value can be set directly in the application using Decidim inconfig/initializers/decidim.rbreplacing the existing line:with:
New redesign layout
A new layout with a couple of new partials has been created at
decidim-core/app/views/layouts/decidim/redesigned_application.html.erb(for the moment just two partials because it's a proof of concept).The convention we're following is that the new files will be prefixed with
redesigned_, so at the end of the redesign it'll be easy to identify these files and remove the preffx from them.This new layout references to the new JS and CSS packs.
Redesign javascript packs
This new pack
decidim-core/app/packs/entrypoints/redesigned_decidim_core.jsis just a copy of the existingdecidim_core.jsand references the same files. We'll be creating theredesigned_version of the js files only when it's necessary, while the idea is to continue working with the existing files.Redesign CSS packs
Same as for javascript, a new pack has been created at
decidim-core/app/packs/stylesheets/decidim/redesigned_application.scssWhile in JS we expect few changes, in CSS almost every file is going to change, so we expect to have a lot of
redesigned_*.cssfiles.Redesign concern
A new concern has been created to activate the new layout in a controller, just by adding it to the application controller file of the engine (there are some things to have into consideration for some engines such as participatory spaces, which have an special layout but we'll tackle later).
You can see an example at
decidim-core/app/controllers/decidim/homepage_controller.rbRename task
A WIP rake task is being developed to automate the final file renaming. The idea behind this task is prevent any human error in the process of moving all the redesign templates, styles and javascripts to the original names.