From 431abc13ab29da644e4ee524570c6717f07138cf Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 14 Aug 2017 12:35:48 -0700 Subject: [PATCH] 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") --- html/inc/prefs.inc | 15 +++++++++++---- html/inc/util.inc | 14 +++++++------- html/user/prefs.php | 4 +++- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/html/inc/prefs.inc b/html/inc/prefs.inc index 2557f24e00..a95003b2ce 100644 --- a/html/inc/prefs.inc +++ b/html/inc/prefs.inc @@ -505,7 +505,12 @@ function prefs_display_venue($prefs, $venue, $subset) { end_table(); echo "\n"; } else { - echo "

".tra("Add separate preferences for %1", $venue).""; + echo "

"; + 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("
", - "".tra("Edit preferences")." - "); + 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("", ""); + row2("", ""); end_table(); echo "\n"; } diff --git a/html/inc/util.inc b/html/inc/util.inc index 2e4dea94e4..c3bb9b1c77 100644 --- a/html/inc/util.inc +++ b/html/inc/util.inc @@ -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 "".$text." - "; + return sprintf('%s', + $url, $desc, $class, $text + ); } -function button_text($url, $text, $desc=null, $class="btn btn-default") { - if (!$desc) $desc = $text; - return "".$text." - "; +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 diff --git a/html/user/prefs.php b/html/user/prefs.php index f23d8d6e76..98c2e79f8b 100644 --- a/html/user/prefs.php +++ b/html/user/prefs.php @@ -49,10 +49,12 @@ if (isset($defaults)) { if ($subset == "global") { print_prefs_display_global($user, $columns); if (!$defaults) { + echo "

"; show_button( "prefs_default.php", "Restore defaults", - "Restore default preferences" + "Restore default preferences", + "btn-warning btn-sm" ); } } else {