social_stream-base 0.6.8 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -0
- data/app/assets/images/btn/activity.png +0 -0
- data/app/assets/images/btn/post.png +0 -0
- data/app/assets/images/icons/favicon.ico +0 -0
- data/app/{views/activities/_jquery.html.erb → assets/javascripts/activities.js.erb} +24 -15
- data/app/assets/javascripts/ckeditor.rails.js.erb +4 -0
- data/app/assets/javascripts/contacts.js +10 -0
- data/app/assets/javascripts/conversations.js +3 -0
- data/app/assets/javascripts/groups.js +5 -0
- data/app/assets/javascripts/invitations.js +1 -0
- data/app/assets/javascripts/{main.js → layouts.js} +4 -11
- data/app/assets/javascripts/messages.js +3 -0
- data/app/assets/javascripts/profiles.js +6 -0
- data/app/{views/relation/customs/_jquery.erb → assets/javascripts/relation_customs.js} +12 -2
- data/app/assets/javascripts/settings.js +1 -1
- data/app/assets/javascripts/social_stream-base.js +6 -0
- data/app/assets/javascripts/toolbar.js +1 -0
- data/app/assets/javascripts/users.js +2 -0
- data/app/assets/stylesheets/base.css +18 -2
- data/app/controllers/contacts_controller.rb +18 -10
- data/app/helpers/notifications_helper.rb +13 -5
- data/app/models/activity.rb +14 -15
- data/app/models/actor.rb +7 -1
- data/app/models/relation.rb +1 -1
- data/app/models/tie.rb +1 -1
- data/app/views/activities/_index.html.erb +3 -9
- data/app/views/activities/_new.html.erb +8 -0
- data/app/views/contacts/_form.html.erb +0 -15
- data/app/views/contacts/_index.html.erb +7 -4
- data/app/views/contacts/index.html.erb +0 -4
- data/app/views/conversations/show.html.erb +0 -1
- data/app/views/conversations/show.js.erb +1 -3
- data/app/views/groups/_new.html.erb +0 -1
- data/app/views/groups/_sidebar_index.html.erb +0 -2
- data/app/views/groups/index.html.erb +0 -1
- data/app/views/groups/new.html.erb +0 -1
- data/app/views/invitation_mailer/send_invitation.html.erb +73 -65
- data/app/views/invitations/new.html.erb +1 -2
- data/app/views/layouts/_header.erb +1 -4
- data/app/views/layouts/application.html.erb +1 -1
- data/app/views/layouts/frontpage.html.erb +0 -2
- data/app/views/message_mailer/new_message_email.html.erb +20 -0
- data/app/views/message_mailer/new_message_email.text.erb +10 -0
- data/app/views/message_mailer/reply_message_email.html.erb +20 -0
- data/app/views/message_mailer/reply_message_email.text.erb +10 -0
- data/app/views/messages/new.html.erb +0 -1
- data/app/views/messages/new.js.erb +0 -2
- data/app/views/notification_mailer/new_notification_email.html.erb +2 -5
- data/app/views/notification_mailer/new_notification_email.text.erb +2 -4
- data/app/views/notifications/activities/_like_subject.html.erb +2 -2
- data/app/views/profiles/edit.html.erb +0 -8
- data/app/views/relation/customs/index.html.erb +0 -5
- data/app/views/settings/index.html.erb +1 -2
- data/app/views/settings/index.js.erb +0 -1
- data/app/views/toolbar/_home.html.erb +0 -1
- data/app/views/toolbar/_profile.html.erb +0 -1
- data/app/views/users/index.html.erb +0 -4
- data/config/locales/en.yml +12 -3
- data/lib/generators/social_stream/base/install_generator.rb +6 -0
- data/lib/social_stream-base.rb +2 -0
- data/lib/social_stream/base/version.rb +1 -1
- data/social_stream-base.gemspec +2 -0
- data/spec/controllers/posts_controller_spec.rb +19 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/models/activity_authorization_spec.rb +10 -0
- data/spec/models/tie_spec.rb +10 -0
- data/{app → vendor}/assets/javascripts/ajax.paginate.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/.htaccess +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/adapters/jquery.js +0 -0
- data/vendor/assets/javascripts/ckeditor/ckeditor.js +147 -0
- data/vendor/assets/javascripts/ckeditor/ckeditor_basic.js +8 -0
- data/{app → vendor}/assets/javascripts/ckeditor/ckeditor_basic_source.js +1 -1
- data/{app → vendor}/assets/javascripts/ckeditor/ckeditor_source.js +1 -1
- data/{app → vendor}/assets/javascripts/ckeditor/config.js +0 -0
- data/vendor/assets/javascripts/ckeditor/contents.css +25 -0
- data/{app → vendor}/assets/javascripts/ckeditor/images/spacer.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/lang/_languages.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/_translationstatus.txt +61 -0
- data/vendor/assets/javascripts/ckeditor/lang/af.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/ar.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/bg.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/bn.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/bs.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/ca.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/cs.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/cy.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/da.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/de.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/el.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/en-au.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/en-ca.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/en-gb.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/en.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/eo.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/es.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/et.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/eu.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/fa.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/fi.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/fo.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/fr-ca.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/fr.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/gl.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/gu.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/he.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/hi.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/hr.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/hu.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/is.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/it.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/ja.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/ka.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/km.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/ko.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/lt.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/lv.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/mn.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/ms.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/nb.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/nl.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/no.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/pl.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/pt-br.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/pt.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/ro.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/ru.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/sk.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/sl.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/sr-latn.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/sr.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/sv.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/th.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/tr.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/uk.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/vi.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/zh-cn.js +6 -0
- data/vendor/assets/javascripts/ckeditor/lang/zh.js +6 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/lang/en.js +6 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/lang/he.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/about/dialogs/about.js +1 -1
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/about/dialogs/logo_ckeditor.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/adobeair/plugin.js +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/ajax/plugin.js +6 -0
- data/vendor/assets/javascripts/ckeditor/plugins/autogrow/plugin.js +6 -0
- data/vendor/assets/javascripts/ckeditor/plugins/bbcode/plugin.js +9 -0
- data/vendor/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +7 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/devtools/lang/en.js +6 -0
- data/vendor/assets/javascripts/ckeditor/plugins/devtools/plugin.js +6 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/dialog/dialogDefinition.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/div/dialogs/div.js +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/docprops/dialogs/docprops.js +10 -0
- data/vendor/assets/javascripts/ckeditor/plugins/docprops/plugin.js +6 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/find/dialogs/find.js +3 -2
- data/vendor/assets/javascripts/ckeditor/plugins/flash/dialogs/flash.js +9 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/flash/images/placeholder.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/forms/dialogs/button.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/forms/dialogs/checkbox.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/forms/dialogs/form.js +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/hiddenfield.js +6 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/forms/dialogs/radio.js +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/select.js +9 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/forms/dialogs/textarea.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/forms/dialogs/textfield.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/forms/images/hiddenfield.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/iframe/dialogs/iframe.js +7 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/iframe/images/placeholder.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/iframedialog/plugin.js +6 -0
- data/vendor/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +13 -0
- data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +6 -0
- data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +12 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/link/images/anchor.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js +7 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/pagebreak/images/pagebreak.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +11 -0
- data/vendor/assets/javascripts/ckeditor/plugins/pastetext/dialogs/pastetext.js +6 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/placeholder/dialogs/placeholder.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/placeholder/lang/en.js +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/placeholder/lang/he.js +6 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/placeholder/placeholder.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/placeholder/plugin.js +6 -0
- data/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +8 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/scayt/dialogs/toolbar.css +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_address.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_blockquote.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_div.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_h1.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_h2.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_h3.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_h4.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_h5.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_h6.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_p.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_pre.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/dialogs/smiley.js +1 -1
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/angel_smile.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/angry_smile.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/broken_heart.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/confused_smile.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/cry_smile.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/devil_smile.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/embaressed_smile.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/envelope.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/heart.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/kiss.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/lightbulb.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/omg_smile.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/regular_smile.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/sad_smile.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/shades_smile.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/teeth_smile.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_down.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_up.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/tounge_smile.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/smiley/images/wink_smile.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/specialchar.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/lang/en.js +6 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/styles/styles/default.js +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/plugin.js +6 -0
- data/vendor/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +9 -0
- data/vendor/assets/javascripts/ckeditor/plugins/tableresize/plugin.js +7 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/tabletools/dialogs/tableCell.js +1 -1
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.js +1 -1
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/templates/templates/default.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/templates/templates/images/template1.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/templates/templates/images/template2.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/templates/templates/images/template3.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/uicolor/dialogs/uicolor.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/uicolor/lang/en.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/uicolor/lang/he.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/uicolor/plugin.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/uicolor/uicolor.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/uicolor/yui/assets/hue_bg.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/uicolor/yui/assets/hue_thumb.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/uicolor/yui/assets/picker_mask.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/uicolor/yui/assets/picker_thumb.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/uicolor/yui/assets/yui.css +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/uicolor/yui/yui.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/wsc/dialogs/ciframe.html +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/wsc/dialogs/tmpFrameset.html +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.css +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.js +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/xml/plugin.js +6 -0
- data/vendor/assets/javascripts/ckeditor/skins/kama/dialog.css +10 -0
- data/vendor/assets/javascripts/ckeditor/skins/kama/editor.css +13 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/kama/icons.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/kama/icons_rtl.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/kama/images/dialog_sides.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/kama/images/dialog_sides.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/kama/images/dialog_sides_rtl.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/kama/images/mini.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/kama/images/noimage.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/kama/images/sprites.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/kama/images/sprites_ie6.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/kama/images/toolbar_start.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/kama/skin.js +7 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/kama/templates.css +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/office2003/dialog.css +9 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/office2003/editor.css +5 -5
- data/{app → vendor}/assets/javascripts/ckeditor/skins/office2003/icons.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/office2003/icons_rtl.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/office2003/images/dialog_sides.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/office2003/images/dialog_sides.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/office2003/images/dialog_sides_rtl.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/office2003/images/mini.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/office2003/images/noimage.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/office2003/images/sprites.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/office2003/images/sprites_ie6.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/office2003/skin.js +6 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/office2003/templates.css +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/v2/dialog.css +3 -3
- data/{app → vendor}/assets/javascripts/ckeditor/skins/v2/editor.css +4 -4
- data/{app → vendor}/assets/javascripts/ckeditor/skins/v2/icons.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/v2/icons_rtl.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/v2/images/dialog_sides.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/v2/images/dialog_sides.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/v2/images/dialog_sides_rtl.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/v2/images/mini.gif +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/v2/images/noimage.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/v2/images/sprites.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/v2/images/sprites_ie6.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/v2/images/toolbar_start.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/v2/skin.js +6 -0
- data/{app → vendor}/assets/javascripts/ckeditor/skins/v2/templates.css +0 -0
- data/vendor/assets/javascripts/ckeditor/themes/default/theme.js +8 -0
- data/{app → vendor}/assets/javascripts/hoverIntent.js +0 -0
- data/vendor/assets/javascripts/jqcloud-0.1.3.js +87 -0
- data/{app → vendor}/assets/javascripts/jquery.ba-url.js +0 -0
- data/{app → vendor}/assets/javascripts/jquery.fcbkcomplete.js +0 -0
- data/{app → vendor}/assets/javascripts/jquery.livequery.js +0 -0
- data/{app → vendor}/assets/javascripts/jquery.scrollTo.min.js +0 -0
- data/{app → vendor}/assets/javascripts/jquery.validate.js +0 -0
- data/{app → vendor}/assets/javascripts/menu.js +0 -0
- data/{app → vendor}/assets/javascripts/superfish.js +0 -0
- data/{app → vendor}/assets/javascripts/ui.checkbox.js +0 -0
- metadata +288 -257
- data/app/assets/javascripts/ckeditor/ckeditor.js +0 -141
- data/app/assets/javascripts/ckeditor/ckeditor_basic.js +0 -8
- data/app/assets/javascripts/ckeditor/contents.css +0 -45
- data/app/assets/javascripts/ckeditor/lang/_translationstatus.txt +0 -60
- data/app/assets/javascripts/ckeditor/lang/af.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/ar.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/bg.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/bn.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/bs.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/ca.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/cs.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/cy.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/da.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/de.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/el.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/en-au.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/en-ca.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/en-gb.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/en.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/eo.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/es.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/et.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/eu.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/fa.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/fi.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/fo.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/fr-ca.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/fr.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/gl.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/gu.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/he.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/hi.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/hr.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/hu.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/is.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/it.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/ja.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/km.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/ko.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/lt.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/lv.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/mn.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/ms.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/nb.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/nl.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/no.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/pl.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/pt-br.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/pt.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/ro.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/ru.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/sk.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/sl.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/sr-latn.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/sr.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/sv.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/th.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/tr.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/uk.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/vi.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/zh-cn.js +0 -6
- data/app/assets/javascripts/ckeditor/lang/zh.js +0 -6
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/lang/en.js +0 -6
- data/app/assets/javascripts/ckeditor/plugins/autogrow/plugin.js +0 -6
- data/app/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +0 -7
- data/app/assets/javascripts/ckeditor/plugins/flash/dialogs/flash.js +0 -9
- data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/hiddenfield.js +0 -6
- data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/select.js +0 -9
- data/app/assets/javascripts/ckeditor/plugins/iframe/dialogs/iframe.js +0 -7
- data/app/assets/javascripts/ckeditor/plugins/iframedialog/plugin.js +0 -6
- data/app/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +0 -13
- data/app/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +0 -6
- data/app/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +0 -11
- data/app/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js +0 -6
- data/app/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +0 -10
- data/app/assets/javascripts/ckeditor/plugins/pastetext/dialogs/pastetext.js +0 -6
- data/app/assets/javascripts/ckeditor/plugins/placeholder/plugin.js +0 -6
- data/app/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +0 -8
- data/app/assets/javascripts/ckeditor/plugins/specialchar/lang/en.js +0 -6
- data/app/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +0 -9
- data/app/assets/javascripts/ckeditor/plugins/tableresize/plugin.js +0 -7
- data/app/assets/javascripts/ckeditor/skins/kama/dialog.css +0 -9
- data/app/assets/javascripts/ckeditor/skins/kama/editor.css +0 -13
- data/app/assets/javascripts/ckeditor/skins/kama/skin.js +0 -7
- data/app/assets/javascripts/ckeditor/skins/office2003/dialog.css +0 -9
- data/app/assets/javascripts/ckeditor/skins/office2003/skin.js +0 -6
- data/app/assets/javascripts/ckeditor/skins/v2/skin.js +0 -6
- data/app/assets/javascripts/ckeditor/themes/default/theme.js +0 -8
- data/app/assets/javascripts/jqcloud-0.1.3.min.js +0 -11
- data/app/assets/javascripts/jquery.boxy.js +0 -570
- data/app/assets/javascripts/jquery.fcbkcomplete.min.js +0 -2
- data/app/assets/javascripts/menu-collapsed.js +0 -42
- data/app/assets/javascripts/modernizr.min.js +0 -4
- data/app/assets/javascripts/rails.js +0 -158
- data/app/assets/javascripts/ui.dropdownchecklist.js +0 -922
- data/app/views/contacts/_edit.html.erb +0 -76
- data/app/views/home/_menu.html.erb +0 -46
- data/app/views/posts/_header.html.erb +0 -1
- data/app/views/subjects/_tabs.html.erb +0 -38
@@ -1,2 +0,0 @@
|
|
1
|
-
/** FCBKcomplete v2.8.6 is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> */
|
2
|
-
(function($,undefined){$.fn.fcbkcomplete=function(opt){return this.queue(function(){function init(){createFCBK();addInput(0)}function createFCBK(){holder=$('<ul class="holder"></ul>');if(options.attachto){if(typeof(options.attachto)=="object"){options.attachto.append(holder)}else{$(options.attachto).append(holder)}}else{element.after(holder)}complete=$('<div class="facebook-auto">').append('<div class="default">'+options.complete_text+"</div>");complete.hover(function(){complete_hover=0},function(){complete_hover=1});feed=$('<ul id="'+elemid+'_feed"></ul>');holder.after(complete.prepend(feed));feed.css("width",complete.width());elPrepare()}function elPrepare(){name=element.attr("name");if(options.bricket){if(name.indexOf("[]")==-1){name=name+"[]"}}var temp_elem=$('<'+element.get(0).tagName+' name="'+name+'" id="'+elemid+'" multiple="multiple" class="hidden">');$.each(element.children('option'),function(i,option){option=$(option);temp_elem.data(option.val(),option.text());if(option.hasClass("selected")){var id=addItem(option.text(),option.val(),true,option.hasClass("locked"));temp_elem.append('<option value="'+option.val()+'" selected="selected" id="opt_'+id+'"class="selected">'+option.text()+'</option>')}});element.after(temp_elem);element.remove();element=temp_elem;$(element).bind("addItem",function(event,data){addItem(data.title,data.value,0,0,0)});$(element).bind("removeItem",function(event,data){var item=holder.children('li[rel='+data.value+']');if(item.length){removeItem(item)}});$(element).bind("destroy",function(event,data){holder.remove();complete.remove();element.show()})}function addItem(title,value,preadded,locked,focusme){if(!maxItems()){return false}var liclass="bit-box"+(locked?" locked":"");var id=randomId();var txt=document.createTextNode(xssDisplay(title));var aclose=$('<a class="closebutton" href="#"></a>');var li=$('<li class="'+liclass+'" rel="'+value+'" id="pt_'+id+'"></li>').prepend(txt).append(aclose);holder.append(li);aclose.click(function(){removeItem($(this).parent("li"));return false});if(!preadded){$("#"+elemid+"_annoninput").remove();addInput(focusme);var _item=$('<option value="'+xssDisplay(value,1)+'" id="opt_'+id+'" class="selected" selected="selected">'+xssDisplay(title)+'</option>');element.append(_item);if(options.onselect){funCall(options.onselect,_item)}element.change()}holder.children("li.bit-box.deleted").removeClass("deleted");feed.hide();return id}function removeItem(item){if(!item.hasClass('locked')){item.fadeOut("fast");var id=item.attr('id');if(options.onremove){var _item=id?$("#o"+id+""):element.children("option[value="+item.attr("rel")+"]");funCall(options.onremove,_item)}if(id){$("#o"+id+"").remove()}else{element.children('option[value="'+item.attr("rel")+'"]').remove()}item.remove();element.change();deleting=0}}function addInput(focusme){var li=$('<li class="bit-input" id="'+elemid+'_annoninput">');var input=$('<input type="text" class="maininput" size="1" autocomplete="off">');var getBoxTimeout=0;holder.append(li.append(input));input.focus(function(){if(maxItems()){complete.fadeIn("fast")}});input.blur(function(){if(complete_hover){complete.fadeOut("fast")}else{input.focus()}});holder.click(function(){input.focus();if(feed.length&&input.val().length){feed.show()}else{feed.hide();complete.children(".default").show()}});input.keypress(function(event){if(event.keyCode==_key.enter){return false}input.attr("size",input.val().length+1)});input.keyup(function(event){var etext=xssPrevent(input.val(),1);if(event.keyCode==_key.backspace&&etext.length==0){feed.hide();if(!holder.children("li.bit-box:last").hasClass('locked')){if(holder.children("li.bit-box.deleted").length==0){holder.children("li.bit-box:last").addClass("deleted");return false}else{if(deleting){return}deleting=1;holder.children("li.bit-box.deleted").fadeOut("fast",function(){removeItem($(this));return false})}}}if(event.keyCode!=_key.downarrow&&event.keyCode!=_key.uparrow&&event.keyCode!=_key.leftarrow&&event.keyCode!=_key.rightarrow&&etext.length!=0){counter=0;if(options.json_url&&maxItems()){if(options.cache&&json_cache_object.get(etext)){addMembers(etext);bindEvents()}else{getBoxTimeout++;var getBoxTimeoutValue=getBoxTimeout;setTimeout(function(){if(getBoxTimeoutValue!=getBoxTimeout)return;$.getJSON(options.json_url,{"tag":xssDisplay(etext)},function(data){addMembers(etext,data);json_cache_object.set(etext,1);bindEvents()})},options.delay)}}else{addMembers(etext);bindEvents()}complete.children(".default").hide();feed.show()}});if(focusme){setTimeout(function(){input.focus();complete.children(".default").show()},1)}}function addMembers(etext,data){feed.html('');if(!options.cache&&data!=null){cache.clear()}addTextItem(etext);if(data!=null&&data.length){$.each(data,function(i,val){cache.set(xssPrevent(val.key),xssPrevent(val.value))})}var maximum=options.maxshownitems<cache.length()?options.maxshownitems:cache.length();var content='';$.each(cache.search(etext),function(i,object){if(options.filter_selected&&element.children("option[value="+object.key+"]").hasClass("selected")){}else{content+='<li rel="'+object.key+'">'+xssDisplay(itemIllumination(object.value,etext))+'</li>';counter++;maximum--}});feed.append(content);if(options.firstselected){focuson=feed.children("li:visible:first");focuson.addClass("auto-focus")}if(counter>options.height){feed.css({"height":(options.height*24)+"px","overflow":"auto"})}else{feed.css("height","auto")}if(maxItems()&&complete.is(':hidden')){complete.show()}}function itemIllumination(text,etext){if(options.filter_case){try{var regex=new RegExp("(.*)("+etext+")(.*)",((options.filter_case)?"g":"gi"));var text=text.replace(regex,'$1<em>$2</em>$3')}catch(ex){}}else{try{var regex=new RegExp("(.*)("+etext.toLowerCase()+")(.*)","gi");var text=text.replace(regex,'$1<em>$2</em>$3')}catch(ex){}}return text}function bindFeedEvent(){feed.children("li").mouseover(function(){feed.children("li").removeClass("auto-focus");focuson=$(this);focuson.addClass("auto-focus")});feed.children("li").mouseout(function(){$(this).removeClass("auto-focus");focuson=null})}function removeFeedEvent(){feed.unbind("mouseover").unbind("mouseout").mousemove(function(){bindFeedEvent();feed.unbind("mousemove")})}function bindEvents(){var maininput=$("#"+elemid+"_annoninput").children(".maininput");bindFeedEvent();feed.children("li").unbind("mousedown").mousedown(function(){var option=$(this);addItem(option.text(),option.attr("rel"),0,0,1);feed.hide();complete.hide()});maininput.unbind("keydown");maininput.keydown(function(event){if(event.keyCode!=_key.backspace){holder.children("li.bit-box.deleted").removeClass("deleted")}if((event.keyCode==_key.enter||event.keyCode==_key.tab)&&checkFocusOn()){var option=focuson;addItem(option.text(),option.attr("rel"),0,0,1);return _preventDefault(event)}if((event.keyCode==_key.enter||event.keyCode==_key.tab)&&!checkFocusOn()){if(options.newel){var value=xssPrevent($(this).val());addItem(value,value,0,0,1);return _preventDefault(event)}if(options.addontab&&options.newel){focuson=feed.children("li:visible:first");var option=focuson;addItem(option.text(),option.attr("rel"),0,0,1);return _preventDefault(event)}}if(event.keyCode==_key.downarrow){nextItem('first')}if(event.keyCode==_key.uparrow){nextItem('last')}})}function nextItem(position){removeFeedEvent();if(focuson==null||focuson.length==0){focuson=feed.children("li:visible:"+position);feed.get(0).scrollTop=position=='first'?0:parseInt(focuson.get(0).scrollHeight,10)*(parseInt(feed.children("li:visible").length,10)-Math.round(options.height/2))}else{focuson.removeClass("auto-focus");focuson=position=='first'?focuson.nextAll("li:visible:first"):focuson.prevAll("li:visible:first");var prev=parseInt(focuson.prevAll("li:visible").length,10);var next=parseInt(focuson.nextAll("li:visible").length,10);if(((position=='first'?prev:next)>Math.round(options.height/2)||(position=='first'?prev:next)<=Math.round(options.height/2))&&typeof(focuson.get(0))!="undefined"){feed.get(0).scrollTop=parseInt(focuson.get(0).scrollHeight,10)*(prev-Math.round(options.height/2))}}feed.children("li").removeClass("auto-focus");focuson.addClass("auto-focus")}function _preventDefault(event){complete.hide();event.preventDefault();focuson=null;return false}function maxItems(){return options.maxitems!=0&&(holder.children("li.bit-box").length<options.maxitems)}function addTextItem(value){if(options.newel&&maxItems()){feed.children("li[fckb=1]").remove();if(value.length==0){return}var li=$('<li rel="'+value+'" fckb="1"">').html(xssDisplay(value));feed.prepend(li);counter++}return}function funCall(func,item){var _object={};for(i=0;i<item.get(0).attributes.length;i++){if(item.get(0).attributes[i].nodeValue!=null){_object["_"+item.get(0).attributes[i].nodeName]=item.get(0).attributes[i].nodeValue}}return func.call(func,_object)}function checkFocusOn(){if(focuson==null||focuson.length==0){return false}return true}function xssPrevent(string,flag){if(typeof flag!="undefined"){for(i=0;i<string.length;i++){var charcode=string.charCodeAt(i);if((_key.exclamation<=charcode&&charcode<=_key.slash)||(_key.colon<=charcode&&charcode<=_key.at)||(_key.squarebricket_left<=charcode&&charcode<=_key.apostrof)){string=string.replace(string[i],escape(string[i]))}}string=string.replace(/(\{|\}|\*)/i,"\\$1")}return string.replace(/script(.*)/g,"")}function xssDisplay(string,flag){string=string.replace('\\',"");if(typeof flag!="undefined"){return string}return unescape(string)}var options=$.extend({json_url:null,cache:false,height:"10",newel:false,addontab:false,firstselected:false,filter_case:false,filter_selected:false,complete_text:"Start to type...",maxshownitems:30,maxitems:10,onselect:null,onremove:null,attachto:null,delay:350,bricket:true},opt);var holder=null;var feed=null;var complete=null;var counter=0;var focuson=null;var deleting=0;var complete_hover=1;var element=$(this);var elemid=element.attr("id");var json_cache=$('<div></div>').after(element);var json_cache_object={'set':function(id,val){json_cache.data(id,val)},'get':function(id){return json_cache.data(id)}};var _key={'enter':13,'tab':9,'backspace':8,'leftarrow':37,'uparrow':38,'rightarrow':39,'downarrow':40,'exclamation':33,'slash':47,'colon':58,'at':64,'squarebricket_left':91,'apostrof':96};var randomId=function(){var chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";var randomstring='';for(var i=0;i<32;i++){var rnum=Math.floor(Math.random()*chars.length);randomstring+=chars.substring(rnum,rnum+1)}return randomstring};var cache={'search':function(text,callback){var temp=new Array();var regex=new RegExp(text,(options.filter_case?"g":"gi"));$.each(element.data(),function(i,_elem){if(typeof _elem.search==='function'){if(_elem.search(regex)!=-1){temp.push({'key':i,'value':_elem})}}});return temp},'set':function(id,val){element.data(id,val)},'get':function(id){return element.data(id)},'clear':function(){element.removeData()},'length':function(){var count=0;for(var k in this){if(this.hasOwnProperty(k)){++count}}return count}};init();return this})}})(jQuery);
|
@@ -1,42 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Simple JQuery Collapsing menu.
|
3
|
-
HTML structure to use:
|
4
|
-
|
5
|
-
<ul id="menu">
|
6
|
-
<li><a href="#">Sub menu heading</a>
|
7
|
-
<ul>
|
8
|
-
<li><a href="http://site.com/">Link</a></li>
|
9
|
-
<li><a href="http://site.com/">Link</a></li>
|
10
|
-
<li><a href="http://site.com/">Link</a></li>
|
11
|
-
...
|
12
|
-
...
|
13
|
-
</ul>
|
14
|
-
<li><a href="#">Sub menu heading</a>
|
15
|
-
<ul>
|
16
|
-
<li><a href="http://site.com/">Link</a></li>
|
17
|
-
<li><a href="http://site.com/">Link</a></li>
|
18
|
-
<li><a href="http://site.com/">Link</a></li>
|
19
|
-
...
|
20
|
-
...
|
21
|
-
</ul>
|
22
|
-
...
|
23
|
-
...
|
24
|
-
</ul>
|
25
|
-
|
26
|
-
Copyright 2007 by Marco van Hylckama Vlieg
|
27
|
-
|
28
|
-
web: http://www.i-marco.nl/weblog/
|
29
|
-
email: marco@i-marco.nl
|
30
|
-
|
31
|
-
Free for non-commercial use
|
32
|
-
*/
|
33
|
-
|
34
|
-
function initMenu() {
|
35
|
-
$('#menu ul').hide();
|
36
|
-
$('#menu li a').click(
|
37
|
-
function() {
|
38
|
-
$(this).next().slideToggle('normal');
|
39
|
-
}
|
40
|
-
);
|
41
|
-
}
|
42
|
-
$(document).ready(function() {initMenu();});
|
@@ -1,4 +0,0 @@
|
|
1
|
-
/* Modernizr 2.0.6 (Custom Build) | MIT & BSD
|
2
|
-
* Contains: canvas | canvastext | iepp | cssclasses | load
|
3
|
-
*/
|
4
|
-
;window.Modernizr=function(a,b,c){function x(a,b){return!!~(""+a).indexOf(b)}function w(a,b){return typeof a===b}function v(a,b){return u(prefixes.join(a+";")+(b||""))}function u(a){k.cssText=a}var d="2.0.6",e={},f=!0,g=b.documentElement,h=b.head||b.getElementsByTagName("head")[0],i="modernizr",j=b.createElement(i),k=j.style,l,m=Object.prototype.toString,n={},o={},p={},q=[],r,s={}.hasOwnProperty,t;!w(s,c)&&!w(s.call,c)?t=function(a,b){return s.call(a,b)}:t=function(a,b){return b in a&&w(a.constructor.prototype[b],c)},n.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},n.canvastext=function(){return!!e.canvas&&!!w(b.createElement("canvas").getContext("2d").fillText,"function")};for(var y in n)t(n,y)&&(r=y.toLowerCase(),e[r]=n[y](),q.push((e[r]?"":"no-")+r));u(""),j=l=null,a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML="<elem></elem>";return a.childNodes.length!==1}()&&function(a,b){function s(a){var b=-1;while(++b<g)a.createElement(f[b])}a.iepp=a.iepp||{};var d=a.iepp,e=d.html5elements||"abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",f=e.split("|"),g=f.length,h=new RegExp("(^|\\s)("+e+")","gi"),i=new RegExp("<(/*)("+e+")","gi"),j=/^\s*[\{\}]\s*$/,k=new RegExp("(^|[^\\n]*?\\s)("+e+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),l=b.createDocumentFragment(),m=b.documentElement,n=m.firstChild,o=b.createElement("body"),p=b.createElement("style"),q=/print|all/,r;d.getCSS=function(a,b){if(a+""===c)return"";var e=-1,f=a.length,g,h=[];while(++e<f){g=a[e];if(g.disabled)continue;b=g.media||b,q.test(b)&&h.push(d.getCSS(g.imports,b),g.cssText),b="all"}return h.join("")},d.parseCSS=function(a){var b=[],c;while((c=k.exec(a))!=null)b.push(((j.exec(c[1])?"\n":c[1])+c[2]+c[3]).replace(h,"$1.iepp_$2")+c[4]);return b.join("\n")},d.writeHTML=function(){var a=-1;r=r||b.body;while(++a<g){var c=b.getElementsByTagName(f[a]),d=c.length,e=-1;while(++e<d)c[e].className.indexOf("iepp_")<0&&(c[e].className+=" iepp_"+f[a])}l.appendChild(r),m.appendChild(o),o.className=r.className,o.id=r.id,o.innerHTML=r.innerHTML.replace(i,"<$1font")},d._beforePrint=function(){p.styleSheet.cssText=d.parseCSS(d.getCSS(b.styleSheets,"all")),d.writeHTML()},d.restoreHTML=function(){o.innerHTML="",m.removeChild(o),m.appendChild(r)},d._afterPrint=function(){d.restoreHTML(),p.styleSheet.cssText=""},s(b),s(l);d.disablePP||(n.insertBefore(p,n.firstChild),p.media="print",p.className="iepp-printshim",a.attachEvent("onbeforeprint",d._beforePrint),a.attachEvent("onafterprint",d._afterPrint))}(a,b),e._version=d,g.className=g.className.replace(/\bno-js\b/,"")+(f?" js "+q.join(" "):"");return e}(this,this.document),function(a,b,c){function k(a){return!a||a=="loaded"||a=="complete"}function j(){var a=1,b=-1;while(p.length- ++b)if(p[b].s&&!(a=p[b].r))break;a&&g()}function i(a){var c=b.createElement("script"),d;c.src=a.s,c.onreadystatechange=c.onload=function(){!d&&k(c.readyState)&&(d=1,j(),c.onload=c.onreadystatechange=null)},m(function(){d||(d=1,j())},H.errorTimeout),a.e?c.onload():n.parentNode.insertBefore(c,n)}function h(a){var c=b.createElement("link"),d;c.href=a.s,c.rel="stylesheet",c.type="text/css";if(!a.e&&(w||r)){var e=function(a){m(function(){if(!d)try{a.sheet.cssRules.length?(d=1,j()):e(a)}catch(b){b.code==1e3||b.message=="security"||b.message=="denied"?(d=1,m(function(){j()},0)):e(a)}},0)};e(c)}else c.onload=function(){d||(d=1,m(function(){j()},0))},a.e&&c.onload();m(function(){d||(d=1,j())},H.errorTimeout),!a.e&&n.parentNode.insertBefore(c,n)}function g(){var a=p.shift();q=1,a?a.t?m(function(){a.t=="c"?h(a):i(a)},0):(a(),j()):q=0}function f(a,c,d,e,f,h){function i(){!o&&k(l.readyState)&&(r.r=o=1,!q&&j(),l.onload=l.onreadystatechange=null,m(function(){u.removeChild(l)},0))}var l=b.createElement(a),o=0,r={t:d,s:c,e:h};l.src=l.data=c,!s&&(l.style.display="none"),l.width=l.height="0",a!="object"&&(l.type=d),l.onload=l.onreadystatechange=i,a=="img"?l.onerror=i:a=="script"&&(l.onerror=function(){r.e=r.r=1,g()}),p.splice(e,0,r),u.insertBefore(l,s?null:n),m(function(){o||(u.removeChild(l),r.r=r.e=o=1,j())},H.errorTimeout)}function e(a,b,c){var d=b=="c"?z:y;q=0,b=b||"j",C(a)?f(d,a,b,this.i++,l,c):(p.splice(this.i++,0,a),p.length==1&&g());return this}function d(){var a=H;a.loader={load:e,i:0};return a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=r&&!s,u=s?l:n.parentNode,v=a.opera&&o.call(a.opera)=="[object Opera]",w="webkitAppearance"in l.style,x=w&&"async"in b.createElement("script"),y=r?"object":v||x?"img":"script",z=w?"img":y,A=Array.isArray||function(a){return o.call(a)=="[object Array]"},B=function(a){return Object(a)===a},C=function(a){return typeof a=="string"},D=function(a){return o.call(a)=="[object Function]"},E=[],F={},G,H;H=function(a){function f(a){var b=a.split("!"),c=E.length,d=b.pop(),e=b.length,f={url:d,origUrl:d,prefixes:b},g,h;for(h=0;h<e;h++)g=F[b[h]],g&&(f=g(f));for(h=0;h<c;h++)f=E[h](f);return f}function e(a,b,e,g,h){var i=f(a),j=i.autoCallback;if(!i.bypass){b&&(b=D(b)?b:b[a]||b[g]||b[a.split("/").pop().split("?")[0]]);if(i.instead)return i.instead(a,b,e,g,h);e.load(i.url,i.forceCSS||!i.forceJS&&/css$/.test(i.url)?"c":c,i.noexec),(D(b)||D(j))&&e.load(function(){d(),b&&b(i.origUrl,h,g),j&&j(i.origUrl,h,g)})}}function b(a,b){function c(a){if(C(a))e(a,h,b,0,d);else if(B(a))for(i in a)a.hasOwnProperty(i)&&e(a[i],h,b,i,d)}var d=!!a.test,f=d?a.yep:a.nope,g=a.load||a.both,h=a.callback,i;c(f),c(g),a.complete&&b.load(a.complete)}var g,h,i=this.yepnope.loader;if(C(a))e(a,0,i,0);else if(A(a))for(g=0;g<a.length;g++)h=a[g],C(h)?e(h,0,i,0):A(h)?H(h):B(h)&&b(h,i);else B(a)&&b(a,i)},H.addPrefix=function(a,b){F[a]=b},H.addFilter=function(a){E.push(a)},H.errorTimeout=1e4,b.readyState==null&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",G=function(){b.removeEventListener("DOMContentLoaded",G,0),b.readyState="complete"},0)),a.yepnope=d()}(this,this.document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};
|
@@ -1,158 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Unobtrusive scripting adapter for jQuery
|
3
|
-
*
|
4
|
-
* Requires jQuery 1.4.3 or later.
|
5
|
-
* https://github.com/rails/jquery-ujs
|
6
|
-
*/
|
7
|
-
|
8
|
-
(function($) {
|
9
|
-
// Make sure that every Ajax request sends the CSRF token
|
10
|
-
function CSRFProtection(xhr) {
|
11
|
-
var token = $('meta[name="csrf-token"]').attr('content');
|
12
|
-
if (token) xhr.setRequestHeader('X-CSRF-Token', token);
|
13
|
-
}
|
14
|
-
if ('ajaxPrefilter' in $) $.ajaxPrefilter(function(options, originalOptions, xhr){ CSRFProtection(xhr) });
|
15
|
-
else $(document).ajaxSend(function(e, xhr){ CSRFProtection(xhr) });
|
16
|
-
|
17
|
-
// Triggers an event on an element and returns the event result
|
18
|
-
function fire(obj, name, data) {
|
19
|
-
var event = $.Event(name);
|
20
|
-
obj.trigger(event, data);
|
21
|
-
return event.result !== false;
|
22
|
-
}
|
23
|
-
|
24
|
-
// Submits "remote" forms and links with ajax
|
25
|
-
function handleRemote(element) {
|
26
|
-
var method, url, data,
|
27
|
-
dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType);
|
28
|
-
|
29
|
-
if (fire(element, 'ajax:before')) {
|
30
|
-
if (element.is('form')) {
|
31
|
-
method = element.attr('method');
|
32
|
-
url = element.attr('action');
|
33
|
-
data = element.serializeArray();
|
34
|
-
// memoized value from clicked submit button
|
35
|
-
var button = element.data('ujs:submit-button');
|
36
|
-
if (button) {
|
37
|
-
data.push(button);
|
38
|
-
element.data('ujs:submit-button', null);
|
39
|
-
}
|
40
|
-
} else {
|
41
|
-
method = element.data('method');
|
42
|
-
url = element.attr('href');
|
43
|
-
data = null;
|
44
|
-
}
|
45
|
-
$.ajax({
|
46
|
-
url: url, type: method || 'GET', data: data, dataType: dataType,
|
47
|
-
// stopping the "ajax:beforeSend" event will cancel the ajax request
|
48
|
-
beforeSend: function(xhr, settings) {
|
49
|
-
if (settings.dataType === undefined) {
|
50
|
-
xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
|
51
|
-
}
|
52
|
-
return fire(element, 'ajax:beforeSend', [xhr, settings]);
|
53
|
-
},
|
54
|
-
success: function(data, status, xhr) {
|
55
|
-
element.trigger('ajax:success', [data, status, xhr]);
|
56
|
-
},
|
57
|
-
complete: function(xhr, status) {
|
58
|
-
element.trigger('ajax:complete', [xhr, status]);
|
59
|
-
},
|
60
|
-
error: function(xhr, status, error) {
|
61
|
-
element.trigger('ajax:error', [xhr, status, error]);
|
62
|
-
}
|
63
|
-
});
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
// Handles "data-method" on links such as:
|
68
|
-
// <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
|
69
|
-
function handleMethod(link) {
|
70
|
-
var href = link.attr('href'),
|
71
|
-
method = link.data('method'),
|
72
|
-
csrf_token = $('meta[name=csrf-token]').attr('content'),
|
73
|
-
csrf_param = $('meta[name=csrf-param]').attr('content'),
|
74
|
-
form = $('<form method="post" action="' + href + '"></form>'),
|
75
|
-
metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
|
76
|
-
|
77
|
-
if (csrf_param !== undefined && csrf_token !== undefined) {
|
78
|
-
metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
|
79
|
-
}
|
80
|
-
|
81
|
-
form.hide().append(metadata_input).appendTo('body');
|
82
|
-
form.submit();
|
83
|
-
}
|
84
|
-
|
85
|
-
function disableFormElements(form) {
|
86
|
-
form.find('input[data-disable-with]').each(function() {
|
87
|
-
var input = $(this);
|
88
|
-
input.data('ujs:enable-with', input.val())
|
89
|
-
.val(input.data('disable-with'))
|
90
|
-
.attr('disabled', 'disabled');
|
91
|
-
});
|
92
|
-
}
|
93
|
-
|
94
|
-
function enableFormElements(form) {
|
95
|
-
form.find('input[data-disable-with]').each(function() {
|
96
|
-
var input = $(this);
|
97
|
-
input.val(input.data('ujs:enable-with')).removeAttr('disabled');
|
98
|
-
});
|
99
|
-
}
|
100
|
-
|
101
|
-
function allowAction(element) {
|
102
|
-
var message = element.data('confirm');
|
103
|
-
return !message || (fire(element, 'confirm') && confirm(message));
|
104
|
-
}
|
105
|
-
|
106
|
-
function requiredValuesMissing(form) {
|
107
|
-
var missing = false;
|
108
|
-
form.find('input[name][required]').each(function() {
|
109
|
-
if (!$(this).val()) missing = true;
|
110
|
-
});
|
111
|
-
return missing;
|
112
|
-
}
|
113
|
-
|
114
|
-
$('a[data-confirm], a[data-method], a[data-remote]').live('click.rails', function(e) {
|
115
|
-
var link = $(this);
|
116
|
-
if (!allowAction(link)) return false;
|
117
|
-
|
118
|
-
if (link.data('remote') != undefined) {
|
119
|
-
handleRemote(link);
|
120
|
-
return false;
|
121
|
-
} else if (link.data('method')) {
|
122
|
-
handleMethod(link);
|
123
|
-
return false;
|
124
|
-
}
|
125
|
-
});
|
126
|
-
|
127
|
-
$('form').live('submit.rails', function(e) {
|
128
|
-
var form = $(this), remote = form.data('remote') != undefined;
|
129
|
-
if (!allowAction(form)) return false;
|
130
|
-
|
131
|
-
// skip other logic when required values are missing
|
132
|
-
if (requiredValuesMissing(form)) return !remote;
|
133
|
-
|
134
|
-
if (remote) {
|
135
|
-
handleRemote(form);
|
136
|
-
return false;
|
137
|
-
} else {
|
138
|
-
// slight timeout so that the submit button gets properly serialized
|
139
|
-
setTimeout(function(){ disableFormElements(form) }, 13);
|
140
|
-
}
|
141
|
-
});
|
142
|
-
|
143
|
-
$('form input[type=submit], form button[type=submit], form button:not([type])').live('click.rails', function() {
|
144
|
-
var button = $(this);
|
145
|
-
if (!allowAction(button)) return false;
|
146
|
-
// register the pressed submit button
|
147
|
-
var name = button.attr('name'), data = name ? {name:name, value:button.val()} : null;
|
148
|
-
button.closest('form').data('ujs:submit-button', data);
|
149
|
-
});
|
150
|
-
|
151
|
-
$('form').live('ajax:beforeSend.rails', function(event) {
|
152
|
-
if (this == event.target) disableFormElements($(this));
|
153
|
-
});
|
154
|
-
|
155
|
-
$('form').live('ajax:complete.rails', function(event) {
|
156
|
-
if (this == event.target) enableFormElements($(this));
|
157
|
-
});
|
158
|
-
})( jQuery );
|
@@ -1,922 +0,0 @@
|
|
1
|
-
;(function($) {
|
2
|
-
/*
|
3
|
-
* ui.dropdownchecklist
|
4
|
-
*
|
5
|
-
* Copyright (c) 2008-2010 Adrian Tosca, Copyright (c) 2010-2011 Ittrium LLC
|
6
|
-
* Dual licensed under the MIT (MIT-LICENSE.txt) OR GPL (GPL-LICENSE.txt) licenses.
|
7
|
-
*
|
8
|
-
*/
|
9
|
-
// The dropdown check list jQuery plugin transforms a regular select html element into a dropdown check list.
|
10
|
-
$.widget("ui.dropdownchecklist", {
|
11
|
-
// Some globlals
|
12
|
-
// $.ui.dropdownchecklist.gLastOpened - keeps track of last opened dropdowncheck list so we can close it
|
13
|
-
// $.ui.dropdownchecklist.gIDCounter - simple counter to provide a unique ID as needed
|
14
|
-
version: function() {
|
15
|
-
alert('DropDownCheckList v1.4');
|
16
|
-
},
|
17
|
-
// Creates the drop container that keeps the items and appends it to the document
|
18
|
-
_appendDropContainer: function( controlItem ) {
|
19
|
-
var wrapper = $("<div/>");
|
20
|
-
// the container is wrapped in a div
|
21
|
-
wrapper.addClass("ui-dropdownchecklist ui-dropdownchecklist-dropcontainer-wrapper");
|
22
|
-
wrapper.addClass("ui-widget");
|
23
|
-
// assign an id
|
24
|
-
wrapper.attr("id",controlItem.attr("id") + '-ddw');
|
25
|
-
// initially positioned way off screen to prevent it from displaying
|
26
|
-
// NOTE absolute position to enable width/height calculation
|
27
|
-
wrapper.css({ position: 'absolute', left: "-33000px", top: "-33000px" });
|
28
|
-
|
29
|
-
var container = $("<div/>"); // the actual container
|
30
|
-
container.addClass("ui-dropdownchecklist-dropcontainer ui-widget-content");
|
31
|
-
container.css("overflow-y", "auto");
|
32
|
-
wrapper.append(container);
|
33
|
-
|
34
|
-
// insert the dropdown after the master control to try to keep the tab order intact
|
35
|
-
// if you just add it to the end, tabbing out of the drop down takes focus off the page
|
36
|
-
// @todo 22Sept2010 - check if size calculation is thrown off if the parent of the
|
37
|
-
// selector is hidden. We may need to add it to the end of the document here,
|
38
|
-
// calculate the size, and then move it back into proper position???
|
39
|
-
//$(document.body).append(wrapper);
|
40
|
-
wrapper.insertAfter(controlItem);
|
41
|
-
|
42
|
-
// flag that tells if the drop container is shown or not
|
43
|
-
wrapper.isOpen = false;
|
44
|
-
return wrapper;
|
45
|
-
},
|
46
|
-
// Look for browser standard 'open' on a closed selector
|
47
|
-
_isDropDownKeyShortcut: function(e,keycode) {
|
48
|
-
return e.altKey && ($.ui.keyCode.DOWN == keycode);// Alt + Down Arrow
|
49
|
-
},
|
50
|
-
// Look for key that will tell us to close the open dropdown
|
51
|
-
_isDropDownCloseKey: function(e,keycode) {
|
52
|
-
return ($.ui.keyCode.ESCAPE == keycode) || ($.ui.keyCode.ENTER == keycode);
|
53
|
-
},
|
54
|
-
// Handler to change the active focus based on a keystroke, moving some count of
|
55
|
-
// items from the element that has the current focus
|
56
|
-
_keyFocusChange: function(target,delta,limitToItems) {
|
57
|
-
// Find item with current focus
|
58
|
-
var focusables = $(":focusable");
|
59
|
-
var index = focusables.index(target);
|
60
|
-
if ( index >= 0 ) {
|
61
|
-
index += delta;
|
62
|
-
if ( limitToItems ) {
|
63
|
-
// Bound change to list of input elements
|
64
|
-
var allCheckboxes = this.dropWrapper.find("input:not([disabled])");
|
65
|
-
var firstIndex = focusables.index(allCheckboxes.get(0));
|
66
|
-
var lastIndex = focusables.index(allCheckboxes.get(allCheckboxes.length-1));
|
67
|
-
if ( index < firstIndex ) {
|
68
|
-
index = lastIndex;
|
69
|
-
} else if ( index > lastIndex ) {
|
70
|
-
index = firstIndex;
|
71
|
-
}
|
72
|
-
}
|
73
|
-
focusables.get(index).focus();
|
74
|
-
}
|
75
|
-
},
|
76
|
-
// Look for navigation, open, close (wired to keyup)
|
77
|
-
_handleKeyboard: function(e) {
|
78
|
-
var self = this;
|
79
|
-
var keyCode = (e.keyCode || e.which);
|
80
|
-
if (!self.dropWrapper.isOpen && self._isDropDownKeyShortcut(e, keyCode)) {
|
81
|
-
// Key command to open the dropdown
|
82
|
-
e.stopImmediatePropagation();
|
83
|
-
self._toggleDropContainer(true);
|
84
|
-
} else if (self.dropWrapper.isOpen && self._isDropDownCloseKey(e, keyCode)) {
|
85
|
-
// Key command to close the dropdown (but we retain focus in the control)
|
86
|
-
e.stopImmediatePropagation();
|
87
|
-
self._toggleDropContainer(false);
|
88
|
-
self.controlSelector.focus();
|
89
|
-
} else if (self.dropWrapper.isOpen
|
90
|
-
&& (e.target.type == 'checkbox')
|
91
|
-
&& ((keyCode == $.ui.keyCode.DOWN) || (keyCode == $.ui.keyCode.UP)) ) {
|
92
|
-
// Up/Down to cycle throught the open items
|
93
|
-
e.stopImmediatePropagation();
|
94
|
-
self._keyFocusChange(e.target, (keyCode == $.ui.keyCode.DOWN) ? 1 : -1, true);
|
95
|
-
} else if (self.dropWrapper.isOpen && (keyCode == $.ui.keyCode.TAB) ) {
|
96
|
-
// I wanted to adjust normal 'tab' processing here, but research indicates
|
97
|
-
// that TAB key processing is NOT a cancelable event. You have to use a timer
|
98
|
-
// hack to pull the focus back to where you want it after browser tab
|
99
|
-
// processing completes. Not going to work for us.
|
100
|
-
//e.stopImmediatePropagation();
|
101
|
-
//self._keyFocusChange(e.target, (e.shiftKey) ? -1 : 1, true);
|
102
|
-
}
|
103
|
-
},
|
104
|
-
// Look for change of focus
|
105
|
-
_handleFocus: function(e,focusIn,forDropdown) {
|
106
|
-
var self = this;
|
107
|
-
if (forDropdown && !self.dropWrapper.isOpen) {
|
108
|
-
// if the focus changes when the control is NOT open, mark it to show where the focus is/is not
|
109
|
-
e.stopImmediatePropagation();
|
110
|
-
if (focusIn) {
|
111
|
-
self.controlSelector.addClass("ui-state-hover");
|
112
|
-
if ($.ui.dropdownchecklist.gLastOpened != null) {
|
113
|
-
$.ui.dropdownchecklist.gLastOpened._toggleDropContainer( false );
|
114
|
-
}
|
115
|
-
} else {
|
116
|
-
self.controlSelector.removeClass("ui-state-hover");
|
117
|
-
}
|
118
|
-
} else if (!forDropdown && !focusIn) {
|
119
|
-
// The dropdown is open, and an item (NOT the dropdown) has just lost the focus.
|
120
|
-
// we really need a reliable method to see who has the focus as we process the blur,
|
121
|
-
// but that mechanism does not seem to exist. Instead we rely on a delay before
|
122
|
-
// posting the blur, with a focus event cancelling it before the delay expires.
|
123
|
-
if ( e != null ) { e.stopImmediatePropagation(); }
|
124
|
-
self.controlSelector.removeClass("ui-state-hover");
|
125
|
-
self._toggleDropContainer( false );
|
126
|
-
}
|
127
|
-
},
|
128
|
-
// Clear the pending change of focus, which keeps us 'in' the control
|
129
|
-
_cancelBlur: function(e) {
|
130
|
-
var self = this;
|
131
|
-
if (self.blurringItem != null) {
|
132
|
-
clearTimeout(self.blurringItem);
|
133
|
-
self.blurringItem = null;
|
134
|
-
}
|
135
|
-
},
|
136
|
-
// Creates the control that will replace the source select and appends it to the document
|
137
|
-
// The control resembles a regular select with single selection
|
138
|
-
_appendControl: function() {
|
139
|
-
var self = this, sourceSelect = this.sourceSelect, options = this.options;
|
140
|
-
|
141
|
-
// the control is wrapped in a basic container
|
142
|
-
// inline-block at this level seems to give us better size control
|
143
|
-
var wrapper = $("<span/>");
|
144
|
-
wrapper.addClass("ui-dropdownchecklist ui-dropdownchecklist-selector-wrapper ui-widget");
|
145
|
-
wrapper.css( { display: "inline-block", cursor: "default", overflow: "hidden" } );
|
146
|
-
|
147
|
-
// assign an ID
|
148
|
-
var baseID = sourceSelect.attr("id");
|
149
|
-
if ((baseID == null) || (baseID == "")) {
|
150
|
-
baseID = "ddcl-" + $.ui.dropdownchecklist.gIDCounter++;
|
151
|
-
} else {
|
152
|
-
baseID = "ddcl-" + baseID;
|
153
|
-
}
|
154
|
-
wrapper.attr("id",baseID);
|
155
|
-
|
156
|
-
// the actual control which you can style
|
157
|
-
// inline-block needed to enable 'width' but has interesting problems cross browser
|
158
|
-
var control = $("<span/>");
|
159
|
-
control.addClass("ui-dropdownchecklist-selector ui-state-default");
|
160
|
-
control.css( { display: "inline-block", overflow: "hidden", 'white-space': 'nowrap'} );
|
161
|
-
// Setting a tab index means we are interested in the tab sequence
|
162
|
-
var tabIndex = sourceSelect.attr("tabIndex");
|
163
|
-
if ( tabIndex == null ) {
|
164
|
-
tabIndex = 0;
|
165
|
-
} else {
|
166
|
-
tabIndex = parseInt(tabIndex);
|
167
|
-
if ( tabIndex < 0 ) {
|
168
|
-
tabIndex = 0;
|
169
|
-
}
|
170
|
-
}
|
171
|
-
control.attr("tabIndex", tabIndex);
|
172
|
-
control.keyup(function(e) {self._handleKeyboard(e);});
|
173
|
-
control.focus(function(e) {self._handleFocus(e,true,true);});
|
174
|
-
control.blur(function(e) {self._handleFocus(e,false,true);});
|
175
|
-
wrapper.append(control);
|
176
|
-
|
177
|
-
// the optional icon (which is inherently a block) which we can float
|
178
|
-
if (options.icon != null) {
|
179
|
-
var iconPlacement = (options.icon.placement == null) ? "left" : options.icon.placement;
|
180
|
-
var anIcon = $("<div/>");
|
181
|
-
anIcon.addClass("ui-icon");
|
182
|
-
anIcon.addClass( (options.icon.toOpen != null) ? options.icon.toOpen : "ui-icon-triangle-1-e");
|
183
|
-
anIcon.css({ 'float': iconPlacement });
|
184
|
-
control.append(anIcon);
|
185
|
-
}
|
186
|
-
// the text container keeps the control text that is built from the selected (checked) items
|
187
|
-
// inline-block needed to prevent long text from wrapping to next line when icon is active
|
188
|
-
var textContainer = $("<span/>");
|
189
|
-
textContainer.addClass("ui-dropdownchecklist-text");
|
190
|
-
textContainer.css( { display: "inline-block", 'white-space': "nowrap", overflow: "hidden" } );
|
191
|
-
control.append(textContainer);
|
192
|
-
|
193
|
-
// add the hover styles to the control
|
194
|
-
wrapper.hover(
|
195
|
-
function() {
|
196
|
-
if (!self.disabled) {
|
197
|
-
control.addClass("ui-state-hover");
|
198
|
-
}
|
199
|
-
}
|
200
|
-
, function() {
|
201
|
-
if (!self.disabled) {
|
202
|
-
control.removeClass("ui-state-hover");
|
203
|
-
}
|
204
|
-
}
|
205
|
-
);
|
206
|
-
// clicking on the control toggles the drop container
|
207
|
-
wrapper.click(function(event) {
|
208
|
-
if (!self.disabled) {
|
209
|
-
event.stopImmediatePropagation();
|
210
|
-
self._toggleDropContainer( !self.dropWrapper.isOpen );
|
211
|
-
}
|
212
|
-
});
|
213
|
-
wrapper.insertAfter(sourceSelect);
|
214
|
-
|
215
|
-
// Watch for a window resize and adjust the control if open
|
216
|
-
$(window).resize(function() {
|
217
|
-
if (!self.disabled && self.dropWrapper.isOpen) {
|
218
|
-
// Reopen yourself to get the position right
|
219
|
-
self._toggleDropContainer(true);
|
220
|
-
}
|
221
|
-
});
|
222
|
-
return wrapper;
|
223
|
-
},
|
224
|
-
// Creates a drop item that coresponds to an option element in the source select
|
225
|
-
_createDropItem: function(index, tabIndex, value, text, optCss, checked, disabled, indent) {
|
226
|
-
var self = this, options = this.options, sourceSelect = this.sourceSelect, controlWrapper = this.controlWrapper;
|
227
|
-
// the item contains a div that contains a checkbox input and a lable for the text
|
228
|
-
// the div
|
229
|
-
var item = $("<div/>");
|
230
|
-
item.addClass("ui-dropdownchecklist-item");
|
231
|
-
item.css({'white-space': "nowrap"});
|
232
|
-
var checkedString = checked ? ' checked="checked"' : '';
|
233
|
-
var classString = disabled ? ' class="inactive"' : ' class="active"';
|
234
|
-
|
235
|
-
// generated id must be a bit unique to keep from colliding
|
236
|
-
var idBase = controlWrapper.attr("id");
|
237
|
-
var id = idBase + '-i' + index;
|
238
|
-
var checkBox;
|
239
|
-
|
240
|
-
// all items start out disabled to keep them out of the tab order
|
241
|
-
if (self.isMultiple) { // the checkbox
|
242
|
-
checkBox = $('<input disabled type="checkbox" id="' + id + '"' + checkedString + classString + ' tabindex="' + tabIndex + '" />');
|
243
|
-
} else { // the radiobutton
|
244
|
-
checkBox = $('<input disabled type="radio" id="' + id + '" name="' + idBase + '"' + checkedString + classString + ' tabindex="' + tabIndex + '" />');
|
245
|
-
}
|
246
|
-
checkBox = checkBox.attr("index", index).val(value);
|
247
|
-
item.append(checkBox);
|
248
|
-
|
249
|
-
// the text
|
250
|
-
var label = $("<label for=" + id + "/>");
|
251
|
-
label.addClass("ui-dropdownchecklist-text");
|
252
|
-
if ( optCss != null ) label.attr('style',optCss);
|
253
|
-
label.css({ cursor: "default" });
|
254
|
-
label.html(text);
|
255
|
-
if (indent) {
|
256
|
-
item.addClass("ui-dropdownchecklist-indent");
|
257
|
-
}
|
258
|
-
item.addClass("ui-state-default");
|
259
|
-
if (disabled) {
|
260
|
-
item.addClass("ui-state-disabled");
|
261
|
-
}
|
262
|
-
label.click(function(e) {e.stopImmediatePropagation();});
|
263
|
-
item.append(label);
|
264
|
-
|
265
|
-
// active items display themselves with hover
|
266
|
-
item.hover(
|
267
|
-
function(e) {
|
268
|
-
var anItem = $(this);
|
269
|
-
if (!anItem.hasClass("ui-state-disabled")) { anItem.addClass("ui-state-hover"); }
|
270
|
-
}
|
271
|
-
, function(e) {
|
272
|
-
var anItem = $(this);
|
273
|
-
anItem.removeClass("ui-state-hover");
|
274
|
-
}
|
275
|
-
);
|
276
|
-
// clicking on the checkbox synchronizes the source select
|
277
|
-
checkBox.click(function(e) {
|
278
|
-
var aCheckBox = $(this);
|
279
|
-
e.stopImmediatePropagation();
|
280
|
-
if (aCheckBox.hasClass("active") ) {
|
281
|
-
// Active checkboxes take active action
|
282
|
-
var callback = self.options.onItemClick;
|
283
|
-
if ($.isFunction(callback)) try {
|
284
|
-
callback.call(self,aCheckBox,sourceSelect.get(0));
|
285
|
-
} catch (ex) {
|
286
|
-
// reject the change on any error
|
287
|
-
aCheckBox.prop("checked",!aCheckBox.prop("checked"));
|
288
|
-
self._syncSelected(aCheckBox);
|
289
|
-
return;
|
290
|
-
}
|
291
|
-
self._syncSelected(aCheckBox);
|
292
|
-
self.sourceSelect.trigger("change", 'ddcl_internal');
|
293
|
-
if (!self.isMultiple && options.closeRadioOnClick) {
|
294
|
-
self._toggleDropContainer(false);
|
295
|
-
}
|
296
|
-
}
|
297
|
-
});
|
298
|
-
// we are interested in the focus leaving the check box
|
299
|
-
// but we need to detect the focus leaving one check box but
|
300
|
-
// entering another. There is no reliable way to detect who
|
301
|
-
// received the focus on a blur, so post the blur in the future,
|
302
|
-
// knowing we will cancel it if we capture the focus in a timely manner
|
303
|
-
// 23Sept2010 - unfortunately, IE 7+ and Chrome like to post a blur
|
304
|
-
// event to the current item with focus when the user
|
305
|
-
// clicks in the scroll bar. So if you have a scrollable
|
306
|
-
// dropdown with focus on an item, clicking in the scroll
|
307
|
-
// will close the drop down.
|
308
|
-
// I have no solution for blur processing at this time.
|
309
|
-
/*********
|
310
|
-
var timerFunction = function(){
|
311
|
-
// I had a hell of a time getting setTimeout to fire this, do not try to
|
312
|
-
// define it within the blur function
|
313
|
-
try { self._handleFocus(null,false,false); } catch(ex){ alert('timer failed: '+ex);}
|
314
|
-
};
|
315
|
-
checkBox.blur(function(e) {
|
316
|
-
self.blurringItem = setTimeout( timerFunction, 200 );
|
317
|
-
});
|
318
|
-
checkBox.focus(function(e) {self._cancelBlur();});
|
319
|
-
**********/
|
320
|
-
// check/uncheck the item on clicks on the entire item div
|
321
|
-
item.click(function(e) {
|
322
|
-
var anItem = $(this);
|
323
|
-
e.stopImmediatePropagation();
|
324
|
-
if (!anItem.hasClass("ui-state-disabled") ) {
|
325
|
-
// check/uncheck the underlying control
|
326
|
-
var aCheckBox = anItem.find("input");
|
327
|
-
var checked = aCheckBox.prop("checked");
|
328
|
-
aCheckBox.prop("checked", !checked);
|
329
|
-
|
330
|
-
var callback = self.options.onItemClick;
|
331
|
-
if ($.isFunction(callback)) try {
|
332
|
-
callback.call(self,aCheckBox,sourceSelect.get(0));
|
333
|
-
} catch (ex) {
|
334
|
-
// reject the change on any error
|
335
|
-
aCheckBox.prop("checked",checked);
|
336
|
-
self._syncSelected(aCheckBox);
|
337
|
-
return;
|
338
|
-
}
|
339
|
-
self._syncSelected(aCheckBox);
|
340
|
-
self.sourceSelect.trigger("change", 'ddcl_internal');
|
341
|
-
if (!checked && !self.isMultiple && options.closeRadioOnClick) {
|
342
|
-
self._toggleDropContainer(false);
|
343
|
-
}
|
344
|
-
} else {
|
345
|
-
// retain the focus even if disabled
|
346
|
-
anItem.focus();
|
347
|
-
self._cancelBlur();
|
348
|
-
}
|
349
|
-
});
|
350
|
-
// do not let the focus wander around
|
351
|
-
item.focus(function(e) {
|
352
|
-
var anItem = $(this);
|
353
|
-
e.stopImmediatePropagation();
|
354
|
-
});
|
355
|
-
item.keyup(function(e) {self._handleKeyboard(e);});
|
356
|
-
return item;
|
357
|
-
},
|
358
|
-
_createGroupItem: function(text,disabled) {
|
359
|
-
var self = this;
|
360
|
-
var group = $("<div />");
|
361
|
-
group.addClass("ui-dropdownchecklist-group ui-widget-header");
|
362
|
-
if (disabled) {
|
363
|
-
group.addClass("ui-state-disabled");
|
364
|
-
}
|
365
|
-
group.css({'white-space': "nowrap"});
|
366
|
-
|
367
|
-
var label = $("<span/>");
|
368
|
-
label.addClass("ui-dropdownchecklist-text");
|
369
|
-
label.css( { cursor: "default" });
|
370
|
-
label.text(text);
|
371
|
-
group.append(label);
|
372
|
-
|
373
|
-
// anything interesting when you click the group???
|
374
|
-
group.click(function(e) {
|
375
|
-
var aGroup= $(this);
|
376
|
-
e.stopImmediatePropagation();
|
377
|
-
// retain the focus even if no action is taken
|
378
|
-
aGroup.focus();
|
379
|
-
self._cancelBlur();
|
380
|
-
});
|
381
|
-
// do not let the focus wander around
|
382
|
-
group.focus(function(e) {
|
383
|
-
var aGroup = $(this);
|
384
|
-
e.stopImmediatePropagation();
|
385
|
-
});
|
386
|
-
return group;
|
387
|
-
},
|
388
|
-
_createCloseItem: function(text) {
|
389
|
-
var self = this;
|
390
|
-
var closeItem = $("<div />");
|
391
|
-
closeItem.addClass("ui-state-default ui-dropdownchecklist-close ui-dropdownchecklist-item");
|
392
|
-
closeItem.css({'white-space': 'nowrap', 'text-align': 'right'});
|
393
|
-
|
394
|
-
var label = $("<span/>");
|
395
|
-
label.addClass("ui-dropdownchecklist-text");
|
396
|
-
label.css( { cursor: "default" });
|
397
|
-
label.html(text);
|
398
|
-
closeItem.append(label);
|
399
|
-
|
400
|
-
// close the control on click
|
401
|
-
closeItem.click(function(e) {
|
402
|
-
var aGroup= $(this);
|
403
|
-
e.stopImmediatePropagation();
|
404
|
-
// retain the focus even if no action is taken
|
405
|
-
aGroup.focus();
|
406
|
-
self._toggleDropContainer( false );
|
407
|
-
});
|
408
|
-
closeItem.hover(
|
409
|
-
function(e) { $(this).addClass("ui-state-hover"); }
|
410
|
-
, function(e) { $(this).removeClass("ui-state-hover"); }
|
411
|
-
);
|
412
|
-
// do not let the focus wander around
|
413
|
-
closeItem.focus(function(e) {
|
414
|
-
var aGroup = $(this);
|
415
|
-
e.stopImmediatePropagation();
|
416
|
-
});
|
417
|
-
return closeItem;
|
418
|
-
},
|
419
|
-
// Creates the drop items and appends them to the drop container
|
420
|
-
// Also calculates the size needed by the drop container and returns it
|
421
|
-
_appendItems: function() {
|
422
|
-
var self = this, config = this.options, sourceSelect = this.sourceSelect, dropWrapper = this.dropWrapper;
|
423
|
-
var dropContainerDiv = dropWrapper.find(".ui-dropdownchecklist-dropcontainer");
|
424
|
-
sourceSelect.children().each(function(index) { // when the select has groups
|
425
|
-
var opt = $(this);
|
426
|
-
if (opt.is("option")) {
|
427
|
-
self._appendOption(opt, dropContainerDiv, index, false, false);
|
428
|
-
} else if (opt.is("optgroup")) {
|
429
|
-
var disabled = opt.prop("disabled");
|
430
|
-
var text = opt.attr("label");
|
431
|
-
if (text != "") {
|
432
|
-
var group = self._createGroupItem(text,disabled);
|
433
|
-
dropContainerDiv.append(group);
|
434
|
-
}
|
435
|
-
self._appendOptions(opt, dropContainerDiv, index, true, disabled);
|
436
|
-
}
|
437
|
-
});
|
438
|
-
if ( config.explicitClose != null ) {
|
439
|
-
var closeItem = self._createCloseItem(config.explicitClose);
|
440
|
-
dropContainerDiv.append(closeItem);
|
441
|
-
}
|
442
|
-
var divWidth = dropContainerDiv.outerWidth();
|
443
|
-
var divHeight = dropContainerDiv.outerHeight();
|
444
|
-
return { width: divWidth, height: divHeight };
|
445
|
-
},
|
446
|
-
_appendOptions: function(parent, container, parentIndex, indent, forceDisabled) {
|
447
|
-
var self = this;
|
448
|
-
parent.children("option").each(function(index) {
|
449
|
-
var option = $(this);
|
450
|
-
var childIndex = (parentIndex + "." + index);
|
451
|
-
self._appendOption(option, container, childIndex, indent, forceDisabled);
|
452
|
-
});
|
453
|
-
},
|
454
|
-
_appendOption: function(option, container, index, indent, forceDisabled) {
|
455
|
-
var self = this;
|
456
|
-
// Note that the browsers destroy any html structure within the OPTION
|
457
|
-
var text = option.html();
|
458
|
-
if ( (text != null) && (text != '') ) {
|
459
|
-
var value = option.val();
|
460
|
-
var optCss = option.attr('style');
|
461
|
-
var selected = option.prop("selected");
|
462
|
-
var disabled = (forceDisabled || option.prop("disabled"));
|
463
|
-
// Use the same tab index as the selector replacement
|
464
|
-
var tabIndex = self.controlSelector.attr("tabindex");
|
465
|
-
var item = self._createDropItem(index, tabIndex, value, text, optCss, selected, disabled, indent);
|
466
|
-
container.append(item);
|
467
|
-
}
|
468
|
-
},
|
469
|
-
// Synchronizes the items checked and the source select
|
470
|
-
// When firstItemChecksAll option is active also synchronizes the checked items
|
471
|
-
// senderCheckbox parameters is the checkbox input that generated the synchronization
|
472
|
-
_syncSelected: function(senderCheckbox) {
|
473
|
-
var self = this, options = this.options, sourceSelect = this.sourceSelect, dropWrapper = this.dropWrapper;
|
474
|
-
var selectOptions = sourceSelect.get(0).options;
|
475
|
-
var allCheckboxes = dropWrapper.find("input.active");
|
476
|
-
if (options.firstItemChecksAll == 'exclusive') {
|
477
|
-
if ((senderCheckbox == null) && $(selectOptions[0]).prop("selected") ) {
|
478
|
-
// Initialization call with first item active
|
479
|
-
allCheckboxes.prop("checked", false);
|
480
|
-
$(allCheckboxes[0]).prop("checked", true);
|
481
|
-
} else if ((senderCheckbox != null) && (senderCheckbox.attr("index") == 0)) {
|
482
|
-
// Action on the first, so all other checkboxes NOT active
|
483
|
-
var firstIsActive = senderCheckbox.prop("checked");
|
484
|
-
allCheckboxes.prop("checked", false);
|
485
|
-
$(allCheckboxes[0]).prop("checked", firstIsActive);
|
486
|
-
} else {
|
487
|
-
// check the first checkbox if all the other checkboxes are checked
|
488
|
-
var allChecked = true;
|
489
|
-
var firstCheckbox = null;
|
490
|
-
allCheckboxes.each(function(index) {
|
491
|
-
if (index > 0) {
|
492
|
-
var checked = $(this).prop("checked");
|
493
|
-
if (!checked) { allChecked = false; }
|
494
|
-
} else {
|
495
|
-
firstCheckbox = $(this);
|
496
|
-
}
|
497
|
-
});
|
498
|
-
if ( firstCheckbox != null ) {
|
499
|
-
if ( allChecked ) {
|
500
|
-
// when all are checked, only the first left checked
|
501
|
-
allCheckboxes.prop("checked", false);
|
502
|
-
}
|
503
|
-
firstCheckbox.prop("checked", allChecked );
|
504
|
-
}
|
505
|
-
}
|
506
|
-
} else if (options.firstItemChecksAll) {
|
507
|
-
if ((senderCheckbox == null) && $(selectOptions[0]).prop("selected") ) {
|
508
|
-
// Initialization call with first item active so force all to be active
|
509
|
-
allCheckboxes.prop("checked", true);
|
510
|
-
} else if ((senderCheckbox != null) && (senderCheckbox.attr("index") == 0)) {
|
511
|
-
// Check all checkboxes if the first one is checked
|
512
|
-
allCheckboxes.prop("checked", senderCheckbox.prop("checked"));
|
513
|
-
} else {
|
514
|
-
// check the first checkbox if all the other checkboxes are checked
|
515
|
-
var allChecked = true;
|
516
|
-
var firstCheckbox = null;
|
517
|
-
allCheckboxes.each(function(index) {
|
518
|
-
if (index > 0) {
|
519
|
-
var checked = $(this).prop("checked");
|
520
|
-
if (!checked) { allChecked = false; }
|
521
|
-
} else {
|
522
|
-
firstCheckbox = $(this);
|
523
|
-
}
|
524
|
-
});
|
525
|
-
if ( firstCheckbox != null ) {
|
526
|
-
firstCheckbox.prop("checked", allChecked );
|
527
|
-
}
|
528
|
-
}
|
529
|
-
}
|
530
|
-
// do the actual synch with the source select
|
531
|
-
var empties = 0;
|
532
|
-
allCheckboxes = dropWrapper.find("input");
|
533
|
-
allCheckboxes.each(function(index) {
|
534
|
-
var anOption = $(selectOptions[index + empties]);
|
535
|
-
var optionText = anOption.html();
|
536
|
-
if ( (optionText == null) || (optionText == '') ) {
|
537
|
-
empties += 1;
|
538
|
-
anOption = $(selectOptions[index + empties]);
|
539
|
-
}
|
540
|
-
anOption.prop("selected", $(this).prop("checked"));
|
541
|
-
});
|
542
|
-
// update the text shown in the control
|
543
|
-
self._updateControlText();
|
544
|
-
|
545
|
-
// Ensure the focus stays pointing where the user is working
|
546
|
-
if ( senderCheckbox != null) { senderCheckbox.focus(); }
|
547
|
-
},
|
548
|
-
_sourceSelectChangeHandler: function(event) {
|
549
|
-
var self = this, dropWrapper = this.dropWrapper;
|
550
|
-
dropWrapper.find("input").val(self.sourceSelect.val());
|
551
|
-
|
552
|
-
// update the text shown in the control
|
553
|
-
self._updateControlText();
|
554
|
-
},
|
555
|
-
// Updates the text shown in the control depending on the checked (selected) items
|
556
|
-
_updateControlText: function() {
|
557
|
-
var self = this, sourceSelect = this.sourceSelect, options = this.options, controlWrapper = this.controlWrapper;
|
558
|
-
var firstOption = sourceSelect.find("option:first");
|
559
|
-
var selectOptions = sourceSelect.find("option");
|
560
|
-
var text = self._formatText(selectOptions, options.firstItemChecksAll, firstOption);
|
561
|
-
var controlLabel = controlWrapper.find(".ui-dropdownchecklist-text");
|
562
|
-
controlLabel.html(text);
|
563
|
-
// the attribute needs naked text, not html
|
564
|
-
//controlLabel.html(text);
|
565
|
-
controlLabel.html(securityImage);
|
566
|
-
controlLabel.append(" ");
|
567
|
-
controlLabel.append(downImage);
|
568
|
-
//controlLabel.attr("title", text);
|
569
|
-
controlLabel.attr("title", "security");
|
570
|
-
},
|
571
|
-
// Formats the text that is shown in the control
|
572
|
-
_formatText: function(selectOptions, firstItemChecksAll, firstOption) {
|
573
|
-
var text;
|
574
|
-
if ( $.isFunction(this.options.textFormatFunction) ) {
|
575
|
-
// let the callback do the formatting, but do not allow it to fail
|
576
|
-
try {
|
577
|
-
text = this.options.textFormatFunction(selectOptions);
|
578
|
-
} catch(ex) {
|
579
|
-
alert( 'textFormatFunction failed: ' + ex );
|
580
|
-
}
|
581
|
-
} else if (firstItemChecksAll && (firstOption != null) && firstOption.prop("selected")) {
|
582
|
-
// just set the text from the first item
|
583
|
-
text = firstOption.html();
|
584
|
-
} else {
|
585
|
-
// concatenate the text from the checked items
|
586
|
-
text = "";
|
587
|
-
selectOptions.each(function() {
|
588
|
-
if ($(this).prop("selected")) {
|
589
|
-
if ( text != "" ) { text += ", "; }
|
590
|
-
/* NOTE use of .html versus .text, which can screw up ampersands for IE */
|
591
|
-
var optCss = $(this).attr('style');
|
592
|
-
var tempspan = $('<span/>');
|
593
|
-
tempspan.html( $(this).html() );
|
594
|
-
if ( optCss == null ) {
|
595
|
-
text += tempspan.html();
|
596
|
-
} else {
|
597
|
-
tempspan.attr('style',optCss);
|
598
|
-
text += $("<span/>").append(tempspan).html();
|
599
|
-
}
|
600
|
-
}
|
601
|
-
});
|
602
|
-
if ( text == "" ) {
|
603
|
-
text = (this.options.emptyText != null) ? this.options.emptyText : " ";
|
604
|
-
}
|
605
|
-
}
|
606
|
-
return text;
|
607
|
-
},
|
608
|
-
// Shows and hides the drop container
|
609
|
-
_toggleDropContainer: function( makeOpen ) {
|
610
|
-
var self = this;
|
611
|
-
// hides the last shown drop container
|
612
|
-
var hide = function(instance) {
|
613
|
-
if ((instance != null) && instance.dropWrapper.isOpen ){
|
614
|
-
instance.dropWrapper.isOpen = false;
|
615
|
-
$.ui.dropdownchecklist.gLastOpened = null;
|
616
|
-
|
617
|
-
var config = instance.options;
|
618
|
-
instance.dropWrapper.css({
|
619
|
-
top: "-33000px",
|
620
|
-
left: "-33000px"
|
621
|
-
});
|
622
|
-
var aControl = instance.controlSelector;
|
623
|
-
aControl.removeClass("ui-state-active");
|
624
|
-
aControl.removeClass("ui-state-hover");
|
625
|
-
|
626
|
-
var anIcon = instance.controlWrapper.find(".ui-icon");
|
627
|
-
if ( anIcon.length > 0 ) {
|
628
|
-
anIcon.removeClass( (config.icon.toClose != null) ? config.icon.toClose : "ui-icon-triangle-1-s");
|
629
|
-
anIcon.addClass( (config.icon.toOpen != null) ? config.icon.toOpen : "ui-icon-triangle-1-e");
|
630
|
-
}
|
631
|
-
$(document).unbind("click", hide);
|
632
|
-
|
633
|
-
// keep the items out of the tab order by disabling them
|
634
|
-
instance.dropWrapper.find("input.active").prop("disabled",true);
|
635
|
-
|
636
|
-
// the following blur just does not fire??? because it is hidden??? because it does not have focus???
|
637
|
-
//instance.sourceSelect.trigger("blur");
|
638
|
-
//instance.sourceSelect.triggerHandler("blur");
|
639
|
-
if($.isFunction(config.onComplete)) { try {
|
640
|
-
config.onComplete.call(instance,instance.sourceSelect.get(0));
|
641
|
-
} catch(ex) {
|
642
|
-
alert( 'callback failed: ' + ex );
|
643
|
-
}}
|
644
|
-
}
|
645
|
-
};
|
646
|
-
// shows the given drop container instance
|
647
|
-
var show = function(instance) {
|
648
|
-
if ( !instance.dropWrapper.isOpen ) {
|
649
|
-
instance.dropWrapper.isOpen = true;
|
650
|
-
$.ui.dropdownchecklist.gLastOpened = instance;
|
651
|
-
|
652
|
-
var config = instance.options;
|
653
|
-
/**** Issue127 (and the like) to correct positioning when parent element is relative
|
654
|
-
**** This positioning only worked with simple, non-relative parent position
|
655
|
-
instance.dropWrapper.css({
|
656
|
-
top: instance.controlWrapper.offset().top + instance.controlWrapper.outerHeight() + "px",
|
657
|
-
left: instance.controlWrapper.offset().left + "px"
|
658
|
-
});
|
659
|
-
****/
|
660
|
-
if ((config.positionHow == null) || (config.positionHow == 'absolute')) {
|
661
|
-
/** Floats above subsequent content, but does NOT scroll */
|
662
|
-
instance.dropWrapper.css({
|
663
|
-
position: 'absolute'
|
664
|
-
, top: instance.controlWrapper.position().top + instance.controlWrapper.outerHeight() + "px"
|
665
|
-
, left: instance.controlWrapper.position().left + "px"
|
666
|
-
});
|
667
|
-
} else if (config.positionHow == 'relative') {
|
668
|
-
/** Scrolls with the parent but does NOT float above subsequent content */
|
669
|
-
instance.dropWrapper.css({
|
670
|
-
position: 'relative'
|
671
|
-
, top: "0px"
|
672
|
-
, left: "0px"
|
673
|
-
});
|
674
|
-
}
|
675
|
-
var zIndex = 0;
|
676
|
-
if (config.zIndex == null) {
|
677
|
-
var ancestorsZIndexes = instance.controlWrapper.parents().map(
|
678
|
-
function() {
|
679
|
-
var zIndex = $(this).css("z-index");
|
680
|
-
return isNaN(zIndex) ? 0 : zIndex; }
|
681
|
-
).get();
|
682
|
-
var parentZIndex = Math.max.apply(Math, ancestorsZIndexes);
|
683
|
-
if ( parentZIndex >= 0) zIndex = parentZIndex+1;
|
684
|
-
} else {
|
685
|
-
/* Explicit set from the optins */
|
686
|
-
zIndex = parseInt(config.zIndex);
|
687
|
-
}
|
688
|
-
if (zIndex > 0) {
|
689
|
-
instance.dropWrapper.css( { 'z-index': zIndex } );
|
690
|
-
}
|
691
|
-
|
692
|
-
var aControl = instance.controlSelector;
|
693
|
-
aControl.addClass("ui-state-active");
|
694
|
-
aControl.removeClass("ui-state-hover");
|
695
|
-
|
696
|
-
var anIcon = instance.controlWrapper.find(".ui-icon");
|
697
|
-
if ( anIcon.length > 0 ) {
|
698
|
-
anIcon.removeClass( (config.icon.toOpen != null) ? config.icon.toOpen : "ui-icon-triangle-1-e");
|
699
|
-
anIcon.addClass( (config.icon.toClose != null) ? config.icon.toClose : "ui-icon-triangle-1-s");
|
700
|
-
}
|
701
|
-
$(document).bind("click", function(e) {hide(instance);} );
|
702
|
-
|
703
|
-
// insert the items back into the tab order by enabling all active ones
|
704
|
-
var activeItems = instance.dropWrapper.find("input.active");
|
705
|
-
activeItems.prop("disabled",false);
|
706
|
-
|
707
|
-
// we want the focus on the first active input item
|
708
|
-
var firstActiveItem = activeItems.get(0);
|
709
|
-
if ( firstActiveItem != null ) {
|
710
|
-
firstActiveItem.focus();
|
711
|
-
}
|
712
|
-
}
|
713
|
-
};
|
714
|
-
if ( makeOpen ) {
|
715
|
-
hide($.ui.dropdownchecklist.gLastOpened);
|
716
|
-
show(self);
|
717
|
-
} else {
|
718
|
-
hide(self);
|
719
|
-
}
|
720
|
-
},
|
721
|
-
// Set the size of the control and of the drop container
|
722
|
-
_setSize: function(dropCalculatedSize) {
|
723
|
-
var options = this.options, dropWrapper = this.dropWrapper, controlWrapper = this.controlWrapper;
|
724
|
-
|
725
|
-
// use the width from config options if set, otherwise set the same width as the drop container
|
726
|
-
var controlWidth = dropCalculatedSize.width;
|
727
|
-
if (options.width != null) {
|
728
|
-
controlWidth = parseInt(options.width);
|
729
|
-
} else if (options.minWidth != null) {
|
730
|
-
var minWidth = parseInt(options.minWidth);
|
731
|
-
// if the width is too small (usually when there are no items) set a minimum width
|
732
|
-
if (controlWidth < minWidth) {
|
733
|
-
controlWidth = minWidth;
|
734
|
-
}
|
735
|
-
}
|
736
|
-
var control = this.controlSelector;
|
737
|
-
control.css({ width: controlWidth + "px" });
|
738
|
-
|
739
|
-
// if we size the text, then Firefox places icons to the right properly
|
740
|
-
// and we do not wrap on long lines
|
741
|
-
var controlText = control.find(".ui-dropdownchecklist-text");
|
742
|
-
var controlIcon = control.find(".ui-icon");
|
743
|
-
if ( controlIcon != null ) {
|
744
|
-
// Must be an inner/outer/border problem, but IE6 needs an extra bit of space,
|
745
|
-
// otherwise you can get text pushed down into a second line when icons are active
|
746
|
-
controlWidth -= (controlIcon.outerWidth() + 4);
|
747
|
-
controlText.css( { width: controlWidth + "px" } );
|
748
|
-
}
|
749
|
-
// Account for padding, borders, etc
|
750
|
-
controlWidth = controlWrapper.outerWidth();
|
751
|
-
|
752
|
-
// the drop container height can be set from options
|
753
|
-
var maxDropHeight = (options.maxDropHeight != null)
|
754
|
-
? parseInt(options.maxDropHeight)
|
755
|
-
: -1;
|
756
|
-
var dropHeight = ((maxDropHeight > 0) && (dropCalculatedSize.height > maxDropHeight))
|
757
|
-
? maxDropHeight
|
758
|
-
: dropCalculatedSize.height;
|
759
|
-
// ensure the drop container is not less than the control width (would be ugly)
|
760
|
-
var dropWidth = dropCalculatedSize.width < controlWidth ? controlWidth : dropCalculatedSize.width;
|
761
|
-
|
762
|
-
$(dropWrapper).css({
|
763
|
-
height: dropHeight + "px",
|
764
|
-
width: dropWidth + "px"
|
765
|
-
});
|
766
|
-
dropWrapper.find(".ui-dropdownchecklist-dropcontainer").css({
|
767
|
-
height: dropHeight + "px"
|
768
|
-
});
|
769
|
-
},
|
770
|
-
// Initializes the plugin
|
771
|
-
_init: function() {
|
772
|
-
var self = this, options = this.options;
|
773
|
-
if ( $.ui.dropdownchecklist.gIDCounter == null) {
|
774
|
-
$.ui.dropdownchecklist.gIDCounter = 1;
|
775
|
-
}
|
776
|
-
// item blurring relies on a cancelable timer
|
777
|
-
self.blurringItem = null;
|
778
|
-
|
779
|
-
// sourceSelect is the select on which the plugin is applied
|
780
|
-
var sourceSelect = self.element;
|
781
|
-
self.initialDisplay = sourceSelect.css("display");
|
782
|
-
sourceSelect.css("display", "none");
|
783
|
-
self.initialMultiple = sourceSelect.prop("multiple");
|
784
|
-
self.isMultiple = self.initialMultiple;
|
785
|
-
if (options.forceMultiple != null) { self.isMultiple = options.forceMultiple; }
|
786
|
-
sourceSelect.prop("multiple", true);
|
787
|
-
self.sourceSelect = sourceSelect;
|
788
|
-
|
789
|
-
// append the control that resembles a single selection select
|
790
|
-
var controlWrapper = self._appendControl();
|
791
|
-
self.controlWrapper = controlWrapper;
|
792
|
-
self.controlSelector = controlWrapper.find(".ui-dropdownchecklist-selector");
|
793
|
-
|
794
|
-
// create the drop container where the items are shown
|
795
|
-
var dropWrapper = self._appendDropContainer(controlWrapper);
|
796
|
-
self.dropWrapper = dropWrapper;
|
797
|
-
|
798
|
-
// append the items from the source select element
|
799
|
-
var dropCalculatedSize = self._appendItems();
|
800
|
-
|
801
|
-
// updates the text shown in the control
|
802
|
-
self._updateControlText(controlWrapper, dropWrapper, sourceSelect);
|
803
|
-
|
804
|
-
// set the sizes of control and drop container
|
805
|
-
self._setSize(dropCalculatedSize);
|
806
|
-
|
807
|
-
// look for possible auto-check needed on first item
|
808
|
-
if ( options.firstItemChecksAll ) {
|
809
|
-
self._syncSelected(null);
|
810
|
-
}
|
811
|
-
// BGIFrame for IE6
|
812
|
-
if (options.bgiframe && typeof self.dropWrapper.bgiframe == "function") {
|
813
|
-
self.dropWrapper.bgiframe();
|
814
|
-
}
|
815
|
-
// listen for change events on the source select element
|
816
|
-
// ensure we avoid processing internally triggered changes
|
817
|
-
self.sourceSelect.change(function(event, eventName) {
|
818
|
-
if (eventName != 'ddcl_internal') {
|
819
|
-
self._sourceSelectChangeHandler(event);
|
820
|
-
}
|
821
|
-
});
|
822
|
-
},
|
823
|
-
// Refresh the disable and check state from the underlying control
|
824
|
-
_refreshOption: function(item,disabled,selected) {
|
825
|
-
var aParent = item.parent();
|
826
|
-
// account for enabled/disabled
|
827
|
-
if ( disabled ) {
|
828
|
-
item.prop("disabled",true);
|
829
|
-
item.removeClass("active");
|
830
|
-
item.addClass("inactive");
|
831
|
-
aParent.addClass("ui-state-disabled");
|
832
|
-
} else {
|
833
|
-
item.prop("disabled",false);
|
834
|
-
item.removeClass("inactive");
|
835
|
-
item.addClass("active");
|
836
|
-
aParent.removeClass("ui-state-disabled");
|
837
|
-
}
|
838
|
-
// adjust the checkbox state
|
839
|
-
item.prop("checked",selected);
|
840
|
-
},
|
841
|
-
_refreshGroup: function(group,disabled) {
|
842
|
-
if ( disabled ) {
|
843
|
-
group.addClass("ui-state-disabled");
|
844
|
-
} else {
|
845
|
-
group.removeClass("ui-state-disabled");
|
846
|
-
}
|
847
|
-
},
|
848
|
-
// External command to explicitly close the dropdown
|
849
|
-
close: function() {
|
850
|
-
this._toggleDropContainer(false);
|
851
|
-
},
|
852
|
-
// External command to refresh the ddcl from the underlying selector
|
853
|
-
refresh: function() {
|
854
|
-
var self = this, sourceSelect = this.sourceSelect, dropWrapper = this.dropWrapper;
|
855
|
-
|
856
|
-
var allCheckBoxes = dropWrapper.find("input");
|
857
|
-
var allGroups = dropWrapper.find(".ui-dropdownchecklist-group");
|
858
|
-
|
859
|
-
var groupCount = 0;
|
860
|
-
var optionCount = 0;
|
861
|
-
sourceSelect.children().each(function(index) {
|
862
|
-
var opt = $(this);
|
863
|
-
var disabled = opt.prop("disabled");
|
864
|
-
if (opt.is("option")) {
|
865
|
-
var selected = opt.prop("selected");
|
866
|
-
var anItem = $(allCheckBoxes[optionCount]);
|
867
|
-
self._refreshOption(anItem, disabled, selected);
|
868
|
-
optionCount += 1;
|
869
|
-
} else if (opt.is("optgroup")) {
|
870
|
-
var text = opt.attr("label");
|
871
|
-
if (text != "") {
|
872
|
-
var aGroup = $(allGroups[groupCount]);
|
873
|
-
self._refreshGroup(aGroup, disabled);
|
874
|
-
groupCount += 1;
|
875
|
-
}
|
876
|
-
opt.children("option").each(function() {
|
877
|
-
var subopt = $(this);
|
878
|
-
var subdisabled = (disabled || subopt.prop("disabled"));
|
879
|
-
var selected = subopt.prop("selected");
|
880
|
-
var subItem = $(allCheckBoxes[optionCount]);
|
881
|
-
self._refreshOption(subItem, subdisabled, selected );
|
882
|
-
optionCount += 1;
|
883
|
-
});
|
884
|
-
}
|
885
|
-
});
|
886
|
-
// sync will handle firstItemChecksAll and updateControlText
|
887
|
-
self._syncSelected(null);
|
888
|
-
},
|
889
|
-
// External command to enable the ddcl control
|
890
|
-
enable: function() {
|
891
|
-
this.controlSelector.removeClass("ui-state-disabled");
|
892
|
-
this.disabled = false;
|
893
|
-
},
|
894
|
-
// External command to disable the ddcl control
|
895
|
-
disable: function() {
|
896
|
-
this.controlSelector.addClass("ui-state-disabled");
|
897
|
-
this.disabled = true;
|
898
|
-
},
|
899
|
-
// External command to destroy all traces of the ddcl control
|
900
|
-
destroy: function() {
|
901
|
-
$.Widget.prototype.destroy.apply(this, arguments);
|
902
|
-
this.sourceSelect.css("display", this.initialDisplay);
|
903
|
-
this.sourceSelect.prop("multiple", this.initialMultiple);
|
904
|
-
this.controlWrapper.unbind().remove();
|
905
|
-
this.dropWrapper.remove();
|
906
|
-
}
|
907
|
-
});
|
908
|
-
|
909
|
-
$.extend($.ui.dropdownchecklist, {
|
910
|
-
defaults: {
|
911
|
-
width: null
|
912
|
-
, maxDropHeight: null
|
913
|
-
, firstItemChecksAll: false
|
914
|
-
, closeRadioOnClick: false
|
915
|
-
, minWidth: 50
|
916
|
-
, positionHow: 'absolute'
|
917
|
-
, bgiframe: false
|
918
|
-
, explicitClose: null
|
919
|
-
}
|
920
|
-
});
|
921
|
-
|
922
|
-
})(jQuery);
|