Skip to content
Snippets Groups Projects
Commit 38bb3d01 authored by pabois's avatar pabois
Browse files

close #210

parent f5aad396
No related branches found
No related tags found
No related merge requests found
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
# #
class Communication::Website < ApplicationRecord class Communication::Website < ApplicationRecord
include WithAbouts include WithAbouts
include WithConfigs
include WithGit include WithGit
include WithGitRepository include WithGitRepository
include WithImport include WithImport
...@@ -59,7 +60,7 @@ class Communication::Website < ApplicationRecord ...@@ -59,7 +60,7 @@ class Communication::Website < ApplicationRecord
def git_dependencies(website) def git_dependencies(website)
dependencies = ( dependencies = (
[self] + [self, config_permalinks, config_base_url] +
pages + pages.map(&:active_storage_blobs).flatten + pages + pages.map(&:active_storage_blobs).flatten +
posts + posts.map(&:active_storage_blobs).flatten + posts + posts.map(&:active_storage_blobs).flatten +
[index_for(:home)] + index_for(:home).active_storage_blobs + [index_for(:home)] + index_for(:home).active_storage_blobs +
......
class Communication::Website::Configs::BaseUrl < Communication::Website
def self.polymorphic_name
'Communication::Website::Configs::BaseUrl'
end
def git_path(website)
"config/production/config.yaml"
end
end
class Communication::Website::Configs::Permalinks < Communication::Website
def self.polymorphic_name
'Communication::Website::Configs::Permalinks'
end
def git_path(website)
"config/_default/permalinks.yaml"
end
end
...@@ -58,7 +58,7 @@ class Communication::Website::IndexPage < ApplicationRecord ...@@ -58,7 +58,7 @@ class Communication::Website::IndexPage < ApplicationRecord
end end
def git_dependencies(website) def git_dependencies(website)
[self] + active_storage_blobs + website.menus [self] + active_storage_blobs + website.menus + [website.config_permalinks]
end end
def git_destroy_dependencies(website) def git_destroy_dependencies(website)
......
module Communication::Website::WithConfigs
extend ActiveSupport::Concern
included do
def config_permalinks
@config_permalinks ||= Communication::Website::Configs::Permalinks.find(id)
end
def config_base_url
@config_base_url ||= Communication::Website::Configs::BaseUrl.find(id)
end
end
end
baseURL: <%= @website.url %>
posts: /<%= @website.index_for(:communication_posts).path %>/:year/:month/:day/:slug/
categories: /<%= @website.index_for(:communication_posts).path %>/:slug/
persons: /<%= @website.index_for(:persons).path %>/:slug/
authors: /<%= @website.index_for(:persons).path %>/:slug/<%= @website.index_for(:communication_posts).path %>/
<%# ces paths complémentaires sont nécessairesà Hugo mais on ne les utilise pas %>
<% if @website.about_school? %>
administrators: /<%= @website.index_for(:persons).path %>/:slug/roles/
teachers: /<%= @website.index_for(:persons).path %>/:slug/programs/
<% end %>
<% if @website.about_journal? %>
researchers: /<%= @website.index_for(:persons).path %>/:slug/articles/
<% end %>
...@@ -3,10 +3,11 @@ ...@@ -3,10 +3,11 @@
<div class="col-md-4"> <div class="col-md-4">
<div class="card flex-fill w-100"> <div class="card flex-fill w-100">
<div class="card-header"> <div class="card-header">
<h5 class="card-title mb-0"><%= t('content') %></h5> <h5 class="card-title mb-0"><%= t('metadata') %></h5>
</div> </div>
<div class="card-body"> <div class="card-body">
<%= f.input :name %> <%= f.input :name %>
<%= f.input :url %>
<%= f.input :about_type, <%= f.input :about_type,
collection: Communication::Website.about_types, collection: Communication::Website.about_types,
input_html: { data: { conditional: true } }, input_html: { data: { conditional: true } },
...@@ -44,20 +45,19 @@ ...@@ -44,20 +45,19 @@
<div class="col-md-8"> <div class="col-md-8">
<div class="card flex-fill w-100"> <div class="card flex-fill w-100">
<div class="card-header"> <div class="card-header">
<h5 class="card-title mb-0"><%= t('metadata') %></h5> <h5 class="card-title mb-0"><%= t('communication.website.git') %></h5>
</div> </div>
<div class="card-body"> <div class="card-body">
<p class="mt-4"><strong><%= t('communication.website.git') %></strong></p>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<%= f.input :url %> <%= f.input :git_provider, include_blank: false %>
<%= f.input :repository %>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<%= f.input :git_provider, include_blank: false %>
<%= f.input :access_token %> <%= f.input :access_token %>
</div> </div>
<div class="col-md-6">
<%= f.input :repository %>
</div>
</div> </div>
</div> </div>
......
{
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"16": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/16/-/16-0.0.2.tgz",
"integrity": "sha1-Hh9noWM+GADBZ+DnA9/wiQw+FTo=",
"requires": {
"numeric": "^1.2.6"
}
},
"cropperjs": {
"version": "1.5.12"
},
"jquery-cropper": {
"version": "1.0.1"
},
"notyf": {
"version": "3.10.0"
},
"numeric": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/numeric/-/numeric-1.2.6.tgz",
"integrity": "sha1-dlsCvvl5iPz4gNTrPza4D6MTNao="
},
"slug": {
"version": "5.1.0"
},
"sortablejs": {
"version": "1.14.0"
}
}
}
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
"npm": "8" "npm": "8"
}, },
"dependencies": { "dependencies": {
"16": "0.0.2",
"cropperjs": "^1.5.12", "cropperjs": "^1.5.12",
"jquery-cropper": "^1.0.1", "jquery-cropper": "^1.0.1",
"notyf": "^3.10.0", "notyf": "^3.10.0",
......
...@@ -2,6 +2,13 @@ ...@@ -2,6 +2,13 @@
# yarn lockfile v1 # yarn lockfile v1
"16@0.0.2":
version "0.0.2"
resolved "https://registry.yarnpkg.com/16/-/16-0.0.2.tgz#1e1f67a1633e1800c167e0e703dff0890c3e153a"
integrity sha1-Hh9noWM+GADBZ+DnA9/wiQw+FTo=
dependencies:
numeric "^1.2.6"
"@babel/parser@^7.16.4": "@babel/parser@^7.16.4":
version "7.17.3" version "7.17.3"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.17.3.tgz#b07702b982990bf6fdc1da5049a23fece4c5c3d0" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.17.3.tgz#b07702b982990bf6fdc1da5049a23fece4c5c3d0"
...@@ -134,6 +141,11 @@ notyf@^3.10.0: ...@@ -134,6 +141,11 @@ notyf@^3.10.0:
resolved "https://registry.yarnpkg.com/notyf/-/notyf-3.10.0.tgz#67a64443c69ea0e6495c56ea0f91198860163d06" resolved "https://registry.yarnpkg.com/notyf/-/notyf-3.10.0.tgz#67a64443c69ea0e6495c56ea0f91198860163d06"
integrity sha512-Mtnp+0qiZxgrH+TzVlzhWyZceHdAZ/UWK0/ju9U0HQeDpap1mZ8cC7H5wSI5mwgni6yeAjaxsTw0sbMK+aSuHw== integrity sha512-Mtnp+0qiZxgrH+TzVlzhWyZceHdAZ/UWK0/ju9U0HQeDpap1mZ8cC7H5wSI5mwgni6yeAjaxsTw0sbMK+aSuHw==
numeric@^1.2.6:
version "1.2.6"
resolved "https://registry.yarnpkg.com/numeric/-/numeric-1.2.6.tgz#765b02bef97988fcf880d4eb3f36b80fa31335aa"
integrity sha1-dlsCvvl5iPz4gNTrPza4D6MTNao=
picocolors@^1.0.0: picocolors@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c"
......
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