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,80 @@
|
|
1
|
+
module Georgia
|
2
|
+
class PermissionTablePresenter < Presenter
|
3
|
+
|
4
|
+
def initialize context, title, actions
|
5
|
+
super
|
6
|
+
@title = title
|
7
|
+
@actions = actions
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_s
|
11
|
+
html = ActiveSupport::SafeBuffer.new
|
12
|
+
html << title_tag
|
13
|
+
html << table
|
14
|
+
html.to_s.html_safe
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def title_tag
|
20
|
+
content_tag :h2, @title.to_s.titleize
|
21
|
+
end
|
22
|
+
|
23
|
+
def table
|
24
|
+
content_tag :table, class: 'table table-results' do
|
25
|
+
thead + tbody
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def thead
|
30
|
+
content_tag(:thead) do
|
31
|
+
content_tag(:tr) do
|
32
|
+
content_tag(:th, 'Actions', class: 'permissions-actions') +
|
33
|
+
roles.map{|role| content_tag(:th, role.to_s.titleize, class: 'role') }.join.html_safe
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def tbody
|
39
|
+
content_tag(:tbody, action_rows)
|
40
|
+
end
|
41
|
+
|
42
|
+
def action_rows
|
43
|
+
@actions.map do |action, permissions|
|
44
|
+
content_tag(:tr) do
|
45
|
+
content_tag(:td, action.to_s.titleize) +
|
46
|
+
roles.map{|role| permission_cell(permissions[role.to_sym]) }.join.html_safe
|
47
|
+
end
|
48
|
+
end.join.html_safe
|
49
|
+
end
|
50
|
+
|
51
|
+
def permission_cell permission
|
52
|
+
content_tag(:td, permission_icon(permission), class: "text-center #{permission_class(permission)}")
|
53
|
+
end
|
54
|
+
|
55
|
+
def permission_icon permission
|
56
|
+
icon_tag(
|
57
|
+
case permission
|
58
|
+
when true then 'check'
|
59
|
+
when false then 'times'
|
60
|
+
when :partial then 'minus'
|
61
|
+
else 'times'
|
62
|
+
end
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
def permission_class permission
|
67
|
+
case permission
|
68
|
+
when true then 'success'
|
69
|
+
when false then 'danger'
|
70
|
+
when :partial then 'warning'
|
71
|
+
else 'danger'
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def roles
|
76
|
+
@roles ||= Georgia::Role.pluck(:name)
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module Georgia
|
2
|
+
class RevisionStatusMessage
|
3
|
+
|
4
|
+
include Pundit
|
5
|
+
|
6
|
+
attr_reader :current_user
|
7
|
+
|
8
|
+
def initialize current_user, page, revision, draft_revision=nil
|
9
|
+
@current_user = current_user
|
10
|
+
@page = page
|
11
|
+
@revision = revision
|
12
|
+
@draft_revision = draft_revision
|
13
|
+
end
|
14
|
+
|
15
|
+
def partial
|
16
|
+
case @revision.status
|
17
|
+
when 'draft' then draft_partial_sorter
|
18
|
+
when 'review' then review_partial_sorter
|
19
|
+
when 'revision' then revision_partial_sorter
|
20
|
+
when 'published' then published_partial_sorter
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def draft_partial_sorter
|
27
|
+
if policy(@revision).approve?
|
28
|
+
'request_review'
|
29
|
+
elsif current_owner?
|
30
|
+
'review'
|
31
|
+
else
|
32
|
+
'insufficient_rights'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def review_partial_sorter
|
37
|
+
if current_owner?
|
38
|
+
'awaiting_review'
|
39
|
+
elsif policy(@revision).approve?
|
40
|
+
'review'
|
41
|
+
else
|
42
|
+
'insufficient_rights'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def revision_partial_sorter
|
47
|
+
if current_revision? and policy(@revision).approve?
|
48
|
+
nil
|
49
|
+
elsif current_revision? and !policy(@revision).approve?
|
50
|
+
'insufficient_rights'
|
51
|
+
elsif !current_revision? and policy(@revision).approve?
|
52
|
+
'edit_current_revision'
|
53
|
+
else
|
54
|
+
'start_draft'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def published_partial_sorter
|
59
|
+
if !policy(@revision).approve?
|
60
|
+
'insufficient_rights'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def current_revision?
|
65
|
+
@is_current_revision ||= @page.current_revision == @revision
|
66
|
+
end
|
67
|
+
|
68
|
+
def current_owner?
|
69
|
+
@is_current_owner ||= @revision.user == @current_user
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
@@ -11,7 +11,7 @@ module Georgia
|
|
11
11
|
@url = url
|
12
12
|
@options = options
|
13
13
|
@icon = options.fetch(:icon, 'bookmark-o')
|
14
|
-
@active = options.fetch(:active
|
14
|
+
@active = options.fetch(:active) { get_active_state_from_controller }
|
15
15
|
@sublink = options.fetch(:sublink, false)
|
16
16
|
super
|
17
17
|
end
|
@@ -36,7 +36,7 @@ module Georgia
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def slide_content_tag
|
39
|
-
content_tag(:div, title_input_tag + text_input_tag + locale_input_tag, class: 'slide-text')
|
39
|
+
content_tag(:div, content_id_tag + title_input_tag + text_input_tag + locale_input_tag, class: 'slide-text')
|
40
40
|
end
|
41
41
|
|
42
42
|
def id_input_tag
|
@@ -47,6 +47,10 @@ module Georgia
|
|
47
47
|
hidden_field_tag("revision[slides_attributes][#{id}][position]", position, class: 'js-position')
|
48
48
|
end
|
49
49
|
|
50
|
+
def content_id_tag
|
51
|
+
hidden_field_tag("revision[slides_attributes][#{id}][contents_attributes][#{content_id}][id]", @content.id)
|
52
|
+
end
|
53
|
+
|
50
54
|
def title_input_tag
|
51
55
|
text_field_tag("revision[slides_attributes][#{id}][contents_attributes][#{content_id}][title]", @content.title, class: 'form-control', placeholder: 'Title')
|
52
56
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Georgia
|
2
|
+
module PageableRouteConcern
|
3
|
+
def self.included(base)
|
4
|
+
base.instance_eval do
|
5
|
+
concern :pageable do
|
6
|
+
|
7
|
+
collection do
|
8
|
+
get :search
|
9
|
+
post :sort
|
10
|
+
post :publish
|
11
|
+
post :unpublish
|
12
|
+
delete '/', to: :destroy
|
13
|
+
end
|
14
|
+
|
15
|
+
member do
|
16
|
+
get :copy
|
17
|
+
get :settings
|
18
|
+
end
|
19
|
+
|
20
|
+
resources :revisions do
|
21
|
+
member do
|
22
|
+
get :preview
|
23
|
+
get :draft
|
24
|
+
get :request_review
|
25
|
+
get :approve
|
26
|
+
get :store
|
27
|
+
get :decline
|
28
|
+
get :restore
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Georgia
|
2
|
+
class MediaSearch < SearchDefinition
|
3
|
+
|
4
|
+
def post_process
|
5
|
+
filter_by_types
|
6
|
+
filter_by_tags
|
7
|
+
apply_filtering
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def apply_filtering
|
13
|
+
add_filters_to_query if filters.any?
|
14
|
+
end
|
15
|
+
|
16
|
+
def filter_by_types
|
17
|
+
@types = @params.fetch(:only, [])
|
18
|
+
filters << pictures_filter if @types.include?(:pictures)
|
19
|
+
end
|
20
|
+
|
21
|
+
def filter_by_tags
|
22
|
+
@tags = @params.fetch(:tg, [])
|
23
|
+
filters << tags_filter if @tags.any?
|
24
|
+
end
|
25
|
+
|
26
|
+
def pictures_filter
|
27
|
+
{term: {image?: true}}
|
28
|
+
end
|
29
|
+
|
30
|
+
def tags_filter
|
31
|
+
{terms: {tag_list: @tags}}
|
32
|
+
end
|
33
|
+
|
34
|
+
def query_fields
|
35
|
+
['data_file_name', 'tag_list']
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Georgia
|
2
|
+
class PageSearch < SearchDefinition
|
3
|
+
|
4
|
+
private
|
5
|
+
|
6
|
+
def post_process
|
7
|
+
@type = params[:type]
|
8
|
+
filters << pages_filter if @type == 'Georgia::Page'
|
9
|
+
add_filters_to_query
|
10
|
+
end
|
11
|
+
|
12
|
+
def query_fields
|
13
|
+
['title^5', 'tag_list^3', 'keyword_list^2', 'text', 'excerpt', 'template', 'slug']
|
14
|
+
end
|
15
|
+
|
16
|
+
def sort_column
|
17
|
+
:updated_at
|
18
|
+
end
|
19
|
+
|
20
|
+
def sort_direction
|
21
|
+
'desc'
|
22
|
+
end
|
23
|
+
|
24
|
+
def pages_filter
|
25
|
+
{missing: {field: 'type'}}
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_suggestion
|
29
|
+
@definition[:suggest] = {
|
30
|
+
text: query,
|
31
|
+
suggest_title: {
|
32
|
+
term: {
|
33
|
+
field: 'title.tokenized',
|
34
|
+
suggest_mode: 'always'
|
35
|
+
}
|
36
|
+
},
|
37
|
+
suggest_body: {
|
38
|
+
term: {
|
39
|
+
field: 'text.tokenized',
|
40
|
+
suggest_mode: 'always'
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module Georgia
|
2
|
+
class SearchDefinition
|
3
|
+
|
4
|
+
attr_reader :params, :definition, :query
|
5
|
+
|
6
|
+
DEFAULT_SORT_COLUMN = :updated_at
|
7
|
+
DEFAULT_SORT_DIRECTION = 'desc'
|
8
|
+
|
9
|
+
def initialize params
|
10
|
+
@params = params
|
11
|
+
@query = params.fetch(:query) { params.fetch(:q, nil) }
|
12
|
+
@sort_column = params.fetch(:sort, nil)
|
13
|
+
@sort_direction = params.fetch(:direction, nil)
|
14
|
+
@definition = default_definition
|
15
|
+
process
|
16
|
+
post_process
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def process
|
22
|
+
add_fulltext_query_filter if query.present?
|
23
|
+
add_sorting unless query.present?
|
24
|
+
end
|
25
|
+
|
26
|
+
def post_process
|
27
|
+
end
|
28
|
+
|
29
|
+
def filters
|
30
|
+
@filters ||= []
|
31
|
+
end
|
32
|
+
|
33
|
+
def add_filters_to_query
|
34
|
+
@definition[:query][:filtered][:filter][:bool][:must] = filters
|
35
|
+
end
|
36
|
+
|
37
|
+
def add_fulltext_query_filter
|
38
|
+
@definition[:query][:filtered][:query] = {simple_query_string: { query: query, fields: query_fields}}
|
39
|
+
end
|
40
|
+
|
41
|
+
def add_sorting
|
42
|
+
@definition[:sort] = { sort_column => sort_direction }
|
43
|
+
end
|
44
|
+
|
45
|
+
def add_status_facet_filter
|
46
|
+
add_to_query_definition({ term: {status: status} })
|
47
|
+
@definition[:facets][:status][:facet_filter] = {term: {status: status}}
|
48
|
+
end
|
49
|
+
|
50
|
+
def add_to_query_definition conditions
|
51
|
+
@definition[:query][:filtered][:query][:bool][:must] << conditions
|
52
|
+
end
|
53
|
+
|
54
|
+
def default_definition
|
55
|
+
{
|
56
|
+
query: { filtered: { filter: {bool: {must: []}}} }
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
def query_fields
|
61
|
+
[]
|
62
|
+
end
|
63
|
+
|
64
|
+
def sort_column
|
65
|
+
@sort_column || DEFAULT_SORT_COLUMN
|
66
|
+
end
|
67
|
+
def sort_direction
|
68
|
+
@sort_direction || DEFAULT_SORT_DIRECTION
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Georgia
|
2
|
+
class TagSearch < SearchDefinition
|
3
|
+
|
4
|
+
def process
|
5
|
+
if query.present?
|
6
|
+
include_filtered_query
|
7
|
+
add_fulltext_query
|
8
|
+
# add_suggestion
|
9
|
+
# add_status_facet_filter if status.present?
|
10
|
+
# elsif status.present?
|
11
|
+
# include_filtered_query
|
12
|
+
# add_status_facet_filter
|
13
|
+
else
|
14
|
+
add_match_all
|
15
|
+
end
|
16
|
+
add_sorting
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def sort_column
|
22
|
+
:taggings_count
|
23
|
+
end
|
24
|
+
def sort_direction
|
25
|
+
'asc'
|
26
|
+
end
|
27
|
+
|
28
|
+
def query_fields
|
29
|
+
['name']
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Georgia
|
2
|
+
class CloneRevision
|
3
|
+
|
4
|
+
def initialize revision, status: nil, revised_by_id: nil
|
5
|
+
raise 'Revision must be persisted to be copied' if revision.new_record?
|
6
|
+
@revision = revision
|
7
|
+
@status = status || @revision.status
|
8
|
+
@revised_by_id = revised_by_id || @revision.revised_by_id
|
9
|
+
end
|
10
|
+
|
11
|
+
# Returns a copy of the revision in 'revision' status
|
12
|
+
def call
|
13
|
+
clone_revision
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.create revision, attributes={}
|
17
|
+
clone = new(revision, attributes).call
|
18
|
+
clone.save!
|
19
|
+
clone
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def clone_revision
|
25
|
+
@duplicate_revision = Georgia::Revision.new(template: @revision.template, status: @status, revisionable: @revision.revisionable, revised_by_id: @revised_by_id) do |r|
|
26
|
+
r.contents = clone_contents
|
27
|
+
r.ui_associations = clone_ui_associations
|
28
|
+
r.slides = clone_slides
|
29
|
+
end
|
30
|
+
@duplicate_revision
|
31
|
+
end
|
32
|
+
|
33
|
+
def clone_contents
|
34
|
+
@revision.contents.map{|c| clone_content(c)}
|
35
|
+
end
|
36
|
+
|
37
|
+
def clone_ui_associations
|
38
|
+
@revision.ui_associations.map{|ui_assoc| clone_ui_association(ui_assoc)}
|
39
|
+
end
|
40
|
+
|
41
|
+
def clone_slides
|
42
|
+
@revision.slides.map do |slide|
|
43
|
+
new_slide = Georgia::Slide.new(page_id: slide.page_id)
|
44
|
+
slide.contents.each do |content|
|
45
|
+
new_slide.contents << clone_content(content)
|
46
|
+
end
|
47
|
+
new_slide
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def clone_content(content)
|
52
|
+
Georgia::Content.new(
|
53
|
+
locale: content.locale,
|
54
|
+
text: content.text,
|
55
|
+
title: content.title,
|
56
|
+
excerpt: content.excerpt,
|
57
|
+
image_id: content.image_id,
|
58
|
+
keyword_list: content.keyword_list
|
59
|
+
)
|
60
|
+
end
|
61
|
+
|
62
|
+
def clone_ui_association(ui_assoc)
|
63
|
+
Georgia::UiAssociation.new(
|
64
|
+
page_id: ui_assoc.page_id,
|
65
|
+
widget_id: ui_assoc.widget_id,
|
66
|
+
ui_section_id: ui_assoc.ui_section_id
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|