honey-cms 0.3.5 → 0.3.7

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.
@@ -127,10 +127,10 @@ module CMS::FormBuilder::Fields
127
127
  end
128
128
 
129
129
  def actions options = {}
130
- options.reverse_merge! save: 'Save', saving: 'Saving...', class: 'form-actions'
130
+ options.reverse_merge! save: 'Save', saving: 'Saving...', class: 'form-actions', save_class: 'btn btn-primary'
131
131
  @template.content_tag(:div, class: options.delete(:class)) do
132
132
  actions = ''.html_safe
133
- actions << submit(options[:save], disable_with: options[:saving], class: 'btn btn-primary')
133
+ actions << submit(options[:save], disable_with: options[:saving], class: options[:save_class])
134
134
  actions << status
135
135
  end
136
136
  end
data/lib/cms/helper.rb CHANGED
@@ -8,26 +8,26 @@ module CMS::Helper
8
8
  def cms_file name, size = false
9
9
  if file = CMS::FileUpload.find_by_name(name) then return file end
10
10
  opts = {name: name}
11
- opts[:description] = (size.sub('x', ' by ') << ' pixels')
11
+ opts[:description] = (size.sub('x', ' by ') << ' pixels') if size
12
12
  CMS::FileUpload.create(opts, without_protection: true)
13
13
  end
14
14
 
15
15
  def cms_image name, size = false, width = '', height = ''
16
16
  width, height = size.split('x') if size
17
17
  image = cms_file(name, size)
18
+ style = if size then "width: #{width}px ; height: #{height}px" else '' end
18
19
 
19
20
  if image.file?
20
- image_tag image.file.url, class: 'cms-image', style: "width: #{width}px ; height: #{height}px"
21
+ image_tag image.file.url, class: 'cms-image', style: style
21
22
  else
22
23
  if current_user && current_user.role.admin?
23
- link_to(name, edit_cms_file_upload_path(image), class: 'cms-image missing-cms-image', style: "width: #{width}px ; height: #{height}px ")
24
+ link_to(name, edit_cms_file_upload_path(image), class: 'cms-image missing-cms-image', style: style)
24
25
  else
25
- content_tag :div, name, class: 'cms-image missing-cms-image', style: "width: #{width}px ; height: #{height}px"
26
+ content_tag :div, name, class: 'cms-image missing-cms-image', style: style
26
27
  end
27
28
  end
28
29
  end
29
30
 
30
-
31
31
  def cms_page_area name, options = {}, &block
32
32
  page_area = if area = CMS::PageArea.find_by_name(name) then area else CMS::PageArea.new({name: name}, without_protection: true) end
33
33
  options[:editable] = true unless options.key?(:editable)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honey-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: