camaleon_cms 2.3.2 → 2.3.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of camaleon_cms might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d51b06dd32523afc6df26dd4f850c2e59ba5268
4
- data.tar.gz: f7b50b72480f46d50346df72feb0ab7535b446f1
3
+ metadata.gz: b4b0b30448fb0ace3c0211759a1cfa907b13e1be
4
+ data.tar.gz: 3405faac8eb44d08804b38be753f3f171906c707
5
5
  SHA512:
6
- metadata.gz: 79573f285bc475bc3a0dd5953b0d61e6043dc0be42fc14895288fb7093750d6f372e947b46d5146e8c9874589a1e7b95059ff08af033771e3e37b09182473374
7
- data.tar.gz: c4a6de358614a79403d692496289dfdd80a3e14af27f04e03fed0cca6cb3dcc3a1db218798b6bcc8261468af06e0d0f1be76a076c744dc0c8f354f9d809f95c7
6
+ metadata.gz: 19575dfc1efe6398d203e9d69fe65b93bd5a189497396664e78d7f775ae1160651ba9c4de4a7a4d5d3b7b6ae4935c8654c9626656bd9457dd06bc45371e0ea8d
7
+ data.tar.gz: b58471054de0c1357569b8797279ec499cd873af0fd421d13b0e940f92f26ac6110285dcd3b497da2bc37d7e1d06298d57b1a4a50fd54e3d50d987b780b9e2d0
data/README.md CHANGED
@@ -28,7 +28,7 @@
28
28
  * Add the gem in your Gemfile
29
29
 
30
30
  ```
31
- gem "camaleon_cms", '>=2.3.2' # Stable versions 2.2.1, 2.1.1, 2.1.0
31
+ gem "camaleon_cms", '>=2.3.3' # Stable versions 2.2.1, 2.1.1, 2.1.0
32
32
  # gem "camaleon_cms", github: 'owen2345/camaleon-cms' # current development version
33
33
  ```
34
34
  * Only Rails 5 support
@@ -6,7 +6,8 @@ window["cama_init_media"] = (media_panel) ->
6
6
  ################ visualize item
7
7
  show_file = (item) ->
8
8
  item.addClass('selected').siblings().removeClass('selected')
9
- data = eval("("+item.find(".data_value").val()+")")
9
+ data = item.data('eval-data') || eval("("+item.find(".data_value").val()+")")
10
+ item.data('eval-data', data)
10
11
  media_info_tab_info.click()
11
12
  tpl =
12
13
  "<div class='p_thumb'></div>" +
@@ -25,22 +26,33 @@ window["cama_init_media"] = (media_panel) ->
25
26
  media_info.html(tpl)
26
27
  media_info.find(".p_thumb").html(item.find(".thumb").html())
27
28
  if data["format"] == "image"
