Settings had been moved into a template

This commit is contained in:
Michael 2019-11-27 05:54:26 +00:00
parent fae6bbe92c
commit 561ae12b02
2 changed files with 21 additions and 17 deletions

View File

@ -45,25 +45,14 @@ function discourse_settings(App $a, &$s)
} }
$enabled = intval(PConfig::get(local_user(), 'discourse', 'enabled')); $enabled = intval(PConfig::get(local_user(), 'discourse', 'enabled'));
$css = ($enabled ? '' : '-disabled');
$s .= '<span id="settings_discourse_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_discourse_expanded\'); openClose(\'settings_discourse_inflated\');">'; $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/discourse/');
$s .= '<img class="connector' . $css . '" src="images/discourse.png" /><h3 class="connector">' . L10n::t('Discourse') . '</h3>'; $s .= Renderer::replaceMacros($t, [
$s .= '</span>'; '$title' => L10n::t('Discourse'),
$s .= '<div id="settings_discourse_expanded" class="settings-block" style="display: none;">'; '$css' => ($enabled ? '' : '-disabled'),
$s .= '<span class="fakelink" onclick="openClose(\'settings_discourse_expanded\'); openClose(\'settings_discourse_inflated\');">'; '$enabled' => ['enabled', L10n::t('Enable processing of Discourse mailing list mails'), $enabled, L10n::t('If enabled, incoming mails from Discourse will be improved so they look much better. To make it work, you have to configure the e-mail settings in Friendica. You also have to enable the mailing list mode in Discourse. Then you have to add the Discourse mail account as contact.')],
$s .= '<img class="connector' . $css . '" src="images/discourse.png" /><h3 class="connector">' . L10n::t('Discourse') . '</h3>'; '$submit' => L10n::t('Save Settings'),
$s .= '</span>';
$field_checkbox = Renderer::getMarkupTemplate('field_checkbox.tpl');
$s .= Renderer::replaceMacros($field_checkbox, [
'$field' => ['enabled', L10n::t('Enable processing of Discourse mailing list mails'), $enabled, L10n::t('If enabled, incoming mails from Discourse will be improved so they look much better. To make it work, you have to configure the e-mail settings in Friendica. You also have to enable the mailing list mode in Discourse. Then you have to add the Discourse mail account as contact.')]
]); ]);
$s .= '<div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="discourse-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
$s .= '</div>';
} }
function discourse_settings_post(App $a) function discourse_settings_post(App $a)

View File

@ -0,0 +1,15 @@
<span id="settings_discourse_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose('settings_discourse_expanded'); openClose('settings_discourse_inflated');">
<img class="connector{{$css}}" src="images/discourse.png" /><h3 class="connector">{{$title}}</h3>
</span>
<div id="settings_discourse_expanded" class="settings-block" style="display: none;">
<span class="fakelink" onclick="openClose('settings_discourse_expanded'); openClose('settings_discourse_inflated');">
<img class="connector{{$css}}" src="images/discourse.png" /><h3 class="connector">{{$title}}</h3>
</span>
<div id="discourse-wrapper">
{{include file="field_checkbox.tpl" field=$enabled}}
</div>
<div class="settings-submit-wrapper" >
<input type="submit" id="discourse-submit" name="discourse-submit" class="settings-submit" value="{{$submit}}" />
</div>
</div>