Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the WebivaExport to export custom content models
- Loading branch information
Doug Youch
committed
Oct 14, 2010
1 parent
f9600b8
commit c576c72
Showing
6 changed files
with
23 additions
and
86 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,64 +1,37 @@ | ||
<script> | ||
Exporter = { | ||
updateForm: function() { | ||
if($('export_download_range').checked) { | ||
$('export_range_start').disabled = false; | ||
$('export_range_end').disabled = false; | ||
} | ||
else { | ||
$('export_range_start').disabled = true; | ||
$('export_range_end').disabled = true; | ||
} | ||
}, | ||
|
||
generate: function() { | ||
$('export_download').innerHTML = '<%= jh "Exporting File".t %>'; | ||
Element.show('export_download'); | ||
$('submit_button').disabled = true; | ||
new Ajax.Request("<%= url_for :action => 'generate_file', :path => @content_model.id %>", | ||
{ parameters: Form.serialize('export_form'), | ||
onComplete: function(req) { | ||
setTimeout(Exporter.status,1000); | ||
} | ||
} | ||
); | ||
}, | ||
|
||
status: function() { | ||
$('export_download').innerHTML = '<%= jh "Still Exporting...".t %>'; | ||
new Ajax.Request("<%= url_for :action => 'status', :path => @content_model.id %>") | ||
}, | ||
|
||
download: function() { | ||
$('export_download').innerHTML = '<%= jh "Downloading".t %>'; | ||
document.location = "<%= url_for :action => 'download_file', :path => @content_model.id %>"; | ||
setTimeout(Exporter.backToContent,3000); | ||
}, | ||
|
||
backToContent: function() { | ||
document.location = "<%= url_for :controller => '/content', :action => 'view', :path => @content_model.id %>"; | ||
|
||
Exporter = { | ||
updateForm: function() { | ||
if($('export_download_range').checked) { | ||
$('export_range_start').disabled = false; | ||
$('export_range_end').disabled = false; | ||
} else { | ||
$('export_range_start').disabled = true; | ||
$('export_range_end').disabled = true; | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<div class='admin_content'> | ||
<% cms_form_for :export, @export, :html => { :onsubmit => 'Exporter.generate(); return false;', :id => 'export_form' } do |f| %> | ||
<% cms_form_for :export, @export, :html => { :id => 'export_form' } do |f| %> | ||
<%= f.radio_buttons :download, [ [ 'All Entries','all' ], ['Range of Entries','range' ]], :vertical => true, :separator => '<br/>', :onchange => 'Exporter.updateForm();' %> | ||
<% f.custom_field 'Entry Range', :vertical => true do %> | ||
Entry # <input type='text' id='export_range_start' name='export[range_start]' size='4' value='1' /> to <input type='text' name='export[range_end]' size='4' id='export_range_end' value='<%= @entry_count %>'/> | ||
<% end -%> | ||
<%= f.radio_buttons :export_format , @export_options , :vertical => true, :separator => '<br/>', :label => 'Format of downloaded file' %> | ||
<tr> | ||
<td colspan='2' align='right'> | ||
<span style='display:none;' id='export_download'><%= "Exporting File".t %></span> <input type='submit' value='<%= vh "Export & Download".t %>' id='submit_button' /> | ||
<input type='button' value='<%= vh "Export & Download".t %>' id='export_button' /><span style='display:none;' id='export_button_status'><%= "Exporting File".t %></span> | ||
</td> | ||
</tr> | ||
|
||
|
||
|
||
<% end -%> | ||
</div> | ||
|
||
<script> | ||
Exporter.updateForm(); | ||
Exporter.updateForm(); | ||
|
||
new WebivaExporter({button: '#export_button', | ||
url: "<%= url_for :action => 'generate_file', :path => @content_model.id %>", | ||
frm: '#export_form', | ||
onComplete: function() {document.location = "<%= url_for :controller => '/content', :action => 'view', :path => @content_model.id %>";}}); | ||
</script> | ||
</div> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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