Display category selection in a popup/modal window.

This commit is contained in:
Matthias Mees 2014-01-25 15:58:47 +01:00
parent 775aac53b5
commit 4e923e1aeb
3 changed files with 28 additions and 15 deletions

View File

@ -96,14 +96,18 @@
</fieldset>
</div>
<div id="edit_entry_category" class="form_select">
<label for="categoryselector">{$CONST.CATEGORY}</label>
<select id="categoryselector" name="serendipity[categories][]" multiple>
<option value="0">{$CONST.NO_CATEGORY}</option>
<div id="edit_entry_category" class="clearfix mfp-hide">
<fieldset>
<legend><span>{$CONST.CATEGORY}</span></legend>
{foreach from=$entry_vars.category_options item="entry_cat"}
<option value="{$entry_cat.categoryid}"{if $entry_cat.is_selected} selected{/if}>{$entry_cat.depth_pad}{$entry_cat.category_name}</option>
<div class="form_check">
{$entry_cat.depth_pad}
<input id="serendipity_category_{$entry_cat.categoryid}" name="serendipity[categories][]" type="checkbox" value="{$entry_cat.categoryid}"{if $entry_cat.is_selected} checked="checked"{/if}>
<label for="serendipity_category_{$entry_cat.categoryid}">{$entry_cat.category_name}</label>
</div>
{/foreach}
</select>
</fieldset>
</div>
</div>
</fieldset>

View File

@ -805,7 +805,7 @@ var AccessifyHTML5 = function (defaults, more_fixes) {
// Entry metadata
// NOTE: This probably should be rewritten as a general function which
// also works for advanced options (see below); also not sure if
// the localStorage stuff works here
// the localStorage stuff works here (seems to)
if($('body').has('#edit_entry_metadata').size() > 0) {
$('#edit_entry_metadata > legend > button').click(function() {
var $el = $(this);
@ -825,12 +825,19 @@ var AccessifyHTML5 = function (defaults, more_fixes) {
}
}
// TEMP: expand entry metadata if #select_category is clicked
// (will be replaced by a better solution soonish)
$('#select_category').click(function(e) {
e.preventDefault();
$('#edit_entry_metadata > legend > button').click();
});
// Show category selector
{if $use_popups}
if($('body').has('#serendipityEntry').size() > 0) {
$('#select_category').click(function(e) {
$('#edit_entry_metadata > legend > button').click();
$('#edit_entry_category').toggleClass('mfp-hide');
});
}
{else}
if($('body').has('#serendipityEntry').size() > 0) {
$('#select_category').magnificPopup({ type: "inline" });
}
{/if}
// Advanced options
if($('body').has('#advanced_options').size() > 0) {

View File

@ -1543,7 +1543,8 @@ form > .button_link:first-of-type,
border: 1px solid #aaa;
}
.mfp-content #s9y_links {
.mfp-content #s9y_links,
.mfp-content #edit_entry_category {
background: #fcfcfc;
margin: 0 auto;
max-width: 480px;
@ -2016,7 +2017,8 @@ form > .button_link:first-of-type,
visibility: hidden;
}
.js .installer .additional_info {
.js .installer .additional_info,
.no-js .mfp-hide {
display: block !important;
visibility: visible;
}