Improve button appearance in prefs page

- for "add prefs for home" etc. use buttons instead of link
- use green for default button
- use yellow for risky buttons (like "reset prefs")
This commit is contained in:
David Anderson 2017-08-14 12:35:48 -07:00
parent ac21dc8e1f
commit 431abc13ab
3 changed files with 21 additions and 12 deletions

View File

@ -505,7 +505,12 @@ function prefs_display_venue($prefs, $venue, $subset) {
end_table();
echo "</td></tr>\n";
} else {
echo "<p><a href=add_venue.php?venue=$venue&subset=$subset$tokens>".tra("Add separate preferences for %1", $venue)."</a>";
echo "<p>";
show_button("add_venue.php?venue=$venue&subset=$subset$tokens>",
tra("Add separate preferences for %1", $venue),
tra("Add separate preferences for %1", $venue),
"btn-primary btn-sm"
);
}
}
@ -534,8 +539,10 @@ function print_prefs_display_global($user, $columns=false) {
prefs_show_global($global_prefs);
$tokens = url_tokens($user->authenticator);
row2("<br>",
"<a href=prefs_edit.php?subset=global$tokens>".tra("Edit preferences")."</a>
");
button_text("prefs_edit.php?subset=global$tokens",
tra("Edit preferences")
)
);
end_table();
prefs_display_venue($global_prefs, "home", "global");
@ -586,7 +593,7 @@ function print_prefs_form(
prefs_form_project_specific($prefs->project_specific, $project_error);
}
row2("", "<input class=\"btn btn-primary\" type=submit value=\"$submit_value\" name=\"action\">");
row2("", "<input class=\"btn btn-success\" type=submit value=\"$submit_value\" name=\"action\">");
end_table();
echo "</form>\n";
}

View File

@ -829,18 +829,18 @@ function current_url() {
// @param desc The title of the destination - typically used as a popup
// @param class The optional CSS class of the button. Defaults to a standard button
//
function show_button($url, $text, $desc=null, $class="btn btn-default btn-xs") {
function button_text($url, $text, $desc=null, $class="btn-success btn-sm") {
if (!$desc) {
$desc = $text;
}
echo "<a href=\"".$url."\" title=\"$desc\" class=\"".$class."\">".$text."</a>
";
return sprintf('<a href="%s" title="%s" class="btn %s"><span style="font-size:1.2em">%s</span></a>',
$url, $desc, $class, $text
);
}
function button_text($url, $text, $desc=null, $class="btn btn-default") {
if (!$desc) $desc = $text;
return "<a href=\"".$url."\" title=\"$desc\" class=\"".$class."\">".$text."</a>
";
function show_button($url, $text, $desc=null, $class="btn-success btn-sm") {
echo button_text($url, $text, $desc=null, $class);
}
// When multiple buttons (or actions) are presented in a list you can

View File

@ -49,10 +49,12 @@ if (isset($defaults)) {
if ($subset == "global") {
print_prefs_display_global($user, $columns);
if (!$defaults) {
echo "<p>";
show_button(
"prefs_default.php",
"Restore defaults",
"Restore default preferences"
"Restore default preferences",
"btn-warning btn-sm"
);
}
} else {