ymdp 0.8.5 → 0.8.6

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.5
1
+ 0.8.6
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ymdp}
8
- s.version = "0.8.5"
8
+ s.version = "0.8.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Isaac Priestley"]
@@ -54,36 +54,24 @@ Gem::Specification.new do |s|
54
54
  "lib/ymdp/generator/templates/stylesheet.css",
55
55
  "lib/ymdp/generator/templates/translation.pres",
56
56
  "lib/ymdp/generator/templates/view.html.haml",
57
- "lib/ymdp/javascripts/jquery/ab_testing.js",
58
57
  "lib/ymdp/javascripts/jquery/ab_testing.js.coffee",
59
- "lib/ymdp/javascripts/jquery/ajax.js",
60
58
  "lib/ymdp/javascripts/jquery/ajax.js.coffee",
61
- "lib/ymdp/javascripts/jquery/application.js",
62
59
  "lib/ymdp/javascripts/jquery/application.js.coffee",
63
- "lib/ymdp/javascripts/jquery/authorization.js",
64
60
  "lib/ymdp/javascripts/jquery/authorization.js.coffee",
65
- "lib/ymdp/javascripts/jquery/browser.js",
66
61
  "lib/ymdp/javascripts/jquery/browser.js.coffee",
67
62
  "lib/ymdp/javascripts/jquery/data.js",
68
63
  "lib/ymdp/javascripts/jquery/data.js.coffee",
69
- "lib/ymdp/javascripts/jquery/debug.js",
70
64
  "lib/ymdp/javascripts/jquery/debug.js.coffee",
71
65
  "lib/ymdp/javascripts/jquery/education.js",
72
66
  "lib/ymdp/javascripts/jquery/flash.js",
73
67
  "lib/ymdp/javascripts/jquery/help.js",
74
68
  "lib/ymdp/javascripts/jquery/i18n.js",
75
- "lib/ymdp/javascripts/jquery/init.js",
76
69
  "lib/ymdp/javascripts/jquery/init.js.coffee",
77
- "lib/ymdp/javascripts/jquery/launcher.js",
78
70
  "lib/ymdp/javascripts/jquery/launcher.js.coffee",
79
- "lib/ymdp/javascripts/jquery/logger.js",
80
71
  "lib/ymdp/javascripts/jquery/logger.js.coffee",
81
- "lib/ymdp/javascripts/jquery/params.js",
82
72
  "lib/ymdp/javascripts/jquery/params.js.coffee",
83
- "lib/ymdp/javascripts/jquery/reporter.js",
84
73
  "lib/ymdp/javascripts/jquery/reporter.js.coffee",
85
74
  "lib/ymdp/javascripts/jquery/tag_helper.js",
86
- "lib/ymdp/javascripts/jquery/user.js",
87
75
  "lib/ymdp/javascripts/jquery/user.js.coffee",
88
76
  "lib/ymdp/javascripts/prototype/ab_testing.js",
89
77
  "lib/ymdp/javascripts/prototype/ajax.js",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ymdp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 53
4
+ hash: 51
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 5
10
- version: 0.8.5
9
+ - 6
10
+ version: 0.8.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Isaac Priestley
@@ -587,36 +587,24 @@ files:
587
587
  - lib/ymdp/generator/templates/stylesheet.css
588
588
  - lib/ymdp/generator/templates/translation.pres
589
589
  - lib/ymdp/generator/templates/view.html.haml
590
- - lib/ymdp/javascripts/jquery/ab_testing.js
591
590
  - lib/ymdp/javascripts/jquery/ab_testing.js.coffee
592
- - lib/ymdp/javascripts/jquery/ajax.js
593
591
  - lib/ymdp/javascripts/jquery/ajax.js.coffee
594
- - lib/ymdp/javascripts/jquery/application.js
595
592
  - lib/ymdp/javascripts/jquery/application.js.coffee
596
- - lib/ymdp/javascripts/jquery/authorization.js
597
593
  - lib/ymdp/javascripts/jquery/authorization.js.coffee
598
- - lib/ymdp/javascripts/jquery/browser.js
599
594
  - lib/ymdp/javascripts/jquery/browser.js.coffee
600
595
  - lib/ymdp/javascripts/jquery/data.js
601
596
  - lib/ymdp/javascripts/jquery/data.js.coffee
602
- - lib/ymdp/javascripts/jquery/debug.js
603
597
  - lib/ymdp/javascripts/jquery/debug.js.coffee
604
598
  - lib/ymdp/javascripts/jquery/education.js
