cobot_client 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/README.md +34 -1
- data/app/assets/javascripts/cobot_client/easyxdm.js +2134 -0
- data/app/helpers/cobot_client/xdm_helper.rb +29 -0
- data/app/views/cobot_client/_resize_script.html.erb +12 -0
- data/cobot_client.gemspec +3 -0
- data/lib/cobot_client/engine.rb +5 -0
- data/lib/cobot_client/navigation_link.rb +10 -0
- data/lib/cobot_client/navigation_link_service.rb +60 -0
- data/lib/cobot_client/version.rb +1 -1
- data/lib/cobot_client.rb +4 -0
- data/spec/cobot_client/navigation_link_service_spec.rb +51 -0
- metadata +58 -3
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -18,7 +18,40 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
### Installing navigation links on Cobot:
|
22
|
+
|
23
|
+
You can install links to your app into the navigation on Cobot. When users click the link an iframe pointing to the given `iframe_url` will be shown.
|
24
|
+
|
25
|
+
CobotClient::NavigationLinkService.new().install_links [
|
26
|
+
CobotClient::NavigationLink.new(section: 'admin/manage', label: 'My App', iframe_url: 'http://example.com')]
|
27
|
+
|
28
|
+
### Setting up automatic iframe resizing
|
29
|
+
|
30
|
+
When you install your app on Cobot you have to add the following to make sure the iframe on Cobot automatically gets resized according to the height of your page.
|
31
|
+
|
32
|
+
This only works for Ruby on Rails >= 3.2. If you are using anything else please take a look at the files involved and set it up manually.
|
33
|
+
|
34
|
+
Add jQuery to your app.
|
35
|
+
|
36
|
+
Add this lines to your layout, before the closing `</body>` tag:
|
37
|
+
|
38
|
+
<%= render 'cobot_client/resize_script' %>
|
39
|
+
|
40
|
+
Add this to your application.js:
|
41
|
+
|
42
|
+
//= require cobot_client/easyxdm
|
43
|
+
|
44
|
+
Add the following code to your application controller:
|
45
|
+
|
46
|
+
include CobotClient::XdmHelper
|
47
|
+
|
48
|
+
### Generating URLs to the Cobot API
|
49
|
+
|
50
|
+
There is a module `CobotClient::UrlHelper`. After you include it you can call `cobot_url`. Examples:
|
51
|
+
|
52
|
+
cobot_url('co-up') # => 'https://co-up.cobot.me/'
|
53
|
+
cobot_url('co-up', '/api/user') # => 'https://co-up.cobot.me/api/user'
|
54
|
+
cobot_url('co-up', '/api/user', params: {x: 'y'}) # => 'https://co-up.cobot.me/api/user?x=y'
|
22
55
|
|
23
56
|
## Contributing
|
24
57
|
|