wafflemix 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +96 -0
- data/Rakefile +40 -0
- data/app/assets/javascripts/mercury/page_editor.js.coffee +254 -0
- data/app/assets/javascripts/wafflemix/admin/admin.js.coffee +73 -0
- data/app/assets/javascripts/wafflemix/admin/admin_js.js +16 -0
- data/app/assets/javascripts/wafflemix/admin/bootstrap-datepicker.js +454 -0
- data/app/assets/javascripts/wafflemix/admin/jquery.nested_sortable.js +608 -0
- data/app/assets/javascripts/wafflemix/application.js +43 -0
- data/app/assets/javascripts/wafflemix/assets.js +2 -0
- data/app/assets/javascripts/wafflemix/contact_forms.js +2 -0
- data/app/assets/javascripts/wafflemix/mercury.js +469 -0
- data/app/assets/javascripts/wafflemix/pages.js +2 -0
- data/app/assets/javascripts/wafflemix/portfolios.js +2 -0
- data/app/assets/javascripts/wafflemix/posts.js +2 -0
- data/app/assets/javascripts/wafflemix/roles.js +2 -0
- data/app/assets/javascripts/wafflemix/users.js +2 -0
- data/app/assets/stylesheets/wafflemix/admin/admin.css.sass +76 -0
- data/app/assets/stylesheets/wafflemix/admin/bootstrap-datepicker.css +7 -0
- data/app/assets/stylesheets/wafflemix/application.css +15 -0
- data/app/assets/stylesheets/wafflemix/assets.css +4 -0
- data/app/assets/stylesheets/wafflemix/clearfix.css +20 -0
- data/app/assets/stylesheets/wafflemix/contact_forms.css +4 -0
- data/app/assets/stylesheets/wafflemix/main.css.sass +11 -0
- data/app/assets/stylesheets/wafflemix/mercury.css +23 -0
- data/app/assets/stylesheets/wafflemix/pages.css +4 -0
- data/app/assets/stylesheets/wafflemix/partials/_base.css.sass +131 -0
- data/app/assets/stylesheets/wafflemix/portfolios.css +4 -0
- data/app/assets/stylesheets/wafflemix/posts.css +4 -0
- data/app/assets/stylesheets/wafflemix/roles.css +4 -0
- data/app/assets/stylesheets/wafflemix/users.css +4 -0
- data/app/controllers/wafflemix/admin/assets_controller.rb +95 -0
- data/app/controllers/wafflemix/admin/categories_controller.rb +77 -0
- data/app/controllers/wafflemix/admin/contact_forms_controller.rb +77 -0
- data/app/controllers/wafflemix/admin/content_sections_controller.rb +85 -0
- data/app/controllers/wafflemix/admin/pages_controller.rb +93 -0
- data/app/controllers/wafflemix/admin/portfolios_controller.rb +93 -0
- data/app/controllers/wafflemix/admin/posts_controller.rb +82 -0
- data/app/controllers/wafflemix/admin/roles_controller.rb +77 -0
- data/app/controllers/wafflemix/admin/slides_controller.rb +88 -0
- data/app/controllers/wafflemix/admin/users_controller.rb +78 -0
- data/app/controllers/wafflemix/application_controller.rb +11 -0
- data/app/controllers/wafflemix/assets_controller.rb +71 -0
- data/app/controllers/wafflemix/categories_controller.rb +34 -0
- data/app/controllers/wafflemix/contact_forms_controller.rb +47 -0
- data/app/controllers/wafflemix/pages_controller.rb +56 -0
- data/app/controllers/wafflemix/portfolios_controller.rb +35 -0
- data/app/controllers/wafflemix/posts_controller.rb +52 -0
- data/app/helpers/wafflemix/admin/slides_helper.rb +11 -0
- data/app/helpers/wafflemix/application_helper.rb +88 -0
- data/app/helpers/wafflemix/assets_helper.rb +4 -0
- data/app/helpers/wafflemix/categories_helper.rb +4 -0
- data/app/helpers/wafflemix/contact_forms_helper.rb +4 -0
- data/app/helpers/wafflemix/content_sections_helper.rb +4 -0
- data/app/helpers/wafflemix/pages_helper.rb +23 -0
- data/app/helpers/wafflemix/portfolios_helper.rb +11 -0
- data/app/helpers/wafflemix/posts_helper.rb +5 -0
- data/app/helpers/wafflemix/roles_helper.rb +4 -0
- data/app/helpers/wafflemix/users_helper.rb +4 -0
- data/app/models/user.rb +10 -0
- data/app/models/wafflemix/Categorical.rb +8 -0
- data/app/models/wafflemix/asset.rb +22 -0
- data/app/models/wafflemix/category.rb +8 -0
- data/app/models/wafflemix/contact_form.rb +19 -0
- data/app/models/wafflemix/content_section.rb +21 -0
- data/app/models/wafflemix/image.rb +8 -0
- data/app/models/wafflemix/meta_content.rb +5 -0
- data/app/models/wafflemix/page.rb +39 -0
- data/app/models/wafflemix/portfolio.rb +16 -0
- data/app/models/wafflemix/post.rb +33 -0
- data/app/models/wafflemix/role.rb +10 -0
- data/app/models/wafflemix/slide.rb +14 -0
- data/app/models/wafflemix/user.rb +11 -0
- data/app/models/wafflemix/user_role.rb +8 -0
- data/app/views/devise/_links.erb +25 -0
- data/app/views/devise/confirmations/new.html.erb +12 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/devise/passwords/edit.html.erb +16 -0
- data/app/views/devise/passwords/new.html.erb +12 -0
- data/app/views/devise/registrations/edit.html.erb +25 -0
- data/app/views/devise/registrations/new.html.erb +18 -0
- data/app/views/devise/sessions/new.html.erb +17 -0
- data/app/views/devise/unlocks/new.html.erb +12 -0
- data/app/views/layouts/mercury.html.erb +24 -0
- data/app/views/layouts/wafflemix/admin.html.erb +19 -0
- data/app/views/layouts/wafflemix/example_layout.html.erb +35 -0
- data/app/views/wafflemix/admin/assets/_form.html.erb +22 -0
- data/app/views/wafflemix/admin/assets/add_image.js.erb +1 -0
- data/app/views/wafflemix/admin/assets/edit.html.erb +6 -0
- data/app/views/wafflemix/admin/assets/index.html.erb +41 -0
- data/app/views/wafflemix/admin/assets/new.html.erb +5 -0
- data/app/views/wafflemix/admin/assets/show.html.erb +20 -0
- data/app/views/wafflemix/admin/categories/_form.html.erb +29 -0
- data/app/views/wafflemix/admin/categories/edit.html.erb +6 -0
- data/app/views/wafflemix/admin/categories/index.html.erb +36 -0
- data/app/views/wafflemix/admin/categories/new.html.erb +5 -0
- data/app/views/wafflemix/admin/categories/show.html.erb +25 -0
- data/app/views/wafflemix/admin/contact_forms/_form.html.erb +15 -0
- data/app/views/wafflemix/admin/contact_forms/edit.html.erb +6 -0
- data/app/views/wafflemix/admin/contact_forms/index.html.erb +38 -0
- data/app/views/wafflemix/admin/contact_forms/new.html.erb +5 -0
- data/app/views/wafflemix/admin/contact_forms/show.html.erb +25 -0
- data/app/views/wafflemix/admin/content_sections/_form.html.erb +33 -0
- data/app/views/wafflemix/admin/content_sections/create.js.erb +3 -0
- data/app/views/wafflemix/admin/content_sections/destroy.js.erb +4 -0
- data/app/views/wafflemix/admin/content_sections/edit.html.erb +6 -0
- data/app/views/wafflemix/admin/content_sections/index.html.erb +29 -0
- data/app/views/wafflemix/admin/content_sections/new.html.erb +5 -0
- data/app/views/wafflemix/admin/content_sections/show.html.erb +25 -0
- data/app/views/wafflemix/admin/pages/_form.html.erb +47 -0
- data/app/views/wafflemix/admin/pages/_page.html.erb +15 -0
- data/app/views/wafflemix/admin/pages/edit.html.erb +3 -0
- data/app/views/wafflemix/admin/pages/index.html.erb +21 -0
- data/app/views/wafflemix/admin/pages/new.html.erb +3 -0
- data/app/views/wafflemix/admin/pages/show.html.erb +40 -0
- data/app/views/wafflemix/admin/portfolios/_form.html.erb +174 -0
- data/app/views/wafflemix/admin/portfolios/_portfolio.html.erb +11 -0
- data/app/views/wafflemix/admin/portfolios/edit.html.erb +5 -0
- data/app/views/wafflemix/admin/portfolios/index.html.erb +21 -0
- data/app/views/wafflemix/admin/portfolios/new.html.erb +5 -0
- data/app/views/wafflemix/admin/portfolios/show.html.erb +20 -0
- data/app/views/wafflemix/admin/posts/_form.html.erb +191 -0
- data/app/views/wafflemix/admin/posts/edit.html.erb +5 -0
- data/app/views/wafflemix/admin/posts/index.html.erb +38 -0
- data/app/views/wafflemix/admin/posts/new.html.erb +3 -0
- data/app/views/wafflemix/admin/posts/show.html.erb +20 -0
- data/app/views/wafflemix/admin/roles/_form.html.erb +21 -0
- data/app/views/wafflemix/admin/roles/edit.html.erb +6 -0
- data/app/views/wafflemix/admin/roles/index.html.erb +34 -0
- data/app/views/wafflemix/admin/roles/new.html.erb +5 -0
- data/app/views/wafflemix/admin/roles/show.html.erb +10 -0
- data/app/views/wafflemix/admin/slides/_form.html.erb +170 -0
- data/app/views/wafflemix/admin/slides/_slide.html.erb +11 -0
- data/app/views/wafflemix/admin/slides/edit.html.erb +5 -0
- data/app/views/wafflemix/admin/slides/index.html.erb +21 -0
- data/app/views/wafflemix/admin/slides/new.html.erb +5 -0
- data/app/views/wafflemix/admin/slides/show.html.erb +10 -0
- data/app/views/wafflemix/admin/users/_form.html.erb +29 -0
- data/app/views/wafflemix/admin/users/edit.html.erb +6 -0
- data/app/views/wafflemix/admin/users/index.html.erb +36 -0
- data/app/views/wafflemix/admin/users/new.html.erb +5 -0
- data/app/views/wafflemix/admin/users/show.html.erb +14 -0
- data/app/views/wafflemix/categories/index.erb +16 -0
- data/app/views/wafflemix/categories/show.html.erb +16 -0
- data/app/views/wafflemix/contact_forms/_form.html.erb +33 -0
- data/app/views/wafflemix/contact_forms/new.html.erb +19 -0
- data/app/views/wafflemix/contact_forms/show.html.erb +25 -0
- data/app/views/wafflemix/pages/home.html.erb +7 -0
- data/app/views/wafflemix/pages/index.html.erb +31 -0
- data/app/views/wafflemix/pages/show.html.erb +14 -0
- data/app/views/wafflemix/portfolios/index.html.erb +21 -0
- data/app/views/wafflemix/portfolios/show.html.erb +36 -0
- data/app/views/wafflemix/posts/_sidebar.html.erb +12 -0
- data/app/views/wafflemix/posts/index.html.erb +16 -0
- data/app/views/wafflemix/posts/show.html.erb +40 -0
- data/app/views/wafflemix/posts/tagged.html.erb +16 -0
- data/config/initializers/devise.rb +227 -0
- data/config/initializers/dragonfly.rb +16 -0
- data/config/initializers/formtastic.rb +78 -0
- data/config/initializers/spam_filter.rb +4 -0
- data/config/locales/devise.en.yml +57 -0
- data/config/routes.rb +55 -0
- data/db/migrate/20120814113226_create_wafflemix_pages.rb +19 -0
- data/db/migrate/20120901141321_create_wafflemix_users.rb +29 -0
- data/db/migrate/20120901150334_create_wafflemix_assets.rb +11 -0
- data/db/migrate/20120901151421_create_wafflemix_roles.rb +9 -0
- data/db/migrate/20120901151704_create_wafflemix_user_roles.rb +13 -0
- data/db/migrate/20120915124116_add_ancestry_to_pages.rb +7 -0
- data/db/migrate/20120918100336_create_wafflemix_categories.rb +15 -0
- data/db/migrate/20120923131130_create_wafflemix_slides.rb +11 -0
- data/db/migrate/20120923131307_create_wafflemix_content_sections.rb +12 -0
- data/db/migrate/20120923135949_add_position_to_slides.rb +5 -0
- data/db/migrate/20121005124419_update_asset_table.rb +10 -0
- data/db/migrate/20121113131239_create_wafflemix_posts.rb +15 -0
- data/db/migrate/20121113132413_add_translation_table_for_posts.rb +9 -0
- data/db/migrate/20121114135432_update_draft_to_boolean_on_posts.rb +11 -0
- data/db/migrate/20121120125114_add_page_translations.rb +9 -0
- data/db/migrate/20121205221122_acts_as_taggable_on_migration.rb +30 -0
- data/db/migrate/20121206132733_re_do_categories.rb +19 -0
- data/db/migrate/20121206132923_add_new_categories_table.rb +11 -0
- data/db/migrate/20121206133026_add_category_joins_table.rb +14 -0
- data/db/migrate/20121211095114_finalize_asset_table.rb +11 -0
- data/db/migrate/20121211095847_store_asset_url.rb +5 -0
- data/db/migrate/20130202161212_create_wafflemix_images.rb +11 -0
- data/db/migrate/20130202182435_add_extra_fields_to_slides.rb +6 -0
- data/db/migrate/20130204225256_create_wafflemix_portfolios.rb +11 -0
- data/db/migrate/20130204230818_add_ancestry_to_portfolio.rb +6 -0
- data/db/migrate/20130216190558_create_wafflemix_meta_contents.rb +13 -0
- data/db/migrate/20130219121412_create_wafflemix_contact_forms.rb +12 -0
- data/db/migrate/20130219130609_add_spam_to_contact_forms.rb +5 -0
- data/lib/tasks/wafflemix_tasks.rake +15 -0
- data/lib/templates/erb/scaffold/_form.html.erb +11 -0
- data/lib/wafflemix/engine.rb +9 -0
- data/lib/wafflemix/version.rb +3 -0
- data/lib/wafflemix.rb +17 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +64 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +39 -0
- data/test/dummy/config/environments/production.rb +69 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/local_s3.rb +3 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/schema.rb +87 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/fixtures/wafflemix/assets.yml +11 -0
- data/test/fixtures/wafflemix/categories.yml +13 -0
- data/test/fixtures/wafflemix/contact_forms.yml +13 -0
- data/test/fixtures/wafflemix/content_sections.yml +13 -0
- data/test/fixtures/wafflemix/images.yml +11 -0
- data/test/fixtures/wafflemix/meta_contents.yml +15 -0
- data/test/fixtures/wafflemix/pages.yml +19 -0
- data/test/fixtures/wafflemix/portfolios.yml +11 -0
- data/test/fixtures/wafflemix/posts.yml +11 -0
- data/test/fixtures/wafflemix/roles.yml +7 -0
- data/test/fixtures/wafflemix/slides.yml +7 -0
- data/test/fixtures/wafflemix/user_roles.yml +9 -0
- data/test/fixtures/wafflemix/users.yml +11 -0
- data/test/functional/wafflemix/assets_controller_test.rb +51 -0
- data/test/functional/wafflemix/categories_controller_test.rb +51 -0
- data/test/functional/wafflemix/contact_forms_controller_test.rb +51 -0
- data/test/functional/wafflemix/content_sections_controller_test.rb +51 -0
- data/test/functional/wafflemix/pages_controller_test.rb +51 -0
- data/test/functional/wafflemix/portfolios_controller_test.rb +51 -0
- data/test/functional/wafflemix/posts_controller_test.rb +51 -0
- data/test/functional/wafflemix/roles_controller_test.rb +51 -0
- data/test/functional/wafflemix/slides_controller_test.rb +51 -0
- data/test/functional/wafflemix/users_controller_test.rb +51 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- data/test/unit/helpers/wafflemix/assets_helper_test.rb +6 -0
- data/test/unit/helpers/wafflemix/categories_helper_test.rb +6 -0
- data/test/unit/helpers/wafflemix/contact_forms_helper_test.rb +6 -0
- data/test/unit/helpers/wafflemix/content_sections_helper_test.rb +6 -0
- data/test/unit/helpers/wafflemix/pages_helper_test.rb +6 -0
- data/test/unit/helpers/wafflemix/portfolios_helper_test.rb +6 -0
- data/test/unit/helpers/wafflemix/posts_helper_test.rb +6 -0
- data/test/unit/helpers/wafflemix/roles_helper_test.rb +6 -0
- data/test/unit/helpers/wafflemix/slides_helper_test.rb +6 -0
- data/test/unit/helpers/wafflemix/users_helper_test.rb +6 -0
- data/test/unit/wafflemix/asset_test.rb +9 -0
- data/test/unit/wafflemix/category_test.rb +9 -0
- data/test/unit/wafflemix/contact_form_test.rb +9 -0
- data/test/unit/wafflemix/content_section_test.rb +9 -0
- data/test/unit/wafflemix/image_test.rb +9 -0
- data/test/unit/wafflemix/meta_content_test.rb +9 -0
- data/test/unit/wafflemix/page_test.rb +9 -0
- data/test/unit/wafflemix/portfolio_test.rb +9 -0
- data/test/unit/wafflemix/post_test.rb +9 -0
- data/test/unit/wafflemix/role_test.rb +9 -0
- data/test/unit/wafflemix/slide_test.rb +9 -0
- data/test/unit/wafflemix/user_role_test.rb +9 -0
- data/test/unit/wafflemix/user_test.rb +9 -0
- data/test/wafflemix_test.rb +7 -0
- metadata +654 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2012 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
= Wafflemix
|
2
|
+
|
3
|
+
To run this app locally:
|
4
|
+
cd test/dummy
|
5
|
+
|
6
|
+
Setup your db here: wafflemix/test/dummy/config/database.yml
|
7
|
+
|
8
|
+
start dummy app with: rails server
|
9
|
+
|
10
|
+
= Using as an engine + settig up new application
|
11
|
+
|
12
|
+
1. Add wafflemix to your gemfile - gem 'wafflemix', :git => 'git://github.com/jrissler/wafflemix.git'
|
13
|
+
|
14
|
+
2. config/application.rb - add require "wafflemix" below bundle method.
|
15
|
+
|
16
|
+
3. config/routes.rb - add: mount Wafflemix::Engine => "/"
|
17
|
+
|
18
|
+
4. rake wafflemix:install:migrations
|
19
|
+
|
20
|
+
5. rake db:migrate
|
21
|
+
|
22
|
+
= Devise
|
23
|
+
|
24
|
+
1. Ensure you have defined default url options in your environments files. Here
|
25
|
+
is an example of default_url_options appropriate for a development environment
|
26
|
+
in config/environments/development.rb:
|
27
|
+
|
28
|
+
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
|
29
|
+
|
30
|
+
In production, :host should be set to the actual host of your application.
|
31
|
+
|
32
|
+
2. Ensure you have defined root_url to *something* in your config/routes.rb.
|
33
|
+
For example:
|
34
|
+
|
35
|
+
root :to => "home#index"
|
36
|
+
|
37
|
+
3. Ensure you have flash messages in app/views/layouts/application.html.erb.
|
38
|
+
For example:
|
39
|
+
|
40
|
+
<p class="notice"><%= notice %></p>
|
41
|
+
<p class="alert"><%= alert %></p>
|
42
|
+
|
43
|
+
4. If you are deploying Rails 3.1 on Heroku, you may want to set:
|
44
|
+
|
45
|
+
config.assets.initialize_on_precompile = false
|
46
|
+
|
47
|
+
On config/application.rb forcing your application to not access the DB
|
48
|
+
or load models when precompiling your assets.
|
49
|
+
|
50
|
+
5. Since devise is an engine and this CMS is an engine, we need to set the order in which their loaded.
|
51
|
+
|
52
|
+
In config/application.rb add:
|
53
|
+
|
54
|
+
config.railties_order = [Wafflemix::Engine, :main_app, :all]
|
55
|
+
|
56
|
+
Read more about Devise: https://github.com/plataformatec/devise
|
57
|
+
|
58
|
+
= S3 uploads
|
59
|
+
|
60
|
+
Add the following to application.rb within the application class definition:
|
61
|
+
|
62
|
+
config.middleware.insert 0, 'Dragonfly::Middleware', :images
|
63
|
+
|
64
|
+
In an initializer or in config/environments/development.rb set:
|
65
|
+
|
66
|
+
ENV['S3_KEY'] = 'your_key'
|
67
|
+
ENV['S3_SECRET'] = 'your_secret'
|
68
|
+
ENV['S3_BUCKET'] = 'your-bucket'
|
69
|
+
|
70
|
+
And for heroku (by default production):
|
71
|
+
|
72
|
+
heroku config:add S3_KEY=***your-s3-key*** S3_SECRET=***your-s3-secret*** S3_BUCKET=***your-bucket***
|
73
|
+
|
74
|
+
= Overriding routes
|
75
|
+
|
76
|
+
Overriding routes is straightforward, in config/routes add:
|
77
|
+
|
78
|
+
Wafflemix::Engine.routes.draw do
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
Add any routes you want to override inside this block.
|
83
|
+
|
84
|
+
For example, changing the root url:
|
85
|
+
|
86
|
+
Wafflemix::Engine.routes.draw do
|
87
|
+
root :to => "posts#index"
|
88
|
+
end
|
89
|
+
|
90
|
+
##Todo's
|
91
|
+
New app generators
|
92
|
+
Instructions for S3 config
|
93
|
+
Seed Default roles
|
94
|
+
|
95
|
+
|
96
|
+
This project rocks and uses MIT-LICENSE.
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'Wafflemix'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
24
|
+
load 'rails/tasks/engine.rake'
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
Bundler::GemHelper.install_tasks
|
29
|
+
|
30
|
+
require 'rake/testtask'
|
31
|
+
|
32
|
+
Rake::TestTask.new(:test) do |t|
|
33
|
+
t.libs << 'lib'
|
34
|
+
t.libs << 'test'
|
35
|
+
t.pattern = 'test/**/*_test.rb'
|
36
|
+
t.verbose = false
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
task :default => :test
|
@@ -0,0 +1,254 @@
|
|
1
|
+
class @Mercury.PageEditor
|
2
|
+
|
3
|
+
# options
|
4
|
+
# saveStyle: 'form', or 'json' (defaults to json)
|
5
|
+
# saveDataType: 'xml', 'json', 'jsonp', 'script', 'text', 'html' (defaults to json)
|
6
|
+
# saveMethod: 'POST', or 'PUT', create or update actions on save (defaults to PUT)
|
7
|
+
# visible: boolean, if the interface should start visible or not (defaults to true)
|
8
|
+
constructor: (@saveUrl = null, @options = {}) ->
|
9
|
+
throw Mercury.I18n('Mercury.PageEditor can only be instantiated once.') if window.mercuryInstance
|
10
|
+
|
11
|
+
@options.visible = true unless (@options.visible == false || @options.visible == 'false')
|
12
|
+
@visible = @options.visible
|
13
|
+
@options.saveDataType = 'json' unless (@options.saveDataType == false || @options.saveDataType)
|
14
|
+
|
15
|
+
window.mercuryInstance = @
|
16
|
+
@regions = []
|
17
|
+
@initializeInterface()
|
18
|
+
Mercury.csrfToken = token if token = jQuery(Mercury.config.csrfSelector).attr('content')
|
19
|
+
|
20
|
+
|
21
|
+
initializeInterface: ->
|
22
|
+
@focusableElement = jQuery('<input>', {class: 'mercury-focusable', type: 'text'}).appendTo(@options.appendTo ? 'body')
|
23
|
+
|
24
|
+
@iframe = jQuery('<iframe>', {id: 'mercury_iframe', class: 'mercury-iframe', frameborder: '0', src: 'about:blank'})
|
25
|
+
@iframe.appendTo(jQuery(@options.appendTo).get(0) ? 'body')
|
26
|
+
|
27
|
+
@toolbar = new Mercury.Toolbar(jQuery.extend(true, {}, @options, @options.toolbarOptions))
|
28
|
+
@statusbar = new Mercury.Statusbar(jQuery.extend(true, {}, @options, @options.statusbarOptions))
|
29
|
+
@resize()
|
30
|
+
|
31
|
+
@iframe.one 'load', => @bindEvents()
|
32
|
+
@iframe.on 'load', => @initializeFrame()
|
33
|
+
@loadIframeSrc(null)
|
34
|
+
|
35
|
+
|
36
|
+
initializeFrame: ->
|
37
|
+
try
|
38
|
+
return if @iframe.data('loaded')
|
39
|
+
@iframe.data('loaded', true)
|
40
|
+
|
41
|
+
# set document reference of iframe
|
42
|
+
@document = jQuery(@iframe.get(0).contentWindow.document)
|
43
|
+
|
44
|
+
# inject styles for document to be able to highlight regions and other tools
|
45
|
+
jQuery("<style mercury-styles=\"true\">").html(Mercury.config.injectedStyles).appendTo(@document.find('head'))
|
46
|
+
|
47
|
+
# jquery: make jQuery evaluate scripts within the context of the iframe window
|
48
|
+
iframeWindow = @iframe.get(0).contentWindow
|
49
|
+
jQuery.globalEval = (data) -> (iframeWindow.execScript || (data) -> iframeWindow["eval"].call(iframeWindow, data))(data) if (data && /\S/.test(data))
|
50
|
+
|
51
|
+
iframeWindow.Mercury = Mercury
|
52
|
+
iframeWindow.History = History if window.History && History.Adapter
|
53
|
+
|
54
|
+
# (re) initialize the editor against the new document
|
55
|
+
@bindDocumentEvents()
|
56
|
+
@resize()
|
57
|
+
@initializeRegions()
|
58
|
+
@finalizeInterface()
|
59
|
+
|
60
|
+
# trigger ready events
|
61
|
+
Mercury.trigger('ready')
|
62
|
+
iframeWindow.jQuery(iframeWindow).trigger('mercury:ready') if iframeWindow.jQuery
|
63
|
+
iframeWindow.Event.fire(iframeWindow, 'mercury:ready') if iframeWindow.Event && iframeWindow.Event.fire
|
64
|
+
iframeWindow.onMercuryReady() if iframeWindow.onMercuryReady
|
65
|
+
|
66
|
+
@iframe.css({visibility: 'visible'})
|
67
|
+
catch error
|
68
|
+
Mercury.notify('Mercury.PageEditor failed to load: %s\n\nPlease try refreshing.', error)
|
69
|
+
|
70
|
+
|
71
|
+
initializeRegions: ->
|
72
|
+
@regions = []
|
73
|
+
@buildRegion(jQuery(region)) for region in jQuery("[#{Mercury.config.regions.attribute}]", @document)
|
74
|
+
return unless @visible
|
75
|
+
for region in @regions
|
76
|
+
if region.focus
|
77
|
+
region.focus()
|
78
|
+
break
|
79
|
+
|
80
|
+
|
81
|
+
buildRegion: (region) ->
|
82
|
+
if region.data('region')
|
83
|
+
region = region.data('region')
|
84
|
+
else
|
85
|
+
type = (region.attr(Mercury.config.regions.attribute) || Mercury.config.regions.determineType?(region) || 'unknown').titleize()
|
86
|
+
throw Mercury.I18n('Region type is malformed, no data-type provided, or "%s" is unknown for the "%s" region.', type, region.attr('id') || 'unknown') if type == 'Unknown' || !Mercury.Regions[type]
|
87
|
+
if !Mercury.Regions[type].supported
|
88
|
+
Mercury.notify('Mercury.Regions.%s is unsupported in this client. Supported browsers are %s.', type, Mercury.Regions[type].supportedText)
|
89
|
+
return false
|
90
|
+
region = new Mercury.Regions[type](region, @iframe.get(0).contentWindow)
|
91
|
+
region.togglePreview() if @previewing
|
92
|
+
@regions.push(region)
|
93
|
+
|
94
|
+
|
95
|
+
finalizeInterface: ->
|
96
|
+
@santizerElement = jQuery('<div>', {id: 'mercury_sanitizer', contenteditable: 'true', style: 'position:fixed;width:100px;height:100px;min-width:0;top:0;left:-100px;opacity:0;overflow:hidden'})
|
97
|
+
@santizerElement.appendTo(@options.appendTo ? @document.find('body'))
|
98
|
+
|
99
|
+
@snippetToolbar.release() if @snippetToolbar
|
100
|
+
@snippetToolbar = new Mercury.SnippetToolbar(@document)
|
101
|
+
|
102
|
+
@hijackLinksAndForms()
|
103
|
+
Mercury.trigger('mode', {mode: 'preview'}) unless @visible
|
104
|
+
|
105
|
+
|
106
|
+
bindDocumentEvents: ->
|
107
|
+
@document.on 'mousedown', (event) ->
|
108
|
+
Mercury.trigger('hide:dialogs')
|
109
|
+
if Mercury.region
|
110
|
+
Mercury.trigger('unfocus:regions') unless jQuery(event.target).closest("[#{Mercury.config.regions.attribute}]").get(0) == Mercury.region.element.get(0)
|
111
|
+
|
112
|
+
jQuery(@document).bind 'keydown', (event) =>
|
113
|
+
return unless event.ctrlKey || event.metaKey
|
114
|
+
if (event.keyCode == 83) # meta+S
|
115
|
+
Mercury.trigger('action', {action: 'save'})
|
116
|
+
event.preventDefault()
|
117
|
+
|
118
|
+
|
119
|
+
bindEvents: ->
|
120
|
+
Mercury.on 'initialize:frame', => setTimeout(@initializeFrame, 100)
|
121
|
+
Mercury.on 'focus:frame', => @iframe.focus()
|
122
|
+
Mercury.on 'focus:window', => setTimeout((=> @focusableElement.focus()), 10)
|
123
|
+
Mercury.on 'toggle:interface', => @toggleInterface()
|
124
|
+
Mercury.on 'reinitialize', => @initializeRegions()
|
125
|
+
Mercury.on 'mode', (event, options) => @previewing = !@previewing if options.mode == 'preview'
|
126
|
+
Mercury.on 'action', (event, options) =>
|
127
|
+
action = Mercury.config.globalBehaviors[options.action] || @[options.action]
|
128
|
+
return unless typeof(action) == 'function'
|
129
|
+
event.preventDefault()
|
130
|
+
action.call(@, options)
|
131
|
+
|
132
|
+
jQuery(window).on 'resize', =>
|
133
|
+
@resize()
|
134
|
+
|
135
|
+
jQuery(window).bind 'keydown', (event) =>
|
136
|
+
return unless event.ctrlKey || event.metaKey
|
137
|
+
if (event.keyCode == 83) # meta+S
|
138
|
+
Mercury.trigger('action', {action: 'save'})
|
139
|
+
event.preventDefault()
|
140
|
+
|
141
|
+
window.onbeforeunload = @beforeUnload
|
142
|
+
|
143
|
+
|
144
|
+
toggleInterface: ->
|
145
|
+
if @visible
|
146
|
+
@visible = false
|
147
|
+
@toolbar.hide()
|
148
|
+
@statusbar.hide()
|
149
|
+
Mercury.trigger('mode', {mode: 'preview'}) unless @previewing
|
150
|
+
@previewing = true
|
151
|
+
@resize()
|
152
|
+
else
|
153
|
+
@visible = true
|
154
|
+
@iframe.animate({top: @toolbar.height(true)}, 200, 'easeInOutSine', => @resize())
|
155
|
+
@toolbar.show()
|
156
|
+
@statusbar.show()
|
157
|
+
Mercury.trigger('mode', {mode: 'preview'})
|
158
|
+
@previewing = false
|
159
|
+
|
160
|
+
|
161
|
+
resize: ->
|
162
|
+
width = jQuery(window).width()
|
163
|
+
height = @statusbar.top()
|
164
|
+
toolbarHeight = @toolbar.top() + @toolbar.height()
|
165
|
+
|
166
|
+
Mercury.displayRect = {top: toolbarHeight, left: 0, width: width, height: height - toolbarHeight, fullHeight: height}
|
167
|
+
|
168
|
+
@iframe.css {
|
169
|
+
top: toolbarHeight
|
170
|
+
left: 0
|
171
|
+
height: height - toolbarHeight
|
172
|
+
}
|
173
|
+
|
174
|
+
Mercury.trigger('resize')
|
175
|
+
|
176
|
+
|
177
|
+
iframeSrc: (url = null, params = false) ->
|
178
|
+
# remove the /editor segment of the url if it gets passed through
|
179
|
+
url = (url ? window.location.href).replace(Mercury.config.editorUrlRegEx ?= /([http|https]:\/\/.[^\/]*)\/editor\/?(.*)/i, "$1/$2")
|
180
|
+
url = url.replace(/[\?|\&]mercury_frame=true/gi, '')
|
181
|
+
url = url.replace(/\&_=i\d+/gi, '')
|
182
|
+
if params
|
183
|
+
# add a param allowing the server to know that the request is coming from mercury
|
184
|
+
# and add a cache busting param so we don't get stale content
|
185
|
+
return "#{url}#{if url.indexOf('?') > -1 then '&' else '?'}mercury_frame=true&_=#{new Date().getTime()}"
|
186
|
+
else
|
187
|
+
return url
|
188
|
+
|
189
|
+
|
190
|
+
loadIframeSrc: (url)->
|
191
|
+
# clear any existing events if we are loading a new iframe to replace the existing one
|
192
|
+
@document.off() if @document
|
193
|
+
|
194
|
+
@iframe.data('loaded', false)
|
195
|
+
@iframe.get(0).contentWindow.document.location.href = @iframeSrc(url, true)
|
196
|
+
|
197
|
+
|
198
|
+
hijackLinksAndForms: ->
|
199
|
+
for element in jQuery('a, form', @document)
|
200
|
+
ignored = false
|
201
|
+
for classname in Mercury.config.nonHijackableClasses || []
|
202
|
+
if jQuery(element).hasClass(classname)
|
203
|
+
ignored = true
|
204
|
+
continue
|
205
|
+
if !ignored && (element.target == '' || element.target == '_self') && !jQuery(element).closest("[#{Mercury.config.regions.attribute}]").length
|
206
|
+
jQuery(element).attr('target', '_parent')
|
207
|
+
|
208
|
+
|
209
|
+
beforeUnload: ->
|
210
|
+
if Mercury.changes && !Mercury.silent
|
211
|
+
return Mercury.I18n('You have unsaved changes. Are you sure you want to leave without saving them first?')
|
212
|
+
return null
|
213
|
+
|
214
|
+
|
215
|
+
getRegionByName: (id) ->
|
216
|
+
for region in @regions
|
217
|
+
return region if region.name == id
|
218
|
+
return null
|
219
|
+
|
220
|
+
|
221
|
+
save: (callback) ->
|
222
|
+
url = @saveUrl ? Mercury.saveUrl ? @iframeSrc()
|
223
|
+
data = @serialize()
|
224
|
+
data = {content: data}
|
225
|
+
|
226
|
+
if @options.saveMethod == 'POST'
|
227
|
+
method = 'POST'
|
228
|
+
else
|
229
|
+
method = 'PUT'
|
230
|
+
data['_method'] = method
|
231
|
+
|
232
|
+
Mercury.log('saving', data)
|
233
|
+
|
234
|
+
options = {
|
235
|
+
headers: Mercury.ajaxHeaders()
|
236
|
+
type: method
|
237
|
+
dataType: @options.saveDataType
|
238
|
+
data: data
|
239
|
+
success: (response) =>
|
240
|
+
Mercury.changes = false
|
241
|
+
Mercury.trigger('saved', response)
|
242
|
+
callback() if typeof(callback) == 'function'
|
243
|
+
error: (response) =>
|
244
|
+
Mercury.trigger('save_failed', response)
|
245
|
+
Mercury.notify('Mercury was unable to save to the url: %s', url)
|
246
|
+
}
|
247
|
+
jQuery.ajax url, options
|
248
|
+
|
249
|
+
|
250
|
+
serialize: ->
|
251
|
+
serialized = {}
|
252
|
+
serialized[region.name] = region.serialize() for region in @regions
|
253
|
+
return serialized
|
254
|
+
|
@@ -0,0 +1,73 @@
|
|
1
|
+
$(document).ready ->
|
2
|
+
$(".sortable").nestedSortable
|
3
|
+
listType: "ul"
|
4
|
+
handle: ".sort_handle"
|
5
|
+
items: "li"
|
6
|
+
toleranceElement: "> div"
|
7
|
+
forcePlaceholderSize: true
|
8
|
+
placeholder: 'placeholder'
|
9
|
+
update: (event, ui) ->
|
10
|
+
mylist = $(".sortable").sortable('serialize')
|
11
|
+
mylist = mylist.replace(/root/g, "")
|
12
|
+
finalstring = ""
|
13
|
+
$(mylist.split("&")).each (index) ->
|
14
|
+
string2 = @split("[")
|
15
|
+
type = string2[0]
|
16
|
+
string3 = string2[1].split("]")
|
17
|
+
id = string3[0]
|
18
|
+
fragments = @split("=")
|
19
|
+
parent_id = fragments[1]
|
20
|
+
finalstring = finalstring + type + "[" + index + "]" + "[id]=" + id + "&" + type + "[" + index + "][parent_id]=" + parent_id + "&" + type + "[" + index + "][position]=" + index + "&"
|
21
|
+
$.post($(this).data('update-url'), finalstring)
|
22
|
+
|
23
|
+
$(".one_level_sortable").nestedSortable
|
24
|
+
listType: "ul"
|
25
|
+
handle: ".sort_handle"
|
26
|
+
items: "li"
|
27
|
+
toleranceElement: "> div"
|
28
|
+
disableNesting: true
|
29
|
+
update: (event, ui) ->
|
30
|
+
mylist = $(".one_level_sortable").sortable('serialize')
|
31
|
+
mylist = mylist.replace(/root/g, "")
|
32
|
+
finalstring = ""
|
33
|
+
$(mylist.split("&")).each (index) ->
|
34
|
+
string2 = @split("[")
|
35
|
+
type = string2[0]
|
36
|
+
string3 = string2[1].split("]")
|
37
|
+
id = string3[0]
|
38
|
+
fragments = @split("=")
|
39
|
+
parent_id = fragments[1]
|
40
|
+
finalstring = finalstring + type + "[" + index + "]" + "[id]=" + id + "&" + type + "[" + index + "][parent_id]=" + parent_id + "&" + type + "[" + index + "][position]=" + index + "&"
|
41
|
+
$.post($(this).data('update-url'), finalstring)
|
42
|
+
|
43
|
+
$(document).on "click", ".add_content_link", (event) ->
|
44
|
+
if $('.add_content_link').hasClass('disabled')
|
45
|
+
return false
|
46
|
+
else
|
47
|
+
$('.add_content_link').addClass('disabled')
|
48
|
+
$('#add_new').append('<div class="add_content_part_input"><label>New Section Name</label><input type="text"></input><br /><a href="#" id="submit_content_part" class="btn btn-primary">Add Section</a></div>')
|
49
|
+
$('.add_content_link').tab('show');
|
50
|
+
return false
|
51
|
+
|
52
|
+
$(document).on "click", "#submit_content_part", (event) ->
|
53
|
+
$.ajax
|
54
|
+
url: '/admin/content_sections.js'
|
55
|
+
type: 'POST'
|
56
|
+
data:
|
57
|
+
resource: $('.add_content_tab').data('resource')
|
58
|
+
resource_id: $('.add_content_tab').data('id')
|
59
|
+
name: $('.add_content_part_input input').val()
|
60
|
+
$('.add_content_part_input').remove();
|
61
|
+
$('.add_content_link').removeClass('disabled')
|
62
|
+
|
63
|
+
$("#draggable li" ).draggable(revert: true, cursor: "move");
|
64
|
+
|
65
|
+
$("#droppable").droppable
|
66
|
+
drop: (event, ui) ->
|
67
|
+
$.ajax
|
68
|
+
url: '/admin/assets/add_image.js'
|
69
|
+
type: 'POST'
|
70
|
+
data:
|
71
|
+
resource: $(ui.draggable).data('resource')
|
72
|
+
resource_id: $(ui.draggable).data('resource-id')
|
73
|
+
asset_id: $(ui.draggable).data('asset-id')
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
+
// the compiled file.
|
6
|
+
//
|
7
|
+
//= require jquery
|
8
|
+
//= require jquery.ui.all
|
9
|
+
//= require jquery_ujs
|
10
|
+
//= require bootstrap-dropdown
|
11
|
+
//= require bootstrap-tab
|
12
|
+
//= require wafflemix/admin/jquery.nested_sortable
|
13
|
+
//= require jquery-fileupload/basic
|
14
|
+
//= require jquery-fileupload/vendor/tmpl
|
15
|
+
//= require wafflemix/admin/bootstrap-datepicker
|
16
|
+
//= require wafflemix/admin/admin
|