dust-generators 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/lib/dust/version.rb +1 -1
  2. data/lib/generators/dust/albums/USAGE +8 -0
  3. data/lib/generators/dust/albums/albums_generator.rb +58 -0
  4. data/lib/generators/dust/albums/templates/albums_migration.rb +18 -0
  5. data/lib/generators/dust/albums/templates/app/controllers/albums_controller.rb +50 -0
  6. data/lib/generators/dust/albums/templates/app/controllers/photos_controller.rb +92 -0
  7. data/lib/generators/dust/albums/templates/app/controllers/view_albums_controller.rb +18 -0
  8. data/lib/generators/dust/albums/templates/app/helpers/albums_helper.rb +2 -0
  9. data/lib/generators/dust/albums/templates/app/helpers/photos_helper.rb +2 -0
  10. data/lib/generators/dust/albums/templates/app/helpers/view_albums_helper.rb +2 -0
  11. data/lib/generators/dust/albums/templates/app/models/album.rb +48 -0
  12. data/lib/generators/dust/albums/templates/app/models/photo.rb +18 -0
  13. data/lib/generators/dust/albums/templates/app/views/albums/_form.html.erb +22 -0
  14. data/lib/generators/dust/albums/templates/app/views/albums/_search.html.erb +6 -0
  15. data/lib/generators/dust/albums/templates/app/views/albums/_upload_script.html.erb +39 -0
  16. data/lib/generators/dust/albums/templates/app/views/albums/edit.html.erb +5 -0
  17. data/lib/generators/dust/albums/templates/app/views/albums/index.html.erb +61 -0
  18. data/lib/generators/dust/albums/templates/app/views/albums/new.html.erb +6 -0
  19. data/lib/generators/dust/albums/templates/app/views/albums/show.html.erb +44 -0
  20. data/lib/generators/dust/albums/templates/app/views/albums/show.js.erb +0 -0
  21. data/lib/generators/dust/albums/templates/app/views/photos/_form.html.erb +22 -0
  22. data/lib/generators/dust/albums/templates/app/views/photos/_photo.html.erb +23 -0
  23. data/lib/generators/dust/albums/templates/app/views/photos/edit.html.erb +28 -0
  24. data/lib/generators/dust/albums/templates/app/views/photos/index.html.erb +80 -0
  25. data/lib/generators/dust/albums/templates/app/views/photos/new.html.erb +7 -0
  26. data/lib/generators/dust/albums/templates/app/views/photos/show.html.erb +26 -0
  27. data/lib/generators/dust/albums/templates/app/views/photos/show.js.erb +9 -0
  28. data/lib/generators/dust/albums/templates/app/views/view_albums/index.html.erb +20 -0
  29. data/lib/generators/dust/albums/templates/app/views/view_albums/show.html.erb +20 -0
  30. data/lib/generators/dust/albums/templates/dust_album.css +11 -0
  31. data/lib/generators/dust/albums/templates/images/browse.png +0 -0
  32. data/lib/generators/dust/albums/templates/images/cancel.png +0 -0
  33. data/lib/generators/dust/albums/templates/images/upload.png +0 -0
  34. data/lib/generators/dust/albums/templates/initializers/flash_session_cookie_middleware.rb +19 -0
  35. data/lib/generators/dust/albums/templates/initializers/session_store_middleware.rb +5 -0
  36. data/lib/generators/dust/albums/templates/jquery-1.4.2.js +6240 -0
  37. data/lib/generators/dust/albums/templates/photos_migration.rb +20 -0
  38. data/lib/generators/dust/albums/templates/uploadify/jquery.uploadify.v2.1.0.js +258 -0
  39. data/lib/generators/dust/albums/templates/uploadify/swfobject.js +4 -0
  40. data/lib/generators/dust/albums/templates/uploadify/uploadify.swf +0 -0
  41. data/lib/generators/dust/albums/templates/uploadify.css +84 -0
  42. data/lib/generators/dust/scaffold/scaffold_generator.rb +3 -2
  43. data/lib/generators/dust/scaffold/templates/controller.rb +7 -1
  44. data/lib/generators/dust/scaffold/templates/migration.rb +2 -0
  45. data/lib/generators/dust/scaffold/templates/model.rb +3 -2
  46. data/lib/generators/dust/scaffold/templates/views/erb/_form.html.erb +4 -4
  47. data/lib/generators/dust/scaffold/templates/views/erb/_search.html.erb +1 -1
  48. data/lib/generators/dust/scaffold/templates/views/erb/edit.html.erb +1 -1
  49. data/lib/generators/dust/scaffold/templates/views/erb/index.html.erb +6 -6
  50. data/lib/generators/dust/scaffold/templates/views/erb/show.html.erb +5 -4
  51. metadata +43 -3