28
- ww = parseInt(data['dimension'].split("x")[0])
29
- hh = parseInt(data['dimension'].split("x")[1])
30
- media_info.find(".p_body").append("<div class='cdimension'><b>"+I18n("button.dimension")+": </b><span>"+ww+"x"+hh+"</span></div>")
31
- if media_panel.attr("data-dimension") # verify dimensions
32
- btn = media_info.find(".p_footer .insert_btn")
33
- btn.prop('disabled', true)
34
- _ww = parseInt(media_panel.attr("data-dimension").split("x")[0])
35
- _hh = parseInt(media_panel.attr("data-dimension").split("x")[1])
36
- if _ww == ww && _hh == hh
37
- btn.prop('disabled', false)
38
- else
39
- media_info.find(".cdimension").css("color", 'red')
40
- cut = $("<button class='btn btn-info pull-right'><i class='fa fa-crop'></i> "+I18n("button.crop_image")+"</button>").click(->
41
- $.fn.upload_url({url: data["url"]})
42
- )
43
- btn.after(cut)
29
+ draw_image = ->
30
+ ww = parseInt(data['dimension'].split("x")[0])
31
+ hh = parseInt(data['dimension'].split("x")[1])
32
+ media_info.find(".p_body").append("<div class='cdimension'><b>"+I18n("button.dimension")+": </b><span>"+ww+"x"+hh+"</span></div>")
33
+ if media_panel.attr("data-dimension") # verify dimensions
34
+ btn = media_info.find(".p_footer .insert_btn")
35
+ btn.prop('disabled', true)
36
+ _ww = parseInt(media_panel.attr("data-dimension").split("x")[0])
37
+ _hh = parseInt(media_panel.attr("data-dimension").split("x")[1])
38
+ if _ww == ww && _hh == hh
39
+ btn.prop('disabled', false)
40
+ else
41
+ media_info.find(".cdimension").css("color", 'red')
42
+ cut = $("<button class='btn btn-info pull-right'><i class='fa fa-crop'></i> "+I18n("button.crop_image")+"</button>").click(->
43
+ $.fn.upload_url({url: data["url"]})
44
+ )
45
+ btn.after(cut)
46
+
47
+ if !data['dimension'] && media_panel.attr("data-dimension") # if not dimension in the image and required dimension
48
+ img = new Image()
49
+ img.onload = ->
50
+ data['dimension'] = this.width+'x'+this.height
51
+ item.data('eval-data', data)
52
+ draw_image()
53
+ img.src = data["url"]
54
+ else
55
+ draw_image()
44
56
 
45
57
  if window["callback_media_uploader"] # trigger callback
46
58
  media_info.find(".insert_btn").click ->
@@ -154,12 +154,15 @@ class CamaleonCms::SiteDecorator < CamaleonCms::TermTaxonomyDecorator
154
154
  args[:locale] = @_deco_locale unless args.include?(:locale)
155
155
  postfix = 'url'
156
156
  postfix = 'path' if args.delete(:as_path)
157
- begin
157
+ skip_relative_url_root = args.delete(:skip_relative_url_root)
158
+ res = begin
158
159
  h.cama_url_to_fixed("cama_root_#{postfix}", args)
159
160
  rescue # undefined method `host' for nil:NilClass (called from rake:tasks)
160
161
  parms = args.except(:host, :port, :locale, :as_path)
161
- "http://#{args[:host]}#{":#{args[:port]}" if args[:port].present?}#{"/#{args[:locale]}" if args[:locale].present?}/#{"?#{parms.to_param}" if parms.present?}"
162
+ "http://#{args[:host]}#{":#{args[:port]}" if args[:port].present?}#{"/#{PluginRoutes.static_system_info['relative_url_root']}" if PluginRoutes.static_system_info['relative_url_root'].present?}#{"/#{args[:locale]}" if args[:locale].present?}/#{"?#{parms.to_param}" if parms.present?}"
162
163
  end
164
+ res = res.sub("/#{PluginRoutes.static_system_info['relative_url_root']}", '') if skip_relative_url_root && PluginRoutes.static_system_info['relative_url_root'].present?
165
+ res
163
166
  end
164
167
 
165
168
  # return the path for this site
@@ -41,7 +41,7 @@ class CamaleonCmsLocalUploader < CamaleonCmsUploader
41
41
  res = {
42
42
  "name" => File.basename(file_path),
43
43
  "key" => parse_key(file_path),
44
- "url" => is_dir ? '' : (is_private_uploader? ? url_path.sub("#{@root_folder}/", '') : File.join(@current_site.decorate.the_url(locale: false), url_path)),
44
+ "url" => is_dir ? '' : (is_private_uploader? ? url_path.sub("#{@root_folder}/", '') : File.join(@current_site.decorate.the_url(locale: false, skip_relative_url_root: true), url_path)),
45
45
  "is_folder" => is_dir,
46
46
  "size" => is_dir ? 0 : File.size(file_path).round(2),
47
47
  "format" => is_dir ? 'folder' : self.class.get_file_format(file_path),
@@ -1,3 +1,3 @@
1
1
  module CamaleonCms
2
- VERSION = '2.3.2'
2
+ VERSION = '2.3.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: camaleon_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.2
4
+ version: 2.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Owen Peredo Diaz