Skip to content
Snippets Groups Projects
Commit 4381fbbe authored by alexisben's avatar alexisben
Browse files

Fix static data and backward compatibility

parent af44efdc
No related branches found
No related tags found
No related merge requests found
<a class="<%= button_classes('mb-4 me-1') %>" <a class="<%= button_classes('mb-4 me-1') %>"
v-on:click="data.elements.push({name: '', url: '', logo: {}})"> v-on:click="data.elements.push({id:'', name: '', url: '', logo: {}})">
<%= t '.add_partner' %> <%= t '.add_partner' %>
</a> </a>
<draggable :list="data.elements" class="list-group" handle=".partnerHandle"> <draggable :list="data.elements" class="list-group" handle=".partnerHandle">
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<select :id="'organization-' + index + '-id'" <select :id="'organization-' + index + '-id'"
class="form-select select" class="form-select select"
v-model="partner.id"> v-model="partner.id">
<option value="" :selected="!partner.id"><%= t '.unregistered_organization' %></option> <option value="" :selected="true"><%= t '.unregistered_organization' %></option>
<% current_university.organizations.ordered.each_with_index do |organization, index| %> <% current_university.organizations.ordered.each_with_index do |organization, index| %>
<option value="<%= organization.id %>"><%= organization.name %></option> <option value="<%= organization.id %>"><%= organization.name %></option>
<% end %> <% end %>
......
<% if block.data.has_key?('elements') %> <% if block.data.has_key?('elements') %>
<% block.data['elements'].each do |partner| %> <% block.data['elements'].each do |partner|
<% if partner['type'] == 'organization' %> id = partner['id']
<% organization = block.university.organizations.find partner['id'] %> if id != ''
<% if organization %> unless id.nil?
- is_organization: true unless id.empty?
id: <%= partner['id'] %> organization = block.university.organizations.find id %>
- id: "<%= id %>"
name: > name: >
<%= prepare_text_for_static organization.name %> <%= prepare_text_for_static organization.name %>
<% if organization.url %> url: <%= prepare_text_for_static organization.url %>
url: >-
<%= prepare_text_for_static organization.url %>
<% end %>
<% if organization.logo.attached? %> <% if organization.logo.attached? %>
logo: "<%= organization.logo.blob.id %>" logo: "<%= organization.logo.blob.id %>"
<% end %> <% end %>
<% end %> <% end
<% else %> end
else %>
- name: > - name: >
<%= prepare_text_for_static partner['name'] %> <%= prepare_text_for_static partner['name'] %>
url: >- url: >-
...@@ -23,4 +22,4 @@ ...@@ -23,4 +22,4 @@
logo: "<%= prepare_media_for_static partner, 'logo' %>" logo: "<%= prepare_media_for_static partner, 'logo' %>"
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>
\ No newline at end of file
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