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> </fieldset>
</div> </div>
<div id="edit_entry_category" class="form_select"> <div id="edit_entry_category" class="clearfix mfp-hide">
<label for="categoryselector">{$CONST.CATEGORY}</label> <fieldset>
<select id="categoryselector" name="serendipity[categories][]" multiple> <legend><span>{$CONST.CATEGORY}</span></legend>
<option value="0">{$CONST.NO_CATEGORY}</option>
{foreach from=$entry_vars.category_options item="entry_cat"} {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} {/foreach}
</select> </fieldset>
</div> </div>
</div> </div>
</fieldset> </fieldset>

View File

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

View File

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