mirror of
https://github.com/Growstuff/growstuff.git
synced 2025-12-24 01:57:46 -05:00
Posts - Ensure responsive (#3584)
* Fix model validations and responsiveness * Fix model validations and responsiveness * Update app/models/post.rb
This commit is contained in:
@@ -24,8 +24,11 @@ class Post < ApplicationRecord
|
||||
#
|
||||
# Validations
|
||||
validates :subject, presence: true, length: { maximum: 255 }
|
||||
validates :body, presence: true
|
||||
|
||||
def author_date_subject
|
||||
return unless author
|
||||
|
||||
# slugs are created before created_at is set
|
||||
time = created_at || Time.zone.now
|
||||
"#{author.login_name} #{time.strftime('%Y%m%d')} #{subject}"
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
%h1= @author ? t('.title.author_posts', author: @author) : t('.title.default')
|
||||
|
||||
.row
|
||||
.col-2
|
||||
.col-8= will_paginate @posts
|
||||
.col-md-2
|
||||
.col-md-8= will_paginate @posts
|
||||
.row
|
||||
.col-2
|
||||
.col-md-2
|
||||
= render 'layouts/nav', model: Post
|
||||
%hr/
|
||||
%p
|
||||
@@ -28,7 +28,7 @@
|
||||
or
|
||||
= succeed "." do
|
||||
= link_to "comments RSS feed", comments_path(format: 'rss')
|
||||
.col-10
|
||||
.col-md-10
|
||||
.row.posts
|
||||
- @posts.each do |post|
|
||||
.col-lg-3.col-md-6.mb-3.post
|
||||
|
||||
20
db/schema.rb
20
db/schema.rb
@@ -571,26 +571,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_01_14_045751) do
|
||||
t.index ["slug"], name: "index_seeds_on_slug", unique: true
|
||||
end
|
||||
|
||||
create_table "weather_observations", force: :cascade do |t|
|
||||
t.string "source"
|
||||
t.datetime "observation_at"
|
||||
t.integer "solar_uv_index"
|
||||
t.decimal "wind_speed_kmh"
|
||||
t.decimal "wind_gust_speed_kmh"
|
||||
t.string "wind_direction"
|
||||
t.decimal "air_temperature_centigrade"
|
||||
t.decimal "relative_humidity"
|
||||
t.decimal "precipitation_probability"
|
||||
t.decimal "dew_point_temperature_centigrade"
|
||||
t.decimal "pressure"
|
||||
t.integer "visibility_distance_metres"
|
||||
t.string "weather_type"
|
||||
t.bigint "owner_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["owner_id"], name: "index_weather_observations_on_owner_id"
|
||||
end
|
||||
|
||||
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
||||
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
||||
add_foreign_key "harvests", "plantings"
|
||||
|
||||
Reference in New Issue
Block a user