Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Admin::Communication::Websites::Pages::ApplicationController < Admin::Comm

def breadcrumb
super
add_breadcrumb t('admin.communication.website.subnav.structure'),
add_breadcrumb Communication::Website::Page.model_name.human(count: 2),
admin_communication_website_pages_path
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def load_object

def breadcrumb
super
add_breadcrumb t('admin.communication.website.subnav.structure'),
add_breadcrumb Communication::Website::Page.model_name.human(count: 2),
admin_communication_website_pages_path
end

Expand Down
5 changes: 4 additions & 1 deletion app/models/communication/block/template/definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ class Communication::Block::Template::Definition < Communication::Block::Templat
def allowed_for_about?
!about.respond_to?(:extranet)
end


def empty?
elements.none?
end
end
4 changes: 4 additions & 0 deletions app/models/communication/block/template/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ def media_blobs
]
end

def empty?
image_component.blob.nil?
end

protected

def check_accessibility
Expand Down
4 changes: 4 additions & 0 deletions app/models/communication/block/template/timeline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ def allowed_for_about?
def children
elements
end

def empty?
elements.none?
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,13 @@ template ||= block.template
component = template.public_send "#{property}_component"
value = template.public_send property
depth ||= 3
# ---
# List
# ---
#
# No list for an image
# image:
# id: "6481e276-23c7-43bb-84aa-87820706ef27"
# file: "6481e276-23c7-43bb-84aa-87820706ef27"
# List for an image (removes the property name)
# - id: "1372a56a-8859-45b9-a7db-d6f9c0e1f38f"
# file: "1372a56a-8859-45b9-a7db-d6f9c0e1f38f
#
# No list for a string
# title: >-
# def 1
# List for a string
# - title: >-
# def 1
list ||= false
indentation = ' ' * depth
partial = "admin/communication/blocks/components/#{component.kind}/static"

