Add member preferences
This commit is contained in:
parent
4f190f67f0
commit
72d88e25ff
@ -66,7 +66,7 @@ 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)
|
params.fetch(:member, {}).permit(:display_name, :email, :identification_number, :category, :address, :joined_on, :expires_on, :wants_mailing_list, :prefers_postal)
|
||||||
end
|
end
|
||||||
|
|
||||||
def sort_params
|
def sort_params
|
||||||
|
@ -6,4 +6,12 @@ module ApplicationHelper
|
|||||||
def notification_status(status)
|
def notification_status(status)
|
||||||
t("notifications.status.#{status}")
|
t("notifications.status.#{status}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bool_option(value)
|
||||||
|
if value
|
||||||
|
t('option.positive')
|
||||||
|
else
|
||||||
|
t('option.negative')
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -34,6 +34,14 @@
|
|||||||
<td><label><%= t('members.attributes.address') %></label></td>
|
<td><label><%= t('members.attributes.address') %></label></td>
|
||||||
<td><%= form.text_area :address %></label></td>
|
<td><%= form.text_area :address %></label></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><label><%= t('members.attributes.wants_mailing_list') %></label></td>
|
||||||
|
<td><%= form.check_box :wants_mailing_list %></label></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><label><%= t('members.attributes.prefers_postal') %></label></td>
|
||||||
|
<td><%= form.check_box :prefers_postal %></label></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2"><%= t('members.edit.edit_dates_warning') %></td>
|
<td colspan="2"><%= t('members.edit.edit_dates_warning') %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
<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>
|
||||||
<tr><td><label><%= t('members.attributes.address') %></label></td><td><%= form.text_area :address %></label></td></tr>
|
<tr><td><label><%= t('members.attributes.address') %></label></td><td><%= form.text_area :address %></label></td></tr>
|
||||||
|
<tr><td><label><%= t('members.attributes.wants_mailing_list') %></label></td><td><%= form.check_box :wants_mailing_list %></label></td></tr>
|
||||||
|
<tr><td><label><%= t('members.attributes.prefers_postal') %></label></td><td><%= form.check_box :prefers_postal %></label></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
@ -8,6 +8,9 @@
|
|||||||
<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>
|
||||||
<tr><td><%= t('members.attributes.address') %></td><td><%= simple_format @member.address %></td></tr>
|
<tr><td><%= t('members.attributes.address') %></td><td><%= simple_format @member.address %></td></tr>
|
||||||
|
<tr><td><%= t('members.attributes.wants_mailing_list') %></td><td><%= bool_option @member.wants_mailing_list %></td></tr>
|
||||||
|
<tr><td><%= t('members.attributes.prefers_postal') %></td><td><%= bool_option @member.prefers_postal %></td></tr>
|
||||||
|
<tr><td><%= t('members.attributes.address') %></td><td><%= simple_format @member.address %></td></tr>
|
||||||
<tr><td><%= t('members.attributes.joined_on') %></td><td><%= @member.joined_on %></td></tr>
|
<tr><td><%= t('members.attributes.joined_on') %></td><td><%= @member.joined_on %></td></tr>
|
||||||
<tr><td><%= t('members.attributes.expires_on') %></td><td><%= @member.expires_on %></td></tr>
|
<tr><td><%= t('members.attributes.expires_on') %></td><td><%= @member.expires_on %></td></tr>
|
||||||
<tr><td><%= t('members.attributes.status') %></td><td><%= @member.status %></td></tr>
|
<tr><td><%= t('members.attributes.status') %></td><td><%= @member.status %></td></tr>
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
pt:
|
pt:
|
||||||
|
option:
|
||||||
|
positive: "Sim"
|
||||||
|
negative: "Não"
|
||||||
navigation:
|
navigation:
|
||||||
members: "Lista de membros"
|
members: "Lista de membros"
|
||||||
members:
|
members:
|
||||||
@ -46,6 +49,8 @@ pt:
|
|||||||
category: "Categoria"
|
category: "Categoria"
|
||||||
identification_number: "N.º de identificação"
|
identification_number: "N.º de identificação"
|
||||||
address: "Endereço postal"
|
address: "Endereço postal"
|
||||||
|
wants_mailing_list: "Inscrição na lista de correio"
|
||||||
|
prefers_postal: "Prefere comunicação postal"
|
||||||
status:
|
status:
|
||||||
any: "Qualquer"
|
any: "Qualquer"
|
||||||
active: "Activo"
|
active: "Activo"
|
||||||
|
8
db/migrate/20220625224650_add_preferences_to_members.rb
Normal file
8
db/migrate/20220625224650_add_preferences_to_members.rb
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
class AddPreferencesToMembers < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
change_table :members do |t|
|
||||||
|
t.boolean :wants_mailing_list, null: false, default: false
|
||||||
|
t.boolean :prefers_postal, null: false, default: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
4
db/schema.rb
generated
4
db/schema.rb
generated
@ -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_25_210821) do
|
ActiveRecord::Schema[7.0].define(version: 2022_06_25_224650) 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"
|
||||||
@ -41,6 +41,8 @@ ActiveRecord::Schema[7.0].define(version: 2022_06_25_210821) do
|
|||||||
t.string "regular_ifthenpay_link"
|
t.string "regular_ifthenpay_link"
|
||||||
t.string "reduced_ifthenpay_link"
|
t.string "reduced_ifthenpay_link"
|
||||||
t.boolean "excluded", default: false
|
t.boolean "excluded", default: false
|
||||||
|
t.boolean "wants_mailing_list", default: false, null: false
|
||||||
|
t.boolean "prefers_postal", default: false, null: false
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user