cobot_client 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -1
- data/app/views/cobot_client/_resize_script.html.erb +13 -9
- data/lib/cobot_client/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# CobotClient
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/cobot/cobot_client.png?branch=master)](https://travis-ci.org/cobot/cobot_client)
|
4
|
+
|
3
5
|
A client for the [Cobot](http://cobot.me) [API](http://cobot.me/pages/api) plus helpers.
|
4
6
|
|
5
7
|
## Installation
|
@@ -22,7 +24,8 @@ Or install it yourself as:
|
|
22
24
|
|
23
25
|
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
26
|
|
25
|
-
|
27
|
+
client = OAuth2::Client.new <...>
|
28
|
+
CobotClient::NavigationLinkService.new(client, '<access token>', 'co-up').install_links [
|
26
29
|
CobotClient::NavigationLink.new(section: 'admin/manage', label: 'My App', iframe_url: 'http://example.com')]
|
27
30
|
|
28
31
|
### Setting up automatic iframe resizing
|
@@ -45,6 +48,8 @@ Add the following code to your application controller:
|
|
45
48
|
|
46
49
|
include CobotClient::XdmHelper
|
47
50
|
|
51
|
+
This will automatically resize Cobot's iframe whenever a new page is loaded. To manually trigger a resize call `window.Cobot.iframeResize()`.
|
52
|
+
|
48
53
|
### Generating URLs to the Cobot API
|
49
54
|
|
50
55
|
There is a module `CobotClient::UrlHelper`. After you include it you can call `cobot_url`. Examples:
|
@@ -1,12 +1,16 @@
|
|
1
1
|
<script>
|
2
|
-
|
3
|
-
|
4
|
-
window.socket
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
window.Cobot = window.Cobot || {};
|
3
|
+
window.Cobot.iframeResize = function() {
|
4
|
+
if(window.socket) {
|
5
|
+
window.socket.postMessage($('body').outerHeight());
|
6
|
+
}
|
7
|
+
}
|
8
|
+
easyXDM.query = <%== xdm_params.to_json %>;
|
9
|
+
window.socket = new easyXDM.Socket({
|
10
|
+
onReady: function() {
|
11
|
+
setTimeout(function() {
|
12
|
+
window.Cobot.iframeResize();
|
13
|
+
}, 100);
|
14
|
+
}
|
11
15
|
});
|
12
16
|
</script>
|
data/lib/cobot_client/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cobot_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-03-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|