caboose-cms 0.3.96 → 0.3.97

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- M2NjYjlkNjEyNGIyYjI5OTkxNmI2Y2IwM2VlYWIxNTY4NWM4MzQwMA==
4
+ ZGEyYTNmZjA3YWVjNGJjNGU1YTMxYTg4YmI5MmIzZDQxYjYyYmYzOA==
5
5
  data.tar.gz: !binary |-
6
- ZTE5NDQxOGJkMjJmZTY5ZTY5OGEyZWFiYTk2NmUwYjY3OTYxNjVlMg==
6
+ ZDc1MzA0ZGVhYjNlZGFjZmQ4MjViMzIzODQ2Mzk1ZDMxNWMxYzNkOA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MTcyNzg3ZjBhMDZmYWI4OTVkMzAzYTJmOWQ3MDQxMDUyY2M5MDlmOTcxOTEy
10
- YTNmMTk3MTZlZDgwM2JjNDU1OGI3MmZjZjQ4ZjVmZTVhNzk5MzU2Mjc3YTlm
11
- N2E3ZTk1ZTliOGNjNTRhZjMyNTY2YTM0YzE0ZWE1YWVjNjE3ZWE=
9
+ NjJhYjFiZGFkMjU1ODY2NGVlNmVmOWZhMzE3ZTE2ZTg2MTJjOThjMTNmNjkx
10
+ ZmFhNzIxYzNmZDc1Mzk4NGJhZmM0Y2UwODJkMTNmYTAzOGVjZjJiNGFhNmVj
11
+ ZTU4MjY2OTIwZWY3ZjFlNjRiYTBjNWZhNDAwNWMxOWU1NGE4Yjg=
12
12
  data.tar.gz: !binary |-