data/lib/dust/version.rb CHANGED
@@ -2,7 +2,7 @@ class Dust
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 2
5
+ PATCH = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate install Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,58 @@
1
+ require 'rails/generators/active_record'
2
+
3
+ module Dust
4
+ module Generators
5
+ class AlbumsGenerator < ActiveRecord::Generators::Base
6
+ desc "Create all migrations and copy all files for Dust Albums."
7
+
8
+ def self.source_root
9
+ @source_root ||= File.expand_path('../templates', __FILE__)
10
+ end
11
+
12
+ def create_migration
13
+ route("resources :albums")
14
+ route("resources :photos")
15
+ migration_template "albums_migration.rb", "db/migrate/create_albums.rb"
16
+ migration_template "photos_migration.rb", "db/migrate/create_photos.rb"
17
+ end
18
+
19
+ def generate_static_files
20
+ copy_file "app/controllers/albums_controller.rb", "app/controllers/albums_controller.rb"
21
+ copy_file "app/controllers/photos_controller.rb", "app/controllers/photos_controller.rb"
22
+ copy_file "app/controllers/view_albums_controller.rb", "app/controllers/view_albums_controller.rb"
23
+
24
+ copy_file "app/helpers/albums_helper.rb", "app/helpers/albums_helper.rb"
25
+ copy_file "app/helpers/photos_helper.rb", "app/helpers/photos_helper.rb"
26
+ copy_file "app/helpers/view_albums_helper.rb", "app/helpers/view_albums_helper.rb"
27
+
28
+ copy_file "app/models/album.rb", "app/models/album.rb"
29
+ copy_file "app/models/photo.rb", "app/models/photo.rb"
30
+
31
+ directory "app/views/albums", "app/views/albums"
32
+ directory "app/views/photos", "app/views/photos"
33
+ directory "app/views/view_albums", "app/views/view_albums"
34
+
35
+ copy_file "dust_album.css", "public/stylesheets/dust_album.css"
36
+ copy_file "uploadify.css", "public/stylesheets/uploadify.css"
37
+
38
+ copy_file "initializers/flash_session_cookie_middleware.rb", "config/initializers/flash_session_cookie_middleware.rb"
39
+ copy_file "initializers/session_store_middleware.rb", "config/initializers/session_store_middleware.rb"
40
+
41
+ copy_file "jquery-1.4.2.js", "public/javascripts/jquery-1.4.2.js"
42
+
43
+ copy_file "images/cancel.png", "public/images/cancel.png"
44
+ copy_file "images/browse.png", "public/images/browse.png"
45
+ copy_file "images/upload.png", "public/images/upload.png"
46
+
47
+ copy_file "dust_album.css", "public/stylesheets/dust_album.css"
48
+ copy_file "uploadify.css", "public/stylesheets/uploadify.css"
49
+
50
+ directory "uploadify", "public/javascripts/uploadify"
51
+ end
52
+
53
+ def rake_migrations
54
+ rake("db:migrate")
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,18 @@
1
+ class CreateAlbums < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :albums do |t|
4
+ t.string :title
5
+ t.string :filename
6
+ t.text :desc
7
+ t.boolean :active
8
+ t.timestamps
9
+ end
10
+
11
+ CmsMenuItem.create({:title =>"Albums", :controller_name => "albums", :url => "/albums"})
12
+
13
+ end
14
+
15
+ def self.down
16
+ drop_table :albums
17
+ end
18
+ end
@@ -0,0 +1,50 @@
1
+ class AlbumsController < ApplicationController
2
+
3
+ filter_resource_access
4
+
5
+ layout 'cms'
6
+
7
+ def index
8
+ @albums = Album.page(params[:search], params[:page])
9
+ end
10
+
11
+ def show
12
+ @album = Album.find(params[:id], :include => :photos)
13
+ @new_photo = Photo.new(:album_id => @album.id)
14
+ end
15
+
16
+ def new
17
+ @album = Album.new
18
+ end
19
+
20
+ def create
21
+ @album = Album.new(params[:album])
22
+ if @album.save
23
+ flash[:notice] = "Successfully created album."
24
+ redirect_to @album
25
+ else
26
+ render :action => 'new'
27
+ end
28
+ end
29
+
30
+ def edit
31
+ @album = Album.find(params[:id])
32
+ end
33
+
34
+ def update
35
+ @album = Album.find(params[:id])
36
+ if @album.update_attributes(params[:album])
37
+ flash[:notice] = "Successfully updated album."
38
+ redirect_to @album
39
+ else
40
+ render :action => 'edit'
41
+ end
42
+ end
43
+
44
+ def destroy
45
+ @album = Album.find(params[:id])
46
+ @album.destroy
47
+ flash[:notice] = "Successfully destroyed album."
48
+ redirect_to albums_url
49
+ end
50
+ end
@@ -0,0 +1,92 @@
1
+ class PhotosController < ApplicationController
2
+
3
+ filter_access_to :index, :new, :create, :destroy
4
+ filter_access_to :edit, :update, :attribute_check => true
5
+
6
+ layout 'cms'
7
+
8
+ def index
9
+ @photos = Photo.page(params[:search], params[:page])
10
+ @photo_albums = @photos.group_by { |photo| photo.album.title }
11
+ end
12
+
13
+ def show
14
+ @photo = Photo.find(params[:id], :include => :album)
15
+ @total_uploads = Photo.find(:all, :conditions => { :album_id => @photo.album.id})
16
+ end
17
+
18
+ def new
19
+ @photo = Photo.new
20
+ end
21
+
22
+ def create
23
+ newparams = coerce(params)
24
+ @photo = Photo.new(newparams[:photo])
25
+ if @photo.save
26
+ flash[:notice] = "Successfully created photo."
27
+ respond_to do |format|
28
+ format.html { redirect_to @photo.album }
29
+ format.json { render :json => { :result => 'success', :photo => photo_url(@photo) } }
30
+ end
31
+ else
32
+ render :action => 'new'
33
+ end
34
+ end
35
+
36
+ def edit
37
+ if params[:edit] == 'photo'
38
+ render :layout => false
39
+ @photo = Photo.find(params[:id])
40
+ else
41
+ @photo = Photo.find(params[:id])
42
+ end
43
+ end
44
+
45
+ def update
46
+ @photo = Photo.find(params[:id])
47
+ if @photo.update_attributes(params[:photo])
48
+ flash[:notice] = "Successfully updated photo."
49
+ respond_to do |format|
50
+ format.html { redirect_to album_url(@photo.album)}
51
+ format.js { render :json => { :result => 'success', :album => album_url(@photo.album) } }
52
+ end
53
+ else
54
+ render :action => 'edit'
55
+ end
56
+ end
57
+
58
+ def destroy
59
+ if request.post?
60
+ if params[:photo_ids]
61
+ params[:photo_ids].each do |photo|
62
+ @photo = Photo.find photo
63
+ @photo.destroy
64
+ end
65
+ flash[:notice] = "Photos Successfully deleted!"
66
+ end
67
+ respond_to do |format|
68
+ if Photo.all.blank?
69
+ format.html { redirect_to(albums_url) }
70
+ else
71
+ format.html { redirect_to(:back) }
72
+ end
73
+ end
74
+ end
75
+ end
76
+
77
+ private
78
+ def coerce(params)
79
+ if params[:photo].nil?
80
+ h = Hash.new
81
+ h[:photo] = Hash.new
82
+ h[:photo][:album_id] = params[:album_id]
83
+ h[:photo][:title] = params[:title]
84
+ h[:photo][:file] = params[:Filedata]
85
+ h[:photo][:file].content_type = MIME::Types.type_for(h[:photo][:file].original_filename).to_s
86
+ h
87
+ else
88
+ params
89
+ end
90
+ end
91
+
92
+ end
@@ -0,0 +1,18 @@
1
+ class ViewAlbumsController < ApplicationController
2
+ unloadable
3
+
4
+ def index
5
+ @albums = Album.page(params[:search], params[:page])
6
+ end
7
+
8
+ def show
9
+ if Album.find_by_filename(params[:filename]) == nil
10
+ @album = Album.find(:first)
11
+ render :file => "#{RAILS_ROOT}/public/404.html", :layout => false, :status => 404
12
+ else
13
+ @album = Album.find_by_filename(params[:filename])
14
+ @photos = @album.photos.page(params[:search], params[:page])
15
+ end
16
+ end
17
+
18
+ end
@@ -0,0 +1,2 @@
1
+ module AlbumsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module PhotosHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module ViewAlbumsHelper
2
+ end
@@ -0,0 +1,48 @@
1
+ class Album < ActiveRecord::Base
2
+
3
+ has_many :photos, :dependent => :destroy
4
+
5
+ validates_presence_of :title
6
+ validates_presence_of :filename
7
+ validates_uniqueness_of :filename
8
+
9
+ def self.page(search, page)
10
+ with_permissions_to(:manage).search(search).order("title").paginate(:per_page => 10, :page => page)
11
+ end
12
+
13
+ def self.search(search)
14
+ if search
15
+ where("title LIKE ?", "%#{search}%")
16
+ else
17
+ scoped
18
+ end
19
+ end
20
+
21
+ has_one :menu_item, :as => :linkable, :dependent => :destroy
22
+
23
+ after_create :create_menu_item
24
+ after_update :update_menu_item
25
+
26
+ def update_menu_item
27
+ @menu_item = self.menu_item
28
+ if @menu_item == nil
29
+ self.create_menu_item
30
+ else
31
+ @menu_item.update_attributes(
32
+ :title => self.title,
33
+ :url => "/photos-for/#{self.filename}",
34
+ :active => self.active
35
+ )
36
+ end
37
+ end
38
+
39
+ def create_menu_item
40
+ @menu_item = self.build_menu_item(
41
+ :title => self.title,
42
+ :url => "/photos-for/#{self.filename}",
43
+ :active => self.active
44
+ )
45
+ @menu_item.save
46
+ end
47
+
48
+ end
@@ -0,0 +1,18 @@
1
+ class Photo < ActiveRecord::Base
2
+ belongs_to :album
3
+ has_attached_file :file, :styles => { :medium => "300x300>", :thumb => "100x100>" }
4
+ validates_presence_of :album
5
+
6
+ def self.page(search, page)
7
+ with_permissions_to(:manage).search(search).order("title").paginate(:per_page => 20, :page => page)
8
+ end
9
+
10
+ def self.search(search)
11
+ if search
12
+ where("title LIKE ?", "%#{search}%")
13
+ else
14
+ scoped
15
+ end
16
+ end
17
+
18
+ end
@@ -0,0 +1,22 @@
1
+ <%= stylesheet( 'dust_album','uploadify') %>
2
+
3
+ <% form_for @album, :validations => true do |f| %>
4
+ <%= f.error_messages %>
5
+ <p>
6
+ <%= f.label :title %><br />
7
+ <%= f.text_field :title, :class => 'field' %>
8
+ </p>
9
+ <p>
10
+ <%= f.label :filename %><br />
11
+ <%= f.text_field :filename, :class => 'field' %>
12
+ </p>
13
+ <p>
14
+ <%= f.label :desc %><br />
15
+ <%= f.text_area :desc, :class => 'field' %>
16
+ </p>
17
+ <p>
18
+ <%= f.label :active %>
19
+ <%= f.check_box :active %>
20
+ </p>
21
+ <p><%= f.submit %></p>
22
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <div id="searchbox">
2
+ <%= form_tag albums_path, :method => 'get' do %>
3
+ <%= text_field_tag :search, params[:search], :class => "input-text", :placeholder => 'Search Albums' %>
4
+ <%= image_submit_tag "admin/blank.png", :class => "image-submit"%>
5
+ <% end %>
6
+ </div>
@@ -0,0 +1,39 @@
1
+
2
+ <%= javascript_include_tag "uploadify/swfobject", "uploadify/jquery.uploadify.v2.1.0" %>
3
+ <%- session_key = Rails.application.config.session_options[:key] -%>
4
+ <script type="text/javascript" charset="utf-8">
5
+
6
+ $(document).ready(function() {
7
+ $('#photo_file').click(function(event) {
8
+ event.preventDefault();
9
+ });
10
+
11
+ $('#photo_file').uploadify({
12
+ 'uploader' : '/javascripts/uploadify/uploadify.swf',
13
+ 'script' : '/photos',
14
+ 'multi' : true,
15
+ 'auto' : false,
16
+ 'buttonText' : 'Find',
17
+ 'buttonImg' : '/images/browse.png',
18
+ 'cancelImg' : '/images/cancel.png',
19
+ 'wmode' : 'transparent',
20
+ height : 26, // The height of the flash button
21
+ width : 101, // The width of the flash button
22
+ onComplete : function(event, queueID, fileObj, response, data) { var dat = eval('(' +
23
+ response + ')');$.getScript(dat.photo);},
24
+ scriptData: {
25
+ '_http_accept': 'application/javascript',
26
+ 'format' : 'json',
27
+ '_method': 'post',
28
+ '<%= session_key %>' : encodeURIComponent('<%= u cookies[session_key] %>'),
29
+ 'authenticity_token': encodeURIComponent('<%= u form_authenticity_token %>'),
30
+ 'album_id' : '<%= @album.id %>'
31
+ }
32
+ });
33
+
34
+ $('#photo_submit').click(function(event){
35
+ event.preventDefault();
36
+ $('#photo_file').uploadifyUpload();
37
+ });
38
+ });
39
+ </script>
@@ -0,0 +1,5 @@
1
+ <% title "Edit Album" %>
2
+
3
+ <%= stylesheet( 'dust_album','uploadify') %>
4
+
5
+ <%= render :partial => 'form' %>
@@ -0,0 +1,61 @@
1
+ <% title "Albums" %>
2
+ <% heading "Albums" %>
3
+
4
+ <%= stylesheet 'dust_album', 'uploadify' %>
5
+
6
+ <div class="button_bar">
7
+ <%= render :partial => 'albums/search' %>
8
+ <%=link_to 'new page', new_album_path, :class => 'newfile tip', :title => "New Album" %>
9
+ </div>
10
+
11
+ <div class='photolist'>
12
+
13
+ <%= will_paginate @albums %>
14
+
15
+ <table class="photos">
16
+ <tr style='color:#222;'>
17
+ <th></th>
18
+ <th>
19
+ Album Title
20
+ </th>
21
+ <th>
22
+ Created At
23
+ </th>
24
+ <th></th>
25
+ </tr>
26
+ <% @albums.each do |album| %>
27
+ <tr class='<%= cycle('odd', 'even')%>'>
28
+
29
+ <td>
30
+ <% if album.photos.empty? %>
31
+ <%= link_to "add photos to #{album.title}", album %>
32
+ <% else %>
33
+ <% @photo = album.photos.find(:first) %>
34
+ <%= link_to image_tag(@photo.file.url(:thumb)), album %>
35
+ <% end -%>
36
+ </td>
37
+ <td>
38
+ <%= album.title%>
39
+ </td>
40
+ <td>
41
+ <%= album.created_at.to_s(:m_d_y) %>
42
+ </td>
43
+ <td>
44
+ <div style='float:right'>
45
+ <%=link_to '', edit_album_path(album), :class => 'edit' %>
46
+ <%=link_to "", album, :confirm => 'Are you sure?', :method => :delete, :class => 'destroy' %>
47
+ </div>
48
+ </td>
49
+ </tr>
50
+ <% end %>
51
+
52
+ </table>
53
+
54
+
55
+ </div>
56
+
57
+ <div class="clear"></div>
58
+
59
+ <%= will_paginate @albums %>
60
+
61
+
@@ -0,0 +1,6 @@
1
+ <% title "New Album" %>
2
+
3
+ <%= stylesheet( 'dust_album','uploadify') %>
4
+
5
+ <%= render :partial => 'form' %>
6
+
@@ -0,0 +1,44 @@
1
+ <% title h(@album.title) %>
2
+ <% heading h(@album.title.titleize) %>
3
+
4
+ <%= stylesheet( 'dust_album','uploadify') %>
5
+
6
+ <%= render :partial => "upload_script" %>
7
+
8
+ <div class="item">
9
+
10
+ <div class='manage'>
11
+ <%= link_to "", edit_album_path(@album), :class => 'edit' %>
12
+ <%= link_to "", @album, :confirm => 'Are you sure?', :method => :delete, :class => 'destroy' %>
13
+ </div>
14
+
15
+ <%= simple_format(h(@album.desc)) %>
16
+ </div>
17
+
18
+ <div class="item">
19
+
20
+ <h3 id="photos_count"><%= pluralize(@album.photos.size, "Photo")%> <% unless @album.photos.empty? %> | <%= link_to "Manage Photos", photos_path %> <% end %></h3>
21
+ <div id="uploads">
22
+ <%= render @album.photos %>
23
+ </div>
24
+
25
+ <div class="clear"></div>
26
+
27
+ </div>
28
+
29
+ <% content_for :left do -%>
30
+
31
+ <div id="uploadify">
32
+ <h3>Add Photos to <%= @album.title.titleize %></h3>
33
+ <% form_for @new_photo, :html => {:multipart => true} do |f| %>
34
+
35
+ <%= f.hidden_field :album_id, "value" => @album.id %>
36
+ <div class="uploadifyButtons">
37
+ <%= image_submit_tag "Upload.png", :id => "photo_submit", :name => 'commit' %> <%= f.file_field :file %>
38
+ <div class='clear'></div>
39
+ </div>
40
+ <% end %>
41
+ </div>
42
+
43
+ <% end -%>
44
+
@@ -0,0 +1,22 @@
1
+ <%= stylesheet( 'dust_album','uploadify') %>
2
+
3
+ <% form_for @photo, :validations => true do |f| %>
4
+ <%= f.error_messages %>
5
+ <p>
6
+ <%= f.label :title %><br />
7
+ <%= f.text_field :title %>
8
+ </p>
9
+ <p>
10
+ <%= f.label :desc %><br />
11
+ <%= f.text_area :desc %>
12
+ </p>
13
+ <p>
14
+ <%= f.label :date_shot %><br />
15
+ <%= f.date_select :date_shot %>
16
+ </p>
17
+ <p>
18
+ <%= f.label :location %><br />
19
+ <%= f.text_field :location %>
20
+ </p>
21
+ <p><%= f.submit %></p>
22
+ <% end %>
@@ -0,0 +1,23 @@
1
+ <div class="photo">
2
+ <script type="text/javascript" charset="utf-8">
3
+ $("a.settings").fancybox({
4
+ 'showCloseButton' : false,
5
+ 'transitionIn' : 'elastic',
6
+ 'transitionOut' : 'elastic',
7
+ 'speedIn' : 400,
8
+ 'speedOut' : 200,
9
+ 'hideOnContentClick': false,
10
+ 'overlayOpacity' : 0.6,
11
+ 'overlayColor' : '#000',
12
+ 'opacity' : 'true'
13
+ });
14
+ </script>
15
+ <%= image_tag photo.file.url(:thumb), :height => '50' %>
16
+ <p>
17
+ <%= photo.title %> <br />
18
+ <% unless photo.date_shot.blank? %>
19
+ (<%= photo.date_shot %>)
20
+ <% end -%>
21
+ <%= link_to "Edit Photo", edit_photo_path(photo, :format => :html, :edit => 'photo'), :class => "settings", :title => "Photo Settings" %>
22
+ </p>
23
+ </div>
@@ -0,0 +1,28 @@
1
+ <% title "Edit Photo" %>
2
+
3
+ <% if params[:edit] == 'photo' %>
4
+ <script type="text/javascript" charset="utf-8">
5
+
6
+ var options = {
7
+ success: showFlash,
8
+ data: {format: 'js'},
9
+ clearForm: true
10
+ };
11
+
12
+ $('.edit_photo').ajaxForm(options);
13
+
14
+ $("#photo_submit").click(function () {
15
+ $("#fancybox-inner").fadeTo("slow", 0.1);
16
+ $.fancybox.showActivity();
17
+ });
18
+
19
+ function showFlash() {
20
+ $("#status").html("Success, Your settings have been saved");
21
+ $('#status').fadeIn().delay(2000).slideUp('slow');
22
+ $.fancybox.close();
23
+ $("#fancybox-inner").fadeTo("slow", 1);
24
+ }
25
+ </script>
26
+ <% end -%>
27
+
28
+ <%= render :partial => 'form' %>