caboose-cms 0.4.68 → 0.4.69

Sign up to get free protection for your applications and to get access to all the features.
@@ -84,6 +84,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
84
84
  [ :parent_id , :integer ],
85
85
  [ :name , :string ],
86
86
  [ :description , :string ],
87
+ [ :icon , :string ],
87
88
  [ :is_global , :boolean , { :default => false }],
88
89
  [ :block_type_category_id , :integer , { :default => 2 }],
89
90
  [ :render_function , :text ],
@@ -46,6 +46,13 @@ bt = @block_type
46
46
  <p>This type of page block doesn't have any fields.</p>
47
47
  <% end %>
48
48
 
49
+ <h2>Icon</h2>
50
+ <div class='icons'>
51
+ <% Caboose::BlockTypeIcons.names.each do |icon| %>
52
+ <a href='#' id='icon_<%= icon %>' <% if bt.icon == icon %>class='selected'<% end %>><span class='icon-<%= icon %>'></span></a>
53
+ <% end %>
54
+ </div>
55
+
49
56
  <div id='message'></div>
50
57
  <p>
51
58
  <input type='button' value='< Back' onclick="window.location='/admin/block-types<%= bt.parent_id && bt.parent_id > 0 ? "/#{bt.parent_id}/edit" : '' %>';" />
@@ -53,9 +60,16 @@ bt = @block_type
53
60
  </p>
54
61
 
55
62
  <% content_for :caboose_css do %>
63
+ <%= stylesheet_link_tag 'caboose/icomoon_fonts' %>
56
64
  <style type='text/css'>
57
65
  #blocktype_<%= bt.id %>_render_function { font-family: Courier; font-size: 80%; width: 100%; }
58
66
  #blocktype_<%= bt.id %>_options_function { font-family: Courier; font-size: 80%; width: 100%; }
67
+ div.icons { height: 400px; width: 80%; overflow-y: scroll; }
68
+ div.icons span { display: block; float: left; padding: 10px 20px; font-size: 24pt; }
69
+ div.icons a span { color: #000; border: #fff 1px solid; }
70
+ div.icons a:hover span { background: #efefef; color: #000; border: #666 1px solid; }
71
+ div.icons a.selected span,
72
+ div.icons a.selected:hover span { background: #fff69f; color: #000; border: #ff0000 1px solid; }
59
73
  </style>
60
74
  <% end %>
61
75
  <% content_for :caboose_js do %>
@@ -84,7 +98,25 @@ function delete_block_type(block_type_id, confirm)
84
98
  });
85
99
  }
86
100
 
