caboose-cms 0.4.92 → 0.4.93
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/assets/javascripts/caboose/model/all.js +2 -0
- data/app/assets/javascripts/caboose/model/attribute.js +2 -0
- data/app/assets/javascripts/caboose/model/bound_date.js +119 -0
- data/app/assets/javascripts/caboose/model/bound_richtext.js +35 -53
- data/app/assets/javascripts/caboose/model/bound_time.js +177 -0
- data/app/assets/javascripts/caboose/model/model_binder.js +12 -3
- data/app/controllers/caboose/application_controller.rb +1 -1
- data/app/helpers/caboose/application_helper.rb +22 -0
- data/app/models/caboose/crumbtrail.rb +4 -4
- data/lib/caboose/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OGRlMzYwYTY4ZjJmNzc1YWU4NzYwNWQ1YmUyMGUyNDUzNTlkMTBlMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTRiZDg5MWY4ZGYyYTY5MjkzZTExNTljYjE3MTBmNTAxMGYyNjczMQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDNkZjJiMmZlNTNjODRiNTdkMmUzNzA3ZjZhNzA5MGRmYmIwYWRjY2Y0ZGNj
|
10
|
+
NzMxNTYxN2M0ZmY0ZGFjNTliOGE4ZGM0YTRlZjhkOWE2NzYxODIzNmZmMGI1
|
11
|
+
NDA0NTZjMWQ0NmFjYWI1ZDUxOWI1ODBlNzg3Mzk3YzRlMzM1ZjU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Yjg5NjgxYjVmODkyNTA4NzhlYTVlZmJiY2E1NjgxOGRhMmRkYjhkMDQzNGQy
|
14
|
+
MDI4ZmE0Y2VlNjc1MDU3YWZmNmYxYWU2YmRjYTM0N2NmOTkzZDk5ODFkMTNm
|
15
|
+
MDJhZWQ5YjRjZTI1ZDM4OTBiZGQwMGMzZmI5NGQ0ODEzMzhmODk=
|
@@ -6,6 +6,8 @@
|
|
6
6
|
//= require caboose/model/bound_control
|
7
7
|
//= require caboose/model/bound_checkbox
|
8
8
|
//= require caboose/model/bound_checkbox_multiple
|
9
|
+
//= require caboose/model/bound_date
|
10
|
+
//= require caboose/model/bound_time
|
9
11
|
//= require caboose/model/bound_image
|
10
12
|
//= require caboose/model/bound_s3_image
|
11
13
|
//= require caboose/model/bound_file
|
@@ -0,0 +1,119 @@
|
|
1
|
+
|
2
|
+
BoundDate = BoundControl.extend({
|
3
|
+
|
4
|
+
//el: false,
|
5
|
+
//model: false,
|
6
|
+
//attribute: false,
|
7
|
+
//binder: false,
|
8
|
+
|
9
|
+
width: false,
|
10
|
+
save_attempts: 0,
|
11
|
+
|
12
|
+
init: function(params) {
|
13
|
+
for (var thing in params)
|
14
|
+
this[thing] = params[thing];
|
15
|
+
|
16
|
+
this.el = this.el ? this.el : this.model.name.toLowerCase() + '_' + this.model.id + '_' + this.attribute.name;
|
17
|
+
$('#'+this.el).wrap($('<div/>')
|
18
|
+
.attr('id', this.el + '_container')
|
19
|
+
.addClass('mb_container')
|
20
|
+
.css('position', 'relative')
|
21
|
+
);
|
22
|
+
$('#'+this.el+'_container').empty();
|
23
|
+
$('#'+this.el+'_container').append($('<input/>')
|
24
|
+
.attr('id', this.el)
|
25
|
+
.attr('type', 'text')
|
26
|
+
.attr('placeholder', this.attribute.fixed_placeholder ? 'empty' : this.attribute.nice_name)
|
27
|
+
.css('text-align', this.attribute.align)
|
28
|
+
.val(this.attribute.value)
|
29
|
+
);
|
30
|
+
|
31
|
+
if (this.attribute.fixed_placeholder)
|
32
|
+
$('#'+this.el+'_container').append($('<div/>').attr('id', this.el + '_placeholder').addClass('mb_placeholder').append($('<span/>').html(this.attribute.nice_name + ': ')));
|
33
|
+
if (this.attribute.width) $('#'+this.el).css('width' , this.attribute.width);
|
34
|
+
if (this.attribute.fixed_placeholder)
|
35
|
+
{
|
36
|
+
var w = $('#'+this.el+'_placeholder').outerWidth();
|
37
|
+
$('#'+this.el).attr('placeholder', 'empty').css('padding-left', '+=' + w).css('width', '-=' + w);
|
38
|
+
}
|
39
|
+
|
40
|
+
var this2 = this;
|
41
|
+
$('#'+this.el).on('keyup', function(e) {
|
42
|
+
if (e.keyCode == 27) this2.cancel(); // Escape
|
43
|
+
if (e.keyCode == 13) this2.save(); // Enter
|
44
|
+
|
45
|
+
if ($('#'+this2.el).val() != this2.attribute.value_clean)
|
46
|
+
$('#'+this2.el).addClass('mb_dirty');
|
47
|
+
else
|
48
|
+
$('#'+this2.el).removeClass('mb_dirty');
|
49
|
+
});
|
50
|
+
$('#'+this.el).on('blur', function() {
|
51
|
+
if (this2.save_attempts < 1)
|
52
|
+
{
|
53
|
+
this2.save_attempts++;
|
54
|
+
this2.save();
|
55
|
+
}
|
56
|
+
});
|
57
|
+
$('#'+this.el).css('z-index', 21);
|
58
|
+
$('#'+this.el).css('position', 'relative');
|
59
|
+
$('#'+this.el).css('background', 'transparent');
|
60
|
+
$('#'+this.el).datepicker({
|
61
|
+
onSelect: function() { this2.save(); }
|
62
|
+
});
|
63
|
+
},
|
64
|
+
|
65
|
+
save: function() {
|
66
|
+
this.attribute.value = $('#'+this.el).val();
|
67
|
+
if (this.attribute.value == this.attribute.value_clean)
|
68
|
+
return;
|
69
|
+
|
70
|
+
this.show_loader();
|
71
|
+
var this2 = this;
|
72
|
+
|
73
|
+
this.model.save(this.attribute, function(resp) {
|
74
|
+
this2.save_attempts = 0;
|
75
|
+
if (resp.error)
|
76
|
+
{
|
77
|
+
this2.hide_loader();
|
78
|
+
this2.error(resp.error);
|
79
|
+
}
|
80
|
+
else
|
81
|
+
{
|
82
|
+
this2.show_check(500);
|
83
|
+
$('#'+this2.el).val(this2.attribute.value);
|
84
|
+
$('#'+this2.el).removeClass('mb_dirty');
|
85
|
+
|
86
|
+
if (this2.binder.success)
|
87
|
+
this2.binder.success(this2);
|
88
|
+
}
|
89
|
+
});
|
90
|
+
},
|
91
|
+
|
92
|
+
cancel: function() {
|
93
|
+
if (this.attribute.before_cancel) this.attribute.before_cancel();
|
94
|
+
this.attribute.value = this.attribute.value_clean;
|
95
|
+
$('#'+this.el).val(this.attribute.value);
|
96
|
+
$('#'+this.el).removeClass('mb_dirty');
|
97
|
+
|
98
|
+
if ($('#'+this.el+'_check').length)
|
99
|
+
this.hide_check();
|
100
|
+
|
101
|
+
if (this.attribute.after_cancel) this.attribute.after_cancel();
|
102
|
+
},
|
103
|
+
|
104
|
+
error: function(str) {
|
105
|
+
if (!$('#'+this.el+'_message').length)
|
106
|
+
{
|
107
|
+
$('#'+this.el+'_container').append($('<div/>')
|
108
|
+
.attr('id', this.el + '_message')
|
109
|
+
.css('width', $('#'+this.el).outerWidth())
|
110
|
+
);
|
111
|
+
}
|
112
|
+
$('#'+this.el+'_message').hide();
|
113
|
+
$('#'+this.el+'_message').html("<p class='note error'>" + str + "</p>");
|
114
|
+
$('#'+this.el+'_message').slideDown();
|
115
|
+
var this2 = this;
|
116
|
+
setTimeout(function() { $('#'+this2.el+'_message').slideUp(function() { $(this).empty(); }); }, 3000);
|
117
|
+
}
|
118
|
+
|
119
|
+
});
|
@@ -20,6 +20,7 @@ BoundRichText = BoundControl.extend({
|
|
20
20
|
.css('position', 'relative')
|
21
21
|
);
|
22
22
|
$('#'+this.el+'_container').empty();
|
23
|
+
$('#'+this.el+'_container').append($('<div/>').attr('id', this.el + '_message'));
|
23
24
|
$('#'+this.el+'_container').append($('<textarea/>').attr('id', this.el).attr('class', 'tinymce').attr('placeholder', 'empty').val(this.attribute.value));
|
24
25
|
//$('#'+this.el+'_container').append($('<div/>').attr('id', this.el + '_placeholder').addClass('placeholder').append($('<span/>').html(this.attribute.nice_name + ': ')));
|
25
26
|
if (this.attribute.width) $('#'+this.el).css('width' , this.attribute.width);
|
@@ -28,67 +29,49 @@ BoundRichText = BoundControl.extend({
|
|
28
29
|
$('#'+this.el).attr('placeholder', 'empty').css('padding-top', '+=' + h).css('height', '-=' + h);
|
29
30
|
|
30
31
|
var this2 = this;
|
31
|
-
//$('#'+this.el).on('keyup', function(e) {
|
32
|
-
// if (e.keyCode == 27) this2.cancel(); // Escape
|
33
|
-
// //if (e.keyCode == 13) this2.save(); // Enter
|
34
|
-
//
|
35
|
-
// if ($('#'+this2.el).val() != this2.attribute.value_clean)
|
36
|
-
// $('#'+this2.el).addClass('dirty');
|
37
|
-
// else
|
38
|
-
// $('#'+this2.el).removeClass('dirty');
|
39
|
-
//});
|
40
32
|
|
41
33
|
setTimeout(function() {
|
42
|
-
tinymce.execCommand("mceAddEditor", false, this2.el);
|
34
|
+
//tinymce.execCommand("mceAddEditor", false, this2.el);
|
43
35
|
var ed = tinymce.EditorManager.createEditor(this2.el);
|
44
|
-
|
45
|
-
//
|
46
|
-
//
|
47
|
-
//
|
48
|
-
//
|
49
|
-
//
|
50
|
-
//
|
51
|
-
|
52
|
-
//ed.
|
53
|
-
//ed.on('keyup', function(e) {
|
54
|
-
// tinymce.triggerSave();
|
55
|
-
// if (e.keyCode == 27) this2.cancel(); // Escape
|
56
|
-
// if ($('#'+this2.el).val() != this2.attribute.value_clean)
|
57
|
-
// ed.getBody().style.backgroundColor = "#fff799";
|
58
|
-
// else
|
59
|
-
// ed.getBody().style.backgroundColor = "#fff";
|
60
|
-
//});
|
36
|
+
//var ed = new tinymce.Editor(this2.el, {
|
37
|
+
// setup: function (editor) {
|
38
|
+
// editor.on('init', function (e) { alert('Test'); });
|
39
|
+
// }
|
40
|
+
// }, tinymce.Editormanager);
|
41
|
+
//editor.on('init', function (e) { alert('Test'); });
|
42
|
+
//ed.on('NodeChange', this2.tinymce_change);
|
43
|
+
//ed.on('click', function(e) { alert('tinymce was clicked'); });
|
44
|
+
//ed.render();
|
61
45
|
}, 100);
|
62
46
|
},
|
63
47
|
|
48
|
+
tinymce_change: function(ed) {
|
49
|
+
if (ed.getContent() == this.attribute.value_clean)
|
50
|
+
ed.getBody().style.backgroundColor = "#fff";
|
51
|
+
else
|
52
|
+
ed.getBody().style.backgroundColor = "#fff799";
|
53
|
+
},
|
54
|
+
|
64
55
|
save: function() {
|
65
56
|
var ed = tinymce.activeEditor;
|
66
|
-
el
|
67
|
-
$(el).val(ed.getContent());
|
68
|
-
|
69
|
-
//ed.remove();
|
70
|
-
//tinymce.triggerSave();
|
57
|
+
$('#'+this.el).val(ed.getContent());
|
71
58
|
|
72
59
|
this.attribute.value = $('#'+this.el).val();
|
73
60
|
if (this.attribute.value == this.attribute.value_clean)
|
74
|
-
return;
|
75
|
-
|
61
|
+
return;
|
62
|
+
|
76
63
|
var this2 = this;
|
77
|
-
this.model.save(this.attribute, function(resp) {
|
64
|
+
this.model.save(this.attribute, function(resp) {
|
78
65
|
if (resp.error)
|
79
|
-
{
|
80
|
-
|
81
|
-
this2.error(resp.error);
|
66
|
+
{
|
67
|
+
alert(resp.error);
|
82
68
|
}
|
83
69
|
else
|
84
|
-
{
|
85
|
-
tinymce.activeEditor.remove();
|
86
|
-
this2.show_check(500);
|
70
|
+
{
|
87
71
|
$('#'+this2.el).val(this2.attribute.value);
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
72
|
+
ed.setContent(this2.attribute.value);
|
73
|
+
ed.getBody().style.backgroundColor = "#fff";
|
74
|
+
|
92
75
|
if (this2.binder.success)
|
93
76
|
this2.binder.success(this2);
|
94
77
|
}
|
@@ -96,16 +79,15 @@ BoundRichText = BoundControl.extend({
|
|
96
79
|
},
|
97
80
|
|
98
81
|
cancel: function() {
|
99
|
-
if (this.attribute.before_cancel)
|
82
|
+
if (this.attribute.before_cancel)
|
83
|
+
this.attribute.before_cancel();
|
84
|
+
|
100
85
|
this.attribute.value = this.attribute.value_clean;
|
101
86
|
$('#'+this.el).val(this.attribute.value);
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
tinymce.activeEditor.remove();
|
108
|
-
if (this.attribute.after_cancel) this.attribute.after_cancel();
|
87
|
+
|
88
|
+
var ed = tinymce.activeEditor;
|
89
|
+
ed.setContent(this.attribute.value);
|
90
|
+
ed.getBody().style.backgroundColor = "#fff";
|
109
91
|
},
|
110
92
|
|
111
93
|
error: function(str) {
|
@@ -0,0 +1,177 @@
|
|
1
|
+
|
2
|
+
BoundTime = BoundControl.extend({
|
3
|
+
|
4
|
+
//el: false,
|
5
|
+
//model: false,
|
6
|
+
//attribute: false,
|
7
|
+
//binder: false,
|
8
|
+
|
9
|
+
message: false,
|
10
|
+
placeholder: false,
|
11
|
+
|
12
|
+
init: function(params) {
|
13
|
+
for (var thing in params)
|
14
|
+
this[thing] = params[thing];
|
15
|
+
|
16
|
+
this.el = this.el ? this.el : this.model.name.toLowerCase() + '_' + this.model.id + '_' + this.attribute.name;
|
17
|
+
this.message = this.el + '_message';
|
18
|
+
this.placeholder = this.el + '_placeholder';
|
19
|
+
|
20
|
+
$('#'+this.el).wrap($('<div/>')
|
21
|
+
.attr('id', this.el + '_container')
|
22
|
+
.addClass('mb_container')
|
23
|
+
.css('position', 'relative')
|
24
|
+
);
|
25
|
+
$('#'+this.el+'_container').empty();
|
26
|
+
if (this.attribute.fixed_placeholder == true)
|
27
|
+
{
|
28
|
+
$('#'+this.el+'_container').append($('<div/>')
|
29
|
+
.attr('id', this.placeholder)
|
30
|
+
.addClass('mb_placeholder')
|
31
|
+
.append($('<span/>')
|
32
|
+
.html(this.attribute.nice_name + ': ')
|
33
|
+
)
|
34
|
+
);
|
35
|
+
}
|
36
|
+
var this2 = this;
|
37
|
+
$('#'+this.el+'_container').append($('<input/>')
|
38
|
+
.attr('type', 'text')
|
39
|
+
.attr('id', this.el)
|
40
|
+
.addClass('mb_fake_option')
|
41
|
+
.attr('placeholder', this.attribute.empty_text)
|
42
|
+
.click(function() { this2.edit(); })
|
43
|
+
.val(this.attribute.text && this.attribute.text.length > 0 ? this.attribute.text : this.attribute.empty_text)
|
44
|
+
);
|
45
|
+
if (this.attribute.width)
|
46
|
+
$('#'+this.el).css('width', this.attribute.width);
|
47
|
+
|
48
|
+
if (this.attribute.fixed_placeholder)
|
49
|
+
{
|
50
|
+
var w = $('#'+this.placeholder).outerWidth();
|
51
|
+
$('#'+this.el)
|
52
|
+
.css('padding-left', '+=' + w)
|
53
|
+
.css('width', '-=' + w);
|
54
|
+
}
|
55
|
+
|
56
|
+
// Populate options manually
|
57
|
+
this.attribute.options = []
|
58
|
+
$.each(['am', 'pm'], function(i, ampm) {
|
59
|
+
for (var hour = 0; hour < 12; hour += this2.attribute.hour_increment) {
|
60
|
+
for (var min = 0; min < 60; min += this2.attribute.minute_increment) {
|
61
|
+
h = hour == 0 ? '12' : (hour < 10 ? '0' + hour : '' + hour);
|
62
|
+
m = min < 10 ? '0' + min : '' + min;
|
63
|
+
t = '' + h + ':' + m + ' ' + ampm;
|
64
|
+
this2.attribute.options.push({ value: t, text: t });
|
65
|
+
}
|
66
|
+
}
|
67
|
+
});
|
68
|
+
|
69
|
+
var select = $('<select/>')
|
70
|
+
.attr('id', this2.el + '_select')
|
71
|
+
.addClass('mb_fake')
|
72
|
+
.css('width', $('#'+this2.el).outerWidth())
|
73
|
+
.on('change', function() {
|
74
|
+
$('#'+this2.el).val($('#'+this2.el+'_select').val());
|
75
|
+
this2.save();
|
76
|
+
});
|
77
|
+
// Make sure the existing value is in the list of options
|
78
|
+
var exists = false;
|
79
|
+
$.each(this2.attribute.options, function(i, option) {
|
80
|
+
if (option.value == this2.attribute.value)
|
81
|
+
{
|
82
|
+
exists = true;
|
83
|
+
return false;
|
84
|
+
}
|
85
|
+
});
|
86
|
+
if (!exists)
|
87
|
+
this2.attribute.options.unshift({
|
88
|
+
value: this2.attribute.value,
|
89
|
+
text: this2.attribute.text
|
90
|
+
});
|
91
|
+
|
92
|
+
$.each(this2.attribute.options, function(i, option) {
|
93
|
+
var opt = $('<option/>')
|
94
|
+
.val(option.value)
|
95
|
+
.html(option.text);
|
96
|
+
if (option.value == this2.attribute.value)
|
97
|
+
{
|
98
|
+
this2.attribute.text = option.text;
|
99
|
+
$('#'+this2.el).val(this2.attribute.text);
|
100
|
+
opt.attr('selected', 'true');
|
101
|
+
}
|
102
|
+
select.append(opt);
|
103
|
+
});
|
104
|
+
$('#'+this2.el+'_container').append(select);
|
105
|
+
$('#'+this2.el+'_select').css('width', $('#'+this2.el).outerWidth());
|
106
|
+
},
|
107
|
+
|
108
|
+
//update_options: function() {
|
109
|
+
// var that = this;
|
110
|
+
// this.attribute.populate_options(function() {
|
111
|
+
// var select = $('<select/>')
|
112
|
+
// .attr('id', that.el + '_select')
|
113
|
+
// .addClass('fake')
|
114
|
+
// .css('width', $('#'+that.el).outerWidth())
|
115
|
+
// .on('change', function() {
|
116
|
+
// $('#'+that.el).val($('#'+that.el+'_select').val());
|
117
|
+
// that.save();
|
118
|
+
// });
|
119
|
+
//
|
120
|
+
// $.each(that.attribute.options, function(i, option) {
|
121
|
+
// var opt = $('<option/>')
|
122
|
+
// .val(option.value)
|
123
|
+
// .html(option.text);
|
124
|
+
// if (option.value == that.attribute.value)
|
125
|
+
// opt.attr('selected', 'true');
|
126
|
+
// select.append(opt);
|
127
|
+
// });
|
128
|
+
//
|
129
|
+
// if ($('#' + that.el + '_select').length)
|
130
|
+
// $('#' + that.el + '_select').remove();
|
131
|
+
//
|
132
|
+
// $('#'+that.el+'_container').append(select);
|
133
|
+
// $('#'+that.el+'_select').css('width', $('#'+that.el).outerWidth());
|
134
|
+
// });
|
135
|
+
//},
|
136
|
+
|
137
|
+
view: function() {
|
138
|
+
|
139
|
+
},
|
140
|
+
|
141
|
+
edit: function() {
|
142
|
+
},
|
143
|
+
|
144
|
+
save: function() {
|
145
|
+
this.attribute.value = $('#'+this.el).val();
|
146
|
+
var this2 = this;
|
147
|
+
this.model.save(this.attribute, function(resp) {
|
148
|
+
$(this2.attribute.options).each(function(i,opt) {
|
149
|
+
if (opt.value == this2.attribute.value)
|
150
|
+
this2.attribute.text = opt.text;
|
151
|
+
});
|
152
|
+
if (this2.attribute.text)
|
153
|
+
$('#'+this2.el).val(this2.attribute.text);
|
154
|
+
$('#'+this2.el+'_check a').removeClass('loading');
|
155
|
+
if (resp.error) this2.error(resp.error);
|
156
|
+
else
|
157
|
+
{
|
158
|
+
if (this2.binder.success)
|
159
|
+
this2.binder.success(this2);
|
160
|
+
this2.view();
|
161
|
+
}
|
162
|
+
});
|
163
|
+
},
|
164
|
+
|
165
|
+
cancel: function() {
|
166
|
+
this.attribute.value = this.attribute.value_clean;
|
167
|
+
$('#'+this.el).val(this.attribute.value);
|
168
|
+
this.view();
|
169
|
+
},
|
170
|
+
|
171
|
+
error: function(str) {
|
172
|
+
if (!$('#'+this.message).length)
|
173
|
+
$('#'+this.el+'_container').prepend($('<div/>').attr('id', this.message));
|
174
|
+
$('#'+this.message).html("<p class='note error'>" + str + "</p>");
|
175
|
+
}
|
176
|
+
|
177
|
+
});
|
@@ -5,6 +5,10 @@ var ModelBinder = function(params) {
|
|
5
5
|
all_model_binders[all_model_binders.length] = this;
|
6
6
|
};
|
7
7
|
|
8
|
+
ModelBinder.tinymce_init = function() {
|
9
|
+
alert('ModelBinder.tinymce_init');
|
10
|
+
};
|
11
|
+
|
8
12
|
ModelBinder.remove_from_all_model_binders = function(model_name, id) {
|
9
13
|
var arr = [];
|
10
14
|
$.each(all_model_binders, function(i, mb) {
|
@@ -14,8 +18,7 @@ ModelBinder.remove_from_all_model_binders = function(model_name, id) {
|
|
14
18
|
all_model_binders = arr;
|
15
19
|
};
|
16
20
|
|
17
|
-
ModelBinder.
|
18
|
-
var id = tinymce.activeEditor.id.toLowerCase();
|
21
|
+
ModelBinder.tinymce_control = function(id) {
|
19
22
|
var control = false;
|
20
23
|
$.each(all_model_binders, function(i, mb) {
|
21
24
|
$.each(mb.controls, function(i, c) {
|
@@ -26,6 +29,11 @@ ModelBinder.tinymce_current_control = function() {
|
|
26
29
|
return control;
|
27
30
|
};
|
28
31
|
|
32
|
+
ModelBinder.tinymce_current_control = function() {
|
33
|
+
var id = tinymce.activeEditor.id.toLowerCase();
|
34
|
+
return ModelBinder.tinymce_control(id);
|
35
|
+
};
|
36
|
+
|
29
37
|
ModelBinder.prototype = {
|
30
38
|
model: false,
|
31
39
|
controls: [],
|
@@ -43,6 +51,7 @@ ModelBinder.prototype = {
|
|
43
51
|
if (params['update_url']) this.model.update_url = params['update_url'];
|
44
52
|
if (params['success']) this.success = params['success'];
|
45
53
|
if (params['authenticity_token']) this.authenticity_token = params['authenticity_token'];
|
54
|
+
if (params['on_load']) this.on_load = params['on_load'];
|
46
55
|
|
47
56
|
var m = this.model;
|
48
57
|
$.each(params['attributes'], function(i, attrib) {
|
@@ -76,7 +85,7 @@ ModelBinder.prototype = {
|
|
76
85
|
|
77
86
|
this2.controls.push(control);
|
78
87
|
});
|
79
|
-
|
88
|
+
|
80
89
|
if (this.on_load)
|
81
90
|
this.on_load();
|
82
91
|
},
|
@@ -1,4 +1,26 @@
|
|
1
1
|
module Caboose
|
2
2
|
module ApplicationHelper
|
3
|
+
def caboose_tinymce
|
4
|
+
return "
|
5
|
+
<script src='//tinymce.cachefly.net/4.0/tinymce.min.js'></script>
|
6
|
+
<script type='text/javascript'>
|
7
|
+
//<![CDATA[
|
8
|
+
tinyMCE.init({
|
9
|
+
selector: 'textarea.tinymce',
|
10
|
+
width: '800px',
|
11
|
+
height: '300px',
|
12
|
+
convert_urls: false,
|
13
|
+
plugins: 'advlist autolink lists link image charmap print preview hr anchor pagebreak searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking table contextmenu directionality emoticons template paste textcolor caboose',
|
14
|
+
toolbar1: 'caboose_save caboose_cancel | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
|
15
|
+
image_advtab: true,
|
16
|
+
external_plugins: { 'caboose': '/assets/tinymce/plugins/caboose/plugin.js' },
|
17
|
+
setup: function(editor) {
|
18
|
+
var control = ModelBinder.tinymce_control(editor.id);
|
19
|
+
editor.on('keyup', function(e) { control.tinymce_change(editor); });
|
20
|
+
}
|
21
|
+
});
|
22
|
+
//]]>
|
23
|
+
</script>\n"
|
24
|
+
end
|
3
25
|
end
|
4
26
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Caboose
|
2
2
|
class Crumbtrail
|
3
3
|
|
4
|
-
@_crumbtrail =
|
4
|
+
@_crumbtrail = nil
|
5
5
|
|
6
|
-
def
|
7
|
-
|
6
|
+
def add(url, text = nil)
|
7
|
+
@_crumbtrail = [] if @_crumbtrail.nil?
|
8
8
|
if url.is_a?(Hash)
|
9
9
|
url.each do |url2, text2|
|
10
10
|
@_crumbtrail << [url2, text2]
|
@@ -14,7 +14,7 @@ module Caboose
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
17
|
+
def print(url = nil, text = nil)
|
18
18
|
if url
|
19
19
|
self.add(url, text)
|
20
20
|
end
|
data/lib/caboose/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caboose-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.93
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -213,6 +213,7 @@ files:
|
|
213
213
|
- app/assets/javascripts/caboose/model/bound_checkbox_multiple.js
|
214
214
|
- app/assets/javascripts/caboose/model/bound_code.js
|
215
215
|
- app/assets/javascripts/caboose/model/bound_control.js
|
216
|
+
- app/assets/javascripts/caboose/model/bound_date.js
|
216
217
|
- app/assets/javascripts/caboose/model/bound_file.js
|
217
218
|
- app/assets/javascripts/caboose/model/bound_image.js
|
218
219
|
- app/assets/javascripts/caboose/model/bound_richtext.js
|
@@ -220,6 +221,7 @@ files:
|
|
220
221
|
- app/assets/javascripts/caboose/model/bound_select.js
|
221
222
|
- app/assets/javascripts/caboose/model/bound_text.js
|
222
223
|
- app/assets/javascripts/caboose/model/bound_textarea.js
|
224
|
+
- app/assets/javascripts/caboose/model/bound_time.js
|
223
225
|
- app/assets/javascripts/caboose/model/class.js
|
224
226
|
- app/assets/javascripts/caboose/model/model.js
|
225
227
|
- app/assets/javascripts/caboose/model/model_binder.js
|