init
This commit is contained in:
152
templates/Webzine/edit.html.twig
Executable file
152
templates/Webzine/edit.html.twig
Executable file
@ -0,0 +1,152 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block localstyle %}
|
||||
.webzinepages { text-align:center }
|
||||
.webzinepages div { padding:5px ; margin:5px;}
|
||||
.webzinepages img {
|
||||
width: 100px;
|
||||
}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{{ form_start(form) }}
|
||||
<h1 class="page-header">
|
||||
{% if mode=="update" %}
|
||||
Modification WEBZINE
|
||||
{% elseif mode=="submit" %}
|
||||
Création WEBZINE
|
||||
{% endif %}
|
||||
</h1>
|
||||
|
||||
{{ form_widget(form.submit) }}
|
||||
|
||||
{% if by=="console" %}
|
||||
<a class="btn btn-secondary" href={{ path('app_webzine') }}>Annuler</a>
|
||||
{% else %}
|
||||
<a class="btn btn-secondary" href={{ path('app_home') }}>Annuler</a>
|
||||
{% endif %}
|
||||
|
||||
{% if mode=="update" %}
|
||||
<a href="{{ path('app_webzine_delete',{'id':webzine.id, 'by':by}) }}"
|
||||
class="btn btn-danger float-right"
|
||||
data-method="delete"
|
||||
data-confirm="Êtes-vous sûr de vouloir supprimer cet entregistrement ?">
|
||||
Supprimer
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<br><br>
|
||||
|
||||
{% if app.session.flashbag.has('error') %}
|
||||
<div class='alert alert-danger' style='margin: 5px 0px'>
|
||||
<strong>Erreur</strong><br>
|
||||
{% for flashMessage in app.session.flashbag.get('error') %}
|
||||
{{ flashMessage }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if app.session.flashbag.has('notice') %}
|
||||
<div class='alert alert-info' style='margin: 5px 0px'>
|
||||
<strong>Information</strong><br>
|
||||
{% for flashMessage in app.session.flashbag.get('notice') %}
|
||||
{{ flashMessage }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Informations
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{ form_row(form.name) }}
|
||||
{{ form_row(form.set) }}
|
||||
{{ form_row(form.order) }}
|
||||
{{ form_row(form.mode) }}
|
||||
{{ form_row(form.description) }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Planches
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<a class="btn btn-info" style="width:100%; margin-bottom:10px" onClick="ModalLoad('extraLargeModal','Planches','{{ path('app_webzine_upload') }}');" title='Ajouter des Planches'>Télécharger les Planches du Webzine</a>
|
||||
|
||||
<div class="webzinepages">
|
||||
{% for page in webzine.webzinepages %}
|
||||
<div id="div_{{ page.illustration|replace({'.':''}) }}">
|
||||
<img id="{{ page.illustration }}" src="/{{ appAlias }}/uploads/webzine/thumbori_{{ page.illustration }}"><br>
|
||||
<a style="cursor:pointer" onclick="removeLinkPage('{{ page.illustration }}')"><i class='fa fa-trash fa-fw'></i></a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ form_end(form) }}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block localjavascript %}
|
||||
$(document).ready(function() {
|
||||
$("#webzine_name").focus();
|
||||
|
||||
var linkpages="";
|
||||
{% for page in webzine.webzinepages %}
|
||||
if(linkpages=="")
|
||||
linkpages+="{{ page.illustration }}";
|
||||
else
|
||||
linkpages+=",{{ page.illustration }}";
|
||||
{% endfor %}
|
||||
|
||||
$("#webzine_linkpages").val(linkpages);
|
||||
|
||||
$(".webzinepages").sortable({
|
||||
tolerance: 'pointer',
|
||||
revert: '100',
|
||||
opacity: 0.6,
|
||||
forceHelperSize: true,
|
||||
delay: 50,
|
||||
itemSelector: 'img',
|
||||
axis: "y",
|
||||
cursor: "move",
|
||||
|
||||
update: function( event, ui )
|
||||
{
|
||||
var order = [];
|
||||
$('.webzinepages img').each( function(e) {
|
||||
order.push($(this).attr('id'));
|
||||
});
|
||||
|
||||
var positions = order.join(',');
|
||||
$("#webzine_linkpages").val(positions);
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
function removeLinkPage(id) {
|
||||
// On supprime la ligne
|
||||
$("#div_"+id.replace(".","")).remove();
|
||||
console.log($("#div_"+id.replace(".","")).attr("id"));
|
||||
|
||||
// On supprime l'id de la liste
|
||||
$("#webzine_linkpages").val($("#webzine_linkpages").val().replace(id+",",""));
|
||||
$("#webzine_linkpages").val($("#webzine_linkpages").val().replace(","+id,""));
|
||||
$("#webzine_linkpages").val($("#webzine_linkpages").val().replace(id,""));
|
||||
}
|
||||
|
||||
{% endblock %}
|
64
templates/Webzine/list.html.twig
Normal file
64
templates/Webzine/list.html.twig
Normal file
@ -0,0 +1,64 @@
|
||||
{% extends "base.html.twig" %}
|
||||
|
||||
{% block body %}
|
||||
<h1 class="page-header">
|
||||
WEBZINES
|
||||
</h1>
|
||||
|
||||
<p><a class="btn btn-success" href={{ path('app_webzine_submit',{by:'console'}) }}>Ajouter</a></p>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-table fa-fw"></i> Liste des Webzines
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="dataTable_wrapper">
|
||||
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="70px" class="no-sort">Action</th>
|
||||
<th width="70px" class="no-sort">Miniature</th>
|
||||
<th width="100px">Serie</th>
|
||||
<th>Nom</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for webzine in webzines %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{path("app_webzine_update",{id:webzine.id,by:'console'})}}"><i class="fa fa-file"></i></a>
|
||||
{% if webzine.id >=0 %}
|
||||
<a href="{{path("app_webzine_delete",{id:webzine.id,by:'console'})}}" data-method="delete" data-confirm="Êtes-vous sûr de vouloir supprimer cet enregistrement ?"><i class="fa fa-trash"></i></a>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{% if not webzine.webzinepages is empty %}
|
||||
{% set source="thumbori_"~webzine.webzinepages[0].illustration %}
|
||||
{% set height=30*90/21 %}
|
||||
|
||||
<div style="width:90px; height:{{ height }}px;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/webzine/{{source}}");">
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ webzine.set }} #{{ webzine.order| format_number({min_integer_digit:'2'})}}</td>
|
||||
<td>{{ webzine.name }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block localjavascript %}
|
||||
$(document).ready(function() {
|
||||
$('#dataTables').DataTable({
|
||||
columnDefs: [ { "targets": "no-sort", "orderable": false }, { "targets": "no-string", "type" : "num" } ],
|
||||
responsive: true,
|
||||
iDisplayLength: 100,
|
||||
order: [[ 2, "desc" ]]
|
||||
});
|
||||
});
|
||||
{% endblock %}
|
54
templates/Webzine/upload.html.twig
Normal file
54
templates/Webzine/upload.html.twig
Normal file
@ -0,0 +1,54 @@
|
||||
{% extends "base.html.twig" %}
|
||||
|
||||
{% block encorelinktags %}
|
||||
{{ encore_entry_link_tags('dropzone') }}
|
||||
{% endblock encorelinktags %}
|
||||
|
||||
{% block body %}
|
||||
<h3 class="page-header">Téléchargez vos Planches</h3>
|
||||
<a class="btn btn-default" onClick="closeModal();">Annuler</a>
|
||||
|
||||
<form
|
||||
action="{{ oneup_uploader_endpoint('webzine') }}"
|
||||
class="dropzone"
|
||||
id="mydropzone"
|
||||
data-acceptedMimeTypes="image/*"
|
||||
data-resizeWidth:2500,
|
||||
style="margin-top:10px">
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
{% block encorescripttags %}
|
||||
{{ encore_entry_script_tags('dropzone') }}
|
||||
{% endblock %}
|
||||
|
||||
{% block localjavascript %}
|
||||
function dropzoneinit( elt ) {
|
||||
}
|
||||
|
||||
function dropzonesuccess( file, response ) {
|
||||
var val = parent.$("#webzine_linkpages").val();
|
||||
if(val=="")
|
||||
parent.$("#webzine_linkpages").val(response["file"]);
|
||||
else
|
||||
parent.$("#webzine_linkpages").val(val+","+response["file"]);
|
||||
|
||||
html="";
|
||||
html+="<div id='div_"+response["file"].replace(".","")+"'>";
|
||||
html+="<img id='"+response["file"]+"' src='/{{ appAlias }}/uploads/webzine/thumb_"+response["file"]+"'>";
|
||||
html+="<br>";
|
||||
html+="<a style='cursor:pointer' onclick='removeLinkPage(\""+response["file"]+"\")'><i class='fa fa-trash fa-fw'></i></a>";
|
||||
html+="</div>";
|
||||
|
||||
parent.$(".webzinepages").append($(html));
|
||||
}
|
||||
|
||||
function dropzonequeuecomplete(file) {
|
||||
closeModal();
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
window.parent.$("#extraLargeModal").modal('hide');
|
||||
}
|
||||
{% endblock %}
|
||||
|
143
templates/Webzine/view.html.twig
Executable file
143
templates/Webzine/view.html.twig
Executable file
@ -0,0 +1,143 @@
|
||||
{% extends "base.html.twig" %}
|
||||
|
||||
{% block metablock %}
|
||||
<meta property="og:title" content="{{ appName }} - Webzine - {{ page.webzine.name }}" />
|
||||
<meta property="og:description" content="le {{ page.webzine.submittime|date('d/m/Y H:i') }}" />
|
||||
<meta property="og:url" content="{{ absolute_url(path(app.request.attributes.get('_route'),app.request.attributes.get('_route_params'))) }}" />
|
||||
<meta property="og:image" content="{{ absolute_url("/"~appAlias~"/uploads/webzine/"~page.illustration) }}" />
|
||||
{% endblock %}
|
||||
|
||||
{% block localstyle %}
|
||||
<style>
|
||||
#main {
|
||||
padding: 0px;
|
||||
display:none;
|
||||
margin-bottom:200px;
|
||||
}
|
||||
|
||||
/* Image */
|
||||
#webzine_webzine_img, #kadavresky_kadavresky_img, #album_photo_img,#webzine_page_img{
|
||||
margin: 30px auto 0px auto;
|
||||
display:block;
|
||||
/*box-shadow: 0px 0px 5px 1px rgba(255, 255, 255, 0.45);*/
|
||||
}
|
||||
|
||||
#bigright{
|
||||
position:absolute;
|
||||
top:30px;
|
||||
right:0px;
|
||||
width:45%;
|
||||
height:100%;
|
||||
line-height:100%;
|
||||
text-align: right;
|
||||
vertical-align: middle;
|
||||
padding:5px;
|
||||
}
|
||||
#bigleft{
|
||||
position:absolute;
|
||||
top:30px;
|
||||
left:0px;
|
||||
width:45%;
|
||||
height:100%;
|
||||
vertical-align: middle;
|
||||
padding:5px;
|
||||
}
|
||||
|
||||
.menuview a {
|
||||
margin: 0px 5px;
|
||||
}
|
||||
|
||||
</style>
|
||||
{% if not prev is empty %}
|
||||
<a id="bigleft" href="{{ path("app_webzine_view",{"idcat":prev[0].webzine.id,"id":prev[0].id})}}"><i class="fas fa-chevron-left fa-3x"></i></a>
|
||||
{% endif %}
|
||||
{% if not next is empty %}
|
||||
<a id="bigright" href="{{ path("app_webzine_view",{"idcat":next[0].webzine.id,"id":next[0].id})}}"><i class="fas fa-chevron-right fa-3x"></i></a>
|
||||
{% endif %}
|
||||
|
||||
<img style="display:none;" id="webzine_webzine_img" src="/{{ appAlias }}/uploads/webzine/{{page.illustration}}">
|
||||
|
||||
|
||||
<div class="container mb-5">
|
||||
<div class="text-center menuview" style="font-size:25px">
|
||||
<a id="up" href="{{ path("app_home")}}#webzine{{webzine.id}}"><i class="fa fa-home" aria-hidden="true"></i></a>
|
||||
<a download="{{ webzine.name }}-{{page.order}}.{{ pathinfo.extension }}" href="/{{ appAlias }}/uploads/webzine/{{page.illustration}}"><i class="fa fa-download" aria-hidden="true"></i></a>
|
||||
|
||||
{% if is_granted("ROLE_ADMIN") %}
|
||||
<a id="update" href="{{ path("app_webzine_update",{"id":webzine.id})}}"><i class="fa fa-file" aria-hidden="true"></i></a>
|
||||
<a id="delete" href="{{ path("app_webzine_delete",{"id":webzine.id})}}" data-method="delete" data-confirm="Êtes-vous sûr de vouloir supprimer cet entregistrement ?"><i class="fa fa-trash" aria-hidden="true"></i></a>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="text-center" style="clear:both;">
|
||||
<h3>{{ webzine.name }} - {{ page.order }}</h3>
|
||||
<small>le {{ webzine.submittime|date('d/m/Y H:i') }}</small><br>
|
||||
|
||||
{% for page in webzine.webzinepages %}
|
||||
{% set height=30*90/21 %}
|
||||
<a href="{{ path("app_webzine_view",{"idcat":webzine.id,"id":page.id}) }}">
|
||||
<div style="display: inline-block; width:90px; height:{{height}}px;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/webzine/thumbori_{{page.illustration}}"></div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
|
||||
{% if sets|length > 1 %}
|
||||
{% set height=30*90/21 %}
|
||||
<h3 class="mt-3">Dans la même série</h3>
|
||||
{% for set in sets %}
|
||||
{% if not set.webzinepages is empty %}
|
||||
<a href="{{ path("app_webzine_view",{"idcat":set.id,"id":set.webzinepages[0].id}) }}">
|
||||
<div style="display: inline-block; width:90px; height:{{height}}px;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/webzine/thumbori_{{set.webzinepages[0].illustration}}"></div>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
<div class="webzine_description" style="clear:both;max-width: 350px;margin: auto; text-align: justify;">
|
||||
<small>
|
||||
{% autoescape 'html' %}
|
||||
{{ webzine.description|raw }}
|
||||
{% endautoescape %}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block localjavascript %}
|
||||
function resizeImage() {
|
||||
height=$(window).height()-70;
|
||||
$("#webzine_webzine_img").css({height:height,width:'auto'});
|
||||
|
||||
width=$(window).width()-90;
|
||||
if($("#webzine_webzine_img").width()>width)
|
||||
$("#webzine_webzine_img").css({width:width,height:'auto'});
|
||||
|
||||
height=$("#webzine_webzine_img").height();
|
||||
$("#bigright").css({height:height,"line-height":height+"px"});
|
||||
$("#bigleft").css({height:height,"line-height":height+"px"});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('body').imagesLoaded(function() {
|
||||
resizeImage();
|
||||
$("#webzine_webzine_img").fadeIn();
|
||||
});
|
||||
});
|
||||
|
||||
$("body").keydown(function(e) {
|
||||
if(e.keyCode == 37) { // left
|
||||
var href = $('#bigleft').attr('href');
|
||||
if(href!=null) window.location.href = href;
|
||||
}
|
||||
else if(e.keyCode == 39) {
|
||||
var href = $('#bigright').attr('href');
|
||||
if(href!=null) window.location.href = href;
|
||||
}
|
||||
});
|
||||
|
||||
$(window).resize(function() {
|
||||
resizeImage();
|
||||
});
|
||||
{% endblock %}
|
Reference in New Issue
Block a user