Skip to content

[RFC] Use cells to componentize the views (2nd take)#2897

Merged
mrcasals merged 87 commits intomasterfrom
cells-reloaded
May 3, 2018
Merged

[RFC] Use cells to componentize the views (2nd take)#2897
mrcasals merged 87 commits intomasterfrom
cells-reloaded

Conversation

@mrcasals
Copy link
Copy Markdown
Contributor

@mrcasals mrcasals commented Mar 3, 2018

This is a Request For Comments

🎩 What? Why?

This PR builds on top of #2521 by @josepjaume.

Basically this PR copies the commits from #2521, updates them to work with current master and reuses cells in some other places to show how to use them.

This work is done outside the work of @decidim/lot-core, and can serve as a basis for @decidim/lot-mods when they need to add cards to resources.

Since we'll have to add the idea of cards, and I wanted to have a real use case for this, I too added a simple Decidim::Proposals::ProposalMCell (naming is not the best, I know), you call it like this:

<%= cell "decidim/proposals/proposal_m", my_proposal %>

You'll see other changes in unrelated views too. Those are partials that are rendered from within the cell, and the cells don't have the context of the path, so I need to specify a full path for both partials and i18n strings. Also, when rendering partials from within the cell you need to add the .html suffix to the partial name, otherwise it won't be found.

While this is cumbersome, this means those partials can be extracted to their own cells, which is a better solution IMHO.

For the specific case of card versions, maybe we could create a ProposalCell that is rendered like this:

<%= cell "decidim/proposals/proposal", my_proposal, version: :m %>

And this ProposalCell knows how to render the :m version of the proposal. It would act as a delegator/presenter/facade, but we'd force it to be a cell. This pattern can be extracted to all resources, since all will have cards. See #2872 for a discussion what can be considered as a "resource". This delegator/presenter/facade cell can be specified within the ResourceManifest.

📌 Related Issues

📋 Subtasks

  • Add CHANGELOG entry
  • Allow conversations with user groups. In master, a conversation with a user group is actually a conversation with the user holding the user group, and it links to the user profile. this cells implementation does not have this, and does not show a conversation icon for user groups. My guess is that this can be added to the Decidim::UserPresenter and Decidim::UserGroupPresenter: add a conversation_with method that returns the user ID, and use it in the views

📷 Screenshots (optional)

None. My own visual checks say nothing has changed, apart from the missing conversation icon on user groups.

@mrcasals mrcasals self-assigned this Mar 3, 2018
@mrcasals
Copy link
Copy Markdown
Contributor Author

mrcasals commented Mar 3, 2018

@decidim/lot-core @decidim/lot-mods @decidim/developers I'd like some comments on this, since we have discussed adding cells lately on #2521, #2273 and #2591 for example.

If someone else has an alternate implementation of views with cells, create a PR and we can discuss both options! 😄

@deivid-rodriguez
Copy link
Copy Markdown
Contributor

@mrcasals I don't see the sample proposal cell you mentioned, only around users/authors... Is this something to be added later?

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 3, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@6dad250). Click here to learn what that means.
The diff coverage is 91.42%.

@@            Coverage Diff            @@
##             master    #2897   +/-   ##
=========================================
  Coverage          ?   88.78%           
=========================================
  Files             ?     1626           
  Lines             ?    38771           
  Branches          ?        0           
=========================================
  Hits              ?    34423           
  Misses            ?     4348           
  Partials          ?        0

@mrcasals
Copy link
Copy Markdown
Contributor Author

mrcasals commented Mar 3, 2018

@deivid-rodriguez I forgot to push it 😭 now it's there!

@josepjaume
Copy link
Copy Markdown
Contributor

josepjaume commented Mar 3, 2018 via email

@mrcasals
Copy link
Copy Markdown
Contributor Author

mrcasals commented Mar 5, 2018

OK, tests are failing. I want to note that cells don't have any test (that's the point where @josepjaume got stuck in the previous PR, he says)

@ghost ghost assigned agustibr Mar 5, 2018
end

def feature_settings
controller.feature_settings
Copy link
Copy Markdown
Contributor

@rbngzlv rbngzlv Mar 5, 2018

Choose a reason for hiding this comment

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

I have a question about calls similar to this. If this cell lives in decidim-proposals component, and I want to render it from outside it, e.g. a view_hook from decidim-participatory_processes, this will work?

This will not return the settings of the component/feature that is being visited instead the settings of the feature that the proposal belongs?

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.

@rbngzlv you're right, this is gonna use whatever feature_Settings returns from the current controller rendering the cell.

What if we pass an options hash when rendering the view so we can overwrite this?

def feature_settings
  options[:feature_setting] || controller.feature_settings
end

Copy link
Copy Markdown
Contributor

@agustibr agustibr Mar 5, 2018

Choose a reason for hiding this comment

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

so from the outside of decidim-proposals the cell call could be something like:

<%= cell("decidim/proposals/proposal", model, context: {controller: controller}) %>

as the controller is needed for: current_settings, feature_settings and action_authorization

refactoring what @mrcasals stated before:

def controller
  options[:controller] || controller
end

def feature_settings
  controller.feature_settings
end

do you agree @mrcasals ?

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.

We can access feature_settings from the model? Something like:

def feature_settings
  model.feature.settings
end

I understood that the purpose of cells was to be self-sufficient and not depend on the context at all.

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.

