dust-cms 0.0.05
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +20 -0
- data/README.md +3 -0
- data/Rakefile +5 -0
- data/app/assets/images/admin/blank.png +0 -0
- data/app/assets/images/admin/dust-letterpress.png +0 -0
- data/app/assets/images/admin/main-back.png +0 -0
- data/app/assets/images/admin/ui/delete-icon.png +0 -0
- data/app/assets/images/admin/ui/edit-icon.png +0 -0
- data/app/assets/images/admin/ui/handle.png +0 -0
- data/app/assets/images/admin/ui/icons.png +0 -0
- data/app/assets/images/admin/ui/index-icon.png +0 -0
- data/app/assets/images/admin/ui/new-icon.png +0 -0
- data/app/assets/images/entypo/entypo.eot +0 -0
- data/app/assets/images/entypo/entypo.svg +13 -0
- data/app/assets/images/entypo/entypo.ttf +0 -0
- data/app/assets/images/entypo/entypo.woff +0 -0
- data/app/assets/images/entypo-social/entypo-social.eot +0 -0
- data/app/assets/images/entypo-social/entypo-social.svg +13 -0
- data/app/assets/images/entypo-social/entypo-social.ttf +0 -0
- data/app/assets/images/entypo-social/entypo-social.woff +0 -0
- data/app/assets/images/fancybox/blank.gif +0 -0
- data/app/assets/images/fancybox/fancy_close.png +0 -0
- data/app/assets/images/fancybox/fancy_loading.png +0 -0
- data/app/assets/images/fancybox/fancy_nav_left.png +0 -0
- data/app/assets/images/fancybox/fancy_nav_right.png +0 -0
- data/app/assets/images/fancybox/fancy_shadow_e.png +0 -0
- data/app/assets/images/fancybox/fancy_shadow_n.png +0 -0
- data/app/assets/images/fancybox/fancy_shadow_ne.png +0 -0
- data/app/assets/images/fancybox/fancy_shadow_nw.png +0 -0
- data/app/assets/images/fancybox/fancy_shadow_s.png +0 -0
- data/app/assets/images/fancybox/fancy_shadow_se.png +0 -0
- data/app/assets/images/fancybox/fancy_shadow_sw.png +0 -0
- data/app/assets/images/fancybox/fancy_shadow_w.png +0 -0
- data/app/assets/images/fancybox/fancy_title_left.png +0 -0
- data/app/assets/images/fancybox/fancy_title_main.png +0 -0
- data/app/assets/images/fancybox/fancy_title_over.png +0 -0
- data/app/assets/images/fancybox/fancy_title_right.png +0 -0
- data/app/assets/images/fancybox/fancybox-x.png +0 -0
- data/app/assets/images/fancybox/fancybox-y.png +0 -0
- data/app/assets/images/fancybox/fancybox.png +0 -0
- data/app/assets/javascripts/cms/dust/defaults.js.coffee +31 -0
- data/app/assets/javascripts/cms/dust/gallery/photo.js.coffee +1 -0
- data/app/assets/javascripts/cms/dust/gallery/photo_view.js.coffee +21 -0
- data/app/assets/javascripts/cms/dust/gallery/photos.js.coffee +6 -0
- data/app/assets/javascripts/cms/dust/gallery/photos_view.js.coffee +12 -0
- data/app/assets/javascripts/cms/dust/gallery/router.js.coffee +14 -0
- data/app/assets/javascripts/cms/dust/gallery.js.coffee +31 -0
- data/app/assets/javascripts/cms/dust/nav.js.coffee +21 -0
- data/app/assets/javascripts/cms/dust/sections.js.coffee +21 -0
- data/app/assets/javascripts/cms/dust/sortables.js.coffee +64 -0
- data/app/assets/javascripts/cms/dust/window.js.coffee +11 -0
- data/app/assets/javascripts/cms/dust.js.coffee +19 -0
- data/app/assets/javascripts/cms/lib/backbone.js +42 -0
- data/app/assets/javascripts/cms/lib/fineuploader-3.0.js +71 -0
- data/app/assets/javascripts/cms/lib/handlebars.js +1920 -0
- data/app/assets/javascripts/cms/lib/spin.js +2 -0
- data/app/assets/javascripts/cms/lib/underscore.js +1 -0
- data/app/assets/javascripts/cms.js +14 -0
- data/app/assets/javascripts/core/jquery.form.js +785 -0
- data/app/assets/javascripts/core/jquery.html5.js +29 -0
- data/app/assets/javascripts/core/jquery.mousewheel-3.0.2.pack.js +13 -0
- data/app/assets/javascripts/core/jquery.placeholder.min.js +11 -0
- data/app/assets/javascripts/core/nestedsortables.js +429 -0
- data/app/assets/javascripts/core/serializelist.js +66 -0
- data/app/assets/javascripts/core/tipTip.js +21 -0
- data/app/assets/javascripts/core.js +4 -0
- data/app/assets/javascripts/front_end/application-main.js.coffee +27 -0
- data/app/assets/javascripts/front_end/map.js +34 -0
- data/app/assets/javascripts/front_end/video.js +4569 -0
- data/app/assets/javascripts/front_end.js +18 -0
- data/app/assets/stylesheets/cms/flash_messages.css.scss +17 -0
- data/app/assets/stylesheets/cms/footer.css.scss +12 -0
- data/app/assets/stylesheets/cms/forms.css.scss +67 -0
- data/app/assets/stylesheets/cms/gallery.css.scss +21 -0
- data/app/assets/stylesheets/cms/icons.css.scss +123 -0
- data/app/assets/stylesheets/cms/jquery-ui.custom.scss +6 -0
- data/app/assets/stylesheets/cms/layout.css.scss +162 -0
- data/app/assets/stylesheets/cms/lib/grid.css.scss +116 -0
- data/app/assets/stylesheets/cms/lib/mixins.css.scss +20 -0
- data/app/assets/stylesheets/cms/login.scss +12 -0
- data/app/assets/stylesheets/cms/main.old +155 -0
- data/app/assets/stylesheets/cms/nav.css.scss +73 -0
- data/app/assets/stylesheets/cms/sections.scss +17 -0
- data/app/assets/stylesheets/cms/sortables.scss +20 -0
- data/app/assets/stylesheets/cms.css.scss +30 -0
- data/app/assets/stylesheets/core/app/defaults.css.scss +556 -0
- data/app/assets/stylesheets/core/plugins/PIE.htc +96 -0
- data/app/assets/stylesheets/core/plugins/jquery-ui-1.8.5.custom.old +572 -0
- data/app/assets/stylesheets/core/plugins/jquery.fancybox-1.3.1.css +364 -0
- data/app/assets/stylesheets/core/plugins/skeleton.css +155 -0
- data/app/assets/stylesheets/core/plugins/tipTip.css +115 -0
- data/app/assets/stylesheets/core/plugins/uploadify.css +25 -0
- data/app/assets/stylesheets/core/reset/reset.css +211 -0
- data/app/assets/stylesheets/core/reset/text.css +86 -0
- data/app/assets/stylesheets/core.css.scss +14 -0
- data/app/assets/stylesheets/front_end/app/just-delete-me-and-start-over.css.scss +70 -0
- data/app/assets/stylesheets/front_end.css +14 -0
- data/app/controllers/authentication_controller.rb +30 -0
- data/app/controllers/dust/blocks_controller.rb +49 -0
- data/app/controllers/dust/contacts_controller.rb +89 -0
- data/app/controllers/dust/dashboard_controller.rb +26 -0
- data/app/controllers/dust/gallery/albums_controller.rb +49 -0
- data/app/controllers/dust/gallery/api/photos_controller.rb +28 -0
- data/app/controllers/dust/gallery/photos_controller.rb +47 -0
- data/app/controllers/dust/menu_items_controller.rb +51 -0
- data/app/controllers/dust/menus_controller.rb +47 -0
- data/app/controllers/dust/pages_controller.rb +52 -0
- data/app/controllers/dust/password_resets_controller.rb +48 -0
- data/app/controllers/dust/posts_controller.rb +47 -0
- data/app/controllers/dust/roles_controller.rb +47 -0
- data/app/controllers/dust/sessions_controller.rb +29 -0
- data/app/controllers/dust/site_wides_controller.rb +28 -0
- data/app/controllers/dust/sortable_controller.rb +17 -0
- data/app/controllers/dust/users_controller.rb +52 -0
- data/app/controllers/front_end/page_controller.rb +27 -0
- data/app/controllers/front_end/post_controller.rb +14 -0
- data/app/controllers/front_end/sitemap_controller.rb +11 -0
- data/app/controllers/front_end_controller.rb +18 -0
- data/app/helpers/error_messages_helper.rb +23 -0
- data/app/helpers/exceptions.rb +4 -0
- data/app/helpers/layout_helper.rb +28 -0
- data/app/helpers/misc_helper.rb +29 -0
- data/app/helpers/region_helper.rb +32 -0
- data/app/mailers/post_office.rb +39 -0
- data/app/models/ckeditor/asset.rb +7 -0
- data/app/models/ckeditor/attachment_file.rb +7 -0
- data/app/models/ckeditor/picture.rb +7 -0
- data/app/models/dust/block.rb +114 -0
- data/app/models/dust/builder/page.rb +84 -0
- data/app/models/dust/builder/site_wide.rb +50 -0
- data/app/models/dust/contact.rb +34 -0
- data/app/models/dust/gallery/album.rb +14 -0
- data/app/models/dust/gallery/photo.rb +23 -0
- data/app/models/dust/handlebar.rb +59 -0
- data/app/models/dust/map.rb +21 -0
- data/app/models/dust/menu/item_dependency.rb +66 -0
- data/app/models/dust/menu.rb +11 -0
- data/app/models/dust/menu_item.rb +64 -0
- data/app/models/dust/page.rb +52 -0
- data/app/models/dust/post.rb +39 -0
- data/app/models/dust/role.rb +9 -0
- data/app/models/dust/section.rb +11 -0
- data/app/models/dust/session.rb +28 -0
- data/app/models/dust/site_wide.rb +41 -0
- data/app/models/dust/sort.rb +52 -0
- data/app/models/dust/sortable_item.rb +21 -0
- data/app/models/dust/user.rb +49 -0
- data/app/uploaders/ckeditor_attachment_file_uploader.rb +42 -0
- data/app/uploaders/ckeditor_picture_uploader.rb +53 -0
- data/app/uploaders/gallery_photo_uploader.rb +52 -0
- data/app/uploaders/image_uploader.rb +51 -0
- data/app/uploaders/slide_image_uploader.rb +51 -0
- data/app/views/dust/blocks/_block.html.haml +20 -0
- data/app/views/dust/blocks/_form.html.haml +50 -0
- data/app/views/dust/blocks/_normal_block_content.html.haml +1 -0
- data/app/views/dust/blocks/_search.html.haml +4 -0
- data/app/views/dust/blocks/edit.html.haml +4 -0
- data/app/views/dust/blocks/index.html.haml +16 -0
- data/app/views/dust/blocks/new.html.haml +3 -0
- data/app/views/dust/contacts/_form.html.haml +37 -0
- data/app/views/dust/contacts/_import_csv.html.haml +8 -0
- data/app/views/dust/contacts/_instance.html.haml +13 -0
- data/app/views/dust/contacts/_search.html.haml +4 -0
- data/app/views/dust/contacts/edit.html.haml +2 -0
- data/app/views/dust/contacts/index.html.haml +17 -0
- data/app/views/dust/contacts/index.json.haml +6 -0
- data/app/views/dust/contacts/new.html.haml +3 -0
- data/app/views/dust/dashboard/_options.html.haml +6 -0
- data/app/views/dust/dashboard/show.html.haml +33 -0
- data/app/views/dust/dashboard/update.html.haml +6 -0
- data/app/views/dust/gallery/albums/_form.html.haml +52 -0
- data/app/views/dust/gallery/albums/_photo.html.haml +12 -0
- data/app/views/dust/gallery/albums/edit.html.haml +3 -0
- data/app/views/dust/gallery/albums/index.html.haml +18 -0
- data/app/views/dust/gallery/albums/new.html.haml +4 -0
- data/app/views/dust/gallery/albums/show.html.haml +2 -0
- data/app/views/dust/gallery/photos/_form.html.haml +26 -0
- data/app/views/dust/gallery/photos/edit.html.haml +3 -0
- data/app/views/dust/gallery/photos/index.html.haml +18 -0
- data/app/views/dust/gallery/photos/new.html.haml +4 -0
- data/app/views/dust/gallery/photos/show.json.jbuilder +5 -0
- data/app/views/dust/menu_items/_form.html.haml +24 -0
- data/app/views/dust/menu_items/_roots.html.haml +3 -0
- data/app/views/dust/menu_items/_search.html.haml +4 -0
- data/app/views/dust/menu_items/_tree.html.haml +11 -0
- data/app/views/dust/menu_items/edit.html.haml +2 -0
- data/app/views/dust/menu_items/index.html.haml +19 -0
- data/app/views/dust/menu_items/new.html.haml +2 -0
- data/app/views/dust/menus/_form.html.haml +39 -0
- data/app/views/dust/menus/edit.html.haml +3 -0
- data/app/views/dust/menus/index.html.haml +18 -0
- data/app/views/dust/menus/new.html.haml +4 -0
- data/app/views/dust/menus/show.html.haml +2 -0
- data/app/views/dust/pages/_form.html.haml +68 -0
- data/app/views/dust/pages/_search.html.haml +4 -0
- data/app/views/dust/pages/edit.html.haml +3 -0
- data/app/views/dust/pages/index.html.haml +16 -0
- data/app/views/dust/pages/new.html.haml +3 -0
- data/app/views/dust/password_resets/edit.html.haml +6 -0
- data/app/views/dust/password_resets/new.html.haml +10 -0
- data/app/views/dust/posts/_form.html.haml +39 -0
- data/app/views/dust/posts/edit.html.haml +3 -0
- data/app/views/dust/posts/index.html.haml +18 -0
- data/app/views/dust/posts/new.html.haml +4 -0
- data/app/views/dust/posts/show.html.haml +2 -0
- data/app/views/dust/roles/_form.html.haml +11 -0
- data/app/views/dust/roles/edit.html.haml +2 -0
- data/app/views/dust/roles/index.html.haml +14 -0
- data/app/views/dust/roles/new.html.haml +2 -0
- data/app/views/dust/sessions/_form.html.haml +18 -0
- data/app/views/dust/sessions/new.html.haml +2 -0
- data/app/views/dust/site_wides/new.html.haml +19 -0
- data/app/views/dust/slides/_form.html.haml +26 -0
- data/app/views/dust/slides/_search.html.haml +4 -0
- data/app/views/dust/slides/_slideshow.html.haml +12 -0
- data/app/views/dust/slides/edit.html.haml +5 -0
- data/app/views/dust/slides/index.html.haml +25 -0
- data/app/views/dust/slides/index.js.haml +2 -0
- data/app/views/dust/slides/new.html.haml +6 -0
- data/app/views/dust/slides/show.html.haml +15 -0
- data/app/views/dust/sortable/sort.js.coffee +10 -0
- data/app/views/dust/users/_form.html.haml +27 -0
- data/app/views/dust/users/_search.html.haml +4 -0
- data/app/views/dust/users/_user_bar.html.haml +10 -0
- data/app/views/dust/users/dashboard.html.haml +40 -0
- data/app/views/dust/users/edit.html.haml +2 -0
- data/app/views/dust/users/index.html.haml +16 -0
- data/app/views/dust/users/new.html.haml +2 -0
- data/app/views/front_end/page/_admin.html.haml +6 -0
- data/app/views/front_end/page/search.html.haml +9 -0
- data/app/views/front_end/page/show.html.haml +8 -0
- data/app/views/front_end/post/_admin.html.haml +7 -0
- data/app/views/front_end/post/show.html.haml +12 -0
- data/app/views/front_end/sitemap/index.html.haml +4 -0
- data/app/views/front_end/sitemap/index.xml.haml +9 -0
- data/app/views/layouts/app_partials/_analytics.html.haml +11 -0
- data/app/views/layouts/app_partials/_application_tree.html.haml +6 -0
- data/app/views/layouts/cms.html.haml +52 -0
- data/app/views/layouts/cms_partials/_nav.html.haml +5 -0
- data/app/views/layouts/front_end.html.haml +22 -0
- data/app/views/layouts/sessions.html.haml +19 -0
- data/app/views/post_office/contact_confirmation.html.haml +7 -0
- data/app/views/post_office/contact_request.html.haml +24 -0
- data/app/views/post_office/password_reset_instructions.html.haml +6 -0
- data/app/views/widgets/_contact_form.html.haml +20 -0
- data/app/views/widgets/_map.html.haml +16 -0
- data/app/views/widgets/_quick_contact_form.html.haml +10 -0
- data/app/views/widgets/_site_map.html.haml +7 -0
- data/app/views/widgets/_site_menu.html.haml +10 -0
- data/app/views/widgets/_slider.html.haml +0 -0
- data/app/views/widgets/_user_login.html.haml +13 -0
- data/app/views/widgets/galleries/_archive.html.haml +1 -0
- data/app/views/widgets/galleries/_show.html.haml +0 -0
- data/app/views/widgets/posts/_index.html.haml +1 -0
- data/app/views/widgets/posts/_show.html.haml +0 -0
- data/config/authorization_rules.rb +23 -0
- data/config/generators/templates/haml/scaffold/_form.html.haml +19 -0
- data/config/generators/templates/haml/scaffold/edit.html.haml +3 -0
- data/config/generators/templates/haml/scaffold/index.html.haml +18 -0
- data/config/generators/templates/haml/scaffold/new.html.haml +4 -0
- data/config/generators/templates/haml/scaffold/show.html.haml +2 -0
- data/config/generators/templates/rails/scaffold_controller/controller.rb +51 -0
- data/config/initializers/app_string_io.rb +12 -0
- data/config/initializers/ckeditor.rb +18 -0
- data/config/initializers/client_side_validations.rb +13 -0
- data/config/initializers/dust_config.rb +22 -0
- data/config/initializers/dust_core_reloader.rb +11 -0
- data/config/initializers/sorcery.rb +398 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/routes.rb +55 -0
- data/db/migrate/20101206025845_create_roles.rb +11 -0
- data/db/migrate/20110217212357_create_ckeditor_assets.rb +31 -0
- data/db/migrate/20110218000640_create_pages.rb +15 -0
- data/db/migrate/20110218000641_create_sections.rb +15 -0
- data/db/migrate/20110218002220_create_contacts.rb +22 -0
- data/db/migrate/20110218020608_create_menu_items.rb +21 -0
- data/db/migrate/20110507014158_create_blocks.rb +23 -0
- data/db/migrate/20121106195938_sorcery_core.rb +17 -0
- data/db/migrate/20121106195939_sorcery_remember_me.rb +15 -0
- data/db/migrate/20121106195940_sorcery_reset_password.rb +17 -0
- data/db/migrate/20121106195941_sorcery_activity_logging.rb +17 -0
- data/db/migrate/20121106200754_sorcery_user_activation.rb +17 -0
- data/db/migrate/20130220044031_create_site_wides.rb +11 -0
- data/db/migrate/20130220051658_create_menus.rb +11 -0
- data/db/migrate/20130223030136_create_albums.rb +13 -0
- data/db/migrate/20130223040911_create_photos.rb +15 -0
- data/db/migrate/20130223044553_create_posts.rb +15 -0
- data/lib/dust/engine.rb +18 -0
- data/lib/dust/utils.rb +14 -0
- data/lib/dust/version.rb +3 -0
- data/lib/dust-cms.rb +53 -0
- data/lib/tasks/dust_tasks.rake +51 -0
- data/lib/tasks/seed.rb +46 -0
- metadata +613 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module Dust
|
|
2
|
+
class MenuItemsController < AuthenticationController
|
|
3
|
+
filter_access_to :all
|
|
4
|
+
|
|
5
|
+
layout "cms"
|
|
6
|
+
|
|
7
|
+
def new
|
|
8
|
+
@menu_item = Dust::MenuItem.new
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create
|
|
12
|
+
@menu_item = Dust::MenuItem.new(params[:dust_menu_item])
|
|
13
|
+
if params[:menu_id]
|
|
14
|
+
@menu = Dust::Menu.find(params[:menu_id])
|
|
15
|
+
@menu_item.menu = @menu
|
|
16
|
+
end
|
|
17
|
+
if @menu_item.save
|
|
18
|
+
flash[:notice] = "Successfully created menu item."
|
|
19
|
+
try_return_to_previous_page(dust_menu_items_url)
|
|
20
|
+
else
|
|
21
|
+
render :action => 'new'
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def edit
|
|
26
|
+
@menu_item = Dust::MenuItem.find(params[:id])
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def update
|
|
30
|
+
@menu_item = Dust::MenuItem.find(params[:id])
|
|
31
|
+
if params[:menu_id]
|
|
32
|
+
@menu = Dust::Menu.find(params[:menu_id])
|
|
33
|
+
@menu_item.menu = @menu
|
|
34
|
+
end
|
|
35
|
+
if @menu_item.update_attributes(params[:dust_menu_item])
|
|
36
|
+
flash[:notice] = "Successfully updated menu item."
|
|
37
|
+
try_return_to_previous_page(dust_menu_items_url)
|
|
38
|
+
else
|
|
39
|
+
render :action => 'edit'
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def destroy
|
|
44
|
+
@menu_item = Dust::MenuItem.find(params[:id])
|
|
45
|
+
@menu_item.destroy
|
|
46
|
+
flash[:notice] = "Successfully destroyed menu item."
|
|
47
|
+
redirect_to edit_dust_menu_url(@menu_item.menu)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module Dust
|
|
2
|
+
class MenusController < AuthenticationController
|
|
3
|
+
|
|
4
|
+
filter_access_to :all
|
|
5
|
+
|
|
6
|
+
layout 'cms'
|
|
7
|
+
|
|
8
|
+
def index
|
|
9
|
+
@menus = Dust::Menu.all
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def new
|
|
13
|
+
@menu = Dust::Menu.new
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def edit
|
|
17
|
+
@menu = Dust::Menu.find(params[:id])
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def create
|
|
21
|
+
@menu = Dust::Menu.new(params[:dust_menu])
|
|
22
|
+
|
|
23
|
+
if @menu.save
|
|
24
|
+
redirect_to edit_dust_menu_path(@menu), notice: 'Menu was successfully created.'
|
|
25
|
+
else
|
|
26
|
+
render action: "new"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def update
|
|
31
|
+
@menu = Dust::Menu.find(params[:id])
|
|
32
|
+
|
|
33
|
+
if @menu.update_attributes(params[:dust_menu])
|
|
34
|
+
redirect_to dust_menus_path, notice: 'Menu was successfully updated.'
|
|
35
|
+
else
|
|
36
|
+
render action: "edit"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def destroy
|
|
41
|
+
@menu = Dust::Menu.find(params[:id])
|
|
42
|
+
@menu.destroy
|
|
43
|
+
|
|
44
|
+
redirect_to dust_menus_url
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
module Dust
|
|
2
|
+
class PagesController < AuthenticationController
|
|
3
|
+
|
|
4
|
+
filter_access_to :all
|
|
5
|
+
|
|
6
|
+
layout 'cms'
|
|
7
|
+
|
|
8
|
+
def index
|
|
9
|
+
@pages = Dust::Page.page(params[:search], params[:page])
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def new
|
|
13
|
+
@page = Dust::Page.new_with_menu_item
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def create
|
|
17
|
+
@page = Dust::Page.new_with_menu_item(params[:dust_page])
|
|
18
|
+
@builder = Dust::Builder::Page.new(:page => @page, :sections => params[:sections])
|
|
19
|
+
|
|
20
|
+
if @builder.save
|
|
21
|
+
flash[:notice] = "Successfully created page."
|
|
22
|
+
redirect_to front_end_page_path(@page.filename)
|
|
23
|
+
else
|
|
24
|
+
render :action => 'new', :layout => 'cms'
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def edit
|
|
29
|
+
@page = Dust::Page.find(params[:id])
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def update
|
|
33
|
+
@page = Dust::Page.find(params[:id])
|
|
34
|
+
@builder = Dust::Builder::Page.new(:page => @page, :sections => params[:sections], :attrs => params[:dust_page])
|
|
35
|
+
|
|
36
|
+
if @builder.update
|
|
37
|
+
flash[:notice] = "Successfully updated page."
|
|
38
|
+
redirect_to front_end_page_path(@page.filename)
|
|
39
|
+
else
|
|
40
|
+
render :action => 'edit'
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def destroy
|
|
45
|
+
@page = Dust::Page.find(params[:id])
|
|
46
|
+
@page.destroy
|
|
47
|
+
flash[:notice] = "Successfully destroyed page."
|
|
48
|
+
redirect_to dust_pages_url
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module Dust
|
|
2
|
+
class PasswordResetsController < AuthenticationController
|
|
3
|
+
|
|
4
|
+
before_filter :load_user_using_perishable_token, :only => [ :edit, :update ]
|
|
5
|
+
|
|
6
|
+
layout 'user_sessions'
|
|
7
|
+
|
|
8
|
+
def new
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create
|
|
12
|
+
@user = Dust::User.find_by_email(params[:email])
|
|
13
|
+
if @user
|
|
14
|
+
@user.deliver_password_reset_instructions!
|
|
15
|
+
flash[:notice] = "Instructions to reset your password have been emailed to you"
|
|
16
|
+
redirect_to root_path
|
|
17
|
+
else
|
|
18
|
+
flash.now[:error] = "No user was found with email address #{params[:email]}"
|
|
19
|
+
render :action => :new
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def edit
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def update
|
|
27
|
+
@user.password = params[:password]
|
|
28
|
+
@user.password_confirmation = params[:password]
|
|
29
|
+
if @user.save
|
|
30
|
+
flash[:notice] = "Your password was successfully updated"
|
|
31
|
+
redirect_to dashboard_url
|
|
32
|
+
else
|
|
33
|
+
render :action => :edit
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
def load_user_using_perishable_token
|
|
41
|
+
@user = Dust::User.find_using_perishable_token(params[:id])
|
|
42
|
+
unless @user
|
|
43
|
+
flash[:error] = "We're sorry, but we could not locate your account"
|
|
44
|
+
redirect_to root_url
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module Dust
|
|
2
|
+
class PostsController < AuthenticationController
|
|
3
|
+
|
|
4
|
+
filter_access_to :all
|
|
5
|
+
|
|
6
|
+
layout 'cms'
|
|
7
|
+
|
|
8
|
+
def index
|
|
9
|
+
@posts = Post.all
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def new
|
|
13
|
+
@post = Post.new_with_menu_item
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def edit
|
|
17
|
+
@post = Post.find(params[:id])
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def create
|
|
21
|
+
@post = Post.new_with_menu_item(params[:dust_post])
|
|
22
|
+
|
|
23
|
+
if @post.save
|
|
24
|
+
redirect_to front_end_post_path(@post.slug), notice: 'Post was successfully created.'
|
|
25
|
+
else
|
|
26
|
+
render action: "new"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def update
|
|
31
|
+
@post = Post.find(params[:id])
|
|
32
|
+
|
|
33
|
+
if @post.update_attributes(params[:dust_post])
|
|
34
|
+
redirect_to front_end_post_path(@post.slug), notice: 'Post was successfully updated.'
|
|
35
|
+
else
|
|
36
|
+
render action: "edit"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def destroy
|
|
41
|
+
@post = Post.find(params[:id])
|
|
42
|
+
@post.destroy
|
|
43
|
+
|
|
44
|
+
redirect_to posts_url
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module Dust
|
|
2
|
+
class RolesController < AuthenticationController
|
|
3
|
+
|
|
4
|
+
filter_access_to :all
|
|
5
|
+
|
|
6
|
+
layout 'cms'
|
|
7
|
+
|
|
8
|
+
def index
|
|
9
|
+
@roles = Dust::Role.all
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def new
|
|
13
|
+
@role = Dust::Role.new
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def create
|
|
17
|
+
@role = Dust::Role.new(params[:dust_role])
|
|
18
|
+
if @role.save
|
|
19
|
+
flash[:notice] = "Successfully created role."
|
|
20
|
+
redirect_to dust_roles_url
|
|
21
|
+
else
|
|
22
|
+
render :action => 'new', :layout => 'cms'
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def edit
|
|
27
|
+
@role = Dust::Role.find(params[:id])
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def update
|
|
31
|
+
@role = Dust::Role.find(params[:id])
|
|
32
|
+
if @role.update_attributes(params[:dust_role])
|
|
33
|
+
flash[:notice] = "Successfully updated role."
|
|
34
|
+
redirect_to dust_roles_url
|
|
35
|
+
else
|
|
36
|
+
render :action => 'edit', :layout => 'cms'
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def destroy
|
|
41
|
+
@role = Dust::Role.find(params[:id])
|
|
42
|
+
@role.destroy
|
|
43
|
+
flash[:notice] = "Successfully destroyed role."
|
|
44
|
+
redirect_to dust_roles_url
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Dust
|
|
2
|
+
class SessionsController < AuthenticationController
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
layout "sessions"
|
|
6
|
+
|
|
7
|
+
def new
|
|
8
|
+
@session = Dust::Session.new
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create
|
|
12
|
+
@user = login(params[:dust_session][:username], params[:dust_session][:password], params[:dust_session][:remember_me])
|
|
13
|
+
#raise "hey there"
|
|
14
|
+
if @user
|
|
15
|
+
redirect_back_or_to dust_dashboard_path, :notice => "Logged In!"
|
|
16
|
+
else
|
|
17
|
+
@session = Dust::Session.new(params[:dust_session], @user)
|
|
18
|
+
@session.valid?
|
|
19
|
+
render :action => 'new'
|
|
20
|
+
#flash.alert = "Email or Password Invalid!"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def destroy
|
|
25
|
+
logout
|
|
26
|
+
redirect_to root_url, :notice => "Logged Out!"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Dust
|
|
2
|
+
class SiteWidesController < AuthenticationController
|
|
3
|
+
|
|
4
|
+
filter_access_to :all
|
|
5
|
+
layout 'cms'
|
|
6
|
+
|
|
7
|
+
def new
|
|
8
|
+
@site_wide = Dust::SiteWide.new
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create
|
|
12
|
+
@site_wide = Dust::SiteWide.new(params[:dust_site_wide])
|
|
13
|
+
if @site_wide.save
|
|
14
|
+
redirect_to dust_dashboard_path
|
|
15
|
+
else
|
|
16
|
+
render :action => :new
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def destroy
|
|
21
|
+
@site_wide = Dust::SiteWide.find params[:id]
|
|
22
|
+
@site_wide.destroy
|
|
23
|
+
|
|
24
|
+
redirect_to dust_dashboard_path
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Dust
|
|
2
|
+
class SortableController < AuthenticationController
|
|
3
|
+
|
|
4
|
+
def sort
|
|
5
|
+
begin
|
|
6
|
+
@menu_sort = Dust::Sort.new(params[:list], params[:class_name])
|
|
7
|
+
rescue ActiveRecord::RecordNotFound => e
|
|
8
|
+
not_found = true
|
|
9
|
+
flash[:error] = "Sorting Failed | #{e}"
|
|
10
|
+
else
|
|
11
|
+
flash[:notice] = "Sort Successfull!"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
module Dust
|
|
2
|
+
class UsersController < AuthenticationController
|
|
3
|
+
|
|
4
|
+
filter_access_to :all
|
|
5
|
+
|
|
6
|
+
layout 'cms'
|
|
7
|
+
|
|
8
|
+
def index
|
|
9
|
+
@users = Dust::User.page(params[:search], params[:page])
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def new
|
|
13
|
+
@user = Dust::User.new()
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def create
|
|
17
|
+
@user = Dust::User.new(params[:dust_user])
|
|
18
|
+
|
|
19
|
+
if @user.save
|
|
20
|
+
flash[:notice] = "Successfully created user."
|
|
21
|
+
redirect_to dust_users_url
|
|
22
|
+
else
|
|
23
|
+
render :action => 'new', :layout => 'cms'
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def edit
|
|
28
|
+
@user = Dust::User.find(params[:id])
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def update
|
|
32
|
+
@user = Dust::User.find(params[:id])
|
|
33
|
+
|
|
34
|
+
if @user.update_attributes(params[:dust_user])
|
|
35
|
+
flash[:notice] = "Successfully updated user information."
|
|
36
|
+
redirect = current_user.is?(:moderator) ? dust_dashboard_url : dust_users_url
|
|
37
|
+
redirect_to redirect
|
|
38
|
+
else
|
|
39
|
+
flash.now[:error] = "There was an error in your form."
|
|
40
|
+
render :action => 'edit', :layout => 'cms'
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def destroy
|
|
45
|
+
@user = Dust::User.find(params[:id])
|
|
46
|
+
@user.destroy
|
|
47
|
+
flash[:notice] = "Successfully destroyed user."
|
|
48
|
+
redirect_to dust_users_url
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
class FrontEnd::PageController < FrontEndController
|
|
2
|
+
|
|
3
|
+
before_filter :root_redirect
|
|
4
|
+
|
|
5
|
+
def show
|
|
6
|
+
@page = Dust::Page.find_by_filename(params[:filename])
|
|
7
|
+
@contact = Dust::Contact.new
|
|
8
|
+
|
|
9
|
+
if @page == nil
|
|
10
|
+
raise Exceptions::PageNotFound
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
rescue Exceptions::PageNotFound
|
|
14
|
+
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def search
|
|
18
|
+
@results = (params[:query].present? ? Dust::Block.search(params[:query]) : [])
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def root_redirect
|
|
22
|
+
if "/#{Dust.config.root}" == request.fullpath
|
|
23
|
+
redirect_to root_url, :status => 301
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class FrontEnd::PostController < FrontEndController
|
|
2
|
+
|
|
3
|
+
def show
|
|
4
|
+
@post = Dust::Post.find_by_filename("post/#{params[:filename]}")
|
|
5
|
+
|
|
6
|
+
if @post == nil
|
|
7
|
+
raise Exceptions::PageNotFound
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
rescue Exceptions::PageNotFound
|
|
11
|
+
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
class FrontEndController < AuthenticationController
|
|
2
|
+
|
|
3
|
+
before_filter :load_sitewide_data, :meta_tags, :load_blocks
|
|
4
|
+
|
|
5
|
+
def meta_tags
|
|
6
|
+
@description = @site_data.site_info.default_description
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# Loads blocks and groups them by position in the layout
|
|
10
|
+
def load_blocks
|
|
11
|
+
@blocks = Dust::Block.find_active(request.fullpath)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def load_sitewide_data
|
|
15
|
+
@site_data = Dust::SiteWide.all_to_object
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module ErrorMessagesHelper
|
|
2
|
+
# Render error messages for the given objects. The :message and :header_message options are allowed.
|
|
3
|
+
def error_messages_for(*objects)
|
|
4
|
+
options = objects.extract_options!
|
|
5
|
+
options[:header_message] ||= "Invalid Fields"
|
|
6
|
+
options[:message] ||= "Correct the following errors and try again."
|
|
7
|
+
messages = objects.compact.map { |o| o.errors.full_messages }.flatten
|
|
8
|
+
unless messages.empty?
|
|
9
|
+
content_tag(:div, :class => "error_messages") do
|
|
10
|
+
list_items = messages.map { |msg| content_tag(:li, msg) }
|
|
11
|
+
content_tag(:h2, options[:header_message]) + content_tag(:p, options[:message]) + content_tag(:ul, list_items.join.html_safe)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
module FormBuilderAdditions
|
|
17
|
+
def error_messages(options = {})
|
|
18
|
+
@template.error_messages_for(@object, options)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
ActionView::Helpers::FormBuilder.send(:include, ErrorMessagesHelper::FormBuilderAdditions)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# These helper methods can be called in your template to set variables to be used in the layout
|
|
2
|
+
# This module should be included in all views globally,
|
|
3
|
+
module LayoutHelper
|
|
4
|
+
def title(page_title, show_title = true)
|
|
5
|
+
content_for(:title) { h(page_title.to_s) }
|
|
6
|
+
@show_title = show_title
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def show_title?
|
|
10
|
+
@show_title
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def heading(page_title, show_title = true)
|
|
14
|
+
content_for(:heading) { h(page_title.to_s) }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def description(page_description, show_description = true)
|
|
18
|
+
content_for(:description) { h(page_description.to_s) }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def stylesheet(*args)
|
|
22
|
+
content_for(:head) { stylesheet_link_tag(*args) }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def javascript(*args)
|
|
26
|
+
content_for(:head) { javascript_include_tag(*args) }
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module MiscHelper
|
|
2
|
+
|
|
3
|
+
def create_description
|
|
4
|
+
truncate(strip_tags(content), :length => 50)
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def content_classes()
|
|
8
|
+
classes = ""
|
|
9
|
+
classes << @page.classes unless @page.nil? or @page.classes.nil?
|
|
10
|
+
classes
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def edit_icon(type="")
|
|
14
|
+
image_tag("admin/ui/edit-icon.png", :class =>"brush tip", :title => "Edit #{type}")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def delete_icon(type="")
|
|
18
|
+
image_tag("admin/ui/delete-icon.png", :class =>"brush tip", :title => "Delete #{type}")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def index_icon(type="")
|
|
22
|
+
image_tag("admin/ui/index-icon.png", :class =>"eye tip", :title => "Show All #{type}")
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def new_icon(type="")
|
|
26
|
+
image_tag("admin/ui/new-icon.png", :class =>"eye tip", :title => "Create New #{type}")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module RegionHelper
|
|
2
|
+
|
|
3
|
+
def render_region(name, classes="", &block)
|
|
4
|
+
@block_content = (block_given? ? block : @blocks.select{ |b| b.where_to_show == name })
|
|
5
|
+
unless @block_content.blank?
|
|
6
|
+
build_regions(name, classes, (@block_content.class == Proc ? @block_content : render_block_wrappers))
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def build_regions(name, classes, innards)
|
|
11
|
+
@regions = region_wrapper("#{name}-blocks", "container-twelve", innards)
|
|
12
|
+
@regions = region_wrapper("#{name}-blocks-container", "clearfix", @regions)
|
|
13
|
+
@regions = region_wrapper("#{name}-blocks-wrapper", "cleafix #{classes}", @regions)
|
|
14
|
+
|
|
15
|
+
@regions
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def region_wrapper(id, html_class, innards="")
|
|
19
|
+
content_tag :div, :id => id, :class => html_class do
|
|
20
|
+
innards.class == Proc ? innards.call : raw(innards)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def render_block_wrappers
|
|
25
|
+
@block_content.map! do |block|
|
|
26
|
+
render(:partial => "dust/blocks/block", :locals => {:block => block})
|
|
27
|
+
end
|
|
28
|
+
@block_content.join("\n")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
class PostOffice < ActionMailer::Base
|
|
2
|
+
|
|
3
|
+
default :from => default_recipient
|
|
4
|
+
|
|
5
|
+
def contact_confirmation(contact)
|
|
6
|
+
@contact = contact
|
|
7
|
+
mail(:to => "#{contact.name} <#{contact.email}>", :subject => "Your contact request has been sent.")
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def contact_request(contact)
|
|
11
|
+
@contact = contact
|
|
12
|
+
mail(:to => default_recipient, :subject => "New contact request has been received.")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def password_reset_instructions(user)
|
|
16
|
+
@user = user
|
|
17
|
+
@edit_password_reset_url = edit_password_reset_url(user.perishable_token)
|
|
18
|
+
mail(:to => "#{user.username} <#{user.email}>", :subject => "Password Reset Instructions", :content_type => "text/html")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def activation_needed_email(user)
|
|
22
|
+
@user = user
|
|
23
|
+
mail(:to => default_recipient, :subject => "User #{@user.username} is awaiting approval.", :content_type => "text/html")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def activation_success_email(user)
|
|
27
|
+
@user = user
|
|
28
|
+
mail(:to => "#{user.username} <#{user.email}>", :subject => "Your Landmark Title account has been approved.", :content_type => "text/html")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def default_recipient
|
|
32
|
+
Dust.site_wides.contact_info.default_recipient || "no-reply@dust.com"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.default_recipient
|
|
36
|
+
self.new.default_recipient
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
end
|