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
@@ -0,0 +1,88 @@
|
|
1
|
+
module Wafflemix
|
2
|
+
module ApplicationHelper
|
3
|
+
|
4
|
+
def top_nav
|
5
|
+
output = ''
|
6
|
+
output += content_tag(:div, :class => 'navbar navbar-fixed-top') do
|
7
|
+
content_tag(:div, :class => 'navbar-inner') do
|
8
|
+
content_tag(:div, :class => 'container') do
|
9
|
+
container_content = ''
|
10
|
+
container_content += content_tag(:div, :class => 'btn btn-navbar', :type => 'button', 'data-toggle' => 'collapse', 'data-target' => '.nav-collapse') do
|
11
|
+
icon_bar = ''
|
12
|
+
icon_bar += content_tag(:span, '', :class => 'icon-bar')
|
13
|
+
icon_bar += content_tag(:span, '', :class => 'icon-bar')
|
14
|
+
icon_bar += content_tag(:span, '', :class => 'icon-bar')
|
15
|
+
icon_bar.html_safe
|
16
|
+
end
|
17
|
+
container_content += link_to('WaffleMix', '#', :class => 'brand')
|
18
|
+
container_content += content_tag(:div, '', :class => 'nav-collapse collapse') do
|
19
|
+
content_tag(:ul, :class => 'nav') do
|
20
|
+
top_nav_links.html_safe
|
21
|
+
end
|
22
|
+
end
|
23
|
+
container_content.html_safe
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
output.html_safe
|
28
|
+
end
|
29
|
+
|
30
|
+
def main_subnav
|
31
|
+
output = ''
|
32
|
+
output += content_tag(:div, :class => 'subnav') do
|
33
|
+
content_tag(:ul, :class => 'nav nav-pills') do
|
34
|
+
sub_nav_links.html_safe
|
35
|
+
end
|
36
|
+
end
|
37
|
+
output.html_safe
|
38
|
+
end
|
39
|
+
|
40
|
+
def top_nav_links
|
41
|
+
t = content_tag(:li, link_to('Switch to Site', root_path, :class => 'brand brand_switch'))
|
42
|
+
t += content_tag(:li, link_to('Dashboard', '#'), :class => 'active')
|
43
|
+
t += content_tag(:li, link_to('Pages', admin_pages_path))
|
44
|
+
t += content_tag(:li, link_to('Users', admin_users_path))
|
45
|
+
t += content_tag(:li, link_to('Files and Images', admin_assets_path))
|
46
|
+
t += content_tag(:li, link_to('Categories', admin_categories_path))
|
47
|
+
t += content_tag(:li, link_to('Posts', admin_posts_path))
|
48
|
+
t += content_tag(:li, link_to('Slides', admin_slides_path))
|
49
|
+
t += content_tag(:li, link_to('Portfolio', admin_portfolios_path))
|
50
|
+
t += content_tag(:li, link_to('Contact Forms', admin_contact_forms_path))
|
51
|
+
t += content_tag(:li, '', :class => 'divider-vertical')
|
52
|
+
if user_signed_in?
|
53
|
+
t += content_tag(:li, link_to('Logout', destroy_user_session_path, :method => :delete))
|
54
|
+
else
|
55
|
+
t += content_tag(:li, link_to('Login', new_user_session_path))
|
56
|
+
end
|
57
|
+
t += content_tag(:li, link_to('Customize', '#'))
|
58
|
+
end
|
59
|
+
|
60
|
+
def sub_nav_links
|
61
|
+
t = content_tag(:li, link_to('Global styles', '#'))
|
62
|
+
t += content_tag(:li, link_to('Grid system', '#'))
|
63
|
+
t += content_tag(:li, link_to('Fluid grid system', '#'))
|
64
|
+
t += content_tag(:li, link_to('Customizing', '#'))
|
65
|
+
t += content_tag(:li, link_to('Layouts', '#'))
|
66
|
+
t += content_tag(:li, link_to('Responsive design', '#'))
|
67
|
+
end
|
68
|
+
|
69
|
+
def main_menu(pages)
|
70
|
+
pages.map do |page, sub_pages|
|
71
|
+
content_tag(:li, :id => page.title, :class => menu_level_class(page)) do
|
72
|
+
link_to(page.title, link_with_parents(page)) + (content_tag(:ul, main_menu(sub_pages), :class => 'dropdown') if sub_pages.any?)
|
73
|
+
end
|
74
|
+
end.join.html_safe
|
75
|
+
end
|
76
|
+
|
77
|
+
def menu_level_class(page)
|
78
|
+
if page.is_root?
|
79
|
+
'level1'
|
80
|
+
elsif page.parent.is_root?
|
81
|
+
'level2'
|
82
|
+
else
|
83
|
+
'level3'
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Wafflemix
|
2
|
+
module PagesHelper
|
3
|
+
|
4
|
+
def link_with_parents(page)
|
5
|
+
if page.link_url == 'home'
|
6
|
+
'/'
|
7
|
+
elsif Page.ancestors_of(page).any?
|
8
|
+
'/' + [Page.ancestors_of(page).map{|p| p.title.parameterize}, page.link_url].join('/').gsub(/\/\//, '/')
|
9
|
+
else
|
10
|
+
'/' + page.link_url
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def tree_view(pages)
|
15
|
+
pages.map do |page, sub_pages|
|
16
|
+
content_tag(:li, :id => dom_id(page)) do
|
17
|
+
render(:partial => 'wafflemix/admin/pages/page', :object => page) + (content_tag(:ul, tree_view(sub_pages)) if sub_pages.any?)
|
18
|
+
end
|
19
|
+
end.join.html_safe
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Wafflemix
|
2
|
+
module PortfoliosHelper
|
3
|
+
def portfolio_tree_view(portfolios)
|
4
|
+
portfolios.map do |portfolio|
|
5
|
+
content_tag(:li, :id => dom_id(portfolio)) do
|
6
|
+
render(:partial => 'wafflemix/admin/portfolios/portfolio', :object => portfolio)
|
7
|
+
end
|
8
|
+
end.join.html_safe
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/app/models/user.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
class User < ActiveRecord::Base
|
2
|
+
self.table_name = 'wafflemix_users'
|
3
|
+
|
4
|
+
attr_accessible :email, :username, :password, :password_confirmation, :remember_me
|
5
|
+
|
6
|
+
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable
|
7
|
+
|
8
|
+
has_many :wafflemix_roles, :class_name => 'Wafflemix::Role'
|
9
|
+
has_many :roles, :through => :wafflemix_roles
|
10
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Wafflemix
|
2
|
+
class Asset < ActiveRecord::Base
|
3
|
+
|
4
|
+
image_accessor :asset
|
5
|
+
|
6
|
+
attr_accessible :asset_name, :asset_mime_type, :asset_uid, :asset_size, :asset_origin, :asset
|
7
|
+
|
8
|
+
attr_accessor :path
|
9
|
+
|
10
|
+
#one convenient method to pass jq_upload the necessary information
|
11
|
+
def to_jq_upload
|
12
|
+
{
|
13
|
+
"name" => read_attribute(:asset_name),
|
14
|
+
"size" => asset_size,
|
15
|
+
"url" => asset_url,
|
16
|
+
"thumbnail_url" => asset.thumb('80x80#').url,
|
17
|
+
"delete_url" => Wafflemix::Engine::routes.url_helpers.admin_asset_path(:id => id),
|
18
|
+
"delete_type" => "DELETE"
|
19
|
+
}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
module Wafflemix
|
2
|
+
class Category < ActiveRecord::Base
|
3
|
+
attr_accessible :ancestry, :categorical_id, :categorical_type, :name, :position
|
4
|
+
|
5
|
+
has_many :categoricals
|
6
|
+
has_many :posts, :through => :categoricals, :source => :categorical, :source_type => 'Wafflemix::Post'
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Wafflemix
|
2
|
+
class ContactForm < ActiveRecord::Base
|
3
|
+
attr_accessible :email, :message, :name, :subject
|
4
|
+
|
5
|
+
validates_presence_of :email, :name
|
6
|
+
|
7
|
+
include Spamster::Model
|
8
|
+
spamster_attrs comment_author: :name, comment_author_email: :email
|
9
|
+
|
10
|
+
after_create :check_for_spam
|
11
|
+
|
12
|
+
def check_for_spam
|
13
|
+
if ENV['AKISMET_SITE_URL'] && ENV['AKISMET_API_KEY']
|
14
|
+
self.spam = self.spamster.spam?
|
15
|
+
self.save
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Wafflemix
|
2
|
+
class ContentSection < ActiveRecord::Base
|
3
|
+
attr_accessible :content, :contentable_id, :contentable_type, :name
|
4
|
+
|
5
|
+
belongs_to :contentable, :polymorphic => true
|
6
|
+
|
7
|
+
def self.title
|
8
|
+
self.name.downcase.parameterize
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.content_for(name)
|
12
|
+
part = where('lower(name) LIKE ?', "%#{name.downcase}%").first
|
13
|
+
if part
|
14
|
+
part.content
|
15
|
+
else
|
16
|
+
false
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Wafflemix
|
2
|
+
class Page < ActiveRecord::Base
|
3
|
+
attr_accessible :deletable, :draft, :link_url, :parent_id, :position, :show_in_menu, :skip_to_first, :title, :translations_attributes, :locale, :content_parts_attributes, :meta_content_attributes
|
4
|
+
|
5
|
+
has_many :content_parts, :as => :contentable, :class_name => 'Wafflemix::ContentSection'
|
6
|
+
has_one :meta_content, :as => :metable, :class_name => 'Wafflemix::MetaContent'
|
7
|
+
|
8
|
+
accepts_nested_attributes_for :content_parts
|
9
|
+
accepts_nested_attributes_for :meta_content
|
10
|
+
|
11
|
+
default_scope :order => 'position ASC'
|
12
|
+
scope :active, where(:draft => false, :show_in_menu => true)
|
13
|
+
|
14
|
+
has_ancestry
|
15
|
+
|
16
|
+
translates :title
|
17
|
+
|
18
|
+
class Translation
|
19
|
+
attr_accessible :title, :locale
|
20
|
+
end
|
21
|
+
|
22
|
+
before_save :convert_to_safe_url
|
23
|
+
|
24
|
+
validates_presence_of :title
|
25
|
+
|
26
|
+
def to_param
|
27
|
+
link_url.gsub('/', '')
|
28
|
+
end
|
29
|
+
|
30
|
+
def convert_to_safe_url
|
31
|
+
if !self.link_url.blank?
|
32
|
+
safe_url = self.link_url.gsub('/','').parameterize
|
33
|
+
else
|
34
|
+
safe_url = self.title.parameterize
|
35
|
+
end
|
36
|
+
self.link_url = safe_url
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Wafflemix
|
2
|
+
class Portfolio < ActiveRecord::Base
|
3
|
+
attr_accessible :content, :intro, :title, :meta_content_attributes
|
4
|
+
|
5
|
+
validates_presence_of :content, :intro, :title
|
6
|
+
validates_uniqueness_of :title
|
7
|
+
|
8
|
+
has_ancestry
|
9
|
+
|
10
|
+
has_many :images, :as => :imageable
|
11
|
+
has_many :assets, :through => :images
|
12
|
+
has_one :meta_content, :as => :metable, :class_name => 'Wafflemix::MetaContent'
|
13
|
+
|
14
|
+
accepts_nested_attributes_for :meta_content
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Wafflemix
|
2
|
+
|
3
|
+
class Post < ActiveRecord::Base
|
4
|
+
attr_accessible :draft, :link_url, :published_at, :translations_attributes, :locale, :title, :content, :tag_list, :category_ids, :meta_content_attributes
|
5
|
+
|
6
|
+
acts_as_taggable
|
7
|
+
ActsAsTaggableOn.force_parameterize = true
|
8
|
+
|
9
|
+
default_scope :order => 'published_at DESC'
|
10
|
+
scope :published, lambda { where("published_at <= ? AND draft != ?", Time.zone.now, true) }
|
11
|
+
|
12
|
+
has_many :categoricals, :as => :categorical
|
13
|
+
has_many :categories, :through => :categoricals
|
14
|
+
has_many :images, :as => :imageable
|
15
|
+
has_many :assets, :through => :images
|
16
|
+
has_one :meta_content, :as => :metable, :class_name => 'Wafflemix::MetaContent'
|
17
|
+
|
18
|
+
translates :title, :body, :excerpt
|
19
|
+
|
20
|
+
accepts_nested_attributes_for :meta_content
|
21
|
+
|
22
|
+
class Translation
|
23
|
+
attr_accessible :title, :body, :excerpt, :locale
|
24
|
+
end
|
25
|
+
|
26
|
+
validates_presence_of :title
|
27
|
+
|
28
|
+
def to_param
|
29
|
+
"#{id}-#{link_url.gsub('/', '')}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Wafflemix
|
2
|
+
class Role < ActiveRecord::Base
|
3
|
+
attr_accessible :name
|
4
|
+
|
5
|
+
validates_uniqueness_of :name
|
6
|
+
|
7
|
+
has_many :wafflemix_user_roles, :class_name => 'Wafflemix::UserRole'
|
8
|
+
has_many :users, :through => :wafflemix_user_roles, :class_name => 'Wafflemix::User'
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Wafflemix
|
2
|
+
class Slide < ActiveRecord::Base
|
3
|
+
default_scope :order => 'position ASC'
|
4
|
+
|
5
|
+
attr_accessible :name, :position, :parent_id, :slide_link, :content
|
6
|
+
|
7
|
+
validates_presence_of :name
|
8
|
+
|
9
|
+
has_ancestry
|
10
|
+
|
11
|
+
has_many :images, :as => :imageable
|
12
|
+
has_many :assets, :through => :images
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Wafflemix
|
2
|
+
class User < ActiveRecord::Base
|
3
|
+
|
4
|
+
attr_accessible :email, :username, :password, :password_confirmation, :remember_me
|
5
|
+
|
6
|
+
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable
|
7
|
+
|
8
|
+
has_many :wafflemix_user_roles, :class_name => 'Wafflemix::UserRole'
|
9
|
+
has_many :roles, :through => :wafflemix_user_roles, :class_name => 'Wafflemix::Role'
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%- if controller_name != 'sessions' %>
|
2
|
+
<%= link_to "Sign in", new_session_path(resource_name) %><br />
|
3
|
+
<% end -%>
|
4
|
+
|
5
|
+
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
6
|
+
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
|
7
|
+
<% end -%>
|
8
|
+
|
9
|
+
<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
|
10
|
+
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
11
|
+
<% end -%>
|
12
|
+
|
13
|
+
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
14
|
+
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
15
|
+
<% end -%>
|
16
|
+
|
17
|
+
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
18
|
+
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
|
19
|
+
<% end -%>
|
20
|
+
|
21
|
+
<%- if devise_mapping.omniauthable? %>
|
22
|
+
<%- resource_class.omniauth_providers.each do |provider| %>
|
23
|
+
<%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
|
24
|
+
<% end -%>
|
25
|
+
<% end -%>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<h2>Resend confirmation instructions</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
|
4
|
+
<%= devise_error_messages! %>
|
5
|
+
|
6
|
+
<div><%= f.label :email %><br />
|
7
|
+
<%= f.email_field :email %></div>
|
8
|
+
|
9
|
+
<div><%= f.submit "Resend confirmation instructions" %></div>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= render "links" %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<p>Hello <%= @resource.email %>!</p>
|
2
|
+
|
3
|
+
<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
|
4
|
+
|
5
|
+
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
|
6
|
+
|
7
|
+
<p>If you didn't request this, please ignore this email.</p>
|
8
|
+
<p>Your password won't change until you access the link above and create a new one.</p>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<p>Hello <%= @resource.email %>!</p>
|
2
|
+
|
3
|
+
<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
|
4
|
+
|
5
|
+
<p>Click the link below to unlock your account:</p>
|
6
|
+
|
7
|
+
<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<h2>Change your password</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
|
4
|
+
<%= devise_error_messages! %>
|
5
|
+
<%= f.hidden_field :reset_password_token %>
|
6
|
+
|
7
|
+
<div><%= f.label :password, "New password" %><br />
|
8
|
+
<%= f.password_field :password %></div>
|
9
|
+
|
10
|
+
<div><%= f.label :password_confirmation, "Confirm new password" %><br />
|
11
|
+
<%= f.password_field :password_confirmation %></div>
|
12
|
+
|
13
|
+
<div><%= f.submit "Change my password" %></div>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render "links" %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<h2>Forgot your password?</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
|
4
|
+
<%= devise_error_messages! %>
|
5
|
+
|
6
|
+
<div><%= f.label :email %><br />
|
7
|
+
<%= f.email_field :email %></div>
|
8
|
+
|
9
|
+
<div><%= f.submit "Send me reset password instructions" %></div>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= render "links" %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
|
4
|
+
<%= devise_error_messages! %>
|
5
|
+
|
6
|
+
<div><%= f.label :email %><br />
|
7
|
+
<%= f.email_field :email %></div>
|
8
|
+
|
9
|
+
<div><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
|
10
|
+
<%= f.password_field :password, :autocomplete => "off" %></div>
|
11
|
+
|
12
|
+
<div><%= f.label :password_confirmation %><br />
|
13
|
+
<%= f.password_field :password_confirmation %></div>
|
14
|
+
|
15
|
+
<div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
16
|
+
<%= f.password_field :current_password %></div>
|
17
|
+
|
18
|
+
<div><%= f.submit "Update" %></div>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<h3>Cancel my account</h3>
|
22
|
+
|
23
|
+
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
|
24
|
+
|
25
|
+
<%= link_to "Back", :back %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<h2>Sign up</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
|
4
|
+
<%= devise_error_messages! %>
|
5
|
+
|
6
|
+
<div><%= f.label :email %><br />
|
7
|
+
<%= f.email_field :email %></div>
|
8
|
+
|
9
|
+
<div><%= f.label :password %><br />
|
10
|
+
<%= f.password_field :password %></div>
|
11
|
+
|
12
|
+
<div><%= f.label :password_confirmation %><br />
|
13
|
+
<%= f.password_field :password_confirmation %></div>
|
14
|
+
|
15
|
+
<div><%= f.submit "Sign up" %></div>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<%= render "links" %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<h2>Sign in</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
|
4
|
+
<div><%= f.label :email %><br />
|
5
|
+
<%= f.text_field :email %></div>
|
6
|
+
|
7
|
+
<div><%= f.label :password %><br />
|
8
|
+
<%= f.password_field :password %></div>
|
9
|
+
|
10
|
+
<% if devise_mapping.rememberable? -%>
|
11
|
+
<div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
|
12
|
+
<% end -%>
|
13
|
+
|
14
|
+
<div><%= f.submit "Sign in" %></div>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<%= render "links" %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<h2>Resend unlock instructions</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
|
4
|
+
<%= devise_error_messages! %>
|
5
|
+
|
6
|
+
<div><%= f.label :email %><br />
|
7
|
+
<%= f.email_field :email %></div>
|
8
|
+
|
9
|
+
<div><%= f.submit "Resend unlock instructions" %></div>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= render "links" %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta name="viewport" content="width=device-width, maximum-scale=1.0, initial-scale=1.0">
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
<title>Mercury Editor</title>
|
7
|
+
<%= stylesheet_link_tag 'mercury' %>
|
8
|
+
<%= javascript_include_tag 'jquery-1.7', 'wafflemix/mercury' %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<script type="text/javascript">
|
12
|
+
// Set to the url that you want to save any given page to, leave null for default handling.
|
13
|
+
var saveUrl = null;
|
14
|
+
|
15
|
+
// Instantiate the PageEditor
|
16
|
+
new Mercury.PageEditor(saveUrl, {
|
17
|
+
saveStyle: 'form', // 'form', or 'json' (default json)
|
18
|
+
saveMethod: 'POST', // 'PUT', or 'POST', (create, vs. update -- default PUT)
|
19
|
+
visible: true // boolean - if the interface should start visible or not
|
20
|
+
});
|
21
|
+
</script>
|
22
|
+
|
23
|
+
</body>
|
24
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Wafflemix Admin</title>
|
5
|
+
<%= stylesheet_link_tag "wafflemix/admin/admin", :media => "all" %>
|
6
|
+
<%= javascript_include_tag "wafflemix/admin/admin_js" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
<%= yield :custom_js %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<%= top_nav %>
|
12
|
+
<div class="container-fluid container">
|
13
|
+
<%= main_subnav %>
|
14
|
+
<div class="row-fluid">
|
15
|
+
<%= yield %>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
</body>
|
19
|
+
</html>
|