caboose-cms 0.8.43 → 0.8.44

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/caboose/admin_page_edit_content.js +83 -70
  3. data/app/assets/javascripts/caboose/card.js +2432 -0
  4. data/app/assets/javascripts/caboose/clipboard.js +7 -0
  5. data/app/assets/javascripts/caboose/modal_controllers/modal_block_controller.js +174 -252
  6. data/app/assets/javascripts/caboose/modal_controllers/modal_controller.js +160 -12
  7. data/app/assets/javascripts/caboose/modal_controllers/modal_media_controller.js +419 -0
  8. data/app/assets/javascripts/caboose/modal_integration.js +21 -1
  9. data/app/assets/javascripts/caboose/model/bound_checkbox.js +13 -6
  10. data/app/assets/javascripts/caboose/model/bound_select.js +16 -7
  11. data/app/assets/javascripts/caboose/model/bound_text.js +15 -2
  12. data/app/assets/stylesheets/caboose/admin_block_edit_image.css.scss +16 -1
  13. data/app/assets/stylesheets/caboose/admin_new_block.css +9 -0
  14. data/app/assets/stylesheets/caboose/application.css +2 -1
  15. data/app/assets/stylesheets/caboose/modal_inline.css +8 -15
  16. data/app/assets/stylesheets/caboose/my_account.scss +178 -0
  17. data/app/controllers/caboose/block_types_controller.rb +20 -0
  18. data/app/controllers/caboose/blocks_controller.rb +70 -8
  19. data/app/controllers/caboose/media_controller.rb +39 -3
  20. data/app/models/caboose/block.rb +17 -1
  21. data/app/models/caboose/media.rb +9 -8
  22. data/app/models/caboose/schema.rb +1 -0
  23. data/app/views/caboose/block_types/admin_edit.html.erb +5 -2
  24. data/app/views/caboose/block_types/admin_index.html.erb +2 -1
  25. data/app/views/caboose/my_account/index.html.erb +124 -63
  26. data/app/views/caboose/my_account/index_old.html.erb +191 -0
  27. data/app/views/caboose/pages/admin_edit_content.html.erb +16 -1
  28. data/lib/caboose/version.rb +1 -1
  29. metadata +8 -3
  30. data/app/assets/stylesheets/caboose/my_account.css +0 -2
@@ -45,9 +45,29 @@ $(document).ready(function() {
45
45
  //caboose_modal('caboose_login');
46
46
  //caboose_modal('caboose_register');
47
47
  //caboose_modal('caboose_station');
48
- $('a.caboose_modal').each(function(i, a) { caboose_modal($(a)); });
48
+ $('a.caboose_modal').each(function(i, a) { caboose_modal_iframe($(a)); });
49
49
  });
50
50
 
51
+ function caboose_modal_iframe(el)
52
+ {
53
+ var options = {
54
+ iframe: true,
55
+ initialWidth: 400,
56
+ initialHeight: 200,
57
+ innerWidth: 400,
58
+ innerHeight: 200,
59
+ scrolling: false,
60
+ transition: 'fade',
61
+ closeButton: false,
62
+ onComplete: caboose_fix_colorbox,
63
+ opacity: 0.50
64
+ };
65
+ if (typeof(el) == 'string')
66
+ $('#'+el).colorbox(options);
67
+ else
68
+ el.colorbox(options);
69
+ }
70
+
51
71
  function caboose_modal(el)
