Add legal name and pronouns to members

This commit is contained in:
Hugo Peixoto 2023-03-31 02:24:16 +01:00
parent f956a65100
commit ee0dc75889
14 changed files with 53 additions and 11 deletions

View File

@ -28,3 +28,12 @@ table.noborder { border: 0; margin: 0; }
nav ul { display: flex; flex-wrap: wrap; padding: 10px; list-style-type: none; gap: 20px; } nav ul { display: flex; flex-wrap: wrap; padding: 10px; list-style-type: none; gap: 20px; }
nav ul li { margin: 0; padding: 0; } nav ul li { margin: 0; padding: 0; }
.contribution-actions {
list-style-type: none;
padding: 0px;
display: flex;
flex-wrap: wrap;
gap: 0 20px;
}
.contribution-actions li { padding: 0; }

View File

@ -4,7 +4,7 @@ module MemberFilter
def filtered_members def filtered_members
members = Member.all.order(sort_params.merge(number: :asc)) members = Member.all.order(sort_params.merge(number: :asc))
filters = params.permit(:prefers_postal, :display_name, :email, :identification_number, status: [], category: []) filters = params.permit(:prefers_postal, :display_name, :legal_name, :email, :identification_number, status: [], category: [])
Rails.logger.info filters Rails.logger.info filters
@ -18,6 +18,7 @@ module MemberFilter
members.ransack( members.ransack(
display_name_i_cont: filters[:display_name], display_name_i_cont: filters[:display_name],
legal_name_i_cont: filters[:legal_name],
email_i_cont: filters[:email], email_i_cont: filters[:email],
identification_number_i_cont: filters[:identification_number], identification_number_i_cont: filters[:identification_number],
).result ).result
@ -27,7 +28,7 @@ module MemberFilter
field, direction = params.fetch(:sort, "").split(".") field, direction = params.fetch(:sort, "").split(".")
directions = %w[ asc desc ] directions = %w[ asc desc ]
fields = %w[ number expires_on joined_on email status display_name ] fields = %w[ number expires_on joined_on email status display_name legal_name ]
if directions.include?(direction) && fields.include?(field) if directions.include?(direction) && fields.include?(field)
{ field => direction } { field => direction }

View File

@ -64,6 +64,6 @@ class MembersController < ApplicationController
# Only allow a list of trusted parameters through. # Only allow a list of trusted parameters through.
def member_params def member_params
params.fetch(:member, {}).permit(:display_name, :email, :identification_number, :category, :address, :joined_on, :expires_on, :wants_mailing_list, :prefers_postal) params.fetch(:member, {}).permit(:display_name, :legal_name, :pronouns, :email, :identification_number, :category, :address, :joined_on, :expires_on, :wants_mailing_list, :prefers_postal)
end end
end end

View File

