caboose-cms 0.4.18 → 0.4.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTc1OTFkZGQzMGQ3YTAyMGRkNGM2NjgzOGJjMDc4ZDZiOWEyZjE2MA==
4
+ NGI3NmNlNTQ5MDZlZjMzYzdhMzNmNGZkOTdkOGI3ZGIwODhlNjBmYw==
5
5
  data.tar.gz: !binary |-
6
- NWYwYzBmMzhhZTlkMzcxMzdkMGZjNDM5ZjI2MzdhZTUwNDRjZDMyOA==
6
+ NWM5ZTM1ZjZmYTM4ZDc0M2UxZjNmOWJkY2MxN2U5ODRhODg5OTJiYg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NGMxMGFjZjMyNDIwZGE1YWMzNGI3MTNiN2MyOWI2MzkzZTM2MDk4NWEwYWYz
10
- MWUwZGU1ZGRlZDRiYzY4YzZkYWVhMWU4NjkyYzcyYmYwNjE2OTIyZGYyMjhm
11
- MjcyNzQ2NTNjNGM4MTI5OTI1YjIyMDg1ZjM4NDk1OWM1MWNiM2I=
9
+ Nzk4YzUwZTk1MjkwNDA2YTliMzhmNmE3NzE1YzU2ZGNmYTNiZWZhNTU0YmFm
10
+ Y2I0MzY0OGFlOTE0MTE4ZWNlZjE1MzI3OTE1MzMzNDQwZjE5ZTQxMzVjMDQ0
11
+ MzczNGQyYTM5NWYzOTY4NDIwNGU3ZWUyYjUzMDQxMTEyNGRkMmY=
12
12
  data.tar.gz: !binary |-
13
- MjMzODI0Yzc4MTBlODZmMWNkZTNkYTFjODIxNGI5MDc5NjE4MDM0MDUwN2M1
14
- MWIyZWExZGExOTM5NzllMmM2YWMwNGM5Y2I1MDBkMDIwMjk2YWZhZGEyZDA4
15
- YzE4YWIyMjIyOTY0NGU4ZDk4NjdjNGViOWJjNzU4YmEwYTFjZmI=
13
+ NDFjNWYzOGZiNWQ1YWI5N2Y0MmI5YzQyYjM0ZDhkODJlMzlmNDI5OTcwM2Mz
14
+ MDAzMmUxMTk0OTdjOWZhOTg1ZjIxNmYwYTNhZDI2ODI5ZGIzYWZlZWMxMTFk
15
+ OGI5MzJjMTIyZWM1YWNmYjhlNDdhZWI3YWEwOTU4YmMzYzg5ZDU=
@@ -113,7 +113,7 @@ module Caboose
113
113
  :modal => false,
114
114
  :editing => true,
115
115
  :empty_text => params[:empty_text],
116
- :css => '|CABOOSE_CSS|',
116
+ :css => '|CABOOSE_CSS|',
117
117
  :js => '|CABOOSE_JAVASCRIPT|',
118
118
  :csrf_meta_tags => '|CABOOSE_CSRF|'
119
119
  })
@@ -132,7 +132,7 @@ module Caboose
132
132
  return unless user_is_allowed('pages', 'edit')
133
133
  @page = Page.find(params[:id])
134
134
  if @page.block.nil?
135
- redirect_to "/admin/page/#{@page.id}/layout"
135
+ redirect_to "/admin/pages/#{@page.id}/layout"
136
136
  return
137
137
  end
138
138
  @editing = true
@@ -353,10 +353,22 @@ class Caboose::Schema < Caboose::Utilities::Schema
353
353
  bt.save
354
354
  end
355
355
  if !Caboose::BlockType.where(:name => 'image').exists?
356
- Caboose::BlockType.create(:name => 'image', :description => 'Image', :field_type => 'image', :default => '', :width => 800, :height => 400, :fixed_placeholder => false)
356
+ bt = Caboose::BlockType.create(:name => 'image', :description => 'Image', :field_type => 'block')
357
+ Caboose::BlockType.create(:parent_id => bt.id, :name => 'image_src' , :description => 'Image' , :field_type => 'image' , :default => '' , :width => 400, :fixed_placeholder => false)
358
+ Caboose::BlockType.create(:parent_id => bt.id, :name => 'image_style' , :description => 'Style' , :field_type => 'select' , :default => 'Thumb' , :width => 400, :fixed_placeholder => false, :options => "Tiny\nThumb\nLarge")
359
+ Caboose::BlockType.create(:parent_id => bt.id, :name => 'link' , :description => 'Link' , :field_type => 'text' , :default => '' , :width => 400, :fixed_placeholder => false)
360
+ Caboose::BlockType.create(:parent_id => bt.id, :name => 'width' , :description => 'Width' , :field_type => 'text' , :default => '' , :width => 400, :fixed_placeholder => false)
361
+ Caboose::BlockType.create(:parent_id => bt.id, :name => 'height' , :description => 'Height' , :field_type => 'text' , :default => '' , :width => 400, :fixed_placeholder => false)
362
+ Caboose::BlockType.create(:parent_id => bt.id, :name => 'margin_top' , :description => 'Top Margin' , :field_type => 'text' , :default => '10' , :width => 400, :fixed_placeholder => false)
363
+ Caboose::BlockType.create(:parent_id => bt.id, :name => 'margin_right' , :description => 'Right Margin' , :field_type => 'text' , :default => '10' , :width => 400, :fixed_placeholder => false)
364
+ Caboose::BlockType.create(:parent_id => bt.id, :name => 'margin_bottom' , :description => 'Bottom Margin' , :field_type => 'text' , :default => '10' , :width => 400, :fixed_placeholder => false)
365
+ Caboose::BlockType.create(:parent_id => bt.id, :name => 'margin_left' , :description => 'Left Margin' , :field_type => 'text' , :default => '10' , :width => 400, :fixed_placeholder => false)
366
+ Caboose::BlockType.create(:parent_id => bt.id, :name => 'align' , :description => 'Align' , :field_type => 'select' , :default => 'None' , :width => 400, :fixed_placeholder => false, :options => "None\nCenter\nLeft\nRight")
357
367
  end