local_assigns[:template] = template
local_assigns[:component] = component
local_assigns[:value] = value
local_assigns[:depth] = depth
local_assigns[:list] = list
local_assigns[:indentation] = indentation
%>
<%= render partial, **local_assigns -%>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= '- ' if list %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
<%
array = value&.compact_blank
%>
<% if list %>
<%= indentation %>- <%= raw array %>
<% else %>
<%= indentation %><%= property %>: <%= raw array %>
<% end %>
%><%= indentation %><%= property %>: <%= raw array %>
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
<% if list %>
<%= indentation %>- <%= property %>: >-
<%= indentation %> <%= prepare_code_for_static value, depth: depth + 2 %>
<% else %>
<%= indentation %><%= property %>: >-
<%= indentation %> <%= prepare_code_for_static value, depth: depth + 1 %>
<% end %>
<%= indentation %> <%= prepare_code_for_static value, depth: depth + 1 %>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= '- ' if list %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= '- ' if list %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<%
blob = component.blob
return unless blob
%>
<% if list %>
<%= indentation %>- id: "<%= blob.id %>"
<% else %>
<%= indentation %><%= property %>:
<%= indentation %> id: "<%= blob.id %>"
<% end %>
<%= indentation %> file: "<%= blob.id %>"
%><%= indentation %><%= property %>:
<%= indentation %> id: "<%= blob.id %>"
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<%
blob = component.blob
return unless blob
%>
<% if list %>
<%= indentation %>- id: "<%= blob.id %>"
<% else %>
<%= indentation %><%= property %>:
<%= indentation %> id: "<%= blob.id %>"
<% end %>
<%= indentation %> file: "<%= blob.id %>"
%><%= indentation %><%= property %>:
<%= indentation %> id: "<%= blob.id %>"
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= '- ' if list %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= '- ' if list %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= '- ' if list %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= '- ' if list %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= '- ' if list %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= '- ' if list %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= '- ' if list %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= '- ' if list %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= '- ' if list %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= '- ' if list %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= '- ' if list %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= '- ' if list %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= '- ' if list %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
<%
if list && value.present?
%><%= indentation %>- <%= property %>: >-
<%= indentation %> <%= prepare_html_for_static value %><%
else
%><%= osuny_static_html property, value, depth: depth+1 %><%
end
%>
<%= osuny_static_html property, value, depth: depth+1 %>
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
<%
if list && value.present?
%><%= indentation %>- <%= property %>: >-
<%= indentation %> <%= prepare_text_for_static value, depth: depth + 2 %><%
else
%><%= osuny_static_text property, value, depth: depth+1 %><%
end
%>
<%= osuny_static_text property, value, depth: depth+1 %>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
<%
if list && value.present?
%><%= indentation %>- <%= property %>: >-
<%= indentation %> <%= prepare_text_for_static value, depth: depth + 2 %><%
else
%><%= osuny_static_text property, value, depth: depth+1 %><%
end
%>
<%= osuny_static_text property, value, depth: depth+1 %>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<%= indentation %><%= property %>:
<%= indentation %> from: "<%= component.from %>"
<%= indentation %> to: "<%= component.to %>"
<%= indentation %> to: "<%= component.to %>"
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= indentation %><%= property %>: <%= value %>
<%= indentation %><%= property %>: <%= value %>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
block.template.elements.each do |element|
next if element.title.blank?
%>
<%= block_component_static block, :title, template: element, list: true, depth: 4 %>
-
<%= block_component_static block, :title, template: element, depth: 5 %>
<%= block_component_static block, :url, template: element, depth: 5 %>
<%= block_component_static block, :target_blank, template: element, depth: 5 %>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<%= render 'admin/application/contact_details/static', about: block.template, l10n: block.template, depth: 3 %>
timetable:
<% block.template.elements.each do |element| %>
<%= block_component_static block, :title, template: element, list: true, depth: 4 %>
-
<%= block_component_static block, :title, template: element, depth: 5 %>
<%= block_component_static block, :time_slot_morning, template: element, depth: 5 %>
<%= block_component_static block, :time_slot_afternoon, template: element, depth: 5 %>
<% end %>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<%= block_component_static block, :description %>
elements:
<% block.template.elements.each do |element| %>
<%= block_component_static block, :title, template: element, list: true, depth: 4 %>
-
<%= block_component_static block, :title, template: element, depth: 5 %>
<%= block_component_static block, :description, template: element, depth: 5 %>
<% end %>
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<%= block_component_static block, :description %>
elements:
<% block.template.elements.each do |element| %>
<%= block_component_static block, :title, template: element, list: true, depth: 4 %>
-
<%= block_component_static block, :title, template: element, depth: 5 %>
<%= block_component_static block, :description, template: element, depth: 5 %>
<%= block_component_static block, :image, template: element, depth: 5 %>
<%= block_component_static block, :alt, template: element, depth: 5 %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<%= block_component_static block, :description %>
files:
<% block.template.elements.each do |element| %>
<% next unless element.blob %>
<%= block_component_static block, :file, template: element, depth: 4, list: true %>
<%
block.template.elements.each do |element|
next unless element.blob %>
-
id: "<%= element.blob.id %>"<%# TODO legacy to remove %>
<%= block_component_static block, :title, template: element, depth: 5 %>
<%= block_component_static block, :file, template: element, depth: 5 %>
<%= block_component_static block, :image, template: element, depth: 5 %>
<% end %>
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<%= block_component_static block, :description %>
<%= block_component_static block, :layout %>
images:
<% block.template.elements.each do |element| %>
<% next unless element.blob %>
<%= block_component_static block, :image, template: element, depth: 4, list: true %>
<%
block.template.elements.each do |element|
next unless element.blob %>
-
<%= block_component_static block, :image, template: element, depth: 5 %>
<%= block_component_static block, :alt, template: element, depth: 5 %>
<%= block_component_static block, :credit, template: element, depth: 5 %>
<%= block_component_static block, :text, template: element, depth: 5 %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<%= block_options_static block %>
links:
<% block.template.elements.each do |element| %>
<%= block_component_static block, :title, template: element, depth: 4, list: true %>
-
<%= block_component_static block, :title, template: element, depth: 5 %>
<%= block_component_static block, :description, template: element, depth: 5 %>
<%= block_component_static block, :url, template: element, depth: 5 %>
external: <%= element.url_external?(@website) %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ else
next if element.best_name.blank?
quantity += 1
%>
<%= block_component_static block, :name, template: element, depth: 4, list: true %>
-
<%= block_component_static block, :name, template: element, depth: 5 %>
<%= block_component_static block, :url, template: element, depth: 5 %>
logo: "<%= element.logo_component.blob&.id %>"
external: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<%= block_component_static block, :layout %>
testimonials:
<% block.template.elements.each do |element| %>
<%= block_component_static block, :text, template: element, depth: 4, list: true %>
-
<%= block_component_static block, :text, template: element, depth: 5 %>
<%= block_component_static block, :author, template: element, depth: 5 %>
<%= block_component_static block, :job, template: element, depth: 5 %>
<%= block_component_static block, :photo, template: element, depth: 5 if element.photo %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<%= block_component_static block, :layout %>
events:
<% block.template.elements.each do |element| %>
<%= block_component_static block, :title, template: element, depth: 4, list: true %>
-
<%= block_component_static block, :title, template: element, depth: 5 %>
<%= block_component_static block, :text, template: element, depth: 5 %>
<% end %>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% content_for :title, t('admin.communication.website.subnav.structure') %>
<% content_for :title, Communication::Website::Page.model_name.human(count: 2) %>

<% content_for :title_right do %>
<%= create_link Communication::Website::Page %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/education/programs/_static_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ indentation = ' ' * depth
<%= indentation %> path: "<%= hugo.path %>"
<%= indentation %> slug: "<%= hugo.slug %>"
<%= indentation %> file: "<%= hugo.file %>"
<%= osuny_static_text 'label', program_l10n.to_s, depth: depth+1 %>
<%= osuny_static_text 'label', program_l10n.to_s, depth: depth-1 %>
<%
children = program.children.published_now_in(language).where(diploma: diploma)
# Limit to a global list of programs, for example on a location
Expand Down
2 changes: 0 additions & 2 deletions config/locales/communication/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,6 @@ en:
previous_paths: Redirects (old paths)
title: Manage redirects
see_showcase: See showcase
subnav:
structure: Structure
synchronize:
button: Synchronize
running: Synchronization launched, please be patient...
Expand Down
2 changes: 0 additions & 2 deletions config/locales/communication/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -638,8 +638,6 @@ fr:
previous_paths: Redirections (anciens chemins)
title: Gérer les redirections
see_showcase: Voir le showcase
subnav:
structure: Arborescence
synchronize:
button: Synchroniser
running: La synchronisation est lancée, un peu de patience...
Expand Down
Loading
Loading