urturn-cli 0.6.2 → 0.6.3

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/bin/urturn CHANGED
@@ -8,6 +8,8 @@ include GLI::App
8
8
 
9
9
  program_desc "Command Line to access Webdoc API"
10
10
 
11
+ version Webdoc::Cli::VERSION
12
+
11
13
  flag [:h, :host], :default_value => 'webdoc.com'
12
14
 
13
15
  pre do |global_options, command, options, args|
@@ -3,8 +3,7 @@
3
3
  * is to puts all your code in the camelcased version of your expression system name.
4
4
  *
5
5
  * /!\ Your expression might be loaded multiple time in the
6
- * same page so you should always limit your DOM queries to
7
- * expression.getElement().
6
+ * same page so you should always limit your DOM queries to expression.getElement().
8
7
  */
9
8
 
10
9
  var <%= system_name.gsub(/\-/,'_').camelcase %> = function(expression){
@@ -14,28 +13,26 @@ var <%= system_name.gsub(/\-/,'_').camelcase %> = function(expression){
14
13
 
15
14
  var self = this;
16
15
  // display the image.
17
- this.expression.items.find('picture', function(imageResource) {
18
- if(imageResource){
19
- self.displayImage(imageResource);
20
- }
21
- });
16
+ self.displayImage(this.expression.storage.getItem('picture'));
22
17
 
23
18
  // display the name.
24
- this.expression.items.find('name', function(item) {
25
- if(self.nameWrapper && item){
26
- self.nameWrapper.innerHTML = item.value;
27
- }
28
- });
19
+ if(self.nameWrapper){
20
+ self.nameWrapper.innerHTML = this.expression.storage.getItem('myName');
21
+ }
22
+ self.expression.container.autoResize();
29
23
  };
30
24
 
31
25
  <%= system_name.gsub(/\-/,'_').camelcase %>.prototype.displayImage = function(imageResource) {
32
- if (!this.img) {
33
- this.img = document.createElement('img');
34
- this.imageWrapper.appendChild(this.img);
35
- var self = this;
36
- this.img.addEventListener('load', function(event){
37
- self.expression.container.autoResize();
38
- });
39
- }
40
- this.img.src = imageResource.url;
26
+ if(!imageResource){
27
+ return;
28
+ }
29
+ if (!this.img) {
30
+ this.img = document.createElement('img');
31
+ this.imageWrapper.appendChild(this.img);
32
+ var self = this;
33
+ this.img.addEventListener('load', function(event){
34
+ self.expression.container.autoResize();
35
+ });
36
+ }
37
+ this.img.src = imageResource.url;
41
38
  };
@@ -12,34 +12,31 @@
12
12
  this.displayImage = function(imageResource) {
13
13
  playerDisplayImage.call(this, imageResource);
14
14
  this.editorDisplayImage();
15
- }
15
+ };
16
16
  if(this.img){
17
17
  this.editorDisplayImage();
18
18
  }
19
19
 
20
20
  var self = this;
21
21
  // display text in editor
22
- this.expression.items.find('name', function(item){
23
- if(item){
24
- self.nameEditor.value = item.value;
25
- }
26
- });
22
+ self.nameEditor.value = this.expression.storage.getItem('myName', "");
27
23
 
28
24
  // save text on post
29
25
  this.expression.post(function(doPostCallback){
30
- self.expression.items.save('name', {:value => self.nameEditor.value}, function(){
31
- doPostCallback();
32
- });
26
+ self.expression.storage.setItem('myName', self.nameEditor.value);
27
+ self.expression.storage.save();
28
+ doPostCallback();
33
29
  });
34
30
  };
35
31
 
36
32
  <%= system_name.gsub(/\-/,'_').camelcase %>.prototype.bindChooseImage = function() {
37
33
  var self = this;
38
34
  return function(event) {
39
- self.expression.medias.imageDialog(function(imageResource) {
35
+ self.expression.medias.imageDialog(function(imageResource){
40
36
  // Directly save image upon selection
41
- self.expression.items.save('picture', imageResource);
37
+ self.expression.storage.setItem('picture', imageResource);
42
38
  self.displayImage(imageResource);
39
+ self.expression.readyToPost(true);
43
40
  });
44
41
  };
45
42
  };
@@ -47,4 +44,4 @@
47
44
  <%= system_name.gsub(/\-/,'_').camelcase %>.prototype.editorDisplayImage = function() {
48
45
  this.img.addEventListener('click', this.bindChooseImage());
49
46
  this.chooseImageButton.className += ' hidden';
50
- }
47
+ };
@@ -1,5 +1,5 @@
1
1
  module Webdoc
2
2
  module Cli
3
- VERSION = "0.6.2"
3
+ VERSION = "0.6.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: urturn-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: