1
0

Replace JS-based equal heights with flexbox solution

- Only fire JS equal heights if flexbox is not supported
- Add flexbox styles for backend sections that used to use
  JS based equal heights
- Use Modernizr's flexbox detection to use the old styles
  as a fallback for non-flexbox browsers
- Generate new oldie stylesheet
- Do not use .clearfix with flexbox (Safari doesn't like it)
- Apply IE11 fix for flexbox, see goo.gl/pglrbm

References #333
This commit is contained in:
Matthias Mees
2016-10-21 15:54:03 +02:00
parent d9b1baab76
commit d3d205ece9
9 changed files with 284 additions and 96 deletions

View File

@ -1,4 +1,4 @@
<div id="maintenance" class="clearfix">
<div id="maintenance">
<h2>{$CONST.MENU_MAINTENANCE}</h2>
{if $action == "integrity"}
@ -52,7 +52,7 @@
<section id="maintenance_import" class="equal_heights quick_list">
<h3>{$CONST.IMPORT_ENTRIES}</h3>
{$importMenu}
</section>
{/if}
@ -77,7 +77,7 @@
<input id="sizecheckthumbs" name="serendipity[deleteThumbs]" type="radio" value="check">
<label for="sizecheckthumbs">{$CONST.SYNC_OPTION_SIZECHECKTHUMBS}</label>
</div>
<div class="form_radio">
<input id="deletethumbs" name="serendipity[deleteThumbs]" type="radio" value="yes">
<label for="deletethumbs">{$CONST.SYNC_OPTION_DELETETHUMBS}</label>
@ -94,4 +94,4 @@
{serendipity_hookPlugin hook="backend_maintenance" hookAll="true"}
</div>
</div>

View File

@ -243,7 +243,7 @@
<input name="serendipity[adminAction]" type="hidden" value="multidelete">
{/if}
<div class="clearfix media_pane" data-thumbmaxwidth="{$media.thumbSize}">
<div class="media_pane" data-thumbmaxwidth="{$media.thumbSize}">
{$MEDIA_ITEMS}
{if ($media.page != 1 AND $media.page <= $media.pages) OR $media.page != $media.pages}
@ -293,4 +293,4 @@
</div>
{/if}
</div>{* media library pane end *}
</div>{* media library pane end *}

View File

@ -20,6 +20,14 @@
position: relative;
}
#media_selector_bar {
margin: 0;
}
.popuplayer_showUpload {
margin: 1em 0 0;
}
.tabcontent #pluginlist_event > a,
.tabcontent #pluginlist_sidebar > a {
position: absolute;
@ -40,6 +48,7 @@
#image_directory_create_form label {
display: inline-block;
width: 20%;
white-space: nowrap;/*mediafilter*/
}
#sort_entries .form_select select,
@ -83,6 +92,14 @@
margin: 0 0 1em;
}
.popuplayer_showUpload {
margin: 0 .4em 1em 0;
}
.media_select_strict {
margin: -1em 0;
}
#mediaPropertyForm .media_file_props label,
#mediaPropertyForm header b,
#mediaPropertyForm footer b {
@ -90,6 +107,11 @@
width: 20%;
}
#media_filter > .left,
#media_filter > .center {/*mediafilter*/
margin-right: .2em;
}
.user_level {
display: inline;
}
@ -144,13 +166,13 @@ pre {
margin: 1.71429em 0;
}
#template_select article,
.plugins_installable > li,
.no-flexbox #template_select article,
.no-flexbox .plugins_installable > li,
#serendipityScaleForm,
#serendipityScaleImg,
.media_file,
#dashboard > .dashboard_widget,
#maintenance > .quick_list,
.no-flexbox .media_file,
.no-flexbox #dashboard > .dashboard_widget,
.no-flexbox #maintenance > .quick_list,
.serendipity_statistics > section,
#serendipity_category > div > div,
#serendipity_category #preview,
@ -162,6 +184,66 @@ pre {
width: 48%;
}
#dashboard,
#maintenance,
.media_pane,
.pluginmanager,
.plugins_installable,
#template_select,
#template_select > ul {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.plugins_installable {
justify-content: flex-start;
}
#dashboard > .dashboard_widget,
#maintenance > .quick_list,
.media_pane > .media_file,
.plugins_installable li,
#template_select > article,
#template_select > ul li {
flex: 0 0 auto;
margin: 0 2% 1em 0;
width: 48%;
}
.pluginmanager .pluginmanager_event {
flex: 0 0 auto;
margin: 0 1% 0 0;
width: 49%;
}
.pluginmanager .pluginmanager_sidebar {
flex: 0 0 auto;
margin: 0 1% 0 0;
width: 32%;
}
.no-js #dashboard #s9y_links,
#maintenance > h2,
.media_pane .pagination,
#template_select > h2 {
flex: 0 0 auto;
width: 100%;
}
#dashboard > .dashboard_widget:nth-of-type(even),
#maintenance > .quick_list:nth-of-type(even),
.media_pane > .media_file:nth-of-type(even),
.plugins_installable li:nth-of-type(even),
#template_select > .current_backend_template,
#template_select > ul li:nth-of-type(even) {
margin: 0 0 1em 2%;
}
.no-js #dashboard #s9y_links {
margin: 0 0 1em;
}
.media_chooser {
margin-bottom: 0;
}
@ -176,22 +258,14 @@ pre {
width: 84%;
}
#template_select .current_backend_template,
#template_select li:nth-child(even) article,
.media_pane .even,
#dashboard > .dashboard_widget:nth-child(even),
#maintenance > section:nth-of-type(even) {
.no-flexbox #template_select .current_backend_template,
.no-flexbox #template_select li:nth-child(even) article,
.no-flexbox .media_pane .even,
.no-flexbox #dashboard > .dashboard_widget:nth-child(even),
.no-flexbox #maintenance > section:nth-of-type(even) {
margin: 0 0 1em 2%;
}
#maintenance > section {
margin: 0 2% 1em 0;
}
#template_select .current_template {
margin-bottom: 2em;
}
#mediaPropertyForm .media_file {
float: none;
margin: 1.5em 0;
@ -227,6 +301,7 @@ pre {
.configuration_group .form_field input,
.configuration_group .form_area textarea,
.configuration_group fieldset > fieldset legend,
.configuration_group div > fieldset legend,
#uploadform .form_select label,
#uploadform .form_field label,
#uploadform .form_select select,
@ -302,14 +377,15 @@ pre {
.configuration_group .form_multiselect,
.configuration_group .form_field,
.configuration_group .form_area,
.configuration_group .custom_item,
.configuration_group fieldset > fieldset,
#template_select li:nth-child(odd),
.configuration_group div > fieldset,
.no-flexbox #template_select li:nth-child(odd),
#template_select h2,
.media_pane .odd,
#dashboard > .odd,
.plugins_installable > li:nth-child(odd),
.no-flexbox .media_pane .odd,
.no-flexbox .plugins_installable > li:nth-child(odd),
.serendipity_statistics > section:nth-child(odd),
.dashboard_widget:nth-child(odd) {
.no-flexbox .dashboard_widget:nth-child(odd) {
clear: left;
}
@ -323,33 +399,34 @@ pre {
.configure_plugin fieldset .form_radio,
.configuration_group fieldset > fieldset .form_radio,
.configuration_group div > fieldset .form_radio,
#serendipity_plugin_config > fieldset .form_radio,
#template_options fieldset .form_radio {
margin-top: 0;
}
.pluginmanager_side {
.no-flexbox .pluginmanager_side {
float: left;
margin: 0 0 1.5em;
vertical-align: top;
}
#pluginlist_sidebar .pluginmanager_side {
.no-flexbox #pluginlist_sidebar .pluginmanager_side {
margin-right: 1%;
width: 32%;
}
#pluginlist_event .pluginmanager_side {
.no-flexbox #pluginlist_event .pluginmanager_side {
margin-right: 1%;
width: 49%;
}
#pluginlist_event .pluginmanager_side:nth-child(even) {
.no-flexbox #pluginlist_event .pluginmanager_side:nth-child(even) {
margin-right: 0;
margin-left: 1%;
}
#pluginlist_sidebar .pluginmanager_side:nth-of-type(4) {
.no-flexbox #pluginlist_sidebar .pluginmanager_side:nth-of-type(4) {
clear: left;
}
@ -358,6 +435,10 @@ pre {
padding: .85715em;
}
.manage h3 {
width: 17em;
}
#edit_entry_status_comments .form_check {
margin-bottom: 0;
}
@ -405,6 +486,12 @@ pre {
width: 33% ;
}
#media_filter > div.keywords {/*simple filter*/
float: right;
margin-top: -2.5em;
margin-bottom: 0;
}
#filter_entries .form_select,
#filter_entries .form_field {
float: left;
@ -417,8 +504,10 @@ pre {
width: 50%;
}
#media_filter_file,
#media_pane_sort .left,
#media_filter .left {
clear: left;
}
#serendipity_comment .form_area {
clear: both;
}
@ -427,6 +516,10 @@ pre {
padding-top: 2em;
}
.manage h3 {
width: 19em;
}
#login .form_field input {
width: auto;
}
@ -567,6 +660,10 @@ main {
width: 100%;
}
.manage h3 {
width: 14em;
}
#login {
margin: 4em auto 8em;
}
}

