Browse Source

use attribute selectors to avoid non-unique id attributes

master
cinnaboot 8 years ago
parent
commit
05cfe18874
  1. 8
      admin.html
  2. 4
      static/admin.js

8
admin.html

@ -24,10 +24,10 @@
<template id="path_info_template">
<li>
<form>
<input id="movie" type="radio" name="media_type" value="movie" />
<label for="movie">movie</label>
<input id="tv_show" type="radio" name="media_type" value="tv_show" />
<label for="tv_show">tv_show</label>
<input type="radio" name="media_type" value="movie" />
<label>movie</label>
<input type="radio" name="media_type" value="tv_show" />
<label>tv_show</label>
<span />
</form>
</li>

4
static/admin.js

@ -39,9 +39,9 @@ function displayPathInfo(path_info)
sub_list.classList.add('unknown');
if (path_info.media_type == 'movie')
sub_list.querySelector('#movie').setAttribute('checked', true);
sub_list.querySelector('input[value^="movie"]').setAttribute('checked', true);
else if (path_info.media_type == 'tv_show')
sub_list.querySelector('#tv_show').setAttribute('checked', true);
sub_list.querySelector('input[value^="tv_show"]').setAttribute('checked', true);
// NOTE: don't display the radio buttons on top level directory
if (path_info.depth == 0) {

Loading…
Cancel
Save