Merge pull request #897 from tobiasd/20191004-gnot

[gnot] Make settings collapsible
This commit is contained in:
Hypolite Petovan 2019-10-04 07:34:16 -04:00 committed by GitHub
commit f573907bd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 12 deletions

View file

@ -11,6 +11,7 @@ use Friendica\Core\Hook;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
function gnot_install() { function gnot_install() {
@ -76,20 +77,16 @@ function gnot_settings(&$a,&$s) {
$gnot_checked = (($gnot) ? ' checked="checked" ' : '' ); $gnot_checked = (($gnot) ? ' checked="checked" ' : '' );
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/gnot/');
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<div class="settings-block">'; $s .= Renderer::replaceMacros($t, [
$s .= '<h3>' . L10n::t('Gnot Settings') . '</h3>'; '$title' => L10n::t('Gnot Settings') ,
$s .= '<div id="gnot-wrapper">'; '$submit' => L10n::t('Save Settings'),
$s .= '<div id="gnot-desc">' . L10n::t("Allows threading of email comment notifications on Gmail and anonymising the subject line.") . '</div>'; '$enable' => L10n::t('Enable this addon?'),
$s .= '<label id="gnot-label" for="gnot">' . L10n::t('Enable this addon?') . '</label>'; '$enabled' => $gnot_checked,
$s .= '<input id="gnot-input" type="checkbox" name="gnot" value="1"'. $gnot_checked . '/>'; '$text' => L10n::t("Allows threading of email comment notifications on Gmail and anonymising the subject line.")
$s .= '</div><div class="clear"></div>'; ]);
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="gnot-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }

View file

@ -0,0 +1,20 @@
<span id="settings_gnot_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_gnot_expanded\'); openClose(\'settings_gnot_inflated\');">
<h3>{{$title}}</h3>
</span>
<div id="settings_gnot_expanded" class="settings-block" style="display: none;">
<span class="fakelink" onclick="openClose(\'settings_gnot_expanded\'); openClose(\'settings_gnot_inflated\');">
<h3>{{$title}}</h3>
</span>
<div id="gnot-wrapper">
<div id="gnot-desc">{{$text}}</div>
<label id="gnot-label" for="gnot">{{$enable}}</label>
<input id="gnot-input" type="checkbox" name="gnot" value="1" {{$enabled}} />
</div>
<div class="clear"></div>
/* provide a submit button */
<div class="settings-submit-wrapper" >
<input type="submit" name="gnot-submit" class="settings-submit" value="{{$submit}}" />
</div>
</div>