This commit is contained in:
Hub Feenix Member 2023-01-24 17:31:54 +02:00
commit 07b09e54de
9 changed files with 49 additions and 9 deletions

View File

@ -26,6 +26,7 @@ gem 'thredded', '~> 1.0'
gem "simple_form" , "5.1.0" gem "simple_form" , "5.1.0"
gem "simple_form_tailwind_css" gem "simple_form_tailwind_css"
gem 'kaminari' gem 'kaminari'
gem 'ransack'
gem "passenger" , "6.0.15" , require: "phusion_passenger/rack_handler" gem "passenger" , "6.0.15" , require: "phusion_passenger/rack_handler"
gem "bootsnap", require: false gem "bootsnap", require: false

View File

@ -306,6 +306,10 @@ GEM
thor (~> 1.0) thor (~> 1.0)
zeitwerk (~> 2.5) zeitwerk (~> 2.5)
rake (13.0.6) rake (13.0.6)
ransack (3.2.1)
activerecord (>= 6.1.5)
activesupport (>= 6.1.5)
i18n
rb-fsevent (0.11.2) rb-fsevent (0.11.2)
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
@ -429,6 +433,7 @@ DEPENDENCIES
pg (~> 1.1) pg (~> 1.1)
pundit (~> 2.3) pundit (~> 2.3)
rails (~> 7.0) rails (~> 7.0)
ransack
ruby2js! ruby2js!
sassc-rails sassc-rails
selenium-webdriver selenium-webdriver

View File

@ -2,7 +2,9 @@ class StoriesController < ApplicationController
before_action :set_story, only: %i[ show edit update destroy ] before_action :set_story, only: %i[ show edit update destroy ]
def index def index
@stories = Story.all.page params[:page] @q = Story.ransack(params[:q])
@q.sorts = 'created_at desc' if @q.sorts.empty?
@stories = @q.result(distinct: true).page( params[:page])
end end
def show def show

View File

@ -9,27 +9,33 @@
%nav.mt-6{"aria-label" => "Footer Navigation - Services"} %nav.mt-6{"aria-label" => "Footer Navigation - Services"}
%ul.space-y-4.text-sm %ul.space-y-4.text-sm
%li %li
%a.text-gray-700.transition.hover:opacity-75{:href => "/local"} %a.text-gray-700.transition.hover:opacity-75{:href => "/local_area"}
Local Area Local Area
%li %li
%a.text-gray-700.transition.hover:opacity-75{:href => "/helsinki"} %a.text-gray-700.transition.hover:opacity-75{:href => "/helsinki_turku"}
Helsinki & Turkku Helsinki & Turkku
%li %li
%a.text-gray-700.transition.hover:opacity-75{:href => "/other_sites"} %a.text-gray-700.transition.hover:opacity-75{:href => "/in_summer"}
Other Sites In Summer
%li
%a.text-gray-700.transition.hover:opacity-75{:href => "/in_winter"}
In Winter
.col-span-2.sm:col-span-1 .col-span-2.sm:col-span-1
%p.font-medium.text-gray-900 Information %p.font-medium.text-gray-900 Information
%nav.mt-6{"aria-label" => "Footer Navigation - Hub Feenix"} %nav.mt-6{"aria-label" => "Footer Navigation - Hub Feenix"}
%ul.space-y-4.text-sm %ul.space-y-4.text-sm
%li %li
%a.text-gray-700.transition.hover:opacity-75{:href => "/info"} %a.text-gray-700.transition.hover:opacity-75{:href => "/info"}
Info Living @ Feenix Info
%li
%a.text-gray-700.transition.hover:opacity-75{:href => "/the_deal"}
About Volunteeing
%li %li
%a.text-gray-700.transition.hover:opacity-75{:href => "/arriving"} %a.text-gray-700.transition.hover:opacity-75{:href => "/arriving"}
Arriving Getting here
%li %li
%a.text-gray-700.transition.hover:opacity-75{:href => "/about"} %a.text-gray-700.transition.hover:opacity-75{:href => "/about"}
About About Hub Feenix
.col-span-2.sm:col-span-1 .col-span-2.sm:col-span-1
%p.font-medium.text-gray-900 People %p.font-medium.text-gray-900 People
%nav.mt-6{"aria-label" => "Footer Navigation - Hub Feenix"} %nav.mt-6{"aria-label" => "Footer Navigation - Hub Feenix"}

View File

@ -32,7 +32,7 @@
- if false - if false
%script{:src => "https://cdn.tailwindcss.com"} %script{:src => "https://cdn.tailwindcss.com"}
%body.max-w-screen-2xl.xl:mx-auto %body.xl:mx-auto{class: "max-w-[1920px]"}
= render "layouts/header" = render "layouts/header"
= render "layouts/messages" = render "layouts/messages"
= yield = yield

View File

@ -1,4 +1,10 @@
= paginate @stories = paginate @stories
.flex.justify-end
= sort_link(@q, :happened ,class: 'flex flex-nowrap text-md')
.border-r-4.mx-4
= sort_link(@q, :created_at , class: 'flex flex-nowrap text-md')
- @stories.each do |story| - @stories.each do |story|
= render_story(story) = render_story(story)

View File

@ -9,6 +9,7 @@ require 'mina/rbenv' # for rbenv support. (https://rbenv.org)
# branch - Branch name to deploy. (needed by mina/git) # branch - Branch name to deploy. (needed by mina/git)
set :application_name, 'volunteers' set :application_name, 'volunteers'
#set :domain, 'www.rubydesign.fi'
set :domain, '192.168.129.10' set :domain, '192.168.129.10'
set :deploy_to, '/home/feenix/volunteers' set :deploy_to, '/home/feenix/volunteers'
set :repository, "https://github.com/HubFeenixMakers/volunteers.git" set :repository, "https://github.com/HubFeenixMakers/volunteers.git"

View File

@ -0,0 +1,18 @@
require "ransack"
Ransack.configure do |config|
config.custom_arrows = {
up_arrow: '<div class="mt-1 ml-1 h-0 w-0 border-x-8 border-x-transparent border-b-[16px] border-b-blue-600"></div>',
down_arrow: '<div class="mt-1 ml-1 h-0 w-0 border-x-8 border-x-transparent border-t-[16px] border-t-blue-600"></div>',
}
# Change default search parameter key name.
# Default key name is :q
config.search_key = :q
# Raise errors if a query contains an unknown predicate or attribute.
# Default is true (do not raise error on unknown conditions).
config.ignore_unknown_conditions = false
config.hide_sort_order_indicators = false
end

View File

@ -11,6 +11,7 @@ module.exports = {
content: [ content: [
'./public/*.html', './public/*.html',
'./app/helpers/**/*.rb', './app/helpers/**/*.rb',
'./config/initializers/**/*.rb',
'./app/javascript/**/*.js', './app/javascript/**/*.js',
'./app/views/**/*.{erb,haml,html,slim}' , './app/views/**/*.{erb,haml,html,slim}' ,
fullname , fullname2 fullname , fullname2