Created
June 21, 2010 16:01
-
-
Save tamoot/447067 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: category.rb | |
=================================================================== | |
--- category.rb (revision 3640) | |
+++ category.rb (working copy) | |
@@ -616,9 +616,10 @@ | |
if @conf['category.edit_support'] then | |
add_header_proc do | |
%Q[\t<script type="text/javascript"><!-- | |
- function inj_c(str) { | |
+ function inj_c() { | |
var textarea = window.document.forms[0].body; | |
textarea.focus(); | |
+ var str = '[' + window.document.getElementById('category_dropdown').value + ']'; | |
if (document.selection) { // IE, Opera | |
var range = document.selection.createRange(); | |
range.text = str; | |
@@ -640,10 +641,12 @@ | |
unless @categories.size == 0 then | |
ret << '<div class="field title">' | |
ret << "#{@category_conf_label}:\n" | |
+ ret << '<form name="dropdown">' | |
+ ret << '<select id="category_dropdown" onChange="inj_c()">' | |
@categories.sort_by{|e| e.downcase}.each do |c| | |
- ret << %Q!| <a href="javascript:inj_c("[#{h c}]")">#{h c}</a>\n! | |
+ ret << %Q!<option value="#{h c}">#{h c}</option>! | |
end | |
- ret << "|\n</div>\n<br>\n" | |
+ ret << "\n</select></form>\n</div>\n<br>\n" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment