diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-06-25 04:35:21 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-06-25 04:35:21 +0200 |
| commit | 5f8cc4fa269dadc895d99eec9ef3a82b17c5890a (patch) | |
| tree | 048ffe4ef9e6b147eddbe6472312b72267d268d9 /app | |
| parent | f7a5944a1f44ede9881d368a36eb9f7d82d6ab69 (diff) | |
Rails 4.2 view fixes
- Replace :confirm => with :data => { :confirm => } in all link_to calls
- Fix link_to_path helper: use content_path named route instead of hash-style routing
- Fix admin/_menu.html.erb: use named routes for logout and admin index
- Fix admin layout: load jquery/jquery_ujs before jquery-ui, remove duplicate jQuery 1.3.2
- Add csrf_meta_tags to admin layout
Diffstat (limited to 'app')
| -rw-r--r-- | app/helpers/link_helper.rb | 26 | ||||
| -rw-r--r-- | app/views/admin/_drafts.html.erb | 4 | ||||
| -rw-r--r-- | app/views/admin/_menu.html.erb | 6 | ||||
| -rw-r--r-- | app/views/assets/index.html.erb | 4 | ||||
| -rw-r--r-- | app/views/events/index.html.erb | 4 | ||||
| -rw-r--r-- | app/views/layouts/admin.html.erb | 3 | ||||
| -rw-r--r-- | app/views/menu_items/index.html.erb | 4 | ||||
| -rw-r--r-- | app/views/nodes/edit.html.erb | 2 | ||||
| -rw-r--r-- | app/views/occurrences/index.html.erb | 4 | ||||
| -rw-r--r-- | app/views/pages/index.html.erb | 2 | ||||
| -rw-r--r-- | app/views/revisions/index.html.erb | 2 | ||||
| -rw-r--r-- | app/views/users/_user.html.erb | 4 |
12 files changed, 32 insertions, 33 deletions
diff --git a/app/helpers/link_helper.rb b/app/helpers/link_helper.rb index 29c58f0..85d8fbe 100644 --- a/app/helpers/link_helper.rb +++ b/app/helpers/link_helper.rb | |||
| @@ -14,28 +14,26 @@ module LinkHelper | |||
| 14 | end | 14 | end |
| 15 | 15 | ||
| 16 | def link_to_path title, path, html_options = {} | 16 | def link_to_path title, path, html_options = {} |
| 17 | return "" if path.nil? | ||
| 18 | |||
| 17 | if params[:page_path] | 19 | if params[:page_path] |
| 18 | page_path = params[:page_path].is_a?(Array) ? params[:page_path].join("/") : params[:page_path] | 20 | page_path = params[:page_path].is_a?(Array) ? params[:page_path].join("/") : params[:page_path] |
| 19 | active = (page_path == path.sub(/^\//, "")) | 21 | active = (page_path == path.sub(/^\//, "")) |
| 20 | end | 22 | end |
| 21 | 23 | ||
| 22 | active_class = active ? {:class => 'active'} : {:class => 'inactive'} | 24 | active_class = active ? {:class => 'active'} : {:class => 'inactive'} |
| 23 | 25 | ||
| 24 | html_options = html_options.merge(active_class) | 26 | html_options = html_options.merge(active_class) |
| 25 | 27 | ||
| 26 | params[:locale] ||= I18n.locale | 28 | locale = params[:locale] || I18n.locale |
| 27 | 29 | ||
| 28 | link_to( | 30 | link_to( |
| 29 | title, { | 31 | title, |
| 30 | :controller => :content, | 32 | content_path(path.sub(/^\//, ""), :locale => locale), |
| 31 | :action => :render_page, | ||
| 32 | :locale => params[:locale], | ||
| 33 | :page_path => (path.sub(/^\//, "") rescue "") | ||
| 34 | }, | ||
| 35 | html_options | 33 | html_options |
| 36 | ) | 34 | ) |
| 37 | end | 35 | end |
| 38 | 36 | ||
| 39 | def selected? controller_name | 37 | def selected? controller_name |
| 40 | if params[:controller] == controller_name | 38 | if params[:controller] == controller_name |
| 41 | return :class => "selected" | 39 | return :class => "selected" |
| @@ -48,7 +46,7 @@ module LinkHelper | |||
| 48 | "Last modified #{@page.updated_at.to_s(:db)}" | 46 | "Last modified #{@page.updated_at.to_s(:db)}" |
| 49 | 47 | ||
| 50 | link_to( | 48 | link_to( |
| 51 | 'Unlock', unlock_node_path(@node), :method => :put, :confirm => message | 49 | 'Unlock', unlock_node_path(@node), :method => :put, :data => { :confirm => message } |
| 52 | ) | 50 | ) |
| 53 | end | 51 | end |
| 54 | 52 | ||
diff --git a/app/views/admin/_drafts.html.erb b/app/views/admin/_drafts.html.erb index 58b946b..2036d12 100644 --- a/app/views/admin/_drafts.html.erb +++ b/app/views/admin/_drafts.html.erb | |||
| @@ -17,9 +17,9 @@ | |||
| 17 | <td class="actions"> | 17 | <td class="actions"> |
| 18 | <%= link_to 'Show', node_path(draft.node) %> | 18 | <%= link_to 'Show', node_path(draft.node) %> |
| 19 | <%= link_to "Revisions", revision_path(draft.node.id) %> | 19 | <%= link_to "Revisions", revision_path(draft.node.id) %> |
| 20 | <%= link_to "Publish", publish_node_path(draft.node), :method => :put, :confirm => "Do you really want to publish?" %> | 20 | <%= link_to "Publish", publish_node_path(draft.node), :method => :put, :data => { :confirm => "Do you really want to publish?" } %> |
| 21 | </td> | 21 | </td> |
| 22 | </tr> | 22 | </tr> |
| 23 | <% end %> | 23 | <% end %> |
| 24 | </table> | 24 | </table> |
| 25 | </div> \ No newline at end of file | 25 | </div> |
diff --git a/app/views/admin/_menu.html.erb b/app/views/admin/_menu.html.erb index e8b39ce..3188d94 100644 --- a/app/views/admin/_menu.html.erb +++ b/app/views/admin/_menu.html.erb | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | <%= language_selector %> | 1 | <%= language_selector %> |
| 2 | <%= link_to 'Logout', :controller => :sessions, :action => :destroy %> | 2 | <%= link_to 'Logout', logout_path, :method => :delete %> |
| 3 | <%= link_to 'Overview', :controller => :admin, :action => 'index' %> | 3 | <%= link_to 'Overview', admin_path %> |
| 4 | <%= link_to 'Nodes', nodes_path, selected?('nodes') %> | 4 | <%= link_to 'Nodes', nodes_path, selected?('nodes') %> |
| 5 | <%= link_to 'Assets', assets_path, selected?('assets') %> | 5 | <%= link_to 'Assets', assets_path, selected?('assets') %> |
| 6 | <%= link_to 'User', users_path, selected?('users') %> | 6 | <%= link_to 'User', users_path, selected?('users') %> |
| 7 | <%= link_to 'Navigation', menu_items_path, selected?('menu_items') %> > \ No newline at end of file | 7 | <%= link_to 'Navigation', menu_items_path, selected?('menu_items') %> > |
diff --git a/app/views/assets/index.html.erb b/app/views/assets/index.html.erb index fc7c029..e7ef313 100644 --- a/app/views/assets/index.html.erb +++ b/app/views/assets/index.html.erb | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | <td><%= asset.upload.content_type %></td> | 15 | <td><%= asset.upload.content_type %></td> |
| 16 | <td><%= link_to 'Show', asset %></td> | 16 | <td><%= link_to 'Show', asset %></td> |
| 17 | <td><%= link_to 'Edit', edit_asset_path(asset) %></td> | 17 | <td><%= link_to 'Edit', edit_asset_path(asset) %></td> |
| 18 | <td><%= link_to 'Destroy', asset, :confirm => 'Are you sure?', :method => :delete %></td> | 18 | <td><%= link_to 'Destroy', asset, :data => { :confirm => 'Are you sure?' }, :method => :delete %></td> |
| 19 | </tr> | 19 | </tr> |
| 20 | <% end %> | 20 | <% end %> |
| 21 | </table> \ No newline at end of file | 21 | </table> |
diff --git a/app/views/events/index.html.erb b/app/views/events/index.html.erb index c1b5b48..93c95fa 100644 --- a/app/views/events/index.html.erb +++ b/app/views/events/index.html.erb | |||
| @@ -26,11 +26,11 @@ | |||
| 26 | <td><%=h event.node_id %></td> | 26 | <td><%=h event.node_id %></td> |
| 27 | <td><%= link_to 'Show', event %></td> | 27 | <td><%= link_to 'Show', event %></td> |
| 28 | <td><%= link_to 'Edit', edit_event_path(event) %></td> | 28 | <td><%= link_to 'Edit', edit_event_path(event) %></td> |
| 29 | <td><%= link_to 'Destroy', event, :confirm => 'Are you sure?', :method => :delete %></td> | 29 | <td><%= link_to 'Destroy', event, :data => { :confirm => 'Are you sure?' }, :method => :delete %></td> |
| 30 | </tr> | 30 | </tr> |
| 31 | <% end %> | 31 | <% end %> |
| 32 | </table> | 32 | </table> |
| 33 | 33 | ||
| 34 | <br /> | 34 | <br /> |
| 35 | 35 | ||
| 36 | <%= link_to 'New event', new_event_path %> \ No newline at end of file | 36 | <%= link_to 'New event', new_event_path %> |
diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index 9f36021..e64850b 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb | |||
| @@ -4,9 +4,10 @@ | |||
| 4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | 4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 5 | <head> | 5 | <head> |
| 6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | 6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
| 7 | <%= csrf_meta_tags %> | ||
| 7 | 8 | ||
| 8 | <title><%= "#{params[:controller]} | #{params[:action]}" %></title> | 9 | <title><%= "#{params[:controller]} | #{params[:action]}" %></title> |
| 9 | <%= javascript_include_tag 'jquery-1.3.2.min' %> | 10 | <%= javascript_include_tag 'jquery', 'jquery_ujs' %> |
| 10 | <%= javascript_include_tag 'jquery-ui-1.7.2.custom.min' %> | 11 | <%= javascript_include_tag 'jquery-ui-1.7.2.custom.min' %> |
| 11 | <%= javascript_include_tag 'jquery.hotkeys' %> | 12 | <%= javascript_include_tag 'jquery.hotkeys' %> |
| 12 | <%= javascript_include_tag 'tiny_mce/jquery.tinymce.js' %> | 13 | <%= javascript_include_tag 'tiny_mce/jquery.tinymce.js' %> |
diff --git a/app/views/menu_items/index.html.erb b/app/views/menu_items/index.html.erb index 123a07a..7d0ce62 100644 --- a/app/views/menu_items/index.html.erb +++ b/app/views/menu_items/index.html.erb | |||
| @@ -18,9 +18,9 @@ | |||
| 18 | "Delete", | 18 | "Delete", |
| 19 | menu_item_path(menu_item), | 19 | menu_item_path(menu_item), |
| 20 | :method => :delete, | 20 | :method => :delete, |
| 21 | :confirm => "Are you sure?" | 21 | :data => { :confirm => "Are you sure?" } |
| 22 | ) %> | 22 | ) %> |
| 23 | </td> | 23 | </td> |
| 24 | </tr> | 24 | </tr> |
| 25 | <% end %> | 25 | <% end %> |
| 26 | </table> \ No newline at end of file | 26 | </table> |
diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb index d40d4e7..64884cf 100644 --- a/app/views/nodes/edit.html.erb +++ b/app/views/nodes/edit.html.erb | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | <%= link_to 'metadata', '#', :id => 'button', :class => "unselected" %> | 2 | <%= link_to 'metadata', '#', :id => 'button', :class => "unselected" %> |
| 3 | <%= link_to 'Show', @node %> | 3 | <%= link_to 'Show', @node %> |
| 4 | <%= link_to 'Preview', preview_page_path(@draft) %> | 4 | <%= link_to 'Preview', preview_page_path(@draft) %> |
| 5 | <%= link_to 'Publish', publish_node_path, :method => :put, :confirm => "Publish this draft?" %> | 5 | <%= link_to 'Publish', publish_node_path, :method => :put, :data => { :confirm => "Publish this draft?" } %> |
| 6 | <%= link_to 'Revisions', node_revisions_path(@node) %> | 6 | <%= link_to 'Revisions', node_revisions_path(@node) %> |
| 7 | <% end %> | 7 | <% end %> |
| 8 | 8 | ||
diff --git a/app/views/occurrences/index.html.erb b/app/views/occurrences/index.html.erb index 06dbf07..7b8ffb8 100644 --- a/app/views/occurrences/index.html.erb +++ b/app/views/occurrences/index.html.erb | |||
| @@ -18,11 +18,11 @@ | |||
| 18 | <td><%=h occurrence.event_id %></td> | 18 | <td><%=h occurrence.event_id %></td> |
| 19 | <td><%= link_to 'Show', occurrence %></td> | 19 | <td><%= link_to 'Show', occurrence %></td> |
| 20 | <td><%= link_to 'Edit', edit_occurrence_path(occurrence) %></td> | 20 | <td><%= link_to 'Edit', edit_occurrence_path(occurrence) %></td> |
| 21 | <td><%= link_to 'Destroy', occurrence, :confirm => 'Are you sure?', :method => :delete %></td> | 21 | <td><%= link_to 'Destroy', occurrence, :data => { :confirm => 'Are you sure?' }, :method => :delete %></td> |
| 22 | </tr> | 22 | </tr> |
| 23 | <% end %> | 23 | <% end %> |
| 24 | </table> | 24 | </table> |
| 25 | 25 | ||
| 26 | <br /> | 26 | <br /> |
| 27 | 27 | ||
| 28 | <%= link_to 'New occurrence', new_occurrence_path %> \ No newline at end of file | 28 | <%= link_to 'New occurrence', new_occurrence_path %> |
diff --git a/app/views/pages/index.html.erb b/app/views/pages/index.html.erb index 06cb16c..4b28c9b 100644 --- a/app/views/pages/index.html.erb +++ b/app/views/pages/index.html.erb | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | <td><%=h page.title %></td> | 12 | <td><%=h page.title %></td> |
| 13 | <td><%= link_to 'Show', content_path(:page_path => page.node.unique_path) %></td> | 13 | <td><%= link_to 'Show', content_path(:page_path => page.node.unique_path) %></td> |
| 14 | <td><%= link_to 'Edit', edit_page_path(page) %></td> | 14 | <td><%= link_to 'Edit', edit_page_path(page) %></td> |
| 15 | <td><%= link_to 'Destroy', page, :confirm => 'Are you sure?', :method => :delete %></td> | 15 | <td><%= link_to 'Destroy', page, :data => { :confirm => 'Are you sure?' }, :method => :delete %></td> |
| 16 | </tr> | 16 | </tr> |
| 17 | <% end %> | 17 | <% end %> |
| 18 | </table> | 18 | </table> |
diff --git a/app/views/revisions/index.html.erb b/app/views/revisions/index.html.erb index 306f9ea..e038ed2 100644 --- a/app/views/revisions/index.html.erb +++ b/app/views/revisions/index.html.erb | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | 'restore', | 31 | 'restore', |
| 32 | restore_node_revision_path(@node, page), | 32 | restore_node_revision_path(@node, page), |
| 33 | :method => :put, | 33 | :method => :put, |
| 34 | :confirm => "Restore this revision?" | 34 | :data => { :confirm => "Restore this revision?" } |
| 35 | ) %> | 35 | ) %> |
| 36 | </td> | 36 | </td> |
| 37 | </tr> | 37 | </tr> |
diff --git a/app/views/users/_user.html.erb b/app/views/users/_user.html.erb index 8117bcd..9987e31 100644 --- a/app/views/users/_user.html.erb +++ b/app/views/users/_user.html.erb | |||
| @@ -11,9 +11,9 @@ | |||
| 11 | "destroy", | 11 | "destroy", |
| 12 | user_path(user), | 12 | user_path(user), |
| 13 | :method => :delete, | 13 | :method => :delete, |
| 14 | :confirm => "Do you really want to delete user #{user.login}?" | 14 | :data => { :confirm => "Do you really want to delete user #{user.login}?" } |
| 15 | ) %> | 15 | ) %> |
| 16 | </td> | 16 | </td> |
| 17 | <% end %> | 17 | <% end %> |
| 18 | </tr> | 18 | </tr> |
| 19 | <% end %> \ No newline at end of file | 19 | <% end %> |
