trusty-cms 3.1.11 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +9 -14
- data/Gemfile.lock +84 -70
- data/README.md +4 -0
- data/app/assets/images/admin/add.png +0 -0
- data/app/assets/images/admin/archive_icon.png +0 -0
- data/app/assets/images/admin/audio_icon.png +0 -0
- data/app/assets/images/admin/audio_thumbnail.png +0 -0
- data/app/assets/images/admin/c_icon.png +0 -0
- data/app/assets/images/admin/copy.png +0 -0
- data/app/assets/images/admin/css_icon.png +0 -0
- data/app/assets/images/admin/database_icon.png +0 -0
- data/app/assets/images/admin/delete.png +0 -0
- data/app/assets/images/admin/document_icon.png +0 -0
- data/app/assets/images/admin/document_thumbnail.png +0 -0
- data/app/assets/images/admin/flash_icon.png +0 -0
- data/app/assets/images/admin/flash_thumbnail.png +0 -0
- data/app/assets/images/admin/font_icon.png +0 -0
- data/app/assets/images/admin/gzip_icon.png +0 -0
- data/app/assets/images/admin/html_icon.png +0 -0
- data/app/assets/images/admin/image_icon.png +0 -0
- data/app/assets/images/admin/image_thumbnail.png +0 -0
- data/app/assets/images/admin/java_icon.png +0 -0
- data/app/assets/images/admin/page_edit.png +0 -0
- data/app/assets/images/admin/pdf_icon.png +0 -0
- data/app/assets/images/admin/pdf_thumbnail.png +0 -0
- data/app/assets/images/admin/perl_icon.png +0 -0
- data/app/assets/images/admin/php_icon.png +0 -0
- data/app/assets/images/admin/presentation_icon.png +0 -0
- data/app/assets/images/admin/python_icon.png +0 -0
- data/app/assets/images/admin/reorder_assets.png +0 -0
- data/app/assets/images/admin/ruby_icon.png +0 -0
- data/app/assets/images/admin/script_icon.png +0 -0
- data/app/assets/images/admin/spinner.gif +0 -0
- data/app/assets/images/admin/spreadsheet_icon.png +0 -0
- data/app/assets/images/admin/tar_icon.png +0 -0
- data/app/assets/images/admin/unknown_icon.png +0 -0
- data/app/assets/images/admin/unknown_thumbnail.png +0 -0
- data/app/assets/images/admin/video_icon.png +0 -0
- data/app/assets/images/admin/video_thumbnail.png +0 -0
- data/app/assets/images/admin/xml_icon.png +0 -0
- data/app/assets/images/admin/zip_icon.png +0 -0
- data/app/assets/javascripts/admin/assets.js +268 -0
- data/app/assets/javascripts/admin/assets_admin.js +16 -0
- data/app/assets/javascripts/admin/jquery.fileupload.js +1457 -0
- data/app/assets/javascripts/admin/jquery.iframe-transport.js +214 -0
- data/app/assets/javascripts/admin/jquery.ui.widget.js +558 -0
- data/app/assets/stylesheets/admin/assets.scss +283 -0
- data/app/controllers/admin/assets_controller.rb +88 -0
- data/app/controllers/admin/page_attachments_controller.rb +23 -0
- data/app/helpers/admin/assets_helper.rb +16 -0
- data/app/helpers/admin/page_attachments_helper.rb +2 -0
- data/app/models/asset.rb +251 -0
- data/app/models/asset_type.rb +239 -0
- data/app/models/old_page_attachment.rb +26 -0
- data/app/models/page_attachment.rb +20 -0
- data/app/views/admin/assets/_asset.html.haml +12 -0
- data/app/views/admin/assets/_asset_table.html.haml +30 -0
- data/app/views/admin/assets/_errors.html.haml +3 -0
- data/app/views/admin/assets/_form.html.haml +18 -0
- data/app/views/admin/assets/_page_assets.html.haml +12 -0
- data/app/views/admin/assets/_search.html.haml +17 -0
- data/app/views/admin/assets/_search_results.html.haml +17 -0
- data/app/views/admin/assets/edit.html.haml +40 -0
- data/app/views/admin/assets/index.html.haml +15 -0
- data/app/views/admin/assets/new.html.haml +24 -0
- data/app/views/admin/assets/refresh.html.haml +14 -0
- data/app/views/admin/assets/remove.html.haml +16 -0
- data/app/views/admin/configuration/_clipped_edit.html.haml +8 -0
- data/app/views/admin/configuration/_clipped_show.html.haml +12 -0
- data/app/views/admin/page_attachments/_attachment.html.haml +25 -0
- data/app/views/admin/pages/_asset_popups.html.haml +37 -0
- data/app/views/admin/pages/_assets.html.haml +13 -0
- data/app/views/admin/removed/_assets_bucket.html.haml +8 -0
- data/app/views/admin/removed/_assets_container.html.haml +54 -0
- data/app/views/admin/removed/_bucket.html.haml +11 -0
- data/app/views/admin/removed/_bucket_asset.html.haml +9 -0
- data/app/views/admin/removed/_show_bucket_link.html.haml +4 -0
- data/app/views/admin/removed/_upload_to_page.html.haml +12 -0
- data/app/views/admin/removed/bucket/_iframe.html.haml +1 -0
- data/config/application.rb +0 -37
- data/config/initializers/assets.rb +1 -0
- data/config/initializers/interpolation.rb +6 -0
- data/config/initializers/kraken.rb +7 -0
- data/config/initializers/trusty_cms_config.rb +67 -0
- data/config/locales/en.yml +101 -0
- data/config/routes.rb +14 -3
- data/coverage/index.html +26 -26
- data/db/migrate/028_create_assets.rb +12 -0
- data/db/migrate/029_create_paperclip_attributes.rb +13 -0
- data/db/migrate/030_create_user_observer.rb +13 -0
- data/db/migrate/031_create_page_attachments.rb +19 -0
- data/db/migrate/032_rename_users.rb +13 -0
- data/db/migrate/20110513205050_asset_uuid.rb +11 -0
- data/db/migrate/20110606111250_update_configuration.rb +34 -0
- data/db/migrate/20110609101438_dimensions.rb +13 -0
- data/lib/trusty_cms.rb +1 -1
- data/spec/dummy/db/schema.rb +22 -0
- data/spec/dummy/log/test.log +95620 -0
- data/spec/dummy/tmp/cache/747/A70/TrustyCms%3A%3AConfig +0 -0
- data/spec/dummy/tmp/cache/85C/FA0/TrustyCms.cache_mtime +0 -0
- data/spec/dummy/tmp/capybara/capybara-20180312152412265881245.html +262 -0
- data/spec/dummy/tmp/capybara/capybara-201803121526139973682798.html +149 -0
- data/spec/factories/layout.rb +1 -1
- data/spec/factories/page.rb +3 -3
- data/spec/factories/page_part.rb +1 -1
- data/spec/factories/user.rb +1 -1
- data/spec/models/layout_spec.rb +6 -6
- data/spec/spec_helper.rb +4 -4
- data/trusty_cms.gemspec +27 -22
- data/vendor/extensions/clipped-extension/clipped_extension.rb +40 -0
- data/vendor/extensions/clipped-extension/lib/asset_tags.rb +346 -0
- data/vendor/extensions/clipped-extension/lib/clipped/engine.rb +11 -0
- data/vendor/extensions/clipped-extension/lib/clipped_admin_ui.rb +28 -0
- data/vendor/extensions/clipped-extension/lib/generators/templates/clipped_config.rb +53 -0
- data/vendor/extensions/clipped-extension/lib/page_asset_associations.rb +13 -0
- data/vendor/extensions/clipped-extension/lib/paperclip/frame_grab.rb +73 -0
- data/vendor/extensions/clipped-extension/lib/paperclip/geometry_transformation.rb +80 -0
- data/vendor/extensions/clipped-extension/lib/tasks/clipped_extension_tasks.rake +124 -0
- data/vendor/extensions/clipped-extension/lib/tasks/paperclip_tasks.rake +79 -0
- data/vendor/extensions/clipped-extension/lib/trusty-clipped-extension.rb +2 -0
- data/vendor/extensions/clipped-extension/lib/trusty_cms_clipped_extension/cloud.rb +41 -0
- metadata +219 -67
- data/config/initializers/ckeditor.rb +0 -3
- data/config/initializers/haml.rb +0 -2
- data/config/initializers/rails_patch.rb +0 -2
- data/config/initializers/string_extensions.rb +0 -1
- data/config/initializers/symbol_extensions.rb +0 -1
@@ -0,0 +1,239 @@
|
|
1
|
+
class AssetType
|
2
|
+
|
3
|
+
# The Asset Type encapsulates a type of attachment.
|
4
|
+
# Conventionally this would a sensible category like 'image' or 'video'
|
5
|
+
# that should be processed and presented in a particular way.
|
6
|
+
# An AssetType currently provides:
|
7
|
+
# * processor definitions for paperclip
|
8
|
+
# * styles definitions for paperclip
|
9
|
+
# * mime type list for file recognition
|
10
|
+
# * selectors and scopes for retrieving this (or not this) category of asset
|
11
|
+
# * radius tags for those subsets of assets (temporarily removed pending discussion of interface)
|
12
|
+
|
13
|
+
@@types = []
|
14
|
+
@@type_lookup = {}
|
15
|
+
@@extension_lookup = {}
|
16
|
+
@@mime_lookup = {}
|
17
|
+
@@default_type = nil
|
18
|
+
attr_reader :name, :processors, :styles, :icon_name, :catchall, :default_radius_tag
|
19
|
+
|
20
|
+
def initialize(name, options = {})
|
21
|
+
options = options.symbolize_keys
|
22
|
+
@name = name
|
23
|
+
@icon_name = options[:icon] || name
|
24
|
+
@processors = options[:processors] || []
|
25
|
+
@styles = options[:styles] || {}
|
26
|
+
@styles = standard_styles if @styles == :standard
|
27
|
+
@default_radius_tag = options[:default_radius_tag] || 'link'
|
28
|
+
@extensions = options[:extensions] || []
|
29
|
+
@extensions.each { |ext| @@extension_lookup[ext] ||= self }
|
30
|
+
@mimes = options[:mime_types] || []
|
31
|
+
@mimes.each { |mimetype| @@mime_lookup[mimetype] ||= self }
|
32
|
+
|
33
|
+
this = self
|
34
|
+
Asset.send :define_method, "#{name}?".intern do this.mime_types.include?(asset_content_type) end
|
35
|
+
Asset.send :define_class_method, "#{name}_condition".intern do this.condition; end
|
36
|
+
Asset.send :define_class_method, "not_#{name}_condition".intern do this.non_condition; end
|
37
|
+
Asset.send :scope, plural.to_sym, -> {where(:conditions => condition)}
|
38
|
+
Asset.send :scope, "not_#{plural}".to_sym, -> {where(:conditions => non_condition)}
|
39
|
+
|
40
|
+
self.define_radius_tags
|
41
|
+
@@types.push self
|
42
|
+
@@type_lookup[@name] = self
|
43
|
+
end
|
44
|
+
|
45
|
+
def plural
|
46
|
+
name.to_s.pluralize
|
47
|
+
end
|
48
|
+
|
49
|
+
def icon(style_name='icon')
|
50
|
+
if File.exist?(Rails.root + "public/images/admin/assets/#{icon_name}_#{style_name.to_s}.png")
|
51
|
+
return "/assets/admin/#{icon_name}_#{style_name.to_s}.png"
|
52
|
+
else
|
53
|
+
return "/assets/admin/#{icon_name}_icon.png"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def icon_path(style_name='icon')
|
58
|
+
Rails.root + "public#{icon(style_name)}"
|
59
|
+
end
|
60
|
+
|
61
|
+
def condition
|
62
|
+
if @mimes.any?
|
63
|
+
["asset_content_type IN (#{@mimes.map{'?'}.join(',')})", *@mimes]
|
64
|
+
else
|
65
|
+
self.class.other_condition
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def sanitized_condition
|
70
|
+
ActiveRecord::Base.send :sanitize_sql_array, condition
|
71
|
+
end
|
72
|
+
|
73
|
+
def non_condition
|
74
|
+
if @mimes.any?
|
75
|
+
["NOT asset_content_type IN (#{@mimes.map{'?'}.join(',')})", *@mimes]
|
76
|
+
else
|
77
|
+
self.class.non_other_condition
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def sanitized_non_condition
|
82
|
+
ActiveRecord::Base.send :sanitize_sql_array, non_condition
|
83
|
+
end
|
84
|
+
|
85
|
+
def mime_types
|
86
|
+
@mimes
|
87
|
+
end
|
88
|
+
|
89
|
+
def paperclip_processors
|
90
|
+
TrustyCms.config["assets.create_#{name}_thumbnails?"] ? processors : []
|
91
|
+
end
|
92
|
+
|
93
|
+
# Parses and combines the various ways in which paperclip styles can be defined, and normalises them into
|
94
|
+
# the format that paperclip expects. Note that :styles => :standard has already been replaced with the
|
95
|
+
# results of a call to standard_styles.
|
96
|
+
# Styles are passed to paperclip as a hash and arbitrary keys can be passed through from configuration.
|
97
|
+
#
|
98
|
+
def paperclip_styles
|
99
|
+
# Styles are not relevant if processors are not defined.
|
100
|
+
# TODO: should this default to an icon set?
|
101
|
+
@paperclip_styles ||= if paperclip_processors.any?
|
102
|
+
normalize_style_rules(configured_styles.merge(styles))
|
103
|
+
else
|
104
|
+
{}
|
105
|
+
end
|
106
|
+
@paperclip_styles
|
107
|
+
end
|
108
|
+
|
109
|
+
# Takes a motley collection of differently-defined styles and renders them into the standard hash-of-hashes format.
|
110
|
+
# Solitary strings are assumed to be
|
111
|
+
#TODO: define permitted and/or expected options for the asset type and pass through that subset of the style-definition hash
|
112
|
+
#
|
113
|
+
def normalize_style_rules(styles={})
|
114
|
+
styles.each_pair do |name, rule|
|
115
|
+
unless rule.is_a? Hash
|
116
|
+
if rule =~ /\=/
|
117
|
+
parameters = rule.split(',').collect{ |parameter| parameter.split('=') } # array of pairs
|
118
|
+
rule = Hash[parameters].symbolize_keys # into hash of :first => last
|
119
|
+
else
|
120
|
+
rule = {:geometry => rule} # simplest case: name:geom|name:geom
|
121
|
+
end
|
122
|
+
end
|
123
|
+
rule[:geometry] ||= rule.delete(:size)
|
124
|
+
styles[name.to_sym] = rule
|
125
|
+
end
|
126
|
+
styles
|
127
|
+
end
|
128
|
+
|
129
|
+
def standard_styles
|
130
|
+
{
|
131
|
+
:thumbnail => { :geometry => '100x100#', :format => :png }
|
132
|
+
}
|
133
|
+
end
|
134
|
+
|
135
|
+
# Paperclip styles are defined in the config entry `assets.thumbnails.asset_type`, with the format:
|
136
|
+
# foo:key-x,key=y,key=z|bar:key-x,key=y,key=z
|
137
|
+
# where 'key' can be any parameter understood by your paperclip processors. Usually they include :geometry and :format.
|
138
|
+
# A typical entry would be:
|
139
|
+
#
|
140
|
+
# standard:geometry=640x640>,format=jpg
|
141
|
+
#
|
142
|
+
# This method parses that string and returns the defined styles as a hash of style-defining strings that will later be normalized into hashes.
|
143
|
+
#
|
144
|
+
def configured_styles
|
145
|
+
@configured_styles ||= if style_definitions = TrustyCms.config["assets.thumbnails.#{name}"]
|
146
|
+
style_definitions.split('|').each_with_object({}) do |definition, styles|
|
147
|
+
name, rule = definition.split(':')
|
148
|
+
styles[name.strip.to_sym] = rule.to_s.strip
|
149
|
+
end
|
150
|
+
else
|
151
|
+
{}
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def legacy_styles
|
156
|
+
TrustyCms::config["assets.additional_thumbnails"].to_s.gsub(' ','').split(',').collect{|s| s.split('=')}.inject({}) {|ha, (k, v)| ha[k.to_sym] = v; ha}
|
157
|
+
end
|
158
|
+
|
159
|
+
def style_dimensions(style_name)
|
160
|
+
if style = paperclip_styles[style_name.to_sym]
|
161
|
+
style[:size]
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
def define_radius_tags
|
166
|
+
type = self.name
|
167
|
+
Page.class_eval {
|
168
|
+
tag "asset:if_#{type}" do |tag|
|
169
|
+
tag.expand if find_asset(tag, tag.attr.dup).send("#{type}?".to_sym)
|
170
|
+
end
|
171
|
+
tag "asset:unless_#{type}" do |tag|
|
172
|
+
tag.expand unless find_asset(tag, tag.attr.dup).send("#{type}?".to_sym)
|
173
|
+
end
|
174
|
+
}
|
175
|
+
end
|
176
|
+
|
177
|
+
# class methods
|
178
|
+
|
179
|
+
def self.for(attachment)
|
180
|
+
extension = File.extname(attachment.original_filename).sub(/^\.+/, "")
|
181
|
+
from_extension(extension) || from_mimetype(attachment.instance_read(:content_type)) || catchall
|
182
|
+
end
|
183
|
+
|
184
|
+
def self.from_extension(extension)
|
185
|
+
@@extension_lookup[extension]
|
186
|
+
end
|
187
|
+
|
188
|
+
def self.from_mimetype(mimetype)
|
189
|
+
@@mime_lookup[mimetype]
|
190
|
+
end
|
191
|
+
|
192
|
+
def self.catchall
|
193
|
+
@@default_type ||= self.find(:other)
|
194
|
+
end
|
195
|
+
|
196
|
+
def self.known?(name)
|
197
|
+
!self.find(name).nil?
|
198
|
+
end
|
199
|
+
|
200
|
+
def self.slice(*types)
|
201
|
+
@@type_lookup.slice(*types.map(&:to_sym)).values if types # Hash#slice is provided by will_paginate
|
202
|
+
end
|
203
|
+
|
204
|
+
def self.find(type)
|
205
|
+
@@type_lookup[type] if type
|
206
|
+
end
|
207
|
+
def self.[](type)
|
208
|
+
find(type)
|
209
|
+
end
|
210
|
+
|
211
|
+
def self.all
|
212
|
+
@@types
|
213
|
+
end
|
214
|
+
|
215
|
+
def self.known_types
|
216
|
+
@@types.map(&:name) # to preserve order
|
217
|
+
end
|
218
|
+
|
219
|
+
def self.known_mimetypes
|
220
|
+
@@mime_lookup.keys
|
221
|
+
end
|
222
|
+
|
223
|
+
def self.mime_types_for(*names)
|
224
|
+
names.collect{ |name| find(name).mime_types }.flatten
|
225
|
+
end
|
226
|
+
|
227
|
+
def self.conditions_for(*names)
|
228
|
+
names.collect{ |name| self.find(name).sanitized_condition }.join(' OR ')
|
229
|
+
end
|
230
|
+
|
231
|
+
def self.non_other_condition
|
232
|
+
["asset_content_type IN (#{known_mimetypes.map{'?'}.join(',')})", *known_mimetypes]
|
233
|
+
end
|
234
|
+
|
235
|
+
def self.other_condition
|
236
|
+
["NOT asset_content_type IN (#{known_mimetypes.map{'?'}.join(',')})", *known_mimetypes]
|
237
|
+
end
|
238
|
+
|
239
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class OldPageAttachment < ActiveRecord::Base
|
2
|
+
def create_paperclipped_record
|
3
|
+
options = {
|
4
|
+
:asset_file_size => size,
|
5
|
+
:asset_file_name => filename,
|
6
|
+
:asset_content_type => content_type,
|
7
|
+
:created_by_id => created_by
|
8
|
+
}
|
9
|
+
|
10
|
+
# In newer versions of page_attachments we have title and description fields.
|
11
|
+
options[:title] = title if respond_to?(:title)
|
12
|
+
options[:caption] = description if respond_to?(:description)
|
13
|
+
|
14
|
+
a = Asset.new(options)
|
15
|
+
a.save
|
16
|
+
|
17
|
+
# Re-attach the asset to it's page
|
18
|
+
page = Page.find(page_id)
|
19
|
+
p = PageAttachment.create(:asset_id => a.id, :page_id => page.id)
|
20
|
+
|
21
|
+
# Circumvent acts_as_list before_create filter to set the original page_attachment position.
|
22
|
+
PageAttachment.update_all("position=#{position}", "id=#{p.id}") if respond_to?(:position)
|
23
|
+
|
24
|
+
a
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class PageAttachment < ActiveRecord::Base
|
2
|
+
belongs_to :asset
|
3
|
+
belongs_to :page
|
4
|
+
attr_accessor :selected
|
5
|
+
|
6
|
+
accepts_nested_attributes_for :asset
|
7
|
+
|
8
|
+
acts_as_list :scope => :page_id
|
9
|
+
|
10
|
+
def selected?
|
11
|
+
!!selected
|
12
|
+
end
|
13
|
+
|
14
|
+
# a small change to the method in acts_as_list so that we don't override
|
15
|
+
# the position value if it has already been set (as it usually is for new attachments)
|
16
|
+
def add_to_list_bottom
|
17
|
+
self[position_column] ||= bottom_position_in_list.to_i + 1
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
- asset ||= @asset
|
2
|
+
- asset_type = asset.image? ? "image" : "link"
|
3
|
+
|
4
|
+
%li{:class => "#{asset_type} asset", :id => "asset_#{asset.id}"}
|
5
|
+
.front
|
6
|
+
.thumbnail= image_tag asset.thumbnail(:thumbnail)
|
7
|
+
.back
|
8
|
+
.title= asset.title
|
9
|
+
%ul.actions
|
10
|
+
%li
|
11
|
+
= link_to t('clipped_extension.edit'), edit_admin_asset_url(asset), :class => 'edit_asset'
|
12
|
+
= link_to t('clipped_extension.remove'), remove_admin_asset_url(asset), :class => 'remove_asset'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
- assets ||= @assets
|
2
|
+
- page ||= @page
|
3
|
+
- with_pagination ||= false
|
4
|
+
|
5
|
+
- if assets.empty?
|
6
|
+
%p
|
7
|
+
= t("clipped_extension.no_assets")
|
8
|
+
- else
|
9
|
+
- if with_pagination && assets.respond_to?(:total_pages) && assets.total_pages > 1
|
10
|
+
= pagination_for(assets, pagination_parameters.merge(:depaginate => false, :params => {:controller => 'admin/assets', :action => 'index', :id => nil, :format => 'js'}))
|
11
|
+
|
12
|
+
%ul
|
13
|
+
- assets.each_with_index do |asset, index|
|
14
|
+
- asset_type = asset.image? ? "image" : "link"
|
15
|
+
%li{:class => "#{asset_type} asset", :id => "asset_#{asset.id}"}
|
16
|
+
.front
|
17
|
+
.thumbnail= image_tag asset.thumbnail(:thumbnail)
|
18
|
+
.back
|
19
|
+
.title
|
20
|
+
= asset.title
|
21
|
+
%ul.actions
|
22
|
+
- if @page
|
23
|
+
%li= asset_insertion_link(asset)
|
24
|
+
%li= asset_attachment_link(asset)
|
25
|
+
- else
|
26
|
+
%li= link_to t('clipped_extension.edit'), admin_asset_path(asset), :class => 'edit'
|
27
|
+
%li= link_to t("clipped_extension.remove"), remove_admin_asset_path(asset), :class => "delete"
|
28
|
+
|
29
|
+
- if with_pagination && assets.respond_to?(:total_pages) && assets.total_pages > 1
|
30
|
+
= pagination_for(assets, pagination_parameters.merge(:depaginate => false, :param_name => 'p', :params => {:controller => 'admin/assets', :action => 'index', :id => nil, :format => 'js', :page_id => (page && page.id), :pp => assets.per_page }))
|
@@ -0,0 +1,18 @@
|
|
1
|
+
= render_region :form_top
|
2
|
+
- render_region :form do |form|
|
3
|
+
- form.edit_title do
|
4
|
+
%fieldset.title
|
5
|
+
- form.edit_metadata do
|
6
|
+
.drawer
|
7
|
+
.drawer_contents#attributes
|
8
|
+
%table.fieldset
|
9
|
+
%tr
|
10
|
+
%th.label
|
11
|
+
%label{ :for => "asset_caption" }
|
12
|
+
= t("clipped_extension.caption")
|
13
|
+
%td.field
|
14
|
+
= f.text_field :caption, :class => 'textbox', :maxlength => 255
|
15
|
+
= render_region :extended_metadata, :locals => {:f => f}
|
16
|
+
.drawer_handle
|
17
|
+
%a.toggle.more{:href=>'#attributes', :rel=>"toggle[attributes]"}
|
18
|
+
= t('more')
|
@@ -0,0 +1,12 @@
|
|
1
|
+
- unless @page.assets.empty?
|
2
|
+
- @page.page_attachments.each do |attachment|
|
3
|
+
= render :partial => 'admin/assets/asset', :locals => { :attachment => attachment }
|
4
|
+
- else
|
5
|
+
%li
|
6
|
+
%p.note
|
7
|
+
= t("clipped_extension.no_attached_assets")
|
8
|
+
|
9
|
+
%script{ :type => "text/javascript" }
|
10
|
+
Asset.MakeDraggables();
|
11
|
+
|
12
|
+
= sortable_element 'attachments', :url => reorder_assets_url(@page), :constraint => 'horizontal', :handle => 'reorder', :ghosting => false, :complete => visual_effect(:highlight, 'assets')
|
@@ -0,0 +1,17 @@
|
|
1
|
+
= form_tag(admin_assets_path, :id=>'filesearchform', :method => 'get', :class=>"search") do
|
2
|
+
- if @page
|
3
|
+
= hidden_field_tag "page_id", @page.id
|
4
|
+
= hidden_field_tag "p", params['p'] || 1
|
5
|
+
= hidden_field_tag "pp", params['pp'] || 20
|
6
|
+
|
7
|
+
.asset_filters
|
8
|
+
= link_to t("asset_types.all"), admin_assets_url, :id => "select_all", :class => params[:filter].blank? ? "deselective pressed" : "deselective"
|
9
|
+
- AssetType.all.each do |type|
|
10
|
+
- unless type.name == :other
|
11
|
+
= link_to t("asset_types.#{type.plural}"), admin_assets_url(:filter => type.name), :rel => type.name.to_s, :class => params[:filter] == type.name.to_s ? "selective pressed" : "selective"
|
12
|
+
.right
|
13
|
+
%input{:type=>"search", :id => 'filesearchforminput', :class=>"search", :name=>"search", :value=>h(params[:search]), :placeholder=>"Search", :results=>0, :size=>30}
|
14
|
+
|
15
|
+
#type_boxes{:style => "display: none"}
|
16
|
+
- AssetType.all.each do |type|
|
17
|
+
= check_box_tag 'filter[]', type.name.to_s, false, :id => "#{type.name}-check", :class => 'selective'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
%ul#search_list
|
2
|
+
- unless @assets.empty?
|
3
|
+
- @assets.each do |asset|
|
4
|
+
=# render :partial => 'asset', :locals => { :asset => asset, :page => @page }
|
5
|
+
= render :partial => 'admin/assets/asset', :locals => { :asset_url => asset.asset.url, :asset_id => asset.id, :asset_type => 'image', :asset_title => asset.title, :asset_thumbnail => asset.thumbnail(:thumbnail), :page => @page }
|
6
|
+
|
7
|
+
- else
|
8
|
+
%li
|
9
|
+
%p.note
|
10
|
+
= t("clipped_extension.no_assets_found")
|
11
|
+
|
12
|
+
%script
|
13
|
+
Asset.MakeDroppables();
|
14
|
+
Asset.MakeDraggables();
|
15
|
+
Event.addBehavior({ '.asset a' : Asset.DisableLinks, 'a.add_asset' : Asset.AddToPage });
|
16
|
+
|
17
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
= stylesheet_link_tag 'admin/assets'
|
2
|
+
= render_region :top
|
3
|
+
|
4
|
+
- render_region :main do |main|
|
5
|
+
- main.edit_header do
|
6
|
+
%h1= t("clipped_extension.asset_edit_title")
|
7
|
+
|
8
|
+
- main.edit_form do
|
9
|
+
- form_for :asset, :url => admin_asset_path(@asset), :html => { :method => "put", :multipart => true } do |f|
|
10
|
+
.form_area
|
11
|
+
= render :partial => "form", :locals => { :f => f }
|
12
|
+
|
13
|
+
%div.content
|
14
|
+
%fieldset
|
15
|
+
%label.filename
|
16
|
+
= "#{t("clipped_extension.filename")}: #{@asset.asset_file_name unless @asset.new_record?}"
|
17
|
+
%p.asset
|
18
|
+
- display_size = TrustyCms::config['assets.display_size'] || 'normal'
|
19
|
+
= image_tag @asset.thumbnail(display_size.to_sym), :class => 'preview'
|
20
|
+
|
21
|
+
= updated_stamp @asset
|
22
|
+
|
23
|
+
%fieldset.upload
|
24
|
+
%label.upload
|
25
|
+
= t("clipped_extension.replace_file")
|
26
|
+
= f.file_field :asset, :class => "", :style => "width: 100%"
|
27
|
+
|
28
|
+
.buttons
|
29
|
+
= save_model_button(@asset)
|
30
|
+
= save_model_and_continue_editing_button(@asset)
|
31
|
+
= t("or")
|
32
|
+
= link_to t("cancel"), admin_assets_path
|
33
|
+
|
34
|
+
- main.edit_regenerate do
|
35
|
+
- if current_user.admin? or current_user.designer?
|
36
|
+
%fieldset= t("clipped_extension.regenerate_thumbnails")
|
37
|
+
|
38
|
+
- form_tag refresh_admin_asset_path(@asset), :method => :put do
|
39
|
+
%p.asset_buttons
|
40
|
+
%input.button{ :type => "submit", :value => t("clipped_extension.regenerate") }
|
@@ -0,0 +1,15 @@
|
|
1
|
+
= stylesheet_link_tag 'admin/assets'
|
2
|
+
= javascript_include_tag 'admin/assets_admin'
|
3
|
+
|
4
|
+
- content_for :toolbar do
|
5
|
+
= render 'search'
|
6
|
+
|
7
|
+
.outset
|
8
|
+
#assets_table.assets
|
9
|
+
= render :partial => 'asset_table', :locals => { assets: @assets, with_pagination: true }
|
10
|
+
%p{style: 'clear: both; height: 2em'}
|
11
|
+
|
12
|
+
- render_region :bottom do |bottom|
|
13
|
+
#actions
|
14
|
+
%ul
|
15
|
+
%li= link_to((image('upload') + ' ' + t('clipped_extension.upload_asset')), new_admin_asset_path)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
= stylesheet_link_tag 'admin/assets'
|
2
|
+
= render_region :top
|
3
|
+
|
4
|
+
- render_region :main do |main|
|
5
|
+
- main.edit_header do
|
6
|
+
%h1= t("clipped_extension.new_asset")
|
7
|
+
|
8
|
+
- main.edit_form do
|
9
|
+
- form_for :asset, :url => admin_assets_path, :html => { :method => "post", :multipart => true } do |f|
|
10
|
+
|
11
|
+
= render :partial => "form", :locals => { :f => f }
|
12
|
+
|
13
|
+
%fieldset
|
14
|
+
%label= t("clipped_extension.choose_file")
|
15
|
+
= f.file_field :asset, :style => "width: 100%", :multiple => true
|
16
|
+
|
17
|
+
.buttons
|
18
|
+
= save_model_button(@asset)
|
19
|
+
= save_model_and_continue_editing_button(@asset)
|
20
|
+
= t("or")
|
21
|
+
= link_to t("cancel"), admin_assets_path
|
22
|
+
|
23
|
+
- main.edit_regenerate do
|
24
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
= stylesheet_link_tag 'admin/assets'
|
2
|
+
|
3
|
+
%h1
|
4
|
+
= t("clipped_extension.refresh_assets")
|
5
|
+
%p.confirmation
|
6
|
+
= t("clipped_extension.confirm_refresh_assets")
|
7
|
+
%p.confirmation
|
8
|
+
=t('clipped_extension.refresh_assets_rake_task')
|
9
|
+
|
10
|
+
%form{:action => regenerate_admin_assets_path, :method => :post}
|
11
|
+
.buttons
|
12
|
+
%input.button{:type => "submit", :value => t("clipped_extension.refresh_assets")}
|
13
|
+
= t("or")
|
14
|
+
= link_to t("cancel"), admin_assets_path
|
@@ -0,0 +1,16 @@
|
|
1
|
+
= stylesheet_link_tag 'admin/assets'
|
2
|
+
|
3
|
+
%h1= t("clipped_extension.remove_asset")
|
4
|
+
%p.warning= t("clipped_extension.confirm_remove_asset")
|
5
|
+
|
6
|
+
%table.index#assets{:cellpadding => "0", :cellspacing => "0", :border => "0"}
|
7
|
+
%tbody
|
8
|
+
%tr[@asset]
|
9
|
+
%td.icon= image_tag @asset.thumbnail(:icon), :title => @asset.asset_file_name
|
10
|
+
%td.name= @asset.title
|
11
|
+
|
12
|
+
= form_for [:admin, @asset], :html => { :method => 'delete' } do
|
13
|
+
.buttons
|
14
|
+
%input.button{:type => "submit", :value => t("clipped_extension.delete_asset")}
|
15
|
+
= t("or")
|
16
|
+
= link_to t("cancel"), admin_assets_path
|
@@ -0,0 +1,8 @@
|
|
1
|
+
%fieldset
|
2
|
+
%h3
|
3
|
+
= t('clipped_extension.assets')
|
4
|
+
%p= edit_config 'assets.max_asset_size'
|
5
|
+
%p= edit_config 'assets.display_size'
|
6
|
+
%p= edit_config 'assets.insertion_size'
|
7
|
+
- %w{image video pdf}.each do |type|
|
8
|
+
%p= edit_config "assets.create_#{type}_thumbnails?"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
%h4
|
2
|
+
= t('clipped_extension.assets')
|
3
|
+
%p.ruled
|
4
|
+
= show_config 'assets.max_asset_size'
|
5
|
+
%p.ruled
|
6
|
+
= show_config 'assets.display_size'
|
7
|
+
%p.ruled
|
8
|
+
= show_config 'assets.insertion_size'
|
9
|
+
- %w{image video pdf}.each do |type|
|
10
|
+
%p.ruled
|
11
|
+
= show_config "assets.create_#{type}_thumbnails?"
|
12
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
- attachment ||= @page_attachment
|
2
|
+
|
3
|
+
- page = attachment.page
|
4
|
+
- asset = attachment.asset
|
5
|
+
- asset_type = asset.image? ? "image" : "link"
|
6
|
+
- css_class = "#{asset_type} asset"
|
7
|
+
- css_class += ' unsaved' if attachment.new_record?
|
8
|
+
|
9
|
+
%li{:class => css_class, :id => "attachment_#{asset.uuid}", data: {toggle: "tooltip", placement: "left"}, title: "Asset ID: #{asset.id}"}
|
10
|
+
= fields_for :page, @page do |f|
|
11
|
+
= f.fields_for :page_attachments, attachment, :child_index => asset.uuid do |paf|
|
12
|
+
- if attachment.new_record?
|
13
|
+
= paf.hidden_field :asset_id, :class => 'attacher'
|
14
|
+
- else
|
15
|
+
= paf.hidden_field :_destroy, :class => 'destroyer'
|
16
|
+
= paf.hidden_field :position, :class => 'pos'
|
17
|
+
.front
|
18
|
+
.thumbnail= image_tag asset.thumbnail(:thumbnail), alt: "Asset ID: #{asset.id}"
|
19
|
+
.back
|
20
|
+
.title= asset.title
|
21
|
+
%ul.actions
|
22
|
+
%li
|
23
|
+
= asset_insertion_link(asset)
|
24
|
+
%li
|
25
|
+
= link_to t('clipped_extension.detach'), '#', :class => 'detach_asset'
|
@@ -0,0 +1,37 @@
|
|
1
|
+
- render_region :asset_popups do |popups|
|
2
|
+
- popups.upload_asset do
|
3
|
+
#upload_asset.popup.textured{:style => "display: none; width: 28em"}
|
4
|
+
#upload_asset_busy.busy{:style => "display: none"}= image('spinner.gif', :alt => "")
|
5
|
+
|
6
|
+
.popup_title= t('clipped_extension.upload_asset')
|
7
|
+
|
8
|
+
= form_for([:admin, Asset.new], :html => {:method => 'post', :multipart => true, :class => 'upload_asset'}) do |f|
|
9
|
+
= hidden_field_tag "for_attachment", 1
|
10
|
+
= hidden_field_tag "page_id", @page.id
|
11
|
+
#upload-controls
|
12
|
+
%p
|
13
|
+
= f.label :asset, t("clipped_extension.choose_file")
|
14
|
+
= f.file_field :asset, :class => 'file', :multiple => true
|
15
|
+
#upload-status{:style => 'display: none;'}
|
16
|
+
%img{:src => "/assets/admin/spinner.gif"}
|
17
|
+
%p
|
18
|
+
%a#attach-popup{:href=>"#attach_asset", :style => 'color: #666; font-size: .8em'}= t('clipped_extension.attach_existing')
|
19
|
+
|
20
|
+
-#%a.close_popup{:href=>"#"}= 'Upload Complete. Click to Close.'
|
21
|
+
|
22
|
+
- popups.attach_asset do
|
23
|
+
#attach_asset.popup.textured{:style=>"display: none;"}
|
24
|
+
|
25
|
+
.popup_title= t('clipped_extension.find_assets')
|
26
|
+
|
27
|
+
.toolbar
|
28
|
+
= render :partial => 'admin/assets/search'
|
29
|
+
|
30
|
+
#assets_table.assets.viewport{:style=>"height: 320px; width: 610px"}
|
31
|
+
- assets = Asset.all.paginate(:per_page => 20, page: params[:p])
|
32
|
+
= render :partial => 'admin/assets/asset_table', :locals => {:assets => assets, :with_pagination => true}
|
33
|
+
|
34
|
+
.busy{:style => "display: none"}= image('spinner.gif', :alt => "")
|
35
|
+
.buttons
|
36
|
+
%a.cancel.close_popup{:href=>"#"}= t('close')
|
37
|
+
%a{:href=>"#upload_asset", :id=> "upload_asset_link", :style => 'color: #666; float: left'}= t('clipped_extension.upload_asset')
|
@@ -0,0 +1,13 @@
|
|
1
|
+
= stylesheet_link_tag 'admin/assets'
|
2
|
+
= javascript_include_tag 'admin/assets_admin'
|
3
|
+
#content.fieldset
|
4
|
+
#attachment_list.assets
|
5
|
+
%ul#attachment_fields{:class => @page.page_attachments.empty? ? 'empty' : ''}
|
6
|
+
= render :partial => 'admin/page_attachments/attachment', :collection => @page.page_attachments
|
7
|
+
%p.note
|
8
|
+
= link_to "path/to/page.html" '#attach_asset', :class => 'button', :id => 'attach_assets' do
|
9
|
+
%i.fa.fa-image
|
10
|
+
= t('clipped_extension.assets')
|
11
|
+
%span.message
|
12
|
+
- if @page.page_attachments.empty?
|
13
|
+
= t('clipped_extension.no_attached_assets')
|