101
+ function select_icon(icon)
102
+ {
103
+ $.ajax({
104
+ url: '/admin/block-types/<%= @block_type.id %>',
105
+ type: 'put',
106
+ data: { icon: icon },
107
+ success: function(resp) {
108
+ $('div.icons a.selected').removeClass('selected');
109
+ $('#icon_' + icon).addClass('selected');
110
+ }
111
+ });
112
+ }
113
+
87
114
  $(document).ready(function() {
115
+ $('div.icons a').click(function(e) {
116
+ e.preventDefault();
117
+ select_icon($(this).attr('id').substr(5));
118
+ });
119
+
88
120
  m = new ModelBinder({
89
121
  name: 'BlockType',
90
122
  id: <%= @block_type.id %>,
@@ -12,12 +12,29 @@ end
12
12
  b = @block
13
13
 
14
14
  %>
15
+ <!--
15
16
  <h2 style='margin-top: 0; padding-top: 0;'><%= raw crumbs.reverse.join(' > ') %></h2>
16
17
  <h1>New Block</h1>
17
- <form action='/admin/pages/<%= b.page_id %>/blocks/<%= b.id %>' method='post' id='new_block_form' onsubmit="add_child_block(); return false;">
18
+ -->
19
+ <form action='/admin/pages/<%= b.page_id %>/blocks/<%= b.id %>' method='post' id='new_block_form' onsubmit="return false;">
18
20
  <input type='hidden' name='authenticity_token' value='<%= form_authenticity_token %>' />
21
+ <input type='hidden' name='block_type_id' id='block_type_id' value='' />
19
22
  <% if @before_id %><input type='hidden' name='before_id' value='<%= @before_id %>' /><% end %>
20
23
  <% if @after_id %><input type='hidden' name='after_id' value='<%= @after_id %>' /><% end %>
24
+ <div class='icons'>
25
+ <% Caboose::BlockTypeCategory.reorder(:name).all.each do |cat| %>
26
+ <% next if cat.parent_id.nil? && cat.name == 'Layouts' %>
27
+ <h2 onclick="$('#cat<%= cat.id %>_container').slideToggle();"><%= cat.name %></h3>
28
+ <div id='cat<%= cat.id %>_container'>
29
+ <% cat.block_types.where("parent_id is null").reorder(:name).all.each do |bt| %>
30
+ <a href='#' onclick="add_child_block(<%= bt.id %>);"><span class='icon icon-<%= bt.icon %>'></span><span class='name'><%= bt.description %></span></a>
31
+ <% end %>
32
+ </div>
33
+ <% end %>
34
+ </div>
35
+ </form>
36
+
37
+ <!--
21
38
  <p><select name='block_type_id'>
22
39
  <option value=''>-- Select a block type --</option>
23
40
  <% Caboose::BlockType.where("parent_id is null").reorder(:name).all.each do |bt| %>
@@ -29,22 +46,37 @@ b = @block
29
46
  <input type='submit' value='Add Block' />
30
47
  <input type='button' value='Cancel' onclick="modal.close();" />
31
48
  </p>
49
+ -->
32
50
 
51
+ <% content_for :caboose_css do %>
52
+ <%= stylesheet_link_tag 'caboose/icomoon_fonts' %>
53
+ <style>
54
+ #modal_content div.icons { height: 400px; overflow-y: scroll; }
55
+ #modal_content div.icons h2 { clear: both; padding: 20px 0px 10px 0; text-align: center; }
56
+ #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; }
57
+ #modal_content div.icons a span.icon { display: block; padding: 10px 20px; font-size: 24pt; color: #fff; }
58
+ #modal_content div.icons a span.name { display: block; }
59
+ #modal_content div.icons a:hover { background: #fff69f; color: #000; border: #666 0px solid; border: #666 4px solid; }
60
+ #modal_content div.icons a:hover span.icon { color: #000; }
61
+ #modal_content div.icons a:hover span.name { color: #000; }
62
+ </style>
63
+ <% end %>
33
64
  <% content_for :caboose_js do %>
34
65
  <script type='text/javascript'>
35
66
 
36
67
  var modal = false;
37
68
  $(window).load(function() {
38
- modal = new CabooseModal(800);
39
- });
69
+ modal = new CabooseModal(550);
70
+ });
40
71
 
41
72
  $(document).ready(function() {
42
- modal = new CabooseModal(800);
73
+ modal = new CabooseModal(550);
43
74
  });
44
75
 
45
- function add_child_block()
76
+ function add_child_block(block_type_id)
46
77
  {
47
78
  modal.autosize("<p class='loading'>Adding block...</p>");
79
+ $('#block_type_id').val(block_type_id);
48
80
  $.ajax({
49
81
  url: '/admin/pages/<%= b.page_id %>/blocks/<%= b.id %>',
50
82
  type: 'post',
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.4.68'
2
+ VERSION = '0.4.69'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.68
4
+ version: 0.4.69
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
@@ -174,6 +174,10 @@ extra_rdoc_files: []
174
174
  files:
175
175
  - app/assets/fonts/avenir-medium.eot
176
176
  - app/assets/fonts/avenir-medium.ttf
177
+ - app/assets/fonts/icomoon.eot
178
+ - app/assets/fonts/icomoon.svg
179
+ - app/assets/fonts/icomoon.ttf
180
+ - app/assets/fonts/icomoon.woff
177
181
  - app/assets/images/caboose/caboose_logo.png
178
182
  - app/assets/images/caboose/caboose_logo_small.png
179
183
  - app/assets/images/caboose/caboose_nav.png
@@ -236,6 +240,8 @@ files:
236
240
  - app/assets/stylesheets/caboose/fonts/big_noodle_titling.ttf
237
241
  - app/assets/stylesheets/caboose/fonts/big_noodle_titling_oblique.ttf
238
242
  - app/assets/stylesheets/caboose/fonts.css
243
+ - app/assets/stylesheets/caboose/icomoon_fonts.css
244
+ - app/assets/stylesheets/caboose/icons.txt
239
245
  - app/assets/stylesheets/caboose/login.css
240
246
  - app/assets/stylesheets/caboose/modal.css
241
247
  - app/assets/stylesheets/caboose/model_binder.css
@@ -286,6 +292,7 @@ files:
286
292
  - app/models/caboose/block.rb
287
293
  - app/models/caboose/block_type.rb
288
294
  - app/models/caboose/block_type_category.rb
295
+ - app/models/caboose/block_type_icons.rb
289
296
  - app/models/caboose/block_type_source.rb
290
297
  - app/models/caboose/block_type_summary.rb
291
298
  - app/models/caboose/caboose_plugin.rb