We can re-think it: settings are used to decide whether a button should appear, or some conditions are checked or not. The cells should not care about those settings, but should know if a button should be rendered or not. Options that come to mind:

  1. pass a hash with options, using some sane defaults. Cells render different things according to the values of this hash
  2. We have some "external" cell, and some "internal" cell. The external cell is how the cell should be rendered in other components, for example the search. When rendering a budget project, we don't want to add it to a non-existing cart from the search, for example, as the cart logic belongs exclusively to the budgets component. Internal cell would be the one budgets use to render a project inside the component, so it knows about the cart.
  3. A Combination of both: the internal cell receives a hash, the external cell renders the internal one setting the options automatically so we don't need to mess around from outside the component

@decidim/lot-core can you chime in?

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 agree with your proposal @mrcasals, specially option 3. I don't think is a good idea to allow carts to have all the actions in all the contexts (voting a proposal from the search results makes no sense to me), specially in the cases of budgets where there are technical issues that don't allow 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.

@mrcasals @oriolgual If you agree, in this first iteration, cards shown outside its context will link to the card (XL) details.

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.

@agustibr the XL card is the one we use in the show views? If so, then I'd make them default to the M size instead, as it's much more reusable and we're already working on moving the M cards to cells, AFAIK

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.

Yes @mrcasals I think the default should be M size, but i was talking about the link that appears in the footer of the M card

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.

Ah, I understand now, yeah go for it!

include Decidim::ResourceHelper
include Decidim::LayoutHelper
include Decidim::ApplicationHelper
include Decidim::ActionAuthorizationHelper
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 don't think we need all these helpers by default, I'd rather include them manually so we can track the dependencies of each cell

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.

But the Decidim::ResourceHelper will probably be used for most cards, or subCells such as CategoryCell
the rest of them I'll move to decidim/proposals/view_model

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.

👍


initializer "decidim_proposals.add_cells_view_paths" do
Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Proposals::Engine.root}/app/cells")
# Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Core::Engine.root}/app/cells") # for shared partials
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.

Check this commented line (remove it if it's not needed)

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.

removed, It's not needed since Decidim::Proposals::ViewModel < Decidim::ViewModel

it's in core

Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Core::Engine.root}/app/cells")

@@ -0,0 +1,8 @@
module Decidim
module Proposals
class ViewModel < Decidim::ViewModel
Copy link
Copy Markdown
Contributor Author

@mrcasals mrcasals Mar 6, 2018

Choose a reason for hiding this comment

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

Aw yeah 👏 💪

@mrcasals
Copy link
Copy Markdown
Contributor Author

@agustibr can you fix this lint error please? We're really close to merge it! 😄

@mrcasals
Copy link
Copy Markdown
Contributor Author

Actually, I'd wait until 0.11 is released to merge this PR, as it's a big change and I'd like it to run on development apps for a while before we release it 😄

@agustibr
Copy link
Copy Markdown
Contributor

@mrcasals I've fixed rubocop and erblint issues.
Yes If 0.11 is going to be released this week, it seems good to wait 🚏 .

@agustibr agustibr mentioned this pull request Apr 26, 2018
37 tasks
@xabier
Copy link
Copy Markdown

xabier commented May 2, 2018

how is this moving on?

@mrcasals
Copy link
Copy Markdown
Contributor Author

mrcasals commented May 2, 2018

@xabier we're waiting for the tests. Once they're green we'll merge the PR!

@agustibr
Copy link
Copy Markdown
Contributor

agustibr commented May 2, 2018

@decidim/lot-core All checks passed!

@mrcasals
Copy link
Copy Markdown
Contributor Author

mrcasals commented May 3, 2018

Oh my goodness

@mrcasals mrcasals merged commit 00914c8 into master May 3, 2018
@ghost ghost removed the status: WIP label May 3, 2018
@mrcasals mrcasals deleted the cells-reloaded branch May 3, 2018 07:25
@agustibr
Copy link
Copy Markdown
Contributor

agustibr commented May 3, 2018

Aw, Yeah Finally! ☺️ 🍻

