Merge pull request #8317 from MrPetovan/task/frio-remove-compose-setting

[frio] Remove "Enable Compose page" setting
This commit is contained in:
Michael Vogel 2020-02-20 09:35:48 +01:00 committed by GitHub
commit eefa699bb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 34 deletions

View file

@ -41,7 +41,6 @@ function theme_post(App $a)
DI::pConfig()->set(local_user(), 'frio', 'background_image', $_POST['frio_background_image'] ?? ''); DI::pConfig()->set(local_user(), 'frio', 'background_image', $_POST['frio_background_image'] ?? '');
DI::pConfig()->set(local_user(), 'frio', 'bg_image_option', $_POST['frio_bg_image_option'] ?? ''); DI::pConfig()->set(local_user(), 'frio', 'bg_image_option', $_POST['frio_bg_image_option'] ?? '');
DI::pConfig()->set(local_user(), 'frio', 'css_modified', time()); DI::pConfig()->set(local_user(), 'frio', 'css_modified', time());
DI::pConfig()->set(local_user(), 'frio', 'enable_compose', $_POST['frio_enable_compose'] ?? 0);
} }
} }
@ -63,7 +62,6 @@ function theme_admin_post(App $a)
DI::config()->set('frio', 'login_bg_image', $_POST['frio_login_bg_image'] ?? ''); DI::config()->set('frio', 'login_bg_image', $_POST['frio_login_bg_image'] ?? '');
DI::config()->set('frio', 'login_bg_color', $_POST['frio_login_bg_color'] ?? ''); DI::config()->set('frio', 'login_bg_color', $_POST['frio_login_bg_color'] ?? '');
DI::config()->set('frio', 'css_modified', time()); DI::config()->set('frio', 'css_modified', time());
DI::config()->set('frio', 'enable_compose', $_POST['frio_enable_compose'] ?? 0);
} }
} }
@ -85,7 +83,6 @@ function theme_content(App $a)
$arr['contentbg_transp'] = DI::pConfig()->get(local_user(), 'frio', 'contentbg_transp', DI::config()->get('frio', 'contentbg_transp')); $arr['contentbg_transp'] = DI::pConfig()->get(local_user(), 'frio', 'contentbg_transp', DI::config()->get('frio', 'contentbg_transp'));
$arr['background_image'] = DI::pConfig()->get(local_user(), 'frio', 'background_image', DI::config()->get('frio', 'background_image')); $arr['background_image'] = DI::pConfig()->get(local_user(), 'frio', 'background_image', DI::config()->get('frio', 'background_image'));
$arr['bg_image_option'] = DI::pConfig()->get(local_user(), 'frio', 'bg_image_option' , DI::config()->get('frio', 'bg_image_option')); $arr['bg_image_option'] = DI::pConfig()->get(local_user(), 'frio', 'bg_image_option' , DI::config()->get('frio', 'bg_image_option'));
$arr['enable_compose'] = DI::pConfig()->get(local_user(), 'frio', 'enable_compose' , DI::config()->get('frio', 'enable_compose'));
return frio_form($arr); return frio_form($arr);
} }
@ -108,7 +105,6 @@ function theme_admin(App $a)
$arr['bg_image_option'] = DI::config()->get('frio', 'bg_image_option'); $arr['bg_image_option'] = DI::config()->get('frio', 'bg_image_option');
$arr['login_bg_image'] = DI::config()->get('frio', 'login_bg_image'); $arr['login_bg_image'] = DI::config()->get('frio', 'login_bg_image');
$arr['login_bg_color'] = DI::config()->get('frio', 'login_bg_color'); $arr['login_bg_color'] = DI::config()->get('frio', 'login_bg_color');
$arr['enable_compose'] = DI::config()->get('frio', 'enable_compose');
return frio_form($arr); return frio_form($arr);
} }
@ -152,7 +148,6 @@ function frio_form($arr)
'$background_image' => array_key_exists('background_image', $disable) ? '' : ['frio_background_image', DI::l10n()->t('Set the background image'), $arr['background_image'], $background_image_help, false], '$background_image' => array_key_exists('background_image', $disable) ? '' : ['frio_background_image', DI::l10n()->t('Set the background image'), $arr['background_image'], $background_image_help, false],
'$bg_image_options_title' => DI::l10n()->t('Background image style'), '$bg_image_options_title' => DI::l10n()->t('Background image style'),
'$bg_image_options' => Image::get_options($arr), '$bg_image_options' => Image::get_options($arr),
'$enable_compose' => ['frio_enable_compose', DI::l10n()->t('Enable Compose page'), $arr['enable_compose'], DI::l10n()->t('This replaces the jot modal window for writing new posts with a link to <a href="compose">the new Compose page</a>.')],
]; ];
if (array_key_exists('login_bg_image', $arr) && !array_key_exists('login_bg_image', $disable)) { if (array_key_exists('login_bg_image', $arr) && !array_key_exists('login_bg_image', $disable)) {

View file

@ -1301,8 +1301,7 @@ section ul.tabs {
section #jotOpen { section #jotOpen {
display: none; display: none;
} }
#jotOpen, #jotOpen {
#composeOpen {
margin-top: 3px; margin-top: 3px;
float: right; float: right;
} }

