@@ -376,25 +376,21 @@ impl Setting {
376376 description,
377377 ) ,
378378 Setting :: Select { js_data_name, description, default_value, ref options } => format ! (
379- "<div class=\" setting-line\" >\
380- <div>{}</div>\
381- <label class=\" select-wrapper\" >\
382- <select id=\" {}\" autocomplete=\" off\" >{}</select>\
383- <img src=\" {}down-arrow{}.svg\" alt=\" Select item\" >\
384- </label>\
385- </div>",
386- description,
379+ "<div class=\" setting-line\" ><div class=\" radio-line\" id=\" {}\" ><span class=\" setting-name\" >{}</span>{}</div></div>" ,
387380 js_data_name,
381+ description,
388382 options
389383 . iter( )
390384 . map( |opt| format!(
391- "<option value=\" {name}\" {}>{name}</option>" ,
392- if opt == default_value { "selected" } else { "" } ,
385+ "<label for=\" {js_data_name}-{name}\" class=\" choice\" >
386+ <input type=\" radio\" name=\" {js_data_name}\" id=\" {js_data_name}-{name}\" value=\" {name}\" {checked}>\
387+ {name}\
388+ </label>",
389+ js_data_name = js_data_name,
393390 name = opt,
391+ checked = if opt == default_value { "checked" } else { "" } ,
394392 ) )
395393 . collect:: <String >( ) ,
396- root_path,
397- suffix,
398394 ) ,
399395 }
400396 }
@@ -418,31 +414,25 @@ impl<T: Into<Setting>> From<(&'static str, Vec<T>)> for Setting {
418414fn settings ( root_path : & str , suffix : & str , theme_names : Vec < String > ) -> Result < String , Error > {
419415 // (id, explanation, default value)
420416 let settings: & [ Setting ] = & [
421- (
422- "Theme preferences" ,
423- vec ! [
424- Setting :: from( ( "use-system-theme" , "Use system theme" , true ) ) ,
425- Setting :: Select {
426- js_data_name: "theme" ,
427- description: "Theme" ,
428- default_value: "light" ,
429- options: theme_names. clone( ) ,
430- } ,
431- Setting :: Select {
432- js_data_name: "preferred-dark-theme" ,
433- description: "Preferred dark theme" ,
434- default_value: "dark" ,
435- options: theme_names. clone( ) ,
436- } ,
437- Setting :: Select {
438- js_data_name: "preferred-light-theme" ,
439- description: "Preferred light theme" ,
440- default_value: "light" ,
441- options: theme_names,
442- } ,
443- ] ,
444- )
445- . into ( ) ,
417+ Setting :: from ( ( "use-system-theme" , "Use system theme" , true ) ) ,
418+ Setting :: Select {
419+ js_data_name : "theme" ,
420+ description : "Theme" ,
421+ default_value : "light" ,
422+ options : theme_names. clone ( ) ,
423+ } ,
424+ Setting :: Select {
425+ js_data_name : "preferred-light-theme" ,
426+ description : "Preferred light theme" ,
427+ default_value : "light" ,
428+ options : theme_names. clone ( ) ,
429+ } ,
430+ Setting :: Select {
431+ js_data_name : "preferred-dark-theme" ,
432+ description : "Preferred dark theme" ,
433+ default_value : "dark" ,
434+ options : theme_names,
435+ } ,
446436 ( "auto-hide-large-items" , "Auto-hide item contents for large items." , true ) . into ( ) ,
447437 ( "auto-hide-method-docs" , "Auto-hide item methods' documentation" , false ) . into ( ) ,
448438 ( "auto-hide-trait-implementations" , "Auto-hide trait implementation documentation" , false )
@@ -454,9 +444,14 @@ fn settings(root_path: &str, suffix: &str, theme_names: Vec<String>) -> Result<S
454444 ] ;
455445
456446 Ok ( format ! (
457- "<h1 class=\" fqn\" >\
458- <span class=\" in-band\" >Rustdoc settings</span>\
459- </h1>\
447+ "<div class=\" main-heading\" >
448+ <h1 class=\" fqn\" >\
449+ <span class=\" in-band\" >Rustdoc settings</span>\
450+ </h1>\
451+ <span class=\" out-of-band\" >\
452+ <a id=\" back\" href=\" javascript:void(0)\" >Back</a>\
453+ </span>\
454+ </div>\
460455 <div class=\" settings\" >{}</div>\
461456 <link rel=\" stylesheet\" href=\" {root_path}settings{suffix}.css\" >\
462457 <script src=\" {root_path}settings{suffix}.js\" ></script>",
0 commit comments