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
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'active_support/concern'
|
2
|
-
|
3
|
-
module Georgia
|
4
|
-
module Concerns
|
5
|
-
module Slugable
|
6
|
-
extend ActiveSupport::Concern
|
7
|
-
|
8
|
-
included do
|
9
|
-
|
10
|
-
attr_accessible :slug, :url
|
11
|
-
|
12
|
-
validates :slug, format: {with: /^[a-zA-Z0-9_-]+$/, message: 'can only consist of letters, numbers, dash (-) and underscore (_)'}#, uniqueness: {scope: [:ancestry, :type], message: 'has already been taken'}
|
13
|
-
|
14
|
-
before_validation :sanitize_slug
|
15
|
-
after_save :update_url
|
16
|
-
|
17
|
-
scope :from_url, -> (path) { where(url: "/#{path}").includes(current_revision: :contents) }
|
18
|
-
|
19
|
-
# Must stay public for #update_url on descendants
|
20
|
-
def set_url
|
21
|
-
self.update_column(:url, '/' + self.ancestry_url)
|
22
|
-
end
|
23
|
-
|
24
|
-
protected
|
25
|
-
|
26
|
-
def sanitize_slug
|
27
|
-
self.slug ||= ''
|
28
|
-
self.slug.gsub!(/^\/*/, '').gsub!(/\/*$/, '')
|
29
|
-
end
|
30
|
-
|
31
|
-
def update_url
|
32
|
-
if slug_changed? or ancestry_changed?
|
33
|
-
self.set_url
|
34
|
-
self.descendants.each(&:set_url) if !self.new_record? and self.has_children?
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def ancestry_url
|
39
|
-
(ancestors + [self]).map(&:slug).join('/')
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
module ClassMethods
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'active_support/concern'
|
2
|
-
|
3
|
-
module Georgia
|
4
|
-
module Concerns
|
5
|
-
module Statable
|
6
|
-
extend ActiveSupport::Concern
|
7
|
-
|
8
|
-
included do
|
9
|
-
|
10
|
-
attr_accessible :state
|
11
|
-
state_machine :state, initial: :draft do
|
12
|
-
|
13
|
-
state :published
|
14
|
-
state :draft
|
15
|
-
state :review
|
16
|
-
state :revision
|
17
|
-
|
18
|
-
# Drafts
|
19
|
-
event :review do
|
20
|
-
transition all => :review
|
21
|
-
end
|
22
|
-
|
23
|
-
# Reviews
|
24
|
-
event :approve do
|
25
|
-
transition [:draft, :review] => :published
|
26
|
-
end
|
27
|
-
event :decline do
|
28
|
-
transition :review => :draft
|
29
|
-
end
|
30
|
-
|
31
|
-
# Published
|
32
|
-
event :store do
|
33
|
-
transition :published => :revision
|
34
|
-
end
|
35
|
-
event :unpublish do
|
36
|
-
transition :published => :draft
|
37
|
-
end
|
38
|
-
|
39
|
-
# Revisions
|
40
|
-
event :restore do
|
41
|
-
transition :revision => :published
|
42
|
-
end
|
43
|
-
|
44
|
-
before_transition any => :published do |revision, transition|
|
45
|
-
revision.revisionable.approve_revision(revision)
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
scope :published, with_states(:published)
|
51
|
-
scope :drafts, with_states(:draft)
|
52
|
-
scope :reviews, with_states(:review)
|
53
|
-
scope :stored, with_states(:revision)
|
54
|
-
|
55
|
-
def status_name
|
56
|
-
warn "[DEPRECATION] `status_name` is deprecated. Please use `human_state_name` instead."
|
57
|
-
human_state_name
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'active_support/concern'
|
2
|
-
|
3
|
-
module Georgia
|
4
|
-
module Concerns
|
5
|
-
module Templatable
|
6
|
-
extend ActiveSupport::Concern
|
7
|
-
|
8
|
-
included do
|
9
|
-
|
10
|
-
attr_accessible :template
|
11
|
-
|
12
|
-
validates :template, inclusion: {in: Georgia.templates, message: "%{value} is not a valid template" }
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
module ClassMethods
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,92 +0,0 @@
|
|
1
|
-
module Georgia
|
2
|
-
class PageActionsPresenter < Presenter
|
3
|
-
|
4
|
-
attr_accessor :page, :revision, :options
|
5
|
-
|
6
|
-
def initialize view, page, revision, options={}
|
7
|
-
@page = (page.decorated? ? page.object : page)
|
8
|
-
@revision = (revision.decorated? ? revision.object : revision)
|
9
|
-
@options = options
|
10
|
-
super
|
11
|
-
end
|
12
|
-
|
13
|
-
def to_s
|
14
|
-
content_tag :div, class: 'dropdown' do
|
15
|
-
link_to("Actions #{caret_tag}".html_safe, '#', role: :button, class: 'btn btn-warning', data: {toggle: 'dropdown'}) +
|
16
|
-
content_tag(:ul, action_list, class: 'dropdown-menu', role: :menu)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def action_list
|
21
|
-
html = ActiveSupport::SafeBuffer.new
|
22
|
-
html << content_tag(:li, link_to_edit) if can?(:edit, page)
|
23
|
-
# html << content_tag(:li, link_to_settings) if can?(:settings, page)
|
24
|
-
html << content_tag(:li, link_to_preview) if can?(:preview, page)
|
25
|
-
html << content_tag(:li, link_to_copy) if can?(:copy, page)
|
26
|
-
html << content_tag(:li, link_to_publish) if can?(:publish, page) and !page.published?
|
27
|
-
html << content_tag(:li, link_to_unpublish) if can?(:unpublish, page) and page.published?
|
28
|
-
html << content_tag(:li, link_to_flush_cache) if can?(:flush_cache, page)
|
29
|
-
html << content_tag(:li, link_to_revisions) if can?(:index, Revision)
|
30
|
-
html
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def link_to_preview
|
36
|
-
link_to "#{icon_tag('eye')} Preview".html_safe, [:preview, page, revision], options.reverse_merge(target: '_blank')
|
37
|
-
end
|
38
|
-
|
39
|
-
def link_to_settings
|
40
|
-
link_to "#{icon_tag('cogs')} Settings".html_safe, [:settings, page], options
|
41
|
-
end
|
42
|
-
|
43
|
-
def link_to_edit
|
44
|
-
link_to "#{icon_tag('pencil')} Edit".html_safe, [:edit, page], options
|
45
|
-
end
|
46
|
-
|
47
|
-
def link_to_settings
|
48
|
-
link_to "#{icon_tag('cogs')} Settings".html_safe, [:settings, page], options
|
49
|
-
end
|
50
|
-
|
51
|
-
def link_to_copy
|
52
|
-
link_to "#{icon_tag('copy')} Copy".html_safe, [:copy, page], options
|
53
|
-
end
|
54
|
-
|
55
|
-
def link_to_flush_cache
|
56
|
-
link_to "#{icon_tag('fire-extinguisher')} Flush Cache".html_safe, georgia.flush_cache_pages_path(id: [page.id]), options.merge(method: :post)
|
57
|
-
end
|
58
|
-
|
59
|
-
def link_to_publish
|
60
|
-
link_to "#{icon_tag('thumbs-up')} Publish".html_safe, georgia.publish_pages_path(id: [page.id]), options.merge(method: :post)
|
61
|
-
end
|
62
|
-
|
63
|
-
def link_to_unpublish
|
64
|
-
link_to "#{icon_tag('thumbs-down')} Unpublish".html_safe, georgia.unpublish_pages_path(id: [page.id]), options.merge(data: {confirm: 'Are you sure?'}, method: :post)
|
65
|
-
end
|
66
|
-
|
67
|
-
def link_to_review
|
68
|
-
link_to "#{icon_tag('flag')} Ask for Review".html_safe, [:review, page], options
|
69
|
-
end
|
70
|
-
|
71
|
-
def link_to_approve
|
72
|
-
link_to "#{icon_tag('thumbs-up')} Approve".html_safe, [:approve, page], options
|
73
|
-
end
|
74
|
-
|
75
|
-
def link_to_decline
|
76
|
-
link_to "#{icon_tag('thumbs-down')} Decline".html_safe, [:decline, page], options
|
77
|
-
end
|
78
|
-
|
79
|
-
def link_to_delete
|
80
|
-
options = {}
|
81
|
-
options[:data] ||= {}
|
82
|
-
options[:data][:confirm] = 'Are you sure?'
|
83
|
-
options[:method] ||= :delete
|
84
|
-
link_to "#{icon_tag('icon-trash')} Delete".html_safe, page, options
|
85
|
-
end
|
86
|
-
|
87
|
-
def link_to_revisions
|
88
|
-
link_to "#{icon_tag('copy')} Revisions".html_safe, [page, :revisions], options
|
89
|
-
end
|
90
|
-
|
91
|
-
end
|
92
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
module Georgia
|
2
|
-
class WarningMessage < Presenter
|
3
|
-
|
4
|
-
attr_reader :page, :revision, :options
|
5
|
-
|
6
|
-
def initialize view_context, page, revision, options={}
|
7
|
-
@page = page
|
8
|
-
@revision = revision
|
9
|
-
@options = options
|
10
|
-
super
|
11
|
-
end
|
12
|
-
|
13
|
-
def to_s
|
14
|
-
return nil unless message
|
15
|
-
html = ActiveSupport::SafeBuffer.new
|
16
|
-
html << warning_icon_tag
|
17
|
-
html << message
|
18
|
-
content_tag(:div, content_tag(:p, html), class: 'warning-message')
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def warning_icon_tag
|
24
|
-
content_tag(:span, icon_tag('warning'), class: 'label label-warning')
|
25
|
-
end
|
26
|
-
|
27
|
-
def message
|
28
|
-
case revision.state
|
29
|
-
when 'review' then review_message
|
30
|
-
when 'revision' then revision_message
|
31
|
-
else nil
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def review_message
|
36
|
-
review_message = "This revision is awaiting review from an Editor."
|
37
|
-
if can? :approve, revision
|
38
|
-
review_message << " #{link_to 'Approve Changes', [:approve, page, revision], class: 'btn btn-primary btn-xs'}"
|
39
|
-
elsif can? :review, revision
|
40
|
-
review_message << " #{link_to 'Request Review', [:review, page, revision], class: 'btn btn-primary btn-xs'}"
|
41
|
-
end
|
42
|
-
review_message.html_safe
|
43
|
-
end
|
44
|
-
|
45
|
-
def revision_message
|
46
|
-
return nil if current_revision?
|
47
|
-
revision_message ||= "You are looking at a past revision. Updating this content will not change anything on your website. Click #{link_to 'here', [:edit, @page, @page.current_revision], class: 'text-primary'} to edit the current revision.".html_safe
|
48
|
-
end
|
49
|
-
|
50
|
-
def current_revision?
|
51
|
-
@is_current_revision ||= page.current_revision == revision
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
class CreateMediaAsset
|
2
|
-
|
3
|
-
require 'carrierwave/processing/mini_magick'
|
4
|
-
|
5
|
-
def initialize file
|
6
|
-
@file = file
|
7
|
-
@asset = klass.new(data: file)
|
8
|
-
end
|
9
|
-
|
10
|
-
# Returns created asset
|
11
|
-
def call
|
12
|
-
extract_content_type
|
13
|
-
set_file_name
|
14
|
-
set_size
|
15
|
-
read_dimensions
|
16
|
-
@asset.save!
|
17
|
-
@asset
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def read_dimensions
|
23
|
-
if @asset.image? && @asset.has_dimensions?
|
24
|
-
magick = ::MiniMagick::Image.new(@asset.data.current_path)
|
25
|
-
@asset.width, @asset.height = magick[:width], magick[:height]
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def extract_content_type
|
30
|
-
if @file.content_type == 'application/octet-stream' || @file.content_type.blank?
|
31
|
-
content_type = MIME::Types.type_for(@file.original_filename).first
|
32
|
-
else
|
33
|
-
content_type = @file.content_type
|
34
|
-
end
|
35
|
-
|
36
|
-
@asset.data_content_type = content_type.to_s
|
37
|
-
end
|
38
|
-
|
39
|
-
def set_file_name
|
40
|
-
@asset.data_file_name = @file.original_filename
|
41
|
-
end
|
42
|
-
|
43
|
-
def set_size
|
44
|
-
@asset.data_file_size = @file.size
|
45
|
-
end
|
46
|
-
|
47
|
-
def klass
|
48
|
-
@file.content_type.match(/^image/) ? Ckeditor::Picture : Ckeditor::Asset
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
class NavigationSweeper < ActionController::Caching::Sweeper
|
2
|
-
observe Georgia::Menu
|
3
|
-
|
4
|
-
# Clear all cache when updating the menu.
|
5
|
-
# Menu is present on all pages. It also changes for each page because of the 'active' link.
|
6
|
-
def sweep(menu)
|
7
|
-
Rails.cache.clear
|
8
|
-
end
|
9
|
-
alias_method :after_save, :sweep
|
10
|
-
alias_method :after_touch, :sweep
|
11
|
-
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
<div class="well sidebar-nav">
|
2
|
-
<ul class="nav nav-list">
|
3
|
-
<% if @search %>
|
4
|
-
<li class="nav-header">Extension</li>
|
5
|
-
<%= render partial: 'georgia/facets/facet', collection: @search.facet(:extension).rows, as: :facet, locals: {filter: :e} %>
|
6
|
-
<li class="nav-header">File Size</li>
|
7
|
-
<%= render partial: 'georgia/facets/facet', collection: @search.facet(:size).rows, as: :facet, locals: {filter: :s} %>
|
8
|
-
<li class="nav-header">Tags</li>
|
9
|
-
<%= render partial: 'georgia/facets/array_facet', collection: @search.facet(:tags).rows, as: :facet, locals: {filter: :tg, multiple: true} %>
|
10
|
-
<% end -%>
|
11
|
-
</ul>
|
12
|
-
</div>
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<div class='btn-group'>
|
2
|
-
<%= link_to "#{link.try(:title)} <span class='caret'></span>".html_safe, '#', class: 'btn dropdown-toggle', data: {toggle: 'dropdown'} %>
|
3
|
-
<ul class="dropdown-menu">
|
4
|
-
<% link.page.children.published.decorate.each do |child| %>
|
5
|
-
<li><%= link_to child.try(:title), url_for(child.url) if child.published? %></li>
|
6
|
-
<% end -%>
|
7
|
-
<li class='divider'></li>
|
8
|
-
<li><%= link_to 'Browse All', url_for(link.text) %></li>
|
9
|
-
</ul>
|
10
|
-
</div>
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<div class='row-fluid'>
|
2
|
-
<div class='btn-toolbar'>
|
3
|
-
<% links.each do |link| %>
|
4
|
-
<% if link.dropdown? and link.page.present? %>
|
5
|
-
<%= render 'menus/dropdown_group', link: link %>
|
6
|
-
<% else -%>
|
7
|
-
<%= render 'menus/dropdown_link', link: link %>
|
8
|
-
<% end -%>
|
9
|
-
<% end -%>
|
10
|
-
</div>
|
11
|
-
</div>
|
@@ -1 +0,0 @@
|
|
1
|
-
<li class="<%= "active" if current_page? link.url %>"><%= link_to link.title, url_for(link.url) %></li>
|
@@ -1,79 +0,0 @@
|
|
1
|
-
# http://stackoverflow.com/questions/14972253/simpleform-default-input-class
|
2
|
-
# https://github.com/plataformatec/simple_form/issues/316
|
3
|
-
|
4
|
-
inputs = %w[
|
5
|
-
CollectionSelectInput
|
6
|
-
DateTimeInput
|
7
|
-
FileInput
|
8
|
-
GroupedCollectionSelectInput
|
9
|
-
NumericInput
|
10
|
-
PasswordInput
|
11
|
-
RangeInput
|
12
|
-
StringInput
|
13
|
-
TextInput
|
14
|
-
]
|
15
|
-
|
16
|
-
inputs.each do |input_type|
|
17
|
-
superclass = "SimpleForm::Inputs::#{input_type}".constantize
|
18
|
-
|
19
|
-
new_class = Class.new(superclass) do
|
20
|
-
def input_html_classes
|
21
|
-
super.push('form-control')
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
Object.const_set(input_type, new_class)
|
26
|
-
end
|
27
|
-
|
28
|
-
# Use this setup block to configure all options available in SimpleForm.
|
29
|
-
SimpleForm.setup do |config|
|
30
|
-
config.boolean_style = :nested
|
31
|
-
|
32
|
-
config.wrappers :bootstrap3, tag: 'div', class: 'form-group', error_class: 'has-error',
|
33
|
-
defaults: { input_html: { class: 'default_class' } } do |b|
|
34
|
-
|
35
|
-
b.use :html5
|
36
|
-
|
37
|
-
b.use :min_max
|
38
|
-
b.use :maxlength
|
39
|
-
b.use :placeholder
|
40
|
-
b.optional :pattern
|
41
|
-
b.optional :readonly
|
42
|
-
|
43
|
-
b.use :label_input
|
44
|
-
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
45
|
-
b.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
|
46
|
-
end
|
47
|
-
|
48
|
-
config.wrappers :prepend, tag: 'div', class: "form-group", error_class: 'error' do |b|
|
49
|
-
b.use :html5
|
50
|
-
b.use :placeholder
|
51
|
-
b.use :label
|
52
|
-
b.wrapper tag: 'div', class: 'controls' do |input|
|
53
|
-
input.wrapper tag: 'div', class: 'input-prepend' do |prepend|
|
54
|
-
prepend.use :input
|
55
|
-
end
|
56
|
-
input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
|
57
|
-
input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
config.wrappers :append, tag: 'div', class: "control-group", error_class: 'error' do |b|
|
62
|
-
b.use :html5
|
63
|
-
b.use :placeholder
|
64
|
-
b.use :label
|
65
|
-
b.wrapper tag: 'div', class: 'controls' do |input|
|
66
|
-
input.wrapper tag: 'div', class: 'input-append' do |append|
|
67
|
-
append.use :input
|
68
|
-
end
|
69
|
-
input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
|
70
|
-
input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
|
75
|
-
# Check the Bootstrap docs (http://getbootstrap.com/)
|
76
|
-
# to learn about the different styles for forms and inputs,
|
77
|
-
# buttons and other elements.
|
78
|
-
config.default_wrapper = :bootstrap3
|
79
|
-
end
|