Skip to content
Snippets Groups Projects
Commit 20edc2d3 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

Back-office completed

parent ac979ab3
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@ class Admin::Communication::Extranets::Posts::CategoriesController < Admin::Comm
end
def show
@posts = @category.posts.ordered.page params[:page]
breadcrumb
end
......
......@@ -69,7 +69,7 @@ class Admin::Communication::Extranets::PostsController < Admin::Communication::E
:title, :summary, :text,
:published, :published_at, :slug,
:featured_image, :featured_image_delete, :featured_image_infos, :featured_image_alt, :featured_image_credit,
:author_id
:author_id, :category_id
)
.merge(
university_id: current_university.id
......
......@@ -41,6 +41,7 @@ class Communication::Extranet::Post < ApplicationRecord
include WithUniversity
belongs_to :author, class_name: 'University::Person', optional: true
belongs_to :category, class_name: 'Communication::Extranet::Post::Category', optional: true
belongs_to :extranet, class_name: 'Communication::Extranet'
validates :title, presence: true
......
......@@ -24,6 +24,7 @@ class Communication::Extranet::Post::Category < ApplicationRecord
include WithUniversity
belongs_to :extranet, class_name: 'Communication::Extranet'
has_many :posts
scope :ordered, -> { order(:name) }
......
......@@ -12,16 +12,14 @@
<div class="col-md-4">
<%= osuny_panel t('metadata') do %>
<% if can? :publish, post %>
<div class="row pure__row--small">
<div class="col-6">
<%= f.input :published %>
</div>
</div>
<%= f.input :published %>
<%= f.input :published_at, html5: true, as: :date %>
<% end %>
<%= f.association :category,
collection: @extranet.post_categories.ordered %>
<%= f.association :author,
collection: @extranet.connected_persons.ordered,
label_method: :to_s_alphabetical %>
collection: @extranet.connected_persons.ordered,
label_method: :to_s_alphabetical %>
<%= f.input :slug,
as: :string,
input_html: post.persisted? ? {} : {
......
<% content_for :title, @category %>
<%= render 'admin/communication/extranets/sidebar' do %>
<div class="row">
<div class="col-xl-8">
</div>
<div class="col-xl-4">
</div>
</div>
<%= render 'admin/communication/extranets/posts/list', posts: @posts %>
<%= paginate @posts, theme: 'bootstrap-5' %>
<% end %>
<% content_for :action_bar_left do %>
......
......@@ -25,6 +25,10 @@
</p>
</div>
</div>
<% if @post.category %>
<%= osuny_label Communication::Extranet::Post.human_attribute_name('category') %>
<p><%= link_to @post.category, [:admin, @post.category] %></p>
<% end %>
<% if @post.author %>
<%= osuny_label Communication::Extranet::Post.human_attribute_name('author') %>
<p><%= @post.author %></p>
......
......@@ -90,6 +90,7 @@ en:
published_at: Publication date
communication/extranet/post:
author: Author
category: Category
featured_image: Featured image
featured_image_alt: Alt text
featured_image_credit: Credit
......
......@@ -90,6 +90,7 @@ fr:
published_at: Date de publication
communication/extranet/post:
author: Auteur·rice
category: Catégorie
featured_image: Image à la une
featured_image_alt: Texte alternatif
featured_image_credit: Crédit
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment