infopark_fiona_connector 6.9.0.3.197272233 → 6.9.1.3.22208381
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,54 @@
|
|
1
|
+
module RailsConnector
|
2
|
+
|
3
|
+
# This module contains helpers that can be used to reference images and other assets stored in the CMS.
|
4
|
+
#
|
5
|
+
# Use this helper to take advantage of rails' asset host mechanism.
|
6
|
+
# (See http://api.rubyonrails.com/classes/ActionView/Helpers/AssetTagHelper.html for details about asset hosts.)
|
7
|
+
# If your application does not use any asset hosts, the helper will generate regular (=non asset host) pathes.
|
8
|
+
# @api public
|
9
|
+
module CmsAssetHelper
|
10
|
+
|
11
|
+
# Returns an html image tag for an image stored in the CMS.
|
12
|
+
#
|
13
|
+
# +target+ is the image from the cms to be referenced in the image tag.
|
14
|
+
# +target+ can be an +Obj+ or a +Link+ or a +LinkList+.
|
15
|
+
# +options+ can be used to specify additional html attributes for the tag.
|
16
|
+
# If you do not specify an html alt attribute, the helper method will use
|
17
|
+
# +target+'s +display_title+ as the html alt attribute.
|
18
|
+
# If your application is configured to use asset hosts, the images tag will reference
|
19
|
+
# the image using one of your asset hosts.
|
20
|
+
# @api public
|
21
|
+
def cms_image_tag(target, options = {})
|
22
|
+
options.symbolize_keys!
|
23
|
+
|
24
|
+
options[:src] = cms_asset_path(target)
|
25
|
+
options[:alt] ||= display_title(target)
|
26
|
+
|
27
|
+
tag("img", options)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Calculate the path to an asset stored in the CMS.
|
31
|
+
#
|
32
|
+
# The path can be used to reference a cms object inside an html page.
|
33
|
+
# +target+ can be an +Obj+ or a +Link+ or a +LinkList+.
|
34
|
+
# If your application is configured to use asset hosts, the path will reference
|
35
|
+
# the object using one of your asset hosts.
|
36
|
+
# @api public
|
37
|
+
def cms_asset_path(target)
|
38
|
+
regular_path = cms_path(target)
|
39
|
+
return regular_path if regular_path.first == "#"
|
40
|
+
asset_paths.compute_public_path(regular_path, nil)
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def display_title(target)
|
46
|
+
if target.respond_to?(:display_title)
|
47
|
+
return target.display_title
|
48
|
+
elsif target.respond_to?(:first) && target.first.respond_to?(:display_title)
|
49
|
+
return target.first.display_title
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infopark_fiona_connector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.9.
|
4
|
+
version: 6.9.1.3.22208381
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mime-types
|
@@ -69,6 +69,7 @@ extra_rdoc_files: []
|
|
69
69
|
files:
|
70
70
|
- .yardopts
|
71
71
|
- README
|
72
|
+
- app/helpers/rails_connector/cms_asset_helper.rb
|
72
73
|
- app/helpers/rails_connector/cms_tag_helper.rb
|
73
74
|
- app/helpers/rails_connector/editing_helper.rb
|
74
75
|
- app/helpers/rails_connector/marker_helper.rb
|
@@ -112,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
113
|
version: '0'
|
113
114
|
segments:
|
114
115
|
- 0
|
115
|
-
hash:
|
116
|
+
hash: 813754529
|
116
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
118
|
none: false
|
118
119
|
requirements:
|
@@ -121,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
122
|
version: 1.3.5
|
122
123
|
requirements: []
|
123
124
|
rubyforge_project:
|
124
|
-
rubygems_version: 1.8.
|
125
|
+
rubygems_version: 1.8.25
|
125
126
|
signing_key:
|
126
127
|
specification_version: 3
|
127
128
|
summary: Infopark Fiona Connector
|