diff options
| author | hukl <contact@smyck.org> | 2009-06-13 15:42:13 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-06-13 15:42:13 +0200 |
| commit | edd450502f74dcbe8175dfddee8b50d14424a390 (patch) | |
| tree | c5b8c1b9b4ba57151cc72a6235e10807916ddeb4 /app | |
| parent | 4b60f3637c63c40f7b542bcb89cc48f0a6315e0b (diff) | |
added js search widget with clickable results that will take the user to the brand new "show" version of the page. so the user doesn't create new revisions and locks all the time when he / she only wants to take a look at it.
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/admin_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/nodes_controller.rb | 8 | ||||
| -rw-r--r-- | app/views/layouts/admin.html.erb | 29 | ||||
| -rw-r--r-- | app/views/nodes/edit.html.erb | 7 | ||||
| -rw-r--r-- | app/views/nodes/show.html.erb | 40 |
5 files changed, 57 insertions, 29 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 8d7d2ea..517506f 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb | |||
| @@ -19,7 +19,7 @@ class AdminController < ApplicationController | |||
| 19 | format.html | 19 | format.html |
| 20 | format.js do | 20 | format.js do |
| 21 | render( :json => @results.map do |node| | 21 | render( :json => @results.map do |node| |
| 22 | {:id => node.id, :title => node.title} | 22 | {:id => node.id, :title => node.title, :edit_path => node_path(node)} |
| 23 | end | 23 | end |
| 24 | ) | 24 | ) |
| 25 | 25 | ||
diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb index 1c7278c..09d0c52 100644 --- a/app/controllers/nodes_controller.rb +++ b/app/controllers/nodes_controller.rb | |||
| @@ -40,14 +40,6 @@ class NodesController < ApplicationController | |||
| 40 | 40 | ||
| 41 | def show | 41 | def show |
| 42 | @page = Node.find(params[:id]).pages.last | 42 | @page = Node.find(params[:id]).pages.last |
| 43 | |||
| 44 | if @page | ||
| 45 | template = @page.valid_template | ||
| 46 | render( | ||
| 47 | :file => template, | ||
| 48 | :layout => "application" | ||
| 49 | ) | ||
| 50 | end | ||
| 51 | end | 43 | end |
| 52 | 44 | ||
| 53 | def edit | 45 | def edit |
diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index fea6b5a..1c985d9 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | <%= javascript_include_tag 'tiny_mce/tiny_mce.js' %> | 11 | <%= javascript_include_tag 'tiny_mce/tiny_mce.js' %> |
| 12 | <%= javascript_include_tag 'admin_search.js' %> | 12 | <%= javascript_include_tag 'admin_search.js' %> |
| 13 | <%= javascript_include_tag 'admin_interface.js' %> | 13 | <%= javascript_include_tag 'admin_interface.js' %> |
| 14 | <%= javascript_include_tag 'jquery.hotkeys' %> | ||
| 14 | 15 | ||
| 15 | <script type="text/javascript"> | 16 | <script type="text/javascript"> |
| 16 | tinyMCE.init({ | 17 | tinyMCE.init({ |
| @@ -34,17 +35,14 @@ | |||
| 34 | <body> | 35 | <body> |
| 35 | <div id="wrapper"> | 36 | <div id="wrapper"> |
| 36 | <div id="navigation"> | 37 | <div id="navigation"> |
| 37 | <%= render :partial => 'admin/menu' if current_user %> | 38 | <div id="main_navigation"> |
| 39 | <%= render :partial => 'admin/menu' if current_user %> | ||
| 40 | </div> | ||
| 41 | <div id="sub_navigation"> | ||
| 42 | <%= yield :subnavigation %> | ||
| 43 | </div> | ||
| 38 | </div> | 44 | </div> |
| 39 | <div id="subnavigation"> | 45 | <div style="clear: both;"></div> |
| 40 | <%= yield :subnavigation %> | ||
| 41 | </div> | ||
| 42 | <div id="admin_search"> | ||
| 43 | <% form_tag admin_search_path do %> | ||
| 44 | <%= text_field_tag :search_term %> | ||
| 45 | <% end %> | ||
| 46 | </div> | ||
| 47 | <div style="clear: both"></div> | ||
| 48 | <div id="flash"> | 46 | <div id="flash"> |
| 49 | <%= flash[:notice] %> | 47 | <%= flash[:notice] %> |
| 50 | </div> | 48 | </div> |
| @@ -54,5 +52,16 @@ | |||
| 54 | 52 | ||
| 55 | <div id="results"></div> | 53 | <div id="results"></div> |
| 56 | </div> | 54 | </div> |
| 55 | |||
| 56 | <div id="search_widget"> | ||
| 57 | <div> | ||
| 58 | <% form_tag admin_search_path do %> | ||
| 59 | <span>Search: </span><%= text_field_tag :search_term %> | ||
| 60 | <% end %> | ||
| 61 | </div> | ||
| 62 | <div id="search_results" style="display: none"> | ||
| 63 | |||
| 64 | </div> | ||
| 65 | </div> | ||
| 57 | </body> | 66 | </body> |
| 58 | </html> | 67 | </html> |
diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb index e957b5d..f37a24b 100644 --- a/app/views/nodes/edit.html.erb +++ b/app/views/nodes/edit.html.erb | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | <% content_for :subnavigation do %> | 1 | <% content_for :subnavigation do %> |
| 2 | <%= link_to 'metadata', '#', :id => 'button', :class => "unselected" %> | 2 | <%= link_to 'metadata', '#', :id => 'button', :class => "unselected" %> |
| 3 | <%= link_to 'Preview', @node %> | 3 | <%= link_to 'Show', @node %> |
| 4 | <%= link_to 'Preview', preview_page_path(@draft) %> | ||
| 4 | <%= link_to 'Publish', publish_node_path, :method => :put, :confirm => "Publish this draft?" %> | 5 | <%= link_to 'Publish', publish_node_path, :method => :put, :confirm => "Publish this draft?" %> |
| 5 | <%= link_to 'Revisions', revision_path(params[:id]) %> | 6 | <%= link_to 'Revisions', revision_path(params[:id]) %> |
| 6 | <% end %> | 7 | <% end %> |
| @@ -36,6 +37,10 @@ | |||
| 36 | 37 | ||
| 37 | <table id="content"> | 38 | <table id="content"> |
| 38 | <tr> | 39 | <tr> |
| 40 | <th class="description"></th> | ||
| 41 | <th class="content"></th> | ||
| 42 | </tr> | ||
| 43 | <tr> | ||
| 39 | <td class="description">Title</td> | 44 | <td class="description">Title</td> |
| 40 | <td><%= d.text_field :title %></td> | 45 | <td><%= d.text_field :title %></td> |
| 41 | </tr> | 46 | </tr> |
diff --git a/app/views/nodes/show.html.erb b/app/views/nodes/show.html.erb index bbbefe9..8aaedc5 100644 --- a/app/views/nodes/show.html.erb +++ b/app/views/nodes/show.html.erb | |||
| @@ -1,9 +1,31 @@ | |||
| 1 | <h1>Node</h1> | 1 | <% content_for :subnavigation do %> |
| 2 | <p> | 2 | <%= link_to 'Edit', edit_node_path(@node), :id => 'button', :class => "unselected" %> |
| 3 | There is no draft to preview. Click <%= link_to 'edit', edit_node_path %> to | 3 | <%= link_to 'Preview', preview_page_path(@page) %> |
| 4 | create one or view the currently | 4 | <%= link_to 'Revisions', revision_path(params[:id]) %> |
| 5 | <%= link_to_path 'published version', @node.unique_path %>. | 5 | <% end %> |
| 6 | </p> | 6 | |
| 7 | <p> | 7 | |
| 8 | View the revisions of this node | 8 | <div id="page_editor" class="show_node"> |
| 9 | </p> \ No newline at end of file | 9 | <table id="content"> |
| 10 | <tr> | ||
| 11 | <th class="description"></th> | ||
| 12 | <th class="content"></th> | ||
| 13 | </tr> | ||
| 14 | <tr> | ||
| 15 | <td class="description">Title</td> | ||
| 16 | <td><%= @page.title %></td> | ||
| 17 | </tr> | ||
| 18 | <tr> | ||
| 19 | <td class="description">Abstract</td> | ||
| 20 | <td><%= @page.abstract %></td> | ||
| 21 | </tr> | ||
| 22 | <tr> | ||
| 23 | <td class="description">Body</td> | ||
| 24 | <td><%= @page.body %></td> | ||
| 25 | </tr> | ||
| 26 | <tr> | ||
| 27 | <td></td> | ||
| 28 | <td class="right"></td> | ||
| 29 | </tr> | ||
| 30 | </table> | ||
| 31 | </div> \ No newline at end of file | ||