13
- ZGFiZWU0NGVkYzFlYWIzMzk3NTAwYzk1ZTJmNjdlNjZlYTM1NTgzNzk3ZDVi
14
- YjE0MjE3MmNkNWI5M2Y1MzYzN2E4MTNjN2YyNjk5MTA4NTU2MDU0Y2VmNzJi
15
- MDQ5OWFlMmExY2Y0YmFkYWUyMjU3OGExYjgyN2M1MThhYTRkZjE=
13
+ NGI4MDY2ZjExY2MyNjk4NWYwZjlkZGQwNzA4YjA3OGY1ZTVmMmEzN2NiYmQ3
14
+ YzUzNzQ5MTE1MDI4Y2E0NThmMTNkM2Q4ZWY2OTE0ZjY1NTg4ZWNhMjJlNmYz
15
+ ZmYwN2Q4MDQxNDIzOWNlMzQ4MjQ2ZWJkY2ViNGI0NzFmYjRkMDk=
@@ -0,0 +1,143 @@
1
+
2
+ BoundCode = BoundControl.extend({
3
+
4
+ width: false,
5
+
6
+ init: function(params) {
7
+ for (var thing in params)
8
+ this[thing] = params[thing];
9
+
10
+ this.el = this.el ? this.el : this.model.name.toLowerCase() + '_' + this.model.id + '_' + this.attribute.name;
11
+
12
+ $('#'+this.el).wrap($('<div/>')
13
+ .attr('id', this.el + '_container')
14
+ //.addClass('mb_container')
15
+ //.css('position', 'relative')
16
+ );
17
+ $('#'+this.el+'_container').empty();
18
+ $('#'+this.el+'_container').append($('<textarea/>').attr('id', this.el).attr('placeholder', 'empty').val(this.attribute.value));
19
+ //$('#'+this.el+'_container').append($('<div/>').attr('id', this.el + '_placeholder').addClass('mb_placeholder').append($('<span/>').html(this.attribute.nice_name + ': ')));
20
+ //if (this.attribute.width) $('#'+this.el).css('width' , this.attribute.width);
21
+ //if (this.attribute.height) $('#'+this.el).css('height' , this.attribute.height);
22
+ //var h = $('#'+this.el+'_placeholder').outerHeight();
23
+ //$('#'+this.el).attr('placeholder', 'empty').css('padding-top', '+=' + h).css('height', '-=' + h);
24
+
25
+ var this2 = this;
26
+ //$('#'+this.el).on('keyup', function(e) {
27
+ // if (e.keyCode == 27) this2.cancel(); // Escape
28
+ // //if (e.keyCode == 13) this2.save(); // Enter
29
+ //
30
+ // if ($('#'+this2.el).val() != this2.attribute.value_clean)
31
+ // {
32
+ // this2.show_controls();
33
+ // $('#'+this2.el).addClass('mb_dirty');
34
+ // }
35
+ // else
36
+ // $('#'+this2.el).removeClass('mb_dirty');
37
+ //});
38
+ //$('#'+this.el).on('blur', function() { this2.save(); });
39
+
40
+ var code_editor = CodeMirror.fromTextArea(document.getElementById(this.el), {
41
+ lineNumbers: true,
42
+ theme: "night",
43
+ extraKeys: {
44
+ //"F11": function(cm) { cm.setOption("fullScreen", !cm.getOption("fullScreen")); },
45
+ "Esc": function(cm) { if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false); }
46
+ }
47
+ });
48
+ },
49
+
50
+ show_controls: function() {
51
+ if ($('#'+this.el+'_controls').length)
52
+ return;
53
+ var w = $('#'+this.el).outerWidth();
54
+ var this2 = this;
55
+ $('#'+this.el+'_container').prepend($('<div/>')
56
+ .attr('id', this.el + '_controls')
57
+ .addClass('mb_bound_textarea_controls')
58
+ .css('position', 'absolute')
59
+ .css('top', 0)
60
+ .css('left', w-148)
61
+ .css('width', 148)
62
+ .css('overflow', 'hidden')
63
+ .append($('<div/>')
64
+ .css('width', 148)
65
+ .css('margin-left', 148)
66
+ .append($('<a/>').html('Save' ).addClass('mb_save' ).css('width', 60).attr('href', '#').click(function(event) { event.preventDefault(); this2.save(); }))
67
+ .append($('<a/>').html('Discard').addClass('mb_discard').css('width', 80).attr('href', '#').click(function(event) { event.preventDefault(); this2.cancel(); }))
68
+ )
69
+ );
70
+ $('#'+this.el+'_controls div').animate({ 'margin-left': 0 }, 300);
71
+ },
72
+
73
+ hide_controls: function() {
74
+ if (!$('#'+this.el+'_controls').length)
75
+ return;
76
+ var this2 = this;
77
+ $('#'+this.el+'_controls div').animate({ 'margin-left': 100 }, 300, function() {
78
+ $('#'+this2.el+'_controls').remove();
79
+ });
80
+ },
81
+
82
+ save: function() {
83
+
84
+ //this.attribute.value = $('#'+this.el).val();
85
+ //if (this.attribute.value == this.attribute.value_clean)
86
+ // return;
87
+ //
88
+ //this.hide_controls();
89
+ //this.show_loader();
90
+ //var this2 = this;
91
+ //this.model.save(this.attribute, function(resp) {
92
+ // if (resp.error)
93
+ // {
94
+ // this2.hide_loader();
95
+ // this2.error(resp.error);
96
+ // }
97
+ // else
98
+ // {
99
+ // this2.show_check(500);
100
+ // $('#'+this2.el).val(this2.attribute.value);
101
+ // $('#'+this2.el).removeClass('mb_dirty');
102
+ //
103
+ // if (this2.binder.success)
104
+ // this2.binder.success(this2);
105
+ // }
106
+ //});
107
+ },
108
+
109
+ cancel: function() {
110
+
111
+ //if ($('#'+this.el).val() != this.attribute.value_clean)
112
+ //{
113
+ // if (confirm('This box has unsaved changes. Hit OK to save changes, Cancel to discard.'))
114
+ // {
115
+ // this.attribute.value = $('#'+this.el).val();
116
+ // this.attribute.value_clean = $('#'+this.el).val();
117
+ // this.save();
118
+ // }
119
+ //}
120
+ //this.attribute.value = this.attribute.value_clean;
121
+ //$('#'+this.el).val(this.attribute.value);
122
+ //$('#'+this.el).removeClass('mb_dirty');
123
+ //
124
+ //if ($('#'+this.el+'_check').length)
125
+ // this.hide_check();
126
+ },
127
+
128
+ error: function(str) {
129
+ //if (!$('#'+this.el+'_message').length)
130
+ //{
131
+ // $('#'+this.el+'_container').append($('<div/>')
132
+ // .attr('id', this.el + '_message')
133
+ // .css('width', $('#'+this.el).outerWidth())
134
+ // );
135
+ //}
136
+ //$('#'+this.el+'_message').hide();
137
+ //$('#'+this.el+'_message').html("<p class='note error'>" + str + "</p>");
138
+ //$('#'+this.el+'_message').slideDown();
139
+ //var this2 = this;
140
+ //setTimeout(function() { $('#'+this2.el+'_message').slideUp(function() { $(this).empty(); }); }, 3000);
141
+ }
142
+
143
+ });
@@ -38,6 +38,19 @@ module Caboose
38
38
  end
39
39
  return arr
40
40
  end
41
-
41
+
42
+ def nav_link(p, css_class = nil, style = nil)
43
+ str = "<a "
44
+ str << "class='#{css_class}' " if css_class
45
+ str << "style='#{style}' " if style
46
+ if p.redirect_url && p.redirect_url.strip.length > 0
47
+ str << "href='#{p.redirect_url}' target='_blank'"
48
+ else
49
+ str << "href='/#{p.uri}'"
50
+ end
51
+ str << ">#{p.title}</a>"
52
+ return str
53
+ end
54
+
42
55
  end
43
56
  end
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.3.96'
2
+ VERSION = '0.3.97'
3
3
  end
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.3.96
4
+ version: 0.3.97
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-05-01 00:00:00.000000000 Z
11
+ date: 2014-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -195,6 +195,7 @@ files:
195
195
  - app/assets/javascripts/caboose/model/attribute.js
196
196
  - app/assets/javascripts/caboose/model/bound_checkbox.js
197
197
  - app/assets/javascripts/caboose/model/bound_checkbox_multiple.js
198
+ - app/assets/javascripts/caboose/model/bound_code.js
198
199
  - app/assets/javascripts/caboose/model/bound_control.js
199
200
  - app/assets/javascripts/caboose/model/bound_file.js
200
201
  - app/assets/javascripts/caboose/model/bound_image.js