refinerycms-core 2.1.5 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/refinery/add.png +0 -0
- data/app/assets/images/refinery/admin_bg.png +0 -0
- data/app/assets/images/refinery/ajax-loader.gif +0 -0
- data/app/assets/images/refinery/branch-end.gif +0 -0
- data/app/assets/images/refinery/branch.gif +0 -0
- data/app/assets/images/refinery/cross.png +0 -0
- data/app/assets/images/refinery/dialogLoadingAnimation.gif +0 -0
- data/app/assets/images/refinery/header_background.png +0 -0
- data/app/assets/images/refinery/hover-gradient.jpg +0 -0
- data/app/assets/images/refinery/icons/accept.png +0 -0
- data/app/assets/images/refinery/icons/add.png +0 -0
- data/app/assets/images/refinery/icons/ajax-loader.gif +0 -0
- data/app/assets/images/refinery/icons/application_edit.png +0 -0
- data/app/assets/images/refinery/icons/application_go.png +0 -0
- data/app/assets/images/refinery/icons/arrow_left.png +0 -0
- data/app/assets/images/refinery/icons/arrow_left_right.png +0 -0
- data/app/assets/images/refinery/icons/arrow_switch.png +0 -0
- data/app/assets/images/refinery/icons/arrow_up.png +0 -0
- data/app/assets/images/refinery/icons/arrow_up_down.png +0 -0
- data/app/assets/images/refinery/icons/bin.png +0 -0
- data/app/assets/images/refinery/icons/bin_closed.png +0 -0
- data/app/assets/images/refinery/icons/cancel.png +0 -0
- data/app/assets/images/refinery/icons/cog_add.png +0 -0
- data/app/assets/images/refinery/icons/cog_edit.png +0 -0
- data/app/assets/images/refinery/icons/cross.png +0 -0
- data/app/assets/images/refinery/icons/delete.png +0 -0
- data/app/assets/images/refinery/icons/doc.png +0 -0
- data/app/assets/images/refinery/icons/down.gif +0 -0
- data/app/assets/images/refinery/icons/edit.png +0 -0
- data/app/assets/images/refinery/icons/email.png +0 -0
- data/app/assets/images/refinery/icons/email_edit.png +0 -0
- data/app/assets/images/refinery/icons/email_go.png +0 -0
- data/app/assets/images/refinery/icons/email_open.png +0 -0
- data/app/assets/images/refinery/icons/eye.png +0 -0
- data/app/assets/images/refinery/icons/folder.png +0 -0
- data/app/assets/images/refinery/icons/folder_open.png +0 -0
- data/app/assets/images/refinery/icons/folder_page_white.png +0 -0
- data/app/assets/images/refinery/icons/image_add.png +0 -0
- data/app/assets/images/refinery/icons/image_edit.png +0 -0
- data/app/assets/images/refinery/icons/img.png +0 -0
- data/app/assets/images/refinery/icons/information.png +0 -0
- data/app/assets/images/refinery/icons/layout_add.png +0 -0
- data/app/assets/images/refinery/icons/layout_edit.png +0 -0
- data/app/assets/images/refinery/icons/locale-blue.svg +15 -0
- data/app/assets/images/refinery/icons/locale.svg +11 -0
- data/app/assets/images/refinery/icons/music.png +0 -0
- data/app/assets/images/refinery/icons/page.png +0 -0
- data/app/assets/images/refinery/icons/page_add.png +0 -0
- data/app/assets/images/refinery/icons/page_edit.png +0 -0
- data/app/assets/images/refinery/icons/page_white_edit.png +0 -0
- data/app/assets/images/refinery/icons/page_white_gear.png +0 -0
- data/app/assets/images/refinery/icons/page_white_put.png +0 -0
- data/app/assets/images/refinery/icons/pdf.png +0 -0
- data/app/assets/images/refinery/icons/ppt.png +0 -0
- data/app/assets/images/refinery/icons/star.png +0 -0
- data/app/assets/images/refinery/icons/tick.png +0 -0
- data/app/assets/images/refinery/icons/up.gif +0 -0
- data/app/assets/images/refinery/icons/user_add.png +0 -0
- data/app/assets/images/refinery/icons/user_comment.png +0 -0
- data/app/assets/images/refinery/icons/user_edit.png +0 -0
- data/app/assets/images/refinery/icons/xls.png +0 -0
- data/app/assets/images/refinery/icons/zip.png +0 -0
- data/app/assets/images/refinery/icons/zoom.png +0 -0
- data/app/assets/images/refinery/logo-large.png +0 -0
- data/app/assets/images/refinery/logo-medium.png +0 -0
- data/app/assets/images/refinery/logo-site-bar.png +0 -0
- data/app/assets/images/refinery/logo-small-medium.png +0 -0
- data/app/assets/images/refinery/logo-small.png +0 -0
- data/app/assets/images/refinery/logo-tiny.png +0 -0
- data/app/assets/images/refinery/logo.png +0 -0
- data/app/assets/images/refinery/nav-3-background.gif +0 -0
- data/app/assets/images/refinery/nav_inactive_background.png +0 -0
- data/app/assets/images/refinery/orange_button.png +0 -0
- data/app/assets/images/refinery/page_bg.png +0 -0
- data/app/assets/images/refinery/text_field_background.png +0 -0
- data/app/assets/images/refinery/tooltip-nib.gif +0 -0
- data/app/assets/images/refinery/tooltip-nib.png +0 -0
- data/app/assets/javascripts/admin.js +7 -6
- data/app/assets/javascripts/refinery/admin.js.erb +99 -60
- data/app/assets/javascripts/refinery/ajaxy_pagination.js.coffee +2 -5
- data/app/assets/javascripts/refinery/application.js +8 -0
- data/app/assets/javascripts/refinery/core.js +4 -18
- data/app/assets/javascripts/refinery/interface.js.coffee.erb +5 -29
- data/app/assets/javascripts/refinery/modal_dialogs.js.erb +0 -105
- data/app/assets/javascripts/refinery/nestedsortables.js +183 -110
- data/app/assets/javascripts/refinery/refinery.js.erb +3 -9
- data/app/assets/javascripts/refinery/serializelist.js +1 -1
- data/app/assets/javascripts/refinery/site_bar.js +0 -5
- data/app/assets/javascripts/refinery/sortable_list.js +10 -11
- data/app/assets/javascripts/refinery/submit_continue.js.coffee.erb +1 -1
- data/app/assets/stylesheets/application.scss +2 -0
- data/app/assets/stylesheets/refinery/_colours.scss +18 -0
- data/app/assets/stylesheets/refinery/_icons.scss +85 -0
- data/app/assets/stylesheets/refinery/{layout.css.scss → _layout.scss} +306 -338
- data/app/assets/stylesheets/refinery/_mixins.scss +84 -0
- data/app/assets/stylesheets/refinery/{submenu.css.scss → _submenu.scss} +2 -2
- data/app/assets/stylesheets/refinery/{tooltips.css.scss → _tooltips.scss} +0 -0
- data/app/assets/stylesheets/refinery/_ui.scss +252 -0
- data/app/assets/stylesheets/refinery/{formatting.css.scss → formatting.scss} +0 -0
- data/app/assets/stylesheets/refinery/refinery.scss +10 -0
- data/app/assets/stylesheets/refinery/site_bar.scss +126 -0
- data/app/assets/stylesheets/refinery/{theme.css.scss → theme.scss} +0 -0
- data/app/controllers/refinery/admin/core_controller.rb +2 -7
- data/app/controllers/refinery/admin/dialogs_controller.rb +4 -3
- data/app/controllers/refinery/admin_controller.rb +0 -1
- data/app/controllers/refinery/fast_controller.rb +0 -4
- data/app/helpers/refinery/admin/visual_editor_helper.rb +13 -0
- data/app/helpers/refinery/admin_helper.rb +4 -0
- data/app/helpers/refinery/custom_assets_helper.rb +2 -2
- data/app/helpers/refinery/image_helper.rb +9 -8
- data/app/helpers/refinery/meta_helper.rb +1 -1
- data/app/helpers/refinery/site_bar_helper.rb +16 -2
- data/app/helpers/refinery/tag_helper.rb +38 -5
- data/app/models/refinery/core/base_model.rb +3 -1
- data/app/views/layouts/refinery/admin.html.erb +12 -10
- data/app/views/layouts/refinery/admin_dialog.html.erb +1 -4
- data/app/views/refinery/_content_page.html.erb +1 -1
- data/app/views/refinery/_google_analytics.html.erb +8 -9
- data/app/views/refinery/_head.html.erb +1 -1
- data/app/views/refinery/_javascripts.html.erb +0 -15
- data/app/views/refinery/_message.html.erb +1 -1
- data/app/views/refinery/_site_bar.html.erb +9 -6
- data/app/views/refinery/admin/_error_messages.html.erb +4 -4
- data/app/views/refinery/admin/_form_actions.html.erb +1 -0
- data/app/views/refinery/admin/_form_advanced_options_menu.html.erb +3 -4
- data/app/views/refinery/admin/_head.html.erb +3 -0
- data/app/views/refinery/admin/_image_picker.html.erb +4 -5
- data/app/views/refinery/admin/_javascripts.html.erb +4 -9
- data/app/views/refinery/admin/_locale_picker.html.erb +9 -2
- data/app/views/refinery/admin/_make_sortable.html.erb +8 -6
- data/app/views/refinery/admin/_menu.html.erb +2 -15
- data/app/views/refinery/admin/_menu_item.html.erb +3 -0
- data/app/views/refinery/admin/_resource_picker.html.erb +12 -22
- data/app/views/refinery/admin/_search.html.erb +1 -1
- data/app/views/refinery/admin/_tabbed_fields.html.erb +2 -2
- data/app/views/refinery/admin/_wysiwyg.html.erb +1 -1
- data/{lib/generators/refinery/cms/templates/app/decorators/controllers/refinery/.gitkeep → app/views/refinery/admin/dialog_success.html.erb} +0 -0
- data/app/views/refinery/admin/dialogs/show.html.erb +1 -19
- data/config/initializers/assets.rb +6 -0
- data/config/locales/ca.yml +84 -0
- data/config/locales/cs.yml +12 -5
- data/config/locales/en.yml +6 -2
- data/config/locales/fr.yml +15 -11
- data/config/locales/hu.yml +3 -1
- data/config/locales/it.yml +5 -1
- data/config/locales/ja.yml +2 -2
- data/config/locales/pt.yml +5 -3
- data/config/locales/ru.yml +7 -0
- data/config/locales/sl.yml +0 -3
- data/config/locales/tr.yml +43 -41
- data/config/routes.rb +1 -4
- data/lib/generators/refinery/cms/cms_generator.rb +68 -26
- data/lib/generators/refinery/cms/templates/app/decorators/{models/refinery/.gitkeep → controllers/refinery/.keep} +0 -0
- data/lib/generators/refinery/{form/templates/.gitkeep → cms/templates/app/decorators/models/refinery/.keep} +0 -0
- data/lib/generators/refinery/cms/templates/config/database.yml.mysql +3 -3
- data/lib/generators/refinery/cms/templates/config/database.yml.postgresql +3 -3
- data/lib/generators/refinery/core/templates/config/initializers/refinery/core.rb.erb +18 -5
- data/lib/generators/refinery/dummy/dummy_generator.rb +3 -1
- data/lib/generators/refinery/dummy/templates/rails/application.js +3 -0
- data/lib/generators/refinery/dummy/templates/rails/application.rb.erb +0 -2
- data/lib/generators/refinery/dummy/templates/rails/blank.png +0 -0
- data/lib/generators/refinery/dummy/templates/rails/routes.rb +1 -1
- data/lib/generators/refinery/engine/engine_generator.rb +3 -2
- data/lib/generators/refinery/engine/templates/Gemfile +9 -4
- data/lib/generators/refinery/engine/templates/Rakefile +3 -4
- data/lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb +11 -2
- data/lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb.erb +2 -2
- data/lib/generators/refinery/engine/templates/app/models/refinery/namespace/singular_name.rb.erb +5 -5
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_actions.html.erb +7 -12
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_form.html.erb +8 -8
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_records.html.erb +3 -3
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_singular_name.html.erb +6 -11
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/index.html.erb +1 -1
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/plural_name/show.html.erb +4 -4
- data/lib/generators/refinery/engine/templates/db/migrate/1_create_namespace_plural_name.rb.erb +2 -9
- data/lib/generators/refinery/engine/templates/db/seeds.rb.erb +13 -19
- data/lib/generators/refinery/engine/templates/lib/refinery/plural_name/engine.rb.erb +0 -4
- data/lib/generators/refinery/engine/templates/readme.md +3 -3
- data/lib/generators/refinery/engine/templates/refinerycms-extension_plural_name.gemspec +1 -0
- data/lib/generators/refinery/engine/templates/spec/features/refinery/namespace/admin/plural_name_spec.rb.erb +25 -28
- data/lib/generators/refinery/engine/templates/spec/models/refinery/namespace/singular_name_spec.rb.erb +1 -1
- data/lib/generators/refinery/engine/templates/spec/spec_helper.rb +1 -1
- data/lib/refinery.rb +7 -9
- data/lib/refinery/admin/base_controller.rb +42 -32
- data/lib/refinery/application_controller.rb +25 -17
- data/lib/refinery/cli.rb +54 -19
- data/lib/refinery/core.rb +5 -0
- data/lib/refinery/core/authorisation_adapter.rb +11 -0
- data/lib/refinery/core/authorisation_manager.rb +14 -0
- data/lib/refinery/core/configuration.rb +25 -4
- data/lib/refinery/core/default_route.rb +16 -0
- data/lib/refinery/core/engine.rb +44 -25
- data/lib/refinery/core/nil_user.rb +42 -0
- data/lib/refinery/crud.rb +40 -29
- data/lib/refinery/extension_generation.rb +11 -22
- data/lib/refinery/generators/generated_attribute.rb +54 -0
- data/lib/refinery/generators/named_base.rb +16 -0
- data/lib/refinery/menu.rb +3 -2
- data/lib/refinery/menu_item.rb +1 -1
- data/lib/refinery/plugin.rb +27 -43
- data/lib/refinery/plugins.rb +22 -26
- data/lib/refinery/users_manager.rb +8 -0
- data/lib/refinery/version.rb +7 -3
- data/lib/tasks/refinery.rake +7 -0
- data/license.md +1 -1
- data/refinerycms-core.gemspec +11 -8
- data/spec/controllers/refinery/admin/dummy_controller_spec.rb +23 -11
- data/spec/controllers/refinery/sitemap_controller_spec.rb +2 -2
- data/spec/features/refinery/admin/custom_assets_spec.rb +12 -10
- data/spec/features/refinery/admin/dialogs_spec.rb +5 -5
- data/spec/features/refinery/admin/xhr_paging_spec.rb +24 -38
- data/spec/features/refinery/application_layout_spec.rb +3 -3
- data/spec/features/refinery/core_spec.rb +1 -1
- data/spec/features/refinery/site_bar_spec.rb +44 -23
- data/spec/helpers/refinery/admin_helper_spec.rb +15 -0
- data/spec/helpers/refinery/custom_assets_helper_spec.rb +15 -23
- data/spec/helpers/refinery/html_truncation_helper_spec.rb +10 -5
- data/spec/helpers/refinery/meta_helper_spec.rb +3 -3
- data/spec/helpers/refinery/pagination_helper_spec.rb +7 -7
- data/spec/helpers/refinery/tag_helper_spec.rb +4 -4
- data/spec/helpers/refinery/translation_helper_spec.rb +3 -3
- data/spec/lib/generators/refinery/cms/cms_generator_spec.rb +30 -25
- data/spec/lib/generators/refinery/core/core_generator_spec.rb +1 -1
- data/spec/lib/generators/refinery/engine/engine_generator_multiple_resources_spec.rb +7 -8
- data/spec/lib/generators/refinery/engine/engine_generator_sanity_check_spec.rb +15 -15
- data/spec/lib/generators/refinery/engine/engine_generator_spec.rb +9 -9
- data/spec/lib/generators/refinery/engine/engine_generator_with_i18n_spec.rb +1 -1
- data/spec/lib/generators/refinery/engine/engine_generator_without_frontend_spec.rb +1 -1
- data/spec/lib/refinery/application_controller_spec.rb +16 -16
- data/spec/lib/refinery/authorisation_manager_spec.rb +10 -0
- data/spec/lib/refinery/cli_spec.rb +83 -21
- data/spec/lib/refinery/core/configuration_spec.rb +5 -5
- data/spec/lib/refinery/core/nil_user_spec.rb +39 -0
- data/spec/lib/refinery/core_spec.rb +39 -30
- data/spec/lib/refinery/crud_spec.rb +70 -59
- data/spec/lib/refinery/menu_spec.rb +4 -4
- data/spec/lib/refinery/plugin_spec.rb +56 -45
- data/spec/lib/refinery/plugins_spec.rb +39 -87
- data/spec/lib/refinery/users_manager_spec.rb +9 -0
- data/spec/support/refinery.rb +3 -8
- data/vendor/assets/fonts/font-awesome/FontAwesome.otf +0 -0
- data/vendor/assets/fonts/font-awesome/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/font-awesome/fontawesome-webfont.svg +565 -0
- data/vendor/assets/fonts/font-awesome/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/font-awesome/fontawesome-webfont.woff +0 -0
- data/vendor/assets/fonts/font-awesome/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/stylesheets/_font-awesome-compass.scss +5 -0
- data/vendor/assets/stylesheets/_font-awesome-sprockets.scss +5 -0
- data/vendor/assets/stylesheets/_font-awesome.scss +17 -0
- data/vendor/assets/stylesheets/font-awesome/_animated.scss +34 -0
- data/vendor/assets/stylesheets/font-awesome/_bordered-pulled.scss +16 -0
- data/vendor/assets/stylesheets/font-awesome/_core.scss +12 -0
- data/vendor/assets/stylesheets/font-awesome/_extras.scss +44 -0
- data/vendor/assets/stylesheets/font-awesome/_fixed-width.scss +6 -0
- data/vendor/assets/stylesheets/font-awesome/_icons.scss +596 -0
- data/vendor/assets/stylesheets/font-awesome/_larger.scss +13 -0
- data/vendor/assets/stylesheets/font-awesome/_list.scss +19 -0
- data/vendor/assets/stylesheets/font-awesome/_mixins.scss +26 -0
- data/vendor/assets/stylesheets/font-awesome/_path.scss +14 -0
- data/vendor/assets/stylesheets/font-awesome/_rotated-flipped.scss +20 -0
- data/vendor/assets/stylesheets/font-awesome/_stacked.scss +20 -0
- data/vendor/assets/stylesheets/font-awesome/_variables.scss +606 -0
- metadata +144 -441
- data/app/assets/images/refinery/carousel-left.png +0 -0
- data/app/assets/images/refinery/carousel-right.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/arrow_redo.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/arrow_undo.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/eye.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/article.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/aside.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/blockquote.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/command.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/details.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/figcaption.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/figure.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/footer.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/h1.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/h2.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/h3.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/h4.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/h5.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/h6.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/header.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/hgroup.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/mark.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/meter.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/nav.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/p.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/pre.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/progress.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/readme.md +0 -1
- data/app/assets/images/wymeditor/skins/refinery/html5/rp.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/rt.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/ruby.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/section.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/summary.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/time.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-blockquote.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h1.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h2.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h3.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h4.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h5.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h6.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-p.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-pre.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/link_add.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/link_break.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/page_code.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/page_paste.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/photo_add.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/right.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/style.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/table_add.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_align_center.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_align_justify.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_align_left.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_align_right.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_bold.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_heading_1.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_heading_2.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_heading_3.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_heading_4.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_heading_5.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_heading_6.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_indent.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_indent_remove.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_italic.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_list_bullets.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_list_numbers.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_paragraph.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_strikethrough.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_subscript.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_superscript.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_underline.png +0 -0
- data/app/assets/images/wymeditor/skins/wymeditor_icon.png +0 -0
- data/app/assets/javascripts/refinery/boot_wym.js.erb +0 -285
- data/app/assets/javascripts/refinery/sortable_menu.js.coffee.erb +0 -20
- data/app/assets/javascripts/refinery/wymeditor.js +0 -37
- data/app/assets/javascripts/wymeditor/GPL-license.txt +0 -278
- data/app/assets/javascripts/wymeditor/MIT-license.txt +0 -20
- data/app/assets/javascripts/wymeditor/README +0 -35
- data/app/assets/javascripts/wymeditor/browsers/ie.js.erb +0 -224
- data/app/assets/javascripts/wymeditor/browsers/mozilla.js.erb +0 -292
- data/app/assets/javascripts/wymeditor/browsers/opera.js.erb +0 -123
- data/app/assets/javascripts/wymeditor/browsers/webkit.js.erb +0 -283
- data/app/assets/javascripts/wymeditor/classes.js.erb +0 -1575
- data/app/assets/javascripts/wymeditor/functions.js.erb +0 -222
- data/app/assets/javascripts/wymeditor/lang/bg.js +0 -57
- data/app/assets/javascripts/wymeditor/lang/ca.js +0 -45
- data/app/assets/javascripts/wymeditor/lang/cs.js +0 -58
- data/app/assets/javascripts/wymeditor/lang/da.js +0 -48
- data/app/assets/javascripts/wymeditor/lang/de.js +0 -45
- data/app/assets/javascripts/wymeditor/lang/en.js +0 -57
- data/app/assets/javascripts/wymeditor/lang/es.js +0 -58
- data/app/assets/javascripts/wymeditor/lang/fa.js +0 -46
- data/app/assets/javascripts/wymeditor/lang/fi.js +0 -57
- data/app/assets/javascripts/wymeditor/lang/fr.js +0 -58
- data/app/assets/javascripts/wymeditor/lang/he.js +0 -45
- data/app/assets/javascripts/wymeditor/lang/hu.js +0 -45
- data/app/assets/javascripts/wymeditor/lang/it.js +0 -48
- data/app/assets/javascripts/wymeditor/lang/ja.js +0 -47
- data/app/assets/javascripts/wymeditor/lang/lv.js +0 -47
- data/app/assets/javascripts/wymeditor/lang/nb.js +0 -48
- data/app/assets/javascripts/wymeditor/lang/nl.js +0 -57
- data/app/assets/javascripts/wymeditor/lang/nn.js +0 -45
- data/app/assets/javascripts/wymeditor/lang/pl.js +0 -56
- data/app/assets/javascripts/wymeditor/lang/pt-BR.js +0 -58
- data/app/assets/javascripts/wymeditor/lang/pt.js +0 -45
- data/app/assets/javascripts/wymeditor/lang/rs.js +0 -47
- data/app/assets/javascripts/wymeditor/lang/ru.js +0 -57
- data/app/assets/javascripts/wymeditor/lang/sk.js +0 -56
- data/app/assets/javascripts/wymeditor/lang/sl.js +0 -47
- data/app/assets/javascripts/wymeditor/lang/sv.js +0 -45
- data/app/assets/javascripts/wymeditor/lang/tr.js +0 -45
- data/app/assets/javascripts/wymeditor/lang/vi.js +0 -47
- data/app/assets/javascripts/wymeditor/lang/zh-CN.js +0 -47
- data/app/assets/javascripts/wymeditor/prototypes.js.erb +0 -1103
- data/app/assets/javascripts/wymeditor/setup.js.erb +0 -622
- data/app/assets/javascripts/wymeditor/skins/refinery/skin.js +0 -45
- data/app/assets/javascripts/wymeditor/validators.js.erb +0 -777
- data/app/assets/stylesheets/refinery/refinery.css +0 -15
- data/app/assets/stylesheets/refinery/site_bar.css.scss +0 -92
- data/app/assets/stylesheets/refinery/ui.css.scss +0 -103
- data/app/assets/stylesheets/wymeditor/skins/refinery/skin.css.scss +0 -530
- data/app/assets/stylesheets/wymeditor/skins/refinery/wymiframe.css.scss +0 -156
- data/app/helpers/refinery/admin/core_helper.rb +0 -6
- data/app/helpers/refinery/admin/dialogs_helper.rb +0 -6
- data/app/helpers/refinery/fast_helper.rb +0 -4
- data/app/helpers/refinery/sitemap_helper.rb +0 -4
- data/app/views/refinery/wymiframe.html.erb +0 -14
- data/lib/generators/refinery/form/USAGE +0 -20
- data/lib/generators/refinery/form/form_generator.rb +0 -25
- data/lib/generators/refinery/form/templates/.gitignore +0 -2
- data/lib/generators/refinery/form/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb +0 -54
- data/lib/generators/refinery/form/templates/app/controllers/refinery/namespace/admin/settings_controller.rb.erb +0 -45
- data/lib/generators/refinery/form/templates/app/controllers/refinery/namespace/plural_name_controller.rb.erb +0 -53
- data/lib/generators/refinery/form/templates/app/mailers/refinery/namespace/mailer.rb.erb +0 -22
- data/lib/generators/refinery/form/templates/app/models/refinery/namespace/setting.rb.erb +0 -34
- data/lib/generators/refinery/form/templates/app/models/refinery/namespace/singular_name.rb.erb +0 -49
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/_records.html.erb +0 -23
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/_singular_name.html.erb +0 -25
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/_submenu.html.erb +0 -29
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/index.html.erb +0 -4
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/show.html.erb +0 -52
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/spam.html.erb +0 -27
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/settings/_confirmation_email_form.html.erb +0 -51
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/settings/_notification_recipients_form.html.erb +0 -21
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/settings/edit.html.erb +0 -5
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/mailer/confirmation.html.erb +0 -1
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/mailer/notification.html.erb +0 -17
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/plural_name/new.html.erb +0 -43
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/plural_name/thank_you.html.erb +0 -1
- data/lib/generators/refinery/form/templates/config/locales/cs.yml +0 -78
- data/lib/generators/refinery/form/templates/config/locales/da.yml +0 -66
- data/lib/generators/refinery/form/templates/config/locales/de.yml +0 -78
- data/lib/generators/refinery/form/templates/config/locales/en.yml +0 -78
- data/lib/generators/refinery/form/templates/config/locales/es.yml +0 -66
- data/lib/generators/refinery/form/templates/config/locales/fr.yml +0 -78
- data/lib/generators/refinery/form/templates/config/locales/it.yml +0 -66
- data/lib/generators/refinery/form/templates/config/locales/lv.yml +0 -77
- data/lib/generators/refinery/form/templates/config/locales/nb.yml +0 -75
- data/lib/generators/refinery/form/templates/config/locales/nl.yml +0 -78
- data/lib/generators/refinery/form/templates/config/locales/pt-BR.yml +0 -78
- data/lib/generators/refinery/form/templates/config/locales/ru.yml +0 -77
- data/lib/generators/refinery/form/templates/config/locales/sk.yml +0 -78
- data/lib/generators/refinery/form/templates/config/locales/sl.yml +0 -67
- data/lib/generators/refinery/form/templates/config/locales/tr.yml +0 -78
- data/lib/generators/refinery/form/templates/config/locales/zh-CN.yml +0 -78
- data/lib/generators/refinery/form/templates/config/routes.rb.erb +0 -26
- data/lib/generators/refinery/form/templates/db/migrate/1_create_plural_name.rb.erb +0 -39
- data/lib/generators/refinery/form/templates/db/seeds.rb.erb +0 -31
- data/lib/generators/refinery/form/templates/lib/generators/refinery/plural_name_generator.rb.erb +0 -20
- data/lib/generators/refinery/form/templates/lib/refinery/plural_name.rb.erb +0 -18
- data/lib/generators/refinery/form/templates/lib/refinery/plural_name/engine.rb.erb +0 -27
- data/lib/generators/refinery/form/templates/lib/refinerycms-plural_name.rb.erb +0 -1
- data/lib/generators/refinery/form/templates/refinerycms-plural_name.gemspec +0 -16
- data/lib/generators/refinery/form/templates/script/rails +0 -10
- data/lib/refinery/activity.rb +0 -113
- data/lib/refinery/ext/action_view/helpers/form_builder.rb +0 -9
- data/lib/refinery/ext/action_view/helpers/form_helper.rb +0 -20
- data/lib/refinery/ext/action_view/helpers/form_tag_helper.rb +0 -10
- data/spec/controllers/refinery/admin/refinery_core_controller_spec.rb +0 -19
- data/spec/controllers/refinery/fast_controller_spec.rb +0 -12
- data/spec/lib/generators/refinery/form/form_generator_spec.rb +0 -99
- data/spec/lib/refinery/activity_spec.rb +0 -46
- data/spec/support/background_selenium_firefox_driver.rb +0 -14
- data/vendor/assets/javascripts/jquery/jquery.jcarousel.js +0 -900
@@ -1,20 +0,0 @@
|
|
1
|
-
ActionView::Helpers::FormHelper.module_eval do
|
2
|
-
|
3
|
-
def required_label(object_name, method, options = {})
|
4
|
-
options = {:class => "required"}.merge!(options)
|
5
|
-
|
6
|
-
label(object_name, method, "#{label_humanize_text(method, options)} *", options)
|
7
|
-
end
|
8
|
-
|
9
|
-
|
10
|
-
def label_humanize_text method, options = {}
|
11
|
-
object = options[:object]
|
12
|
-
|
13
|
-
content ||= if object && object.class.respond_to?(:human_attribute_name)
|
14
|
-
object.class.human_attribute_name(method)
|
15
|
-
end
|
16
|
-
|
17
|
-
content ||= method.humanize
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Refinery
|
4
|
-
module Admin
|
5
|
-
describe CoreController do
|
6
|
-
refinery_login_with_factory :refinery_user
|
7
|
-
|
8
|
-
it "updates the plugin positions" do
|
9
|
-
plugins = logged_in_user.plugins.reverse.map &:name
|
10
|
-
|
11
|
-
post 'update_plugin_positions', :menu => plugins
|
12
|
-
|
13
|
-
logged_in_user.plugins.reload.each_with_index do |plugin, idx|
|
14
|
-
plugin.name.should eql(plugins[idx])
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'generator_spec/test_case'
|
3
|
-
require 'generators/refinery/form/form_generator'
|
4
|
-
|
5
|
-
module Refinery
|
6
|
-
describe FormGenerator do
|
7
|
-
include GeneratorSpec::TestCase
|
8
|
-
|
9
|
-
temp_dir = Dir.mktmpdir("refinery_rspec_form_test")
|
10
|
-
let(:temp_dir) { temp_dir }
|
11
|
-
|
12
|
-
destination temp_dir
|
13
|
-
|
14
|
-
before do
|
15
|
-
prepare_destination
|
16
|
-
run_generator %w{ rspec_form_test title:string description:text choice:radio another:dropdown enable:checkbox }
|
17
|
-
end
|
18
|
-
|
19
|
-
after do
|
20
|
-
FileUtils.rm_r(temp_dir)
|
21
|
-
end
|
22
|
-
|
23
|
-
specify do
|
24
|
-
destination_root.should have_structure {
|
25
|
-
directory "vendor" do
|
26
|
-
directory "extensions" do
|
27
|
-
directory "rspec_form_tests" do
|
28
|
-
directory "app" do
|
29
|
-
directory "controllers" do
|
30
|
-
directory "refinery" do
|
31
|
-
directory "rspec_form_tests" do
|
32
|
-
directory "admin" do
|
33
|
-
file "rspec_form_tests_controller.rb"
|
34
|
-
end
|
35
|
-
file "rspec_form_tests_controller.rb"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
directory "mailers" do
|
40
|
-
directory "refinery" do
|
41
|
-
directory "rspec_form_tests" do
|
42
|
-
file "mailer.rb"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
directory "models" do
|
47
|
-
directory "refinery" do
|
48
|
-
directory "rspec_form_tests" do
|
49
|
-
file "rspec_form_test.rb"
|
50
|
-
file "setting.rb"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
directory "views" do
|
55
|
-
directory "refinery" do
|
56
|
-
directory "rspec_form_tests" do
|
57
|
-
directory "admin" do
|
58
|
-
directory "rspec_form_tests" do
|
59
|
-
file "_records.html.erb"
|
60
|
-
file "_rspec_form_test.html.erb"
|
61
|
-
file "_submenu.html.erb"
|
62
|
-
file "index.html.erb"
|
63
|
-
file "show.html.erb"
|
64
|
-
file "spam.html.erb"
|
65
|
-
end
|
66
|
-
end
|
67
|
-
directory "rspec_form_tests" do
|
68
|
-
file "new.html.erb"
|
69
|
-
file "thank_you.html.erb"
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
directory "db" do
|
76
|
-
file "seeds.rb"
|
77
|
-
end
|
78
|
-
directory "lib" do
|
79
|
-
file "refinerycms-rspec_form_tests.rb"
|
80
|
-
directory "refinery" do
|
81
|
-
directory "rspec_form_tests" do
|
82
|
-
file "engine.rb"
|
83
|
-
end
|
84
|
-
file "rspec_form_tests.rb"
|
85
|
-
end
|
86
|
-
end
|
87
|
-
directory "config" do
|
88
|
-
directory "locales" do
|
89
|
-
file "en.yml"
|
90
|
-
end
|
91
|
-
file "routes.rb"
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
}
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Refinery::Activity do
|
4
|
-
before { module X; module Y; class Z; end; end; end }
|
5
|
-
|
6
|
-
let(:activity) { Refinery::Activity.new(:class_name => 'X::Y::Z') }
|
7
|
-
|
8
|
-
describe '#base_class_name' do
|
9
|
-
it 'returns the base class name, less module nesting' do
|
10
|
-
activity.base_class_name.should == 'Z'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
describe '#klass' do
|
15
|
-
it 'returns class constant' do
|
16
|
-
activity.klass.should == X::Y::Z
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe '#url_prefix' do
|
21
|
-
it 'returns edit_ by default' do
|
22
|
-
activity.url_prefix.should == 'edit_'
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'returns user specified prefix' do
|
26
|
-
activity.url_prefix = 'testy'
|
27
|
-
activity.url_prefix.should == 'testy_'
|
28
|
-
activity.url_prefix = 'testy_'
|
29
|
-
activity.url_prefix.should == 'testy_'
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe '#url' do
|
34
|
-
it 'returns the url' do
|
35
|
-
activity.url.should == 'refinery.edit_x_y_admin_z_path'
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe '#url with Refinery namespace' do
|
40
|
-
before { module Refinery; module Y; class Z; end; end; end }
|
41
|
-
let(:activity) { Refinery::Activity.new(:class_name => 'Refinery::Y::Z') }
|
42
|
-
it 'returns the url' do
|
43
|
-
activity.url.should == 'refinery.edit_y_admin_z_path'
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
if Capybara.javascript_driver == :selenium
|
2
|
-
require 'selenium-webdriver'
|
3
|
-
require 'selenium/webdriver/firefox'
|
4
|
-
|
5
|
-
if defined?(Selenium::WebDriver::Firefox::Launcher) && Selenium::WebDriver::Platform.mac?
|
6
|
-
# Run firefox in the background, on OS X
|
7
|
-
Selenium::WebDriver::Firefox::Launcher.class_eval do
|
8
|
-
def start
|
9
|
-
assert_profile
|
10
|
-
@binary.start_with @profile, @profile_dir, ''
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,900 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* jCarousel - Riding carousels with jQuery
|
3
|
-
* http://sorgalla.com/jcarousel/
|
4
|
-
*
|
5
|
-
* Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
|
6
|
-
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
7
|
-
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
8
|
-
*
|
9
|
-
* Built on top of the jQuery library
|
10
|
-
* http://jquery.com
|
11
|
-
*
|
12
|
-
* Inspired by the "Carousel Component" by Bill Scott
|
13
|
-
* http://billwscott.com/carousel/
|
14
|
-
*/
|
15
|
-
|
16
|
-
(function($) {
|
17
|
-
/**
|
18
|
-
* Creates a carousel for all matched elements.
|
19
|
-
*
|
20
|
-
* @example $("#mycarousel").jcarousel();
|
21
|
-
* @before <ul id="mycarousel" class="jcarousel-skin-name"><li>First item</li><li>Second item</li></ul>
|
22
|
-
* @result
|
23
|
-
*
|
24
|
-
* <div class="jcarousel-skin-name">
|
25
|
-
* <div class="jcarousel-container">
|
26
|
-
* <div disabled="disabled" class="jcarousel-prev jcarousel-prev-disabled"></div>
|
27
|
-
* <div class="jcarousel-clip">
|
28
|
-
* <ul class="jcarousel-list">
|
29
|
-
* <li class="jcarousel-item-1">First item</li>
|
30
|
-
* <li class="jcarousel-item-2">Second item</li>
|
31
|
-
* </ul>
|
32
|
-
* </div>
|
33
|
-
* <div class="jcarousel-next"></div>
|
34
|
-
* </div>
|
35
|
-
* </div>
|
36
|
-
*
|
37
|
-
* @method jcarousel
|
38
|
-
* @return jQuery
|
39
|
-
* @param o {Hash|String} A set of key/value pairs to set as configuration properties or a method name to call on a formerly created instance.
|
40
|
-
*/
|
41
|
-
$.fn.jcarousel = function(o) {
|
42
|
-
if (typeof o == 'string') {
|
43
|
-
var instance = $(this).data('jcarousel'), args = Array.prototype.slice.call(arguments, 1);
|
44
|
-
return instance[o].apply(instance, args);
|
45
|
-
} else
|
46
|
-
return this.each(function() {
|
47
|
-
$(this).data('jcarousel', new $jc(this, o));
|
48
|
-
});
|
49
|
-
};
|
50
|
-
|
51
|
-
// Default configuration properties.
|
52
|
-
var defaults = {
|
53
|
-
vertical: false,
|
54
|
-
listTag: 'ul',
|
55
|
-
itemTag: 'li',
|
56
|
-
start: 1,
|
57
|
-
offset: 1,
|
58
|
-
size: null,
|
59
|
-
scroll: 3,
|
60
|
-
visible: null,
|
61
|
-
animation: 'normal',
|
62
|
-
easing: 'swing',
|
63
|
-
auto: 0,
|
64
|
-
wrap: null,
|
65
|
-
initCallback: null,
|
66
|
-
reloadCallback: null,
|
67
|
-
itemLoadCallback: null,
|
68
|
-
itemFirstInCallback: null,
|
69
|
-
itemFirstOutCallback: null,
|
70
|
-
itemLastInCallback: null,
|
71
|
-
itemLastOutCallback: null,
|
72
|
-
itemVisibleInCallback: null,
|
73
|
-
itemVisibleOutCallback: null,
|
74
|
-
buttonNextHTML: '<div></div>',
|
75
|
-
buttonPrevHTML: '<div></div>',
|
76
|
-
buttonNextEvent: 'click',
|
77
|
-
buttonPrevEvent: 'click',
|
78
|
-
buttonNextCallback: null,
|
79
|
-
buttonPrevCallback: null
|
80
|
-
};
|
81
|
-
|
82
|
-
/**
|
83
|
-
* The jCarousel object.
|
84
|
-
*
|
85
|
-
* @constructor
|
86
|
-
* @class jcarousel
|
87
|
-
* @param e {HTMLElement} The element to create the carousel for.
|
88
|
-
* @param o {Object} A set of key/value pairs to set as configuration properties.
|
89
|
-
* @cat Plugins/jCarousel
|
90
|
-
*/
|
91
|
-
$.jcarousel = function(e, o) {
|
92
|
-
this.options = $.extend({}, defaults, o || {});
|
93
|
-
|
94
|
-
this.locked = false;
|
95
|
-
|
96
|
-
this.container = null;
|
97
|
-
this.clip = null;
|
98
|
-
this.list = null;
|
99
|
-
this.buttonNext = null;
|
100
|
-
this.buttonPrev = null;
|
101
|
-
|
102
|
-
this.wh = !this.options.vertical ? 'width' : 'height';
|
103
|
-
this.lt = !this.options.vertical ? 'left' : 'top';
|
104
|
-
|
105
|
-
// Extract skin class
|
106
|
-
var skin = '', split = e.className.split(' ');
|
107
|
-
|
108
|
-
for (var i = 0; i < split.length; i++) {
|
109
|
-
if (split[i].indexOf('jcarousel-skin') != -1) {
|
110
|
-
$(e).removeClass(split[i]);
|
111
|
-
skin = split[i];
|
112
|
-
break;
|
113
|
-
}
|
114
|
-
}
|
115
|
-
|
116
|
-
if (e.nodeName.toUpperCase() == this.options.listTag.toUpperCase()) {
|
117
|
-
this.list = $(e);
|
118
|
-
this.container = this.list.parent();
|
119
|
-
|
120
|
-
if (this.container.hasClass('jcarousel-clip')) {
|
121
|
-
if (!this.container.parent().hasClass('jcarousel-container'))
|
122
|
-
this.container = this.container.wrap('<div></div>');
|
123
|
-
|
124
|
-
this.container = this.container.parent();
|
125
|
-
} else if (!this.container.hasClass('jcarousel-container'))
|
126
|
-
this.container = this.list.wrap('<div></div>').parent();
|
127
|
-
} else {
|
128
|
-
this.container = $(e);
|
129
|
-
this.list = this.container.find(this.options.listTag).eq(0);
|
130
|
-
}
|
131
|
-
|
132
|
-
if (skin != '' && this.container.parent()[0].className.indexOf('jcarousel-skin') == -1)
|
133
|
-
this.container.wrap('<div class=" '+ skin + '"></div>');
|
134
|
-
|
135
|
-
this.clip = this.list.parent();
|
136
|
-
|
137
|
-
if (!this.clip.length || !this.clip.hasClass('jcarousel-clip'))
|
138
|
-
this.clip = this.list.wrap('<div></div>').parent();
|
139
|
-
|
140
|
-
this.buttonNext = $('.jcarousel-next', this.container);
|
141
|
-
|
142
|
-
if (this.buttonNext.size() == 0 && this.options.buttonNextHTML != null)
|
143
|
-
this.buttonNext = this.clip.after(this.options.buttonNextHTML).next();
|
144
|
-
|
145
|
-
this.buttonNext.addClass(this.className('jcarousel-next'));
|
146
|
-
|
147
|
-
this.buttonPrev = $('.jcarousel-prev', this.container);
|
148
|
-
|
149
|
-
if (this.buttonPrev.size() == 0 && this.options.buttonPrevHTML != null)
|
150
|
-
this.buttonPrev = this.clip.before(this.options.buttonPrevHTML).prev();
|
151
|
-
|
152
|
-
this.buttonPrev.addClass(this.className('jcarousel-prev'));
|
153
|
-
|
154
|
-
this.clip.addClass(this.className('jcarousel-clip')).css({
|
155
|
-
overflow: 'hidden',
|
156
|
-
position: 'relative'
|
157
|
-
});
|
158
|
-
this.list.addClass(this.className('jcarousel-list')).css({
|
159
|
-
overflow: 'hidden',
|
160
|
-
position: 'relative',
|
161
|
-
top: 0,
|
162
|
-
left: 0,
|
163
|
-
margin: 0,
|
164
|
-
padding: 0
|
165
|
-
});
|
166
|
-
this.container.addClass(this.className('jcarousel-container')).css({
|
167
|
-
position: 'relative'
|
168
|
-
});
|
169
|
-
|
170
|
-
var di = this.options.visible != null ? Math.ceil(this.clipping() / this.options.visible) : null;
|
171
|
-
var li = this.list.children(this.options.itemTag);
|
172
|
-
|
173
|
-
var self = this;
|
174
|
-
|
175
|
-
if (li.size() > 0) {
|
176
|
-
var wh = 0, i = this.options.offset;
|
177
|
-
li.each(function() {
|
178
|
-
self.format(this, i++);
|
179
|
-
wh += self.dimension(this, di);
|
180
|
-
});
|
181
|
-
|
182
|
-
this.list.css(this.wh, wh + 'px');
|
183
|
-
|
184
|
-
// Only set if not explicitly passed as option
|
185
|
-
if (!o || o.size === undefined)
|
186
|
-
this.options.size = li.size();
|
187
|
-
}
|
188
|
-
|
189
|
-
// For whatever reason, .show() does not work in Safari...
|
190
|
-
this.container.css('display', 'block');
|
191
|
-
this.buttonNext.css('display', 'block');
|
192
|
-
this.buttonPrev.css('display', 'block');
|
193
|
-
|
194
|
-
this.funcNext = function() { self.next(); };
|
195
|
-
this.funcPrev = function() { self.prev(); };
|
196
|
-
this.funcResize = function() { self.reload(); };
|
197
|
-
|
198
|
-
if (this.options.initCallback != null)
|
199
|
-
this.options.initCallback(this, 'init');
|
200
|
-
|
201
|
-
if ($.browser.safari) {
|
202
|
-
this.buttons(false, false);
|
203
|
-
$(window).bind('load.jcarousel', function() { self.setup(); });
|
204
|
-
} else
|
205
|
-
this.setup();
|
206
|
-
};
|
207
|
-
|
208
|
-
// Create shortcut for internal use
|
209
|
-
var $jc = $.jcarousel;
|
210
|
-
|
211
|
-
$jc.fn = $jc.prototype = {
|
212
|
-
jcarousel: '0.2.4'
|
213
|
-
};
|
214
|
-
|
215
|
-
$jc.fn.extend = $jc.extend = $.extend;
|
216
|
-
|
217
|
-
$jc.fn.extend({
|
218
|
-
/**
|
219
|
-
* Setups the carousel.
|
220
|
-
*
|
221
|
-
* @method setup
|
222
|
-
* @return undefined
|
223
|
-
*/
|
224
|
-
setup: function() {
|
225
|
-
this.first = null;
|
226
|
-
this.last = null;
|
227
|
-
this.prevFirst = null;
|
228
|
-
this.prevLast = null;
|
229
|
-
this.animating = false;
|
230
|
-
this.timer = null;
|
231
|
-
this.tail = null;
|
232
|
-
this.inTail = false;
|
233
|
-
|
234
|
-
if (this.locked)
|
235
|
-
return;
|
236
|
-
|
237
|
-
this.list.css(this.lt, this.pos(this.options.offset) + 'px');
|
238
|
-
var p = this.pos(this.options.start);
|
239
|
-
this.prevFirst = this.prevLast = null;
|
240
|
-
this.animate(p, false);
|
241
|
-
|
242
|
-
$(window).unbind('resize.jcarousel', this.funcResize).bind('resize.jcarousel', this.funcResize);
|
243
|
-
},
|
244
|
-
|
245
|
-
/**
|
246
|
-
* Clears the list and resets the carousel.
|
247
|
-
*
|
248
|
-
* @method reset
|
249
|
-
* @return undefined
|
250
|
-
*/
|
251
|
-
reset: function() {
|
252
|
-
this.list.empty();
|
253
|
-
|
254
|
-
this.list.css(this.lt, '0px');
|
255
|
-
this.list.css(this.wh, '10px');
|
256
|
-
|
257
|
-
if (this.options.initCallback != null)
|
258
|
-
this.options.initCallback(this, 'reset');
|
259
|
-
|
260
|
-
this.setup();
|
261
|
-
},
|
262
|
-
|
263
|
-
/**
|
264
|
-
* Reloads the carousel and adjusts positions.
|
265
|
-
*
|
266
|
-
* @method reload
|
267
|
-
* @return undefined
|
268
|
-
*/
|
269
|
-
reload: function() {
|
270
|
-
if (this.tail != null && this.inTail)
|
271
|
-
this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + this.tail);
|
272
|
-
|
273
|
-
this.tail = null;
|
274
|
-
this.inTail = false;
|
275
|
-
|
276
|
-
if (this.options.reloadCallback != null)
|
277
|
-
this.options.reloadCallback(this);
|
278
|
-
|
279
|
-
if (this.options.visible != null) {
|
280
|
-
var self = this;
|
281
|
-
var di = Math.ceil(this.clipping() / this.options.visible), wh = 0, lt = 0;
|
282
|
-
$(this.options.itemTag, this.list).each(function(i) {
|
283
|
-
wh += self.dimension(this, di);
|
284
|
-
if (i + 1 < self.first)
|
285
|
-
lt = wh;
|
286
|
-
});
|
287
|
-
|
288
|
-
this.list.css(this.wh, wh + 'px');
|
289
|
-
this.list.css(this.lt, -lt + 'px');
|
290
|
-
}
|
291
|
-
|
292
|
-
this.scroll(this.first, false);
|
293
|
-
},
|
294
|
-
|
295
|
-
/**
|
296
|
-
* Locks the carousel.
|
297
|
-
*
|
298
|
-
* @method lock
|
299
|
-
* @return undefined
|
300
|
-
*/
|
301
|
-
lock: function() {
|
302
|
-
this.locked = true;
|
303
|
-
this.buttons();
|
304
|
-
},
|
305
|
-
|
306
|
-
/**
|
307
|
-
* Unlocks the carousel.
|
308
|
-
*
|
309
|
-
* @method unlock
|
310
|
-
* @return undefined
|
311
|
-
*/
|
312
|
-
unlock: function() {
|
313
|
-
this.locked = false;
|
314
|
-
this.buttons();
|
315
|
-
},
|
316
|
-
|
317
|
-
/**
|
318
|
-
* Sets the size of the carousel.
|
319
|
-
*
|
320
|
-
* @method size
|
321
|
-
* @return undefined
|
322
|
-
* @param s {Number} The size of the carousel.
|
323
|
-
*/
|
324
|
-
size: function(s) {
|
325
|
-
if (s != undefined) {
|
326
|
-
this.options.size = s;
|
327
|
-
if (!this.locked)
|
328
|
-
this.buttons();
|
329
|
-
}
|
330
|
-
|
331
|
-
return this.options.size;
|
332
|
-
},
|
333
|
-
|
334
|
-
/**
|
335
|
-
* Checks whether a list element exists for the given index (or index range).
|
336
|
-
*
|
337
|
-
* @method get
|
338
|
-
* @return bool
|
339
|
-
* @param i {Number} The index of the (first) element.
|
340
|
-
* @param i2 {Number} The index of the last element.
|
341
|
-
*/
|
342
|
-
has: function(i, i2) {
|
343
|
-
if (i2 == undefined || !i2)
|
344
|
-
i2 = i;
|
345
|
-
|
346
|
-
if (this.options.size !== null && i2 > this.options.size)
|
347
|
-
i2 = this.options.size;
|
348
|
-
|
349
|
-
for (var j = i; j <= i2; j++) {
|
350
|
-
var e = this.get(j);
|
351
|
-
if (!e.length || e.hasClass('jcarousel-item-placeholder'))
|
352
|
-
return false;
|
353
|
-
}
|
354
|
-
|
355
|
-
return true;
|
356
|
-
},
|
357
|
-
|
358
|
-
/**
|
359
|
-
* Returns a jQuery object with list element for the given index.
|
360
|
-
*
|
361
|
-
* @method get
|
362
|
-
* @return jQuery
|
363
|
-
* @param i {Number} The index of the element.
|
364
|
-
*/
|
365
|
-
get: function(i) {
|
366
|
-
return $('.jcarousel-item-' + i, this.list);
|
367
|
-
},
|
368
|
-
|
369
|
-
/**
|
370
|
-
* Adds an element for the given index to the list.
|
371
|
-
* If the element already exists, it updates the inner html.
|
372
|
-
* Returns the created element as jQuery object.
|
373
|
-
*
|
374
|
-
* @method add
|
375
|
-
* @return jQuery
|
376
|
-
* @param i {Number} The index of the element.
|
377
|
-
* @param s {String} The innerHTML of the element.
|
378
|
-
*/
|
379
|
-
add: function(i, s) {
|
380
|
-
var e = this.get(i), old = 0, add = 0;
|
381
|
-
|
382
|
-
if (e.length == 0) {
|
383
|
-
var c, e = this.create(i), j = $jc.intval(i);
|
384
|
-
while (c = this.get(--j)) {
|
385
|
-
if (j <= 0 || c.length) {
|
386
|
-
j <= 0 ? this.list.prepend(e) : c.after(e);
|
387
|
-
break;
|
388
|
-
}
|
389
|
-
}
|
390
|
-
} else
|
391
|
-
old = this.dimension(e);
|
392
|
-
|
393
|
-
e.removeClass(this.className('jcarousel-item-placeholder'));
|
394
|
-
typeof s == 'string' ? e.html(s) : e.empty().append(s);
|
395
|
-
|
396
|
-
var di = this.options.visible != null ? Math.ceil(this.clipping() / this.options.visible) : null;
|
397
|
-
var wh = this.dimension(e, di) - old;
|
398
|
-
|
399
|
-
if (i > 0 && i < this.first)
|
400
|
-
this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - wh + 'px');
|
401
|
-
|
402
|
-
this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) + wh + 'px');
|
403
|
-
|
404
|
-
return e;
|
405
|
-
},
|
406
|
-
|
407
|
-
/**
|
408
|
-
* Removes an element for the given index from the list.
|
409
|
-
*
|
410
|
-
* @method remove
|
411
|
-
* @return undefined
|
412
|
-
* @param i {Number} The index of the element.
|
413
|
-
*/
|
414
|
-
remove: function(i) {
|
415
|
-
var e = this.get(i);
|
416
|
-
|
417
|
-
// Check if item exists and is not currently visible
|
418
|
-
if (!e.length || (i >= this.first && i <= this.last))
|
419
|
-
return;
|
420
|
-
|
421
|
-
var d = this.dimension(e);
|
422
|
-
|
423
|
-
if (i < this.first)
|
424
|
-
this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + d + 'px');
|
425
|
-
|
426
|
-
e.remove();
|
427
|
-
|
428
|
-
this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) - d + 'px');
|
429
|
-
},
|
430
|
-
|
431
|
-
/**
|
432
|
-
* Moves the carousel forwards.
|
433
|
-
*
|
434
|
-
* @method next
|
435
|
-
* @return undefined
|
436
|
-
*/
|
437
|
-
next: function() {
|
438
|
-
this.stopAuto();
|
439
|
-
|
440
|
-
if (this.tail != null && !this.inTail)
|
441
|
-
this.scrollTail(false);
|
442
|
-
else
|
443
|
-
this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'last') && this.options.size != null && this.last == this.options.size) ? 1 : this.first + this.options.scroll);
|
444
|
-
},
|
445
|
-
|
446
|
-
/**
|
447
|
-
* Moves the carousel backwards.
|
448
|
-
*
|
449
|
-
* @method prev
|
450
|
-
* @return undefined
|
451
|
-
*/
|
452
|
-
prev: function() {
|
453
|
-
this.stopAuto();
|
454
|
-
|
455
|
-
if (this.tail != null && this.inTail)
|
456
|
-
this.scrollTail(true);
|
457
|
-
else
|
458
|
-
this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'first') && this.options.size != null && this.first == 1) ? this.options.size : this.first - this.options.scroll);
|
459
|
-
},
|
460
|
-
|
461
|
-
/**
|
462
|
-
* Scrolls the tail of the carousel.
|
463
|
-
*
|
464
|
-
* @method scrollTail
|
465
|
-
* @return undefined
|
466
|
-
* @param b {Boolean} Whether scroll the tail back or forward.
|
467
|
-
*/
|
468
|
-
scrollTail: function(b) {
|
469
|
-
if (this.locked || this.animating || !this.tail)
|
470
|
-
return;
|
471
|
-
|
472
|
-
var pos = $jc.intval(this.list.css(this.lt));
|
473
|
-
|
474
|
-
!b ? pos -= this.tail : pos += this.tail;
|
475
|
-
this.inTail = !b;
|
476
|
-
|
477
|
-
// Save for callbacks
|
478
|
-
this.prevFirst = this.first;
|
479
|
-
this.prevLast = this.last;
|
480
|
-
|
481
|
-
this.animate(pos);
|
482
|
-
},
|
483
|
-
|
484
|
-
/**
|
485
|
-
* Scrolls the carousel to a certain position.
|
486
|
-
*
|
487
|
-
* @method scroll
|
488
|
-
* @return undefined
|
489
|
-
* @param i {Number} The index of the element to scoll to.
|
490
|
-
* @param a {Boolean} Flag indicating whether to perform animation.
|
491
|
-
*/
|
492
|
-
scroll: function(i, a) {
|
493
|
-
if (this.locked || this.animating)
|
494
|
-
return;
|
495
|
-
|
496
|
-
this.animate(this.pos(i), a);
|
497
|
-
},
|
498
|
-
|
499
|
-
/**
|
500
|
-
* Prepares the carousel and return the position for a certian index.
|
501
|
-
*
|
502
|
-
* @method pos
|
503
|
-
* @return {Number}
|
504
|
-
* @param i {Number} The index of the element to scoll to.
|
505
|
-
*/
|
506
|
-
pos: function(i) {
|
507
|
-
var pos = $jc.intval(this.list.css(this.lt));
|
508
|
-
|
509
|
-
if (this.locked || this.animating)
|
510
|
-
return pos;
|
511
|
-
|
512
|
-
if (this.options.wrap != 'circular')
|
513
|
-
i = i < 1 ? 1 : (this.options.size && i > this.options.size ? this.options.size : i);
|
514
|
-
|
515
|
-
var back = this.first > i;
|
516
|
-
|
517
|
-
// Create placeholders, new list width/height
|
518
|
-
// and new list position
|
519
|
-
var f = this.options.wrap != 'circular' && this.first <= 1 ? 1 : this.first;
|
520
|
-
var c = back ? this.get(f) : this.get(this.last);
|
521
|
-
var j = back ? f : f - 1;
|
522
|
-
var e = null, l = 0, p = false, d = 0, g;
|
523
|
-
|
524
|
-
while (back ? --j >= i : ++j < i) {
|
525
|
-
e = this.get(j);
|
526
|
-
p = !e.length;
|
527
|
-
if (e.length == 0) {
|
528
|
-
e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
|
529
|
-
c[back ? 'before' : 'after' ](e);
|
530
|
-
|
531
|
-
if (this.first != null && this.options.wrap == 'circular' && this.options.size !== null && (j <= 0 || j > this.options.size)) {
|
532
|
-
g = this.get(this.index(j));
|
533
|
-
if (g.length)
|
534
|
-
this.add(j, g.children().clone(true));
|
535
|
-
}
|
536
|
-
}
|
537
|
-
|
538
|
-
c = e;
|
539
|
-
d = this.dimension(e);
|
540
|
-
|
541
|
-
if (p)
|
542
|
-
l += d;
|
543
|
-
|
544
|
-
if (this.first != null && (this.options.wrap == 'circular' || (j >= 1 && (this.options.size == null || j <= this.options.size))))
|
545
|
-
pos = back ? pos + d : pos - d;
|
546
|
-
}
|
547
|
-
|
548
|
-
// Calculate visible items
|
549
|
-
var clipping = this.clipping();
|
550
|
-
var cache = [];
|
551
|
-
var visible = 0, j = i, v = 0;
|
552
|
-
var c = this.get(i - 1);
|
553
|
-
|
554
|
-
while (++visible) {
|
555
|
-
e = this.get(j);
|
556
|
-
p = !e.length;
|
557
|
-
if (e.length == 0) {
|
558
|
-
e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
|
559
|
-
// This should only happen on a next scroll
|
560
|
-
c.length == 0 ? this.list.prepend(e) : c[back ? 'before' : 'after' ](e);
|
561
|
-
|
562
|
-
if (this.first != null && this.options.wrap == 'circular' && this.options.size !== null && (j <= 0 || j > this.options.size)) {
|
563
|
-
g = this.get(this.index(j));
|
564
|
-
if (g.length)
|
565
|
-
this.add(j, g.find('>*').clone(true));
|
566
|
-
}
|
567
|
-
}
|
568
|
-
|
569
|
-
c = e;
|
570
|
-
var d = this.dimension(e);
|
571
|
-
if (d == 0) {
|
572
|
-
if (console && $.isFunction(console.log)) {
|
573
|
-
console.log('jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...');
|
574
|
-
}
|
575
|
-
return 0;
|
576
|
-
}
|
577
|
-
|
578
|
-
if (this.options.wrap != 'circular' && this.options.size !== null && j > this.options.size)
|
579
|
-
cache.push(e);
|
580
|
-
else if (p)
|
581
|
-
l += d;
|
582
|
-
|
583
|
-
v += d;
|
584
|
-
|
585
|
-
if (v >= clipping)
|
586
|
-
break;
|
587
|
-
|
588
|
-
j++;
|
589
|
-
}
|
590
|
-
|
591
|
-
// Remove out-of-range placeholders
|
592
|
-
for (var x = 0; x < cache.length; x++)
|
593
|
-
cache[x].remove();
|
594
|
-
|
595
|
-
// Resize list
|
596
|
-
if (l > 0) {
|
597
|
-
this.list.css(this.wh, this.dimension(this.list) + l + 'px');
|
598
|
-
|
599
|
-
if (back) {
|
600
|
-
pos -= l;
|
601
|
-
this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - l + 'px');
|
602
|
-
}
|
603
|
-
}
|
604
|
-
|
605
|
-
// Calculate first and last item
|
606
|
-
var last = i + visible - 1;
|
607
|
-
if (this.options.wrap != 'circular' && this.options.size && last > this.options.size)
|
608
|
-
last = this.options.size;
|
609
|
-
|
610
|
-
if (j > last) {
|
611
|
-
visible = 0, j = last, v = 0;
|
612
|
-
while (++visible) {
|
613
|
-
var e = this.get(j--);
|
614
|
-
if (!e.length)
|
615
|
-
break;
|
616
|
-
v += this.dimension(e);
|
617
|
-
if (v >= clipping)
|
618
|
-
break;
|
619
|
-
}
|
620
|
-
}
|
621
|
-
|
622
|
-
var first = last - visible + 1;
|
623
|
-
if (this.options.wrap != 'circular' && first < 1)
|
624
|
-
first = 1;
|
625
|
-
|
626
|
-
if (this.inTail && back) {
|
627
|
-
pos += this.tail;
|
628
|
-
this.inTail = false;
|
629
|
-
}
|
630
|
-
|
631
|
-
this.tail = null;
|
632
|
-
if (this.options.wrap != 'circular' && last == this.options.size && (last - visible + 1) >= 1) {
|
633
|
-
var m = $jc.margin(this.get(last), !this.options.vertical ? 'marginRight' : 'marginBottom');
|
634
|
-
if ((v - m) > clipping)
|
635
|
-
this.tail = v - clipping - m;
|
636
|
-
}
|
637
|
-
|
638
|
-
// Adjust position
|
639
|
-
while (i-- > first)
|
640
|
-
pos += this.dimension(this.get(i));
|
641
|
-
|
642
|
-
// Save visible item range
|
643
|
-
this.prevFirst = this.first;
|
644
|
-
this.prevLast = this.last;
|
645
|
-
this.first = first;
|
646
|
-
this.last = last;
|
647
|
-
|
648
|
-
return pos;
|
649
|
-
},
|
650
|
-
|
651
|
-
/**
|
652
|
-
* Animates the carousel to a certain position.
|
653
|
-
*
|
654
|
-
* @method animate
|
655
|
-
* @return undefined
|
656
|
-
* @param p {Number} Position to scroll to.
|
657
|
-
* @param a {Boolean} Flag indicating whether to perform animation.
|
658
|
-
*/
|
659
|
-
animate: function(p, a) {
|
660
|
-
if (this.locked || this.animating)
|
661
|
-
return;
|
662
|
-
|
663
|
-
this.animating = true;
|
664
|
-
|
665
|
-
var self = this;
|
666
|
-
var scrolled = function() {
|
667
|
-
self.animating = false;
|
668
|
-
|
669
|
-
if (p == 0)
|
670
|
-
self.list.css(self.lt, 0);
|
671
|
-
|
672
|
-
if (self.options.wrap == 'circular' || self.options.wrap == 'both' || self.options.wrap == 'last' || self.options.size == null || self.last < self.options.size)
|
673
|
-
self.startAuto();
|
674
|
-
|
675
|
-
self.buttons();
|
676
|
-
self.notify('onAfterAnimation');
|
677
|
-
};
|
678
|
-
|
679
|
-
this.notify('onBeforeAnimation');
|
680
|
-
|
681
|
-
// Animate
|
682
|
-
if (!this.options.animation || a == false) {
|
683
|
-
this.list.css(this.lt, p + 'px');
|
684
|
-
scrolled();
|
685
|
-
} else {
|
686
|
-
var o = !this.options.vertical ? {'left': p} : {'top': p};
|
687
|
-
this.list.animate(o, this.options.animation, this.options.easing, scrolled);
|
688
|
-
}
|
689
|
-
},
|
690
|
-
|
691
|
-
/**
|
692
|
-
* Starts autoscrolling.
|
693
|
-
*
|
694
|
-
* @method auto
|
695
|
-
* @return undefined
|
696
|
-
* @param s {Number} Seconds to periodically autoscroll the content.
|
697
|
-
*/
|
698
|
-
startAuto: function(s) {
|
699
|
-
if (s != undefined)
|
700
|
-
this.options.auto = s;
|
701
|
-
|
702
|
-
if (this.options.auto == 0)
|
703
|
-
return this.stopAuto();
|
704
|
-
|
705
|
-
if (this.timer != null)
|
706
|
-
return;
|
707
|
-
|
708
|
-
var self = this;
|
709
|
-
this.timer = setTimeout(function() { self.next(); }, this.options.auto * 1000);
|
710
|
-
},
|
711
|
-
|
712
|
-
/**
|
713
|
-
* Stops autoscrolling.
|
714
|
-
*
|
715
|
-
* @method stopAuto
|
716
|
-
* @return undefined
|
717
|
-
*/
|
718
|
-
stopAuto: function() {
|
719
|
-
if (this.timer == null)
|
720
|
-
return;
|
721
|
-
|
722
|
-
clearTimeout(this.timer);
|
723
|
-
this.timer = null;
|
724
|
-
},
|
725
|
-
|
726
|
-
/**
|
727
|
-
* Sets the states of the prev/next buttons.
|
728
|
-
*
|
729
|
-
* @method buttons
|
730
|
-
* @return undefined
|
731
|
-
*/
|
732
|
-
buttons: function(n, p) {
|
733
|
-
if (n == undefined || n == null) {
|
734
|
-
var n = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'first') || this.options.size == null || this.last < this.options.size);
|
735
|
-
if (!this.locked && (!this.options.wrap || this.options.wrap == 'first') && this.options.size != null && this.last >= this.options.size)
|
736
|
-
n = this.tail != null && !this.inTail;
|
737
|
-
}
|
738
|
-
|
739
|
-
if (p == undefined || p == null) {
|
740
|
-
var p = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'last') || this.first > 1);
|
741
|
-
if (!this.locked && (!this.options.wrap || this.options.wrap == 'last') && this.options.size != null && this.first == 1)
|
742
|
-
p = this.tail != null && this.inTail;
|
743
|
-
}
|
744
|
-
|
745
|
-
var self = this;
|
746
|
-
|
747
|
-
this.buttonNext[n ? 'bind' : 'unbind'](this.options.buttonNextEvent + '.jcarousel', this.funcNext)[n ? 'removeClass' : 'addClass'](this.className('jcarousel-next-disabled')).attr('disabled', n ? false : true);
|
748
|
-
this.buttonPrev[p ? 'bind' : 'unbind'](this.options.buttonPrevEvent + '.jcarousel', this.funcPrev)[p ? 'removeClass' : 'addClass'](this.className('jcarousel-prev-disabled')).attr('disabled', p ? false : true);
|
749
|
-
|
750
|
-
if (this.buttonNext.length > 0 && (this.buttonNext[0].jcarouselstate == undefined || this.buttonNext[0].jcarouselstate != n) && this.options.buttonNextCallback != null) {
|
751
|
-
this.buttonNext.each(function() { self.options.buttonNextCallback(self, this, n); });
|
752
|
-
this.buttonNext[0].jcarouselstate = n;
|
753
|
-
}
|
754
|
-
|
755
|
-
if (this.buttonPrev.length > 0 && (this.buttonPrev[0].jcarouselstate == undefined || this.buttonPrev[0].jcarouselstate != p) && this.options.buttonPrevCallback != null) {
|
756
|
-
this.buttonPrev.each(function() { self.options.buttonPrevCallback(self, this, p); });
|
757
|
-
this.buttonPrev[0].jcarouselstate = p;
|
758
|
-
}
|
759
|
-
},
|
760
|
-
|
761
|
-
/**
|
762
|
-
* Notify callback of a specified event.
|
763
|
-
*
|
764
|
-
* @method notify
|
765
|
-
* @return undefined
|
766
|
-
* @param evt {String} The event name
|
767
|
-
*/
|
768
|
-
notify: function(evt) {
|
769
|
-
var state = this.prevFirst == null ? 'init' : (this.prevFirst < this.first ? 'next' : 'prev');
|
770
|
-
|
771
|
-
// Load items
|
772
|
-
this.callback('itemLoadCallback', evt, state);
|
773
|
-
|
774
|
-
if (this.prevFirst !== this.first) {
|
775
|
-
this.callback('itemFirstInCallback', evt, state, this.first);
|
776
|
-
this.callback('itemFirstOutCallback', evt, state, this.prevFirst);
|
777
|
-
}
|
778
|
-
|
779
|
-
if (this.prevLast !== this.last) {
|
780
|
-
this.callback('itemLastInCallback', evt, state, this.last);
|
781
|
-
this.callback('itemLastOutCallback', evt, state, this.prevLast);
|
782
|
-
}
|
783
|
-
|
784
|
-
this.callback('itemVisibleInCallback', evt, state, this.first, this.last, this.prevFirst, this.prevLast);
|
785
|
-
this.callback('itemVisibleOutCallback', evt, state, this.prevFirst, this.prevLast, this.first, this.last);
|
786
|
-
},
|
787
|
-
|
788
|
-
callback: function(cb, evt, state, i1, i2, i3, i4) {
|
789
|
-
if (this.options[cb] == undefined || (typeof this.options[cb] != 'object' && evt != 'onAfterAnimation'))
|
790
|
-
return;
|
791
|
-
|
792
|
-
var callback = typeof this.options[cb] == 'object' ? this.options[cb][evt] : this.options[cb];
|
793
|
-
|
794
|
-
if (!$.isFunction(callback))
|
795
|
-
return;
|
796
|
-
|
797
|
-
var self = this;
|
798
|
-
|
799
|
-
if (i1 === undefined)
|
800
|
-
callback(self, state, evt);
|
801
|
-
else if (i2 === undefined)
|
802
|
-
this.get(i1).each(function() { callback(self, this, i1, state, evt); });
|
803
|
-
else {
|
804
|
-
for (var i = i1; i <= i2; i++)
|
805
|
-
if (i !== null && !(i >= i3 && i <= i4))
|
806
|
-
this.get(i).each(function() { callback(self, this, i, state, evt); });
|
807
|
-
}
|
808
|
-
},
|
809
|
-
|
810
|
-
create: function(i) {
|
811
|
-
return this.format('<' + this.options.itemTag + '></' + this.options.itemTag + '>', i);
|
812
|
-
},
|
813
|
-
|
814
|
-
format: function(e, i) {
|
815
|
-
var $e = $(e).addClass(this.className('jcarousel-item')).addClass(this.className('jcarousel-item-' + i)).css({
|
816
|
-
'float': 'left',
|
817
|
-
'list-style': 'none'
|
818
|
-
});
|
819
|
-
$e.attr('jcarouselindex', i);
|
820
|
-
return $e;
|
821
|
-
},
|
822
|
-
|
823
|
-
className: function(c) {
|
824
|
-
return c + ' ' + c + (!this.options.vertical ? '-horizontal' : '-vertical');
|
825
|
-
},
|
826
|
-
|
827
|
-
dimension: function(e, d) {
|
828
|
-
var el = e.jquery != undefined ? e[0] : e;
|
829
|
-
|
830
|
-
var old = !this.options.vertical ?
|
831
|
-
el.offsetWidth + $jc.margin(el, 'marginLeft') + $jc.margin(el, 'marginRight') :
|
832
|
-
el.offsetHeight + $jc.margin(el, 'marginTop') + $jc.margin(el, 'marginBottom');
|
833
|
-
|
834
|
-
if (d == undefined || old == d)
|
835
|
-
return old;
|
836
|
-
|
837
|
-
var w = !this.options.vertical ?
|
838
|
-
d - $jc.margin(el, 'marginLeft') - $jc.margin(el, 'marginRight') :
|
839
|
-
d - $jc.margin(el, 'marginTop') - $jc.margin(el, 'marginBottom');
|
840
|
-
|
841
|
-
$(el).css(this.wh, w + 'px');
|
842
|
-
|
843
|
-
return this.dimension(el);
|
844
|
-
},
|
845
|
-
|
846
|
-
clipping: function() {
|
847
|
-
if (this.clip[0] != null) {
|
848
|
-
return !this.options.vertical ?
|
849
|
-
this.clip[0].offsetWidth - $jc.intval(this.clip.css('borderLeftWidth')) - $jc.intval(this.clip.css('borderRightWidth')) :
|
850
|
-
this.clip[0].offsetHeight - $jc.intval(this.clip.css('borderTopWidth')) - $jc.intval(this.clip.css('borderBottomWidth'));
|
851
|
-
}
|
852
|
-
},
|
853
|
-
|
854
|
-
index: function(i, s) {
|
855
|
-
if (s == undefined)
|
856
|
-
s = this.options.size;
|
857
|
-
|
858
|
-
return Math.round((((i-1) / s) - Math.floor((i-1) / s)) * s) + 1;
|
859
|
-
}
|
860
|
-
});
|
861
|
-
|
862
|
-
$jc.extend({
|
863
|
-
/**
|
864
|
-
* Gets/Sets the global default configuration properties.
|
865
|
-
*
|
866
|
-
* @method defaults
|
867
|
-
* @return {Object}
|
868
|
-
* @param d {Object} A set of key/value pairs to set as configuration properties.
|
869
|
-
*/
|
870
|
-
defaults: function(d) {
|
871
|
-
return $.extend(defaults, d || {});
|
872
|
-
},
|
873
|
-
|
874
|
-
margin: function(e, p) {
|
875
|
-
if (!e)
|
876
|
-
return 0;
|
877
|
-
|
878
|
-
var el = e.jquery != undefined ? e[0] : e;
|
879
|
-
|
880
|
-
if (p == 'marginRight' && $.browser.safari) {
|
881
|
-
var old = {'display': 'block', 'float': 'none', 'width': 'auto'}, oWidth, oWidth2;
|
882
|
-
|
883
|
-
$.swap(el, old, function() { oWidth = el.offsetWidth; });
|
884
|
-
|
885
|
-
old['marginRight'] = 0;
|
886
|
-
$.swap(el, old, function() { oWidth2 = el.offsetWidth; });
|
887
|
-
|
888
|
-
return oWidth2 - oWidth;
|
889
|
-
}
|
890
|
-
|
891
|
-
return $jc.intval($.css(el, p));
|
892
|
-
},
|
893
|
-
|
894
|
-
intval: function(v) {
|
895
|
-
v = parseInt(v);
|
896
|
-
return isNaN(v) ? 0 : v;
|
897
|
-
}
|
898
|
-
});
|
899
|
-
|
900
|
-
})(jQuery);
|