diff options
| author | hukl <contact@smyck.org> | 2009-04-16 12:14:45 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-04-16 12:14:45 +0200 |
| commit | 7fe358bfb11f1cba4ee9237c4ef4b7efc3cfba87 (patch) | |
| tree | a4ee5095b0ff151891d0ec402dc5b00bedb9a565 /app/views | |
| parent | 7176edae9b93eb00e7982ec2d9a69f5b28633907 (diff) | |
added autosave to node edit view. saves every 15 seconds
Diffstat (limited to 'app/views')
| -rw-r--r-- | app/views/layouts/admin.html.erb | 2 | ||||
| -rw-r--r-- | app/views/nodes/_autosave.html.erb | 6 | ||||
| -rw-r--r-- | app/views/nodes/edit.html.erb | 2 | ||||
| -rw-r--r-- | app/views/nodes/update.js.erb | 3 |
4 files changed, 12 insertions, 1 deletions
diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index 469b18e..1fb9c2b 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb | |||
| @@ -7,8 +7,8 @@ | |||
| 7 | 7 | ||
| 8 | <title><%= "#{params[:controller]} | #{params[:action]}" %></title> | 8 | <title><%= "#{params[:controller]} | #{params[:action]}" %></title> |
| 9 | <%= stylesheet_link_tag 'admin' %> | 9 | <%= stylesheet_link_tag 'admin' %> |
| 10 | <%= javascript_include_tag 'tiny_mce/tiny_mce.js' %> | ||
| 11 | <%= javascript_include_tag 'jquery-1.3.2.min' %> | 10 | <%= javascript_include_tag 'jquery-1.3.2.min' %> |
| 11 | <%= javascript_include_tag 'tiny_mce/tiny_mce.js' %> | ||
| 12 | <%= javascript_include_tag 'admin_interface.js' %> | 12 | <%= javascript_include_tag 'admin_interface.js' %> |
| 13 | 13 | ||
| 14 | <script type="text/javascript"> | 14 | <script type="text/javascript"> |
diff --git a/app/views/nodes/_autosave.html.erb b/app/views/nodes/_autosave.html.erb new file mode 100644 index 0000000..583b374 --- /dev/null +++ b/app/views/nodes/_autosave.html.erb | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | |||
| 2 | <script type="text/javascript" charset="utf-8"> | ||
| 3 | $(document).ready(function() { | ||
| 4 | setInterval('$("#edit_node_<%= @node.id %>").submitWithAjax()', 15000); | ||
| 5 | }); | ||
| 6 | </script> \ No newline at end of file | ||
diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb index d8fb8b4..0d0b0d3 100644 --- a/app/views/nodes/edit.html.erb +++ b/app/views/nodes/edit.html.erb | |||
| @@ -5,6 +5,8 @@ | |||
| 5 | <%= link_to 'Revisions', revision_path(params[:id]) %> | 5 | <%= link_to 'Revisions', revision_path(params[:id]) %> |
| 6 | <% end %> | 6 | <% end %> |
| 7 | 7 | ||
| 8 | <%= render :partial => 'autosave' %> | ||
| 9 | |||
| 8 | <div id="page_editor"> | 10 | <div id="page_editor"> |
| 9 | <% form_for(@node) do |f| %> | 11 | <% form_for(@node) do |f| %> |
| 10 | <%= f.error_messages %> | 12 | <%= f.error_messages %> |
diff --git a/app/views/nodes/update.js.erb b/app/views/nodes/update.js.erb new file mode 100644 index 0000000..be26fab --- /dev/null +++ b/app/views/nodes/update.js.erb | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | $("#flash").html( | ||
| 2 | "<span><%= escape_javascript(flash.delete(:notice)) %></span>" | ||
| 3 | ); \ No newline at end of file | ||
