cedar 0.0.1.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 +7 -0
- data/vendor/assets/images/display-tools-sprite.png +0 -0
- data/vendor/assets/javascripts/cedar.js +241 -0
- data/vendor/assets/javascripts/cedar.marionette.js +25 -0
- data/vendor/assets/javascripts/cedarInit.js.erb +6 -0
- data/vendor/assets/stylesheets/cedar.scss +122 -0
- metadata +48 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 37a9874d9ec3974d629266793d477fe5d9829703
|
4
|
+
data.tar.gz: 45048b87938643c88e6ddb15c3f5f9e6ef746bef
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e08c905f813b6d74df6e8f8aea8dd5be3e733df0e8606fc4b5835d6bb990e1995f6ca01f248d92cd7e167a09d533e1f46e9c6c4c2a179e1cd0d6c73433a76ccf
|
7
|
+
data.tar.gz: 12f2a566de94014a87e59f70bb500b0abfb8a5055ae008c09832f20eb5ef459cf76a0fcfb5b2c508cfff7af8b1701c3bb2c85c3e599e8bfc479961af7f4a4a6b
|
Binary file
|
@@ -0,0 +1,241 @@
|
|
1
|
+
/**
|
2
|
+
* Global object for settings and storage
|
3
|
+
*/
|
4
|
+
var Cedar = {
|
5
|
+
initialized: false,
|
6
|
+
store: null,
|
7
|
+
auth: null,
|
8
|
+
config: {
|
9
|
+
api: 'http://jed.cdr.core.plyinc.dev/api',
|
10
|
+
server: 'http://jed.cdr.core.plyinc.dev/'
|
11
|
+
}
|
12
|
+
};
|
13
|
+
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Cedar.Init
|
17
|
+
*
|
18
|
+
* take care of global initializations
|
19
|
+
*/
|
20
|
+
Cedar.Init = function() {
|
21
|
+
if ( Cedar.initialized ) {
|
22
|
+
return;
|
23
|
+
}
|
24
|
+
|
25
|
+
if ( Cedar.store === null ) {
|
26
|
+
Cedar.store = new Cedar.Store();
|
27
|
+
}
|
28
|
+
|
29
|
+
if ( Cedar.auth === null ) {
|
30
|
+
Cedar.auth = new Cedar.Auth();
|
31
|
+
}
|
32
|
+
|
33
|
+
if (Cedar.auth.isEditMode()) {
|
34
|
+
jQuery( document ).ready(function( $ ) {
|
35
|
+
var logOff = '<a href="" onclick="location.reload(true)" style="position: absolute; bottom: 20px; right: 120px; ">[refresh]</a>';
|
36
|
+
logOff += '<a href="' + Cedar.auth.getLogOffURL() + '" style="position: absolute; bottom: 20px; right: 60px; ">[logout]</a>';
|
37
|
+
$(document.body).append(logOff);
|
38
|
+
});
|
39
|
+
}
|
40
|
+
|
41
|
+
Cedar.initialized = true;
|
42
|
+
}
|
43
|
+
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Cedar.Auth
|
47
|
+
*
|
48
|
+
* responsible for determining if we're authorized for edit mode
|
49
|
+
*/
|
50
|
+
Cedar.Auth = function() {
|
51
|
+
}
|
52
|
+
Cedar.Auth.prototype.isEditMode = function() {
|
53
|
+
return this.isEditUrl();
|
54
|
+
}
|
55
|
+
Cedar.Auth.prototype.isEditUrl = function() {
|
56
|
+
var sPageURL = window.location.search.substring(1);
|
57
|
+
var sURLVariables = sPageURL.split('&');
|
58
|
+
for (var i = 0; i < sURLVariables.length; i++) {
|
59
|
+
if (sURLVariables[i] == 'cdrlogin') {
|
60
|
+
return true;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
return false;
|
64
|
+
}
|
65
|
+
Cedar.Auth.prototype.getLogOffURL = function() {
|
66
|
+
return this.removeURLParameter(window.location.href, 'cdrlogin');
|
67
|
+
}
|
68
|
+
|
69
|
+
// adapted from stackoverflow: http://stackoverflow.com/questions/1634748/how-can-i-delete-a-query-string-parameter-in-javascript
|
70
|
+
Cedar.Auth.prototype.removeURLParameter = function(url, parameter) {
|
71
|
+
//prefer to use l.search if you have a location/link object
|
72
|
+
var urlparts= url.split('?');
|
73
|
+
if (urlparts.length>=2) {
|
74
|
+
|
75
|
+
var prefix= encodeURIComponent(parameter); //+'=';
|
76
|
+
var pars= urlparts[1].split(/[&;]/g);
|
77
|
+
|
78
|
+
//reverse iteration as may be destructive
|
79
|
+
for (var i= pars.length; i-- > 0;) {
|
80
|
+
//idiom for string.startsWith
|
81
|
+
if (pars[i].lastIndexOf(prefix, 0) !== -1) {
|
82
|
+
pars.splice(i, 1);
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
url= urlparts[0];
|
87
|
+
if (pars.length > 0) {
|
88
|
+
url += '?'+pars.join('&');
|
89
|
+
}
|
90
|
+
return url;
|
91
|
+
} else {
|
92
|
+
return url;
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Cedar.Store
|
99
|
+
*
|
100
|
+
* responsible for retrieving Cedar elements from server or local cache.
|
101
|
+
*/
|
102
|
+
Cedar.Store = function() {
|
103
|
+
this._cache = {};
|
104
|
+
}
|
105
|
+
|
106
|
+
Cedar.Store.prototype.put = function ( key, item ) {
|
107
|
+
this._cache[key] = item;
|
108
|
+
}
|
109
|
+
|
110
|
+
// different cedar types may use different api paths
|
111
|
+
Cedar.Store.prototype.find = function ( key, getPath ) {
|
112
|
+
if ( getPath === null )
|
113
|
+
console.log('Cedar Error: must provide api "get" path');
|
114
|
+
|
115
|
+
if (typeof this._cache[key] === 'undefined'){
|
116
|
+
return $.getJSON(Cedar.config.api + getPath + key, function(json) {
|
117
|
+
this.put(key, json);
|
118
|
+
console.log('retrieved from server');
|
119
|
+
}.bind(this));
|
120
|
+
}
|
121
|
+
else {
|
122
|
+
console.log('retrieved from cache');
|
123
|
+
return $.Deferred().resolve(this._cache[key]);
|
124
|
+
}
|
125
|
+
return false;
|
126
|
+
}
|
127
|
+
|
128
|
+
Cedar.Store.prototype.clear = function(key) {
|
129
|
+
delete this._cache[key];
|
130
|
+
}
|
131
|
+
|
132
|
+
|
133
|
+
/**
|
134
|
+
* Cedar.ContentEntry
|
135
|
+
*
|
136
|
+
* basic content block class
|
137
|
+
*
|
138
|
+
*
|
139
|
+
*
|
140
|
+
* options:
|
141
|
+
*
|
142
|
+
* {
|
143
|
+
* el (element or jQuery selector)
|
144
|
+
* }
|
145
|
+
*/
|
146
|
+
Cedar.ContentEntry = function(options) {
|
147
|
+
Cedar.Init();
|
148
|
+
|
149
|
+
var defaults = {
|
150
|
+
el: 'div'
|
151
|
+
};
|
152
|
+
|
153
|
+
this.options = $.extend( {}, defaults, options );
|
154
|
+
|
155
|
+
this.cedarId = this.options.cedarId;
|
156
|
+
this.el = this.options.el;
|
157
|
+
this.$el = $(this.el);
|
158
|
+
this.apiGet = '/objects/contententries/';
|
159
|
+
}
|
160
|
+
|
161
|
+
// parse the json for the relevant content
|
162
|
+
Cedar.ContentEntry.prototype.setContent = function(json) {
|
163
|
+
if (json.code == "UNKNOWN_ID"){
|
164
|
+
this.content = ' '; // if an element is new, fill with blank space to allow edit box to display
|
165
|
+
}
|
166
|
+
else if (typeof json.settings.content !== 'undefined') {
|
167
|
+
this.content = json.settings.content;
|
168
|
+
}
|
169
|
+
else {
|
170
|
+
this.content = '';
|
171
|
+
console.log('Cedar Error: Unable to parse json');
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
// takes into account edit mode styling
|
176
|
+
Cedar.ContentEntry.prototype.getContent = function(options){
|
177
|
+
|
178
|
+
var payload = null;
|
179
|
+
if (options && options.length && options['json']){
|
180
|
+
return { content: 'jsonified' + this.content };
|
181
|
+
}
|
182
|
+
|
183
|
+
if (Cedar.auth.isEditMode()) {
|
184
|
+
return this.getEditOpen(this.cedarId) + this.content + this.getEditClose();
|
185
|
+
}
|
186
|
+
else {
|
187
|
+
return this.content;
|
188
|
+
}
|
189
|
+
}
|
190
|
+
|
191
|
+
// element is optional parameter
|
192
|
+
Cedar.ContentEntry.prototype.fill = function(element) {
|
193
|
+
if (typeof element !== 'undefined') {
|
194
|
+
$(element).html(this.getContent());
|
195
|
+
}
|
196
|
+
else if (typeof this.$el !== 'undefined') {
|
197
|
+
this.$el.html(this.getContent());
|
198
|
+
}
|
199
|
+
}
|
200
|
+
|
201
|
+
// check store for content
|
202
|
+
Cedar.ContentEntry.prototype.retrieve = function() {
|
203
|
+
return Cedar.store.find(this.cedarId, this.apiGet ).done( function(json) {
|
204
|
+
this.setContent(json);
|
205
|
+
this.json = json;
|
206
|
+
}.bind(this));
|
207
|
+
}
|
208
|
+
|
209
|
+
// fill the asssociated element with the retrieved content
|
210
|
+
Cedar.ContentEntry.prototype.render = function() {
|
211
|
+
this.retrieve().done(function() {
|
212
|
+
this.fill();
|
213
|
+
}.bind(this));
|
214
|
+
}
|
215
|
+
|
216
|
+
Cedar.ContentEntry.prototype.renderJSON = function() {
|
217
|
+
//this.retrieve();
|
218
|
+
|
219
|
+
return this.retrieve().done( function() {
|
220
|
+
return (this.getContent({'json':true}));
|
221
|
+
}.bind(this));
|
222
|
+
|
223
|
+
|
224
|
+
// return this.retrieve().done(function() {
|
225
|
+
// return $.Deferred().resolve(this.getContent({'json':true}));
|
226
|
+
// }.bind(this));
|
227
|
+
}
|
228
|
+
|
229
|
+
// styling for edit box
|
230
|
+
Cedar.ContentEntry.prototype.getEditOpen = function(id) {
|
231
|
+
var block;
|
232
|
+
block = '<span class="cms-editable clearfix">';
|
233
|
+
block += '<span class="cms-edit-tools">';
|
234
|
+
block += '<a target="cedarEdit" href="' + Cedar.config.server + 'cmsadmin/EditData?cdr=1&t=ContentEntry&o=' + encodeURIComponent(id) + '" class="cms-edit-icon" >';
|
235
|
+
block += '<b class="cms-edit-label">content block</b><i class="cms-icon cms-icon-right cms-icon-edit"></i></a>';
|
236
|
+
block += '</span>';
|
237
|
+
return block;
|
238
|
+
}
|
239
|
+
Cedar.ContentEntry.prototype.getEditClose = function(){
|
240
|
+
return '</span>';
|
241
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
// Marionette
|
2
|
+
var CedarMarionetteHeader = Backbone.Marionette.ItemView.extend({
|
3
|
+
template : function(serialized_model) {
|
4
|
+
return _.template('<h1><%= content %></h1>')(serialized_model);
|
5
|
+
}
|
6
|
+
});
|
7
|
+
var CedarMarionetteParagraph = Backbone.Marionette.ItemView.extend({
|
8
|
+
template : function(serialized_model) {
|
9
|
+
return _.template('<p><%= content %></p>')(serialized_model);
|
10
|
+
}
|
11
|
+
});
|
12
|
+
|
13
|
+
var CedarMarionetteLayout = Backbone.Marionette.LayoutView.extend({
|
14
|
+
template: '#layout-view-template',
|
15
|
+
|
16
|
+
regions: {
|
17
|
+
cedarHeading: '.js-cedar-heading',
|
18
|
+
anotherParagraph: '.js-cedar-paragraph'
|
19
|
+
},
|
20
|
+
|
21
|
+
onRender: function() {
|
22
|
+
this.cedarHeading.show(new CedarMarionetteHeader({model: this.options.heading}))
|
23
|
+
this.anotherParagraph.show(new CedarMarionetteParagraph({model: this.options.introText}))
|
24
|
+
}
|
25
|
+
});
|
@@ -0,0 +1,122 @@
|
|
1
|
+
// Place all the styles related to the welcome controller here.
|
2
|
+
// They will automatically be included in application.css.
|
3
|
+
// You can use Sass (SCSS) here: http://sass-lang.com/
|
4
|
+
/**
|
5
|
+
* Styles particular to the CMS when in "edit-mode" while viewing a front-end page.
|
6
|
+
* @browsers ALL
|
7
|
+
**/
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
#cmsToolbarPlaceholder {
|
12
|
+
height: 46px !important;
|
13
|
+
}
|
14
|
+
|
15
|
+
.cms-edit-control,
|
16
|
+
.cms-edit-tools {
|
17
|
+
font-family: Arial, sans-serif;
|
18
|
+
}
|
19
|
+
|
20
|
+
.cms-editable {
|
21
|
+
display: block !important;
|
22
|
+
border: 1px dotted #F65126 !important
|
23
|
+
}
|
24
|
+
|
25
|
+
.cms-edit-tools {
|
26
|
+
position: relative;
|
27
|
+
display: block !important;
|
28
|
+
font-size: 10px !important;
|
29
|
+
line-height: 1.2 !important;
|
30
|
+
text-align: left !important;
|
31
|
+
}
|
32
|
+
|
33
|
+
.cms-edit-tools a {
|
34
|
+
color: #F26521 !important;
|
35
|
+
text-decoration: none !important;
|
36
|
+
}
|
37
|
+
|
38
|
+
.cms-edit-tools a:hover {
|
39
|
+
color: #FA8A2D !important;
|
40
|
+
text-decoration: none !important;
|
41
|
+
}
|
42
|
+
|
43
|
+
.cms-edit-label {
|
44
|
+
color: #F26521 !important;
|
45
|
+
text-transform: uppercase;
|
46
|
+
font-size: 10px;
|
47
|
+
padding: 0 6px;
|
48
|
+
}
|
49
|
+
|
50
|
+
.cms-edit-tools .cms-edit-icon,
|
51
|
+
.cms-edit-tools .cms-edit-icon:hover,
|
52
|
+
#industryNavMain #inner .cms-edit-tools .cms-edit-icon,
|
53
|
+
#industryNavMain #inner .cms-edit-tools .cms-edit-icon:hover {
|
54
|
+
display: block;
|
55
|
+
position: absolute;
|
56
|
+
top: 0;
|
57
|
+
right: 0;
|
58
|
+
height: 18px;
|
59
|
+
z-index: 1001;
|
60
|
+
border: 1px solid #fff;
|
61
|
+
background-color: #ffddd0 !important;
|
62
|
+
padding: 0;
|
63
|
+
}
|
64
|
+
|
65
|
+
/* 4 classes to display icons */
|
66
|
+
|
67
|
+
.cms-edit-tools.spacer {
|
68
|
+
height: 20px;
|
69
|
+
}
|
70
|
+
|
71
|
+
.cms-edit-tools.left-align .cms-edit-icon {
|
72
|
+
right: auto;
|
73
|
+
left: 0;
|
74
|
+
}
|
75
|
+
|
76
|
+
.cms-error-log {
|
77
|
+
background-color: white;
|
78
|
+
border: 1px solid black;
|
79
|
+
margin-bottom: 5px;
|
80
|
+
padding: 5px;
|
81
|
+
color: black;
|
82
|
+
}
|
83
|
+
|
84
|
+
/* Standalone icons */
|
85
|
+
.cms-icon {
|
86
|
+
min-height: 18px;
|
87
|
+
width: 18px;
|
88
|
+
height: 18px;
|
89
|
+
display: -moz-inline-stack;
|
90
|
+
display: inline-block;
|
91
|
+
vertical-align: middle;
|
92
|
+
zoom: 1;
|
93
|
+
*display: inline;
|
94
|
+
_height: 18px;
|
95
|
+
background: transparent url(/resources/cms/media/image/display-tools-sprite.png) scroll no-repeat 0 0;
|
96
|
+
}
|
97
|
+
|
98
|
+
.cms-icon-left {
|
99
|
+
border-left: 0;
|
100
|
+
border-right: 1px solid #fff;
|
101
|
+
}
|
102
|
+
|
103
|
+
.cms-icon-right {
|
104
|
+
border-right: 0;
|
105
|
+
border-left: 1px solid #fff;
|
106
|
+
}
|
107
|
+
|
108
|
+
.cms-icon-nav {
|
109
|
+
background-position: -67px -1px;
|
110
|
+
}
|
111
|
+
|
112
|
+
.cms-icon-edit {
|
113
|
+
background-position: -89px -20px;
|
114
|
+
}
|
115
|
+
|
116
|
+
.cms-icon-list {
|
117
|
+
background-position: -34px -39px;
|
118
|
+
}
|
119
|
+
|
120
|
+
.cms-icon-widget {
|
121
|
+
background-position: -71px -58px;
|
122
|
+
}
|
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cedar
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.pre
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jed Murdock
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-06 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Pre-Release Cedar/Ply CaaS Asset Gem
|
14
|
+
email: jedmurdock@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- vendor/assets/images/display-tools-sprite.png
|
20
|
+
- vendor/assets/javascripts/cedar.js
|
21
|
+
- vendor/assets/javascripts/cedar.marionette.js
|
22
|
+
- vendor/assets/javascripts/cedarInit.js.erb
|
23
|
+
- vendor/assets/stylesheets/cedar.scss
|
24
|
+
homepage: http://plyinteractive.com
|
25
|
+
licenses:
|
26
|
+
- MIT
|
27
|
+
metadata: {}
|
28
|
+
post_install_message:
|
29
|
+
rdoc_options: []
|
30
|
+
require_paths:
|
31
|
+
- lib
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 1.3.1
|
42
|
+
requirements: []
|
43
|
+
rubyforge_project:
|
44
|
+
rubygems_version: 2.2.2
|
45
|
+
signing_key:
|
46
|
+
specification_version: 4
|
47
|
+
summary: The Cedar/Ply Asset Gem
|
48
|
+
test_files: []
|