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 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
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
@ -18,6 +18,7 @@ module MemberFilter
members.ransack(
display_name_i_cont: filters[:display_name],
legal_name_i_cont: filters[:legal_name],
email_i_cont: filters[:email],
identification_number_i_cont: filters[:identification_number],
).result
@ -27,7 +28,7 @@ module MemberFilter
field, direction = params.fetch(:sort, "").split(".")
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)
{ field => direction }

View File

@ -64,6 +64,6 @@ class MembersController < ApplicationController
# Only allow a list of trusted parameters through.
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

View File

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

View File

@ -18,6 +18,14 @@
<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, required: true %></label></td>
</tr>
<tr>
<td><label><%= t('members.attributes.email') %></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><%= form.text_field :display_name, value: params[:display_name] %></td>
</tr>
<tr>
<td><%= t 'members.attributes.legal_name' %></td>
<td><%= form.text_field :legal_name, value: params[:legal_name] %></td>
</tr>
<tr>
<td><%= t 'members.attributes.email' %></td>
<td><%= form.text_field :email, value: params[:email] %></td>

View File

@ -15,6 +15,8 @@
<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.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.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>

View File

@ -4,6 +4,8 @@
<table class='lined'>
<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.category') %></td><td><%= @member.category %></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.eurocents %></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.delete_contribution'), delete_contribution_path(contribution) %></li>
</ul>

View File

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

View File

@ -5,8 +5,8 @@ MBWAY:
* Transferência bancária: PT50 0035 2178 00027478430 14
* Multibanco ou MBWAY: <%= @link %>
Caso queiras usufruir da quota reduzida de 6.00€ para estudantes,
desempregados e reformados, pedimos que nos envies um comprovativo desse
Caso queiras usufruir da quota reduzida de 6.00€ para estudantes, pessoas
desempregadas e reformadas, pedimos que nos envies um comprovativo desse
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

View File

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

View File

@ -51,7 +51,9 @@ pt:
number: "#"
status: "Estado"
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"
expires_on: "Data de expiração"
category: "Categoria"
@ -109,7 +111,7 @@ pt:
subject: "ANSOL - Suspensão de inscrição iminente"
cancelled:
subject: "ANSOL - Inscrição cancelada"
greetings: "Caro(a) %{display_name}"
greetings: "Car(a/o/e) %{display_name}"
sessions:
new:
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.
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
enable_extension "pgcrypto"
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 "wants_mailing_list", 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 ["number"], name: "index_members_on_number", unique: true
end