View File

@ -3,7 +3,7 @@
<a href="#s9y_links" class="button_link toggle_links"><span class="icon-info-circled"></span><span class="visuallyhidden"> {$CONST.FURTHER_LINKS}</span></a>
</div>
{$backend_frontpage_display}
<div id="dashboard" class="clearfix">
<div id="dashboard">
{if $published}
<span class="msg_success"><span class="icon-ok-circled"></span> {$CONST.ENTRY_PUBLISHED|sprintf:$published|escape}</span>
<hr class="separator">
@ -138,4 +138,4 @@ $(document).ready(function() {
$('#dashboard_header').after("<span class=\"msg_error\"><span class=\"icon-attention-circled\"></span> {$CONST.JS_FAILURE|sprintf:$js_failure_file|escape:javascript}</span>");
}
});
</script>
</script>

View File

@ -84,7 +84,7 @@
{if $only_group == 'UPGRADE' && $pluggroups['UPGRADE']|@count > 1}
<button id="updateAll">Update All</button>
{/if}
<ul class="plugins_installable plainList clearfix">
<ul class="plugins_installable plainList">
{foreach $groupstack as $plug}
<li class="clearfix">
<div class="equal_heights">
@ -189,4 +189,4 @@
<pre>{$memSnaps|print_r}</pre>
</section>
{/if}
{/if}
{/if}

