droom 0.4.3 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/app/assets/images/droom/admin_menu.png +0 -0
- data/app/assets/images/droom/applications_menu.png +0 -0
- data/app/assets/images/droom/arrows_small.png +0 -0
- data/app/assets/images/droom/config_menu.png +0 -0
- data/app/assets/images/droom/dropdown.png +0 -0
- data/app/assets/images/droom/menu/asterisk.png +0 -0
- data/app/assets/images/droom/{smalladd.png → menu/smalladd.png} +0 -0
- data/app/assets/images/droom/{small_asterisk.png → menu/smallasterisk.png} +0 -0
- data/app/assets/images/droom/{smalldelete.png → menu/smalldelete.png} +0 -0
- data/app/assets/images/droom/{smalldownload.png → menu/smalldownload.png} +0 -0
- data/app/assets/images/droom/{smalledit.png → menu/smalledit.png} +0 -0
- data/app/assets/images/droom/message.png +0 -0
- data/app/assets/images/droom/missing/scrap.jpg +0 -0
- data/app/assets/images/droom/missing/scrap.png +0 -0
- data/app/assets/images/droom/missing/thumb.png +0 -0
- data/app/assets/images/droom/missing/user.png +0 -0
- data/app/assets/images/droom/object_icons.png +0 -0
- data/app/assets/images/droom/panel/add.png +0 -0
- data/app/assets/images/droom/panel/edit.png +0 -0
- data/app/assets/images/droom/panel/manage.png +0 -0
- data/app/assets/images/droom/pointer_upwards.png +0 -0
- data/app/assets/images/droom/search_menu.png +0 -0
- data/app/assets/images/droom/setter.png +0 -0
- data/app/assets/images/droom/small_icons.png +0 -0
- data/app/assets/images/droom/stream/closer.png +0 -0
- data/app/assets/images/droom/stream/next.png +0 -0
- data/app/assets/images/droom/stream/prev.png +0 -0
- data/app/assets/images/droom/stream/previous.png +0 -0
- data/app/assets/images/droom/subscribe.png +0 -0
- data/app/assets/javascripts/droom.js.coffee +23 -13
- data/app/assets/javascripts/droom/actions.js.coffee +104 -10
- data/app/assets/javascripts/droom/ajax.js.coffee +36 -24
- data/app/assets/javascripts/droom/extensions.js.coffee +13 -0
- data/app/assets/javascripts/droom/lib/jquery.datepicker.js +1026 -0
- data/app/assets/javascripts/droom/lib/jquery.deserialize.js +142 -0
- data/app/assets/javascripts/droom/lib/jquery_ujs.js +416 -0
- data/app/assets/javascripts/droom/lib/swipe.js +568 -0
- data/app/assets/javascripts/droom/lib/underscore.js +1276 -0
- data/app/assets/javascripts/droom/popups.js.coffee +98 -37
- data/app/assets/javascripts/droom/stream.js.coffee +119 -77
- data/app/assets/javascripts/droom/utilities.js.coffee +25 -3
- data/app/assets/javascripts/droom/widgets.js.coffee +318 -253
- data/app/assets/stylesheets/droom.css.sass +482 -955
- data/app/assets/stylesheets/droom/_mixins.css.sass +12 -42
- data/app/assets/stylesheets/droom/_popups.css.sass +28 -11
- data/app/assets/stylesheets/droom/_stream.css.sass +375 -0
- data/app/assets/stylesheets/droom/_toolbar.css.sass +0 -6
- data/app/assets/stylesheets/droom/_variables.css.sass +4 -2
- data/app/controllers/droom/agenda_categories_controller.rb +6 -14
- data/app/controllers/droom/api/api_controller.rb +56 -0
- data/app/controllers/droom/api/events_controller.rb +74 -0
- data/app/controllers/droom/api/users_controller.rb +92 -0
- data/app/controllers/droom/api/venues_controller.rb +71 -0
- data/app/controllers/droom/calendars_controller.rb +4 -10
- data/app/controllers/droom/{user_confirmations_controller.rb → confirmations_controller.rb} +8 -7
- data/app/controllers/droom/dashboard_controller.rb +2 -19
- data/app/controllers/droom/documents_controller.rb +12 -60
- data/app/controllers/droom/dropbox_tokens_controller.rb +3 -4
- data/app/controllers/droom/engine_controller.rb +39 -11
- data/app/controllers/droom/events_controller.rb +62 -84
- data/app/controllers/droom/folders_controller.rb +30 -40
- data/app/controllers/droom/group_invitations_controller.rb +6 -23
- data/app/controllers/droom/group_permissions_controller.rb +26 -0
- data/app/controllers/droom/groups_controller.rb +10 -14
- data/app/controllers/droom/invitations_controller.rb +7 -25
- data/app/controllers/droom/memberships_controller.rb +13 -18
- data/app/controllers/droom/organisations_controller.rb +6 -25
- data/app/controllers/droom/permissions_controller.rb +50 -0
- data/app/controllers/droom/preferences_controller.rb +9 -10
- data/app/controllers/droom/scraps_controller.rb +23 -26
- data/app/controllers/droom/services_controller.rb +50 -0
- data/app/controllers/droom/suggestions_controller.rb +6 -4
- data/app/controllers/droom/users/confirmations_controller.rb +24 -0
- data/app/controllers/droom/users/passwords_controller.rb +39 -0
- data/app/controllers/droom/users/sessions_controller.rb +7 -0
- data/app/controllers/droom/users_controller.rb +60 -38
- data/app/controllers/droom/venues_controller.rb +8 -15
- data/app/controllers/droom/youtube_controller.rb +1 -1
- data/app/helpers/droom/droom_helper.rb +22 -17
- data/app/models/droom/ability.rb +81 -0
- data/app/models/droom/agenda_category.rb +0 -1
- data/app/models/droom/calendar.rb +12 -7
- data/app/models/droom/category.rb +4 -10
- data/app/models/droom/concerns/slugged.rb +21 -0
- data/app/models/droom/document.rb +15 -17
- data/app/models/droom/dropbox_document.rb +3 -6
- data/app/models/droom/dropbox_token.rb +2 -3
- data/app/models/droom/event.rb +117 -163
- data/app/models/droom/event_type.rb +25 -0
- data/app/models/droom/folder.rb +36 -48
- data/app/models/droom/group.rb +35 -27
- data/app/models/droom/group_invitation.rb +7 -10
- data/app/models/droom/group_permission.rb +29 -0
- data/app/models/droom/invitation.rb +14 -23
- data/app/models/droom/mailing_list_membership.rb +0 -1
- data/app/models/droom/membership.rb +32 -31
- data/app/models/droom/organisation.rb +6 -3
- data/app/models/droom/permission.rb +19 -0
- data/app/models/droom/personal_folder.rb +9 -21
- data/app/models/droom/preference.rb +1 -2
- data/app/models/droom/scrap.rb +31 -26
- data/app/models/droom/service.rb +31 -0
- data/app/models/droom/tag.rb +10 -9
- data/app/models/droom/tagging.rb +1 -1
- data/app/models/droom/user.rb +453 -130
- data/app/models/droom/user_permission.rb +8 -0
- data/app/models/droom/venue.rb +21 -32
- data/app/serializers/droom/user_serializer.rb +45 -0
- data/app/serializers/droom/venue_serializer.rb +5 -0
- data/app/views/droom/dashboard/_documents.html.haml +1 -1
- data/app/views/droom/dashboard/_folders.html.haml +1 -1
- data/app/views/droom/dashboard/_future_events.html.haml +10 -8
- data/app/views/droom/dashboard/_groups.html.haml +1 -1
- data/app/views/droom/dashboard/_past_events.haml +19 -12
- data/app/views/droom/dashboard/_stream.html.haml +2 -2
- data/app/views/droom/{users/_extra_columns.html.haml → dashboard/_welcome.html.haml} +0 -0
- data/app/views/droom/dashboard/index.html.haml +3 -0
- data/app/views/droom/documents/_document.html.haml +0 -2
- data/app/views/droom/documents/_documents.html.haml +1 -1
- data/app/views/droom/documents/_documents_list.html.haml +1 -1
- data/app/views/droom/documents/_documents_table.html.haml +1 -1
- data/app/views/droom/documents/_form.html.haml +8 -5
- data/app/views/droom/documents/_listing.html.haml +4 -2
- data/app/views/droom/documents/index.html.haml +13 -7
- data/app/views/droom/documents/new.html.haml +1 -4
- data/app/views/droom/events/_action_menu.html.haml +2 -2
- data/app/views/droom/events/_attachments.html.haml +8 -0
- data/app/views/droom/events/_calendar.html.haml +4 -8
- data/app/views/droom/events/_event.html.haml +44 -63
- data/app/views/droom/events/_event_line.html.haml +1 -1
- data/app/views/droom/events/_events.html.haml +18 -2
- data/app/views/droom/events/_form.html.haml +26 -19
- data/app/views/droom/events/_invitations.html.haml +7 -3
- data/app/views/droom/events/_scrap_events.html.haml +8 -0
- data/app/views/droom/events/_suggested.html.haml +4 -1
- data/app/views/droom/events/calendar.html.haml +8 -0
- data/app/views/droom/events/index.html.haml +24 -26
- data/app/views/droom/events/show.html.haml +6 -6
- data/app/views/droom/folders/_contents.html.haml +34 -4
- data/app/views/droom/folders/_folder.html.haml +7 -2
- data/app/views/droom/folders/_form.html.haml +11 -8
- data/app/views/droom/folders/index.html.haml +19 -22
- data/app/views/droom/group_invitations/_attending_groups.html.haml +1 -1
- data/app/views/droom/group_permissions/_toggle.html.haml +18 -0
- data/app/views/droom/groups/_action_menu.haml +0 -2
- data/app/views/droom/groups/_created.html.haml +0 -1
- data/app/views/droom/groups/_form.html.haml +3 -0
- data/app/views/droom/groups/_group.html.haml +10 -8
- data/app/views/droom/groups/_groups.html.haml +1 -1
- data/app/views/droom/groups/_search_result.html.haml +1 -1
- data/app/views/droom/groups/_suggested.html.haml +1 -1
- data/app/views/droom/groups/index.html.haml +15 -16
- data/app/views/droom/invitations/_form.html.haml +1 -1
- data/app/views/droom/invitations/_invitation.html.haml +1 -1
- data/app/views/droom/invitations/_invitations.html.haml +4 -4
- data/app/views/droom/memberships/_button.html.haml +5 -5
- data/app/views/droom/memberships/_form.html.haml +26 -7
- data/app/views/droom/memberships/_member.html.haml +1 -1
- data/app/views/droom/memberships/{_membership_toggle.html.haml → _toggle.html.haml} +4 -4
- data/app/views/droom/memberships/index.html.haml +9 -0
- data/app/views/droom/organisations/_action_menu.html.haml +1 -1
- data/app/views/droom/organisations/_organisation.html.haml +2 -2
- data/app/views/droom/organisations/_suggested.html.haml +1 -1
- data/app/views/droom/organisations/index.html.haml +11 -11
- data/app/views/droom/panels/_admin.html.haml +2 -2
- data/app/views/droom/panels/_configuration.html.haml +28 -0
- data/app/views/droom/panels/_devices.html.haml +2 -4
- data/app/views/droom/panels/_search.html.haml +9 -0
- data/app/views/droom/permissions/_action_menu.html.haml +10 -0
- data/app/views/droom/permissions/_created.html.haml +3 -0
- data/app/views/droom/permissions/_form.html.haml +17 -0
- data/app/views/droom/permissions/edit.html.haml +7 -0
- data/app/views/droom/permissions/new.html.haml +8 -0
- data/app/views/droom/permissions/show.html.haml +4 -0
- data/app/views/droom/preferences/_checkbox.html.haml +4 -2
- data/app/views/droom/scraps/_caption.html.haml +0 -2
- data/app/views/droom/scraps/_credit.html.haml +1 -1
- data/app/views/droom/scraps/_form.html.haml +68 -69
- data/app/views/droom/scraps/_preload.html.haml +4 -0
- data/app/views/droom/scraps/_stream.html.haml +11 -3
- data/app/views/droom/scraps/_thumb.html.haml +33 -1
- data/app/views/droom/scraps/edit.html.haml +6 -1
- data/app/views/droom/scraps/full/_document.html.haml +4 -3
- data/app/views/droom/scraps/full/_event.html.haml +17 -16
- data/app/views/droom/scraps/full/_image.html.haml +1 -2
- data/app/views/droom/scraps/full/_link.html.haml +4 -3
- data/app/views/droom/scraps/full/_quote.html.haml +4 -7
- data/app/views/droom/scraps/full/_text.html.haml +3 -2
- data/app/views/droom/scraps/full/_video.html.haml +2 -2
- data/app/views/droom/scraps/new.html.haml +6 -1
- data/app/views/droom/scraps/show.html.haml +4 -3
- data/app/views/droom/services/_action_menu.html.haml +12 -0
- data/app/views/droom/services/_created.html.haml +3 -0
- data/app/views/droom/services/_form.html.haml +18 -0
- data/app/views/droom/services/_services.html.haml +44 -0
- data/app/views/droom/services/edit.html.haml +7 -0
- data/app/views/droom/services/index.html.haml +5 -0
- data/app/views/droom/{people → services}/new.html.haml +4 -3
- data/app/views/droom/services/show.html.haml +4 -0
- data/app/views/droom/shared/_controls.html.haml +2 -2
- data/app/views/droom/shared/_navigation.html.haml +2 -2
- data/app/views/droom/shared/_toolbar.html.haml +1 -1
- data/app/views/droom/suggestions/index.html.haml +1 -0
- data/app/views/droom/users/_action_menu.html.haml +21 -0
- data/app/views/droom/users/_suggested.html.haml +14 -0
- data/app/views/droom/users/_user.html.haml +2 -2
- data/app/views/droom/users/_users.html.haml +7 -0
- data/app/views/droom/users/_users_table.html.haml +21 -22
- data/app/views/droom/users/admin.html.haml +10 -0
- data/app/views/droom/users/confirmations/_after_confirmation.html.haml +2 -0
- data/app/views/droom/users/confirmations/_password_required.html.haml +30 -0
- data/app/views/droom/users/confirmations/failure.en.html.haml +22 -0
- data/app/views/droom/users/confirmations/show.html.haml +13 -0
- data/app/views/droom/users/edit.html.haml +2 -10
- data/app/views/droom/users/edit/_details.html.haml +13 -0
- data/app/views/droom/users/edit/_memberships.html.haml +13 -0
- data/app/views/droom/users/edit/_password_fields.html.haml +16 -0
- data/app/views/droom/users/edit/_preferences.html.haml +37 -0
- data/app/views/droom/users/edit/_profile.html.haml +26 -0
- data/app/views/droom/users/edit/_user_fields.html.haml +66 -0
- data/app/views/droom/users/index.html.haml +6 -32
- data/app/views/droom/users/new.html.haml +3 -0
- data/app/views/droom/users/passwords/completed.html.haml +13 -0
- data/app/views/{devise → droom/users}/passwords/edit.html.haml +10 -4
- data/app/views/{devise → droom/users}/passwords/new.html.haml +4 -3
- data/app/views/droom/users/passwords/show.html.haml +6 -0
- data/app/views/droom/users/show.html.haml +2 -0
- data/app/views/droom/users/show/_listed.html.haml +46 -0
- data/app/views/droom/users/show/_profile.html.haml +33 -0
- data/app/views/droom/users/show/_tabled.html.haml +28 -0
- data/config/initializers/chronic.rb +2 -0
- data/config/initializers/devise.rb +35 -2
- data/config/initializers/paperclip.rb +11 -6
- data/config/locales/devise.en.yml +1 -1
- data/config/locales/en.yml +198 -103
- data/config/routes.rb +37 -45
- data/db/migrate/20130207123614_stream.rb +5 -1
- data/db/migrate/20130225095328_create_droom_calendars.rb +0 -1
- data/db/migrate/20130627065459_permissions.rb +34 -0
- data/db/migrate/20130627071938_users_take_over.rb +38 -0
- data/db/migrate/20130627073759_user_properties.rb +34 -0
- data/db/migrate/20130627080021_no_more_people.rb +11 -0
- data/db/migrate/20130701122935_directory_groups.rb +8 -0
- data/db/migrate/20130701123152_remove_old_access_control.rb +16 -0
- data/db/migrate/20130729102857_more_scrap_data.rb +12 -0
- data/db/migrate/20130904080340_international_names.rb +17 -0
- data/db/migrate/20130904080341_honours.rb +5 -0
- data/db/migrate/20131124082222_simple_addresses.rb +25 -0
- data/db/migrate/20131201093351_event_time_zone.rb +5 -0
- data/db/migrate/20131217060311_session_revocable.rb +5 -0
- data/db/migrate/20131219180311_event_types.rb +15 -0
- data/lib/devise/strategies/cookie_authenticatable.rb +46 -0
- data/lib/droom.rb +48 -33
- data/lib/droom/auth_cookie.rb +82 -0
- data/lib/droom/cropper.rb +24 -0
- data/lib/droom/engine.rb +20 -2
- data/lib/droom/folders.rb +6 -6
- data/lib/droom/lazy_hash.rb +11 -1
- data/lib/droom/monkeys.rb +6 -6
- data/lib/droom/taggability.rb +1 -1
- data/lib/droom/validators.rb +1 -1
- data/lib/droom/version.rb +1 -1
- data/lib/generators/droom/install/templates/droom_initializer.rb +10 -2
- data/lib/paperclip/geometry_transformation.rb +80 -0
- data/lib/paperclip/validators/attachment_height_validator.rb +89 -0
- data/lib/paperclip/validators/attachment_width_validator.rb +89 -0
- data/lib/paperclip_processors/offset_thumbnail.rb +85 -0
- data/spec/dummy/config/application.rb +0 -7
- data/spec/dummy/config/environments/development.rb +1 -10
- data/spec/dummy/config/environments/production.rb +1 -0
- data/spec/dummy/config/environments/test.rb +2 -7
- data/spec/dummy/db/migrate/20130130120631_folder_ancestry_to_parents.droom.rb +1 -1
- data/spec/dummy/db/migrate/20130724124758_dropbox_tokens.droom.rb +10 -0
- data/spec/dummy/db/migrate/20130724124759_preference_uuids.droom.rb +6 -0
- data/spec/dummy/db/migrate/20130724124760_stream.droom.rb +14 -0
- data/spec/dummy/db/migrate/20130724124761_access_token_secret.droom.rb +6 -0
- data/spec/dummy/db/migrate/20130724124762_person_image.droom.rb +10 -0
- data/spec/dummy/db/migrate/20130724124763_devise_confirmable.droom.rb +14 -0
- data/spec/dummy/db/migrate/20130724124764_create_droom_calendars.droom.rb +20 -0
- data/spec/dummy/db/migrate/20130724124765_give_scraps_document.droom.rb +6 -0
- data/spec/dummy/db/migrate/20130724124766_privateness.droom.rb +10 -0
- data/spec/dummy/db/migrate/20130724124767_store_metadata.droom.rb +6 -0
- data/spec/dummy/db/migrate/20130724124768_folders_nicely.droom.rb +7 -0
- data/spec/dummy/db/migrate/20130724124769_niceties.droom.rb +8 -0
- data/spec/dummy/db/migrate/20130724124770_create_droom_dropbox_documents.droom.rb +12 -0
- data/spec/dummy/db/migrate/20130724124771_dropbox_documents_changed.droom.rb +6 -0
- data/spec/dummy/db/migrate/20130724124772_user_titles.droom.rb +6 -0
- data/spec/dummy/db/migrate/20130724124773_permissions.droom.rb +35 -0
- data/spec/dummy/db/migrate/20130724124774_users_take_over.droom.rb +39 -0
- data/spec/dummy/db/migrate/20130724124775_user_properties.droom.rb +35 -0
- data/spec/dummy/db/migrate/20130724124776_no_more_people.droom.rb +12 -0
- data/spec/dummy/db/migrate/20130724124777_directory_groups.droom.rb +9 -0
- data/spec/dummy/db/migrate/20130724124778_remove_old_access_control.droom.rb +17 -0
- data/spec/dummy/db/schema.rb +217 -140
- data/spec/factories/documents.rb +0 -5
- data/spec/factories/events.rb +0 -9
- data/spec/factories/user.rb +4 -2
- data/spec/lib/droom/folders_spec.rb +8 -8
- data/spec/models/droom/document_spec.rb +6 -43
- data/spec/models/droom/event_spec.rb +0 -34
- data/spec/models/droom/mailing_list_membership_spec.rb +4 -4
- data/spec/models/droom/membership_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -10
- metadata +322 -282
- data/app/assets/images/droom/Untitled-1.png +0 -0
- data/app/assets/images/droom/asterisk.png +0 -0
- data/app/assets/images/droom/smallmanage.png +0 -0
- data/app/assets/javascripts/droom/lib/kalendae.js +0 -1692
- data/app/assets/stylesheets/lib/_kalendae.css.sass +0 -139
- data/app/controllers/droom/pages_controller.rb +0 -61
- data/app/controllers/droom/people_controller.rb +0 -111
- data/app/models/droom/document_attachment.rb +0 -37
- data/app/models/droom/page.rb +0 -26
- data/app/models/droom/person.rb +0 -309
- data/app/models/droom/recurrence_rule.rb +0 -82
- data/app/models/droom/user_action_observer.rb +0 -12
- data/app/views/devise/confirmations/failure.en.html.haml +0 -20
- data/app/views/devise/confirmations/show.html.haml +0 -19
- data/app/views/droom/confirmations/show.html.haml +0 -40
- data/app/views/droom/documents/_document_line.html.haml +0 -2
- data/app/views/droom/events/_created.html.haml +0 -2
- data/app/views/droom/folders/_attachments.html.haml +0 -3
- data/app/views/droom/pages/_contents.html.haml +0 -10
- data/app/views/droom/pages/_form.html.haml +0 -36
- data/app/views/droom/pages/_full_page.html.haml +0 -17
- data/app/views/droom/pages/_page.html.haml +0 -5
- data/app/views/droom/pages/_pages.html.haml +0 -2
- data/app/views/droom/pages/admin.html.haml +0 -24
- data/app/views/droom/pages/edit.html.haml +0 -1
- data/app/views/droom/pages/index.html.haml +0 -10
- data/app/views/droom/pages/new.html.haml +0 -4
- data/app/views/droom/pages/show.html.haml +0 -5
- data/app/views/droom/panels/_account.html.haml +0 -16
- data/app/views/droom/panels/_readers.html.haml +0 -18
- data/app/views/droom/panels/_suggestions.html.haml +0 -15
- data/app/views/droom/people/_action_menu.html.haml +0 -22
- data/app/views/droom/people/_created.html.haml +0 -6
- data/app/views/droom/people/_form.html.haml +0 -66
- data/app/views/droom/people/_listing.html.haml +0 -19
- data/app/views/droom/people/_memberships.html.haml +0 -24
- data/app/views/droom/people/_people.html.haml +0 -5
- data/app/views/droom/people/_person.html.haml +0 -32
- data/app/views/droom/people/_search_result.html.haml +0 -14
- data/app/views/droom/people/_suggested.html.haml +0 -14
- data/app/views/droom/people/edit.html.haml +0 -9
- data/app/views/droom/people/index.html.haml +0 -8
- data/app/views/droom/people/show.html.haml +0 -31
- data/app/views/droom/scraps/_heading.html.haml +0 -16
- data/app/views/droom/scraps/thumbs/_document.html.haml +0 -9
- data/app/views/droom/scraps/thumbs/_event.html.haml +0 -17
- data/app/views/droom/scraps/thumbs/_image.html.haml +0 -6
- data/app/views/droom/scraps/thumbs/_link.html.haml +0 -10
- data/app/views/droom/scraps/thumbs/_quote.html.haml +0 -8
- data/app/views/droom/scraps/thumbs/_text.html.haml +0 -8
- data/app/views/droom/scraps/thumbs/_video.html.haml +0 -6
- data/app/views/droom/users/_extra_columns_header.html.haml +0 -0
- data/app/views/droom/users/_extra_columns_note.html.haml +0 -0
- data/app/views/droom/users/_form.html.haml +0 -14
- data/app/views/droom/users/_password_fields.html.haml +0 -15
- data/app/views/droom/users/_user_or_person.html.haml +0 -72
- data/app/views/kaminari/_paginator.html.haml +0 -16
- data/lib/droom/dav_resource.rb +0 -36
- data/lib/droom/model_helpers.rb +0 -25
- data/lib/droom/routing.rb +0 -13
- data/spec/datasets/calendar_events_dataset.rb +0 -44
- data/spec/datasets/calendar_pages_dataset.rb +0 -8
- data/spec/datasets/calendar_sites_dataset.rb +0 -6
- data/spec/datasets/calendars_dataset.rb +0 -34
- data/spec/datasets/documents_dataset.rb +0 -28
- data/spec/datasets/recurrence_dataset.rb +0 -7
- data/spec/dummy/config/sunspot.yml +0 -17
- data/spec/dummy/log/dav.log +0 -1
- data/spec/dummy/log/development.log +0 -2
- data/spec/dummy/log/test.log +0 -1
- data/spec/dummy/solr/conf/admin-extra.html +0 -31
- data/spec/dummy/solr/conf/elevate.xml +0 -36
- data/spec/dummy/solr/conf/mapping-ISOLatin1Accent.txt +0 -246
- data/spec/dummy/solr/conf/protwords.txt +0 -21
- data/spec/dummy/solr/conf/schema.xml +0 -238
- data/spec/dummy/solr/conf/scripts.conf +0 -24
- data/spec/dummy/solr/conf/solrconfig.xml +0 -934
- data/spec/dummy/solr/conf/spellings.txt +0 -2
- data/spec/dummy/solr/conf/stopwords.txt +0 -58
- data/spec/dummy/solr/conf/synonyms.txt +0 -31
- data/spec/dummy/solr/data/development/index/segments.gen +0 -0
- data/spec/dummy/solr/data/development/index/segments_1 +0 -0
- data/spec/dummy/solr/data/development/spellchecker/segments.gen +0 -0
- data/spec/dummy/solr/data/development/spellchecker/segments_1 +0 -0
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/segments_3nu +0 -0
- data/spec/dummy/solr/data/test/spellchecker/segments.gen +0 -0
- data/spec/dummy/solr/data/test/spellchecker/segments_1 +0 -0
- data/spec/factories/recurrence_rules.rb +0 -25
- data/spec/models/droom/person_spec.rb +0 -72
- data/spec/models/droom/recurrence_rule_spec.rb +0 -81
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'signed_json'
|
2
|
+
require "active_support/core_ext/hash/slice"
|
3
|
+
|
4
|
+
module Droom
|
5
|
+
class AuthCookie
|
6
|
+
|
7
|
+
def initialize(cookies)
|
8
|
+
@cookies = cookies
|
9
|
+
end
|
10
|
+
|
11
|
+
# Sets the cookie, referencing the given resource.id (e.g. User)
|
12
|
+
def set(resource, opts={})
|
13
|
+
cookie_values = cookie_options.merge(opts).merge(:value => set_auth_values(resource))
|
14
|
+
@cookies[cookie_name] = cookie_values
|
15
|
+
end
|
16
|
+
|
17
|
+
# Unsets the cookie via the HTTP response.
|
18
|
+
def unset
|
19
|
+
@cookies.delete cookie_name, cookie_options
|
20
|
+
end
|
21
|
+
|
22
|
+
def token
|
23
|
+
values[0]
|
24
|
+
end
|
25
|
+
|
26
|
+
# The Time at which the cookie was created.
|
27
|
+
def created_at
|
28
|
+
valid? ? DateTime.parse(values[1]) : nil
|
29
|
+
end
|
30
|
+
|
31
|
+
# Whether the cookie appears valid.
|
32
|
+
def valid?
|
33
|
+
present? && values.all?
|
34
|
+
end
|
35
|
+
|
36
|
+
def present?
|
37
|
+
@cookies[cookie_name].present?
|
38
|
+
end
|
39
|
+
|
40
|
+
# Whether the cookie was set since the given Time
|
41
|
+
def set_since?(time)
|
42
|
+
created_at && created_at >= time
|
43
|
+
end
|
44
|
+
|
45
|
+
def store?
|
46
|
+
false
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
# cookie value format is [uid, auth_token, time]
|
52
|
+
#
|
53
|
+
def values
|
54
|
+
begin
|
55
|
+
@values = signer.decode(@cookies[cookie_name])
|
56
|
+
rescue SignedJson::Error
|
57
|
+
[nil, nil]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def cookie_name
|
62
|
+
Settings.auth.cookie_name
|
63
|
+
end
|
64
|
+
|
65
|
+
# Note that this is destructive to all previous authentication tokens even if the cookie is not eventually set.
|
66
|
+
def set_auth_values(resource)
|
67
|
+
signer.encode [ resource.reset_authentication_token!, Time.now ]
|
68
|
+
end
|
69
|
+
|
70
|
+
def cookie_options
|
71
|
+
@session_options ||= Rails.configuration.session_options
|
72
|
+
@session_options[:domain] = Settings.auth.cookie_domain
|
73
|
+
@session_options.slice(:path, :domain, :secure, :httponly)
|
74
|
+
end
|
75
|
+
|
76
|
+
def signer
|
77
|
+
secret = Settings.auth.secret
|
78
|
+
@signer ||= SignedJson::Signer.new(secret)
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "paperclip"
|
2
|
+
require "paperclip/validators/attachment_height_validator"
|
3
|
+
require "paperclip/validators/attachment_width_validator"
|
4
|
+
require "paperclip/geometry_transformation"
|
5
|
+
require "paperclip_processors/offset_thumbnail"
|
6
|
+
|
7
|
+
# For inclusion into any model class with a croppable image. Turns crop values into Imagemagick `convert` paramaters.
|
8
|
+
#
|
9
|
+
module Paperclip::Croppable
|
10
|
+
# Offset+crop geometry is taken from model attributes at runtime
|
11
|
+
# and scaled up by the resolution_multiplier to produce the larger images required by high resolution screens on mobile devices.
|
12
|
+
#
|
13
|
+
def scale_geometry
|
14
|
+
"#{image_scale_width}x"
|
15
|
+
end
|
16
|
+
|
17
|
+
def crop_geometry
|
18
|
+
p ">>> crop_geometry: self is #{self.inspect}"
|
19
|
+
properties = [image_scale_width, image_scale_height, image_offset_left, image_offset_top]
|
20
|
+
p ">>> crop_geometry: #{properties.inspect}"
|
21
|
+
"%dx%d%+-d%+-d" % properties
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/lib/droom/engine.rb
CHANGED
@@ -1,15 +1,33 @@
|
|
1
|
-
require '
|
1
|
+
require 'rubygems'
|
2
|
+
require 'paperclip'
|
3
|
+
require 'fog'
|
4
|
+
require 'devise'
|
5
|
+
require 'devise-encryptable' #TODO only until passwords have migrated to bcrypt
|
6
|
+
require 'cancan'
|
7
|
+
require 'kaminari'
|
8
|
+
require 'icalendar'
|
9
|
+
require 'haml'
|
2
10
|
|
3
11
|
module Droom
|
4
12
|
class Engine < ::Rails::Engine
|
5
13
|
isolate_namespace Droom
|
14
|
+
|
6
15
|
initializer "droom.integration" do
|
7
|
-
|
16
|
+
Devise.parent_controller = "Droom::EngineController"
|
8
17
|
ActiveRecord::Base.send :include, Droom::Taggability
|
9
18
|
ActiveRecord::Base.send :include, Droom::Folders
|
10
19
|
ActiveSupport.on_load :action_controller do
|
11
20
|
helper Droom::DroomHelper
|
12
21
|
end
|
13
22
|
end
|
23
|
+
|
24
|
+
config.to_prepare do
|
25
|
+
Devise::SessionsController.layout Droom.devise_layout
|
26
|
+
Devise::RegistrationsController.layout Droom.devise_layout
|
27
|
+
Devise::ConfirmationsController.layout Droom.devise_layout
|
28
|
+
Devise::UnlocksController.layout Droom.devise_layout
|
29
|
+
Devise::PasswordsController.layout Droom.devise_layout
|
30
|
+
end
|
31
|
+
|
14
32
|
end
|
15
33
|
end
|
data/lib/droom/folders.rb
CHANGED
@@ -74,17 +74,17 @@ module Droom
|
|
74
74
|
Droom::Document.in_folders(folder.family)
|
75
75
|
end
|
76
76
|
|
77
|
-
#
|
78
77
|
# Here we refer to the class variable defined during `has_folder` configuration. If it exists, we will put our folder
|
79
78
|
# inside that of the named associate. The containing folder might be created as a side effect.
|
79
|
+
# if it looks like an association name, we ask the associate for a folder. Otherwise we'll just use it as a name.
|
80
80
|
#
|
81
81
|
def get_parent_folder
|
82
|
-
|
83
|
-
if
|
84
|
-
|
82
|
+
parent_folder_option = self.class.class_variable_get(:"@@parent_folder_holder")
|
83
|
+
if parent_folder_option && respond_to?(parent_folder_option.to_sym) && folder_holder = send(parent_folder_option.to_sym)
|
84
|
+
folder_holder.folder
|
85
85
|
else
|
86
|
-
|
87
|
-
Droom::Folder.
|
86
|
+
slug = parent_folder_option || self.class.to_s.titlecase.split('/').last.pluralize
|
87
|
+
Droom::Folder.where(:slug => slug, :parent_id => nil).first_or_create
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
data/lib/droom/lazy_hash.rb
CHANGED
@@ -49,6 +49,16 @@ module Droom
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
def get_or_set(path, default_value)
|
53
|
+
key, subkeys = split_path(path)
|
54
|
+
if subkeys.any?
|
55
|
+
self[key] ||= Droom::LazyHash.new
|
56
|
+
self[key].get_or_set(subkeys, default_value)
|
57
|
+
else
|
58
|
+
self[key] ||= default_value
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
52
62
|
# *set* will set the value at the named bucket. Note that you should only ever do this from an
|
53
63
|
# initializer or some other thread-global event that can be relied upon always to have run. Never call
|
54
64
|
# LazyHash#set at runtime unless what you want is a local, non-thread-global nested hash construction.
|
@@ -65,7 +75,7 @@ module Droom
|
|
65
75
|
|
66
76
|
#
|
67
77
|
def split_path(key)
|
68
|
-
keys = key.is_a?(Array) ? key : key.to_s.split('.')
|
78
|
+
keys = key.is_a?(Array) ? key.dup : key.to_s.split('.')
|
69
79
|
keys.any? ? [keys.shift.to_sym, keys] : [nil, []]
|
70
80
|
end
|
71
81
|
|
data/lib/droom/monkeys.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
class Array
|
2
2
|
def to_ics
|
3
|
-
|
3
|
+
to_icalendar.to_ical
|
4
4
|
end
|
5
5
|
|
6
|
-
def
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
6
|
+
def to_icalendar
|
7
|
+
cal = Icalendar::Calendar.new
|
8
|
+
self.flatten.each do |item|
|
9
|
+
cal.add_event(item.icalendar_event) if item.respond_to? :icalendar_event
|
11
10
|
end
|
11
|
+
cal
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
data/lib/droom/taggability.rb
CHANGED
data/lib/droom/validators.rb
CHANGED
@@ -6,6 +6,6 @@ end
|
|
6
6
|
|
7
7
|
class UniquenessAmongSiblingsValidator < ActiveModel::EachValidator
|
8
8
|
def validate_each(record, attribute, value)
|
9
|
-
record.errors.add(attribute, :taken) if record.siblings.send(:"
|
9
|
+
record.errors.add(attribute, :taken) if record.siblings.send(:"find_by", {attribute: value})
|
10
10
|
end
|
11
11
|
end
|
data/lib/droom/version.rb
CHANGED
@@ -1,5 +1,13 @@
|
|
1
|
-
#Droom.
|
2
|
-
#Droom.
|
1
|
+
#Droom.layout = "application"
|
2
|
+
#Droom.email_layout = "email"
|
3
3
|
#Droom.use_forenames = false
|
4
4
|
#Droom.show_venue_map = false
|
5
5
|
#Droom.home_country = 'gb'
|
6
|
+
#Droom.main_dashboard_modules = %w{welcome future_events past_events documents}
|
7
|
+
#Droom.margin_dashboard_modules = %w{calendar invitations stream}
|
8
|
+
#Droom.home_url = Settings.host
|
9
|
+
#Droom.email_from = Settings.email.address
|
10
|
+
#Droom.email_from_name = Settings.email.name
|
11
|
+
#Droom.dropbox_app_key = Settings.dropbox.key
|
12
|
+
#Droom.dropbox_app_secret = Settings.dropbox.secret
|
13
|
+
#Droom.dropbox_app_name = Settings.dropbox.name
|
@@ -0,0 +1,80 @@
|
|
1
|
+
module Paperclip
|
2
|
+
|
3
|
+
class TransformationError < RuntimeError; end
|
4
|
+
class StyleError < RuntimeError; end
|
5
|
+
|
6
|
+
class Geometry
|
7
|
+
|
8
|
+
# Returns a new Geometry object with the the same dimensions as this but with no modifier.
|
9
|
+
def without_modifier
|
10
|
+
Geometry.new(self.width, self.height)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Returns the dimensions that would result if a thumbnail was created by transforming this geometry into that geometry.
|
14
|
+
# Its purpose is to mimic imagemagick conversions. Used like so:
|
15
|
+
# file_geometry.transformed_by(style_geometry)
|
16
|
+
# it returns the size of the thumbnail image you would get by applying that rule.
|
17
|
+
# This saves us having to go back to the file, which is expensive with S3.
|
18
|
+
# We understand all the Imagemagick geometry arguments described at http://www.imagemagick.org/script/command-line-processing.php#geometry
|
19
|
+
# including both '^' and paperclip's own '#' modifier.
|
20
|
+
#
|
21
|
+
def transformed_by (other)
|
22
|
+
other = Geometry.parse(other) unless other.is_a? Geometry
|
23
|
+
# if the two geometries are similar, or the destination geometry is a fixed size, the resulting dimensions are fixed
|
24
|
+
return other.without_modifier if self =~ other || ['#', '!', '^'].include?(other.modifier)
|
25
|
+
# otherwise, we apply the transformation
|
26
|
+
raise TransformationError, "geometry is not transformable without both width and height" if self.height == 0 or self.width == 0
|
27
|
+
case other.modifier
|
28
|
+
when '>'
|
29
|
+
(other.width < self.width || other.height < self.height) ? scaled_to_fit(other) : self
|
30
|
+
when '<'
|
31
|
+
(other.width > self.width && other.height > self.height) ? scaled_to_fit(other) : self
|
32
|
+
when '%'
|
33
|
+
scaled_by(other)
|
34
|
+
when '@'
|
35
|
+
scaled_by(other.width * 100 / (self.width * self.height))
|
36
|
+
else
|
37
|
+
scaled_to_fit(other)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
alias :* :transformed_by
|
41
|
+
|
42
|
+
# Tests whether two geometries are identical in dimensions and modifier.
|
43
|
+
def == (other)
|
44
|
+
self.to_s == other.to_s
|
45
|
+
end
|
46
|
+
|
47
|
+
# Tests whether two geometries have the same dimensions, ignoring modifier.
|
48
|
+
def =~ (other)
|
49
|
+
self.height.to_i == other.height.to_i && self.width.to_i == other.width.to_i
|
50
|
+
end
|
51
|
+
|
52
|
+
# Scales this geometry to fit within that geometry.
|
53
|
+
def scaled_to_fit(other)
|
54
|
+
if (other.width > 0 && other.height == 0)
|
55
|
+
Geometry.new(other.width, self.height * other.width / self.width)
|
56
|
+
elsif (other.width == 0 && other.height > 0)
|
57
|
+
Geometry.new(self.width * other.height / self.height, other.height)
|
58
|
+
else
|
59
|
+
ratio = Geometry.new( other.width / self.width, other.height / self.height )
|
60
|
+
if ratio.square?
|
61
|
+
other.without_modifier
|
62
|
+
elsif ratio.horizontal?
|
63
|
+
Geometry.new(ratio.height * self.width, other.height)
|
64
|
+
else
|
65
|
+
Geometry.new(other.width, ratio.width * self.height)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Scales this geometry by the percentage(s) specified in that geometry.
|
71
|
+
def scaled_by(other)
|
72
|
+
other = Geometry.new("#{other}%") unless other.is_a? Geometry
|
73
|
+
if other.height > 0
|
74
|
+
Geometry.new(self.width * other.width / 100, self.height * other.height / 100)
|
75
|
+
else
|
76
|
+
Geometry.new(self.width * other.width / 100, self.height * other.width / 100)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'active_model/validations/numericality'
|
2
|
+
|
3
|
+
module Paperclip
|
4
|
+
module Validators
|
5
|
+
class AttachmentHeightValidator < ActiveModel::Validations::NumericalityValidator
|
6
|
+
AVAILABLE_CHECKS = [:less_than, :less_than_or_equal_to, :greater_than, :greater_than_or_equal_to]
|
7
|
+
|
8
|
+
def initialize(options)
|
9
|
+
extract_options(options)
|
10
|
+
super
|
11
|
+
end
|
12
|
+
|
13
|
+
def validate_each(record, attr_name, value)
|
14
|
+
attachment = record.send(attr_name)
|
15
|
+
dimensions = Paperclip::Geometry.from_file(attachment.queued_for_write[:original])
|
16
|
+
value = dimensions.height.to_i
|
17
|
+
options.slice(*AVAILABLE_CHECKS).each do |option, option_value|
|
18
|
+
option_value = extract_option_value(option, option_value)
|
19
|
+
unless value.send(CHECKS[option], option_value)
|
20
|
+
error_message_key = options[:in] ? :in_between : option
|
21
|
+
record.errors.add(attr_name, error_message_key, filtered_options(value).merge(
|
22
|
+
:min => min_value,
|
23
|
+
:max => max_value
|
24
|
+
))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def check_validity!
|
30
|
+
unless (AVAILABLE_CHECKS + [:in]).any? { |argument| options.has_key?(argument) }
|
31
|
+
raise ArgumentError, "You must pass either :less_than, :greater_than, or :in to the validator"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def extract_options(options)
|
38
|
+
if range = options[:in]
|
39
|
+
if !options[:in].respond_to?(:call)
|
40
|
+
options[:less_than_or_equal_to] = range.max
|
41
|
+
options[:greater_than_or_equal_to] = range.min
|
42
|
+
else
|
43
|
+
options[:less_than_or_equal_to] = range
|
44
|
+
options[:greater_than_or_equal_to] = range
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def extract_option_value(option, option_value)
|
50
|
+
if option_value.is_a?(Range)
|
51
|
+
if [:less_than, :less_than_or_equal_to].include?(option)
|
52
|
+
option_value.max
|
53
|
+
else
|
54
|
+
option_value.min
|
55
|
+
end
|
56
|
+
else
|
57
|
+
option_value
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def min_value
|
62
|
+
value = options[:greater_than_or_equal_to] || options[:greater_than]
|
63
|
+
value = value.min if value.respond_to?(:min)
|
64
|
+
value
|
65
|
+
end
|
66
|
+
|
67
|
+
def max_value
|
68
|
+
value = options[:less_than_or_equal_to] || options[:less_than]
|
69
|
+
value = value.max if value.respond_to?(:max)
|
70
|
+
value
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
module HelperMethods
|
75
|
+
# Places ActiveRecord-style validations on the pixel height of the file assigned.
|
76
|
+
# The possible options are:
|
77
|
+
# * +in+: a Range of bytes (i.e. +1..1.megabyte+),
|
78
|
+
# * +less_than+: equivalent to :in => 0..options[:less_than]
|
79
|
+
# * +greater_than+: equivalent to :in => options[:greater_than]..Infinity
|
80
|
+
# * +message+: error message to display, use :min and :max as replacements
|
81
|
+
# * +if+: A lambda or name of an instance method. Validation will only
|
82
|
+
# be run if this lambda or method returns true.
|
83
|
+
# * +unless+: Same as +if+ but validates if lambda or method returns false.
|
84
|
+
def validates_attachment_height(*attr_names)
|
85
|
+
validates_with AttachmentHeightValidator, _merge_attributes(attr_names)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'active_model/validations/numericality'
|
2
|
+
|
3
|
+
module Paperclip
|
4
|
+
module Validators
|
5
|
+
class AttachmentWidthValidator < ActiveModel::Validations::NumericalityValidator
|
6
|
+
AVAILABLE_CHECKS = [:less_than, :less_than_or_equal_to, :greater_than, :greater_than_or_equal_to]
|
7
|
+
|
8
|
+
def initialize(options)
|
9
|
+
extract_options(options)
|
10
|
+
super
|
11
|
+
end
|
12
|
+
|
13
|
+
def validate_each(record, attr_name, value)
|
14
|
+
attachment = record.send(attr_name)
|
15
|
+
dimensions = Paperclip::Geometry.from_file(attachment.queued_for_write[:original])
|
16
|
+
value = dimensions.width.to_i
|
17
|
+
options.slice(*AVAILABLE_CHECKS).each do |option, option_value|
|
18
|
+
option_value = extract_option_value(option, option_value)
|
19
|
+
unless value.send(CHECKS[option], option_value)
|
20
|
+
error_message_key = options[:in] ? :in_between : option
|
21
|
+
record.errors.add(attr_name, error_message_key, filtered_options(value).merge(
|
22
|
+
:min => min_value,
|
23
|
+
:max => max_value
|
24
|
+
))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def check_validity!
|
30
|
+
unless (AVAILABLE_CHECKS + [:in]).any? { |argument| options.has_key?(argument) }
|
31
|
+
raise ArgumentError, "You must pass either :less_than, :greater_than, or :in to the validator"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def extract_options(options)
|
38
|
+
if range = options[:in]
|
39
|
+
if !options[:in].respond_to?(:call)
|
40
|
+
options[:less_than_or_equal_to] = range.max
|
41
|
+
options[:greater_than_or_equal_to] = range.min
|
42
|
+
else
|
43
|
+
options[:less_than_or_equal_to] = range
|
44
|
+
options[:greater_than_or_equal_to] = range
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def extract_option_value(option, option_value)
|
50
|
+
if option_value.is_a?(Range)
|
51
|
+
if [:less_than, :less_than_or_equal_to].include?(option)
|
52
|
+
option_value.max
|
53
|
+
else
|
54
|
+
option_value.min
|
55
|
+
end
|
56
|
+
else
|
57
|
+
option_value
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def min_value
|
62
|
+
value = options[:greater_than_or_equal_to] || options[:greater_than]
|
63
|
+
value = value.min if value.respond_to?(:min)
|
64
|
+
value
|
65
|
+
end
|
66
|
+
|
67
|
+
def max_value
|
68
|
+
value = options[:less_than_or_equal_to] || options[:less_than]
|
69
|
+
value = value.max if value.respond_to?(:max)
|
70
|
+
value
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
module HelperMethods
|
75
|
+
# Places ActiveRecord-style validations on the pixel width of the file assigned.
|
76
|
+
# The possible options are:
|
77
|
+
# * +in+: a Range of bytes (i.e. +1..1.megabyte+),
|
78
|
+
# * +less_than+: equivalent to :in => 0..options[:less_than]
|
79
|
+
# * +greater_than+: equivalent to :in => options[:greater_than]..Infinity
|
80
|
+
# * +message+: error message to display, use :min and :max as replacements
|
81
|
+
# * +if+: A lambda or name of an instance method. Validation will only
|
82
|
+
# be run if this lambda or method returns true.
|
83
|
+
# * +unless+: Same as +if+ but validates if lambda or method returns false.
|
84
|
+
def validates_attachment_width(*attr_names)
|
85
|
+
validates_with AttachmentWidthValidator, _merge_attributes(attr_names)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|