diff options
author | Joey Hess <joey@kitenet.net> | 2011-06-15 19:08:40 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-06-15 19:08:40 -0400 |
commit | e2b43578a677894d23fa526d9201e5a89b231abc (patch) | |
tree | cd59dc2071520757b616d038e8c27ac6a0195bc4 | |
parent | 3a939f05c509ef57740d6524c785667e36ccff24 (diff) | |
download | ikiwiki-e2b43578a677894d23fa526d9201e5a89b231abc.tar ikiwiki-e2b43578a677894d23fa526d9201e5a89b231abc.tar.gz |
load attachment javascript into template the clean way
-rw-r--r-- | IkiWiki/Plugin/attachment.pm | 17 | ||||
-rw-r--r-- | doc/style.css | 8 | ||||
-rw-r--r-- | templates/editpage.tmpl | 8 | ||||
-rw-r--r-- | underlays/attachment/ikiwiki/jquery.fileupload-ui.js (renamed from underlays/attachments/ikiwiki/jquery.fileupload-ui.js) | 0 | ||||
-rw-r--r-- | underlays/attachment/ikiwiki/jquery.fileupload.js (renamed from underlays/attachments/ikiwiki/jquery.fileupload.js) | 0 | ||||
-rw-r--r-- | underlays/attachment/ikiwiki/jquery.iframe-transport.js (renamed from underlays/attachments/ikiwiki/jquery.iframe-transport.js) | 0 | ||||
-rw-r--r-- | underlays/attachment/ikiwiki/pbar-ani.gif (renamed from underlays/attachments/ikiwiki/pbar-ani.gif) | bin | 3323 -> 3323 bytes | |||
-rw-r--r-- | underlays/attachments/ikiwiki/jquery.fileupload-ui.css | 8 |
8 files changed, 22 insertions, 19 deletions
diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm index fdae8d1e0..be30e97b9 100644 --- a/IkiWiki/Plugin/attachment.pm +++ b/IkiWiki/Plugin/attachment.pm @@ -7,6 +7,7 @@ use IkiWiki 3.00; sub import { add_underlay("javascript"); + add_underlay("attachment"); hook(type => "getsetup", id => "attachment", call => \&getsetup); hook(type => "checkconfig", id => "attachment", call => \&checkconfig); hook(type => "formbuilder_setup", id => "attachment", call => \&formbuilder_setup); @@ -89,10 +90,20 @@ sub formbuilder_setup (@) { $form->tmpl_param("field-upload" => '<input name="_submit" type="submit" value="Upload Attachment" />'); $form->tmpl_param("field-link" => '<input name="_submit" type="submit" value="Insert Links" />'); - # Add the toggle javascript; the attachments interface uses - # it to toggle visibility. + # Add all the javascript used by the attachments interface. require IkiWiki::Plugin::toggle; - $form->tmpl_param("javascript" => IkiWiki::Plugin::toggle::include_javascript($params{page})); + my $js=IkiWiki::Plugin::toggle::include_javascript($params{page}); + $js.='<link rel="stylesheet" href="'.urlto("ikiwiki/jquery-ui.css", $params{page}).' id="theme">\n'; + my @jsfiles=qw{jquery.min jquery-ui.min + jquery.tmpl.min jquery.iframe-transport + jquery.fileupload jquery.fileupload-ui + }; + foreach my $file (@jsfiles) { + $js.='<script src="'.urlto("ikiwiki/$file.js", $params{page}). + '" type="text/javascript" charset="utf-8"></script>'."\n"; + } + $form->tmpl_param("javascript" => $js); + # Start with the attachments interface toggled invisible, # but if it was used, keep it open. if ($form->submitted ne "Upload Attachment" && diff --git a/doc/style.css b/doc/style.css index fcf39be6a..42985c9f4 100644 --- a/doc/style.css +++ b/doc/style.css @@ -493,3 +493,11 @@ a.openid_large_btn:focus { .openid_selected { border: 4px solid #DDD; } + +.fileupload-content .ui-progressbar { + width: 200px; + height: 20px; +} +.fileupload-content .ui-progressbar-value { + background: url(ikiwiki/pbar-ani.gif); +} diff --git a/templates/editpage.tmpl b/templates/editpage.tmpl index b3098a240..efe077f84 100644 --- a/templates/editpage.tmpl +++ b/templates/editpage.tmpl @@ -1,5 +1,3 @@ -<link rel="stylesheet" href="http://localhost/~joey/tmp/blueimp-jQuery-File-Upload-7f89121/jquery-ui.css" id="theme"> -<link rel="stylesheet" href="http://localhost/~joey/tmp/blueimp-jQuery-File-Upload-7f89121/jquery.fileupload-ui.css"> <TMPL_VAR JAVASCRIPT> <TMPL_VAR MESSAGE> <br /> @@ -29,12 +27,6 @@ <a class="toggle" href="#attachments">Attachments</a> <div class="<TMPL_VAR ATTACHMENTS-CLASS>" id="attachments"> <div id="fileupload"> -<script src="http://localhost/~joey/tmp/blueimp-jQuery-File-Upload-7f89121/jquery.min.js"></script> -<script src="http://localhost/~joey/tmp/blueimp-jQuery-File-Upload-7f89121/jquery-ui.min.js"></script> -<script src="http://localhost/~joey/tmp/blueimp-jQuery-File-Upload-7f89121/jquery.tmpl.min.js"></script> -<script src="http://localhost/~joey/tmp/blueimp-jQuery-File-Upload-7f89121/jquery.iframe-transport.js"></script> -<script src="http://localhost/~joey/tmp/blueimp-jQuery-File-Upload-7f89121/jquery.fileupload.js"></script> -<script src="http://localhost/~joey/tmp/blueimp-jQuery-File-Upload-7f89121/jquery.fileupload-ui.js"></script> <script> $(function () { $('#fileupload').fileupload(); }); // initialize upload widget </script> diff --git a/underlays/attachments/ikiwiki/jquery.fileupload-ui.js b/underlays/attachment/ikiwiki/jquery.fileupload-ui.js index 61897ba55..61897ba55 100644 --- a/underlays/attachments/ikiwiki/jquery.fileupload-ui.js +++ b/underlays/attachment/ikiwiki/jquery.fileupload-ui.js diff --git a/underlays/attachments/ikiwiki/jquery.fileupload.js b/underlays/attachment/ikiwiki/jquery.fileupload.js index 1e3c6bf97..1e3c6bf97 100644 --- a/underlays/attachments/ikiwiki/jquery.fileupload.js +++ b/underlays/attachment/ikiwiki/jquery.fileupload.js diff --git a/underlays/attachments/ikiwiki/jquery.iframe-transport.js b/underlays/attachment/ikiwiki/jquery.iframe-transport.js index e859dfe49..e859dfe49 100644 --- a/underlays/attachments/ikiwiki/jquery.iframe-transport.js +++ b/underlays/attachment/ikiwiki/jquery.iframe-transport.js diff --git a/underlays/attachments/ikiwiki/pbar-ani.gif b/underlays/attachment/ikiwiki/pbar-ani.gif Binary files differindex fbcce6bc9..fbcce6bc9 100644 --- a/underlays/attachments/ikiwiki/pbar-ani.gif +++ b/underlays/attachment/ikiwiki/pbar-ani.gif diff --git a/underlays/attachments/ikiwiki/jquery.fileupload-ui.css b/underlays/attachments/ikiwiki/jquery.fileupload-ui.css deleted file mode 100644 index d792724b7..000000000 --- a/underlays/attachments/ikiwiki/jquery.fileupload-ui.css +++ /dev/null @@ -1,8 +0,0 @@ -.fileupload-content .ui-progressbar { - width: 200px; - height: 20px; -} - -.fileupload-content .ui-progressbar-value { - background: url(pbar-ani.gif); -} |