add dates to members
This commit is contained in:
parent
3f53b6b21b
commit
a2215359dc
@ -48,6 +48,6 @@ class MembersController < ApplicationController
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def member_params
|
||||
params.require(:member).permit(:name, :public, :bio , :picture)
|
||||
params.require(:member).permit(:name, :public, :bio , :picture, :arrived ,:left)
|
||||
end
|
||||
end
|
||||
|
@ -9,4 +9,10 @@ module MembersHelper
|
||||
image_tag(image , alt: someone.name , class: classes )
|
||||
end
|
||||
|
||||
def stayed(member)
|
||||
return "Not arrived" if member.arrived.blank?
|
||||
text = member.arrived.to_s
|
||||
return text + " not left" if member.left.blank?
|
||||
text + " " + distance_of_time_in_words( member.left , member.arrived)
|
||||
end
|
||||
end
|
||||
|
@ -5,14 +5,17 @@
|
||||
.flex.flex-col
|
||||
%h1.text-4xl Editing profile
|
||||
|
||||
= simple_form_for @member , builder: SimpleForm::Tailwind::FormBuilder do |f|
|
||||
= simple_form_for @member do |f|
|
||||
= f.error_notification
|
||||
|
||||
.grid.grid-cols-4.mx-20
|
||||
.info.mr-8
|
||||
= f.input :name
|
||||
.grid.grid-cols-2.gap-10
|
||||
= f.input :arrived
|
||||
= f.input :left
|
||||
= f.input :public , label: "Public: (Click box below)"
|
||||
= f.input :picture , as: :file
|
||||
= f.input :picture , as: :file , label: (@member.picture.blank? ? "Add picture" : "Change picture")
|
||||
.flex.justify-center.actions.m-10
|
||||
= f.button :button, "Update", class: button_classes + " bg-cyan-200"
|
||||
= link_to member_path(@member) do
|
||||
|
@ -6,8 +6,10 @@
|
||||
.fex.flex-col.overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm.m-10
|
||||
=link_to member do
|
||||
= image_for( member , class: "h-60 w-full object-cover")
|
||||
%h3.p-5.text-2xl.bg-gray-100.text-black.font-bold.text-center
|
||||
%h3.pt-5.text-2xl.bg-gray-100.text-black.font-bold.text-center
|
||||
= member.name
|
||||
.p-2.text-xs.bg-gray-50.text-black.font-bold.text-center
|
||||
= stayed member
|
||||
%div.h-full
|
||||
.p-5.text-center
|
||||
.m-2.text-sm.leading-relaxed.line-clamp-3{ prose_classes }
|
||||
|
@ -6,7 +6,7 @@
|
||||
.flex.flex-col.justify-center.p-8.lg:p-16.lg:pl-10{:class => "lg:w-1/2"}
|
||||
%div
|
||||
%p.inline-block.px-3.py-px.mb-4.text-xs.font-semibold.tracking-wider.text-teal-900.uppercase.rounded-full.bg-teal-accent-400
|
||||
Arrived
|
||||
= stayed(@member)
|
||||
%h5.mb-3.text-3xl.font-extrabold.leading-none.sm:text-4xl
|
||||
= @member.name
|
||||
.mb-8.text-gray-800
|
||||
|
@ -13,7 +13,7 @@
|
||||
= f.input :picture , as: :file , label: (@story.picture.blank? ? "Add picture" : "Change picture")
|
||||
= f.input :header
|
||||
= f.input :text , input_html: {rows: rows(@story.text)}
|
||||
.mt-4= f.input :happened , class: "flex"
|
||||
= f.input :happened , wrapper_class: "flex mt-4 align-center"
|
||||
%button.mt-6.bg-cyan-200.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400
|
||||
= f.submit 'Save'
|
||||
%button.ml-20.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400
|
||||
|
6
db/migrate/20230112123705_add_arrived_to_memberss.rb
Normal file
6
db/migrate/20230112123705_add_arrived_to_memberss.rb
Normal file
@ -0,0 +1,6 @@
|
||||
class AddArrivedToMemberss < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
add_column :members, :arrived, :date
|
||||
add_column :members, :left, :date
|
||||
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.
|
||||
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_01_11_164425) do
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_01_12_123705) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
@ -42,6 +42,8 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_11_164425) do
|
||||
t.datetime "confirmed_at"
|
||||
t.datetime "confirmation_sent_at"
|
||||
t.string "unconfirmed_email"
|
||||
t.date "arrived"
|
||||
t.date "left"
|
||||
t.index ["email"], name: "index_members_on_email", unique: true
|
||||
t.index ["reset_password_token"], name: "index_members_on_reset_password_token", unique: true
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user