Skip to content

Assembly members - #3008

Merged
oriolgual merged 22 commits into
masterfrom
feature/assembly_members
May 10, 2018
Merged

oriolgual merged 22 commits into
masterfrom
feature/assembly_members

Conversation

@rbngzlv

@rbngzlv rbngzlv commented Mar 14, 2018 •

Copy link
Copy Markdown
Contributor

🎩 What? Why?

An assembly can have members (president, vice president, ...)

📌 Related Issues

📋 Subtasks

  • Add admin log
  • Add seeds
  • Specs
  • Add CHANGELOG entry

📷 Screenshots

screen shot 2018-04-23 at 12 36 46

@rbngzlv rbngzlv self-assigned this Mar 14, 2018
@rbngzlv
rbngzlv force-pushed the feature/assembly_members branch from d2d76e4 to 0f424f6 Compare March 16, 2018 07:25
@codecov

codecov Bot commented Mar 16, 2018 •

Copy link
Copy Markdown

Codecov Report

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

@@            Coverage Diff            @@
##             master    #3008   +/-   ##
=========================================
  Coverage          ?   97.52%           
=========================================
  Files             ?     1688           
  Lines             ?    40348           
  Branches          ?        0           
=========================================
  Hits              ?    39349           
  Misses            ?      999           
  Partials          ?        0

@rbngzlv
rbngzlv force-pushed the feature/assembly_members branch 5 times, most recently from 3b2d991 to 3292bbb Compare March 26, 2018 10:15
@rbngzlv
rbngzlv force-pushed the feature/assembly_members branch 4 times, most recently from 18ed118 to bda7e91 Compare April 6, 2018 07:38
@rbngzlv
rbngzlv force-pushed the feature/assembly_members branch 3 times, most recently from 0578433 to 5e9a8b5 Compare April 19, 2018 18:01
@rbngzlv

rbngzlv commented Apr 20, 2018 •

Copy link
Copy Markdown
Contributor Author

Hi! I'm introducing a custom reusable component that uses selectize.js react-select under the hook to power a select box with autocomplete ajax functionality.

selectize decidim

My idea is to add a form.autocomplete_select method that will render a valid select input div with some data attributes to make the use of this functionality easy for others.

I'm almost finished (not code uploaded yet) but I wanted to ask if there is any any concern about this.

@rbngzlv
rbngzlv force-pushed the feature/assembly_members branch 2 times, most recently from 72d64dd to e0b710f Compare April 23, 2018 09:55
@rbngzlv

rbngzlv commented Apr 23, 2018 •

Copy link
Copy Markdown
Contributor Author

Hi, I need some opinions/guidance/help in my implementation of a autocomplete select with React. Can do a fast review on this commit, please? e0b710f

I need to implement specs, pass linters, etc. but in the meanwhile are the pieces in the right place?

/cc @decidim/lot-core @deivid-rodriguez

Edit: wrong commit link

format.json do
render json: [] && return if params.fetch(:term, "").empty?

query = current_organization.users&.order(name: :asc)

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.

This code is very similar to another PR, maybe we should extract this?

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.

@oriolgual What do you propose? Extract it to a concern? It's a good fit for an API endpoint, but it has no authentication, right?

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.

Also, we would have to add the api as dependency for the admin ... 😕

include Decidim::Traceable
include Decidim::Loggable

GENDERS = %w(man woman).freeze

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.

@decidim/product do we really need to save the gender? I'm not an expert but in terms of LOPD isn't this considered a different level of data?

Also, if we really want to know the gender of the members, maybe we should consider an extra field with a free text option.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @oriolgual, this is a specific requirement from Barcelona Participation Regulation, which states that the composition of assemblies must be proportional in terms of age, gender and origin.

That said, I think a drop-down field with binary option is not a good solution. As the gender issue can be quite tricky (see the 71 gender options offered by Facebook) I would leave this field as an open text field.

In the end, it should serve to make parity issues visible. I understand that using an open text field is the simplest change.

create_table :decidim_assembly_members do |t|
t.references :decidim_assembly, index: true
t.references :decidim_user, index: true
t.integer :weight, null: false, default: 0

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.

Please add an index here since it's the column used as default sorting.

designation_mode: Designation mode
full_name: Full name
gender: Gender
origin: Origin

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.

@decidim/product what do we actually need to save here? Where the member is native from? See https://www.wordnik.com/words/origin

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@oriolgual sorry I forgot to answer this one. Yes, this refers to place of birth (again, data required from Barcelona Participation Regulations)

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.

Maybe birthplace would be a better naming?

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'll be working on this today, I'll change this field to birthplace.

@deivid-rodriguez

deivid-rodriguez commented Apr 24, 2018 •

Copy link
Copy Markdown
Contributor

@rbngzlv Sorry I don't have time to review your work at the moment but at first glance it seems like a fantastic piece of job that's very interesting for other places of decidim as well, and helps up better integrating react in our workflows. Love what you're building 💪

