muck-contents 0.1.12 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +122 -15
- data/VERSION +1 -1
- data/app/controllers/muck/tiny_mce_controller.rb +47 -0
- data/app/helpers/tinymce_helper.rb +23 -8
- data/app/views/contents/_form.html.erb +1 -2
- data/app/views/contents/new.html.erb +1 -0
- data/app/views/layouts/tiny_mce.html.erb +25 -0
- data/app/views/tiny_mce/files.html.erb +136 -0
- data/app/views/tiny_mce/images.html.erb +312 -0
- data/{public/javascripts/tiny_mce/plugins/advlinktoo/link.htm → app/views/tiny_mce/links.html.erb} +328 -344
- data/config/muck_contents_routes.rb +6 -0
- data/lib/action_controller/acts/muck_content_handler.rb +1 -1
- data/locales/en.yml +2 -0
- data/muck-contents.gemspec +153 -25
- data/public/{javascripts/tiny_mce/plugins/advimagetoo/img → images/tinymce}/sample.gif +0 -0
- data/public/{javascripts/tiny_mce/plugins/advfiletoo/img → images/tinymce}/upload.gif +0 -0
- data/public/javascripts/tiny_mce/plugins/advfiletoo/editor_plugin.js +9 -22
- data/public/javascripts/tiny_mce/plugins/advfiletoo/editor_plugin_src.js +41 -54
- data/public/javascripts/tiny_mce/plugins/advfiletoo/js/functions.js +0 -139
- data/public/javascripts/tiny_mce/plugins/advimagetoo/editor_plugin.js +9 -17
- data/public/javascripts/tiny_mce/plugins/advimagetoo/editor_plugin_src.js +40 -50
- data/public/javascripts/tiny_mce/plugins/advimagetoo/js/functions.js +0 -152
- data/public/javascripts/tiny_mce/plugins/advlinktoo/editor_plugin.js +3 -14
- data/public/javascripts/tiny_mce/plugins/advlinktoo/editor_plugin_src.js +3 -14
- data/public/{javascripts/tiny_mce/plugins/advfiletoo/css/advfile.css → stylesheets/tinymce.css} +33 -12
- data/test/rails_root/Rakefile +2 -1
- data/test/rails_root/app/controllers/uploads_controller.rb +57 -0
- data/test/rails_root/app/models/upload.rb +94 -0
- data/test/rails_root/app/models/user.rb +5 -0
- data/test/rails_root/config/environment.rb +2 -0
- data/test/rails_root/config/initializers/mce_options.rb +12 -8
- data/test/rails_root/config/initializers/s3_credentials.rb +9 -0
- data/test/rails_root/db/migrate/{20090602041838_create_users.rb → 20090327231918_create_users.rb} +11 -10
- data/test/rails_root/db/migrate/20090402234137_create_languages.rb +18 -0
- data/test/rails_root/db/migrate/20090426041056_create_countries.rb +15 -0
- data/test/rails_root/db/migrate/20090426041103_create_states.rb +18 -0
- data/test/rails_root/db/migrate/{20090704220120_acts_as_taggable_on_migration.rb → 20090506000404_acts_as_taggable_on_migration.rb} +31 -29
- data/test/rails_root/db/migrate/20090517040220_create_uploads.rb +38 -0
- data/test/rails_root/db/migrate/20090730044139_add_comment_cache.rb +9 -0
- data/test/rails_root/db/migrate/20090818204527_add_activity_indexes.rb +9 -0
- data/test/rails_root/db/migrate/20090819030523_add_attachable_to_activities.rb +13 -0
- data/test/rails_root/lib/daemons/amazonaws.rb +36 -0
- data/test/rails_root/lib/tasks/muck.rake +7 -0
- data/test/rails_root/public/images/SWFUploadButton.png +0 -0
- data/test/rails_root/public/images/arrow_down.gif +0 -0
- data/test/rails_root/public/images/arrow_up.gif +0 -0
- data/test/rails_root/public/images/cancelbutton.gif +0 -0
- data/test/rails_root/public/images/fancybox/fancy_closebox.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_left.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_progress.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_right.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_e.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_n.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_ne.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_nw.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_s.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_se.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_sw.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_w.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_title_left.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_title_main.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_title_right.png +0 -0
- data/test/rails_root/public/images/file_icons/excel.gif +0 -0
- data/test/rails_root/public/images/file_icons/file.gif +0 -0
- data/test/rails_root/public/images/file_icons/file.png +0 -0
- data/test/rails_root/public/images/file_icons/file_aac.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_ai.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_avi.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_bin.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_bmp.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_cue.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_divx.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_doc.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_eps.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_flac.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_flv.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_gif.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_html.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_ical.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_indd.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_inx.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_iso.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_jpg.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_mov.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_mp3.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_mpg.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_pdf.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_php.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_png.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_pps.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_ppt.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_psd.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_qxd.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_qxp.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_raw.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_rtf.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_svg.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_tif.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_txt.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_vcf.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_wav.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_wma.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_xls.gif +0 -0
- data/test/rails_root/public/images/file_icons/file_xml.gif +0 -0
- data/test/rails_root/public/images/file_icons/mp3.gif +0 -0
- data/test/rails_root/public/images/file_icons/pdf.gif +0 -0
- data/test/rails_root/public/images/file_icons/pdf.png +0 -0
- data/test/rails_root/public/images/file_icons/text.gif +0 -0
- data/test/rails_root/public/images/file_icons/text.png +0 -0
- data/test/rails_root/public/images/file_icons/word.gif +0 -0
- data/test/rails_root/public/images/icons/blue_guy.png +0 -0
- data/test/rails_root/public/images/icons/button_background.png +0 -0
- data/test/rails_root/public/images/icons/cancel.png +0 -0
- data/test/rails_root/public/images/icons/close.png +0 -0
- data/test/rails_root/public/images/icons/comment.png +0 -0
- data/test/rails_root/public/images/icons/exclaim.png +0 -0
- data/test/rails_root/public/images/icons/external.png +0 -0
- data/test/rails_root/public/images/icons/feed.png +0 -0
- data/test/rails_root/public/images/icons/grey_guy.png +0 -0
- data/test/rails_root/public/images/icons/hide.png +0 -0
- data/test/rails_root/public/images/icons/information.png +0 -0
- data/test/rails_root/public/images/icons/minus.png +0 -0
- data/test/rails_root/public/images/icons/pending.png +0 -0
- data/test/rails_root/public/images/icons/question.png +0 -0
- data/test/rails_root/public/images/icons/search_box.png +0 -0
- data/test/rails_root/public/images/icons/star.png +0 -0
- data/test/rails_root/public/images/icons/stop.png +0 -0
- data/test/rails_root/public/images/icons/thumb_down.png +0 -0
- data/test/rails_root/public/images/icons/thumb_up.png +0 -0
- data/test/rails_root/public/images/nothing.png +0 -0
- data/test/rails_root/public/{javascripts/tiny_mce/plugins/advimagetoo/img → images/tinymce}/sample.gif +0 -0
- data/test/rails_root/public/{javascripts/tiny_mce/plugins/advfiletoo/img → images/tinymce}/upload.gif +0 -0
- data/test/rails_root/public/javascripts/jquery/colorpicker.js +450 -0
- data/test/rails_root/public/javascripts/jquery/jquery.autocomplete.js.readme +6 -0
- data/test/rails_root/public/javascripts/jquery/jquery.autocomplete.min.js +15 -0
- data/test/rails_root/public/javascripts/jquery/jquery.autocomplete.pack.js +767 -0
- data/test/rails_root/public/javascripts/jquery/jquery.easing.js +1 -0
- data/test/rails_root/public/javascripts/jquery/jquery.fancybox.js +9 -0
- data/test/rails_root/public/javascripts/jquery/jquery.metadata.min.js +13 -0
- data/test/rails_root/public/javascripts/jquery/jquery.queryString.js +33 -0
- data/test/rails_root/public/javascripts/jquery/jquery.swapimage.js +66 -0
- data/test/rails_root/public/javascripts/jquery/jquery.swapimage.min.js +11 -0
- data/test/rails_root/public/javascripts/jquery/jrails.js +1 -0
- data/test/rails_root/public/javascripts/muck.js +11 -6
- data/test/rails_root/public/javascripts/muck_activities.js +5 -6
- data/test/rails_root/public/javascripts/muck_time/en.js +53 -0
- data/test/rails_root/public/javascripts/swfupload/fileprogress.js +151 -0
- data/test/rails_root/public/javascripts/swfupload/handlers.js +201 -0
- data/test/rails_root/public/javascripts/swfupload/swfupload.cookies.js +53 -0
- data/test/rails_root/public/javascripts/swfupload/swfupload.js +980 -0
- data/test/rails_root/public/javascripts/swfupload/swfupload.queue.js +98 -0
- data/test/rails_root/public/javascripts/swfupload/swfupload.speed.js +342 -0
- data/test/rails_root/public/javascripts/swfupload/swfupload.swfobject.js +111 -0
- data/test/rails_root/public/javascripts/tiny_mce/plugins/advfiletoo/editor_plugin.js +9 -22
- data/test/rails_root/public/javascripts/tiny_mce/plugins/advfiletoo/editor_plugin_src.js +41 -54
- data/test/rails_root/public/javascripts/tiny_mce/plugins/advfiletoo/js/functions.js +0 -139
- data/test/rails_root/public/javascripts/tiny_mce/plugins/advimagetoo/editor_plugin.js +9 -17
- data/test/rails_root/public/javascripts/tiny_mce/plugins/advimagetoo/editor_plugin_src.js +40 -50
- data/test/rails_root/public/javascripts/tiny_mce/plugins/advimagetoo/image.htm +10 -9
- data/test/rails_root/public/javascripts/tiny_mce/plugins/advimagetoo/js/functions.js +0 -152
- data/test/rails_root/public/javascripts/tiny_mce/plugins/advlinktoo/editor_plugin.js +3 -14
- data/test/rails_root/public/javascripts/tiny_mce/plugins/advlinktoo/editor_plugin_src.js +3 -14
- data/test/rails_root/public/javascripts/tiny_mce/templates/example.htm +14 -0
- data/test/rails_root/public/javascripts/tree.js +107 -0
- data/test/rails_root/public/stylesheets/jquery/jquery.autocomplete.css +15 -0
- data/test/rails_root/public/stylesheets/jquery/jquery.fancybox.css +44 -0
- data/test/rails_root/public/stylesheets/muck-activities.css +39 -0
- data/test/rails_root/public/stylesheets/styles.css +10 -3
- data/test/rails_root/public/stylesheets/swfupload.css +26 -0
- data/test/rails_root/public/{javascripts/tiny_mce/plugins/advfiletoo/css/advfile.css → stylesheets/tinymce.css} +33 -12
- data/test/rails_root/public/system/locals/000/000/026/original/deploy-1.rb +75 -0
- metadata +153 -25
- data/public/javascripts/tiny_mce/plugins/advfiletoo/file.htm +0 -139
- data/public/javascripts/tiny_mce/plugins/advimagetoo/css/advimage.css +0 -32
- data/public/javascripts/tiny_mce/plugins/advimagetoo/image.htm +0 -303
- data/public/javascripts/tiny_mce/plugins/advlinktoo/css/advlink.css +0 -8
- data/test/rails_root/db/migrate/20090608073052_create_friends.rb +0 -16
- data/test/rails_root/db/migrate/20090808005918_add_scope_index_to_slugs.rb +0 -9
- data/test/rails_root/public/javascripts/tiny_mce/plugins/advfiletoo/file.htm +0 -139
- data/test/rails_root/public/javascripts/tiny_mce/plugins/advimagetoo/css/advimage.css +0 -32
- data/test/rails_root/public/javascripts/tiny_mce/templates/bio.htm +0 -31
- data/test/rails_root/public/javascripts/tiny_mce/templates/country.htm +0 -59
@@ -0,0 +1,57 @@
|
|
1
|
+
class UploadsController < Uploader::UploadsController
|
2
|
+
|
3
|
+
before_filter :login_required
|
4
|
+
before_filter :setup_parent, :only => [:index, :create, :swfupload, :photos, :files]
|
5
|
+
|
6
|
+
def index
|
7
|
+
@upload = Upload.new
|
8
|
+
@uploads = @parent.uploads.paginate(:page => @page, :per_page => @per_page, :order => 'created_at desc')
|
9
|
+
respond_to do |format|
|
10
|
+
format.html { render }
|
11
|
+
format.rss { render :layout => false }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def photos
|
16
|
+
@images = @parent.uploads.images.paginate(:page => @page, :per_page => @per_page, :order => 'created_at desc')
|
17
|
+
respond_to do |format|
|
18
|
+
format.html { render }
|
19
|
+
format.rss { render :layout => false }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def files
|
24
|
+
@files = @parent.uploads.files.paginate(:page => @page, :per_page => @per_page, :order => 'created_at desc')
|
25
|
+
respond_to do |format|
|
26
|
+
format.js { render :json => basic_uploads_json(@files) }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
protected
|
31
|
+
|
32
|
+
def get_upload_text(upload)
|
33
|
+
raise 'get_upload_text not implemented'
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_redirect
|
37
|
+
@parent
|
38
|
+
end
|
39
|
+
|
40
|
+
def has_permission_to_upload(user, upload_parent)
|
41
|
+
return true if upload_parent.blank?
|
42
|
+
upload_parent.can_edit?(user)
|
43
|
+
end
|
44
|
+
|
45
|
+
def permission_denied
|
46
|
+
message = t("uploader.permission_denied")
|
47
|
+
respond_to do |format|
|
48
|
+
format.html do
|
49
|
+
flash[:notice] = message
|
50
|
+
redirect_to get_redirect
|
51
|
+
end
|
52
|
+
format.js { render :text => message }
|
53
|
+
format.json { render :json => { :success => false, :message => message } }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# == Schema Information
|
2
|
+
#
|
3
|
+
# Table name: uploads
|
4
|
+
#
|
5
|
+
# id :integer(4) not null, primary key
|
6
|
+
# creator_id :integer(4)
|
7
|
+
# name :string(255)
|
8
|
+
# caption :string(1000)
|
9
|
+
# description :text
|
10
|
+
# is_public :boolean(1) default(TRUE)
|
11
|
+
# uploadable_id :integer(4)
|
12
|
+
# uploadable_type :string(255)
|
13
|
+
# width :string(255)
|
14
|
+
# height :string(255)
|
15
|
+
# local_file_name :string(255)
|
16
|
+
# local_content_type :string(255)
|
17
|
+
# local_file_size :integer(4)
|
18
|
+
# local_updated_at :datetime
|
19
|
+
# remote_file_name :string(255)
|
20
|
+
# remote_content_type :string(255)
|
21
|
+
# remote_file_size :integer(4)
|
22
|
+
# remote_updated_at :datetime
|
23
|
+
# created_at :datetime
|
24
|
+
# updated_at :datetime
|
25
|
+
#
|
26
|
+
# Indexes
|
27
|
+
#
|
28
|
+
# index_uploads_on_creator_id (creator_id)
|
29
|
+
# index_uploads_on_uploadable_id (uploadable_id)
|
30
|
+
# index_uploads_on_uploadable_type (uploadable_type)
|
31
|
+
# index_uploads_on_local_content_type (local_content_type)
|
32
|
+
#
|
33
|
+
|
34
|
+
class Upload < ActiveRecord::Base
|
35
|
+
|
36
|
+
acts_as_uploader :enable_s3 => false,
|
37
|
+
:has_attached_file => {
|
38
|
+
:url => "/system/:attachment/:id_partition/:style/:basename.:extension",
|
39
|
+
:path => ":rails_root/public/system/:attachment/:id_partition/:style/:basename.:extension",
|
40
|
+
:styles => { :icon => "30x30!",
|
41
|
+
:thumb => "100>",
|
42
|
+
:small => "150>",
|
43
|
+
:medium => "300>",
|
44
|
+
:large => "660>" },
|
45
|
+
:default_url => "/images/profile_default.jpg",
|
46
|
+
:storage => :s3,
|
47
|
+
:s3_credentials => AMAZON_S3_CREDENTIALS,
|
48
|
+
:bucket => "assets.#{GlobalConfig.application_url}",
|
49
|
+
:s3_host_alias => "assets.#{GlobalConfig.application_url}",
|
50
|
+
:convert_options => {
|
51
|
+
:all => '-quality 80'
|
52
|
+
}
|
53
|
+
},
|
54
|
+
:s3_path => ':id_partition/:style/:basename.:extension'
|
55
|
+
|
56
|
+
# has_many :comments, :as => :commentable, :dependent => :destroy, :order => 'created_at ASC'
|
57
|
+
# has_many :shared_uploads, :dependent => :destroy
|
58
|
+
|
59
|
+
acts_as_taggable
|
60
|
+
|
61
|
+
named_scope :public, :conditions => "is_public = true"
|
62
|
+
named_scope :tagged_with, lambda {|tag_name| {:conditions => ["tags.name = ?", tag_name], :include => :tags} }
|
63
|
+
|
64
|
+
# def after_create
|
65
|
+
# do add_activity
|
66
|
+
# end
|
67
|
+
|
68
|
+
# def share_with_friend(sharer, friend_id)
|
69
|
+
# friend = User.find(friend_id)
|
70
|
+
# friend.shared_uploads.find_or_create_by_upload_id_and_shared_by_id(self.id, sharer.id)
|
71
|
+
# end
|
72
|
+
#
|
73
|
+
# def share_with_group(sharer, group_id)
|
74
|
+
# group = Group.find(group_id)
|
75
|
+
# if group.is_member?(sharer)
|
76
|
+
# shared_upload = group.shared_uploads.find_or_create_by_upload_id_and_shared_by_id(self.id, sharer.id)
|
77
|
+
# end
|
78
|
+
# # TODO decide if we want to feed this into a feed somewhere
|
79
|
+
# shared_upload
|
80
|
+
# end
|
81
|
+
#
|
82
|
+
# def share_with_friends(user, friend_ids)
|
83
|
+
# friend_ids.each do |friend_id, checked|
|
84
|
+
# self.share_with_friend(user, friend_id) if (checked == "1")
|
85
|
+
# end
|
86
|
+
# end
|
87
|
+
#
|
88
|
+
# def share_with_groups(user, group_ids)
|
89
|
+
# group_ids.each do |group_id, checked|
|
90
|
+
# self.share_with_group(user, group_id) if (checked == "1")
|
91
|
+
# end
|
92
|
+
# end
|
93
|
+
|
94
|
+
end
|
@@ -4,9 +4,14 @@ class User < ActiveRecord::Base
|
|
4
4
|
end
|
5
5
|
acts_as_muck_user
|
6
6
|
has_activities
|
7
|
+
has_many :uploads, :as => :uploadable, :order => 'created_at desc', :dependent => :destroy
|
7
8
|
|
8
9
|
def can_add_root_content?
|
9
10
|
admin?
|
10
11
|
end
|
11
12
|
|
13
|
+
def can_upload?(check_user)
|
14
|
+
true
|
15
|
+
end
|
16
|
+
|
12
17
|
end
|
@@ -23,7 +23,9 @@ Rails::Initializer.run do |config|
|
|
23
23
|
config.gem "awesome_nested_set"
|
24
24
|
config.gem "friendly_id"
|
25
25
|
config.gem "sanitize"
|
26
|
+
config.gem 'paperclip'
|
26
27
|
config.gem 'tiny_mce'
|
28
|
+
config.gem "uploader"
|
27
29
|
config.gem "babelphish"
|
28
30
|
config.gem 'muck-engine', :lib => 'muck_engine'
|
29
31
|
config.gem 'muck-users', :lib => 'muck_users'
|
@@ -1,16 +1,15 @@
|
|
1
|
-
|
2
|
-
content_css = ['/stylesheets/reset.css', '/stylesheets/styles.css']
|
1
|
+
content_css = ['/stylesheets/reset.css', '/stylesheets/ie.css', '/stylesheets/application.css', '/stylesheets/common.css', '/stylesheets/standard.css']
|
3
2
|
if Rails.env.production?
|
4
3
|
content_css = ['/stylesheets/all.css']
|
5
4
|
end
|
6
|
-
|
7
5
|
GlobalConfig.advanced_mce_options = {
|
6
|
+
:accessibility_warnings => false,
|
8
7
|
:theme => 'advanced',
|
9
8
|
:content_css => content_css,
|
10
9
|
:body_id => 'content',
|
11
10
|
:mode => "textareas",
|
12
11
|
:height => 650,
|
13
|
-
:width =>
|
12
|
+
:width => 830,
|
14
13
|
:browsers => %w{msie gecko safari},
|
15
14
|
:theme_advanced_layout_manager => "SimpleLayout",
|
16
15
|
:theme_advanced_statusbar_location => "bottom",
|
@@ -49,6 +48,7 @@ GlobalConfig.advanced_mce_options = {
|
|
49
48
|
}
|
50
49
|
|
51
50
|
GlobalConfig.simple_mce_options = {
|
51
|
+
:accessibility_warnings => false,
|
52
52
|
:theme => 'advanced',
|
53
53
|
:content_css => content_css,
|
54
54
|
:body_id => 'content',
|
@@ -66,11 +66,15 @@ GlobalConfig.simple_mce_options = {
|
|
66
66
|
:plugins => %w{inlinepopups safari}
|
67
67
|
}
|
68
68
|
|
69
|
-
# Add templates to the editor
|
70
69
|
GlobalConfig.raw_mce_options = 'template_templates : [
|
71
70
|
{
|
72
|
-
title : "
|
73
|
-
src : "/javascripts/tiny_mce/templates/
|
74
|
-
description : "
|
71
|
+
title : "A page",
|
72
|
+
src : "/javascripts/tiny_mce/templates/bio.htm",
|
73
|
+
description : "Easily add a new biography for a team member."
|
74
|
+
},
|
75
|
+
{
|
76
|
+
title : "Country Page",
|
77
|
+
src : "/javascripts/tiny_mce/templates/country.htm",
|
78
|
+
description : "Add a new country page."
|
75
79
|
}
|
76
80
|
]'
|
data/test/rails_root/db/migrate/{20090602041838_create_users.rb → 20090327231918_create_users.rb}
RENAMED
@@ -1,5 +1,4 @@
|
|
1
1
|
class CreateUsers < ActiveRecord::Migration
|
2
|
-
|
3
2
|
def self.up
|
4
3
|
create_table :users, :force => true do |t|
|
5
4
|
t.string :login
|
@@ -8,29 +7,31 @@ class CreateUsers < ActiveRecord::Migration
|
|
8
7
|
t.string :last_name
|
9
8
|
t.string :crypted_password
|
10
9
|
t.string :password_salt
|
11
|
-
t.string :persistence_token
|
12
|
-
t.string :single_access_token
|
13
|
-
t.string :perishable_token
|
10
|
+
t.string :persistence_token, :null => false
|
11
|
+
t.string :single_access_token, :null => false
|
12
|
+
t.string :perishable_token, :null => false
|
14
13
|
t.integer :login_count, :null => false, :default => 0
|
15
14
|
t.integer :failed_login_count, :null => false, :default => 0
|
16
15
|
t.datetime :last_request_at
|
17
|
-
t.datetime :last_login_at
|
18
16
|
t.datetime :current_login_at
|
17
|
+
t.datetime :last_login_at
|
19
18
|
t.string :current_login_ip
|
20
19
|
t.string :last_login_ip
|
21
|
-
t.boolean :terms_of_service,
|
22
|
-
t.string :time_zone,
|
20
|
+
t.boolean :terms_of_service, :default => false, :null => false
|
21
|
+
t.string :time_zone, :default => "UTC"
|
23
22
|
t.datetime :disabled_at
|
23
|
+
t.datetime :created_at
|
24
24
|
t.datetime :activated_at
|
25
|
-
t.
|
25
|
+
t.datetime :updated_at
|
26
|
+
t.string :identity_url
|
27
|
+
t.string :url_key
|
26
28
|
end
|
27
29
|
|
28
30
|
add_index :users, :login
|
29
31
|
add_index :users, :email
|
30
32
|
add_index :users, :persistence_token
|
31
|
-
add_index :users, :perishable_token
|
32
|
-
add_index :users, :single_access_token
|
33
33
|
add_index :users, :last_request_at
|
34
|
+
|
34
35
|
end
|
35
36
|
|
36
37
|
def self.down
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateLanguages < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :languages, :force => true do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :english_name
|
6
|
+
t.string :locale
|
7
|
+
t.boolean :supported, :default => true
|
8
|
+
t.boolean :is_default, :default => false
|
9
|
+
end
|
10
|
+
add_index :languages, :name
|
11
|
+
add_index :languages, :locale
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
drop_table :languages
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateCountries < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :countries, :force => true do |t|
|
4
|
+
t.string "name", :limit => 128, :default => "", :null => false
|
5
|
+
t.string "abbreviation", :limit => 3, :default => "", :null => false
|
6
|
+
t.integer "sort", :default => 1000, :null => false
|
7
|
+
end
|
8
|
+
add_index :countries, :name
|
9
|
+
add_index :countries, :abbreviation
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
drop_table :countries
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateStates < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :states, :force => true do |t|
|
4
|
+
t.string "name", :limit => 128, :default => "", :null => false
|
5
|
+
t.string "abbreviation", :limit => 3, :default => "", :null => false
|
6
|
+
t.integer "country_id", :limit => 8, :null => false
|
7
|
+
end
|
8
|
+
|
9
|
+
add_index :states, :country_id
|
10
|
+
add_index :states, :name
|
11
|
+
add_index :states, :abbreviation
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.down
|
16
|
+
drop_table :states
|
17
|
+
end
|
18
|
+
end
|
@@ -1,29 +1,31 @@
|
|
1
|
-
class ActsAsTaggableOnMigration < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :tags do |t|
|
4
|
-
t.column :name, :string
|
5
|
-
end
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
t.column :
|
11
|
-
t.column :
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
t.column :
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
1
|
+
class ActsAsTaggableOnMigration < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :tags do |t|
|
4
|
+
t.column :name, :string
|
5
|
+
end
|
6
|
+
|
7
|
+
add_index :tags, :name
|
8
|
+
|
9
|
+
create_table :taggings do |t|
|
10
|
+
t.column :tag_id, :integer
|
11
|
+
t.column :taggable_id, :integer
|
12
|
+
t.column :tagger_id, :integer
|
13
|
+
t.column :tagger_type, :string
|
14
|
+
|
15
|
+
# You should make sure that the column created is
|
16
|
+
# long enough to store the required class names.
|
17
|
+
t.column :taggable_type, :string
|
18
|
+
t.column :context, :string
|
19
|
+
|
20
|
+
t.column :created_at, :datetime
|
21
|
+
end
|
22
|
+
|
23
|
+
add_index :taggings, :tag_id
|
24
|
+
add_index :taggings, [:taggable_id, :taggable_type, :context]
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.down
|
28
|
+
drop_table :taggings
|
29
|
+
drop_table :tags
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class CreateUploads < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :uploads, :force => true do |t|
|
4
|
+
t.integer :creator_id
|
5
|
+
t.string :name
|
6
|
+
t.string :caption, :limit => 1000
|
7
|
+
t.text :description
|
8
|
+
t.boolean :is_public, :default => true
|
9
|
+
t.integer :uploadable_id
|
10
|
+
t.string :uploadable_type
|
11
|
+
t.string :width
|
12
|
+
t.string :height
|
13
|
+
|
14
|
+
t.string :local_file_name
|
15
|
+
t.string :local_content_type
|
16
|
+
t.integer :local_file_size
|
17
|
+
t.datetime :local_updated_at
|
18
|
+
|
19
|
+
t.string :remote_file_name
|
20
|
+
t.string :remote_content_type
|
21
|
+
t.integer :remote_file_size
|
22
|
+
t.datetime :remote_updated_at
|
23
|
+
|
24
|
+
t.timestamps
|
25
|
+
end
|
26
|
+
|
27
|
+
add_index :uploads, ["creator_id"]
|
28
|
+
add_index :uploads, ["uploadable_id"]
|
29
|
+
add_index :uploads, ["uploadable_type"]
|
30
|
+
add_index :uploads, ["local_content_type"]
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.down
|
35
|
+
drop_table :uploads
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class AddAttachableToActivities < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :activities, :attachable_id, :integer
|
4
|
+
add_column :activities, :attachable_type, :string
|
5
|
+
add_index :activities, ["attachable_id", "attachable_type"]
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.down
|
9
|
+
remove_column :activities, :attachable_id
|
10
|
+
remove_column :activities, :attachable_type
|
11
|
+
remove_index :activities, ["attachable_id", "attachable_type"]
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# You might want to change this
|
4
|
+
ENV["RAILS_ENV"] ||= "production"
|
5
|
+
|
6
|
+
require File.dirname(__FILE__) + "/../../config/environment"
|
7
|
+
|
8
|
+
$running = true
|
9
|
+
Signal.trap("TERM") do
|
10
|
+
$running = false
|
11
|
+
end
|
12
|
+
|
13
|
+
# Waiting is a timer variable to allow the daemon to restart
|
14
|
+
# within two seconds of the Signal rather than using a long
|
15
|
+
# sleep command and forcing the daemon to wait.
|
16
|
+
$waiting = 0
|
17
|
+
|
18
|
+
ActiveRecord::Base.logger.info "[AmazonS3] Migration daemon started at #{Time.now}.\n"
|
19
|
+
|
20
|
+
while($running) do
|
21
|
+
|
22
|
+
if $waiting < 120
|
23
|
+
$waiting += 2
|
24
|
+
sleep 2
|
25
|
+
else
|
26
|
+
$waiting = 0
|
27
|
+
upload = Upload.pending_s3_migration.first
|
28
|
+
|
29
|
+
if upload
|
30
|
+
$waiting = 120 - 2
|
31
|
+
ActiveRecord::Base.logger.info "[AmazonS3] Migrating upload ##{upload.id}\n"
|
32
|
+
upload.remote = upload.local
|
33
|
+
upload.save!
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|