diff --git a/app/models/communication/website/author.rb b/app/models/communication/website/author.rb index af2d5d4dcc6c8639505f06bdf11c30fc6db569ae..a81414d3d43dd521f43c9f78d1275aa91afed90e 100644 --- a/app/models/communication/website/author.rb +++ b/app/models/communication/website/author.rb @@ -4,6 +4,7 @@ # # id :uuid not null, primary key # first_name :string +# github_path :text # last_name :string # slug :string # created_at :datetime not null @@ -25,6 +26,7 @@ # fk_rails_... (user_id => users.id) # class Communication::Website::Author < ApplicationRecord + include WithGithub include WithSlug has_rich_text :biography @@ -43,4 +45,16 @@ class Communication::Website::Author < ApplicationRecord "#{last_name} #{first_name}" end + def github_path_generated + "_authors/#{slug}.html" + end + + def to_jekyll + ApplicationController.render( + template: 'admin/communication/website/authors/jekyll', + layout: false, + assigns: { author: self } + ) + end + end diff --git a/app/models/communication/website/category.rb b/app/models/communication/website/category.rb index c1e4482a63cc429fa9fb0a002293f8f208da8593..a843e2e312325ac47d3bd49d78e608a86f7ac2cd 100644 --- a/app/models/communication/website/category.rb +++ b/app/models/communication/website/category.rb @@ -4,6 +4,7 @@ # # id :uuid not null, primary key # description :text +# github_path :text # name :string # position :integer # slug :string @@ -26,6 +27,7 @@ # fk_rails_... (university_id => universities.id) # class Communication::Website::Category < ApplicationRecord + include WithGithub include WithSlug include WithTree @@ -68,6 +70,18 @@ class Communication::Website::Category < ApplicationRecord "#{name}" end + def github_path_generated + "_categories/#{slug}.html" + end + + def to_jekyll + ApplicationController.render( + template: 'admin/communication/website/categories/jekyll', + layout: false, + assigns: { category: self } + ) + end + protected def set_position diff --git a/app/models/communication/website/post.rb b/app/models/communication/website/post.rb index 83961a465ddaee46e380a34d470cf3dba702a6c7..23d4a915ea70d535257628c0abee654834e66777 100644 --- a/app/models/communication/website/post.rb +++ b/app/models/communication/website/post.rb @@ -30,8 +30,8 @@ # fk_rails_... (university_id => universities.id) # class Communication::Website::Post < ApplicationRecord - include WithSlug include WithGithub + include WithSlug has_rich_text :text has_one_attached_deletable :featured_image diff --git a/db/schema.rb b/db/schema.rb index f89c01b42b6352b908f1a447de0a7d51ae7fef31..3c1ccf9ec7ee9ada59f282eadb55d247067b9d5b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_10_28_123841) do +ActiveRecord::Schema.define(version: 2021_10_28_155138) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" @@ -87,6 +87,7 @@ ActiveRecord::Schema.define(version: 2021_10_28_123841) do t.string "slug" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false + t.text "github_path" t.index ["communication_website_id"], name: "idx_comm_website_authors_on_communication_website_id" t.index ["university_id"], name: "index_communication_website_authors_on_university_id" t.index ["user_id"], name: "index_communication_website_authors_on_user_id" @@ -102,6 +103,7 @@ ActiveRecord::Schema.define(version: 2021_10_28_123841) do t.datetime "updated_at", precision: 6, null: false t.string "slug" t.uuid "parent_id" + t.text "github_path" t.index ["communication_website_id"], name: "idx_communication_website_post_cats_on_communication_website_id" t.index ["parent_id"], name: "index_communication_website_categories_on_parent_id" t.index ["university_id"], name: "index_communication_website_categories_on_university_id"