Skip to content
Snippets Groups Projects
Unverified Commit 03235ddc authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

static

parent da92a09c
No related branches found
No related tags found
No related merge requests found
Showing with 11 additions and 10 deletions
...@@ -74,7 +74,7 @@ class Communication::Website::Permalink < ApplicationRecord ...@@ -74,7 +74,7 @@ class Communication::Website::Permalink < ApplicationRecord
def computed_path def computed_path
return nil unless published? return nil unless published?
@computed_path ||= published_path @computed_path ||= Static.clean_path(published_path)
end end
protected protected
...@@ -91,4 +91,5 @@ class Communication::Website::Permalink < ApplicationRecord ...@@ -91,4 +91,5 @@ class Communication::Website::Permalink < ApplicationRecord
def set_university def set_university
self.university_id = website.university_id self.university_id = website.university_id
end end
end end
...@@ -8,7 +8,7 @@ class Communication::Website::Permalink::Category < Communication::Website::Perm ...@@ -8,7 +8,7 @@ class Communication::Website::Permalink::Category < Communication::Website::Perm
end end
def self.pattern_in_website(website) def self.pattern_in_website(website)
"#{self.special_page(:communication_posts).path_without_language}:slug/" "#{website.special_page(:communication_posts).path_without_language}:slug/"
end end
protected protected
......
...@@ -13,7 +13,7 @@ module WithPermalinkInWebsite ...@@ -13,7 +13,7 @@ module WithPermalinkInWebsite
new_permalink = Communication::Website::Permalink.for_object(self, website) new_permalink = Communication::Website::Permalink.for_object(self, website)
# If the object had no permalink or if its path changed, we create a new permalink # If the object had no permalink or if its path changed, we create a new permalink
if last_permalink.nil? || new_permalink.computed_path.present? && last_permalink.path != new_permalink.computed_path if new_permalink.computed_path.present? && (last_permalink.nil? || last_permalink.path != new_permalink.computed_path)
last_permalink&.update(is_current: false) last_permalink&.update(is_current: false)
new_permalink.path = new_permalink.computed_path new_permalink.path = new_permalink.computed_path
new_permalink.save new_permalink.save
......
--- ---
title: "<%= @about.name %>" title: "<%= @about.name %>"
<%#= render 'admin/application/static/permalink' %> <%= render 'admin/application/static/permalink' %>
<% if @about.parent %> <% if @about.parent %>
parent: "<%= @about.parent.path %>" parent: "<%= @about.parent.path %>"
<% end %> <% end %>
......
--- ---
title: > title: >
<%= prepare_text_for_static @about.name %> <%= prepare_text_for_static @about.name %>
slug: "<%= @about.slug %>" <%= render 'admin/application/static/permalink' %>
short_name: > short_name: >
<%= prepare_text_for_static @about.short_name %> <%= prepare_text_for_static @about.short_name %>
level: <%= @about.level_i18n %> level: <%= @about.level_i18n %>
......
--- ---
title: > title: >
<%= @about.to_s %> <%= @about.to_s %>
slug: "<%= @about.slug %>" <%= render 'admin/application/static/permalink' %>
long_name: > long_name: >
<%= @about.long_name %> <%= @about.long_name %>
kind: "<%= @about.kind %>" kind: "<%= @about.kind %>"
......
--- ---
title: > title: >
Responsabilités de <%= @about.to_s %> Responsabilités de <%= @about.to_s %>
<%= render 'admin/application/static/permalink' %>
person: > person: >
<%= @about.to_s %> <%= @about.to_s %>
first_name: > first_name: >
<%= @about.first_name %> <%= @about.first_name %>
last_name: > last_name: >
<%= @about.last_name %> <%= @about.last_name %>
slug: "<%= @about.slug %>"
description: > description: >
<%= prepare_text_for_static @about.description %> <%= prepare_text_for_static @about.description %>
--- ---
--- ---
title: > title: >
Actualités de <%= @about.to_s %> Actualités de <%= @about.to_s %>
<%= render 'admin/application/static/permalink' %>
person: > person: >
<%= @about.to_s %> <%= @about.to_s %>
first_name: > first_name: >
<%= @about.first_name %> <%= @about.first_name %>
last_name: > last_name: >
<%= @about.last_name %> <%= @about.last_name %>
slug: "<%= @about.slug %>"
description: > description: >
<%= prepare_text_for_static @about.description %> <%= prepare_text_for_static @about.description %>
--- ---
--- ---
title: > title: >
Publications de <%= @about.to_s %> Publications de <%= @about.to_s %>
<%= render 'admin/application/static/permalink' %>
person: > person: >
<%= @about.to_s %> <%= @about.to_s %>
first_name: > first_name: >
<%= @about.first_name %> <%= @about.first_name %>
last_name: > last_name: >
<%= @about.last_name %> <%= @about.last_name %>
slug: "<%= @about.slug %>"
description: > description: >
<%= prepare_text_for_static @about.description %> <%= prepare_text_for_static @about.description %>
--- ---
--- ---
title: > title: >
Enseignements de <%= @about.to_s %> Enseignements de <%= @about.to_s %>
<%= render 'admin/application/static/permalink' %>
person: > person: >
<%= @about.to_s %> <%= @about.to_s %>
first_name: > first_name: >
<%= @about.first_name %> <%= @about.first_name %>
last_name: > last_name: >
<%= @about.last_name %> <%= @about.last_name %>
slug: "<%= @about.slug %>"
description: > description: >
<%= prepare_text_for_static @about.description %> <%= prepare_text_for_static @about.description %>
--- ---
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