georgia 0.7.8 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +60 -16
- data/Rakefile +17 -10
- data/app/assets/images/georgia/arrow.png +0 -0
- data/app/assets/images/georgia/close.png +0 -0
- data/app/assets/javascripts/georgia/application.js +3 -6
- data/app/assets/javascripts/georgia/bootstrap-vendor.js.coffee +1 -1
- data/app/assets/javascripts/georgia/ckeditor/config.js +1 -1
- data/app/assets/javascripts/georgia/components/flash.js.coffee +1 -1
- data/app/assets/javascripts/georgia/components/media-library.js.coffee +1 -1
- data/app/assets/javascripts/georgia/components/tables.js.coffee +30 -0
- data/app/assets/javascripts/georgia/components/tables/{checkbox.js.coffee → checkboxable.js.coffee} +10 -39
- data/app/assets/javascripts/georgia/components/tables/media.js.coffee +17 -29
- data/app/assets/javascripts/georgia/components/tables/pages.js.coffee +26 -44
- data/app/assets/javascripts/georgia/components/tags.js.coffee +13 -24
- data/app/assets/javascripts/georgia/vendor/ekko-lightbox.min.js +7 -0
- data/app/assets/javascripts/georgia/vendor/textext.core.js +1618 -0
- data/app/assets/javascripts/georgia/vendor/textext.plugin.ajax.js +354 -0
- data/app/assets/javascripts/georgia/vendor/textext.plugin.arrow.js +106 -0
- data/app/assets/javascripts/georgia/vendor/textext.plugin.autocomplete.js +1110 -0
- data/app/assets/javascripts/georgia/vendor/textext.plugin.clear.js +116 -0
- data/app/assets/javascripts/georgia/vendor/textext.plugin.filter.js +242 -0
- data/app/assets/javascripts/georgia/vendor/textext.plugin.focus.js +174 -0
- data/app/assets/javascripts/georgia/vendor/textext.plugin.prompt.js +309 -0
- data/app/assets/javascripts/georgia/vendor/textext.plugin.suggestions.js +175 -0
- data/app/assets/javascripts/georgia/vendor/textext.plugin.tags.js +698 -0
- data/app/assets/stylesheets/georgia/application.css.scss +71 -12
- data/app/assets/stylesheets/georgia/components/_button.scss +3 -20
- data/app/assets/stylesheets/georgia/components/_label.scss +36 -1
- data/app/assets/stylesheets/georgia/components/_portlet.scss +4 -1
- data/app/assets/stylesheets/georgia/components/_status.scss +9 -0
- data/app/assets/stylesheets/georgia/components/_table.scss +7 -0
- data/app/assets/stylesheets/georgia/layout/_base.scss +22 -5
- data/app/assets/stylesheets/georgia/layout/_print.scss +8 -0
- data/app/assets/stylesheets/georgia/modules/_activities.scss +3 -0
- data/app/assets/stylesheets/georgia/modules/_footer.scss +3 -1
- data/app/assets/stylesheets/georgia/modules/_form_with_helpers.scss +2 -2
- data/app/assets/stylesheets/georgia/modules/_header.scss +4 -13
- data/app/assets/stylesheets/georgia/modules/_link.scss +6 -1
- data/app/assets/stylesheets/georgia/modules/_login.scss +7 -0
- data/app/assets/stylesheets/georgia/modules/_media.scss +10 -0
- data/app/assets/stylesheets/georgia/modules/_navigation.scss +5 -0
- data/app/assets/stylesheets/georgia/modules/_pages.scss +3 -0
- data/app/assets/stylesheets/georgia/modules/_results.scss +11 -4
- data/app/assets/stylesheets/georgia/modules/_sidebar.scss +6 -21
- data/app/assets/stylesheets/georgia/modules/_users.scss +3 -0
- data/app/assets/stylesheets/georgia/overrides/_flatly.scss +16 -0
- data/app/assets/stylesheets/georgia/overrides/_textext.scss +54 -0
- data/app/assets/stylesheets/georgia/settings/_base.scss +1 -1
- data/app/assets/stylesheets/georgia/settings/_colors.scss +31 -1
- data/app/assets/stylesheets/georgia/settings/_z-index.scss +2 -2
- data/app/assets/stylesheets/georgia/vendor/_bootswatch-flatly-theme.scss +7 -0
- data/app/assets/stylesheets/georgia/vendor/_ekko-lightbox.min.scss +6 -0
- data/app/assets/stylesheets/georgia/vendor/_select2_bootstrap.scss +497 -0
- data/app/assets/stylesheets/georgia/vendor/_textext.core.scss +29 -0
- data/app/assets/stylesheets/georgia/vendor/_textext.plugin.arrow.scss +13 -0
- data/app/assets/stylesheets/georgia/vendor/_textext.plugin.autocomplete.scss +35 -0
- data/app/assets/stylesheets/georgia/vendor/_textext.plugin.clear.scss +13 -0
- data/app/assets/stylesheets/georgia/vendor/_textext.plugin.focus.scss +12 -0
- data/app/assets/stylesheets/georgia/vendor/_textext.plugin.prompt.scss +16 -0
- data/app/assets/stylesheets/georgia/vendor/_textext.plugin.tags.scss +49 -0
- data/app/controllers/georgia/api/media_controller.rb +4 -2
- data/app/controllers/georgia/api/tags_controller.rb +10 -7
- data/app/controllers/georgia/application_controller.rb +17 -2
- data/app/controllers/georgia/concerns/frontendable.rb +2 -3
- data/app/controllers/georgia/dashboard_controller.rb +5 -7
- data/app/controllers/georgia/links_controller.rb +1 -0
- data/app/controllers/georgia/media_controller.rb +50 -41
- data/app/controllers/georgia/menus_controller.rb +16 -6
- data/app/controllers/georgia/pages_controller.rb +98 -58
- data/app/controllers/georgia/revisions_controller.rb +120 -24
- data/app/controllers/georgia/ui_associations_controller.rb +1 -0
- data/app/controllers/georgia/users_controller.rb +31 -11
- data/app/controllers/georgia/widgets_controller.rb +13 -4
- data/app/helpers/georgia/application_helper.rb +4 -0
- data/app/helpers/georgia/forms_helper.rb +2 -2
- data/app/helpers/georgia/ui_helper.rb +78 -12
- data/app/helpers/georgia/users_helper.rb +21 -0
- data/app/mailers/georgia/notifier.rb +4 -4
- data/app/models/ckeditor/asset.rb +16 -4
- data/app/models/ckeditor/asset_search.rb +15 -0
- data/app/models/ckeditor/attachment_file.rb +7 -0
- data/app/models/ckeditor/picture.rb +10 -0
- data/app/models/georgia/clone.rb +3 -1
- data/app/models/georgia/concerns/contentable.rb +2 -3
- data/app/models/georgia/concerns/searchable.rb +32 -0
- data/app/models/georgia/concerns/taggable.rb +2 -2
- data/app/models/georgia/concerns/treeable.rb +0 -1
- data/app/models/georgia/content.rb +1 -3
- data/app/models/georgia/dashboard.rb +7 -0
- data/app/models/georgia/link.rb +10 -3
- data/app/models/georgia/menu.rb +4 -4
- data/app/models/georgia/page.rb +75 -10
- data/app/models/georgia/revision.rb +10 -5
- data/app/models/georgia/role.rb +5 -5
- data/app/models/georgia/role_assignment.rb +8 -0
- data/app/models/georgia/slide.rb +4 -4
- data/app/models/georgia/status.rb +3 -5
- data/app/models/georgia/ui_association.rb +3 -5
- data/app/models/georgia/ui_section.rb +1 -1
- data/app/models/georgia/user.rb +5 -14
- data/app/models/georgia/widget.rb +3 -3
- data/app/policies/georgia/api_policy.rb +13 -0
- data/app/policies/georgia/application_policy.rb +30 -0
- data/app/policies/georgia/concerns/content_policy.rb +56 -0
- data/app/policies/georgia/concerns/publishing_policy.rb +52 -0
- data/app/policies/georgia/dashboard_policy.rb +19 -0
- data/app/policies/georgia/media_policy.rb +56 -0
- data/app/policies/georgia/navigation_policy.rb +42 -0
- data/app/policies/georgia/page_policy.rb +26 -0
- data/app/policies/georgia/revision_policy.rb +7 -44
- data/app/policies/georgia/ui_association_policy.rb +4 -0
- data/app/policies/georgia/user_policy.rb +46 -0
- data/app/policies/georgia/widget_policy.rb +42 -0
- data/app/presenters/georgia/active_facet_presenter.rb +2 -1
- data/app/presenters/georgia/link_portlet.rb +2 -2
- data/app/presenters/georgia/pagination_presenter.rb +45 -7
- data/app/presenters/georgia/permission_table_presenter.rb +80 -0
- data/app/presenters/georgia/revision_status_message.rb +73 -0
- data/app/presenters/georgia/sidebar_link_presenter.rb +1 -1
- data/app/presenters/georgia/slide_portlet.rb +5 -1
- data/app/routes/georgia/pageable_route_concern.rb +35 -0
- data/app/searches/georgia/media_search.rb +39 -0
- data/app/searches/georgia/page_search.rb +47 -0
- data/app/searches/georgia/search_definition.rb +72 -0
- data/app/searches/georgia/tag_search.rb +32 -0
- data/app/services/georgia/clone_revision.rb +71 -0
- data/app/services/georgia/compress_files.rb +49 -0
- data/app/services/georgia/copy_page.rb +100 -0
- data/app/services/georgia/create_activity.rb +16 -0
- data/app/services/georgia/create_media_asset.rb +53 -0
- data/app/services/georgia/parse_json_tags.rb +21 -0
- data/app/services/georgia/update_revision.rb +52 -0
- data/app/views/georgia/api/media/pictures.html.erb +1 -1
- data/app/views/georgia/ckeditor/assets/_asset.html.erb +2 -4
- data/app/views/georgia/ckeditor/pictures/_picture.html.erb +1 -6
- data/app/views/georgia/dashboard/panels/_messages.html.erb +26 -28
- data/app/views/georgia/dashboard/panels/_reviews.html.erb +23 -22
- data/app/views/georgia/dashboard/show.html.erb +9 -3
- data/app/views/georgia/header/_media.html.erb +2 -2
- data/app/views/georgia/header/_navigation.html.erb +3 -3
- data/app/views/georgia/header/_pages.html.erb +3 -3
- data/app/views/georgia/header/_users.html.erb +2 -2
- data/app/views/georgia/header/_widgets.html.erb +1 -1
- data/app/views/georgia/media/_header.html.erb +4 -2
- data/app/views/georgia/media/create.js.erb +1 -0
- data/app/views/georgia/media/destroy.js.erb +3 -0
- data/app/views/georgia/media/edit.html.erb +35 -30
- data/app/views/georgia/media/search.html.erb +2 -2
- data/app/views/georgia/menus/index.html.erb +1 -1
- data/app/views/georgia/pages/_header.html.erb +4 -4
- data/app/views/georgia/pages/_page.html.erb +1 -1
- data/app/views/georgia/pages/search.html.erb +4 -5
- data/app/views/georgia/pages/settings.html.erb +72 -61
- data/app/views/georgia/revisions/_revision.html.erb +12 -7
- data/app/views/georgia/revisions/edit.html.erb +17 -11
- data/app/views/georgia/revisions/fields/_content.html.erb +1 -2
- data/app/views/georgia/revisions/fields/_message.html.erb +11 -0
- data/app/views/georgia/revisions/fields/_ui_section.html.erb +1 -1
- data/app/views/georgia/revisions/fields/_widgets.html.erb +1 -1
- data/app/views/georgia/revisions/index.html.erb +2 -2
- data/app/views/georgia/revisions/messages/_awaiting_review.html.erb +15 -0
- data/app/views/georgia/revisions/messages/_continue_draft.html.erb +8 -0
- data/app/views/georgia/revisions/messages/_edit_current_revision.html.erb +12 -0
- data/app/views/georgia/revisions/messages/_insufficient_rights.html.erb +6 -0
- data/app/views/georgia/revisions/messages/_request_review.html.erb +7 -0
- data/app/views/georgia/revisions/messages/_review.html.erb +7 -0
- data/app/views/georgia/revisions/messages/_start_draft.html.erb +4 -0
- data/app/views/georgia/revisions/panels/_actions.html.erb +7 -0
- data/app/views/georgia/revisions/panels/_activities.html.erb +6 -0
- data/app/views/georgia/revisions/panels/_drafts.html.erb +28 -0
- data/app/views/georgia/revisions/panels/_info.html.erb +39 -0
- data/app/views/georgia/shared/modals/_media_library.html.erb +3 -1
- data/app/views/georgia/shared/search/_messages.html.erb +1 -1
- data/app/views/georgia/users/_form.html.erb +17 -2
- data/app/views/georgia/users/_user.html.erb +1 -1
- data/app/views/georgia/users/edit.html.erb +0 -1
- data/app/views/georgia/users/index.html.erb +1 -1
- data/app/views/georgia/users/permissions.html.erb +15 -0
- data/app/views/georgia/users/sessions/new.html.erb +3 -3
- data/app/views/layouts/georgia/_footer.html.erb +1 -3
- data/app/views/layouts/georgia/_head.html.erb +3 -4
- data/app/views/layouts/georgia/_header.html.erb +8 -10
- data/app/views/public_activity/_default.html.erb +15 -0
- data/app/views/public_activity/georgia_page/_copy.html.erb +15 -0
- data/app/views/public_activity/georgia_page/_create.html.erb +15 -0
- data/app/views/public_activity/georgia_page/_decline.html.erb +15 -0
- data/app/views/public_activity/georgia_page/_publish.html.erb +15 -0
- data/app/views/public_activity/georgia_page/_unpublish.html.erb +15 -0
- data/app/views/public_activity/georgia_page/_update.html.erb +15 -0
- data/app/views/public_activity/georgia_revision/_approve.html.erb +15 -0
- data/app/views/public_activity/georgia_revision/_decline.html.erb +15 -0
- data/app/views/public_activity/georgia_revision/_draft.html.erb +15 -0
- data/app/views/public_activity/georgia_revision/_restore.html.erb +15 -0
- data/app/views/public_activity/georgia_revision/_review.html.erb +15 -0
- data/app/views/public_activity/georgia_revision/_update.html.erb +15 -0
- data/config/initializers/acts_as_taggable_on.rb +13 -12
- data/config/initializers/ckeditor.rb +36 -16
- data/config/initializers/devise.rb +17 -15
- data/config/initializers/elasticsearch.rb +44 -0
- data/config/initializers/inflections.rb +1 -1
- data/config/routes.rb +13 -36
- data/db/migrate/001_create_ckeditor_assets.rb +6 -5
- data/db/migrate/002_create_georgia_contents.rb +2 -4
- data/db/migrate/008_create_georgia_roles.rb +0 -2
- data/db/migrate/015_add_receives_notifications_to_users.rb +7 -0
- data/db/migrate/016_add_role_id_to_users.rb +7 -0
- data/db/migrate/017_add_status_to_revisions.rb +7 -0
- data/db/migrate/018_create_georgia_role_assignments.rb +11 -0
- data/db/migrate/019_create_activities.rb +23 -0
- data/db/migrate/020_remove_georgia_revisions_state.rb +11 -0
- data/db/migrate/021_add_revised_by_id_to_georgia_revisions.rb +13 -0
- data/lib/generators/georgia/install/install_generator.rb +3 -29
- data/lib/generators/georgia/install/templates/app/controllers/pages_controller.rb +1 -1
- data/lib/generators/georgia/install/templates/config/initializers/georgia.rb +3 -7
- data/lib/generators/georgia/setup/setup_generator.rb +29 -0
- data/lib/georgia.rb +26 -9
- data/lib/georgia/engine.rb +6 -25
- data/lib/georgia/permissions.rb +57 -0
- data/lib/georgia/uploader/adapter.rb +4 -1
- data/lib/georgia/uploader/storage/file.rb +23 -0
- data/lib/georgia/version.rb +1 -1
- data/lib/tasks/georgia_tasks.rake +99 -0
- metadata +463 -461
- data/app/assets/fonts/georgia/signika-bold-webfont.eot +0 -0
- data/app/assets/fonts/georgia/signika-bold-webfont.svg +0 -1711
- data/app/assets/fonts/georgia/signika-bold-webfont.ttf +0 -0
- data/app/assets/fonts/georgia/signika-bold-webfont.woff +0 -0
- data/app/assets/fonts/georgia/signika-light-webfont.eot +0 -0
- data/app/assets/fonts/georgia/signika-light-webfont.svg +0 -1680
- data/app/assets/fonts/georgia/signika-light-webfont.ttf +0 -0
- data/app/assets/fonts/georgia/signika-light-webfont.woff +0 -0
- data/app/assets/fonts/georgia/signika-regular-webfont.eot +0 -0
- data/app/assets/fonts/georgia/signika-regular-webfont.svg +0 -1746
- data/app/assets/fonts/georgia/signika-regular-webfont.ttf +0 -0
- data/app/assets/fonts/georgia/signika-regular-webfont.woff +0 -0
- data/app/assets/images/georgia/bg-body-bar.jpg +0 -0
- data/app/assets/images/georgia/content-types/avi.jpg +0 -0
- data/app/assets/images/georgia/content-types/css.jpg +0 -0
- data/app/assets/images/georgia/content-types/csv.jpg +0 -0
- data/app/assets/images/georgia/content-types/doc.jpg +0 -0
- data/app/assets/images/georgia/content-types/docx.jpg +0 -0
- data/app/assets/images/georgia/content-types/eps.jpg +0 -0
- data/app/assets/images/georgia/content-types/gif.jpg +0 -0
- data/app/assets/images/georgia/content-types/gz.jpg +0 -0
- data/app/assets/images/georgia/content-types/html.jpg +0 -0
- data/app/assets/images/georgia/content-types/jpeg.jpg +0 -0
- data/app/assets/images/georgia/content-types/jpg.jpg +0 -0
- data/app/assets/images/georgia/content-types/mp3.jpg +0 -0
- data/app/assets/images/georgia/content-types/ods.jpg +0 -0
- data/app/assets/images/georgia/content-types/odt.jpg +0 -0
- data/app/assets/images/georgia/content-types/pdf.jpg +0 -0
- data/app/assets/images/georgia/content-types/png.jpg +0 -0
- data/app/assets/images/georgia/content-types/ppt.jpg +0 -0
- data/app/assets/images/georgia/content-types/pptx.jpg +0 -0
- data/app/assets/images/georgia/content-types/rar.jpg +0 -0
- data/app/assets/images/georgia/content-types/tar.jpg +0 -0
- data/app/assets/images/georgia/content-types/txt.jpg +0 -0
- data/app/assets/images/georgia/content-types/wav.jpg +0 -0
- data/app/assets/images/georgia/content-types/xls.jpg +0 -0
- data/app/assets/images/georgia/content-types/zip.jpg +0 -0
- data/app/assets/images/georgia/down_arrow.gif +0 -0
- data/app/assets/images/georgia/grippy_large.png +0 -0
- data/app/assets/images/georgia/logo.png +0 -0
- data/app/assets/images/georgia/up_arrow.gif +0 -0
- data/app/assets/javascripts/georgia/keybindings.js.coffee +0 -42
- data/app/assets/stylesheets/georgia/components/_state.scss +0 -17
- data/app/assets/stylesheets/georgia/settings/_fonts.scss +0 -3
- data/app/decorators/georgia/link_decorator.rb +0 -9
- data/app/decorators/georgia/links_decorator.rb +0 -4
- data/app/helpers/georgia/internationalization_helper.rb +0 -45
- data/app/helpers/georgia/menus_helper.rb +0 -20
- data/app/helpers/georgia/meta_tags_helper.rb +0 -22
- data/app/helpers/georgia/pages_helper.rb +0 -30
- data/app/helpers/georgia/routes_helper.rb +0 -25
- data/app/helpers/georgia/twitter_helper.rb +0 -24
- data/app/models/ability.rb +0 -19
- data/app/models/acts_as_taggable_on/tag.rb +0 -5
- data/app/models/georgia/concerns/cacheable.rb +0 -18
- data/app/models/georgia/concerns/orderable.rb +0 -21
- data/app/models/georgia/concerns/publishable.rb +0 -35
- data/app/models/georgia/concerns/revisionable.rb +0 -38
- data/app/models/georgia/concerns/slugable.rb +0 -48
- data/app/models/georgia/concerns/statable.rb +0 -64
- data/app/models/georgia/concerns/templatable.rb +0 -20
- data/app/policies/georgia/policy.rb +0 -17
- data/app/presenters/georgia/page_actions_presenter.rb +0 -92
- data/app/presenters/georgia/warning_message.rb +0 -55
- data/app/services/create_media_asset.rb +0 -51
- data/app/sweepers/navigation_sweeper.rb +0 -12
- data/app/views/georgia/media/sidebar/_facets.html.erb +0 -12
- data/app/views/menus/_dropdown_group.html.erb +0 -10
- data/app/views/menus/_dropdown_link.html.erb +0 -3
- data/app/views/menus/_dropdown_menu.html.erb +0 -11
- data/app/views/menus/_link.html.erb +0 -1
- data/app/views/menus/_menu.html.erb +0 -7
- data/config/initializers/simple_form.rb +0 -79
- data/config/locales/georgia.en.yml +0 -4
- data/lib/georgia/indexer.rb +0 -33
- data/lib/georgia/indexer/adapter.rb +0 -44
- data/lib/georgia/indexer/extensions/solr_adapter/acts_as_taggable_on/tag.rb +0 -30
- data/lib/georgia/indexer/extensions/solr_adapter/ckeditor/asset.rb +0 -46
- data/lib/georgia/indexer/extensions/solr_adapter/georgia/page.rb +0 -75
- data/lib/georgia/indexer/extensions/tire_adapter/acts_as_taggable_on/tag.rb +0 -34
- data/lib/georgia/indexer/extensions/tire_adapter/ckeditor/asset.rb +0 -57
- data/lib/georgia/indexer/extensions/tire_adapter/georgia/page.rb +0 -55
- data/lib/georgia/indexer/solr_adapter.rb +0 -20
- data/lib/georgia/indexer/tire_adapter.rb +0 -18
- data/lib/tasks/assets.rake +0 -20
- data/lib/tasks/georgia.rake +0 -65
- data/lib/tasks/sidekiq.rake +0 -8
- data/lib/tasks/solr.rake +0 -21
- data/lib/tasks/upgrade.rake +0 -39
- data/lib/templates/erb/scaffold/_form.html.erb +0 -13
@@ -0,0 +1,309 @@
|
|
1
|
+
/**
|
2
|
+
* jQuery TextExt Plugin
|
3
|
+
* http://textextjs.com
|
4
|
+
*
|
5
|
+
* @version 1.3.1
|
6
|
+
* @copyright Copyright (C) 2011 Alex Gorbatchev. All rights reserved.
|
7
|
+
* @license MIT License
|
8
|
+
*/
|
9
|
+
(function($)
|
10
|
+
{
|
11
|
+
/**
|
12
|
+
* Prompt plugin displays a visual user propmpt in the text input area. If user focuses
|
13
|
+
* on the input, the propt is hidden and only shown again when user focuses on another
|
14
|
+
* element and text input doesn't have a value.
|
15
|
+
*
|
16
|
+
* @author agorbatchev
|
17
|
+
* @date 2011/08/18
|
18
|
+
* @id TextExtPrompt
|
19
|
+
*/
|
20
|
+
function TextExtPrompt() {};
|
21
|
+
|
22
|
+
$.fn.textext.TextExtPrompt = TextExtPrompt;
|
23
|
+
$.fn.textext.addPlugin('prompt', TextExtPrompt);
|
24
|
+
|
25
|
+
var p = TextExtPrompt.prototype,
|
26
|
+
|
27
|
+
CSS_HIDE_PROMPT = 'text-hide-prompt',
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Prompt plugin has options to change the prompt label and its HTML template. The options
|
31
|
+
* could be changed when passed to the `$().textext()` function. For example:
|
32
|
+
*
|
33
|
+
* $('textarea').textext({
|
34
|
+
* plugins: 'prompt',
|
35
|
+
* prompt: 'Your email address'
|
36
|
+
* })
|
37
|
+
*
|
38
|
+
* @author agorbatchev
|
39
|
+
* @date 2011/08/18
|
40
|
+
* @id TextExtPrompt.options
|
41
|
+
*/
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Prompt message that is displayed to the user whenever there's no value in the input.
|
45
|
+
*
|
46
|
+
* @name prompt
|
47
|
+
* @default 'Awaiting input...'
|
48
|
+
* @author agorbatchev
|
49
|
+
* @date 2011/08/18
|
50
|
+
* @id TextExtPrompt.options.prompt
|
51
|
+
*/
|
52
|
+
OPT_PROMPT = 'prompt',
|
53
|
+
|
54
|
+
/**
|
55
|
+
* HTML source that is used to generate markup required for the prompt effect.
|
56
|
+
*
|
57
|
+
* @name html.prompt
|
58
|
+
* @default '<div class="text-prompt"/>'
|
59
|
+
* @author agorbatchev
|
60
|
+
* @date 2011/08/18
|
61
|
+
* @id TextExtPrompt.options.html.prompt
|
62
|
+
*/
|
63
|
+
OPT_HTML_PROMPT = 'html.prompt',
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Prompt plugin dispatches or reacts to the following events.
|
67
|
+
* @id TextExtPrompt.events
|
68
|
+
*/
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Prompt plugin reacts to the `focus` event and hides the markup generated from
|
72
|
+
* the `html.prompt` option.
|
73
|
+
*
|
74
|
+
* @name focus
|
75
|
+
* @author agorbatchev
|
76
|
+
* @date 2011/08/18
|
77
|
+
* @id TextExtPrompt.events.focus
|
78
|
+
*/
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Prompt plugin reacts to the `blur` event and shows the prompt back if user
|
82
|
+
* hasn't entered any value.
|
83
|
+
*
|
84
|
+
* @name blur
|
85
|
+
* @author agorbatchev
|
86
|
+
* @date 2011/08/18
|
87
|
+
* @id TextExtPrompt.events.blur
|
88
|
+
*/
|
89
|
+
|
90
|
+
DEFAULT_OPTS = {
|
91
|
+
prompt : 'Awaiting input...',
|
92
|
+
|
93
|
+
html : {
|
94
|
+
prompt : '<div class="text-prompt"/>'
|
95
|
+
}
|
96
|
+
}
|
97
|
+
;
|
98
|
+
|
99
|
+
/**
|
100
|
+
* Initialization method called by the core during plugin instantiation.
|
101
|
+
*
|
102
|
+
* @signature TextExtPrompt.init(core)
|
103
|
+
*
|
104
|
+
* @param core {TextExt} Instance of the TextExt core class.
|
105
|
+
*
|
106
|
+
* @author agorbatchev
|
107
|
+
* @date 2011/08/18
|
108
|
+
* @id TextExtPrompt.init
|
109
|
+
*/
|
110
|
+
p.init = function(core)
|
111
|
+
{
|
112
|
+
var self = this,
|
113
|
+
placeholderKey = 'placeholder',
|
114
|
+
container,
|
115
|
+
prompt
|
116
|
+
;
|
117
|
+
|
118
|
+
self.baseInit(core, DEFAULT_OPTS);
|
119
|
+
|
120
|
+
container = $(self.opts(OPT_HTML_PROMPT));
|
121
|
+
$(self).data('container', container);
|
122
|
+
|
123
|
+
self.core().wrapElement().append(container);
|
124
|
+
self.setPrompt(self.opts(OPT_PROMPT));
|
125
|
+
|
126
|
+
prompt = core.input().attr(placeholderKey);
|
127
|
+
|
128
|
+
if(!prompt)
|
129
|
+
prompt = self.opts(OPT_PROMPT);
|
130
|
+
|
131
|
+
// clear placeholder attribute if set
|
132
|
+
core.input().attr(placeholderKey, '');
|
133
|
+
|
134
|
+
if(prompt)
|
135
|
+
self.setPrompt(prompt);
|
136
|
+
|
137
|
+
if($.trim(self.val()).length > 0)
|
138
|
+
self.hidePrompt();
|
139
|
+
|
140
|
+
self.on({
|
141
|
+
blur : self.onBlur,
|
142
|
+
focus : self.onFocus,
|
143
|
+
postInvalidate : self.onPostInvalidate,
|
144
|
+
postInit : self.onPostInit
|
145
|
+
});
|
146
|
+
};
|
147
|
+
|
148
|
+
//--------------------------------------------------------------------------------
|
149
|
+
// Event handlers
|
150
|
+
|
151
|
+
/**
|
152
|
+
* Reacts to the `postInit` and configures the plugin for initial display.
|
153
|
+
*
|
154
|
+
* @signature TextExtPrompt.onPostInit(e)
|
155
|
+
*
|
156
|
+
* @param e {Object} jQuery event.
|
157
|
+
*
|
158
|
+
* @author agorbatchev
|
159
|
+
* @date 2011/08/24
|
160
|
+
* @id TextExtPrompt.onPostInit
|
161
|
+
*/
|
162
|
+
p.onPostInit = function(e)
|
163
|
+
{
|
164
|
+
this.invalidateBounds();
|
165
|
+
};
|
166
|
+
|
167
|
+
/**
|
168
|
+
* Reacts to the `postInvalidate` and insures that prompt display remains correct.
|
169
|
+
*
|
170
|
+
* @signature TextExtPrompt.onPostInvalidate(e)
|
171
|
+
*
|
172
|
+
* @param e {Object} jQuery event.
|
173
|
+
*
|
174
|
+
* @author agorbatchev
|
175
|
+
* @date 2011/08/24
|
176
|
+
* @id TextExtPrompt.onPostInvalidate
|
177
|
+
*/
|
178
|
+
p.onPostInvalidate = function(e)
|
179
|
+
{
|
180
|
+
this.invalidateBounds();
|
181
|
+
};
|
182
|
+
|
183
|
+
/**
|
184
|
+
* Repositions the prompt to make sure it's always at the same place as in the text input carret.
|
185
|
+
*
|
186
|
+
* @signature TextExtPrompt.invalidateBounds()
|
187
|
+
*
|
188
|
+
* @author agorbatchev
|
189
|
+
* @date 2011/08/24
|
190
|
+
* @id TextExtPrompt.invalidateBounds
|
191
|
+
*/
|
192
|
+
p.invalidateBounds = function()
|
193
|
+
{
|
194
|
+
var self = this,
|
195
|
+
input = self.input()
|
196
|
+
;
|
197
|
+
|
198
|
+
self.containerElement().css({
|
199
|
+
paddingLeft : input.css('paddingLeft'),
|
200
|
+
paddingTop : input.css('paddingTop')
|
201
|
+
});
|
202
|
+
};
|
203
|
+
|
204
|
+
/**
|
205
|
+
* Reacts to the `blur` event and shows the prompt effect with a slight delay which
|
206
|
+
* allows quick refocusing without effect blinking in and out.
|
207
|
+
*
|
208
|
+
* The prompt is restored if the text box has no value.
|
209
|
+
*
|
210
|
+
* @signature TextExtPrompt.onBlur(e)
|
211
|
+
*
|
212
|
+
* @param e {Object} jQuery event.
|
213
|
+
*
|
214
|
+
* @author agorbatchev
|
215
|
+
* @date 2011/08/08
|
216
|
+
* @id TextExtPrompt.onBlur
|
217
|
+
*/
|
218
|
+
p.onBlur = function(e)
|
219
|
+
{
|
220
|
+
var self = this;
|
221
|
+
|
222
|
+
self.startTimer('prompt', 0.1, function()
|
223
|
+
{
|
224
|
+
self.showPrompt();
|
225
|
+
});
|
226
|
+
};
|
227
|
+
|
228
|
+
/**
|
229
|
+
* Shows prompt HTML element.
|
230
|
+
*
|
231
|
+
* @signature TextExtPrompt.showPrompt()
|
232
|
+
*
|
233
|
+
* @author agorbatchev
|
234
|
+
* @date 2011/08/22
|
235
|
+
* @id TextExtPrompt.showPrompt
|
236
|
+
*/
|
237
|
+
p.showPrompt = function()
|
238
|
+
{
|
239
|
+
var self = this,
|
240
|
+
input = self.input()
|
241
|
+
;
|
242
|
+
|
243
|
+
if($.trim(self.val()).length === 0 && !input.is(':focus'))
|
244
|
+
self.containerElement().removeClass(CSS_HIDE_PROMPT);
|
245
|
+
};
|
246
|
+
|
247
|
+
/**
|
248
|
+
* Hides prompt HTML element.
|
249
|
+
*
|
250
|
+
* @signature TextExtPrompt.hidePrompt()
|
251
|
+
*
|
252
|
+
* @author agorbatchev
|
253
|
+
* @date 2011/08/22
|
254
|
+
* @id TextExtPrompt.hidePrompt
|
255
|
+
*/
|
256
|
+
p.hidePrompt = function()
|
257
|
+
{
|
258
|
+
this.stopTimer('prompt');
|
259
|
+
this.containerElement().addClass(CSS_HIDE_PROMPT);
|
260
|
+
};
|
261
|
+
|
262
|
+
/**
|
263
|
+
* Reacts to the `focus` event and hides the prompt effect.
|
264
|
+
*
|
265
|
+
* @signature TextExtPrompt.onFocus
|
266
|
+
*
|
267
|
+
* @param e {Object} jQuery event.
|
268
|
+
* @author agorbatchev
|
269
|
+
* @date 2011/08/08
|
270
|
+
* @id TextExtPrompt.onFocus
|
271
|
+
*/
|
272
|
+
p.onFocus = function(e)
|
273
|
+
{
|
274
|
+
this.hidePrompt();
|
275
|
+
};
|
276
|
+
|
277
|
+
//--------------------------------------------------------------------------------
|
278
|
+
// Core functionality
|
279
|
+
|
280
|
+
/**
|
281
|
+
* Sets the prompt display to the specified string.
|
282
|
+
*
|
283
|
+
* @signature TextExtPrompt.setPrompt(str)
|
284
|
+
*
|
285
|
+
* @oaram str {String} String that will be displayed in the prompt.
|
286
|
+
*
|
287
|
+
* @author agorbatchev
|
288
|
+
* @date 2011/08/18
|
289
|
+
* @id TextExtPrompt.setPrompt
|
290
|
+
*/
|
291
|
+
p.setPrompt = function(str)
|
292
|
+
{
|
293
|
+
this.containerElement().text(str);
|
294
|
+
};
|
295
|
+
|
296
|
+
/**
|
297
|
+
* Returns prompt effect HTML element.
|
298
|
+
*
|
299
|
+
* @signature TextExtPrompt.containerElement()
|
300
|
+
*
|
301
|
+
* @author agorbatchev
|
302
|
+
* @date 2011/08/08
|
303
|
+
* @id TextExtPrompt.containerElement
|
304
|
+
*/
|
305
|
+
p.containerElement = function()
|
306
|
+
{
|
307
|
+
return $(this).data('container');
|
308
|
+
};
|
309
|
+
})(jQuery);
|
@@ -0,0 +1,175 @@
|
|
1
|
+
/**
|
2
|
+
* jQuery TextExt Plugin
|
3
|
+
* http://textextjs.com
|
4
|
+
*
|
5
|
+
* @version 1.3.1
|
6
|
+
* @copyright Copyright (C) 2011 Alex Gorbatchev. All rights reserved.
|
7
|
+
* @license MIT License
|
8
|
+
*/
|
9
|
+
(function($)
|
10
|
+
{
|
11
|
+
/**
|
12
|
+
* Suggestions plugin allows to easily specify the list of suggestion items that the
|
13
|
+
* Autocomplete plugin would present to the user.
|
14
|
+
*
|
15
|
+
* @author agorbatchev
|
16
|
+
* @date 2011/08/18
|
17
|
+
* @id TextExtSuggestions
|
18
|
+
*/
|
19
|
+
function TextExtSuggestions() {};
|
20
|
+
|
21
|
+
$.fn.textext.TextExtSuggestions = TextExtSuggestions;
|
22
|
+
$.fn.textext.addPlugin('suggestions', TextExtSuggestions);
|
23
|
+
|
24
|
+
var p = TextExtSuggestions.prototype,
|
25
|
+
/**
|
26
|
+
* Suggestions plugin only has one option and that is to set suggestion items. It could be
|
27
|
+
* changed when passed to the `$().textext()` function. For example:
|
28
|
+
*
|
29
|
+
* $('textarea').textext({
|
30
|
+
* plugins: 'suggestions',
|
31
|
+
* suggestions: [ "item1", "item2" ]
|
32
|
+
* })
|
33
|
+
*
|
34
|
+
* @author agorbatchev
|
35
|
+
* @date 2011/08/18
|
36
|
+
* @id TextExtSuggestions.options
|
37
|
+
*/
|
38
|
+
|
39
|
+
/**
|
40
|
+
* List of items that Autocomplete plugin would display in the dropdown.
|
41
|
+
*
|
42
|
+
* @name suggestions
|
43
|
+
* @default null
|
44
|
+
* @author agorbatchev
|
45
|
+
* @date 2011/08/18
|
46
|
+
* @id TextExtSuggestions.options.suggestions
|
47
|
+
*/
|
48
|
+
OPT_SUGGESTIONS = 'suggestions',
|
49
|
+
|
50
|
+
/**
|
51
|
+
* Suggestions plugin dispatches or reacts to the following events.
|
52
|
+
*
|
53
|
+
* @author agorbatchev
|
54
|
+
* @date 2011/08/17
|
55
|
+
* @id TextExtSuggestions.events
|
56
|
+
*/
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Suggestions plugin reacts to the `getSuggestions` event and returns `suggestions` items
|
60
|
+
* from the options.
|
61
|
+
*
|
62
|
+
* @name getSuggestions
|
63
|
+
* @author agorbatchev
|
64
|
+
* @date 2011/08/19
|
65
|
+
* @id TextExtSuggestions.events.getSuggestions
|
66
|
+
*/
|
67
|
+
|
68
|
+
/**
|
69
|
+
* Suggestions plugin triggers the `setSuggestions` event to pass its own list of `Suggestions`
|
70
|
+
* to the Autocomplete plugin.
|
71
|
+
*
|
72
|
+
* @name setSuggestions
|
73
|
+
* @author agorbatchev
|
74
|
+
* @date 2011/08/19
|
75
|
+
* @id TextExtSuggestions.events.setSuggestions
|
76
|
+
*/
|
77
|
+
|
78
|
+
/**
|
79
|
+
* Suggestions plugin reacts to the `postInit` event to pass its list of `suggestions` to the
|
80
|
+
* Autocomplete right away.
|
81
|
+
*
|
82
|
+
* @name postInit
|
83
|
+
* @author agorbatchev
|
84
|
+
* @date 2011/08/19
|
85
|
+
* @id TextExtSuggestions.events.postInit
|
86
|
+
*/
|
87
|
+
|
88
|
+
DEFAULT_OPTS = {
|
89
|
+
suggestions : null
|
90
|
+
}
|
91
|
+
;
|
92
|
+
|
93
|
+
/**
|
94
|
+
* Initialization method called by the core during plugin instantiation.
|
95
|
+
*
|
96
|
+
* @signature TextExtSuggestions.init(core)
|
97
|
+
*
|
98
|
+
* @param core {TextExt} Instance of the TextExt core class.
|
99
|
+
*
|
100
|
+
* @author agorbatchev
|
101
|
+
* @date 2011/08/18
|
102
|
+
* @id TextExtSuggestions.init
|
103
|
+
*/
|
104
|
+
p.init = function(core)
|
105
|
+
{
|
106
|
+
var self = this;
|
107
|
+
|
108
|
+
self.baseInit(core, DEFAULT_OPTS);
|
109
|
+
|
110
|
+
self.on({
|
111
|
+
getSuggestions : self.onGetSuggestions,
|
112
|
+
postInit : self.onPostInit
|
113
|
+
});
|
114
|
+
};
|
115
|
+
|
116
|
+
/**
|
117
|
+
* Triggers `setSuggestions` and passes supplied suggestions to the Autocomplete plugin.
|
118
|
+
*
|
119
|
+
* @signature TextExtSuggestions.setSuggestions(suggestions, showHideDropdown)
|
120
|
+
*
|
121
|
+
* @param suggestions {Array} List of suggestions. With the default `ItemManager` it should
|
122
|
+
* be a list of strings.
|
123
|
+
* @param showHideDropdown {Boolean} If it's undesirable to show the dropdown right after
|
124
|
+
* suggestions are set, `false` should be passed for this argument.
|
125
|
+
*
|
126
|
+
* @author agorbatchev
|
127
|
+
* @date 2011/08/19
|
128
|
+
* @id TextExtSuggestions.setSuggestions
|
129
|
+
*/
|
130
|
+
p.setSuggestions = function(suggestions, showHideDropdown)
|
131
|
+
{
|
132
|
+
this.trigger('setSuggestions', { result : suggestions, showHideDropdown : showHideDropdown != false });
|
133
|
+
};
|
134
|
+
|
135
|
+
/**
|
136
|
+
* Reacts to the `postInit` event and triggers `setSuggestions` event to set suggestions list
|
137
|
+
* right after initialization.
|
138
|
+
*
|
139
|
+
* @signature TextExtSuggestions.onPostInit(e)
|
140
|
+
*
|
141
|
+
* @param e {Object} jQuery event.
|
142
|
+
*
|
143
|
+
* @author agorbatchev
|
144
|
+
* @date 2011/08/19
|
145
|
+
* @id TextExtSuggestions.onPostInit
|
146
|
+
*/
|
147
|
+
p.onPostInit = function(e)
|
148
|
+
{
|
149
|
+
var self = this;
|
150
|
+
self.setSuggestions(self.opts(OPT_SUGGESTIONS), false);
|
151
|
+
};
|
152
|
+
|
153
|
+
/**
|
154
|
+
* Reacts to the `getSuggestions` event and triggers `setSuggestions` event with the list
|
155
|
+
* of `suggestions` specified in the options.
|
156
|
+
*
|
157
|
+
* @signature TextExtSuggestions.onGetSuggestions(e, data)
|
158
|
+
*
|
159
|
+
* @param e {Object} jQuery event.
|
160
|
+
* @param data {Object} Payload from the `getSuggestions` event with the user query, eg `{ query: {String} }`.
|
161
|
+
*
|
162
|
+
* @author agorbatchev
|
163
|
+
* @date 2011/08/19
|
164
|
+
* @id TextExtSuggestions.onGetSuggestions
|
165
|
+
*/
|
166
|
+
p.onGetSuggestions = function(e, data)
|
167
|
+
{
|
168
|
+
var self = this,
|
169
|
+
suggestions = self.opts(OPT_SUGGESTIONS)
|
170
|
+
;
|
171
|
+
|
172
|
+
suggestions.sort();
|
173
|
+
self.setSuggestions(self.itemManager().filter(suggestions, data.query));
|
174
|
+
};
|
175
|
+
})(jQuery);
|