From 3f53b6b21b202e9d816b9e061db786d4aa929061 Mon Sep 17 00:00:00 2001 From: Torsten Date: Thu, 12 Jan 2023 14:34:26 +0200 Subject: [PATCH] story validation, member link --- app/models/story.rb | 3 +++ app/views/members/index.html.haml | 8 +++++--- app/views/members/show.html.haml | 7 +------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/models/story.rb b/app/models/story.rb index 6e110e0..1f6685e 100644 --- a/app/models/story.rb +++ b/app/models/story.rb @@ -3,6 +3,9 @@ class Story < ApplicationRecord mount_uploader :picture, PictureUploader + validates :text, length: { maximum: 1000 } + validates :header , length: { minimum: 5 } + def name header end diff --git a/app/views/members/index.html.haml b/app/views/members/index.html.haml index 1f8baf6..0995dd5 100644 --- a/app/views/members/index.html.haml +++ b/app/views/members/index.html.haml @@ -4,9 +4,11 @@ .grid.grid-cols-4 - @members.each do |member| .fex.flex-col.overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm.m-10 - = image_for( member , class: "h-60 w-full object-cover") - %h3.p-5.text-2xl.bg-gray-100.text-black.font-bold.text-center= member.name + =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 + = member.name %div.h-full .p-5.text-center .m-2.text-sm.leading-relaxed.line-clamp-3{ prose_classes } - = markdown(member.bio) + = shorten markdown(member.bio) diff --git a/app/views/members/show.html.haml b/app/views/members/show.html.haml index 22a8f36..6ee5b77 100644 --- a/app/views/members/show.html.haml +++ b/app/views/members/show.html.haml @@ -6,16 +6,11 @@ .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 - Role ? + Arrived %h5.mb-3.text-3xl.font-extrabold.leading-none.sm:text-4xl = @member.name .mb-8.text-gray-800 .prose= markdown(@member.bio) - .flex.items-center - %a.inline-flex.items-center.font-semibold.transition-colors.duration-200.text-deep-purple-accent-400.hover:text-deep-purple-800{"aria-label" => "", :href => "/"} - Learn More - %svg.inline-block.w-3.ml-2{:fill => "currentColor", :viewbox => "0 0 12 12"} - %path{:d => "M9.707,5.293l-5-5A1,1,0,0,0,3.293,1.707L7.586,6,3.293,10.293a1,1,0,1,0,1.414,1.414l5-5A1,1,0,0,0,9.707,5.293Z"} - if current_member == @member .flex.justify-around