View File

@ -1681,7 +1681,7 @@ $(function() {
serendipity.SetCookie('serendipity_only_path', $('#serendipity_only_path').val());
});
}
if ($('.image_move').length > 0) {
$('.image_move').removeClass('hidden');
$('.image_move').magnificPopup({
@ -1761,15 +1761,19 @@ $(function() {
// Equal Heights
$(window).load(function() {
if (mq_small) {
serendipity.sync_heights();
if(!Modernizr.flexbox) {
if (mq_small) {
serendipity.sync_heights();
}
}
});
// Make sure plugin list heights are recalculated when switching tabs
$('#pluginlist_tabs a').click(function() {
if (mq_small) {
serendipity.sync_heights();
if(!Modernizr.flexbox) {
if (mq_small) {
serendipity.sync_heights();
}
}
});
});
@ -1801,4 +1805,4 @@ serendipity_imageSelector_done = function(textarea) {
serendipity_imageSelector_addToElement = function(str, id) {
return serendipity.serendipity_imageSelector_addToElement(str, id);
}
}

View File

@ -6,7 +6,7 @@
<input id="eventorder" name="serendipity[pluginorder]" type="hidden" value="">
{/if}
{$serendipity_setFormToken}
<div class="clearfix pluginmanager">
<div class="pluginmanager">
{foreach $placement as $plugin_placement}
<div class="pluginmanager_side pluginmanager_{($event_only) ? 'event' : 'sidebar'}">
<h4>{$plugin_placement['ptitle']}</h4>
@ -84,10 +84,10 @@
</ol>
</div>
{/foreach}
<span class="plugin_count block_level">{$CONST.PLUGIN_AVAILABLE_COUNT|sprintf:$total}</span>
</div>
<span class="plugin_count block_level">{$CONST.PLUGIN_AVAILABLE_COUNT|sprintf:$total}</span>
<div class="form_buttons">
<input class="state_cancel" name="REMOVE" type="submit" title="{$CONST.REMOVE_TICKED_PLUGINS}" value="{$CONST.DELETE}">
<input name="SAVE" type="submit" title="{$CONST.SAVE_CHANGES_TO_LAYOUT}" value="{$CONST.SAVE}">
</div>
</form>
</form>

View File

@ -371,12 +371,30 @@ progress {
/* Clearfix: contain floats */
.clearfix:before,
.clearfix:after {
.no-flexbox #maintenance:before,
.no-flexbox #dashboard:before,
.no-flexbox .media_pane:before,
.no-flexbox .plugins_installable:before,
.no-flexbox .pluginmanager:before,
.no-flexbox #template_select > ul:before,
.clearfix:after,
.no-flexbox #maintenance:after,
.no-flexbox #dashboard:after,
.no-flexbox .media_pane:after,
.no-flexbox .plugins_installable:after,
.no-flexbox .pluginmanager:after,
.no-flexbox #template_select > ul:after {
content: " ";
display: table;
}
.clearfix:after {
.clearfix:after,
.no-flexbox #maintenance:after,
.no-flexbox #dashboard:after,
.no-flexbox .media_pane:after,
.no-flexbox .plugins_installable:after,
.no-flexbox .pluginmanager:after,
.no-flexbox #template_select > ul:after {
clear: both;
}
@ -1071,7 +1089,7 @@ input[type=checkbox],
.media_file_metadata h5,
.media_file_metadata dt,
#serendipity_comments_list details,
#dashboard > #s9y_links,
.no-flexbox #dashboard > #s9y_links,
.configure_plugin .cke {
clear: both;
}
@ -1584,7 +1602,8 @@ fieldset p,
padding: .25em 0;
}
.importer_data dd > div {
.importer_data dd > div,
.media_file .actions, {
margin-top: 0;
margin-bottom: 0;
}
@ -1598,7 +1617,6 @@ fieldset p,
}
#login .form_buttons,
.media_file .actions,
#entries_list .actions,
.msg_hint > p:last-of-type {
margin-bottom: 0;
@ -1611,7 +1629,6 @@ fieldset p,
margin-top: .75em;
}
.media_file .actions,
.js #add_upload {
margin-top: 1em;
}
@ -1753,13 +1770,19 @@ form > .button_link:first-of-type,
}
#template_select article,
.media_file,
.plugins_installable > li {
padding: 0 .5em 1em;
}
.media_file {
padding: 0 .5em .5em;
box-sizing: border-box;
padding: 0 .5em 3.5em;
position: relative;
}
.media_file_actions {
position: absolute;
bottom: 0;
}
.media_wrap_thumb {
@ -2244,18 +2267,29 @@ label .perm_name,
/* PLUGIN MANAGER */
.pluginmanager {
margin-top: 1em;
margin-bottom: 1em;
}
.pluginmanager_container {
background: transparent;
margin: 0;
padding: .25em;
position: relative;
}
.flexbox .pluginmanager_side,
.no-flexbox .pluginmanager_container {
border: 1px solid #ddd;
border-radius: 2px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
height: 98%;
margin: 0;
min-height: 12.5em;
padding: .25em;
position: relative;
}
.flexbox .pluginmanager_side h4 {
margin: .75em .5em .25em;
}
.pluginmanager_container .placeholder {
@ -2310,7 +2344,7 @@ label .perm_name,
.plugin_count {
clear: both;
margin: 0 0 1.5em;
margin: 1.5em 0 0;
}
.pluginmanager .pluginmanager_grablet {
@ -2440,6 +2474,7 @@ label .perm_name,
.js .media_file_preview,
.js .template_preview {
min-height: 12em;
position: relative;
}
@ -3179,13 +3214,13 @@ img.mfp-img {
margin: 1.71429em 0;
}
#template_select article,
.plugins_installable > li,
.no-flexbox #template_select article,
.no-flexbox .plugins_installable > li,
#serendipityScaleForm,
#serendipityScaleImg,
.media_file,
#dashboard > .dashboard_widget,
#maintenance > .quick_list,
.no-flexbox .media_file,
.no-flexbox #dashboard > .dashboard_widget,
.no-flexbox #maintenance > .quick_list,
.serendipity_statistics > section,
#serendipity_category > div > div,
#serendipity_category #preview,
@ -3197,6 +3232,66 @@ img.mfp-img {
width: 48%;
}
#dashboard,
#maintenance,
.media_pane,
.pluginmanager,
.plugins_installable,
#template_select,
#template_select > ul {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.plugins_installable {
justify-content: flex-start;
}
#dashboard > .dashboard_widget,
#maintenance > .quick_list,
.media_pane > .media_file,
.plugins_installable li,
#template_select > article,
#template_select > ul li {
flex: 0 0 auto;
margin: 0 2% 1em 0;
width: 48%;
}
.pluginmanager .pluginmanager_event {
flex: 0 0 auto;
margin: 0 1% 0 0;
width: 49%;
}
.pluginmanager .pluginmanager_sidebar {
flex: 0 0 auto;
margin: 0 1% 0 0;
width: 32%;
}
.no-js #dashboard #s9y_links,
#maintenance > h2,
.media_pane .pagination,
#template_select > h2 {
flex: 0 0 auto;
width: 100%;
}
#dashboard > .dashboard_widget:nth-of-type(even),
#maintenance > .quick_list:nth-of-type(even),
.media_pane > .media_file:nth-of-type(even),
.plugins_installable li:nth-of-type(even),
#template_select > .current_backend_template,
#template_select > ul li:nth-of-type(even) {
margin: 0 0 1em 2%;
}
.no-js #dashboard #s9y_links {
margin: 0 0 1em;
}
.media_chooser {
margin-bottom: 0;
}
@ -3211,22 +3306,14 @@ img.mfp-img {
width: 84%;
}
#template_select .current_backend_template,
#template_select li:nth-child(even) article,
.media_pane .even,
#dashboard > .dashboard_widget:nth-child(even),
#maintenance > section:nth-of-type(even) {
.no-flexbox #template_select .current_backend_template,
.no-flexbox #template_select li:nth-child(even) article,
.no-flexbox .media_pane .even,
.no-flexbox #dashboard > .dashboard_widget:nth-child(even),
.no-flexbox #maintenance > section:nth-of-type(even) {
margin: 0 0 1em 2%;
}
#maintenance > section {
margin: 0 2% 1em 0;
}
#template_select .current_template {
margin-bottom: 2em;
}
#mediaPropertyForm .media_file {
float: none;
margin: 1.5em 0;
@ -3341,12 +3428,12 @@ img.mfp-img {
.configuration_group .custom_item,
.configuration_group fieldset > fieldset,
.configuration_group div > fieldset,
#template_select li:nth-child(odd),
.no-flexbox #template_select li:nth-child(odd),
#template_select h2,
.media_pane .odd,
.plugins_installable > li:nth-child(odd),
.no-flexbox .media_pane .odd,
.no-flexbox .plugins_installable > li:nth-child(odd),
.serendipity_statistics > section:nth-child(odd),
.dashboard_widget:nth-child(odd) {
.no-flexbox .dashboard_widget:nth-child(odd) {
clear: left;
}
@ -3366,28 +3453,28 @@ img.mfp-img {
margin-top: 0;
}
.pluginmanager_side {
.no-flexbox .pluginmanager_side {
float: left;
margin: 0 0 1.5em;
vertical-align: top;
}
#pluginlist_sidebar .pluginmanager_side {
.no-flexbox #pluginlist_sidebar .pluginmanager_side {
margin-right: 1%;
width: 32%;
}
#pluginlist_event .pluginmanager_side {
.no-flexbox #pluginlist_event .pluginmanager_side {
margin-right: 1%;
width: 49%;
}
#pluginlist_event .pluginmanager_side:nth-child(even) {
.no-flexbox #pluginlist_event .pluginmanager_side:nth-child(even) {
margin-right: 0;
margin-left: 1%;
}
#pluginlist_sidebar .pluginmanager_side:nth-of-type(4) {
.no-flexbox #pluginlist_sidebar .pluginmanager_side:nth-of-type(4) {
clear: left;
}
@ -3661,4 +3748,4 @@ img.mfp-img {
.manage h3 {
width: 19em;
}
}
}

View File

@ -140,19 +140,19 @@
{/function}
<h2>{$CONST.RECOMMENDED}</h2>
<ul class="plainList clearfix">
<ul class="plainList">
{foreach $recommended_templates as $template=>$info}
{templateBlock template=$template info=$info key=$info@key}
{/foreach}
</ul>
<h2>{$CONST.AVAILABLE_TEMPLATES}</h2>
<ul class="plainList clearfix">
<ul class="plainList">
{foreach $templates as $template=>$info}
{templateBlock template=$template info=$info key=$info@key}
{/foreach}
</ul>
</section>
{/if}
{/if}