View file

@ -73,25 +73,17 @@ $(document).ready(function(){
'target': ".flex-target" 'target': ".flex-target"
}); });
// add Jot botton to the scecond navbar // add Jot button to the second navbar
let $jotButton = $("#jotOpen"); let $jotButton = $("#jotOpen");
let $composeButton = $("#composeOpen"); if ($jotButton.length) {
if (compose) { $jotButton.appendTo("#topbar-second > .container > #navbar-button");
$jotButton.hide(); if ($("#jot-popup").is(":hidden")) {
if ($composeButton.length) { $jotButton.hide();
$composeButton.appendTo("#topbar-second > .container > #navbar-button");
if($("#jot-popup").is(":hidden")) {
$composeButton.hide();
}
}
} else {
$composeButton.hide();
if ($jotButton.length) {
$jotButton.appendTo("#topbar-second > .container > #navbar-button");
if($("#jot-popup").is(":hidden")) {
$jotButton.hide();
}
} }
$jotButton.on('click', function (e) {
e.preventDefault();
jotShow();
});
} }
let $body = $('body'); let $body = $('body');

View file

@ -1,6 +1,5 @@
{{* The button to open the jot - in This theme we move the button with js to the second nav bar *}} {{* The button to open the jot - in This theme we move the button with js to the second nav bar *}}
<button class="btn btn-sm btn-main pull-right" id="jotOpen" aria-label="{{$new_post}}" title="{{$new_post}}" onclick="jotShow();"><i class="fa fa-pencil-square-o fa-2x"></i></button> <a class="btn btn-sm btn-main pull-right" id="jotOpen" href="compose/{{$posttype}}{{if $content}}?body={{$content}}{{/if}}" aria-label="{{$new_post}}" title="{{$new_post}}"><i class="fa fa-pencil-square-o fa-2x"></i></a>
<a class="btn btn-sm btn-main pull-right" id="composeOpen" href="compose/{{$posttype}}{{if $content}}?body={{$content}}{{/if}}" aria-label="{{$new_post}}" title="{{$new_post}}"><i class="fa fa-pencil-square-o fa-2x"></i></a>
<div id="jot-content"> <div id="jot-content">
<div id="jot-sections"> <div id="jot-sections">

View file

@ -40,14 +40,6 @@ function frio_init(App $a)
</script> </script>
EOT; EOT;
} }
$enable_compose = DI::pConfig()->get(local_user(), 'frio', 'enable_compose');
$compose = $enable_compose === '1' || $enable_compose === null && DI::config()->get('frio', 'enable_compose') ? 1 : 0;
DI::page()['htmlhead'] .= <<< HTML
<script type="text/javascript">
var compose = $compose;
</script>
HTML;
} }
function frio_install() function frio_install()