358
368
  if !Caboose::BlockType.where(:name => 'file').exists?
359
- Caboose::BlockType.create(:name => 'file', :description => 'File', :field_type => 'file', :default => '', :width => 800, :height => 400, :fixed_placeholder => false)
369
+ bt = Caboose::BlockType.create(:name => 'file', :description => 'File', :field_type => 'block')
370
+ Caboose::BlockType.create(:parent_id => bt.id, :name => 'file' , :description => 'File' , :field_type => 'file', :default => '' , :width => 400, :fixed_placeholder => false)
371
+ Caboose::BlockType.create(:parent_id => bt.id, :name => 'text' , :description => 'Text' , :field_type => 'text', :default => 'Download' , :width => 400, :fixed_placeholder => false)
360
372
  end
361
373
 
362
374
  end
@@ -1,4 +1,11 @@
1
- <div id='block_<%= block.id %>'>
2
- <% if block.file %><a href="<%= block.file.url %>">Download</a>
3
- <% elsif editing %><p>Upload a file.</p>
4
- <% end %>
1
+ <%
2
+ file = block.child('file')
3
+ text = block.child('text').value
4
+
5
+ if editing && file && file.file && file.file.url.include?('missing.png')
6
+ %><div id='block_<%= block.id %>'><p>Please upload a file.</p></div><%
7
+ elsif file && file.file
8
+ %><p><a href="<%= raw file.file.url %>"><%= raw text %></p><%
9
+ end
10
+
11
+ %>
@@ -1,5 +1,45 @@
1
- <% if block.image %>
2
- <img src="<%= block.image.url(:large) %>" id='block_<%= block.id %>' />
3
- <% elsif editing %>
4
- <div id='block_<%= block.id %>'><p>Upload an image.</p></div>
5
- <% end %>
1
+ <%
2
+ img = block.child('image_src')
3
+ img_style = block.child('image_style').value.to_sym
4
+ link = block.child('link').value
5
+ align = block.child('align').value
6
+ width = block.child('width').value
7
+ height = block.child('height').value
8
+ margin_top = block.child('margin_top').value
9
+ margin_right = block.child('margin_right').value
10
+ margin_bottom = block.child('margin_bottom').value
11
+ margin_left = block.child('margin_left').value
12
+ url = img && img.image ? img.image.url(img_style.downcase.to_sym) : nil
13
+
14
+ img = nil
15
+ if url && !url.include?('missing.png')
16
+ style = []
17
+ style << "width: #{width}px" if width
18
+ style << "max-height: #{height}px" if height
19
+ style << "float: left" if align == 'Left'
20
+ style << "float: right" if align == 'Right'
21
+ style << "margin: 0 auto" if align == 'Center'
22
+ style << "display: block" if align == 'Center'
23
+ style << "margin-top: #{margin_top}px" if margin_top
24
+ style << "margin-right: #{margin_right}px" if margin_right
25
+ style << "margin-bottom: #{margin_bottom}px" if margin_bottom
26
+ style << "margin-left: #{margin_left}px" if margin_left
27
+ style = style.join('; ')
28
+
29
+ img = "<img src='#{url}' style='#{style}' id='block_#{block.id}' />"
30
+ if link && link.strip.length > 0
31
+ if editing
32
+ img = "<a href='#'>#{img}</a>"
33
+ else
34
+ img = "<a href='#{link}'>#{img}</a>"
35
+ end
36
+ end
37
+ end
38
+
39
+ if editing && img.nil?
40
+ %><p id='block_<%= block.id %>'>Please upload an image.</p><%
41
+ else
42
+ %><%= raw img %><%
43
+ end
44
+
45
+ %>
@@ -14,7 +14,7 @@
14
14
  <%= yield :caboose_css %>
15
15
  <% end %>
16
16
  <%
17
- b = @page.block
17
+ b = @page.block
18
18
  str = b.render(b, {
19
19
  :view => self,
20
20
  :controller_view_content => yield,
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.4.18'
2
+ VERSION = '0.4.19'
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.18
4
+ version: 0.4.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry