Module: RailsRealtimeErd::ErdHelper
- Defined in:
- app/helpers/rails_realtime_erd/erd_helper.rb
Instance Method Summary collapse
- #inline_asset(relative_path) ⇒ Object
- #inline_javascript(relative_path, type: "module") ⇒ Object
- #inline_stylesheet(relative_path) ⇒ Object
- #schema_data_tag(schema) ⇒ Object
Instance Method Details
#inline_asset(relative_path) ⇒ Object
3 4 5 6 |
# File 'app/helpers/rails_realtime_erd/erd_helper.rb', line 3 def inline_asset(relative_path) path = Engine.root.join(relative_path) File.read(path) end |
#inline_javascript(relative_path, type: "module") ⇒ Object
12 13 14 |
# File 'app/helpers/rails_realtime_erd/erd_helper.rb', line 12 def inline_javascript(relative_path, type: "module") content_tag(:script, inline_asset(relative_path).html_safe, type: type) end |
#inline_stylesheet(relative_path) ⇒ Object
8 9 10 |
# File 'app/helpers/rails_realtime_erd/erd_helper.rb', line 8 def inline_stylesheet(relative_path) content_tag(:style, inline_asset(relative_path).html_safe) end |
#schema_data_tag(schema) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'app/helpers/rails_realtime_erd/erd_helper.rb', line 16 def schema_data_tag(schema) content_tag( :script, schema.to_json.html_safe, type: "application/json", id: "rre-schema-data" ) end |