dust-cms 0.0.05
Sign up to get free protection for your applications and to get access to all the features.
- 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,41 @@
|
|
1
|
+
module Dust
|
2
|
+
class SiteWide < ActiveRecord::Base
|
3
|
+
attr_accessible :name, :value, :category
|
4
|
+
|
5
|
+
validates_presence_of :name, :value, :category
|
6
|
+
|
7
|
+
def self.variables_by_category
|
8
|
+
items = order('category, name').all
|
9
|
+
items.group_by{ |i| i.category }
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.all_to_object
|
13
|
+
vars = OpenStruct.new
|
14
|
+
variables_by_category.each do |cat, vars_for_cat|
|
15
|
+
cat = create_category_method(cat, vars)
|
16
|
+
create_vars_for_category_method(cat, vars_for_cat)
|
17
|
+
end
|
18
|
+
vars
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.default_categories
|
22
|
+
['Site Info', 'Contact Info', 'Location Info']
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def self.create_category_method(cat, vars)
|
28
|
+
cat = cat.parameterize.gsub("-", "_")
|
29
|
+
vars.class.send(:define_method, cat, proc{OpenStruct.new})
|
30
|
+
vars.send(cat)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.create_vars_for_category_method(cat, vars)
|
34
|
+
vars.each do |var|
|
35
|
+
name = var.name.parameterize.gsub("-", "_")
|
36
|
+
cat.class.send(:define_method, name, proc{var.value})
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Dust
|
2
|
+
class Sort
|
3
|
+
|
4
|
+
attr_accessor :previous, :position, :value, :id, :class, :list
|
5
|
+
|
6
|
+
def initialize(list={}, class_name=nil, parent=nil)
|
7
|
+
@class_name = class_name
|
8
|
+
@parent = parent
|
9
|
+
@previous = nil
|
10
|
+
@list = format_list(list.to_a)
|
11
|
+
self.sort_list
|
12
|
+
end
|
13
|
+
|
14
|
+
def format_list(list)
|
15
|
+
list.map! do |item|
|
16
|
+
Dust::SortableItem.new(:position => item[1]["position"].to_i,
|
17
|
+
:id => item[1]["id"],
|
18
|
+
:class_name => @class_name,
|
19
|
+
:children => item[1]["children"])
|
20
|
+
end
|
21
|
+
list.sort_by! { |item| item.position }
|
22
|
+
end
|
23
|
+
|
24
|
+
def sort_list
|
25
|
+
@list.each do |item|
|
26
|
+
@current_menu_item = item.object_class.find(item.id)
|
27
|
+
if @parent.nil?
|
28
|
+
self.sort_roots(item)
|
29
|
+
else
|
30
|
+
@parent = item.object_class.find(@parent)
|
31
|
+
self.sort_children(item)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def sort_roots(item)
|
37
|
+
unless @previous.nil?
|
38
|
+
previous_item = item.object_class.find_by_id(@previous)
|
39
|
+
@current_menu_item.move_to_right_of(previous_item)
|
40
|
+
else
|
41
|
+
@current_menu_item.move_to_root
|
42
|
+
end
|
43
|
+
@previous = item.id
|
44
|
+
end
|
45
|
+
|
46
|
+
def sort_children(item)
|
47
|
+
child_cms_menu_item = item.object_class.find_by_id(item.id)
|
48
|
+
child_cms_menu_item.move_to_child_of(@parent)
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Dust
|
2
|
+
class SortableItem
|
3
|
+
|
4
|
+
attr_accessor :position
|
5
|
+
attr_reader :object_class, :id, :position
|
6
|
+
|
7
|
+
def initialize(options={})
|
8
|
+
@position = options[:position]
|
9
|
+
@object_class = options[:class_name].constantize
|
10
|
+
@id = options[:id]
|
11
|
+
|
12
|
+
self.children = options[:children]
|
13
|
+
end
|
14
|
+
|
15
|
+
def children=(children)
|
16
|
+
@children = Dust::Sort.new(children, @object_class.to_s, self.id)
|
17
|
+
@children
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Dust
|
2
|
+
class User < ActiveRecord::Base
|
3
|
+
authenticates_with_sorcery!
|
4
|
+
|
5
|
+
attr_accessible :username, :password, :password_confirmation, :email, :role_id, :role
|
6
|
+
|
7
|
+
belongs_to :role
|
8
|
+
has_many :assignments
|
9
|
+
has_many :roles, :through => :assignments
|
10
|
+
|
11
|
+
validates_format_of :email, :with => /^(|(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6})$/i
|
12
|
+
validates_length_of :password, :minimum => 3, :message => "password must be at least 3 characters long", :if => Proc.new{ |u| !u.password.blank? }
|
13
|
+
validates_confirmation_of :password, :message => "should match confirmation", :if => Proc.new{ |u| !u.password.blank? }
|
14
|
+
|
15
|
+
def role_symbols
|
16
|
+
[(role.name).to_sym]
|
17
|
+
end
|
18
|
+
|
19
|
+
def has_role?(role)
|
20
|
+
role_symbols.include?(role)
|
21
|
+
end
|
22
|
+
|
23
|
+
def is?(role)
|
24
|
+
role_symbols.include?(role)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.page(search, page)
|
28
|
+
search(search).paginate(:per_page => 12, :page => page)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.search(search)
|
32
|
+
if search
|
33
|
+
where("username LIKE ?", "%#{search}%")
|
34
|
+
else
|
35
|
+
scoped
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def login
|
40
|
+
username
|
41
|
+
end
|
42
|
+
|
43
|
+
def deliver_password_reset_instructions!
|
44
|
+
reset_perishable_token!
|
45
|
+
PostOffice.password_reset_instructions(self).deliver
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
class CkeditorAttachmentFileUploader < CarrierWave::Uploader::Base
|
3
|
+
include Ckeditor::Backend::CarrierWave
|
4
|
+
|
5
|
+
# Include RMagick or ImageScience support:
|
6
|
+
# include CarrierWave::RMagick
|
7
|
+
# include CarrierWave::MiniMagick
|
8
|
+
# include CarrierWave::ImageScience
|
9
|
+
|
10
|
+
# Choose what kind of storage to use for this uploader:
|
11
|
+
storage :file
|
12
|
+
|
13
|
+
# Override the directory where uploaded files will be stored.
|
14
|
+
# This is a sensible default for uploaders that are meant to be mounted:
|
15
|
+
def store_dir
|
16
|
+
"uploads/ckeditor/attachments/#{model.id}"
|
17
|
+
end
|
18
|
+
|
19
|
+
# Provide a default URL as a default if there hasn't been a file uploaded:
|
20
|
+
# def default_url
|
21
|
+
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
22
|
+
# end
|
23
|
+
|
24
|
+
# Process files as they are uploaded:
|
25
|
+
# process :scale => [200, 300]
|
26
|
+
#
|
27
|
+
# def scale(width, height)
|
28
|
+
# # do something
|
29
|
+
# end
|
30
|
+
|
31
|
+
# Add a white list of extensions which are allowed to be uploaded.
|
32
|
+
# For images you might use something like this:
|
33
|
+
def extension_white_list
|
34
|
+
Ckeditor.attachment_file_types
|
35
|
+
end
|
36
|
+
|
37
|
+
# Override the filename of the uploaded files:
|
38
|
+
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
39
|
+
# def filename
|
40
|
+
# "something.jpg" if original_filename
|
41
|
+
# end
|
42
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
class CkeditorPictureUploader < CarrierWave::Uploader::Base
|
3
|
+
include Ckeditor::Backend::CarrierWave
|
4
|
+
|
5
|
+
# Include RMagick or ImageScience support:
|
6
|
+
# include CarrierWave::RMagick
|
7
|
+
include CarrierWave::MiniMagick
|
8
|
+
# include CarrierWave::ImageScience
|
9
|
+
|
10
|
+
# Choose what kind of storage to use for this uploader:
|
11
|
+
storage :file
|
12
|
+
|
13
|
+
# Override the directory where uploaded files will be stored.
|
14
|
+
# This is a sensible default for uploaders that are meant to be mounted:
|
15
|
+
def store_dir
|
16
|
+
"uploads/ckeditor/pictures/#{model.id}"
|
17
|
+
end
|
18
|
+
|
19
|
+
# Provide a default URL as a default if there hasn't been a file uploaded:
|
20
|
+
# def default_url
|
21
|
+
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
22
|
+
# end
|
23
|
+
|
24
|
+
# Process files as they are uploaded:
|
25
|
+
# process :scale => [200, 300]
|
26
|
+
#
|
27
|
+
# def scale(width, height)
|
28
|
+
# # do something
|
29
|
+
# end
|
30
|
+
|
31
|
+
process :read_dimensions
|
32
|
+
|
33
|
+
# Create different versions of your uploaded files:
|
34
|
+
version :thumb do
|
35
|
+
process :resize_to_fill => [118, 100]
|
36
|
+
end
|
37
|
+
|
38
|
+
version :content do
|
39
|
+
process :resize_to_limit => [800, 800]
|
40
|
+
end
|
41
|
+
|
42
|
+
# Add a white list of extensions which are allowed to be uploaded.
|
43
|
+
# For images you might use something like this:
|
44
|
+
def extension_white_list
|
45
|
+
Ckeditor.image_file_types
|
46
|
+
end
|
47
|
+
|
48
|
+
# Override the filename of the uploaded files:
|
49
|
+
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
50
|
+
# def filename
|
51
|
+
# "something.jpg" if original_filename
|
52
|
+
# end
|
53
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
class GalleryPhotoUploader < CarrierWave::Uploader::Base
|
4
|
+
|
5
|
+
# Include RMagick or MiniMagick support:
|
6
|
+
# include CarrierWave::RMagick
|
7
|
+
include CarrierWave::MiniMagick
|
8
|
+
|
9
|
+
# Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
|
10
|
+
# include Sprockets::Helpers::RailsHelper
|
11
|
+
# include Sprockets::Helpers::IsolatedHelper
|
12
|
+
|
13
|
+
# Choose what kind of storage to use for this uploader:
|
14
|
+
storage :file
|
15
|
+
# storage :fog
|
16
|
+
|
17
|
+
# Override the directory where uploaded files will be stored.
|
18
|
+
# This is a sensible default for uploaders that are meant to be mounted:
|
19
|
+
def store_dir
|
20
|
+
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
21
|
+
end
|
22
|
+
|
23
|
+
# Provide a default URL as a default if there hasn't been a file uploaded:
|
24
|
+
# def default_url
|
25
|
+
# # For Rails 3.1+ asset pipeline compatibility:
|
26
|
+
# # asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
|
27
|
+
#
|
28
|
+
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
29
|
+
# end
|
30
|
+
|
31
|
+
# Process files as they are uploaded:
|
32
|
+
process :resize_to_fit => [620, 358]
|
33
|
+
|
34
|
+
# Create different versions of your uploaded files:
|
35
|
+
version :thumb do
|
36
|
+
process :resize_to_fill => [105, 70]
|
37
|
+
end
|
38
|
+
|
39
|
+
# Add a white list of extensions which are allowed to be uploaded.
|
40
|
+
# For images you might use something like this:
|
41
|
+
# def extension_white_list
|
42
|
+
# %w(jpg jpeg gif png)
|
43
|
+
# end
|
44
|
+
|
45
|
+
# Override the filename of the uploaded files:
|
46
|
+
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
47
|
+
# def filename
|
48
|
+
# "something.jpg" if original_filename
|
49
|
+
# end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
class ImageUploader < CarrierWave::Uploader::Base
|
4
|
+
|
5
|
+
# Include RMagick or MiniMagick support:
|
6
|
+
# include CarrierWave::RMagick
|
7
|
+
include CarrierWave::MiniMagick
|
8
|
+
|
9
|
+
# Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
|
10
|
+
# include Sprockets::Helpers::RailsHelper
|
11
|
+
# include Sprockets::Helpers::IsolatedHelper
|
12
|
+
|
13
|
+
# Choose what kind of storage to use for this uploader:
|
14
|
+
storage :file
|
15
|
+
# storage :fog
|
16
|
+
|
17
|
+
# Override the directory where uploaded files will be stored.
|
18
|
+
# This is a sensible default for uploaders that are meant to be mounted:
|
19
|
+
def store_dir
|
20
|
+
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
21
|
+
end
|
22
|
+
|
23
|
+
# Provide a default URL as a default if there hasn't been a file uploaded:
|
24
|
+
# def default_url
|
25
|
+
# # For Rails 3.1+ asset pipeline compatibility:
|
26
|
+
# # asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
|
27
|
+
#
|
28
|
+
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
29
|
+
# end
|
30
|
+
|
31
|
+
# Process files as they are uploaded:
|
32
|
+
process :resize_to_fit => [620, 358]
|
33
|
+
|
34
|
+
# Create different versions of your uploaded files:
|
35
|
+
version :thumb do
|
36
|
+
process :resize_to_fill => [105, 70]
|
37
|
+
end
|
38
|
+
|
39
|
+
# Add a white list of extensions which are allowed to be uploaded.
|
40
|
+
# For images you might use something like this:
|
41
|
+
# def extension_white_list
|
42
|
+
# %w(jpg jpeg gif png)
|
43
|
+
# end
|
44
|
+
|
45
|
+
# Override the filename of the uploaded files:
|
46
|
+
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
47
|
+
# def filename
|
48
|
+
# "something.jpg" if original_filename
|
49
|
+
# end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
class SlideImageUploader < CarrierWave::Uploader::Base
|
4
|
+
|
5
|
+
# Include RMagick or MiniMagick support:
|
6
|
+
# include CarrierWave::RMagick
|
7
|
+
include CarrierWave::MiniMagick
|
8
|
+
|
9
|
+
# Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
|
10
|
+
# include Sprockets::Helpers::RailsHelper
|
11
|
+
# include Sprockets::Helpers::IsolatedHelper
|
12
|
+
|
13
|
+
# Choose what kind of storage to use for this uploader:
|
14
|
+
storage :file
|
15
|
+
# storage :fog
|
16
|
+
|
17
|
+
# Override the directory where uploaded files will be stored.
|
18
|
+
# This is a sensible default for uploaders that are meant to be mounted:
|
19
|
+
def store_dir
|
20
|
+
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
21
|
+
end
|
22
|
+
|
23
|
+
# Provide a default URL as a default if there hasn't been a file uploaded:
|
24
|
+
# def default_url
|
25
|
+
# # For Rails 3.1+ asset pipeline compatibility:
|
26
|
+
# # asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
|
27
|
+
#
|
28
|
+
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
29
|
+
# end
|
30
|
+
|
31
|
+
# Process files as they are uploaded:
|
32
|
+
process :resize_to_fit => [620, 358]
|
33
|
+
|
34
|
+
# Create different versions of your uploaded files:
|
35
|
+
version :thumb do
|
36
|
+
process :resize_to_fill => [105, 70]
|
37
|
+
end
|
38
|
+
|
39
|
+
# Add a white list of extensions which are allowed to be uploaded.
|
40
|
+
# For images you might use something like this:
|
41
|
+
# def extension_white_list
|
42
|
+
# %w(jpg jpeg gif png)
|
43
|
+
# end
|
44
|
+
|
45
|
+
# Override the filename of the uploaded files:
|
46
|
+
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
47
|
+
# def filename
|
48
|
+
# "something.jpg" if original_filename
|
49
|
+
# end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
.block{ :id => "#{block.title.parameterize}", :class => "#{block.final_classes}" }
|
2
|
+
.block-inner
|
3
|
+
.block-content
|
4
|
+
- if !block.partial_name.blank?
|
5
|
+
- begin
|
6
|
+
= render block.partial_name, :block => block
|
7
|
+
- rescue => e
|
8
|
+
- Rails.logger.info "\n\t[# BLOCK ERROR]"
|
9
|
+
- Rails.logger.info "\t\t#{e}"
|
10
|
+
- Rails.logger.info "\t[/ BLOCK ERROR]\n"
|
11
|
+
- if logged_in?
|
12
|
+
Error: Content not found or malfunctioning. Please notify the site administrator.
|
13
|
+
- else
|
14
|
+
|
15
|
+
- else
|
16
|
+
= render "dust/blocks/normal_block_content", :block => block
|
17
|
+
- if permitted_to? :manage, :blocks
|
18
|
+
.edit-link
|
19
|
+
= link_to edit_icon("Block <br/>'#{block.title}'"), edit_dust_block_path(block, :return => request.fullpath), :class => "to-admin"
|
20
|
+
= link_to delete_icon("Delete <br/>'#{block.title}'"), dust_block_path(block, :return => request.fullpath), :class => "to-admin", :confirm => "Are you sure?", :method => :delete
|
@@ -0,0 +1,50 @@
|
|
1
|
+
.solitary-header.sub-header.clearfix
|
2
|
+
.button-bar.clearfix
|
3
|
+
= render :partial => 'search'
|
4
|
+
.admin-links
|
5
|
+
= link_to 'all blocks', dust_blocks_path, :class => 'border', :title => "All Blocks"
|
6
|
+
= link_to "delete block", @block, :confirm => 'Are you sure?', :method => :delete
|
7
|
+
|
8
|
+
.form-wrap.clearfix
|
9
|
+
|
10
|
+
-# custom page variables
|
11
|
+
- @block.where_to_show.blank? ? selected = 'content' : selected = @block.where_to_show
|
12
|
+
- @block.classes.blank? ? css_classes = 'twelve columns' : css_classes = @block.classes
|
13
|
+
|
14
|
+
= simple_form_for @block, :validations => true do |f|
|
15
|
+
= hidden_field_tag :return, params[:return]
|
16
|
+
= f.error_messages
|
17
|
+
.fields
|
18
|
+
.sub-header
|
19
|
+
.title block fields
|
20
|
+
.content-wrapper
|
21
|
+
.item.block_title
|
22
|
+
= f.input :title
|
23
|
+
- if permitted_to? :manage, :blocks
|
24
|
+
= f.input :partial_name, :collection => Dust::Block.widget_list, :label => "Widget"
|
25
|
+
|
26
|
+
= f.input :column_span, :collection => Dust::Block.grid.columns, :label => "Column Span Width", input_html: { value: css_classes }
|
27
|
+
= f.input :column_offset, :collection => Dust::Block.grid.offsets, :label => "Column Offset Width"
|
28
|
+
|
29
|
+
- if permitted_to? :manage, :blocks
|
30
|
+
= f.input :classes
|
31
|
+
|
32
|
+
= f.input :weight, :class => 'field'
|
33
|
+
= f.input :where_to_show, :collection => Dust::Block.regions, :label => "Where should I show up?"
|
34
|
+
|
35
|
+
%strong= f.label :show,"What pages is this block visible on."
|
36
|
+
%br/
|
37
|
+
List Urls of pages this block should show up on, one per Line.
|
38
|
+
%br/
|
39
|
+
%em If this area is blank the block will be visible on all pages.
|
40
|
+
= f.text_area :show, :class => 'field'
|
41
|
+
|
42
|
+
.content-areas
|
43
|
+
.sub-header
|
44
|
+
.title block content
|
45
|
+
.content-wrapper
|
46
|
+
.item
|
47
|
+
= f.cktext_area("body", :width => '100%', :height => '400px')
|
48
|
+
.item
|
49
|
+
.right= f.submit
|
50
|
+
.clear
|
@@ -0,0 +1 @@
|
|
1
|
+
= raw(block.front_end_content)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
- title "Blocks"
|
2
|
+
|
3
|
+
.sub-header
|
4
|
+
.button-bar.clearfix
|
5
|
+
= render :partial => 'search'
|
6
|
+
.admin-links
|
7
|
+
= link_to 'new block', new_dust_block_path, :class => '', :title => "New Block"
|
8
|
+
|
9
|
+
.content-wrapper
|
10
|
+
= will_paginate @blocks
|
11
|
+
- @blocks.each do |block|
|
12
|
+
.index-item
|
13
|
+
.ui-widget.ui-helper-clearfix{:style => "float:right"}
|
14
|
+
= link_to "", block, :confirm => 'Are you sure?', :method => :delete, :class => 'destroy tip', :title => "Destroy This Item"
|
15
|
+
= link_to block.title, edit_dust_block_path(block)
|
16
|
+
= will_paginate @blocks
|
@@ -0,0 +1,37 @@
|
|
1
|
+
.solitary-header.sub-header.clearfix
|
2
|
+
.button-bar.clearfix
|
3
|
+
= render :partial => 'search'
|
4
|
+
.admin-links
|
5
|
+
= link_to 'all contacts', dust_contacts_path, :class => 'border'
|
6
|
+
= link_to "delete contact", @contact, :confirm => 'Are you sure?', :method => :delete
|
7
|
+
|
8
|
+
.form-wrap.clearfix
|
9
|
+
= form_for @contact, :validate => true, :html => { :multipart => true } do |f|
|
10
|
+
= f.error_messages
|
11
|
+
|
12
|
+
.fields
|
13
|
+
.sub-header
|
14
|
+
.title contact fields
|
15
|
+
.content-wrapper
|
16
|
+
.item
|
17
|
+
= f.label :name
|
18
|
+
%br/
|
19
|
+
= f.text_field :name, :class => 'field'
|
20
|
+
.item
|
21
|
+
= f.label :email
|
22
|
+
%br/
|
23
|
+
= f.text_field :email, :class => 'field'
|
24
|
+
.item
|
25
|
+
= f.label :phone
|
26
|
+
%br/
|
27
|
+
= f.text_field :phone, :class => 'field'
|
28
|
+
|
29
|
+
.content-areas
|
30
|
+
.sub-header
|
31
|
+
.title contact content
|
32
|
+
.content-wrapper
|
33
|
+
.item
|
34
|
+
= f.label :message
|
35
|
+
%br/
|
36
|
+
= f.text_area :message, :class => 'field', :style => "height:128px;"
|
37
|
+
.item= f.submit "Submit"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
- title "Contact Requests"
|
2
|
+
|
3
|
+
.sub-header
|
4
|
+
.button-bar.clearfix
|
5
|
+
= render :partial => 'search'
|
6
|
+
.admin-links
|
7
|
+
= link_to 'new contact', new_dust_contact_path, :class => 'border tip', :title => "New Contact Form"
|
8
|
+
= link_to "download", dust_download_csv_path, :class => "batch tip", :title => "Downlaod a CSV of all <br /> the past contact requests."
|
9
|
+
|
10
|
+
.content-wrapper
|
11
|
+
= will_paginate @contacts
|
12
|
+
- @contacts.each do |contact|
|
13
|
+
.index-item
|
14
|
+
.ui-widget.ui-helper-clearfix{:style => "float:right"}
|
15
|
+
= link_to "", contact, :confirm => 'Are you sure?', :method => :delete, :class => 'ui-icon ui-icon-close destroy tip', :title => "Destroy This Item"
|
16
|
+
= link_to contact.name, edit_dust_contact_path(contact)
|
17
|
+
= will_paginate @contacts
|
@@ -0,0 +1,33 @@
|
|
1
|
+
- title "Dashboard"
|
2
|
+
|
3
|
+
- content_for :header do
|
4
|
+
- if @site_wide
|
5
|
+
= error_messages_for @site_wide
|
6
|
+
|
7
|
+
.sub-header
|
8
|
+
.button-bar.clearfix
|
9
|
+
.title Site Wide Administration
|
10
|
+
|
11
|
+
.admin-links
|
12
|
+
= link_to "New Site Wide Variable", new_dust_site_wide_path, :class => 'border'
|
13
|
+
= link_to current_user.username, edit_dust_user_path(current_user)
|
14
|
+
|
15
|
+
.content-wrapper
|
16
|
+
|
17
|
+
= form_tag('/dust/dashboard/update') do
|
18
|
+
.accordion
|
19
|
+
- @options.each do |name, options|
|
20
|
+
|
21
|
+
.index-item
|
22
|
+
|
23
|
+
= link_to name.to_s.titleize, '#'
|
24
|
+
|
25
|
+
.options
|
26
|
+
- options.each do |variable|
|
27
|
+
.item
|
28
|
+
.list-links.clearfix{:style => "float:right"}
|
29
|
+
= link_to "", variable, :confirm => 'Are you sure?', :method => :delete, :class => 'destroy tip', :title => "Destroy This Item"
|
30
|
+
|
31
|
+
= render 'dust/dashboard/options', :variable => variable
|
32
|
+
.item
|
33
|
+
= submit_tag
|