@ -20,6 +20,8 @@ class Member < ApplicationRecord
update( update(
excluded: true, excluded: true,
display_name: "", display_name: "",
legal_name: "",
pronouns: "",
email: nil, email: nil,
identification_number: "", identification_number: "",
category: "", category: "",

View File

@ -18,6 +18,14 @@
<td><label><%= t('members.attributes.display_name') %></label></td> <td><label><%= t('members.attributes.display_name') %></label></td>
<td><%= form.text_field :display_name, required: true %></label></td> <td><%= form.text_field :display_name, required: true %></label></td>
</tr> </tr>
<tr>
<td><label><%= t('members.attributes.legal_name') %></label></td>
<td><%= form.text_field :legal_name, required: true %></label></td>
</tr>
<tr>
<td><label><%= t('members.attributes.pronouns') %></label></td>
<td><%= form.text_field :pronouns, required: true %></label></td>
</tr>
<tr> <tr>
<td><label><%= t('members.attributes.email') %></label></td> <td><label><%= t('members.attributes.email') %></label></td>
<td><%= form.email_field :email, required: true %></label></td> <td><%= form.email_field :email, required: true %></label></td>

View File

@ -13,6 +13,10 @@
<td><%= t 'members.attributes.display_name' %></td> <td><%= t 'members.attributes.display_name' %></td>
<td><%= form.text_field :display_name, value: params[:display_name] %></td> <td><%= form.text_field :display_name, value: params[:display_name] %></td>
</tr> </tr>
<tr>
<td><%= t 'members.attributes.legal_name' %></td>
<td><%= form.text_field :legal_name, value: params[:legal_name] %></td>
</tr>
<tr> <tr>
<td><%= t 'members.attributes.email' %></td> <td><%= t 'members.attributes.email' %></td>
<td><%= form.text_field :email, value: params[:email] %></td> <td><%= form.text_field :email, value: params[:email] %></td>

View File

@ -15,6 +15,8 @@
<table> <table>
<tr><td><label><%= t('members.attributes.display_name') %></label></td><td><%= form.text_field :display_name, required: true %></label></td></tr> <tr><td><label><%= t('members.attributes.display_name') %></label></td><td><%= form.text_field :display_name, required: true %></label></td></tr>
<tr><td><label><%= t('members.attributes.legal_name') %></label></td><td><%= form.text_field :legal_name, required: true %></label></td></tr>
<tr><td><label><%= t('members.attributes.pronouns') %></label></td><td><%= form.text_field :pronouns %></label></td></tr>
<tr><td><label><%= t('members.attributes.email') %></label></td><td><%= form.email_field :email, required: true %></label></td></tr> <tr><td><label><%= t('members.attributes.email') %></label></td><td><%= form.email_field :email, required: true %></label></td></tr>
<tr><td><label><%= t('members.attributes.category') %></label></td><td><%= form.select :category, %w{student retired unemployed employed} %></label></td></tr> <tr><td><label><%= t('members.attributes.category') %></label></td><td><%= form.select :category, %w{student retired unemployed employed} %></label></td></tr>
<tr><td><label><%= t('members.attributes.identification_number') %></label></td><td><%= form.text_field :identification_number %></label></td></tr> <tr><td><label><%= t('members.attributes.identification_number') %></label></td><td><%= form.text_field :identification_number %></label></td></tr>

View File

@ -4,6 +4,8 @@
<table class='lined'> <table class='lined'>
<tr><td><%= t('members.attributes.display_name') %></td><td><%= @member.number %>. <%= @member.display_name %></td></tr> <tr><td><%= t('members.attributes.display_name') %></td><td><%= @member.number %>. <%= @member.display_name %></td></tr>
<tr><td><%= t('members.attributes.legal_name') %></td><td><%= @member.legal_name %></td></tr>
<tr><td><%= t('members.attributes.pronouns') %></td><td><%= @member.pronouns %></td></tr>
<tr><td><%= t('members.attributes.email') %></td><td><%= @member.email %></td></tr> <tr><td><%= t('members.attributes.email') %></td><td><%= @member.email %></td></tr>
<tr><td><%= t('members.attributes.category') %></td><td><%= @member.category %></td></tr> <tr><td><%= t('members.attributes.category') %></td><td><%= @member.category %></td></tr>
<tr><td><%= t('members.attributes.identification_number') %></td><td><%= @member.identification_number %></td></tr> <tr><td><%= t('members.attributes.identification_number') %></td><td><%= @member.identification_number %></td></tr>
@ -40,7 +42,7 @@
<td><%= contribution.payment_reference %></td> <td><%= contribution.payment_reference %></td>
<td>€<%= contribution.eurocents %></td> <td>€<%= contribution.eurocents %></td>
<td> <td>
<ul> <ul class='contribution-actions'>
<li><%= link_to t('members.show.actions.edit_contribution'), edit_contribution_path(contribution) %></div> <li><%= link_to t('members.show.actions.edit_contribution'), edit_contribution_path(contribution) %></div>
<li><%= link_to t('members.show.actions.delete_contribution'), delete_contribution_path(contribution) %></li> <li><%= link_to t('members.show.actions.delete_contribution'), delete_contribution_path(contribution) %></li>
</ul> </ul>

View File

@ -10,8 +10,8 @@
</ul> </ul>
<p> <p>
Caso queiras usufruir da quota reduzida de 6.00€ para estudantes, Caso queiras usufruir da quota reduzida de 6.00€ para estudantes, pessoas
desempregados e reformados, pedimos que nos envies um comprovativo desse desempregadas ou reformadas, pedimos que nos envies um comprovativo desse
estatuto e faças o pagamento por transferência bancária. estatuto e faças o pagamento por transferência bancária.
</p> </p>

View File

@ -5,8 +5,8 @@ MBWAY:
* Transferência bancária: PT50 0035 2178 00027478430 14 * Transferência bancária: PT50 0035 2178 00027478430 14
* Multibanco ou MBWAY: <%= @link %> * Multibanco ou MBWAY: <%= @link %>
Caso queiras usufruir da quota reduzida de 6.00€ para estudantes, Caso queiras usufruir da quota reduzida de 6.00€ para estudantes, pessoas
desempregados e reformados, pedimos que nos envies um comprovativo desse desempregadas e reformadas, pedimos que nos envies um comprovativo desse
estatuto e faças o pagamento por transferência bancária. estatuto e faças o pagamento por transferência bancária.
Se optares pelo método de transferência bancária, pedimos que envies o Se optares pelo método de transferência bancária, pedimos que envies o

View File

@ -30,6 +30,8 @@ en:
status: "Status" status: "Status"
email: "Email address" email: "Email address"
display_name: "Display name" display_name: "Display name"
legal_name: "Legal name"
pronouns: "Pronouns"
joined_on: "Joined on" joined_on: "Joined on"
expires_on: "Expires on" expires_on: "Expires on"
category: "Category" category: "Category"

View File

@ -51,7 +51,9 @@ pt:
number: "#" number: "#"
status: "Estado" status: "Estado"
email: "Endereço de correio electrónico" email: "Endereço de correio electrónico"
display_name: "Nome" display_name: "Nome social"
legal_name: "Nome legal"
pronouns: "Pronomes"
joined_on: "Data de inscrição" joined_on: "Data de inscrição"
expires_on: "Data de expiração" expires_on: "Data de expiração"
category: "Categoria" category: "Categoria"
@ -109,7 +111,7 @@ pt:
subject: "ANSOL - Suspensão de inscrição iminente" subject: "ANSOL - Suspensão de inscrição iminente"
cancelled: cancelled:
subject: "ANSOL - Inscrição cancelada" subject: "ANSOL - Inscrição cancelada"
greetings: "Caro(a) %{display_name}" greetings: "Car(a/o/e) %{display_name}"
sessions: sessions:
new: new:
title: "Entrar" title: "Entrar"

View File

@ -0,0 +1,8 @@
class AddMemberLegalNameAndPronouns < ActiveRecord::Migration[7.0]
def change
change_table :members do |t|
t.string :legal_name
t.string :pronouns
end
end
end

4
db/schema.rb generated
View File

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2022_06_26_100610) do ActiveRecord::Schema[7.0].define(version: 2023_03_31_005733) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto" enable_extension "pgcrypto"
enable_extension "plpgsql" enable_extension "plpgsql"
@ -43,6 +43,8 @@ ActiveRecord::Schema[7.0].define(version: 2022_06_26_100610) do
t.boolean "excluded", default: false t.boolean "excluded", default: false
t.boolean "wants_mailing_list", default: false, null: false t.boolean "wants_mailing_list", default: false, null: false
t.boolean "prefers_postal", default: false, null: false t.boolean "prefers_postal", default: false, null: false
t.string "legal_name"
t.string "pronouns"
t.index ["email"], name: "index_members_on_email", unique: true t.index ["email"], name: "index_members_on_email", unique: true
t.index ["number"], name: "index_members_on_number", unique: true t.index ["number"], name: "index_members_on_number", unique: true
end end