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

Fix #888

parent df6b1316
No related branches found
No related tags found
No related merge requests found
......@@ -56,6 +56,7 @@ class Admin::Communication::Extranets::FilesController < Admin::Communication::E
params.require(:communication_extranet_file)
.permit(
:name, :published, :published_at, :slug,
:file, :file_delete
)
.merge(
university_id: current_university.id
......
......@@ -28,6 +28,8 @@ class Communication::Extranet::File < ApplicationRecord
belongs_to :extranet, class_name: 'Communication::Extranet'
has_one_attached_deletable :file
validates :name, presence: true
def to_s
......
......@@ -6,6 +6,7 @@
<div class="col-md-8">
<%= osuny_panel t('content') do %>
<%= f.input :name %>
<%= f.input :file %>
<% end %>
</div>
<div class="col-md-4">
......
......@@ -3,16 +3,12 @@
<%= render 'admin/communication/extranets/sidebar' do %>
<div class="row">
<div class="col-xl-8">
<% if @file.file.attached? %>
<%= link_to @file.file.filename, @file.file.url, target: :_blank %>
<% end %>
</div>
<div class="col-xl-4">
<%
action = ''
# action += link_to t('open'),
# files_communication_extranet_file_url(@file, host: @file.extranet.url, extranet_id: nil),
# target: :_blank,
# class: 'btn btn-light btn-xs' if @file.published
%>
<%= osuny_panel t('metadata'), action: action do %>
<%= osuny_panel t('metadata') do %>
<div class="row pure__row--small">
<div class="col-6">
<%= osuny_label Communication::Extranet::File.human_attribute_name('published') %>
......
<div class="row mt-n5">
<% files.each do |file| %>
<div class="col-lg-4">
<div class="position-relative mt-5">
<p class="mt-2">
<b><%= file %></b><br>
<span class="text-muted"><%= l file.published_at.to_date %><span>
</p>
<%= link_to t('extranet.files.show'), files_communication_extranet_file_path(file), class: ' btn btn-outline-primary stretched-link' %>
</div>
</div>
<% end %>
</div>
\ No newline at end of file
<% content_for :title, Communication::Extranet.human_attribute_name(:feature_files) %>
<%= render 'extranet/files/files/list', files: @files %>
\ No newline at end of file
<div class="row mt-n5">
<% @files.each do |file| %>
<div class="col-lg-4">
<div class="position-relative mt-5">
<p class="mt-2">
<b><%= file %></b><br>
<span class="text-muted"><%= l file.published_at.to_date %><span>
</p>
<%= link_to t('extranet.files.download'),
file.file.url,
class: 'btn btn-primary',
target: :_blank if file.file.attached? %>
</div>
</div>
<% end %>
</div>
\ No newline at end of file
<% content_for :title, @post %>
......@@ -24,7 +24,6 @@ namespace :posts do
root to: 'posts#index'
end
namespace :files do
get ':id' => 'files#show', as: :communication_extranet_file
root to: 'files#index'
end
get 'account' => 'account#show', as: :account
......
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