605
599
  - lib/ymdp/javascripts/jquery/flash.js
606
600
  - lib/ymdp/javascripts/jquery/help.js
607
601
  - lib/ymdp/javascripts/jquery/i18n.js
608
- - lib/ymdp/javascripts/jquery/init.js
609
602
  - lib/ymdp/javascripts/jquery/init.js.coffee
610
- - lib/ymdp/javascripts/jquery/launcher.js
611
603
  - lib/ymdp/javascripts/jquery/launcher.js.coffee
612
- - lib/ymdp/javascripts/jquery/logger.js
613
604
  - lib/ymdp/javascripts/jquery/logger.js.coffee
614
- - lib/ymdp/javascripts/jquery/params.js
615
605
  - lib/ymdp/javascripts/jquery/params.js.coffee
616
- - lib/ymdp/javascripts/jquery/reporter.js
617
606
  - lib/ymdp/javascripts/jquery/reporter.js.coffee
618
607
  - lib/ymdp/javascripts/jquery/tag_helper.js
619
- - lib/ymdp/javascripts/jquery/user.js
620
608
  - lib/ymdp/javascripts/jquery/user.js.coffee
621
609
  - lib/ymdp/javascripts/prototype/ab_testing.js
622
610
  - lib/ymdp/javascripts/prototype/ajax.js
