Sha256: 4d4782358297183b960ec944594b0a70f549b47f74abe56569b44bd6754c7c0d
Contents?: true
Size: 1.25 KB
Versions: 2
Compression:
Stored size: 1.25 KB
Contents
= Sunrise CMS: File uploader == Install rails generate sunrise:file_upload:install == Callbacks Sunrise::FileUpload::Manager.before_create do |env, asset| asset.user = env['warden'].user if env['warden'] end Sunrise::FileUpload::Manager.after_create do |env, asset| asset.user = env['warden'].user if env['warden'] end == Usage class User < ActiveRecord::Base has_one :picture, :as => :assetable, :dependent => :destroy fileuploads :picture end Find asset by foreign key or guid: @user.fileupload_asset(:picture) === Views <%= stylesheet_link_tag "/javascripts/fileupload/fileuploader.css" %> <%= javascript_include_tag :fileupload, "jquery.tmpl.min" %> <%= form.fileupload :picture %> <%= form.hidden_field :fileupload_guid if form.object.new_record? %> <script id="fileupload_tmpl" type="text/x-jquery-tmpl"> <div class="fileupload-container"> <div class="fileupload-preview"><img alt="Фото" src="/images/userico.jpg"></div> <div class="fileupload-button"><input type="image" value="Оберіть фаіл" src="/images/but_set.png"></div> <ul class="fileupload-list" style="display:none;"></ul> </div> </script> Copyright (c) 2011 Aimbulance, released under the MIT license
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sunrise-file-upload-0.1.4 | README.rdoc |
sunrise-file-upload-0.1.3 | README.rdoc |