-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ajoute la modification "in place" du titre et du sous-titre d'un contenu
- Loading branch information
Showing
20 changed files
with
703 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* ===== Zeste de Savoir ==================================================== */ | ||
/* Show and hide in-place forms */ | ||
/* ========================================================================== */ | ||
|
||
(function($) { | ||
'use strict' | ||
|
||
/* Edit title */ | ||
function toggleDisplayTitle(e) { | ||
$('#title-show').toggleClass('hidden') | ||
$('#title-edit').toggleClass('hidden') | ||
e.preventDefault() | ||
} | ||
|
||
$('#show-title-edit').on('click', toggleDisplayTitle) | ||
$('#hide-title-edit').on('click', toggleDisplayTitle) | ||
|
||
/* Edit subtitle */ | ||
function toggleDisplaySubtitle(e) { | ||
$('#subtitle-show').toggleClass('hidden') | ||
$('#subtitle-edit').toggleClass('hidden') | ||
e.preventDefault() | ||
} | ||
|
||
$('#show-subtitle-edit').on('click', toggleDisplaySubtitle) | ||
$('#hide-subtitle-edit').on('click', toggleDisplaySubtitle) | ||
})(jQuery) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,6 +218,7 @@ | |
} | ||
.btn-inline { | ||
display: inline-block; | ||
cursor: pointer; | ||
} | ||
.btn-no-float { | ||
float: none !important; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
} | ||
|
||
.edit-button { | ||
cursor: pointer; | ||
position: relative; | ||
|
||
margin: 0 .4rem; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
.title { | ||
margin-bottom: 15px; | ||
|
||
.icon img { | ||
display: block; | ||
float: left; | ||
width: 50px; | ||
height: 50px; | ||
} | ||
|
||
.is-title { | ||
display: flex; | ||
|
||
padding: 0; | ||
border-bottom: 1px solid $color-secondary; | ||
|
||
>div { | ||
flex-grow: 1; | ||
display: flex; | ||
|
||
h1 { | ||
border: 0px; | ||
margin-bottom: 0px; | ||
} | ||
|
||
.illu { | ||
padding-left: 8px; | ||
} | ||
} | ||
|
||
aside { | ||
flex-grow: 0; | ||
justify-content: flex-end; | ||
display: flex; | ||
|
||
.license { | ||
justify-content: flex-end; | ||
margin: 0; | ||
margin-top: 10px; | ||
} | ||
} | ||
} | ||
|
||
.is-subtitle { | ||
clear: both; | ||
display: flex; | ||
|
||
margin: 0; | ||
margin-bottom:15px; | ||
border-bottom: 1px solid #eee; | ||
|
||
>div{ | ||
flex-grow: 1; | ||
display: flex; | ||
padding: 5px 0px; | ||
|
||
h2 { | ||
border: 0px; | ||
margin-bottom: 0; | ||
font-size: 18px; | ||
font-size: 1.8rem; | ||
line-height: 23px; | ||
color: #999; | ||
font-weight: normal; | ||
} | ||
} | ||
} | ||
} | ||
|
||
.title-edit, .subtitle-edit { | ||
flex-grow: 10; | ||
display: flex; | ||
|
||
form { | ||
display: flex; | ||
|
||
.control-group, .controls { | ||
display: flex; | ||
flex-grow: 1; | ||
} | ||
|
||
.control-label { | ||
display: none; | ||
} | ||
|
||
input { | ||
flex-grow: 1; | ||
vertical-align: middle; | ||
margin: 0; | ||
padding: 0; | ||
font-weight: normal; | ||
//font-size: 2.2rem; | ||
} | ||
|
||
button.btn, button.btn-submit, button.link, button { | ||
flex-grow: 0; | ||
vertical-align: middle; | ||
cursor: pointer; | ||
line-height: 32px; | ||
height: 32px; | ||
} | ||
|
||
button.link { | ||
flex-grow: 0; | ||
box-sizing: border-box; | ||
color: lighten($color-primary, 20%); | ||
transition: color $transition-duration ease, text-decoration $transition-duration ease; | ||
text-decoration: underline; | ||
|
||
&:hover { | ||
color: darken($color-secondary, 15%); | ||
text-decoration: none; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{% load i18n %} | ||
{% load crispy_forms_tags %} | ||
|
||
<div class="title"> | ||
{% if content.image %} | ||
<div class="icon"> | ||
<img src="{{ content.image.physical.tutorial_illu.url }}" alt=""> | ||
</div> | ||
{% endif %} | ||
<div class="is-title"> | ||
<div> | ||
<div class="editable-element" id="title-show"> | ||
<h1 {% if content.image %}class="illu"{% endif %}>{{ content.title }}</h1> | ||
{% if editable %} | ||
<a href="" class="edit-button" id="show-title-edit"> | ||
<span class="visuallyhidden">{% trans "Modifier le titre" %}</span> | ||
</a> | ||
{% endif %} | ||
</div> | ||
{% if editable %} | ||
<div class="title-edit hidden {% if content.image %}illu{% endif %}" id="title-edit"> | ||
{% spaceless %}{% crispy form_edit_title %}{% endspaceless %} | ||
</div> | ||
{% endif %} | ||
</div> | ||
|
||
<aside> | ||
{% if content.licence %} | ||
<div class="editable-element license"> | ||
<p>{{ content.licence }}</p> | ||
{% if editable %} | ||
<a href="#edit-license" class="open-modal edit-button" title="{% trans "Modifier la licence" %}"> | ||
<span class="visuallyhidden">{% trans "Modifier la licence" %}</span> | ||
</a> | ||
{% endif %} | ||
</div> | ||
{% else %} | ||
<p class="license"> | ||
<a href="#edit-license" class="open-modal">{% trans "Choisissez la licence de votre publication !" %}</a> | ||
</p> | ||
{% endif %} | ||
{% if editable %} | ||
{% crispy form_edit_license %} | ||
{% endif %} | ||
</aside> | ||
</div> | ||
|
||
{% if content.description or editable %} | ||
<div class="is-subtitle"> | ||
<div> | ||
<div class="editable-element" id="subtitle-show"> | ||
{% if content.description %} | ||
<h2 class="subtitle">{{ content.description }}</h2> | ||
{% endif %} | ||
{% if editable %} | ||
{% if content.description %} | ||
<a href="" id="show-subtitle-edit" class="edit-button"> | ||
<span class="visuallyhidden">{% trans "Modifier le sous-titre" %}</span> | ||
</a> | ||
{% else %} | ||
<a href="" id="show-subtitle-edit" class="link">{% trans "Ajouter un sous-titre" %}</a> | ||
{% endif %} | ||
{% endif %} | ||
</div> | ||
|
||
{% if editable %} | ||
<div class="subtitle-edit hidden" id="subtitle-edit"> | ||
{% spaceless %}{% crispy form_edit_subtitle %}{% endspaceless %} | ||
</div> | ||
{% endif %} | ||
</div> | ||
</div> | ||
{% endif %} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.