radiant-clipped-extension-add-group 1.1.2
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.
- data/LICENSE +22 -0
- data/README.md +184 -0
- data/Rakefile +109 -0
- data/app/controllers/admin/assets_controller.rb +66 -0
- data/app/controllers/admin/page_attachments_controller.rb +18 -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 +237 -0
- data/app/models/asset_type.rb +241 -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 +33 -0
- data/app/views/admin/assets/_errors.html.haml +3 -0
- data/app/views/admin/assets/_form.html.haml +25 -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 +41 -0
- data/app/views/admin/assets/index.html.haml +19 -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/page_parts/_page_part.html.haml +21 -0
- data/app/views/admin/pages/_asset_popups.html.haml +42 -0
- data/app/views/admin/pages/_assets.html.haml +11 -0
- data/app/views/admin/removed/_assets_bucket.html.haml +8 -0
- data/app/views/admin/removed/_assets_container.html.haml +58 -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/artwork/icons.png +0 -0
- data/clipped_extension.rb +52 -0
- data/config/initializers/interpolation.rb +6 -0
- data/config/initializers/processors.rb +43 -0
- data/config/initializers/radiant_config.rb +65 -0
- data/config/locales/de.yml +109 -0
- data/config/locales/en.yml +110 -0
- data/config/locales/nl.yml +107 -0
- data/config/locales/ru.yml +110 -0
- data/config/routes.rb +8 -0
- data/cucumber.yml +1 -0
- data/db/migrate/001_create_assets.rb +12 -0
- data/db/migrate/002_create_paperclip_attributes.rb +13 -0
- data/db/migrate/003_create_user_observer.rb +13 -0
- data/db/migrate/004_create_page_attachments.rb +19 -0
- data/db/migrate/005_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/db/migrate/20121024064452_add_group_to_assets.rb +9 -0
- data/features/support/env.rb +11 -0
- data/features/support/paths.rb +22 -0
- data/lib/asset_tags.rb +350 -0
- data/lib/clipped_admin_ui.rb +32 -0
- data/lib/cloud.rb +41 -0
- data/lib/generators/templates/clipped_config.rb +53 -0
- data/lib/page_asset_associations.rb +13 -0
- data/lib/paperclip/frame_grab.rb +73 -0
- data/lib/paperclip/geometry_transformation.rb +80 -0
- data/lib/radiant-clipped-extension.rb +8 -0
- data/lib/tasks/clipped_extension_tasks.rake +124 -0
- data/lib/tasks/paperclip_tasks.rake +79 -0
- data/public/flash/ZeroClipboard.swf +0 -0
- data/public/images/admin/assets/add.png +0 -0
- data/public/images/admin/assets/archive_icon.png +0 -0
- data/public/images/admin/assets/audio_icon.png +0 -0
- data/public/images/admin/assets/audio_thumbnail.png +0 -0
- data/public/images/admin/assets/c_icon.png +0 -0
- data/public/images/admin/assets/copy.png +0 -0
- data/public/images/admin/assets/css_icon.png +0 -0
- data/public/images/admin/assets/database_icon.png +0 -0
- data/public/images/admin/assets/delete.png +0 -0
- data/public/images/admin/assets/document_icon.png +0 -0
- data/public/images/admin/assets/document_thumbnail.png +0 -0
- data/public/images/admin/assets/flash_icon.png +0 -0
- data/public/images/admin/assets/flash_thumbnail.png +0 -0
- data/public/images/admin/assets/font_icon.png +0 -0
- data/public/images/admin/assets/gzip_icon.png +0 -0
- data/public/images/admin/assets/html_icon.png +0 -0
- data/public/images/admin/assets/image_icon.png +0 -0
- data/public/images/admin/assets/image_thumbnail.png +0 -0
- data/public/images/admin/assets/java_icon.png +0 -0
- data/public/images/admin/assets/page_edit.png +0 -0
- data/public/images/admin/assets/perl_icon.png +0 -0
- data/public/images/admin/assets/php_icon.png +0 -0
- data/public/images/admin/assets/presentation_icon.png +0 -0
- data/public/images/admin/assets/python_icon.png +0 -0
- data/public/images/admin/assets/reorder_assets.png +0 -0
- data/public/images/admin/assets/ruby_icon.png +0 -0
- data/public/images/admin/assets/script_icon.png +0 -0
- data/public/images/admin/assets/spreadsheet_icon.png +0 -0
- data/public/images/admin/assets/tar_icon.png +0 -0
- data/public/images/admin/assets/unknown_icon.png +0 -0
- data/public/images/admin/assets/unknown_thumbnail.png +0 -0
- data/public/images/admin/assets/video_icon.png +0 -0
- data/public/images/admin/assets/video_thumbnail.png +0 -0
- data/public/images/admin/assets/xml_icon.png +0 -0
- data/public/images/admin/assets/zip_icon.png +0 -0
- data/public/javascripts/admin/assets.js +297 -0
- data/public/stylesheets/sass/admin/assets.sass +224 -0
- data/radiant-clipped-extension.gemspec +29 -0
- data/spec/ci/before_script +23 -0
- data/spec/ci/script +2 -0
- data/spec/controllers/admin/assets_controller_spec.rb +50 -0
- data/spec/controllers/admin/page_attachments_controller_spec.rb +50 -0
- data/spec/datasets/assets_dataset.rb +36 -0
- data/spec/fixtures/5k.png +0 -0
- data/spec/fixtures/test.flv +0 -0
- data/spec/lib/asset_tags_spec.rb +107 -0
- data/spec/lib/frame_grab_spec.rb +17 -0
- data/spec/lib/geometry_transformation_spec.rb +63 -0
- data/spec/models/asset_spec.rb +72 -0
- data/spec/models/asset_type_spec.rb +70 -0
- data/spec/models/post_processing_spec.rb +62 -0
- data/spec/spec.opts +7 -0
- data/spec/spec_helper.rb +36 -0
- data/wireframes/edit-page-assets-2.bmml +453 -0
- data/wireframes/edit-page-assets-2.png +0 -0
- data/wireframes/edit-page-assets-3.bmml +454 -0
- data/wireframes/edit-page-assets-3.png +0 -0
- data/wireframes/edit-page-assets.bmml +433 -0
- data/wireframes/edit-page-assets.png +0 -0
- data/wireframes/edit-page.bmml +174 -0
- data/wireframes/edit-page.png +0 -0
- metadata +281 -0
@@ -0,0 +1,241 @@
|
|
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 :named_scope, plural.to_sym, :conditions => condition
|
38
|
+
Asset.send :named_scope, "not_#{plural}".to_sym, :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 "/images/admin/assets/#{icon_name}_#{style_name.to_s}.png"
|
52
|
+
else
|
53
|
+
return "/images/admin/assets/#{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
|
+
Radiant.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
|
+
:native => { :geometry => "", :format => :jpg },
|
132
|
+
:icon => { :geometry => '42x42#', :format => :png },
|
133
|
+
:thumbnail => { :geometry => '100x100#', :format => :png }
|
134
|
+
}
|
135
|
+
end
|
136
|
+
|
137
|
+
# Paperclip styles are defined in the config entry `assets.thumbnails.asset_type`, with the format:
|
138
|
+
# foo:key-x,key=y,key=z|bar:key-x,key=y,key=z
|
139
|
+
# where 'key' can be any parameter understood by your paperclip processors. Usually they include :geometry and :format.
|
140
|
+
# A typical entry would be:
|
141
|
+
#
|
142
|
+
# standard:geometry=640x640>,format=jpg
|
143
|
+
#
|
144
|
+
# This method parses that string and returns the defined styles as a hash of style-defining strings that will later be normalized into hashes.
|
145
|
+
#
|
146
|
+
def configured_styles
|
147
|
+
@configured_styles ||= if style_definitions = Radiant.config["assets.thumbnails.#{name}"]
|
148
|
+
style_definitions.split('|').each_with_object({}) do |definition, styles|
|
149
|
+
name, rule = definition.split(':')
|
150
|
+
styles[name.strip.to_sym] = rule.to_s.strip
|
151
|
+
end
|
152
|
+
else
|
153
|
+
{}
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
def legacy_styles
|
158
|
+
Radiant::config["assets.additional_thumbnails"].to_s.gsub(' ','').split(',').collect{|s| s.split('=')}.inject({}) {|ha, (k, v)| ha[k.to_sym] = v; ha}
|
159
|
+
end
|
160
|
+
|
161
|
+
def style_dimensions(style_name)
|
162
|
+
if style = paperclip_styles[style_name.to_sym]
|
163
|
+
style[:size]
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def define_radius_tags
|
168
|
+
type = self.name
|
169
|
+
Page.class_eval {
|
170
|
+
tag "asset:if_#{type}" do |tag|
|
171
|
+
tag.expand if find_asset(tag, tag.attr.dup).send("#{type}?".to_sym)
|
172
|
+
end
|
173
|
+
tag "asset:unless_#{type}" do |tag|
|
174
|
+
tag.expand unless find_asset(tag, tag.attr.dup).send("#{type}?".to_sym)
|
175
|
+
end
|
176
|
+
}
|
177
|
+
end
|
178
|
+
|
179
|
+
# class methods
|
180
|
+
|
181
|
+
def self.for(attachment)
|
182
|
+
extension = File.extname(attachment.original_filename).sub(/^\.+/, "")
|
183
|
+
from_extension(extension) || from_mimetype(attachment.instance_read(:content_type)) || catchall
|
184
|
+
end
|
185
|
+
|
186
|
+
def self.from_extension(extension)
|
187
|
+
@@extension_lookup[extension]
|
188
|
+
end
|
189
|
+
|
190
|
+
def self.from_mimetype(mimetype)
|
191
|
+
@@mime_lookup[mimetype]
|
192
|
+
end
|
193
|
+
|
194
|
+
def self.catchall
|
195
|
+
@@default_type ||= self.find(:other)
|
196
|
+
end
|
197
|
+
|
198
|
+
def self.known?(name)
|
199
|
+
!self.find(name).nil?
|
200
|
+
end
|
201
|
+
|
202
|
+
def self.slice(*types)
|
203
|
+
@@type_lookup.slice(*types.map(&:to_sym)).values if types # Hash#slice is provided by will_paginate
|
204
|
+
end
|
205
|
+
|
206
|
+
def self.find(type)
|
207
|
+
@@type_lookup[type] if type
|
208
|
+
end
|
209
|
+
def self.[](type)
|
210
|
+
find(type)
|
211
|
+
end
|
212
|
+
|
213
|
+
def self.all
|
214
|
+
@@types
|
215
|
+
end
|
216
|
+
|
217
|
+
def self.known_types
|
218
|
+
@@types.map(&:name) # to preserve order
|
219
|
+
end
|
220
|
+
|
221
|
+
def self.known_mimetypes
|
222
|
+
@@mime_lookup.keys
|
223
|
+
end
|
224
|
+
|
225
|
+
def self.mime_types_for(*names)
|
226
|
+
names.collect{ |name| find(name).mime_types }.flatten
|
227
|
+
end
|
228
|
+
|
229
|
+
def self.conditions_for(*names)
|
230
|
+
names.collect{ |name| self.find(name).sanitized_condition }.join(' OR ')
|
231
|
+
end
|
232
|
+
|
233
|
+
def self.non_other_condition
|
234
|
+
["asset_content_type IN (#{known_mimetypes.map{'?'}.join(',')})", *known_mimetypes]
|
235
|
+
end
|
236
|
+
|
237
|
+
def self.other_condition
|
238
|
+
["NOT asset_content_type IN (#{known_mimetypes.map{'?'}.join(',')})", *known_mimetypes]
|
239
|
+
end
|
240
|
+
|
241
|
+
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,33 @@
|
|
1
|
+
- group_assets ||= @assets.group_by{|i| i.group}
|
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
|
+
- group_assets.each do |group, assets|
|
13
|
+
%h2 #{"Group: " + group.to_s}
|
14
|
+
%ul
|
15
|
+
- assets.each_with_index do |asset, index|
|
16
|
+
- asset_type = asset.image? ? "image" : "link"
|
17
|
+
%li{:class => "#{asset_type} asset", :id => "asset_#{asset.id}"}
|
18
|
+
.front
|
19
|
+
.thumbnail= image_tag asset.thumbnail(:thumbnail)
|
20
|
+
.back
|
21
|
+
.title
|
22
|
+
= asset.title
|
23
|
+
%ul.actions
|
24
|
+
- if @page
|
25
|
+
%li= asset_insertion_link(asset)
|
26
|
+
%li= asset_attachment_link(asset)
|
27
|
+
- else
|
28
|
+
%li= link_to t('clipped_extension.edit'), admin_asset_path(asset), :class => 'edit'
|
29
|
+
%li= link_to t("clipped_extension.remove"), remove_admin_asset_path(asset), :class => "delete"
|
30
|
+
%p{:style => 'clear: both; height: 2em'}
|
31
|
+
|
32
|
+
- if with_pagination && assets.respond_to?(:total_pages) && assets.total_pages > 1
|
33
|
+
= 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,25 @@
|
|
1
|
+
= render_region :form_top
|
2
|
+
- render_region :form do |form|
|
3
|
+
- form.edit_title do
|
4
|
+
%p.title
|
5
|
+
%label{ :for => "asset_title" }
|
6
|
+
= t("clipped_extension.title")
|
7
|
+
= f.text_field :title, :class => 'textbox', :maxlength => 100
|
8
|
+
%p.group
|
9
|
+
%label{ :for => "asset_group" }
|
10
|
+
= t("clipped_extension.group")
|
11
|
+
= f.text_field :group, :class => 'textbox', :maxlength => 100
|
12
|
+
- form.edit_metadata do
|
13
|
+
.drawer
|
14
|
+
.drawer_contents#attributes
|
15
|
+
%table.fieldset
|
16
|
+
%tr
|
17
|
+
%th.label
|
18
|
+
%label{ :for => "asset_caption" }
|
19
|
+
= t("clipped_extension.caption")
|
20
|
+
%td.field
|
21
|
+
= f.text_field :caption, :class => 'textbox', :maxlength => 255
|
22
|
+
= render_region :extended_metadata, :locals => {:f => f}
|
23
|
+
.drawer_handle
|
24
|
+
%a.toggle.more{:href=>'#attributes', :rel=>"toggle[attributes]"}
|
25
|
+
= 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", :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,41 @@
|
|
1
|
+
- include_stylesheet '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
|
+
%p
|
15
|
+
%label.filename
|
16
|
+
= "#{t("clipped_extension.filename")}: #{@asset.asset_file_name unless @asset.new_record?}"
|
17
|
+
%p.asset
|
18
|
+
- display_size = Radiant::config['assets.display_size'] || 'normal'
|
19
|
+
= image_tag @asset.thumbnail(display_size.to_sym), :class => 'preview'
|
20
|
+
|
21
|
+
= updated_stamp @asset
|
22
|
+
= text_field_tag "", @asset.thumbnail, :style => "width: 550px"
|
23
|
+
|
24
|
+
%p.upload
|
25
|
+
%label.upload
|
26
|
+
= t("clipped_extension.replace_file")
|
27
|
+
= f.file_field :asset, :class => "", :style => "width: 100%"
|
28
|
+
|
29
|
+
.buttons
|
30
|
+
= save_model_button(@asset)
|
31
|
+
= save_model_and_continue_editing_button(@asset)
|
32
|
+
= t("or")
|
33
|
+
= link_to t("cancel"), admin_assets_path
|
34
|
+
|
35
|
+
- main.edit_regenerate do
|
36
|
+
- if current_user.admin? or current_user.designer?
|
37
|
+
%p= t("clipped_extension.regenerate_thumbnails")
|
38
|
+
|
39
|
+
- form_tag refresh_admin_asset_path(@asset), :method => :put do
|
40
|
+
%p.asset_buttons
|
41
|
+
%input.button{ :type => "submit", :value => t("clipped_extension.regenerate") }
|