Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
images get inserted without having to close the facebox and open it a…
…gain
- Loading branch information
Jeff Kreeftmeijer
committed
Jun 4, 2010
1 parent
02189c4
commit 822b99f
Showing
3 changed files
with
17 additions
and
10 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
module WysihatFilesHelper | ||
def include_link(file) | ||
def include_link(file) | ||
function = file.file_content_type.starts_with?('image') ? | ||
".insertImage(this.href);" : | ||
".insertHTML('<a href=\"' + this.href + '\">#{file.file_file_name}</a>');" | ||
|
||
link_to_function( | ||
file.file_file_name, | ||
"$$('iframe##{params[:editor]}')[0]#{function}facebox.close();", | ||
"$$('iframe##{editor_id}')[0]#{function}facebox.close();", | ||
:href => file.file.url | ||
) | ||
end | ||
|
||
def editor_id | ||
return params[:wysihat_file][:editor] if params[:wysihat_file] && params[:wysihat_file][:editor] | ||
params[:editor] | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
<% form_for @wysihat_file, :html => { :multipart => true, :target => 'file_upload' } do |f| %> | ||
|
||
<%= f.hidden_field(:editor, :value => params[:editor]) %> | ||
|
||
<p> | ||
<%= f.label :file %><br/> | ||
<%= f.file_field :file %> | ||
</p> | ||
<p> | ||
<%= f.submit %> | ||
</p> | ||
|
||
<% end %> | ||
|
||
<iframe id='file_upload' name="file_upload" style="width:1px;height:1px;border:0px" src="about:blank"></iframe> |