diff --git a/app/assets/stylesheets/admin/commons/photo-import.sass b/app/assets/stylesheets/admin/commons/photo-import.sass new file mode 100644 index 0000000000000000000000000000000000000000..226833406979e1e8fe5f86519ec4a73a0fc2bcca --- /dev/null +++ b/app/assets/stylesheets/admin/commons/photo-import.sass @@ -0,0 +1,10 @@ +.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 diff --git a/app/controllers/server/websites_controller.rb b/app/controllers/server/websites_controller.rb index 033ac3daa4b5da0a4fbaea8ca29930baee5b94cc..c9e5f860e02af8b2e28fcdae197d8180279ad7e1 100644 --- a/app/controllers/server/websites_controller.rb +++ b/app/controllers/server/websites_controller.rb @@ -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" diff --git a/app/models/communication/website.rb b/app/models/communication/website.rb index 25b5601f4effc8a0a96f2914d23403bf51d40359..6ddbe5fa873f3d02ac901137855b229b5555a900 100644 --- a/app/models/communication/website.rb +++ b/app/models/communication/website.rb @@ -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 diff --git a/app/views/admin/application/_filters.html.erb b/app/views/admin/application/_filters.html.erb index 2488457c83f30e551f3f4d23461fa8891156d476..48239c2596647ed121a5ef4e868506930e1afe65 100644 --- a/app/views/admin/application/_filters.html.erb +++ b/app/views/admin/application/_filters.html.erb @@ -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" diff --git a/app/views/admin/communication/photo_imports/_selector.html.erb b/app/views/admin/communication/photo_imports/_selector.html.erb index 45aca8d0ffd90fd7e873c9e4837483b30496adf1..3e1514af1548e3da8d3d36cc9b071f3ea49b8177 100644 --- a/app/views/admin/communication/photo_imports/_selector.html.erb +++ b/app/views/admin/communication/photo_imports/_selector.html.erb @@ -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); diff --git a/app/views/admin/research/journals/papers/static.html.erb b/app/views/admin/research/journals/papers/static.html.erb index 948beb305831459c37edf8ae1c5dbc1217d61444..ce7217b7bb0e2c8252daf15daf875a2ea0597bf1 100644 --- a/app/views/admin/research/journals/papers/static.html.erb +++ b/app/views/admin/research/journals/papers/static.html.erb @@ -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 %>