52
72
  {
53
73
  var options = {
@@ -26,11 +26,11 @@ BoundCheckbox = BoundControl.extend({
26
26
  );
27
27
  $('#'+this.el+'_container').empty();
28
28
  if (this.attribute.fixed_placeholder)
29
- {
29
+ {
30
30
  $('#'+this.el+'_container').append($('<div/>')
31
31
  .attr('id', this.placeholder)
32
32
  .addClass('mb_placeholder')
33
- .append($('<span/>').html(this.attribute.nice_name + ': '))
33
+ .append($('<span/>').html(this.attribute.nice_name + (this.attribute.nice_name[this.attribute.nice_name.length-1] == '?' ? '' : ':') + ' '))
34
34
  );
35
35
  }
36
36
  var cb = $('<input/>')
@@ -48,10 +48,8 @@ BoundCheckbox = BoundControl.extend({
48
48
  $('#'+this.el).css('left', Math.floor($('#'+this.el+'_container').outerWidth()/2))
49
49
  else // left
50
50
  {
51
- //alert(this.placeholder);
52
- //alert($('#'+this.placeholder).html());
53
- //alert($('#'+this.placeholder).outerWidth());
54
- $('#'+this.el).css('left', $('#'+this.placeholder).outerWidth(true) + 10);
51
+ this.set_placeholder_padding();
52
+ //$('#'+this.el).css('left', $('#'+this.placeholder).outerWidth(true) + 10);
55
53
  }
56
54
 
57
55
  $('#'+this.el+'_container').append($('<input/>')
@@ -65,6 +63,15 @@ BoundCheckbox = BoundControl.extend({
65
63
  $('#'+this.el+'_background').css('width' , this.attribute.width);
66
64
  },
67
65
 
66
+ set_placeholder_padding: function() {
67
+ var that = this;
68
+ var w = $('#'+that.placeholder).outerWidth(true);
69
+ if (w > 0)
70
+ $('#'+that.el).css('left', w + 10);
71
+ else
72
+ setTimeout(function() { that.set_placeholder_padding(); }, 200);
73
+ },
74
+
68
75
  view: function() {
69
76
 
70
77
  },
@@ -10,11 +10,10 @@ BoundSelect = BoundControl.extend({
10
10
  placeholder: false,
11
11
 
12
12
  init: function(params) {
13
- //console.log('control.model.id = ' + this.model.id);
13
+ var that = this;
14
14
  for (var thing in params)
15
15
  this[thing] = params[thing];
16
- //console.log('control.model.id = ' + this.model.id);
17
-
16
+
18
17
  this.el = this.el ? this.el : this.model.name.toLowerCase() + '_' + this.model.id + '_' + this.attribute.name;
19
18
  this.message = this.el + '_message';
20
19
  this.placeholder = this.el + '_placeholder';
@@ -48,10 +47,11 @@ BoundSelect = BoundControl.extend({
48
47
 
49
48
  if (this.attribute.fixed_placeholder)
50
49
  {
51
- var w = $('#'+this.placeholder).outerWidth();
52
- $('#'+this.el)
53
- .css('padding-left', '+=' + w)
54
- .css('width', '-=' + w);
50
+ that.set_placeholder_padding();
51
+ //setTimeout(function() {
52
+ // var w = $('#'+that.placeholder).outerWidth(true);
53
+ // $('#'+that.el).css('padding-left', '+=' + w);//.css('width', '-=' + w);
54
+ // }, 200);
55
55
  }
56
56
 
57
57
  //this.update_options();
@@ -136,6 +136,15 @@ BoundSelect = BoundControl.extend({
136
136
  $('#'+this2.el+'_select').css('width', $('#'+this2.el).outerWidth());
137
137
  });
138
138
  },
139
+
140
+ set_placeholder_padding: function() {
141
+ var that = this;
142
+ var w = $('#'+that.placeholder).outerWidth(true);
143
+ if (w > 0)
144
+ $('#'+that.el).css('padding-left', '+=' + w);
145
+ else
146
+ setTimeout(function() { that.set_placeholder_padding(); }, 200);
147
+ },
139
148
 
140
149
  //update_options: function() {
141
150
  // var that = this;
@@ -10,6 +10,7 @@ BoundText = BoundControl.extend({
10
10
  save_attempts: 0,
11
11
 
12
12
  init: function(params) {
13
+ var that = this;
13
14
  for (var thing in params)
14
15
  this[thing] = params[thing];
15
16
 
@@ -35,8 +36,11 @@ BoundText = BoundControl.extend({
35
36
  if (this.attribute.width) $('#'+this.el).css('width' , this.attribute.width);
36
37
  if (this.attribute.fixed_placeholder && this.attribute.align != 'right')
37
38
  {
38
- var w = $('#'+this.el+'_placeholder').outerWidth();
39
- $('#'+this.el).attr('placeholder', 'empty').css('padding-left', '+=' + w).css('width', '-=' + w);
39
+ that.set_placeholder_padding();
40
+ //setTimeout(function() {
41
+ // var w = $('#'+that.el+'_placeholder').outerWidth();
42
+ // $('#'+that.el).attr('placeholder', 'empty').css('padding-left', '+=' + w);//.css('width', '-=' + w);
43
+ // }, 200);
40
44
  }
41
45
 
42
46
  var this2 = this;
@@ -58,6 +62,15 @@ BoundText = BoundControl.extend({
58
62
  });
59
63
  },
60
64
 
65
+ set_placeholder_padding: function() {
66
+ var that = this;
67
+ var w = $('#'+that.el+'_placeholder').outerWidth();
68
+ if (w > 0)
69
+ $('#'+that.el).css('padding-left', '+=' + w);
70
+ else
71
+ setTimeout(function() { that.set_placeholder_padding(); }, 200);
72
+ },
73
+
61
74
  save: function() {
62
75
  this.attribute.value = $('#'+this.el).val();
63
76
  if (this.attribute.value == this.attribute.value_clean)
@@ -1,4 +1,10 @@
1
1
 
2
+ #detail_image {
3
+ float: right;
4
+ margin: 0;
5
+ width: 370px;
6
+ }
7
+
2
8
  #left_content {
3
9
  width: 200px;
4
10
  float: left;
@@ -36,7 +42,7 @@
36
42
  }
37
43
 
38
44
  &.selected {
39
- a {
45
+ & > a {
40
46
  font-weight: bold;
41
47
  background-color: #90dbf9;
42
48
  }
@@ -149,3 +155,12 @@
149
155
  }
150
156
  }
151
157
  }
158
+
159
+ #the_modal div.icons { height: 400px; overflow-y: scroll; }
160
+ #the_modal div.icons h2 { clear: both; padding: 20px 0px 10px 0; text-align: center; }
161
+ #the_modal div.icons a { display: block; float: left; margin: 4px; border: #fff 0px solid; width: 120px; height: 100px; text-align: center; vertical-align: middle; border: #666 4px solid; }
162
+ #the_modal div.icons a span.icon { display: block; padding: 10px 20px; font-size: 24pt; color: #fff; }
163
+ #the_modal div.icons a span.name { display: block; }
164
+ #the_modal div.icons a:hover { background: #fff69f; color: #000; border: #666 0px solid; border: #666 4px solid; }
165
+ #the_modal div.icons a:hover span.icon { color: #000; }
166
+ #the_modal div.icons a:hover span.name { color: #000; }
@@ -0,0 +1,9 @@
1
+
2
+ #modal_content div.icons { height: 400px; overflow-y: scroll; }
3
+ #modal_content div.icons h2 { clear: both; padding: 20px 0px 10px 0; text-align: center; }
4
+ #modal_content div.icons a { display: block; float: left; margin: 4px; border: #fff 0px solid; width: 120px; height: 100px; text-align: center; vertical-align: middle; border: #666 4px solid; }
5
+ #modal_content div.icons a span.icon { display: block; padding: 10px 20px; font-size: 24pt; color: #fff; }
6
+ #modal_content div.icons a span.name { display: block; }
7
+ #modal_content div.icons a:hover { background: #fff69f; color: #000; border: #666 0px solid; border: #666 4px solid; }
8
+ #modal_content div.icons a:hover span.icon { color: #000; }
9
+ #modal_content div.icons a:hover span.name { color: #000; }
@@ -25,4 +25,5 @@
25
25
  #cboxMiddleRight,
26
26
  #cboxTopCenter,
27
27
  #cboxBottomCenter,
28
- #cboxClose { background: #111 !important; }
28
+ #cboxClose { background: #111; }
29
+ #cboxWrapper { border-radius: 7px !important; }
@@ -1,17 +1,10 @@
1
1
 
2
- #the_modal {
3
- box-sizing: content-box; /* border-box */
4
- }
5
-
6
- #modal_content p { margin-bottom: 10px; }
7
-
8
- #modal_content .mb_container input { border: #ccc 1px solid; }
9
-
10
- #modal_content div.mb_container div.mb_placeholder { top: 9px; }
11
- #modal_content div.mb_container div.mb_placeholder span { font-size: 16px; }
12
-
13
- #modal_content div.mb_container select { border: #ccc 1px solid; height: 36px; }
14
- #modal_content div.mb_container select option { font-size: 16px; }
15
-
16
- #modal_content div.mb_container input[type=checkbox] { top: 12px; }
2
+ #the_modal { box-sizing: border-box; }
3
+ #the_modal p { margin-bottom: 10px; }
4
+ #the_modal .mb_container input { border: #ccc 1px solid; }
5
+ #the_modal div.mb_container div.mb_placeholder { top: 9px; }
6
+ #the_modal div.mb_container div.mb_placeholder span { font-size: 16px; }
7
+ #the_modal div.mb_container select { border: #ccc 1px solid; height: 36px; }
8
+ #the_modal div.mb_container select option { font-size: 16px; }
9
+ #the_modal div.mb_container input[type=checkbox] { top: 12px; }
17
10
 
@@ -0,0 +1,178 @@
1
+ @import url('https://fonts.googleapis.com/css?family=Open+Sans');
2
+
3
+ $font-card: normal 1em "Open Sans", sans-serif;
4
+ $color-main: #5f5f5f;
5
+ $color-light: #ececec;
6
+
7
+ @mixin small() { @media all and (max-width: 800px) { @content }}
8
+ @mixin big() { @media all and (min-width: 800px) { @content }}
9
+
10
+ #caboose-my-account {
11
+ padding: 30px 2% 50px 2%;
12
+ & > h2 {
13
+ text-align: center;
14
+ font-size: 1.5em;
15
+ margin-bottom: 30px;
16
+ color: #3c3c3c;
17
+ }
18
+ & > .grid-row {
19
+ max-width: 900px;
20
+ margin: 0 auto;
21
+ .unit1of2 {
22
+ @include big {
23
+ width: 49%;
24
+ }
25
+ &.right {
26
+ @include big {
27
+ float: right;
28
+ }
29
+ }
30
+ }
31
+ #card-wrapper {
32
+ height: 200px;
33
+ }
34
+ #stripe_form {
35
+ display: none;
36
+ }
37
+ .card-form-wrapper {
38
+ background: $color-light;
39
+ border-radius: 12px;
40
+ padding: 12px 4% 24px 4%;
41
+ border: 1px solid $color-main;
42
+ max-width: 400px;
43
+ margin: 0 auto;
44
+ text-align: center;
45
+ font: $font-card;
46
+ .title {
47
+ font-size: 1.1em;
48
+ text-align: center;
49
+ margin-bottom: 17px;
50
+ color: #3c3c3c;
51
+ }
52
+ #card_details {
53
+ .edit-card {
54
+ color: #4c94ff;
55
+ text-decoration: none;
56
+ margin-left: 4px;
57
+ &:hover {
58
+ color: #c24cff;
59
+ }
60
+ }
61
+ }
62
+ .jp-card .jp-card-front .jp-card-lower .jp-card-number {
63
+ font-size: 22px;
64
+ }
65
+ .jp-card .jp-card-front .jp-card-lower .jp-card-name {
66
+ font-size: 16px;
67
+ }
68
+ .jp-card .jp-card-front .jp-card-lower {
69
+ left: 8%;
70
+ width: 84%;
71
+ }
72
+ &.address {
73
+ @include small {
74
+ margin-bottom: 40px;
75
+ }
76
+ .title {
77
+ margin-bottom: 20px;
78
+ }
79
+ .input-holder {
80
+ margin-bottom: 10px;
81
+ input {
82
+ &.mb_dirty {
83
+ background: #fff799 !important
84
+ }
85
+ }
86
+ .mb_bound_input_check {
87
+ a {
88
+ color: #fff;
89
+ background: #6fb96f;
90
+ font-size: 21px;
91
+ text-decoration: none;
92
+ }
93
+ }
94
+ .mb_placeholder {
95
+ top: 7px;
96
+ left: 7px;
97
+ span {
98
+ font-size: 16px;
99
+ }
100
+ }
101
+ }
102
+ }
103
+ .buttons {
104
+ margin-top: 20px;
105
+ .btn {
106
+ font-size: 15px;
107
+ margin-right: 5px;
108
+ margin-bottom: 5px;
109
+ &:last-of-type {
110
+ margin-right: 0;
111
+ }
112
+ }
113
+ }
114
+ }
115
+ form {
116
+ width: 90%;
117
+ margin: 0 auto;
118
+ text-align: left;
119
+ .row {
120
+ margin-bottom: 10px;
121
+ }
122
+ .field {
123
+ &.col-2 {
124
+ width: 50%;
125
+ float: left;
126
+ &:first-of-type {
127
+ padding-right: 1.5%;
128
+ }
129
+ &:last-of-type {
130
+ padding-left: 1.5%;
131
+ }
132
+ }
133
+ &.col-3 {
134
+ width: 33.33333%;
135
+ float: left;
136
+ &:nth-of-type(1) { padding-right: 1.5%; }
137
+ &:nth-of-type(2) { padding-right: 0.75%; padding-left: 0.75%; }
138
+ &:nth-of-type(3) { padding-left: 1.5%; }
139
+ }
140
+ }
141
+ .payment_controls {
142
+ text-align: right;
143
+ margin-top: 10px;
144
+ .btn {
145
+ font-size: 15px;
146
+ &.disabled {
147
+ cursor: default;
148
+ background: gray;
149
+ }
150
+ }
151
+ }
152
+ }
153
+ label {
154
+ display: block;
155
+ font-size: 12px;
156
+ margin-bottom: 2px;
157
+ }
158
+ input {
159
+ background-color: #fff !important;
160
+ display: block;
161
+ width: 100% !important;
162
+ font: $font-card;
163
+ line-height: 1em;
164
+ padding: 6px 6px 6px 6px;
165
+ border: 1px solid #dadada;
166
+ border-radius: 3px;
167
+ color: #2d2d2d;
168
+ &.placeholder_js {
169
+ color: #adadad;
170
+ }
171
+ }
172
+ }
173
+ .reset-password {
174
+ .btn.alternate {
175
+ margin-top: 10px;
176
+ }
177
+ }
178
+ }
@@ -113,6 +113,7 @@ module Caboose
113
113
  when 'render_function' then bt.render_function = v
114
114
  when 'use_render_function' then bt.use_render_function = v
115
115
  when 'use_render_function_for_layout' then bt.use_render_function_for_layout = v
116
+ when 'use_js_for_modal' then bt.use_js_for_modal = v
116
117
  when 'allow_child_blocks' then bt.allow_child_blocks = v
117
118
  when 'default_child_block_type_id' then bt.default_child_block_type_id = v
118
119
  when 'name' then bt.name = v
@@ -150,6 +151,25 @@ module Caboose
150
151
  end
151
152
 
152
153
  # @route_priority 1
154
+ # @route GET /admin/block-types/new-options
155
+ def admin_options_for_new_block
156
+ return unless user_is_allowed('blocktypes', 'edit')
157
+ #cats = BlockTypeCategory.where("parent_id is not null and name != ?", 'Layouts').all.collect{ |cat| {
158
+ # :block_type_category => cat,
159
+ # :block_types => Caboose::BlockType.includes(:block_type_site_memberships).where(:parent_id => nil, :block_type_category_id => cat.id).where("block_type_site_memberships.site_id = ?", @site.id).reorder(:description).all
160
+ #}}
161
+
162
+ cats = BlockTypeCategory.where("name != ?", 'Layouts').all.collect{ |cat| {
163
+ :block_type_category => cat,
164
+ :block_types => Caboose::BlockType.includes(:block_type_site_memberships)
165
+ .where(:parent_id => nil, :block_type_category_id => cat.id)
166
+ .where("block_type_site_memberships.site_id = ?", @site.id)
167
+ .reorder(:description).all
168
+ }}
169
+ render :json => cats
170
+ end
171
+
172
+ # @route_priority 2
153
173
  # @route GET /admin/block-types/:field-options
154
174
  # @route GET /admin/block-types/options
155
175
  # @route GET /admin/block-types/:id/options