@@ -1,116 +0,0 @@
1
-
2
- // DO NOT USE the @view instance variable in any files in /app/javascripts/base.
3
- // The way they are cached makes it not safe to do so.
4
-
5
- var ABTesting;
6
-
7
- ABTesting = {
8
- on: true,
9
- languages: <%= english_languages.to_json %>,
10
-
11
- enable: function() {
12
- ABTesting.on = true;
13
- },
14
-
15
- disable: function() {
16
- ABTesting.on = false;
17
- },
18
-
19
- randomAB: function() {
20
- return Math.floor(Math.random()*2) ? "a" : "b";
21
- },
22
-
23
- get: function(content_id) {
24
- var url, host;
25
-
26
- url = "ymdp/experiment";
27
-
28
- OIB.get(url, {
29
- "domain": View.domain
30
- }, function(response) {
31
- ABTesting.success(content_id, response);
32
- }, function(response) {
33
- ABTesting.error(response);
34
- });
35
- },
36
-
37
- post: function(params) {
38
- params = params || {};
39
- OIB.post("ymdp/view", params, function(response) {
40
- Debug.log("ABTesting.post success", response);
41
- }, function(response) {
42
- Debug.error("ABTesting.post error", response);
43
- });
44
- },
45
-
46
- postView: function(experimentId) {
47
- var params;
48
-
49
- params = {
50
- "var": ABTesting.variable
51
- };
52
- if (experimentId) {
53
- params["experiment_id"] = experimentId;
54
- }
55
- Debug.log("ABTesting.postView: ", params);
56
- ABTesting.post(params);
57
- },
58
-
59
- setVariable: function(value) {
60
- ABTesting.variable = value;
61
- },
62
-
63
- apply: function(content_id, language) {
64
- if (ABTesting.on && $.inArray(language, ABTesting.languages) >= 0) {
65
- var index;
66
-
67
- index = ABTesting.randomAB();
68
- ABTesting.setVariable(index);
69
-
70
- ABTesting.get(content_id);
71
- } else {
72
- YMDP.Init.showAndFinish();
73
- }
74
- },
75
-
76
- error: function(data) {
77
- Debug.log("applyError", data);
78
- if (data.error !== 3002) {
79
- Debug.error("Received body contents fetch error on page " + View.name + ": " + data.error + ' - ' + data.errorMsg);
80
- }
81
- YMDP.Init.showAndFinish();
82
- },
83
-
84
- success: function(content_id, response) {
85
- var content, experiment, experimentId;
86
- Debug.log("ABTesting.success", response);
87
-
88
- experiment = response.experiment;
89
-
90
- if (experiment) {
91
- content = ABTesting.content(experiment);
92
- experimentId = response.experiment.id;
93
-
94
- ABTesting.postView(experimentId);
95
- ABTesting.replaceContents(content_id, content);
96
- } else {
97
- Debug.log("No experiment running");
98
- }
99
-
100
- YMDP.Init.showAndFinish();
101
- },
102
-
103
- replaceContents: function(content_id, content) {
104
- openmail.Application.filterHTML({html: content}, function(response) {
105
- if (response.html && response.html !== '') {
106
- $("#" + content_id).html(response.html);
107
- }
108
- YMDP.Init.showAndFinish();
109
- });
110
- },
111
-
112
- content: function(experiment) {
113
- return experiment["content_" + ABTesting.variable];
114
- }
115
- };
116
-
@@ -1,174 +0,0 @@
1
- /*
2
- CALL OIB
3
-
4
- global to every view. sends Ajax call to OtherInbox.
5
- */
6
-
7
- // send an Ajax call to OtherInbox.
8
- // takes as parameters:
9
- // - the path to call
10
- // - any additional query string params
11
- // - a callback function to run when the Ajax call is a success
12
- // - an optional error function
13
- // - a base URL to use, if you don't want this call going to YMDP.Constants.base_url
14
- // TODO refactor this function to take a second params hash where we could stick success_function, error_function, and base_url
15
-
16
- OIB = {
17
- get: function(oib_path, params, success_function, error_function, base_url) {
18
- params.method = "GET";
19
- OIB.call(oib_path, params, success_function, error_function, base_url);
20
- },
21
-
22
- post: function(oib_path, params, success_function, error_function, base_url) {
23
- params.method = "POST";
24
- OIB.call(oib_path, params, success_function, error_function, base_url);
25
- },
26
-
27
- call: function(oib_path, params, success_function, error_function, base_url) {
28
- var success;
29
-
30
- success = function(response) {
31
- response = JSON.parse(response.data);
32
- if (response.error) {
33
- if (error_function) {
34
- error_function(response);
35
- } else {
36
- YMDP.showError(
37
- {
38
- "method": "OIB.call",
39
- "description": "error callback"
40
- }
41
- ); // OIB.call response: error
42
- }
43
- } else {
44
- if (success_function) {
45
- success_function(response);
46
- } else {
47
- YMDP.showError(
48
- {
49
- "method": "OIB.call",
50
- "description": "success callback error"
51
- }
52
- ); // OIB.call response: success error
53
- }
54
- }
55
- };
56
- OIB.request(oib_path, params, success, error_function, base_url);
57
- },
58
-
59
- ajax_response: false,
60
-
61
- ajax: function(url, method, params, success_function, error_function) {
62
- var debug;
63
-
64
- params = params || {};
65
- params["application"] = View.application;
66
-
67
- debug = !params["_hide_debug"];
68
-
69
- if (debug) {
70
- Debug.log("OIB.ajax: About to call openmail.Application.callWebService: ", {
71
- "method": method,
72
- "url": url + "?" + $.param(params)
73
- });
74
- }
75
-
76
- openmail.Application.callWebService(
77
- {
78
- url: url,
79
- method: method,
80
- parameters: params
81
- },
82
- function(response) {
83
- // response from Ajax call was a 200 response
84
- //
85
- if (debug) {
86
- Debug.log("inside response from openMail.Application.callWebService", response);
87
- }
88
- if (response.error) {
89
- // response has a parameter called "error"
90
- //
91
- if (error_function) {
92
- error_function(response);
93
- } else {
94
- if (debug) {
95
- OIB.error(url, params, response);
96
- }
97
- }
98
- } else {
99
- // SUCCESSFUL RESPONSE
100
- //
101
- // response doesn't have a parameter called "error"
102
- //
103
- success_function(response);
104
- }
105
- });
106
- },
107
-
108
- request: function(oib_path, params, success_function, error_function, base_url) {
109
- var oib_url, method, debug;
110
-
111
- debug = !params["_hide_debug"];
112
-
113
- if (debug) {
114
- Debug.log("inside OIB.request: ", {
115
- "oib_path": oib_path,
116
- "params": JSON.stringify(params)
117
- });
118
- }
119
-
120
- oib_url = base_url ? base_url : YMDP.Constants.base_url;
121
-
122
- if (!(oib_path && typeof(oib_path) === "string")) {
123
- throw("OIB.request must define oib_path");
124
- }
125
- if (!(params && typeof(params) === "object")) {
126
- throw("OIB.request must define params");
127
- }
128
-
129
- oib_url = oib_url + oib_path;
130
- method = "GET";
131
- if (!params.format) {
132
- params.format = 'json';
133
- }
134
- if (params.method) {
135
- method = params.method;
136
- delete params.method;
137
- }
138
- params.version = params.version || <%= @version %>;
139
-
140
- if (debug) {
141
- Debug.log("about to call OIB.ajax");
142
- }
143
-
144
- OIB.ajax(oib_url, method, params, success_function, error_function);
145
- },
146
-
147
- // overwrite this function locally if you need to
148
- error: function(url, params, response) {
149
- var message, debug;
150
-
151
- debug = !params["_hide_debug"];
152
-
153
- if (debug) {
154
- message = "OIB.error: " + JSON.stringify(response) + " calling url: " + url + "?" + $.param(params);
155
- Debug.error(message);
156
- }
157
- },
158
-
159
- // advance the user to the next state in the signup process
160
- //
161
- advance: function(success_function, error_function) {
162
- OIB.post("ymdp/state", {}, function(response) {
163
- Debug.log("Scanning.next success", response);
164
- if (success_function) {
165
- success_function(response);
166
- }
167
- }, function(response) {
168
- Debug.error("Scanning.next error", response);
169
- if (error_function) {
170
- error_function(response);
171
- }
172
- });
173
- }
174
- };
@@ -1,135 +0,0 @@
1
- /*
2
- APPLICATION
3
-
4
- // DO NOT USE the @view instance variable in any files in /app/javascripts/base.
5
- // The way they are cached makes it not safe to do so.
6
-
7
- */
8
-
9
- var OIB, YMDP;
10
-
11
- /*
12
- GLOBAL CONSTANTS
13
- */
14
-
15
- var View = {
16
- application: "<%= @application_name %>",
17
- domain: "<%= @domain %>",
18
- page_loaded: false,
19
-
20
- authorized: function(user) {
21
- return (user[View.application + "_user"]);
22
- }
23
- };
24
-
25
- var YMDP = {
26
- Constants: {},
27
- Init: {}
28
- };
29
-
30
- function unixTimeToDate(unixtime) {
31
- return new Date(unixtime * 1000);
32
- }
33
-
34
- function formatUnixDate(unixtime) {
35
- var date;
36
- date = unixTimeToDate(unixtime);
37
- return date.toString("MMMM d, yyyy");
38
- }
39
-
40
- // Shows the error view.
41
- //
42
- // YMDP.showError({
43
- // heading: "optional heading text can overwrite the error view's heading",
44
- // message: "optional message can overwrite the view's first paragraph",
45
- // retry: "hide"
46
- // });
47
- //
48
- // Set the "retry" option to "hide" to hide the Retry button.
49
- //
50
-
51
- YMDP.showError = function(options) {
52
- var params;
53
-
54
- options = options || {};
55
-
56
- if (options["heading"]) {
57
- $("#error_1").html(options["heading"]);
58
- }
59
- if (options["message"]) {
60
- $("#error_2").html(options["message"]);
61
- }
62
- if (options["retry"] && options["retry"] === "hide") {
63
- $("#retry_button_container").hide();
64
- }
65
-
66
- params = {};
67
- params["description"] = options["description"];
68
- params["method_name"] = options["method"];
69
- params["error"] = JSON.stringify(options["error"]);
70
- params["page"] = View.name;
71
-
72
- Reporter.error(YMDP.guid, params);
73
- $('#main').hide();
74
- $('#utility').show();
75
- $('#loading').hide();
76
- $('#error').show();
77
- };
78
-
79
- YMDP.showLoading = function() {
80
- $('#main').hide();
81
- $('#utility').show();
82
- $('#error').hide();
83
- $('#loading').show();
84
- };
85
-
86
- YMDP.Init.upgradeCheck = function(success_callback, failure_callback) {
87
- // test for Minty
88
- //
89
- openmail.Application.getParameters(function(response) {
90
- if (response.version === "2") {
91
-
92
- // Minty-only code goes here
93
-
94
- Debug.log("Minty found");
95
-
96
- success_callback();
97
- } else {
98
- // non-Minty
99
-
100
- if (failure_callback) {
101
- failure_callback();
102
- } else {
103
- YMDP.Init.upgrade();
104
- }
105
- }
106
- });
107
- };
108
-
109
- YMDP.Init.upgrade = function() {
110
- YMDP.showTranslations();
111
-
112
- View.page_loaded = true;
113
-
114
- $('#loading').hide();
115
- $('#error').hide();
116
- $('#upgrade').show();
117
- };
118
-
119
- YMDP.setTimeoutInSeconds = function(callback_function, interval) {
120
- setTimeout(callback_function, interval * 1000);
121
- };
122
-
123
- YMDP.showTranslations = function() {
124
- Debug.log("begin YMDP.showTranslations");
125
- I18n.findAndTranslateAll();
126
-
127
- // define I18n.localTranslations in the view template
128
- I18n.localTranslations();
129
-
130
- Debug.log("end YMDP.showTranslations");
131
- };
132
-
133
- String.prototype.capitalize = function() {
134
- return this.charAt(0).toUpperCase() + this.slice(1);
135
- }