Module: Sonia::Helpers

Defined in:
lib/sonia/helpers.rb

Instance Method Summary collapse

Instance Method Details

#system_javascriptsObject


35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/sonia/helpers.rb', line 35

def system_javascripts
  %w(
    /vendor/swfobject.js
    /vendor/console.js
    /vendor/FABridge.js
    /vendor/web_socket.js
    /vendor/json2.js
    /vendor/prototype.js
    /vendor/effects.js
    /vendor/dragdrop.js
    /vendor/livepipe.js
    /vendor/window.js
    /vendor/resizable.js
    /vendor/cookie.js
    /javascripts/storage.js
    /javascripts/sonia.js
    /javascripts/dispatcher.js
    /javascripts/widget.js
  )
end

#system_stylesheetsObject


56
57
58
59
60
61
62
# File 'lib/sonia/helpers.rb', line 56

def system_stylesheets
  %w(
    /blueprint/reset.css
    /blueprint/grid.css
    /stylesheets/sonia.css
  )
end

#websocket_hostObject


23
24
25
# File 'lib/sonia/helpers.rb', line 23

def websocket_host
  Sonia::Server.websocket_host
end

#websocket_portObject


27
28
29
# File 'lib/sonia/helpers.rb', line 27

def websocket_port
  Sonia::Server.websocket_port
end

#websocket_urlObject


31
32
33
# File 'lib/sonia/helpers.rb', line 31

def websocket_url
  Sonia::Server.websocket_url
end

#widget_javascriptsArray

Returns all available widgets with relative path recognized by the webserver

Returns:

  • (Array)

    Array of relalive widget Javascript paths


6
7
8
9
10
11
# File 'lib/sonia/helpers.rb', line 6

def widget_javascripts
  Dir[Sonia.root + "/widgets/*/*.js"].map do |file|
    widget_name = File.basename(file, ".js")
    file.gsub(File.join(Sonia.root, "widgets"), "/javascripts")
  end
end

#widget_stylesheetsArray

Returns all available widget stylesheets with relative paths recognized by the webserver

Returns:

  • (Array)

    Array of relative widget CSS files


16
17
18
19
20
21
# File 'lib/sonia/helpers.rb', line 16

def widget_stylesheets
  Dir[Sonia.root + "/widgets/*/*.css"].map do |file|
    widget_name = File.basename(file, ".css")
    file.gsub(File.join(Sonia.root, "widgets"), "/stylesheets")
  end
end