Project

General

Profile

Bug #7613

Error rendering searcheable list pages in a new plugin

Added by Dennis Kliban about 5 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Plugins-Engines
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

I am developing a Foreman plugin that adds ability to keep track of Image Stores, such as Image Factory. I would like the user to be able to search images. As a result I have made a searcheable list page. However, I get the following error when I try to render the page ...

Showing /home/dkliban/foreman/app/views/common/_searchbar.html.erb where line #18 raised:

undefined method `new_bookmark_path' for #<#<Class:0x00000008255078>:0x00000009c4c2b0>
Extracted source (around line #18):

15: <% end %>
16: <li class="divider"></li>
17: <li><%= link_to_function _('Bookmark this search'), "$('#bookmarks-modal').modal();",
18: {:id => "bookmark", :"data-url"=> new_bookmark_path(:kontroller => controller_name)}%></li>
19: </ul>
20: </span>
21: </div>

I am able to fix this problem by applying the following diff to Foreman

diff --git a/app/views/common/_searchbar.html.erb b/app/views/common/_searchbar.html.erb
index 2ff07ce..0f61638 100644
--- a/app/views/common/_searchbar.html.erb
+++ b/app/views/common/_searchbar.html.erb
@@ -15,7 +15,7 @@
         <% end %>
         <li class="divider"></li>
         <li><%= link_to_function _('Bookmark this search'), "$('#bookmarks-modal').modal();",
-                                 {:id => "bookmark", :"data-url"=>new_bookmark_path(:kontroller => controller_name)}%></li>
+                                 {:id => "bookmark", :"data-url"=>main_app.new_bookmark_path(:kontroller => controller_name)}%></li>
       </ul>
     </span>
   </div>

Can this diff be permanently added?

Associated revisions

Revision 6cf71d79 (diff)
Added by Dennis Kliban about 5 years ago

fixes #7613 - make search bar route lookup usable from isolated engine

History

#1 Updated by Dominic Cleal about 5 years ago

  • Description updated (diff)
  • Category set to Plugins-Engines

Patches should be submitted as pull requests, we won't pull them from a ticket alone.

See http://theforeman.org/contribute.html for more details. You should reference this ticket in the commit message, e.g. "fixes #7613 - make search bar route lookup usable from isolated engine"

#2 Updated by The Foreman Bot about 5 years ago

  • Status changed from New to Ready For Testing
  • Target version set to 1.7.3
  • Pull request https://github.com/theforeman/foreman/pull/1795 added
  • Pull request deleted ()

#3 Updated by Dominic Cleal about 5 years ago

  • Assignee set to Dennis Kliban

#4 Updated by Dominic Cleal about 5 years ago

  • Target version changed from 1.7.3 to 1.7.2

#5 Updated by Dennis Kliban about 5 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#6 Updated by Dominic Cleal about 5 years ago

  • Legacy Backlogs Release (now unused) set to 21

Also available in: Atom PDF