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,116 @@
|
|
1
|
+
/**
|
2
|
+
* jQuery TextExt Plugin
|
3
|
+
* http://alexgorbatchev.com/textext
|
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
|
+
* Displays a clear search button.
|
13
|
+
*
|
14
|
+
* @author mreinstein
|
15
|
+
* @date 2012/02/19
|
16
|
+
* @id TextExtClear
|
17
|
+
*/
|
18
|
+
function TextExtClear() {};
|
19
|
+
|
20
|
+
$.fn.textext.TextExtClear = TextExtClear;
|
21
|
+
$.fn.textext.addPlugin('clear', TextExtClear);
|
22
|
+
|
23
|
+
var p = TextExtClear.prototype,
|
24
|
+
/**
|
25
|
+
* Clear plugin only has one option and that is its HTML template. It could be
|
26
|
+
* changed when passed to the `$().textext()` function. For example:
|
27
|
+
*
|
28
|
+
* $('textarea').textext({
|
29
|
+
* plugins: 'clear',
|
30
|
+
* html: {
|
31
|
+
* clear: "<span/>"
|
32
|
+
* }
|
33
|
+
* })
|
34
|
+
*
|
35
|
+
* @author mreinstein
|
36
|
+
* @date 2012/02/19
|
37
|
+
* @id TextExtClear.options
|
38
|
+
*/
|
39
|
+
|
40
|
+
/**
|
41
|
+
* HTML source that is used to generate markup required for the clear.
|
42
|
+
*
|
43
|
+
* @name html.clear
|
44
|
+
* @default '<div class="text-clear"/>'
|
45
|
+
* @author mreinstein
|
46
|
+
* @date 2012/02/19
|
47
|
+
* @id TextExtClear.options.html.clear
|
48
|
+
*/
|
49
|
+
OPT_HTML_CLEAR = 'html.clear',
|
50
|
+
|
51
|
+
DEFAULT_OPTS = {
|
52
|
+
html : {
|
53
|
+
clear : '<div class="text-clear"/>'
|
54
|
+
}
|
55
|
+
};
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Initialization method called by the core during plugin instantiation.
|
59
|
+
*
|
60
|
+
* @signature TextExtClear.init(core)
|
61
|
+
*
|
62
|
+
* @param core {TextExt} Instance of the TextExt core class.
|
63
|
+
*
|
64
|
+
* @author agorbatchev
|
65
|
+
* @date 2011/12/27
|
66
|
+
* @id TextExtClear.init
|
67
|
+
*/
|
68
|
+
p.init = function(core)
|
69
|
+
{
|
70
|
+
var self = this,
|
71
|
+
clear
|
72
|
+
;
|
73
|
+
|
74
|
+
self.baseInit(core, DEFAULT_OPTS);
|
75
|
+
|
76
|
+
self._clear = clear = $(self.opts(OPT_HTML_CLEAR));
|
77
|
+
self.core().wrapElement().append(clear);
|
78
|
+
clear.bind('click', function(e) { self.onClearClick(e); });
|
79
|
+
};
|
80
|
+
|
81
|
+
//--------------------------------------------------------------------------------
|
82
|
+
// Event handlers
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Reacts to the `click` event whenever user clicks the clear.
|
86
|
+
*
|
87
|
+
* @signature TextExtClear.onClearClick(e)
|
88
|
+
*
|
89
|
+
* @param e {Object} jQuery event.
|
90
|
+
* @author agorbatchev
|
91
|
+
* @date 2011/12/27
|
92
|
+
* @id TextExtClear.onClearClick
|
93
|
+
*/
|
94
|
+
p.onClearClick = function(e)
|
95
|
+
{
|
96
|
+
var self = this;
|
97
|
+
|
98
|
+
// check if the tags plugin is present
|
99
|
+
if(typeof self.core()._plugins.tags != 'undefined')
|
100
|
+
{
|
101
|
+
// it is! remove all tags
|
102
|
+
var elems = self.core()._plugins.tags.tagElements();
|
103
|
+
for(var i =0; i < elems.length;i++)
|
104
|
+
{
|
105
|
+
self.core()._plugins.tags.removeTag($(elems[i]));
|
106
|
+
}
|
107
|
+
}
|
108
|
+
// clear the text from the search area
|
109
|
+
self.val('');
|
110
|
+
self.core().getFormData();
|
111
|
+
};
|
112
|
+
|
113
|
+
//--------------------------------------------------------------------------------
|
114
|
+
// Core functionality
|
115
|
+
|
116
|
+
})(jQuery);
|
@@ -0,0 +1,242 @@
|
|
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
|
+
* The Filter plugin introduces ability to limit input that the text field
|
13
|
+
* will accept. If the Tags plugin is used, Filter plugin will limit which
|
14
|
+
* tags it's possible to add.
|
15
|
+
*
|
16
|
+
* The list of allowed items can be either specified through the
|
17
|
+
* options, can come from the Suggestions plugin or be loaded by the Ajax
|
18
|
+
* plugin. All these plugins have one thing in common -- they
|
19
|
+
* trigger `setSuggestions` event which the Filter plugin is expecting.
|
20
|
+
*
|
21
|
+
* @author agorbatchev
|
22
|
+
* @date 2011/08/18
|
23
|
+
* @id TextExtFilter
|
24
|
+
*/
|
25
|
+
function TextExtFilter() {};
|
26
|
+
|
27
|
+
$.fn.textext.TextExtFilter = TextExtFilter;
|
28
|
+
$.fn.textext.addPlugin('filter', TextExtFilter);
|
29
|
+
|
30
|
+
var p = TextExtFilter.prototype,
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Filter plugin options are grouped under `filter` when passed to the
|
34
|
+
* `$().textext()` function. For example:
|
35
|
+
*
|
36
|
+
* $('textarea').textext({
|
37
|
+
* plugins: 'filter',
|
38
|
+
* filter: {
|
39
|
+
* items: [ "item1", "item2" ]
|
40
|
+
* }
|
41
|
+
* })
|
42
|
+
*
|
43
|
+
* @author agorbatchev
|
44
|
+
* @date 2011/08/18
|
45
|
+
* @id TextExtFilter.options
|
46
|
+
*/
|
47
|
+
|
48
|
+
/**
|
49
|
+
* This is a toggle switch to enable or disable the Filter plugin. The value is checked
|
50
|
+
* each time at the top level which allows you to toggle this setting on the fly.
|
51
|
+
*
|
52
|
+
* @name filter.enabled
|
53
|
+
* @default true
|
54
|
+
* @author agorbatchev
|
55
|
+
* @date 2011/08/18
|
56
|
+
* @id TextExtFilter.options.enabled
|
57
|
+
*/
|
58
|
+
OPT_ENABLED = 'filter.enabled',
|
59
|
+
|
60
|
+
/**
|
61
|
+
* Arra of items that the Filter plugin will allow the Tag plugin to add to the list of
|
62
|
+
* its resut tags. Each item by default is expected to be a string which default `ItemManager`
|
63
|
+
* can work with. You can change the item type by supplying custom `ItemManager`.
|
64
|
+
*
|
65
|
+
* @name filter.items
|
66
|
+
* @default null
|
67
|
+
* @author agorbatchev
|
68
|
+
* @date 2011/08/18
|
69
|
+
* @id TextExtFilter.options.items
|
70
|
+
*/
|
71
|
+
OPT_ITEMS = 'filter.items',
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Filter plugin dispatches and reacts to the following events.
|
75
|
+
*
|
76
|
+
* @author agorbatchev
|
77
|
+
* @date 2011/08/18
|
78
|
+
* @id TextExtFilter.events
|
79
|
+
*/
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Filter plugin reacts to the `isTagAllowed` event triggered by the Tags plugin before
|
83
|
+
* adding a new tag to the list. If the new tag is among the `items` specified in options,
|
84
|
+
* then the new tag will be allowed.
|
85
|
+
*
|
86
|
+
* @name isTagAllowed
|
87
|
+
* @author agorbatchev
|
88
|
+
* @date 2011/08/18
|
89
|
+
* @id TextExtFilter.events.isTagAllowed
|
90
|
+
*/
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Filter plugin reacts to the `setSuggestions` event triggered by other plugins like
|
94
|
+
* Suggestions and Ajax.
|
95
|
+
*
|
96
|
+
* However, event if this event is handled and items are passed with it and stored, if `items`
|
97
|
+
* option was supplied, it will always take precedense.
|
98
|
+
*
|
99
|
+
* @name setSuggestions
|
100
|
+
* @author agorbatchev
|
101
|
+
* @date 2011/08/18
|
102
|
+
* @id TextExtFilter.events.setSuggestions
|
103
|
+
*/
|
104
|
+
|
105
|
+
DEFAULT_OPTS = {
|
106
|
+
filter : {
|
107
|
+
enabled : true,
|
108
|
+
items : null
|
109
|
+
}
|
110
|
+
}
|
111
|
+
;
|
112
|
+
|
113
|
+
/**
|
114
|
+
* Initialization method called by the core during plugin instantiation.
|
115
|
+
*
|
116
|
+
* @signature TextExtFilter.init(core)
|
117
|
+
*
|
118
|
+
* @param core {TextExt} Instance of the TextExt core class.
|
119
|
+
*
|
120
|
+
* @author agorbatchev
|
121
|
+
* @date 2011/08/18
|
122
|
+
* @id TextExtFilter.init
|
123
|
+
*/
|
124
|
+
p.init = function(core)
|
125
|
+
{
|
126
|
+
var self = this;
|
127
|
+
self.baseInit(core, DEFAULT_OPTS);
|
128
|
+
|
129
|
+
self.on({
|
130
|
+
getFormData : self.onGetFormData,
|
131
|
+
isTagAllowed : self.onIsTagAllowed,
|
132
|
+
setSuggestions : self.onSetSuggestions
|
133
|
+
});
|
134
|
+
|
135
|
+
self._suggestions = null;
|
136
|
+
};
|
137
|
+
|
138
|
+
//--------------------------------------------------------------------------------
|
139
|
+
// Core functionality
|
140
|
+
|
141
|
+
/**
|
142
|
+
* Reacts to the [`getFormData`][1] event triggered by the core. Returns data with the
|
143
|
+
* weight of 200 to be *greater than the Autocomplete plugins* data weights.
|
144
|
+
* The weights system is covered in greater detail in the [`getFormData`][1] event
|
145
|
+
* documentation.
|
146
|
+
*
|
147
|
+
* This method does nothing if Tags tag is also present.
|
148
|
+
*
|
149
|
+
* [1]: /manual/textext.html#getformdata
|
150
|
+
*
|
151
|
+
* @signature TextExtFilter.onGetFormData(e, data, keyCode)
|
152
|
+
*
|
153
|
+
* @param e {Object} jQuery event.
|
154
|
+
* @param data {Object} Data object to be populated.
|
155
|
+
* @param keyCode {Number} Key code that triggered the original update request.
|
156
|
+
*
|
157
|
+
* @author agorbatchev
|
158
|
+
* @date 2011/12/28
|
159
|
+
* @id TextExtFilter.onGetFormData
|
160
|
+
* @version 1.1
|
161
|
+
*/
|
162
|
+
p.onGetFormData = function(e, data, keyCode)
|
163
|
+
{
|
164
|
+
var self = this,
|
165
|
+
val = self.val(),
|
166
|
+
inputValue = val,
|
167
|
+
formValue = ''
|
168
|
+
;
|
169
|
+
|
170
|
+
if(!self.core().hasPlugin('tags'))
|
171
|
+
{
|
172
|
+
if(self.isValueAllowed(inputValue))
|
173
|
+
formValue = val;
|
174
|
+
|
175
|
+
data[300] = self.formDataObject(inputValue, formValue);
|
176
|
+
}
|
177
|
+
};
|
178
|
+
|
179
|
+
/**
|
180
|
+
* Checks given value if it's present in `filterItems` or was loaded for the Autocomplete
|
181
|
+
* or by the Suggestions plugins. `value` is compared to each item using `ItemManager.compareItems`
|
182
|
+
* method which is currently attached to the core. Returns `true` if value is known or
|
183
|
+
* Filter plugin is disabled.
|
184
|
+
*
|
185
|
+
* @signature TextExtFilter.isValueAllowed(value)
|
186
|
+
*
|
187
|
+
* @param value {Object} Value to check.
|
188
|
+
*
|
189
|
+
* @author agorbatchev
|
190
|
+
* @date 2011/12/28
|
191
|
+
* @id TextExtFilter.isValueAllowed
|
192
|
+
* @version 1.1
|
193
|
+
*/
|
194
|
+
p.isValueAllowed = function(value)
|
195
|
+
{
|
196
|
+
var self = this,
|
197
|
+
list = self.opts('filterItems') || self._suggestions || [],
|
198
|
+
itemManager = self.itemManager(),
|
199
|
+
result = !self.opts(OPT_ENABLED), // if disabled, should just return true
|
200
|
+
i
|
201
|
+
;
|
202
|
+
|
203
|
+
for(i = 0; i < list.length && !result; i++)
|
204
|
+
if(itemManager.compareItems(value, list[i]))
|
205
|
+
result = true;
|
206
|
+
|
207
|
+
return result;
|
208
|
+
};
|
209
|
+
|
210
|
+
/**
|
211
|
+
* Handles `isTagAllowed` event dispatched by the Tags plugin. If supplied tag is not
|
212
|
+
* in the `items` list, method sets `result` on the `data` argument to `false`.
|
213
|
+
*
|
214
|
+
* @signature TextExtFilter.onIsTagAllowed(e, data)
|
215
|
+
*
|
216
|
+
* @param e {Object} jQuery event.
|
217
|
+
* @param data {Object} Payload in the following format : `{ tag : {Object}, result : {Boolean} }`.
|
218
|
+
* @author agorbatchev
|
219
|
+
* @date 2011/08/04
|
220
|
+
* @id TextExtFilter.onIsTagAllowed
|
221
|
+
*/
|
222
|
+
p.onIsTagAllowed = function(e, data)
|
223
|
+
{
|
224
|
+
data.result = this.isValueAllowed(data.tag);
|
225
|
+
};
|
226
|
+
|
227
|
+
/**
|
228
|
+
* Reacts to the `setSuggestions` events and stores supplied suggestions for future use.
|
229
|
+
*
|
230
|
+
* @signature TextExtFilter.onSetSuggestions(e, data)
|
231
|
+
*
|
232
|
+
* @param e {Object} jQuery event.
|
233
|
+
* @param data {Object} Payload in the following format : `{ result : {Array} } }`.
|
234
|
+
* @author agorbatchev
|
235
|
+
* @date 2011/08/18
|
236
|
+
* @id TextExtFilter.onSetSuggestions
|
237
|
+
*/
|
238
|
+
p.onSetSuggestions = function(e, data)
|
239
|
+
{
|
240
|
+
this._suggestions = data.result;
|
241
|
+
};
|
242
|
+
})(jQuery);
|
@@ -0,0 +1,174 @@
|
|
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
|
+
* Focus plugin displays a visual effect whenever user sets focus
|
13
|
+
* into the text area.
|
14
|
+
*
|
15
|
+
* @author agorbatchev
|
16
|
+
* @date 2011/08/18
|
17
|
+
* @id TextExtFocus
|
18
|
+
*/
|
19
|
+
function TextExtFocus() {};
|
20
|
+
|
21
|
+
$.fn.textext.TextExtFocus = TextExtFocus;
|
22
|
+
$.fn.textext.addPlugin('focus', TextExtFocus);
|
23
|
+
|
24
|
+
var p = TextExtFocus.prototype,
|
25
|
+
/**
|
26
|
+
* Focus plugin only has one option and that is its HTML template. It could be
|
27
|
+
* changed when passed to the `$().textext()` function. For example:
|
28
|
+
*
|
29
|
+
* $('textarea').textext({
|
30
|
+
* plugins: 'focus',
|
31
|
+
* html: {
|
32
|
+
* focus: "<span/>"
|
33
|
+
* }
|
34
|
+
* })
|
35
|
+
*
|
36
|
+
* @author agorbatchev
|
37
|
+
* @date 2011/08/18
|
38
|
+
* @id TextExtFocus.options
|
39
|
+
*/
|
40
|
+
|
41
|
+
/**
|
42
|
+
* HTML source that is used to generate markup required for the focus effect.
|
43
|
+
*
|
44
|
+
* @name html.focus
|
45
|
+
* @default '<div class="text-focus"/>'
|
46
|
+
* @author agorbatchev
|
47
|
+
* @date 2011/08/18
|
48
|
+
* @id TextExtFocus.options.html.focus
|
49
|
+
*/
|
50
|
+
OPT_HTML_FOCUS = 'html.focus',
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Focus plugin dispatches or reacts to the following events.
|
54
|
+
*
|
55
|
+
* @author agorbatchev
|
56
|
+
* @date 2011/08/17
|
57
|
+
* @id TextExtFocus.events
|
58
|
+
*/
|
59
|
+
|
60
|
+
/**
|
61
|
+
* Focus plugin reacts to the `focus` event and shows the markup generated from
|
62
|
+
* the `html.focus` option.
|
63
|
+
*
|
64
|
+
* @name focus
|
65
|
+
* @author agorbatchev
|
66
|
+
* @date 2011/08/18
|
67
|
+
* @id TextExtFocus.events.focus
|
68
|
+
*/
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Focus plugin reacts to the `blur` event and hides the effect.
|
72
|
+
*
|
73
|
+
* @name blur
|
74
|
+
* @author agorbatchev
|
75
|
+
* @date 2011/08/18
|
76
|
+
* @id TextExtFocus.events.blur
|
77
|
+
*/
|
78
|
+
|
79
|
+
DEFAULT_OPTS = {
|
80
|
+
html : {
|
81
|
+
focus : '<div class="text-focus"/>'
|
82
|
+
}
|
83
|
+
}
|
84
|
+
;
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Initialization method called by the core during plugin instantiation.
|
88
|
+
*
|
89
|
+
* @signature TextExtFocus.init(core)
|
90
|
+
*
|
91
|
+
* @param core {TextExt} Instance of the TextExt core class.
|
92
|
+
*
|
93
|
+
* @author agorbatchev
|
94
|
+
* @date 2011/08/18
|
95
|
+
* @id TextExtFocus.init
|
96
|
+
*/
|
97
|
+
p.init = function(core)
|
98
|
+
{
|
99
|
+
var self = this;
|
100
|
+
|
101
|
+
self.baseInit(core, DEFAULT_OPTS);
|
102
|
+
self.core().wrapElement().append(self.opts(OPT_HTML_FOCUS));
|
103
|
+
self.on({
|
104
|
+
blur : self.onBlur,
|
105
|
+
focus : self.onFocus
|
106
|
+
});
|
107
|
+
|
108
|
+
self._timeoutId = 0;
|
109
|
+
};
|
110
|
+
|
111
|
+
//--------------------------------------------------------------------------------
|
112
|
+
// Event handlers
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Reacts to the `blur` event and hides the focus effect with a slight delay which
|
116
|
+
* allows quick refocusing without effect blinking in and out.
|
117
|
+
*
|
118
|
+
* @signature TextExtFocus.onBlur(e)
|
119
|
+
*
|
120
|
+
* @param e {Object} jQuery event.
|
121
|
+
*
|
122
|
+
* @author agorbatchev
|
123
|
+
* @date 2011/08/08
|
124
|
+
* @id TextExtFocus.onBlur
|
125
|
+
*/
|
126
|
+
p.onBlur = function(e)
|
127
|
+
{
|
128
|
+
var self = this;
|
129
|
+
|
130
|
+
clearTimeout(self._timeoutId);
|
131
|
+
|
132
|
+
self._timeoutId = setTimeout(function()
|
133
|
+
{
|
134
|
+
self.getFocus().hide();
|
135
|
+
},
|
136
|
+
100);
|
137
|
+
};
|
138
|
+
|
139
|
+
/**
|
140
|
+
* Reacts to the `focus` event and shows the focus effect.
|
141
|
+
*
|
142
|
+
* @signature TextExtFocus.onFocus
|
143
|
+
*
|
144
|
+
* @param e {Object} jQuery event.
|
145
|
+
* @author agorbatchev
|
146
|
+
* @date 2011/08/08
|
147
|
+
* @id TextExtFocus.onFocus
|
148
|
+
*/
|
149
|
+
p.onFocus = function(e)
|
150
|
+
{
|
151
|
+
var self = this;
|
152
|
+
|
153
|
+
clearTimeout(self._timeoutId);
|
154
|
+
|
155
|
+
self.getFocus().show();
|
156
|
+
};
|
157
|
+
|
158
|
+
//--------------------------------------------------------------------------------
|
159
|
+
// Core functionality
|
160
|
+
|
161
|
+
/**
|
162
|
+
* Returns focus effect HTML element.
|
163
|
+
*
|
164
|
+
* @signature TextExtFocus.getFocus()
|
165
|
+
*
|
166
|
+
* @author agorbatchev
|
167
|
+
* @date 2011/08/08
|
168
|
+
* @id TextExtFocus.getFocus
|
169
|
+
*/
|
170
|
+
p.getFocus = function()
|
171
|
+
{
|
172
|
+
return this.core().wrapElement().find('.text-focus');
|
173
|
+
};
|
174
|
+
})(jQuery);
|