1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-24 05:51:28 +00:00

login form: use control helpers

This commit is contained in:
Andrew Dolgov
2021-02-16 15:05:32 +03:00
parent 22fc6871e8
commit af4b3e7df0
2 changed files with 10 additions and 9 deletions

View File

@@ -64,12 +64,12 @@
name=\"".htmlspecialchars($name)."\" value=\"".htmlspecialchars($value)."\">"; name=\"".htmlspecialchars($name)."\" value=\"".htmlspecialchars($value)."\">";
} }
function checkbox_tag(string $name, bool $checked, string $value = "", string $attributes = "", string $id = "") { function checkbox_tag(string $name, bool $checked = false, string $value = "", string $attributes = "", string $id = "") {
$is_checked = $checked ? "checked" : ""; $is_checked = $checked ? "checked" : "";
$value_str = $value ? "value=\"".htmlspecialchars($value)."\"" : ""; $value_str = $value ? "value=\"".htmlspecialchars($value)."\"" : "";
return "<input dojoType='dijit.form.CheckBox' name=\"".htmlspecialchars($name)."\" return "<input dojoType='dijit.form.CheckBox' name=\"".htmlspecialchars($name)."\"
$value_str $is_checked $attributes name=\"".htmlspecialchars($id)."\">"; $value_str $is_checked $attributes id=\"".htmlspecialchars($id)."\">";
} }
function select_feeds_cats(string $name, int $default_id = null, string $attributes = "", function select_feeds_cats(string $name, int $default_id = null, string $attributes = "",

View File

@@ -141,8 +141,8 @@
<fieldset class="narrow"> <fieldset class="narrow">
<label> </label> <label> </label>
<label id="bw_limit_label"><input dojoType="dijit.form.CheckBox" name="bw_limit" id="bw_limit" <label id="bw_limit_label">
type="checkbox" onchange="UtilityApp.bwLimitChange(this)"> <?= \Controls\checkbox_tag("safe_mode", false, "", "onchange='UtilityApp.bwLimitChange(this)'", 'bw_limit') ?>
<?= __("Use less traffic") ?></label> <?= __("Use less traffic") ?></label>
</fieldset> </fieldset>
@@ -153,9 +153,10 @@
<fieldset class="narrow"> <fieldset class="narrow">
<label> </label> <label> </label>
<label id="safe_mode_label"><input dojoType="dijit.form.CheckBox" name="safe_mode" id="safe_mode" <label id="safe_mode_label">
type="checkbox"> <?= \Controls\checkbox_tag("safe_mode") ?>
<?= __("Safe mode") ?></label> <?= __("Safe mode") ?>
</label>
</fieldset> </fieldset>
<div dojoType="dijit.Tooltip" connectId="safe_mode_label" position="below" style="display:none"> <div dojoType="dijit.Tooltip" connectId="safe_mode_label" position="below" style="display:none">
@@ -166,7 +167,7 @@
<fieldset class="narrow"> <fieldset class="narrow">
<label> </label> <label> </label>
<label> <label>
<input dojoType="dijit.form.CheckBox" name="remember_me" id="remember_me" type="checkbox"> <?= \Controls\checkbox_tag("remember_me") ?>
<?= __("Remember me") ?> <?= __("Remember me") ?>
</label> </label>
</fieldset> </fieldset>
@@ -177,7 +178,7 @@
<fieldset class="align-right"> <fieldset class="align-right">
<label> </label> <label> </label>
<button dojoType="dijit.form.Button" type="submit" class="alt-primary"><?= __('Log in') ?></button> <?= \Controls\submit_tag(__('Log in')) ?>
</fieldset> </fieldset>
</form> </form>