The New Way to Build with AI! Introducing ReUI — the developer platform for agentic UI with shadcn/ui
Browse ReUI Pro

Rails Helpers for Vendors


Hello and thank you for this thoughtful template integration into rails 7. I've been through all files and rails help documentation but I do not understand how to use the rails helper in controller or view for datatables?

JS and CSS are loading correctly for datatables.

Examples from documentation:

helpers.addVendor('datatables')
Does this go in the controller?

addVendor(vendor)
Does this go at the bottom of the view template?

I am trying to use the following code in my view template

table id="kt_datatable_dom_positioning"


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (4)

 
Deleted comment
 
Deleted comment
Deleted comment
 
Deleted comment
 
Deleted comment
 
Deleted comment
 
Deleted comment
 
Deleted comment
 
Deleted comment
 
Deleted comment

I was honestly surprised by how good the salads at Whataburger are! You’d expect a burger joint to treat salads as an afterthought, but they actually put effort into freshness and flavor. The grilled chicken Cobb salad is a solid go-to for me—crispy veggies, decent portion of protein, and just enough dressing without drowning everything. It’s a great option when you want to stick to something lighter but still crave that Whataburger taste.


 
Deleted comment
 
Deleted comment

Glad you solved it. Feel free to let us know if you have any issues.

Thanks



Hi,

In the Rails controller, you can call any helper functions from /app/helpers/* files using helpers object. Eg. helpers.addVendor('datatables')

The addVendor function is defined in /app/helpers/application_helper.rb

The vendors' entries will be printed in the /app/views/layout/master.html.erb. JS files at the bottom and CSS in the head.


getVendors("css")
getVendors("js")


Thanks



Thanks for the response. I was able to get it working after adding the DataTable script at the bottom of the master.html.erb


<script>
$("#kt_datatable_dom_positioning").DataTable({
"language": {
"lengthMenu": "Show _MENU_",
},
"dom":
"<"row"" +
"<"col-sm-6 d-flex align-items-center justify-content-start"l>" +
"<"col-sm-6 d-flex align-items-center justify-content-end"f>" +
">" +

"<"table-responsive"tr>" +

"<"row"" +
"<"col-sm-12 col-md-5 d-flex align-items-center justify-content-md-start"i>" +
"<"col-sm-12 col-md-7 d-flex align-items-center justify-content-md-end"p>" +
">"
})
</script>


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
buy metronic keenthemes mega bundle

ReUI

Open-source React components, blocks and templates built on shadcn/ui and Tailwind CSS by Keenthemes.