ecm_pictures 1.0.2.pre → 1.0.3.pre
Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,7 @@ class Ecm::Pictures::Picture < ActiveRecord::Base
|
|
17
17
|
|
18
18
|
# acts as markup
|
19
19
|
acts_as_markup :language => :variable, :columns => [ :description, :description ]
|
20
|
-
|
20
|
+
|
21
21
|
# callbacks
|
22
22
|
after_initialize :set_defaults
|
23
23
|
before_validation :set_name_from_image_file_name, :if => Proc.new { |p| ( p.name.nil? || p.name.empty? ) }
|
@@ -40,14 +40,20 @@ class Ecm::Pictures::Picture < ActiveRecord::Base
|
|
40
40
|
:inclusion => Ecm::Pictures::Configuration.markup_languages
|
41
41
|
validates :name, :presence => true
|
42
42
|
|
43
|
-
def display_code
|
44
|
-
|
43
|
+
def display_code(style)
|
44
|
+
case style
|
45
|
+
when :erb
|
46
|
+
"<%= render_picture '#{self.name}' %>"
|
47
|
+
when :textile
|
48
|
+
"!#{image.url}!".gsub(/\?[0-9]*/, '')
|
49
|
+
else
|
50
|
+
end
|
45
51
|
end
|
46
52
|
|
47
53
|
def to_s
|
48
54
|
name
|
49
55
|
end
|
50
|
-
|
56
|
+
|
51
57
|
private
|
52
58
|
|
53
59
|
def set_defaults
|
@@ -55,7 +61,7 @@ class Ecm::Pictures::Picture < ActiveRecord::Base
|
|
55
61
|
self.markup_language ||= Ecm::Pictures::Configuration.default_markup_language
|
56
62
|
end
|
57
63
|
end
|
58
|
-
|
64
|
+
|
59
65
|
def set_name_from_image_file_name
|
60
66
|
self.name = File.basename(image_file_name, File.extname(image_file_name)) unless image_file_name.nil?
|
61
67
|
end
|
data/lib/ecm/pictures/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecm_pictures
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 961915992
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
9
|
+
- 3
|
10
10
|
- pre
|
11
|
-
version: 1.0.
|
11
|
+
version: 1.0.3.pre
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Roberto Vasquez Angel
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2013-
|
19
|
+
date: 2013-03-17 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: rails
|