Skip to content
Snippets Groups Projects
Unverified Commit 3b04c613 authored by Arnaud Levy's avatar Arnaud Levy Committed by GitHub
Browse files

Merge branch 'main' into publication-info

parents ca1d9c11 6dd11094
No related branches found
No related tags found
No related merge requests found
.photo_import
&__results
column-count: 2
column-gap: 16px
@include media-breakpoint-up(lg)
column-count: 3
&__result
max-width: 100%
display: block
margin-bottom: 16px
\ No newline at end of file
......@@ -13,6 +13,7 @@ class Server::WebsitesController < Server::ApplicationController
end
def manage_versions
@websites = @websites.with_repository.with_url
load_filters
breadcrumb
add_breadcrumb "Gestion des versions"
......
......@@ -95,10 +95,13 @@ class Communication::Website < ApplicationRecord
}
scope :for_update, -> (autoupdate) { where(autoupdate_theme: autoupdate) }
scope :for_updatable_theme, -> (status) { updatable_theme if status == 'true' }
scope :with_repository, -> { where.not(repository: [nil, '']) }
scope :with_url, -> { where.not(url: [nil, '']) }
scope :with_access_token, -> { where.not(access_token: [nil, '']) }
scope :updatable_theme, -> {
where.not(repository: [nil, '']).
where.not(access_token: [nil, '']).
where.not(url: [nil, ''])
with_repository.
with_url.
with_access_token
}
def to_s
......
......@@ -6,7 +6,7 @@ filters.each { |filter| should_be_open = true if params.has_key?(filter[:scope_n
<div class="filters">
<% if collapsable %>
<a class="btn btn-xs filters__button"
<a class="btn btn-xs mx-n2 filters__button"
data-bs-toggle="collapse"
href="#collapseFilters"
role="button"
......
......@@ -49,10 +49,10 @@ pexels_path = admin_communication_pexels_path(website_id: nil, extranet_id: nil,
<div class="modal-dialog modal-fullscreen modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<div class="col-auto">
<div class="col-auto d-none d-lg-block">
<h5 class="modal-title"><%= t 'photo_import.title' %></h5>
</div>
<div class="col-auto d-flex flex-fill mx-5">
<div class="col-auto d-flex flex-fill mx-lg-5">
<input type="text"
name="search"
placeholder="<%= t 'photo_import.placeholder' %>"
......@@ -69,39 +69,42 @@ pexels_path = admin_communication_pexels_path(website_id: nil, extranet_id: nil,
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
</div>
<div class="modal-body">
<div class="modal-body overflow-x-hidden" id="results">
<div class="row">
<div class="col-md-6">
<div class="photo_import__unsplash photo_import__unsplash__results row pure__row--small" ref="results">
<p v-if="unsplash.data.results.length === 0 || !unsplash.data" >
<%= t 'photo_import.nothing' %>
</p>
<div v-for="image in unsplash.data.results" class="col-6 col-lg-4">
<img :src="image.thumb"
:alt="image.alt"
v-on:click="selectUnsplash(image)"
class="img-fluid img-thumbnail mb-3">
</div>
<div class="col-lg-6">
<p v-if="unsplash.data.results.length === 0 || !unsplash.data" >
<%= t 'photo_import.nothing' %>
</p>
<div class="photo_import__results photo_import__unsplash photo_import__unsplash__results" ref="results">
<img :src="image.thumb"
:alt="image.alt"
v-for="image in unsplash.data.results" class="photo_import__results__result"
v-on:click="selectUnsplash(image)">
</div>
<p class="small text-muted" v-if="unsplash.data.total_pages">
{{unsplash.page}} / {{unsplash.data.total_pages }}
</p>
</div>
<div class="col-md-6">
<div class="photo_import__pexels photo_import__pexels__results row pure__row--small" ref="results">
<p v-if="pexels.data.results.length === 0 || !pexels.data" >
<%= t 'photo_import.nothing' %>
</p>
<div v-for="image in pexels.data.results" class="col-6 col-lg-4">
<img :src="image.thumb"
:alt="image.alt"
v-on:click="selectPexels(image)"
class="img-fluid img-thumbnail mb-3">
</div>
<div class="col-lg-6">
<p v-if="pexels.data.results.length === 0 || !pexels.data" >
<%= t 'photo_import.nothing' %>
</p>
<div class="photo_import__results photo_import__pexels photo_import__pexels__results" ref="results">
<img :src="image.thumb"
:alt="image.alt"
v-for="image in pexels.data.results"
v-on:click="selectPexels(image)"
class="photo_import__results__result">
</div>
<p class="small text-muted" v-if="pexels.data.total_pages">
{{pexels.page}} / {{pexels.data.total_pages }}
</p>
</div>
</div>
</div>
<div class="modal-footer d-block">
<div class="row">
<div class="col-md-6">
<div class="col-lg-6">
<div class="row photo_import__unsplash photo_import__unsplash__nav">
<div class="col-lg-5">
<a href="#"
......@@ -123,7 +126,7 @@ pexels_path = admin_communication_pexels_path(website_id: nil, extranet_id: nil,
</div>
</div>
</div>
<div class="col-md-6">
<div class="col-lg-6">
<div class="row photo_import__pexels photo_import__pexels__nav">
<div class="col-lg-5">
<a href="#"
......@@ -165,7 +168,7 @@ pexels_path = admin_communication_pexels_path(website_id: nil, extranet_id: nil,
per_page: 12,
lang: '<%= lang %>',
},
query: '<%= search || "" %>',
query: <%= search.to_json.html_safe %>,
unsplash: {
url: '<%= unsplash_path %>',
page: 1,
......@@ -204,7 +207,7 @@ pexels_path = admin_communication_pexels_path(website_id: nil, extranet_id: nil,
modalElement.addEventListener('show.bs.modal', function (){
this.isOpened = true;
this.research()
this.research();
}.bind(this));
modalElement.addEventListener('hide.bs.modal', function() {
......@@ -236,7 +239,7 @@ pexels_path = admin_communication_pexels_path(website_id: nil, extranet_id: nil,
},
searchUnsplash() {
var url = this.unsplash.url
+ '?query=' + this.query
+ '?query=' + encodeURIComponent(this.query)
+ '&page=' + this.unsplash.page
+ '&per_page=' + this.parameters.per_page
+ '&lang=' + this.parameters.lang
......@@ -244,7 +247,7 @@ pexels_path = admin_communication_pexels_path(website_id: nil, extranet_id: nil,
},
searchPexels() {
var url = this.pexels.url
+ '?query=' + this.query
+ '?query=' + encodeURIComponent(this.query)
+ '&page=' + this.pexels.page
+ '&per_page=' + this.parameters.per_page
+ '&lang=' + this.parameters.lang
......@@ -258,6 +261,7 @@ pexels_path = admin_communication_pexels_path(website_id: nil, extranet_id: nil,
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
source.data = JSON.parse(xmlHttp.responseText);
document.getElementById('results').scrollTop = 0;
}
}.bind(this);
xmlHttp.open("GET", url, false);
......
......@@ -2,7 +2,7 @@
title: >-
<%= prepare_text_for_static @about.title %>
<%= render 'admin/application/static/permalink' %>
<%= render 'admin/application/static/design', full_width: false, toc_offcanvas: false, toc_present: true %>
<%= render 'admin/application/static/design', full_width: false, toc_offcanvas: false %>
<%= render 'admin/application/static/breadcrumbs',
pages: @website.special_page(Communication::Website::Page::ResearchPaper).ancestors_and_self,
current: @about %>
......
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