Module: Delayed::Server::Helpers

Defined in:
lib/delayed/server/helpers.rb

Instance Method Summary collapse

Instance Method Details

#h(text) ⇒ Object


6
7
8
# File 'lib/delayed/server/helpers.rb', line 6

def h(text)
  Rack::Utils.escape_html(text)
end

#path_prefixObject


14
15
16
# File 'lib/delayed/server/helpers.rb', line 14

def path_prefix
  request.env['SCRIPT_NAME']
end

#render_javascript_envObject


18
19
20
21
22
23
24
25
26
27
28
# File 'lib/delayed/server/helpers.rb', line 18

def render_javascript_env
  {
    Routes: {
      root: path_prefix,
      running: url_path('running'),
      tags: url_path('tags'),
      jobs: url_path('jobs'),
      bulkUpdate: url_path('bulk_update'),
    }
  }.to_json
end

#url_path(*path_parts) ⇒ Object


10
11
12
# File 'lib/delayed/server/helpers.rb', line 10

def url_path(*path_parts)
  [path_prefix, path_parts].join('/').squeeze('/')
end