fixed collection access on mobile

This commit is contained in:
2018-11-20 15:16:26 +01:00
parent 784d7c6b0f
commit 8f674817e0
18 changed files with 601 additions and 286 deletions
@@ -1,6 +1,6 @@
(function($,Drupal,drupalSettings){EdlpTheme=function(){var _ajax_settings=drupalSettings.edlp_ajax;var _$body=$('body');var _corpus_ready=false;var _$corpus_canvas;var _$row=$('main[role="main"]>.layout-content>.row');var _$ajaxLinks;var _audioPlayer;var _randomPlayer;var _compoPlayer;var _ajax_timing={start:0,end:0};var _corpus_promise;var _is_mobile=edlp_mobile.device_is_mobile;function init(){void 0;if(!_is_mobile){initEvents();_audioPlayer=new AudioPlayer();_compoPlayer=new CompoPlayer();checkLayout();initAjaxLinks();initHistory();initAudioLinksHover();}else{if(drupalSettings.path.isFront){initHomeMobile();}
_$body.attr('booted','booted');}};function initHomeMobile(){$('.field--name-field-notice, .index','.entrees .taxonomy-term.vocabulary-entrees').addClass('closed');$('.field--name-field-notice>.field__label','.entrees .taxonomy-term.vocabulary-entrees').on('click',onClickHomeMobileNotice);$('.index>.field__label','.entrees .taxonomy-term.vocabulary-entrees').on('click',onClickHomeMobileIndex);};function onClickHomeMobileNotice(e){toggleEntreeOpening($(this).parent(),'notice');};function onClickHomeMobileIndex(e){toggleEntreeOpening($(this).parent(),'index');};function toggleEntreeOpening($e,part){$e.toggleClass('closed').parents('.taxonomy-term.vocabulary-entrees.home_mobile').toggleClass(part+'-opened');}
_$body.attr('booted','booted');}};function initHomeMobile(){$('.field--name-field-notice, .index','.entrees .taxonomy-term.vocabulary-entrees').addClass('closed');$('[data-drupal-link-system-path="<front>"]','#block-mainnavigation').removeClass('is-active').attr('href','#collection');$('h2#block-mainnavigation-menu, a','#block-mainnavigation').on('click',onclickHomeMobileMenu);$('.field--name-field-notice>.field__label','.entrees .taxonomy-term.vocabulary-entrees').on('click',onClickHomeMobileNotice);$('.index>.field__label','.entrees .taxonomy-term.vocabulary-entrees').on('click',onClickHomeMobileIndex);};function onclickHomeMobileMenu(e){$('#block-mainnavigation').toggleClass('visible');};function onClickHomeMobileNotice(e){toggleEntreeOpening($(this).parent(),'notice');};function onClickHomeMobileIndex(e){toggleEntreeOpening($(this).parent(),'index');};function toggleEntreeOpening($e,part){$e.toggleClass('closed').parents('.taxonomy-term.vocabulary-entrees.home_mobile').toggleClass(part+'-opened');}
function initEvents(){var $corpus_df=$.Deferred();_corpus_promise=$corpus_df.promise();_$body.on('corpus-map-ready',function(e){onCorpusMapReady(e);$corpus_df.resolve();}).on('on-studio-chutier-updated',initAjaxLinks).on('studio-initialized',function(e){_compoPlayer.newCompo();}).on('studio-not-active',function(e){_compoPlayer.deactivate();}).on('on-studio-compo-updated',function(e){initAjaxLinks();_compoPlayer.refresh();}).on('on-studio-compo-opened',function(e){initAjaxLinks();_compoPlayer.newCompo();}).on('search-results-loaded',function(e){initAjaxLinks();initAudioLinksHover();checkVisibleCorpusMapSpace();}).on('open_entree',function(e){void 0;closeAllModals();checkLayout();_$body.removeClass();if(typeof e.url!='undefined'){var state=getSysPathState(e.sys_path);history.pushState(state,null,e.url);if(typeof _paq!=='undefined'){_paq.push(['setCustomUrl',e.url]);_paq.push(['setDocumentTitle',e.title]);_paq.push(['trackPageView']);}}}).on('close_entree',function(e){backToFrontPage();checkLayout();});window.addEventListener('resize',checkLayout,false);}
function checkLayout(){var $audioplayer=$("#audio-player");if($audioplayer.length){var navpos=$('#block-mainnavigation').position();if(typeof navpos!='undefined'){$audioplayer.css({'width':navpos.left+'px'});}}
checkGridBlockHeight();checkGridBlockVisible();};function initScrollbars(){};function getSysPathState(sys_path,view_mode){var state={'sys_path':sys_path,'ajax_path':sys_path};var node_match=state.ajax_path.match(/^\/?(node\/(\d+))$/i);void 0;var term_match=state.ajax_path.match(/^\/?(taxonomy\/term\/(\d+))$/i);void 0;if(node_match){state.ajax_path=_ajax_settings.entityjson_path+'/'+node_match[1];state.node_nid=node_match[2];if(view_mode){state.ajax_path+='/'+view_mode;state.view_mode=view_mode;}}else if(term_match){state.ajax_path=_ajax_settings.entityjson_path+'/'+term_match[1];state.ajax_path=state.ajax_path.replace(/taxonomy\/term/,'taxonomy_term');state.entree_tid=term_match[2];if(view_mode){state.ajax_path+='/'+view_mode;state.view_mode=view_mode;}else{state.ajax_path=null;}}else{state.ajax_path+='/ajax'}
File diff suppressed because one or more lines are too long
@@ -65,11 +65,21 @@
function initHomeMobile(){
$('.field--name-field-notice, .index', '.entrees .taxonomy-term.vocabulary-entrees')
.addClass('closed');
$('[data-drupal-link-system-path="<front>"]','#block-mainnavigation')
.removeClass('is-active')
.attr('href', '#collection');
$('h2#block-mainnavigation-menu, a', '#block-mainnavigation')
.on('click', onclickHomeMobileMenu);
// $('a', '#block-mainnavigation')
// .on('click', onclickHomeMobileMenu);
$('.field--name-field-notice>.field__label', '.entrees .taxonomy-term.vocabulary-entrees')
.on('click', onClickHomeMobileNotice);
$('.index>.field__label', '.entrees .taxonomy-term.vocabulary-entrees')
.on('click', onClickHomeMobileIndex);
};
function onclickHomeMobileMenu(e){
$('#block-mainnavigation').toggleClass('visible');
};
function onClickHomeMobileNotice(e){
// console.log('onClickHomeMobileNotice');
// var $part = $(this).parent();//parents('.taxonomy-term');
@@ -156,13 +156,58 @@ header[role="banner"]{
}
}
html.is-mobile &{
// outline: 1px solid orange;
// outline: 1px solid blue;
margin-top:4px;
li{
a{
font-size: 0.680em;
padding:0; margin:0;
width:50px; //height:25px;
overflow: visible;
$square-size:15px;
>h2#block-mainnavigation-menu.visually-hidden{
// outline: 1px solid green;
right:0;
clip: auto;
margin:0;
text-indent: 100px;
cursor: pointer;
width:$square-size*2; height:$square-size*2;
background-size:$square-size $square-size;
background-color: white;
background-repeat: repeat;
background-image:
// hiddings off-square lines
linear-gradient(90deg, white 0, white 2px, transparent 2px, transparent),
linear-gradient(90deg, transparent 0, transparent $square-size - 2, white $square-size - 2, white),
linear-gradient(0deg, white 0, white 2px, transparent 2px, transparent),
linear-gradient(0deg, transparent 0, transparent $square-size - 2, white $square-size - 2, white),
// drawing the lines
linear-gradient(90deg, transparent 0, transparent 2px, red 2px, transparent 3px, transparent),
linear-gradient(90deg, transparent 0, transparent $square-size - 3, red $square-size - 3, transparent $square-size - 2, transparent),
linear-gradient(0deg, transparent 0, transparent 2px, red 2px, transparent 3px, transparent),
linear-gradient(0deg, transparent 0, transparent $square-size - 3, red $square-size - 3, transparent $square-size - 2, transparent);
}
ul.menu{
// outline: 1px solid orange;
border-top: 1px solid red;
border-bottom: 1px solid red;
position:absolute;
background-color: white;
width:300px;
padding: 1em;
top:$square-size * 3; left:100px;
transition: left 0.2s ease-in-out;
li{
&:first-of-type{
display:block;
}
a{
font-size: 0.680em;
padding:0; margin:0;
}
}
}
&.visible ul.menu{
left:-130px;
}
}
}
@@ -405,6 +450,7 @@ main[role="main"]{
@include content_courant;
}
}
}
article.node--type-evenement{
@@ -533,11 +579,65 @@ main[role="main"]{
}
}
html.is-mobile & .entrees{
#collection{
margin-top: -80px;
margin-bottom: 80px;
}
h3{
@include content_titles;
text-align: center;
padding-top: 0.5em;
}
article.node--type-enregistrement{
margin:0.7em 0 0 0;
h2.node-title{
margin: 0;
}
div.entrees{
@include entree-micro-square;
}
p{margin: 0;}
}
}
div.taxonomy-term.vocabulary-entrees.home_mobile{
// &:not(:first-of-type){
padding-bottom: 1em;
border-bottom: 1px solid red;
// border-bottom: 1px solid red;
// }
> h2{
white-space:nowrap;
&:before{
content: "";
display:inline-block;
$sq:10px;
width: $sq; height:$sq;
border: 1px solid #000;
margin-right: 0.5em;
}
div{display: inline-block;}
}
&[tid='134']{>h2:before{border-color: var(--e-col-134);}}
&[tid='121']{>h2:before{border-color: var(--e-col-121);}}
&[tid='125']{>h2:before{border-color: var(--e-col-125);}}
&[tid='119']{>h2:before{border-color: var(--e-col-119);}}
&[tid='132']{>h2:before{border-color: var(--e-col-132);}}
&[tid='122']{>h2:before{border-color: var(--e-col-122);}}
&[tid='129']{>h2:before{border-color: var(--e-col-129);}}
&[tid='120']{>h2:before{border-color: var(--e-col-120);}}
&[tid='130']{>h2:before{border-color: var(--e-col-130);}}
&[tid='118']{>h2:before{border-color: var(--e-col-118);}}
&[tid='127']{>h2:before{border-color: var(--e-col-127);}}
&[tid='133']{>h2:before{border-color: var(--e-col-133);}}
&[tid='128']{>h2:before{border-color: var(--e-col-128);}}
&[tid='124']{>h2:before{border-color: var(--e-col-124);}}
&[tid='116']{>h2:before{border-color: var(--e-col-116);}}
&[tid='117']{>h2:before{border-color: var(--e-col-117);}}
&[tid='131']{>h2:before{border-color: var(--e-col-131);}}
&[tid='126']{>h2:before{border-color: var(--e-col-126);}}
&[tid='123']{>h2:before{border-color: var(--e-col-123);}}
.field--name-field-notice, .index{
>.field__label{
cursor: pointer;
@@ -668,6 +768,8 @@ main[role="main"]{
.audiofield label{display: none;}
}
}
@@ -17,13 +17,15 @@
#}
<div class="grid">
{% for node in nodes %}
<div class="col small-col-12 med-col-4 large-col-{{ node.cols }}">
<div class="wrapper">
{{ node.build }}
{% if nodes %}
{% for node in nodes %}
<div class="col small-col-12 med-col-4 large-col-{{ node.cols }}">
<div class="wrapper">
{{ node.build }}
</div>
</div>
</div>
{% endfor %}
{% endfor %}
{% endif %}
{% if lastdocs %}
<div class="lastdocs-home col small-col-12 med-col-4 large-col-2">
@@ -0,0 +1,99 @@
{#
/**
* @file
* Theme override to display a node.
*
* Available variables:
* - node: The node entity with limited access to object properties and methods.
* Only method names starting with "get", "has", or "is" and a few common
* methods such as "id", "label", and "bundle" are available. For example:
* - node.getCreatedTime() will return the node creation timestamp.
* - node.hasField('field_example') returns TRUE if the node bundle includes
* field_example. (This does not indicate the presence of a value in this
* field.)
* - node.isPublished() will return whether the node is published or not.
* Calling other methods, such as node.delete(), will result in an exception.
* See \Drupal\node\Entity\Node for a full list of public properties and
* methods for the node object.
* - label: The title of the node.
* - content: All node items. Use {{ content }} to print them all,
* or print a subset such as {{ content.field_example }}. Use
* {{ content|without('field_example') }} to temporarily suppress the printing
* of a given child element.
* - author_picture: The node author user entity, rendered using the "compact"
* view mode.
* - metadata: Metadata for this node.
* - date: Themed creation date field.
* - author_name: Themed author name field.
* - url: Direct URL of the current node.
* - display_submitted: Whether submission information should be displayed.
* - attributes: HTML attributes for the containing element.
* The attributes.class element may contain one or more of the following
* classes:
* - node: The current template type (also known as a "theming hook").
* - node--type-[type]: The current node type. For example, if the node is an
* "Article" it would result in "node--type-article". Note that the machine
* name will often be in a short form of the human readable label.
* - node--view-mode-[view_mode]: The View Mode of the node; for example, a
* teaser would result in: "node--view-mode-teaser", and
* full: "node--view-mode-full".
* The following are controlled through the node publishing options.
* - node--promoted: Appears on nodes promoted to the front page.
* - node--sticky: Appears on nodes ordered above other non-sticky nodes in
* teaser listings.
* - node--unpublished: Appears on unpublished nodes visible only to site
* admins.
* - title_attributes: Same as attributes, except applied to the main title
* tag that appears in the template.
* - content_attributes: Same as attributes, except applied to the main
* content tag that appears in the template.
* - author_attributes: Same as attributes, except applied to the author of
* the node tag that appears in the template.
* - title_prefix: Additional output populated by modules, intended to be
* displayed in front of the main title tag that appears in the template.
* - title_suffix: Additional output populated by modules, intended to be
* displayed after the main title tag that appears in the template.
* - view_mode: View mode; for example, "teaser" or "full".
* - teaser: Flag for the teaser state. Will be true if view_mode is 'teaser'.
* - page: Flag for the full page state. Will be true if view_mode is 'full'.
* - readmore: Flag for more state. Will be true if the teaser content of the
* node cannot hold the main body content.
* - logged_in: Flag for authenticated user status. Will be true when the
* current user is a logged-in member.
* - is_admin: Flag for admin user status. Will be true when the current user
* is an administrator.
*
* @see template_preprocess_node()
*
* @todo Remove the id attribute (or make it a class), because if that gets
* rendered twice on a page this is invalid CSS for example: two lists
* in different view modes.
*/
#}
{%
set classes = [
'node',
'node--type-' ~ node.bundle|clean_class,
node.isPromoted() ? 'node--promoted',
node.isSticky() ? 'node--sticky',
not node.isPublished() ? 'node--unpublished',
view_mode ? 'node--view-mode-' ~ view_mode|clean_class,
]
%}
{{ attach_library('classy/node') }}
<article{{ attributes.addClass(classes) }}>
<div class="entrees">
{# THIS IS REALLY DIRTY !! #}
{% for key, child in content.field_entrees if key|first != '#' %}
{% set tid = child['#cache']['tags'][0]|replace({'taxonomy_term:':''}) %}
<span class="entree" tid="{{ tid }}" title="{{ child }}"></span>
{% endfor %}
</div>
<h2{{ title_attributes.addClass('node-title') }}>
<a href="{{ url }}" rel="bookmark" {{ link_attributes }}>{{ label }}</a>
</h2>
<div{{ content_attributes.addClass('node__content') }}>
{{ content|without('field_entrees') }}
</div>
</article>
@@ -30,7 +30,7 @@
view_mode
]
%}
<div{{ attributes.setAttribute('id', 'taxonomy-term-' ~ term.id).addClass(classes) }}>
<div{{ attributes.setAttribute('id', 'taxonomy-term-' ~ term.id).setAttribute('tid', term.id).addClass(classes) }}>
{{ title_prefix }}
{% if not page %}
<h2>{{ name }}</h2>