tramuntanal added a commit that referenced this pull request May 5, 2018
* Fix migration (#3292)

* Search homepage (#3294)

* search boxes

* boxes stylish

* Change broken link on Getting started and add definition on checklist (#3303)

* Update link to checklist on getting_started.md

* update checklist.md

Add  definition of how the slug must be for the terms-and-conditions page to display it in the registration form.

* Fix codeclimate compliance

* Meetings management for minutes (#3213)

* [WIP] manage minutes

* wip working with admin_log

* fix log and add specs

* add changelog line and fix documentation

* add space before %> in html

* rename to minutes and add system specs

* add consultations into gemfile

* add admin specs for minutes

* change is_visible to visible and apply some other requested changes

* normalize en

* [FIX] Do not set the ajax endpoint to the member but to the collection (#3262)

* [FIX] Do not set the ajax endopont to the member but to the collection, so it can be used when creating.

* Changelog.

* Make linter happy.

* [TEST|REFACTOR] Extract capybara_data_picker.

* [WIP] Test.

* [TEST] Test proposals association in results CRUD.

* [TEST|REFACTOR] Apply renaming of capybara behaviour method.

* Rubocopify.

* [REFACTOR] Rename changed method name.

* [REFACTOR] Remove commented methods.

* Update README.md (#3298)

change reference to votes with reference to signatures

* Component permissions manifest (#3300)

* Try to keep our mental health

Naming these nested block variables with different names helps stay
mentally healthy.

* Indentation fix

* Remove unnecessary memoization

This is a private method called from a single place.

* Add a permission options manifest

* Change options when switching selected workflow

* Improve spec's readability

Foo was both the name of the authorized action and the name of the
option, that was confusing.

* Improve dummy authorization handlers

* Move them outside of decidim.
* Install them optional via the `--demo` option.
* Merge the "example" one with the "dummy" one. Their purpose was the
  same: explain the feature, so we merge both taking the best of each
  (docs + real working example).
* Add another dummy handler, so the "handler" selection features can be
  used on development applications by default.

* Allow optional permission settings

* Add changelog entry

* Add documentation

And also merge documentation for authorizations in a single place.

* Version bump

* new card meeting multiple dates (#3280)

* Dry CI config (#3258)

* Dry simple steps

* Dry steps with module names

* Rename processes step to match module name

* Use a glob pattern in paths lists

* Update design navigation (#3295)

* update provess-navigation

* update initiatives cards

* User profile (#3261)

* initial setup profile

* block profile card

* tabs control

* tabs title bar

* timeline

* edit card-widget

* generalize

* common width widget left item

* center icons

* rename tabs

* absolutes

* following/followers

* add inline filters to notifications

* inline filters minimal fix

* update links header

* rounded profile topbar

* dropdown styled

* notifications menu

* dropdown arrows

* fix typo

* restore login status

* member of, in user card profile

* icons changed

* fix form for erb linter (#3306)

* Introduce coauthorable concern and coauthorship model.

* Fix version format for npm (#3312)

* Privatize private method

* Make sure we only read file once

* Extract a private method

To try make the code explain itself.

* Add missing version check

We're now using `.dev` for development versions so we need to add this
check so that those are properly transformed into a semver compatible
string.

* Fix a couple of erblint offenses (#3311)

Probably crept in in a non rebased PR.

* Fix dev app's gemfile for external plugins (#3313)

* Correct optional gems location when generating app

Otherwise we get an error bundling it in external plugins since there's
no local folder in the final app:

```
The path `/path/to/decidim/development_app/decidim-consultations` does not exist
```

* Read gemspec only once

* Update ruby to version 2.5.1 (#3293)

* Update Gemfile.lock to update erb_lint to v 0.0.24

* fix erb_lint errors

* update to ruby 2.5.1

* Use ruby 2.5.1's docker image

* Update decidim-generators Gemfile.lock

* Update decidim_app-design Gemfile.lock

* Update decidim_app-design Gemfile.lock (2)

* [TEST] Add factory for coauthorsihps.

* [REFACTOR] Review Coauthorship (and its migration) foreign key definitions.

* [REFACTOR] Coauthorable asserts affect coauthorship instead of coauthorable, then it should be a spec instead of a shared_example.

* [RFC] Use cells to componentize the views (2nd take) (#2897)

* Introduce cells to componentize the UI

* Fix layout

* Update gems

* Fix layout

* Improve naming

* Add UserCell

* Render endorsers using cells

* Fix layout

* Improve naming and reuse cells

* Reuse AuthorBox cell

* Add Proposal M card cell

* Fix tests

* Refactor ViewModel, inheritance, autoload, move view_paths to engine

* use proposal_cell in participatory_processes/participatory_process_groups and participatory_spaces

* Refactor cell_proposal_m w/ action `footer` context aware.

* Replace partial `shared/tags` with `tags_cell`

* remove partial `shared/tags`

* move helper_methods from Decidim::ActionAuthorization to Decidim::ActionAuthorizationHelper

* added proposal header cell

* Replace partial `shared/author_reference` with `author_box` cell

* remove partial `shared/author_reference`

* Replace partial `proposal_badge` with `badge` cell

* remove partial `proposal_badge`

* move helpers to/from `ViewModel`s

* use content_tag in badge cell

* Proposal show use badge cell

* update Gemfile.lock

* fix formatting

* rename `feature` to `component`

* restore shared/tags partial for meetings

* fix Cell::ViewModel::Partial error in tests

* use cell badge in similar_proposal and proposal_embed

* remove locale unused keys

* fix single quotes erblint complaints

* removed unused i18n key

* Add card attr in proposal Manifest, add proposal cell, cell spec tests, refactor proposal_m_cell

* [wip] introduce card_for author

* Added author_cell spec

* removed unused locale key `view_proposal` from sortitions

* add Decidim::Debates::OfficialAuthorPresenter
to CardCell

* remove Devise::Controller::Helpers from Decidim:ViewModel

* fix erblint issues

* remove Devise::Controller::Helpers from CardCell

* remove Devise::Controller::Helpers from ProposalCell

* fix test system/report_proposal_spec

* fix test system/process_admin_manages_proposals_spec

* card_for merge(options)

* update gem to cells-rails 0.0.9, supresses forwardable warning: protect_against_forgery?

* updated the design_app Gemfile.lock

* add creation_date to author_cell

* force AuthorCell to use the top-level ::Devise::Controllers::Helpers

* clean-up

* Remove unused locale keys

* fix blog w AuthorCell, adds comments to AuthorCell

* fix show creation_date on proposal#show

* replace model.class.method_defined? with model.respond_to?

* Add TagsCell spec

* Remove unused code block

* Add more examples to TagsCell spec

* include `ActionController::Helpers` in `Decidim::Proposals::ViewModel` for helper methods used in `action_authorization.rb`

* removed unused actions and `true if` in ProposalCell

* update decidim-generators Gemfile

* move Decidim::ActionAuthorization to Decidim::ViewModel

* fix rubocop offense

* fix erb-lint issues

* update Gemfile.lock files (root, generators and design)

* Better linking back from admin to frontend (#3325)

* Remove old upgrade notes from 0.11

* Fix notifications styling on (at least) chromium (#3324)

Introduced in 01db57e.

* [TEST|REFACTOR] Force user_group.name uniqueness in user_group test factory. (#3290)

* [REFACTOR] Force user_group.name uniqueness in user_group test factory.

* Add change in Changelog.

* [DOC|FIX] Remove doubled line in **Changed** block.

* [FIX] Remove changes that belong to another branch.

* Fix CHANGELOG.md problem with git automatic merge.

* Fix conntroller name in routes (#3323)

* Revert "Remove old upgrade notes from 0.11"

This reverts commit c1efea7.

Sorry :disappoint:

* [FIX] DB table name.

* [REFACTOR|TEST] Move coauthorship into Decidim namespace and finish tests.

* Fix changelog (#3330)

* Rubocopify.

* Define Coauthorable object interface.

* Rubocopify.

* Rubocopify.

* Fine grained permissions (#3029)

* Add Permissions class to processes

* Add proposals permissions

* Make component and space manifests be aware of permissions classes

* Add permissions to assemblies

* Remove proposal abilities

* Make all proposal actions use the permissions system

* Ignore complexity checks on permissions classes

They *will* be complex anyway...

* Fix moderations specs

* Make comments know how to find their participatory space

* Add changelog

* Unify naming in favor of `class` insted of `klass`

* Rename method to clarify its behaviour

* Fix constant name

* Fix tests

* Remove redundant tests

Features are tested via the `admin_manages_proposals_spec.rb` tests,
access to those features are tested via the permissions tests.

* Add default interface for component permissions

* Fine grained permissions: meetings (#3105)

* Add permissions for meetings

* Move to permissions system

* Remove old abilities

* Add admin permissions for meetings

* Add missing admin permission checks

* Add changelog entry

* Remove redundant specs

* Use default interface to simplify code

* Fine grained permissions: surveys (#3108)

* Add surveys permissions

* Move to permissions system in the public part

* Move admin section to permissions system

* Rubocop autofix

* Add changelog file

* Remove redundant specs

* Remove abilities specs

* Use default interface to simplify code

* Fine grained permissions: comments (#3116)

* Remove abilities and redundant specs from comments

Permissions are handled by the space

* Add changelog

* Fine grained permissions: debates (#3114)

* Add permissions for debates

* Remove debates abilities

* Move to permissions system

* Remove redundant system specs

* Rubocop fixes

* Move to the new permissions system (#3113)

* Fine grained permissions: budgets (#3119)

* Add permissions

* Remove reundant specs

* Add context of pemrissions to the controllers

* Add CRUD permissions for budgets on admin

* Move abilities to permissions

* Add CHANGELOG

* Fix typo

* Fix copy&paste

* Improve readability

* Fix rubocop issues

* Fine grained permissions: accountability (#3122)

* Add permissions

* Remove redundant spec

* Move to permission system

* Add changelog

* rubocop fixes

* Fine grained permissions sortitions (#3127)

* Add permissions

* Fix typo

* Remove abilities

* Move to permissions

* Remove redundant specs

* Add changelog

* [WIP] Fine grained permissions: admin && core (#3137)

Fine grained permissions: admin && core

* Fix method name

This was introduced on a rebase.

* Fix bad rebase

* Fix specs

* Move blogs to permissions

* Do not inject abilities for initiatives

* Use permissions on menu block so tests can run

* Fix Gemfile.lock

* Fix admin specs

* Fine grained permissions: initiatives (#3304)

* comment line

* Remove unused tests

* Add public permissions

* Add specs for the public part of permissions

* Remove unused file

* Add tests for the admin permissions part

* Remove abilities

* Move controllers to permissions

* Add ApplicationController to initiatives

* Move views to permissions

* Fix permissions

* Fix inheritance

* Fix typo

* Fix forgotten `cannot?` calls

* Fix warning

* Add reference to permission class to space manifest

* Fix permissions

* Fix controller specs

* Fix public permissions

* Fix permissions chain for public part

* Fix attachment permissions for initiative user

* Fix permissions specs

* Fix committee requests specs

* rubocop fixes

* Fix permissions

* Fix Gemfile.lock files

* Fix ProposalsController after rebase

* Fix admin permissions

* Fix specs

* Fix bad merge

* Remove calls to unexisting method

* Fix admin specs

* Collaborative drafts (#3285)

* reorder public index

* sort missing stuff

* fix overflow author avatar

* ellipsis names

* previous draft version

* collaborator member

* no collaborator

* access requested

* update proposals view

* resort items collaboratives

* Renaming properly

* Update links

* fix erblint

* Remove duplicated space title on page meta tags (#3278)

* Remove duplicated space title on page meta tags

* Fix changelog

* Strange behaviour when creating an area with the same name (#3336)

* add validation uniqueness name in area form scoped with the area_type

* Add changelog line.

* add specs for form

* Add Changelog entry.
isaacmg410 pushed a commit to CodiTramuntana/decidim that referenced this pull request May 25, 2018
* Introduce cells to componentize the UI

* Fix layout

* Update gems

* Fix layout

* Improve naming

* Add UserCell

* Render endorsers using cells

* Fix layout

* Improve naming and reuse cells

* Reuse AuthorBox cell

* Add Proposal M card cell

* Fix tests

* Refactor ViewModel, inheritance, autoload, move view_paths to engine

* use proposal_cell in participatory_processes/participatory_process_groups and participatory_spaces

* Refactor cell_proposal_m w/ action `footer` context aware.

* Replace partial `shared/tags` with `tags_cell`

* remove partial `shared/tags`

* move helper_methods from Decidim::ActionAuthorization to Decidim::ActionAuthorizationHelper

* added proposal header cell

* Replace partial `shared/author_reference` with `author_box` cell

* remove partial `shared/author_reference`

* Replace partial `proposal_badge` with `badge` cell

* remove partial `proposal_badge`

* move helpers to/from `ViewModel`s

* use content_tag in badge cell

* Proposal show use badge cell

* update Gemfile.lock

* fix formatting

* rename `feature` to `component`

* restore shared/tags partial for meetings

* fix Cell::ViewModel::Partial error in tests

* use cell badge in similar_proposal and proposal_embed

* remove locale unused keys

* fix single quotes erblint complaints

* removed unused i18n key

* Add card attr in proposal Manifest, add proposal cell, cell spec tests, refactor proposal_m_cell

* [wip] introduce card_for author

* Added author_cell spec

* removed unused locale key `view_proposal` from sortitions

* add Decidim::Debates::OfficialAuthorPresenter
to CardCell

* remove Devise::Controller::Helpers from Decidim:ViewModel

* fix erblint issues

* remove Devise::Controller::Helpers from CardCell

* remove Devise::Controller::Helpers from ProposalCell

* fix test system/report_proposal_spec

* fix test system/process_admin_manages_proposals_spec

* card_for merge(options)

* update gem to cells-rails 0.0.9, supresses forwardable warning: protect_against_forgery?

* updated the design_app Gemfile.lock

* add creation_date to author_cell

* force AuthorCell to use the top-level ::Devise::Controllers::Helpers

* clean-up

* Remove unused locale keys

* fix blog w AuthorCell, adds comments to AuthorCell

* fix show creation_date on proposal#show

* replace model.class.method_defined? with model.respond_to?

* Add TagsCell spec

* Remove unused code block

* Add more examples to TagsCell spec

* include `ActionController::Helpers` in `Decidim::Proposals::ViewModel` for helper methods used in `action_authorization.rb`

* removed unused actions and `true if` in ProposalCell

* update decidim-generators Gemfile

* move Decidim::ActionAuthorization to Decidim::ViewModel

* fix rubocop offense

* fix erb-lint issues

* update Gemfile.lock files (root, generators and design)
oriolgual pushed a commit that referenced this pull request Aug 27, 2018
* [WIP] Access button to collaborative draft.

* [LAYOUT] Add a .ml-s left margin to access collaborative drafts button.

* [WIP] CollaborativeDraftsController.

* [WIP] CollaborativeDraftsController.
[FIX] CollabortaiveOrderable.
[TEST] Make test pass.

* [FEATURE] Make CollaborativeDraft commentable.

* Apply rubocop corrections.

* Added default cell card to collaborative_drafts list. Pending to define a specific M-card.

* Added filter by state.

* Normalize i18n.

* Collaborative draft search: javascript for search filter.

* [FIX] Use 'published' state to filter by published state (instead of published_at).

* [WIP] Show collaborative draft.

* add `class.name` and `id` to CardCell in env.development

* Added commentable capacity to CollaborativeDrafts with CommentableCollaborativeDraft.

* Rubocopify.

* [WIP] Collaborative Draft Wizard

* [WIP] Editable collaborative_draft.

* [WIP|LAYOUT] Show CollaborativeDraft.

* [WIP|LAYOUT] Show CollaborativeDraft.

* [WIP|TEST] Start by defining specs.

* [WIP]

* [FIX] Correct previous bad renaming.

* Wizard for Collaborative Draft

* add state "open" on create ProposalDraft

* ProposalDraft Edit

* fix wizard total_steps

* Introduce coauthorable concern and coauthorship model. (#3310)

* Fix migration (#3292)

* Search homepage (#3294)

* search boxes

* boxes stylish

* Change broken link on Getting started and add definition on checklist (#3303)

* Update link to checklist on getting_started.md

* update checklist.md

Add  definition of how the slug must be for the terms-and-conditions page to display it in the registration form.

* Fix codeclimate compliance

* Meetings management for minutes (#3213)

* [WIP] manage minutes

* wip working with admin_log

* fix log and add specs

* add changelog line and fix documentation

* add space before %> in html

* rename to minutes and add system specs

* add consultations into gemfile

* add admin specs for minutes

* change is_visible to visible and apply some other requested changes

* normalize en

* [FIX] Do not set the ajax endpoint to the member but to the collection (#3262)

* [FIX] Do not set the ajax endopont to the member but to the collection, so it can be used when creating.

* Changelog.

* Make linter happy.

* [TEST|REFACTOR] Extract capybara_data_picker.

* [WIP] Test.

* [TEST] Test proposals association in results CRUD.

* [TEST|REFACTOR] Apply renaming of capybara behaviour method.

* Rubocopify.

* [REFACTOR] Rename changed method name.

* [REFACTOR] Remove commented methods.

* Update README.md (#3298)

change reference to votes with reference to signatures

* Component permissions manifest (#3300)

* Try to keep our mental health

Naming these nested block variables with different names helps stay
mentally healthy.

* Indentation fix

* Remove unnecessary memoization

This is a private method called from a single place.

* Add a permission options manifest

* Change options when switching selected workflow

* Improve spec's readability

Foo was both the name of the authorized action and the name of the
option, that was confusing.

* Improve dummy authorization handlers

* Move them outside of decidim.
* Install them optional via the `--demo` option.
* Merge the "example" one with the "dummy" one. Their purpose was the
  same: explain the feature, so we merge both taking the best of each
  (docs + real working example).
* Add another dummy handler, so the "handler" selection features can be
  used on development applications by default.

* Allow optional permission settings

* Add changelog entry

* Add documentation

And also merge documentation for authorizations in a single place.

* Version bump

* new card meeting multiple dates (#3280)

* Dry CI config (#3258)

* Dry simple steps

* Dry steps with module names

* Rename processes step to match module name

* Use a glob pattern in paths lists

* Update design navigation (#3295)

* update provess-navigation

* update initiatives cards

* User profile (#3261)

* initial setup profile

* block profile card

* tabs control

* tabs title bar

* timeline

* edit card-widget

* generalize

* common width widget left item

* center icons

* rename tabs

* absolutes

* following/followers

* add inline filters to notifications

* inline filters minimal fix

* update links header

* rounded profile topbar

* dropdown styled

* notifications menu

* dropdown arrows

* fix typo

* restore login status

* member of, in user card profile

* icons changed

* fix form for erb linter (#3306)

* Introduce coauthorable concern and coauthorship model.

* Fix version format for npm (#3312)

* Privatize private method

* Make sure we only read file once

* Extract a private method

To try make the code explain itself.

* Add missing version check

We're now using `.dev` for development versions so we need to add this
check so that those are properly transformed into a semver compatible
string.

* Fix a couple of erblint offenses (#3311)

Probably crept in in a non rebased PR.

* Fix dev app's gemfile for external plugins (#3313)

* Correct optional gems location when generating app

Otherwise we get an error bundling it in external plugins since there's
no local folder in the final app:

```
The path `/path/to/decidim/development_app/decidim-consultations` does not exist
```

* Read gemspec only once

* Update ruby to version 2.5.1 (#3293)

* Update Gemfile.lock to update erb_lint to v 0.0.24

* fix erb_lint errors

* update to ruby 2.5.1

* Use ruby 2.5.1's docker image

* Update decidim-generators Gemfile.lock

* Update decidim_app-design Gemfile.lock

* Update decidim_app-design Gemfile.lock (2)

* [TEST] Add factory for coauthorsihps.

* [REFACTOR] Review Coauthorship (and its migration) foreign key definitions.

* [REFACTOR] Coauthorable asserts affect coauthorship instead of coauthorable, then it should be a spec instead of a shared_example.

* [RFC] Use cells to componentize the views (2nd take) (#2897)

* Introduce cells to componentize the UI

* Fix layout

* Update gems

* Fix layout

* Improve naming

* Add UserCell

* Render endorsers using cells

* Fix layout

* Improve naming and reuse cells

* Reuse AuthorBox cell

* Add Proposal M card cell

* Fix tests

* Refactor ViewModel, inheritance, autoload, move view_paths to engine

* use proposal_cell in participatory_processes/participatory_process_groups and participatory_spaces

* Refactor cell_proposal_m w/ action `footer` context aware.

* Replace partial `shared/tags` with `tags_cell`

* remove partial `shared/tags`

* move helper_methods from Decidim::ActionAuthorization to Decidim::ActionAuthorizationHelper

* added proposal header cell

* Replace partial `shared/author_reference` with `author_box` cell

* remove partial `shared/author_reference`

* Replace partial `proposal_badge` with `badge` cell

* remove partial `proposal_badge`

* move helpers to/from `ViewModel`s

* use content_tag in badge cell

* Proposal show use badge cell

* update Gemfile.lock

* fix formatting

* rename `feature` to `component`

* restore shared/tags partial for meetings

* fix Cell::ViewModel::Partial error in tests

* use cell badge in similar_proposal and proposal_embed

* remove locale unused keys

* fix single quotes erblint complaints

* removed unused i18n key

* Add card attr in proposal Manifest, add proposal cell, cell spec tests, refactor proposal_m_cell

* [wip] introduce card_for author

* Added author_cell spec

* removed unused locale key `view_proposal` from sortitions

* add Decidim::Debates::OfficialAuthorPresenter
to CardCell

* remove Devise::Controller::Helpers from Decidim:ViewModel

* fix erblint issues

* remove Devise::Controller::Helpers from CardCell

* remove Devise::Controller::Helpers from ProposalCell

* fix test system/report_proposal_spec

* fix test system/process_admin_manages_proposals_spec

* card_for merge(options)

* update gem to cells-rails 0.0.9, supresses forwardable warning: protect_against_forgery?

* updated the design_app Gemfile.lock

* add creation_date to author_cell

* force AuthorCell to use the top-level ::Devise::Controllers::Helpers

* clean-up

* Remove unused locale keys

* fix blog w AuthorCell, adds comments to AuthorCell

* fix show creation_date on proposal#show

* replace model.class.method_defined? with model.respond_to?

* Add TagsCell spec

* Remove unused code block

* Add more examples to TagsCell spec

* include `ActionController::Helpers` in `Decidim::Proposals::ViewModel` for helper methods used in `action_authorization.rb`

* removed unused actions and `true if` in ProposalCell

* update decidim-generators Gemfile

* move Decidim::ActionAuthorization to Decidim::ViewModel

* fix rubocop offense

* fix erb-lint issues

* update Gemfile.lock files (root, generators and design)

* Better linking back from admin to frontend (#3325)

* Remove old upgrade notes from 0.11

* Fix notifications styling on (at least) chromium (#3324)

Introduced in 01db57e.

* [TEST|REFACTOR] Force user_group.name uniqueness in user_group test factory. (#3290)

* [REFACTOR] Force user_group.name uniqueness in user_group test factory.

* Add change in Changelog.

* [DOC|FIX] Remove doubled line in **Changed** block.

* [FIX] Remove changes that belong to another branch.

* Fix CHANGELOG.md problem with git automatic merge.

* Fix conntroller name in routes (#3323)

* Revert "Remove old upgrade notes from 0.11"

This reverts commit c1efea7.

Sorry :disappoint:

* [FIX] DB table name.

* [REFACTOR|TEST] Move coauthorship into Decidim namespace and finish tests.

* Fix changelog (#3330)

* Rubocopify.

* Define Coauthorable object interface.

* Rubocopify.

* Rubocopify.

* Fine grained permissions (#3029)

* Add Permissions class to processes

* Add proposals permissions

* Make component and space manifests be aware of permissions classes

* Add permissions to assemblies

* Remove proposal abilities

* Make all proposal actions use the permissions system

* Ignore complexity checks on permissions classes

They *will* be complex anyway...

* Fix moderations specs

* Make comments know how to find their participatory space

* Add changelog

* Unify naming in favor of `class` insted of `klass`

* Rename method to clarify its behaviour

* Fix constant name

* Fix tests

* Remove redundant tests

Features are tested via the `admin_manages_proposals_spec.rb` tests,
access to those features are tested via the permissions tests.

* Add default interface for component permissions

* Fine grained permissions: meetings (#3105)

* Add permissions for meetings

* Move to permissions system

* Remove old abilities

* Add admin permissions for meetings

* Add missing admin permission checks

* Add changelog entry

* Remove redundant specs

* Use default interface to simplify code

* Fine grained permissions: surveys (#3108)

* Add surveys permissions

* Move to permissions system in the public part

* Move admin section to permissions system

* Rubocop autofix

* Add changelog file

* Remove redundant specs

* Remove abilities specs

* Use default interface to simplify code

* Fine grained permissions: comments (#3116)

* Remove abilities and redundant specs from comments

Permissions are handled by the space

* Add changelog

* Fine grained permissions: debates (#3114)

* Add permissions for debates

* Remove debates abilities

* Move to permissions system

* Remove redundant system specs

* Rubocop fixes

* Move to the new permissions system (#3113)

* Fine grained permissions: budgets (#3119)

* Add permissions

* Remove reundant specs

* Add context of pemrissions to the controllers

* Add CRUD permissions for budgets on admin

* Move abilities to permissions

* Add CHANGELOG

* Fix typo

* Fix copy&paste

* Improve readability

* Fix rubocop issues

* Fine grained permissions: accountability (#3122)

* Add permissions

* Remove redundant spec

* Move to permission system

* Add changelog

* rubocop fixes

* Fine grained permissions sortitions (#3127)

* Add permissions

* Fix typo

* Remove abilities

* Move to permissions

* Remove redundant specs

* Add changelog

* [WIP] Fine grained permissions: admin && core (#3137)

Fine grained permissions: admin && core

* Fix method name

This was introduced on a rebase.

* Fix bad rebase

* Fix specs

* Move blogs to permissions

* Do not inject abilities for initiatives

* Use permissions on menu block so tests can run

* Fix Gemfile.lock

* Fix admin specs

* Fine grained permissions: initiatives (#3304)

* comment line

* Remove unused tests

* Add public permissions

* Add specs for the public part of permissions

* Remove unused file

* Add tests for the admin permissions part

* Remove abilities

* Move controllers to permissions

* Add ApplicationController to initiatives

* Move views to permissions

* Fix permissions

* Fix inheritance

* Fix typo

* Fix forgotten `cannot?` calls

* Fix warning

* Add reference to permission class to space manifest

* Fix permissions

* Fix controller specs

* Fix public permissions

* Fix permissions chain for public part

* Fix attachment permissions for initiative user

* Fix permissions specs

* Fix committee requests specs

* rubocop fixes

* Fix permissions

* Fix Gemfile.lock files

* Fix ProposalsController after rebase

* Fix admin permissions

* Fix specs

* Fix bad merge

* Remove calls to unexisting method

* Fix admin specs

* Collaborative drafts (#3285)

* reorder public index

* sort missing stuff

* fix overflow author avatar

* ellipsis names

* previous draft version

* collaborator member

* no collaborator

* access requested

* update proposals view

* resort items collaboratives

* Renaming properly

* Update links

* fix erblint

* Remove duplicated space title on page meta tags (#3278)

* Remove duplicated space title on page meta tags

* Fix changelog

* Strange behaviour when creating an area with the same name (#3336)

* add validation uniqueness name in area form scoped with the area_type

* Add changelog line.

* add specs for form

* Add Changelog entry.

* [WIP] Tests for CollaborativeDraft+Coauthorable.

* [REFACTOR] Remove decidim_author_id and decidim_user_group_id from collaborative_drafts table in favour of coauthorships.

* [WIP|TEST] Coauthorships and coauthorable.

* [WIP|TEST] Coauthorships and coauthorable.

* [TEST] Coauthorships and coauthorable.

* [REFACTOR] Apply new authorizations system instead of cancancan.

* [REFACTOR] Make CollaborativeDraft Coauthorable.

* [WIP] Hack presenter so that there is no crash.

* [FIX] Use correct permission action name :edit instead of :update.

* [REFACTOR] Apply new `card_for` and use `allowed_to?` instead of `can?`.

* Rubocopify.

* [REFACTOR] Allow Component resources to declare its card cell.

* Add Traceability, collaborative_draft_cell, collaborative_draft permisions, fix collaborative_draft views

* [REFACTOR] Remove DeclaresResourceManifest concern.

* [FEATURE] Added CollaborativeDraft.has_and_belongs_to_many users through access_requests intermediate table.

* fix translation scope

* disable "create as" in edit

* fix component.register_resource(:collaborative_draft)

* CollaborativeDraftCell spec, CollaborativeDraftCell with collapsible_list for authors

* Add create_collaborative_draft_spec

* refactor i18n helpers for collaborative drafts

* add update_collaborative_draft_spec.rb

* Add collaborator request_accept and request_reject, routes, actions, views and spec

* add versioning example to update_collaborative_draft_spec.rb

* Add collaborative drafts system spec

* Add collaborative drafts version system spec

* Remove DeclaresResourceManifest spec

* remove current_user_ability_spec

* fix i18n CI issues

* RequestAccessToCollaborativeDraft command with notification to authors

* RejectAccessToCollaborativeDraft command with notification to requester and authors

* small edits

* AcceptAccessToCollaborativeDraft command with notification to requester and authors

* fix i18n collaborative_drafts requests flash alert

* fix create_collaborative_draft_spec.rb

* close/publish collaborative draft, reject pending requests and notify authors

* close, publish, controller, access/reject/accept request and events specs for collaborative drafts

* refactor collaborator_requests from `has_and_belongs_to_many` to `has_many :through`

* reviewed irreversible_action_modal styles

* re-reviewed irreversible_action_modal styles

* Fix: proposal wizard help text announcement, has_many LineLength

* Admin can enable/disable collaborative drafts

* Fix failing specs

* enable collaborative drafts in seeds

* Number of contributors to the draft

* Fix failing specs

* fix Faker::UniqueGenerator::RetryLimitExceeded for user_group factory

* create a proposal when collaborative_draft is published

* remove double redirect from proposals controller

* renamed to `withdrawn` the `closed` state

* Add link in collaborative drafts detail page back to list #3713

* fix command PublishCollaborativeDraft, replace closed? with withdrawn?

* fix collaborative draft seeds

* Add Counter Cache Coauthorships To CollaborativeDrafts

* Remove Index Counter Cache Coauthorships To Proposals

* refactor CollabDrafts to use CoathorshipCell

* Fix collaborative_drafts_controller_spec

* fix 3 rubocop offenses

* fix 2 rubocop offenses

* fix invalid Coauthorships in specs

* Publish CollabDraft as Proposal with coauthors

* no proposal_limit when creating proposal from collaborative draft

* create proposal with the collaborative drafts' scope and category

* fix proposal_limit_reached for spec

* fix update_collaborative_draft_spec

* refactor to use coathorships not identities to crate the new proposal

* refactor Publish CollabDraft

* Add CHANGELOG entry

* Fix collaborative_draft spec

* Generate `collaborative_draft_versions` route with Rails routes

* remove `votes` from CollaborativeDraftMCard footer

* Generate `button_continue` from `irreversible_modal` route with Rails routes

* Memoize linked `collaborative_draft`

* remove :link_resource_name from resource_manifest

* RequestAccessToCollaborativeDraft: form, command, view

* AcceptAccessToCollaborativeDraftForm: form, command, view

* RejectAccessToCollaborativeDraftForm: form, command, view

* refactor add_coauthor to use user_group

* Module with Attachment common methods for proposals and collaborative_drafts

* removed unused method :organization

* use `authored_by?`

* normalized en locale

* renormalize en locale & erblit

* include AttachmentMethods to UpdateProposal

* scope requester_user to organization

* refactor PublishCollaborativeDraft command, CollaboratorRequests to its own controller

* various mini fixes

* Refactor CollaborativeDraftAccessRequestEvent to DRY

* Full words for accept_request_button_label and reject_request_button_label

* permission if collaborative_drafts are enabled

* fix reject/accept_access_to_collaborative_draft_spec

* fix request_access permission

* refactor PublishCollaborativeDraft.
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.

8 participants