@tramuntanal

Copy link
Copy Markdown
Contributor

@rbngzlv @isaacmg410 this PR is expected to be merged this week to enter v0.12. Do you expect to have it finished soon?

@mrcasals

mrcasals commented May 8, 2018

Copy link
Copy Markdown
Contributor

@rbngzlv some conflicts appeared, can you work on them?

I can help you if you need to, since those conflicts are related to #3029

rbngzlv added 2 commits May 8, 2018 12:49
# Conflicts:
#	decidim-assemblies/app/models/decidim/assemblies/abilities/admin/admin_ability.rb
#	decidim-assemblies/app/models/decidim/assemblies/abilities/admin/assembly_admin_ability.rb
#	decidim-assemblies/app/models/decidim/assemblies/abilities/admin_ability.rb
#	decidim-assemblies/app/models/decidim/assemblies/abilities/assembly_role_ability.rb
#	decidim-assemblies/app/models/decidim/assemblies/abilities/everyone_ability.rb
#	decidim-assemblies/app/views/layouts/decidim/admin/assembly.html.erb
#	decidim-assemblies/lib/decidim/assemblies/test/factories.rb
@rbngzlv

rbngzlv commented May 8, 2018

Copy link
Copy Markdown
Contributor Author

@decidim/lot-core updated with master and conflicts fixed.

@mrcasals can you check my implementation for the new permissions system?

@mrcasals

mrcasals commented May 9, 2018

Copy link
Copy Markdown
Contributor

@rbngzlv yup, the permissions commit looks good to me! I'll check the rest of the PR too and try to merge it 😄

helper_method :collection

def index
redirect_to "/404" if members.none?

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 think we should raise ActionController::RoutingError, "No members for this assembly" here. In development we'd see the error, in production we'd be redirected to /404.

Thoughts?

module Abilities
module Admin
# Defines the abilities for an admin user. Intended to be used with `cancancan`.
class AdminAbility < Decidim::Abilities::AdminAbility

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.

These ability classes should be removed

module Assemblies
module Abilities
# Defines the abilities for an admin user. Intended to be used with `cancancan`.
class AdminAbility < Decidim::Abilities::AdminAbility

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.

This should be removed

module Abilities
# Defines the abilities for any user that can manage assemblies (whatever their role).
# Intended to be used with `cancancan`.
class AssemblyRoleAbility

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.

This should be removed

module Abilities
# Defines the base abilities related to assemblies for any user. Guest users
# will use these too. Intended to be used with `cancancan`.
class EveryoneAbility < Decidim::Abilities::EveryoneAbility

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.

This should be removed

@@ -0,0 +1,29 @@
<% member_presenter = Decidim::AssemblyMemberPresenter.new(assembly_member) %>

<div class="column">

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.

Move this to a cell, maybe? 😄

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'm not sure about this, for now we're not going to reuse this view.

Anyway, if we want to have this moved to a cell, I can make the commitment to do it in a future PR, but not now. We need this feature to be merged before the end of this week, and we have two more related PR's pending. What do you think?

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.

Sounds reasonable to me, 👍

module Admin
# Defines the abilities for an assembly admin user. Intended to be used
# with `cancancan`.
class AssemblyAdminAbility < Decidim::Assemblies::Abilities::Admin::AssemblyRoleAbility

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.

This one should be removed too

@ghost ghost added the status: WIP label May 9, 2018
mrcasals
mrcasals previously approved these changes May 9, 2018
@mrcasals

mrcasals commented May 9, 2018

Copy link
Copy Markdown
Contributor

@rbngzlv you need to update the test after adding the exception 😄

@rbngzlv
rbngzlv force-pushed the feature/assembly_members branch from 783aed9 to bc1aa2f Compare May 9, 2018 14:20
@oriolgual
oriolgual merged commit 4656577 into master May 10, 2018
@ghost ghost removed the status: WIP label May 10, 2018
@rbngzlv
rbngzlv deleted the feature/assembly_members branch May 10, 2018 17:12
isaacmg410 pushed a commit to CodiTramuntana/decidim that referenced this pull request May 25, 2018
* Add AssemblyMember entity

* Show/Hide and Disable/Enable position other input

* Implement admin log

* Add seeds for assembly members

* Basic public UI

* Add weight attribute to order members

* A member can be ceased

* Allow to filter and search members in admin

* Apply final design

* Add specs

* Rename origin to birthplace

* Change gender from select to text field

* Add changelog entry

* Fix locales, rubocop and remove unnecessary specs

* Add birthplace to factories

* Implement new permissions sytem

* Remove cancancan abilities

* raise ActionController::RoutingError instead of redirect

* Update spec
@mrcasals mrcasals mentioned this pull request May 31, 2018
@isaacmg410 isaacmg410 mentioned this pull request Oct 24, 2018
4 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants