日記
labelがあった方がいいよねEdit

tDiaryでは、管理機能のチェックボックスにlabelが指定されていないけど、あった方が便利だよね*1。ということで、自分が使っている範囲のところに追加してみた。

でもこういうことは、場当たり的にやらずにちゃんと網羅的にやった方がいいんだろうな。あとlabel for="[ID]"を使うとinput type="checkbox"にidが必要になるんだけど、他の場所とのidの重複が怖いんで、専用のネームスペース(っつーかprefix)を使った方がいいかもしれない。

update.rhtml

*** update.rhtml.org    2006-02-13 18:05:49.000000000 +0900
--- update.rhtml        2006-02-13 18:22:31.637861952 +0900
***************
*** 38,44 ****
<input type="submit" tabindex="999" accesskey="A" name="<%%= submit_command %>" value=" <%%= submit_label %> ">
</span>
<span class="checkbox hidediary">
!                       この日の日記を隠す<input type="checkbox" name="hide" value="true" <% unless @diary.visible? then %>checked <% end %>tabindex="1000" accesskey="H">
</span>
</div></form>
</div>
--- 38,44 ----
<input type="submit" tabindex="999" accesskey="A" name="<%%= submit_command %>" value=" <%%= submit_label %> ">
</span>
<span class="checkbox hidediary">
!                       <label for="hide">この日の日記を隠す</label><input type="checkbox" name="hide" id="hide" value="true" <% unless @diary.visible? then %>checked <% end %>tabindex="1000" accesskey="H">
</span>
</div></form>
</div>
***************
*** 59,68 ****
@diary.each_comment( 100 ) do |comment| %>
<div class="commentator">
<span class="checkbox">
!                                       <input class="checkbox" type="checkbox" tabindex="<%=2000+idx%>" name="<%= idx += 1 %>" value="true"<% if comment.visible? then %> checked<% end %>>
</span>
<span class="commentator"><%= CGI::escapeHTML( comment.name ) %><%= CGI::escapeHTML( " <#{comment.mail}>" ) unless comment.mail.empty? %></span>
<span class="commenttime"><%%=comment_date( Time::at( <%=comment.date.to_i%> ) )%></span>
</div>
<p><%= comment.body.make_link.gsub( /\n/, "<br>" ).gsub( /<br><br>\Z/, '' ) %></p><%
end
--- 59,70 ----
@diary.each_comment( 100 ) do |comment| %>
<div class="commentator">
<span class="checkbox">
!                                       <input class="checkbox" type="checkbox" tabindex="<%=2000+idx%>" name="<%= idx += 1 %>" id="cid_<%= idx += 1 %>" value="true"<% if comment.visible? then %> checked<% end %>>
</span>
+                 <label for="cid_<%= idx %>">
<span class="commentator"><%= CGI::escapeHTML( comment.name ) %><%= CGI::escapeHTML( " <#{comment.mail}>" ) unless comment.mail.empty? %></span>
<span class="commenttime"><%%=comment_date( Time::at( <%=comment.date.to_i%> ) )%></span>
+                 </label>
</div>
<p><%= comment.body.make_link.gsub( /\n/, "<br>" ).gsub( /<br><br>\Z/, '' ) %></p><%
end

ping.rb

*** ping.rb.org 2006-02-13 18:14:32.000000000 +0900
--- ping.rb     2006-02-13 18:17:43.915602384 +0900
***************
*** 84,91 ****
def ping_edit_proc
r = <<-HTML
<div class="ping">
!       <input type="checkbox" name="plugin_ping_send" value="true" checked tabindex="400" />
#{@ping_label_send}
</div>
HTML
end
--- 84,93 ----
def ping_edit_proc
r = <<-HTML
<div class="ping">
!       <input type="checkbox" name="plugin_ping_send" id="plugin_ping_send" value="true" checked tabindex="400" />
!    <label for="plugin_ping_send">
#{@ping_label_send}
+    </label>
</div>
HTML
end

makerss.rb

*** makerss.rb.org      2006-02-13 18:18:15.032871840 +0900
--- makerss.rb  2006-02-13 18:18:49.595617504 +0900
***************
*** 301,308 ****
checked = @cgi.params['makerss_update'][0] == 'false' ? ' checked' : ''
r = <<-HTML
<div class="makerss">
!       <input type="checkbox" name="makerss_update" value="false"#{checked} tabindex="390" />
#{@makerss_edit_label}
</div>
HTML
end
--- 301,310 ----
checked = @cgi.params['makerss_update'][0] == 'false' ? ' checked' : ''
r = <<-HTML
<div class="makerss">
!       <input type="checkbox" name="makerss_update" id="makerss_update" value="false"#{checked} tabindex="390" />
!     <label for="makerss_update">
#{@makerss_edit_label}
+     </label>
</div>
HTML
end

*1 チェックボックス自体をクリックしなくても、その説明文とかをクリックしてチェックボックスのオン・オフを切り替えることができるようになる

Published At2006-02-13 00:00Updated At2006-02-13 00:00