cedar 0.1.8.pre → 0.1.9.pre

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 834c1e6f8d22dd8ba74ba29f54e6465be77793ec
4
- data.tar.gz: 99d014143eb094e05fbf42eda8460bcf108e0200
3
+ metadata.gz: 4e6bf11961f900332b01889e6238f0c7af279231
4
+ data.tar.gz: 714dc233c5fc049b1dbcff6d85a1db789187790e
5
5
  SHA512:
6
- metadata.gz: b1652d6e1fbe7aad9dcecf815dd0e2e34f63b8384f6e4d8ce0eb3b067a11f0875157ef52d0aae8ae8f93fc02a30537cefc9f97f64eeb873e43b842201b9f1a93
7
- data.tar.gz: ebb2e1764de764aec3f24519017686cd9e0d7f1fb0b0012e68be6fa04efab58527c71301785df15031a96cf9c311df3cf08d76dc89a4d5dc5a4e64a1a89a8d90
6
+ metadata.gz: 48c4f927250cf3785be11fc1a92824571b20a41755f3df9c49cabb8bb5816ce9c23777ad0c97f4333937c5ffcb5cd3b729be7beae555951039da430eae479ddd
7
+ data.tar.gz: fdfdb7cb12eb95e9953acc99777ce5c8bdbe611d92eb9fa04d8a204ed861e031db7f2d5c913dcb1c0c7beb8b9478578eba798e2690fccddd56c1c2546165651a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cedar (0.1.8.pre)
4
+ cedar (0.1.9.pre)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -16,20 +16,44 @@ var Cedar = {
16
16
  /**
17
17
  * Cedar.Init
18
18
  *
19
- * take care of global initializations
19
+ * Initialize Application object
20
+ *
21
+ */
22
+ Cedar.Init = function(options) {
23
+ return new Cedar.Application(options);
24
+ }
25
+
26
+ /**
27
+ * Global function to display message to console if Cedar.debug = true
28
+ *
29
+ * @param <string> message
30
+ */
31
+ Cedar.debug = function(msg) {
32
+ if (Cedar.config.debug) {
33
+ console.log(msg);
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Cedar.Application
39
+ *
40
+ * Application object for initializing and setting global values
20
41
  *
21
42
  * @param <Array> options
22
43
  * - server : 'test.cdr.plyinc.com' - *required
23
44
  * - debug : true | false
45
+ * - fetch : true | false
46
+ * - forceHttps : true | false
24
47
  */
25
- Cedar.Init = function(options) {
48
+ Cedar.Application = function(options) {
26
49
  if ( Cedar.initialized ) {
27
50
  return;
28
51
  }
29
52
 
30
53
  var defaults = {
31
54
  debug: false,
32
- fetch: true
55
+ fetch: true,
56
+ forceHttps: false
33
57
  };
34
58
 
35
59
  this.options = $.extend({}, defaults, options);
@@ -38,8 +62,8 @@ Cedar.Init = function(options) {
38
62
  throw 'Cedar Error: must provide "server" value on Init()';
39
63
  }
40
64
 
41
- Cedar.config.server = 'http://' + this.options.server;
42
- Cedar.config.api = 'http://' + this.options.server + '/api';
65
+ Cedar.config.server = this.getProtocol() + this.options.server;
66
+ Cedar.config.api = this.getProtocol() + this.options.server + '/api';
43
67
  Cedar.config.debug = this.options.debug;
44
68
 
45
69
  if ( Cedar.store === null ) {
@@ -51,20 +75,7 @@ Cedar.Init = function(options) {
51
75
  }
52
76
 
53
77
  if (Cedar.auth.isEditMode()) {
54
- $(document).ready(function() {
55
- var $body = $('body');
56
- var globalActions = '<div class="cedar-cms-global-actions">' +
57
- '<a href="#" class="cedar-cms-global-action" onclick="window.location.reload();">' +
58
- '<span class="cedar-cms-icon cedar-cms-icon-edit"></span> ' +
59
- '<span class="cedar-cms-global-action-label">Refresh</span>' +
60
- '</a><br>' +
61
- '<a class="cedar-cms-global-action" href="' + Cedar.auth.getLogOffURL() + '">' +
62
- '<span class="cedar-cms-icon cedar-cms-icon-edit"></span> ' +
63
- '<span class="cedar-cms-global-action-label">Log Off Cedar</span>' +
64
- '</a>' +
65
- '</div>';
66
- $body.append(globalActions);
67
- });
78
+ this.showGlobalActions();
68
79
  }
69
80
 
70
81
  if (this.options.fetch) {
@@ -73,17 +84,32 @@ Cedar.Init = function(options) {
73
84
 
74
85
  Cedar.initialized = true;
75
86
  }
76
- /**
77
- * display message to console if Cedar.debug = true
78
- *
79
- * @param <string> message
80
- */
81
- Cedar.debug = function(msg) {
82
- if (Cedar.config.debug) {
83
- console.log(msg);
87
+
88
+ Cedar.Application.prototype.getProtocol = function() {
89
+ if (this.options.forceHttps || window.location.protocol === 'https:') {
90
+ return 'https://';
91
+ } else {
92
+ return 'http://';
84
93
  }
85
94
  }
86
95
 
96
+ Cedar.Application.prototype.showGlobalActions = function() {
97
+ $(document).ready(function() {
98
+ var $body = $('body');
99
+ var globalActions = '<div class="cedar-cms-global-actions">' +
100
+ '<a href="#" class="cedar-cms-global-action" onclick="window.location.reload();">' +
101
+ '<span class="cedar-cms-icon cedar-cms-icon-edit"></span> ' +
102
+ '<span class="cedar-cms-global-action-label">Refresh</span>' +
103
+ '</a><br>' +
104
+ '<a class="cedar-cms-global-action" href="' + Cedar.auth.getLogOffURL() + '">' +
105
+ '<span class="cedar-cms-icon cedar-cms-icon-edit"></span> ' +
106
+ '<span class="cedar-cms-global-action-label">Log Off Cedar</span>' +
107
+ '</a>' +
108
+ '</div>';
109
+ $body.append(globalActions);
110
+ });
111
+ }
112
+
87
113
 
88
114
  /**
89
115
  * Cedar.Auth
data/lib/cedar/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cedar
2
- VERSION = "0.1.8.pre"
2
+ VERSION = "0.1.9.pre"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cedar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.pre
4
+ version: 0.1.9.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jed Murdock
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-08 00:00:00.000000000 Z
11
+ date: 2015-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler