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 +8 -8
- data/app/controllers/caboose/blocks_controller.rb +1 -1
- data/app/controllers/caboose/pages_controller.rb +1 -1
- data/app/models/caboose/schema.rb +14 -2
- data/app/views/caboose/blocks/_file.html.erb +11 -4
- data/app/views/caboose/blocks/_image.html.erb +45 -5
- data/app/views/layouts/caboose/application.html.erb +1 -1
- data/lib/caboose/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGI3NmNlNTQ5MDZlZjMzYzdhMzNmNGZkOTdkOGI3ZGIwODhlNjBmYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NWM5ZTM1ZjZmYTM4ZDc0M2UxZjNmOWJkY2MxN2U5ODRhODg5OTJiYg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Nzk4YzUwZTk1MjkwNDA2YTliMzhmNmE3NzE1YzU2ZGNmYTNiZWZhNTU0YmFm
|
10
|
+
Y2I0MzY0OGFlOTE0MTE4ZWNlZjE1MzI3OTE1MzMzNDQwZjE5ZTQxMzVjMDQ0
|
11
|
+
MzczNGQyYTM5NWYzOTY4NDIwNGU3ZWUyYjUzMDQxMTEyNGRkMmY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDFjNWYzOGZiNWQ1YWI5N2Y0MmI5YzQyYjM0ZDhkODJlMzlmNDI5OTcwM2Mz
|
14
|
+
MDAzMmUxMTk0OTdjOWZhOTg1ZjIxNmYwYTNhZDI2ODI5ZGIzYWZlZWMxMTFk
|
15
|
+
OGI5MzJjMTIyZWM1YWNmYjhlNDdhZWI3YWEwOTU4YmMzYzg5ZDU=
|
@@ -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/
|
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 => '
|
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 => '
|
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
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
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
|
-
<%
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
+
%>
|
data/lib/caboose/version.rb
CHANGED