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,49 +1,69 @@
|
|
1
1
|
module Georgia
|
2
2
|
class UsersController < ApplicationController
|
3
3
|
|
4
|
-
load_and_authorize_resource class: Georgia::User
|
5
|
-
|
6
4
|
def index
|
5
|
+
authorize Georgia::User
|
7
6
|
@users = User.order(:created_at).page(params[:page])
|
8
7
|
end
|
9
8
|
|
10
9
|
def show
|
11
|
-
|
10
|
+
@user = User.find(params[:id])
|
11
|
+
authorize @user
|
12
|
+
redirect_to [:edit, @user]
|
12
13
|
end
|
13
14
|
|
14
15
|
def new
|
15
16
|
@user = User.new
|
17
|
+
authorize @user
|
16
18
|
end
|
17
19
|
|
18
20
|
def edit
|
19
|
-
|
21
|
+
begin
|
22
|
+
@user = User.find(params[:id])
|
23
|
+
authorize @user
|
24
|
+
rescue ActiveRecord::RecordNotFound => ex
|
25
|
+
redirect_to users_path, alert: "This user doesn't exist anymore."
|
26
|
+
end
|
20
27
|
end
|
21
28
|
|
22
29
|
def create
|
23
|
-
@user = User.new(
|
30
|
+
@user = User.new(user_params)
|
31
|
+
authorize @user
|
24
32
|
|
25
33
|
if @user.save
|
26
|
-
redirect_to
|
34
|
+
redirect_to users_path, notice: "User was successfully created."
|
27
35
|
else
|
28
|
-
render
|
36
|
+
render :new
|
29
37
|
end
|
30
38
|
end
|
31
39
|
|
32
40
|
def update
|
33
41
|
@user = User.find(params[:id])
|
42
|
+
authorize @user
|
34
43
|
params[:user].delete(:password) if params[:user][:password].blank?
|
35
44
|
params[:user].delete(:password_confirmation) if params[:user][:password].blank? and params[:user][:password_confirmation].blank?
|
36
|
-
if @user.
|
37
|
-
redirect_to
|
45
|
+
if @user.update(user_params)
|
46
|
+
redirect_to users_path, notice: "User was successfully updated."
|
38
47
|
else
|
39
|
-
render
|
48
|
+
render :edit
|
40
49
|
end
|
41
50
|
end
|
42
51
|
|
43
52
|
def destroy
|
44
53
|
@user = User.find(params[:id])
|
54
|
+
authorize @user
|
45
55
|
@user.destroy
|
46
|
-
redirect_to
|
56
|
+
redirect_to users_path, notice: "User was successfully deleted."
|
57
|
+
end
|
58
|
+
|
59
|
+
def permissions
|
60
|
+
authorize Georgia::User
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def user_params
|
66
|
+
params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation, :receives_notifications, role_ids: [])
|
47
67
|
end
|
48
68
|
|
49
69
|
end
|
@@ -1,9 +1,8 @@
|
|
1
1
|
module Georgia
|
2
2
|
class WidgetsController < ApplicationController
|
3
3
|
|
4
|
-
load_and_authorize_resource class: Georgia::Widget
|
5
|
-
|
6
4
|
def index
|
5
|
+
authorize Widget
|
7
6
|
@widgets = Widget.order(:created_at).page(params[:page]).in_groups_of(4, false)
|
8
7
|
@widget = Widget.new
|
9
8
|
@widget.contents.build(locale: current_locale)
|
@@ -11,10 +10,12 @@ module Georgia
|
|
11
10
|
|
12
11
|
def edit
|
13
12
|
@widget = Widget.find(params[:id])
|
13
|
+
authorize @widget
|
14
14
|
end
|
15
15
|
|
16
16
|
def create
|
17
|
-
@widget = Widget.new(
|
17
|
+
@widget = Widget.new(widget_params)
|
18
|
+
authorize @widget
|
18
19
|
|
19
20
|
if @widget.save
|
20
21
|
respond_to do |format|
|
@@ -32,7 +33,9 @@ module Georgia
|
|
32
33
|
|
33
34
|
def update
|
34
35
|
@widget = Widget.find(params[:id])
|
35
|
-
|
36
|
+
authorize @widget
|
37
|
+
|
38
|
+
if @widget.update(widget_params)
|
36
39
|
respond_to do |format|
|
37
40
|
format.html { redirect_to widgets_url, notice: "Widget was successfully updated." }
|
38
41
|
format.js { head :ok }
|
@@ -47,6 +50,8 @@ module Georgia
|
|
47
50
|
|
48
51
|
def destroy
|
49
52
|
@widget = Widget.find(params[:id])
|
53
|
+
authorize @widget
|
54
|
+
|
50
55
|
if @widget.destroy
|
51
56
|
respond_to do |format|
|
52
57
|
format.html { redirect_to widgets_url, notice: "Widget was successfully deleted." }
|
@@ -58,8 +63,12 @@ module Georgia
|
|
58
63
|
format.js { head :internal_server_error }
|
59
64
|
end
|
60
65
|
end
|
66
|
+
end
|
61
67
|
|
68
|
+
private
|
62
69
|
|
70
|
+
def widget_params
|
71
|
+
params.require(:widget).permit(:id, :_destroy, contents_attributes: [:locale, :title, :text])
|
63
72
|
end
|
64
73
|
|
65
74
|
end
|
@@ -50,11 +50,11 @@ module Georgia
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def extra_fields?
|
53
|
-
lookup_context.exists?('
|
53
|
+
lookup_context.exists?('extra_fields', ["#{klass_folder}/fields"], true)
|
54
54
|
end
|
55
55
|
|
56
56
|
def extra_fields_path
|
57
|
-
"#{klass_folder}/fields/
|
57
|
+
"#{klass_folder}/fields/extra_fields"
|
58
58
|
end
|
59
59
|
|
60
60
|
private
|
@@ -1,25 +1,47 @@
|
|
1
1
|
module Georgia
|
2
2
|
module UiHelper
|
3
3
|
|
4
|
-
def avatar_url(email, options={})
|
5
|
-
gravatar_id = Digest::MD5.hexdigest(email.
|
4
|
+
def avatar_url(email='', options={})
|
5
|
+
gravatar_id = Digest::MD5.hexdigest(email.downcase) if email
|
6
6
|
size = options.fetch(:size, '32')
|
7
|
-
"
|
8
|
-
end
|
9
|
-
|
10
|
-
def icon_tag icon_name, options={}
|
11
|
-
options[:class] ||= ''
|
12
|
-
options[:class] << "fa fa-#{icon_name}"
|
13
|
-
content_tag :i, nil, options
|
7
|
+
"//gravatar.com/avatar/#{gravatar_id}.png?s=#{size}&d=mm"
|
14
8
|
end
|
15
9
|
|
16
10
|
def caret_tag
|
17
11
|
content_tag :span, nil, class: 'caret'
|
18
12
|
end
|
19
13
|
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
# FIXME: Turn into a Hash
|
15
|
+
def asset_icon_tag extension
|
16
|
+
icon_name = case extension.downcase
|
17
|
+
when 'avi' then 'file-movie-o'
|
18
|
+
when 'css' then 'file-text-o'
|
19
|
+
when 'csv' then 'file-excel-o'
|
20
|
+
when 'doc' then 'file-word-o'
|
21
|
+
when 'docx' then 'file-word-o'
|
22
|
+
when 'eps' then 'file-powerpoint-o'
|
23
|
+
when 'gif' then 'file-image-o'
|
24
|
+
when 'gz' then 'file-archive-o'
|
25
|
+
when 'html' then 'file-code-o'
|
26
|
+
when 'jpeg' then 'file-image-o'
|
27
|
+
when 'jpg' then 'file-image'
|
28
|
+
when 'mp3' then 'file-audio-o'
|
29
|
+
when 'ods' then 'file-excel-o'
|
30
|
+
when 'odt' then 'file-word-o'
|
31
|
+
when 'pdf' then 'file-pdf-o'
|
32
|
+
when 'png' then 'file-image-o'
|
33
|
+
when 'ppt' then 'file-powerpoint-o'
|
34
|
+
when 'pptx' then 'file-powerpoint-o'
|
35
|
+
when 'rar' then 'file-archive-o'
|
36
|
+
when 'tar' then 'file-archive-o'
|
37
|
+
when 'txt' then 'file-text-o'
|
38
|
+
when 'wav' then 'file-audio-o'
|
39
|
+
when 'xls' then 'file-excel-o'
|
40
|
+
when 'zip' then 'file-archive-o'
|
41
|
+
else
|
42
|
+
'file'
|
43
|
+
end
|
44
|
+
icon_tag(icon_name)
|
23
45
|
end
|
24
46
|
|
25
47
|
def link_to_back url=:back
|
@@ -44,5 +66,49 @@ module Georgia
|
|
44
66
|
session[:welcomed] || !(session[:welcomed] = true)
|
45
67
|
end
|
46
68
|
|
69
|
+
def button_to_settings
|
70
|
+
return unless policy(@page).settings?
|
71
|
+
link_to "#{icon_tag('cogs')} Settings".html_safe, [:settings, @page], class: 'btn btn-info'
|
72
|
+
end
|
73
|
+
|
74
|
+
def button_to_edit
|
75
|
+
return unless policy(@page).update?
|
76
|
+
link_to "#{icon_tag('pencil')} Edit".html_safe, [:edit, @page], class: 'btn btn-info'
|
77
|
+
end
|
78
|
+
|
79
|
+
def page_actions_tag page, revision=nil, options={}
|
80
|
+
revision ||= page.current_revision
|
81
|
+
Georgia::PageActionsPresenter.new(self, page, revision, options)
|
82
|
+
end
|
83
|
+
|
84
|
+
def page_url_minus_slug
|
85
|
+
@page_full_url ||= (Georgia.url + @page.url).gsub(@page.slug, '')
|
86
|
+
end
|
87
|
+
|
88
|
+
def revision_status_message page, revision, options={}
|
89
|
+
Georgia::RevisionStatusMessage.new(self, page, revision, options)
|
90
|
+
end
|
91
|
+
|
92
|
+
def picture_tag picture, options={}
|
93
|
+
return unless picture and picture.url.present?
|
94
|
+
format = options.fetch(:format, :tiny)
|
95
|
+
link_to picture.url_content, class: 'media-link bg-transparent', rel: 'shadowbox[gallery]' do
|
96
|
+
image_tag(picture.url(format), title: picture.data_file_name, class: 'media-image')
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def link_to_available_locales
|
101
|
+
return unless I18n.available_locales.length > 1
|
102
|
+
links = I18n.available_locales.map do |locale|
|
103
|
+
content_tag(:li, link_to(t("georgia.#{locale}"), params.merge(locale: locale) ))
|
104
|
+
end
|
105
|
+
content_tag(:p, class: 'hint') do
|
106
|
+
content_tag(:div, class: 'dropdown') do
|
107
|
+
link_to("Change language <span class='caret'></span>".html_safe, '#', class: 'btn btn-warning', data: {toggle: 'dropdown'}, role: :button) +
|
108
|
+
content_tag(:ul, links.join('').html_safe, class: 'dropdown-menu', role: 'menu')
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
47
113
|
end
|
48
114
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Georgia
|
2
|
+
module UsersHelper
|
3
|
+
|
4
|
+
def permissions_view
|
5
|
+
Georgia.permissions.map{|section, actions| permission_table_tag(section, actions)}.join().html_safe
|
6
|
+
end
|
7
|
+
|
8
|
+
def permission_table_tag section, actions
|
9
|
+
PermissionTablePresenter.new(self, section, actions).to_s
|
10
|
+
end
|
11
|
+
|
12
|
+
def georgia_roles_collection
|
13
|
+
@georgia_role_collection ||= Georgia::Role.pluck(:name, :id).map{|name, id| [name.titleize, id]}
|
14
|
+
end
|
15
|
+
|
16
|
+
def unknown_user_name
|
17
|
+
content_tag(:span, 'Unknown', class: 'text-muted')
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -4,10 +4,10 @@ module Georgia
|
|
4
4
|
def notify_admins(message, url)
|
5
5
|
@message = message
|
6
6
|
@url = url
|
7
|
-
emails_to = Georgia::User.
|
7
|
+
emails_to = Georgia::User.where(roles: ['admin', 'editor']).where(receives_notifications: true).pluck(:email)
|
8
8
|
unless emails_to.empty?
|
9
9
|
mail(
|
10
|
-
from: "
|
10
|
+
from: "notify@georgiacms.org",
|
11
11
|
to: emails_to,
|
12
12
|
subject: @message
|
13
13
|
)
|
@@ -17,10 +17,10 @@ module Georgia
|
|
17
17
|
def notify_editors(message, url)
|
18
18
|
@message = message
|
19
19
|
@url = url
|
20
|
-
emails_to = Georgia::User.
|
20
|
+
emails_to = Georgia::User.where(roles: ['admin', 'editor']).where(receives_notifications: true).pluck(:email)
|
21
21
|
unless emails_to.empty?
|
22
22
|
mail(
|
23
|
-
from: "
|
23
|
+
from: "notify@georgiacms.org",
|
24
24
|
to: emails_to,
|
25
25
|
subject: @message
|
26
26
|
)
|
@@ -1,23 +1,27 @@
|
|
1
1
|
class Ckeditor::Asset < ActiveRecord::Base
|
2
2
|
|
3
|
-
include
|
3
|
+
include Elasticsearch::Model
|
4
|
+
include Elasticsearch::Model::Callbacks
|
5
|
+
index_name 'ckeditor-assets'
|
6
|
+
document_type 'asset'
|
7
|
+
include Ckeditor::AssetSearch
|
4
8
|
|
5
9
|
# to allow media_path in to_jq_upload
|
6
10
|
include Georgia::Engine.routes.url_helpers
|
7
11
|
|
8
12
|
include Ckeditor::Orm::ActiveRecord::AssetBase
|
9
|
-
|
13
|
+
|
14
|
+
acts_as_taggable_on :tags
|
10
15
|
|
11
16
|
delegate :url, :current_path, :content_type, to: :data
|
12
17
|
|
13
18
|
mount_uploader :data, Ckeditor::AttachmentFileUploader, mount_on: :data_file_name
|
14
19
|
|
15
20
|
validates :data, presence: true
|
16
|
-
attr_accessible :data
|
17
21
|
|
18
22
|
paginates_per 15
|
19
23
|
|
20
|
-
scope :latest, order(
|
24
|
+
scope :latest, -> { order(created_at: :desc) }
|
21
25
|
|
22
26
|
def to_jq_upload
|
23
27
|
{
|
@@ -38,6 +42,14 @@ class Ckeditor::Asset < ActiveRecord::Base
|
|
38
42
|
@extension ||= data_content_type.gsub(/.*\/(.*)/, '\1')
|
39
43
|
end
|
40
44
|
|
45
|
+
def self.policy_class
|
46
|
+
Georgia::MediaPolicy
|
47
|
+
end
|
48
|
+
|
49
|
+
def image?
|
50
|
+
false
|
51
|
+
end
|
52
|
+
|
41
53
|
SIZE_RANGE = {
|
42
54
|
'< 25 KB' => 0..25,
|
43
55
|
'25 KB to 100 KB' => 25..100,
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
module Ckeditor
|
3
|
+
module AssetSearch
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
def as_indexed_json options={}
|
8
|
+
self.as_json(
|
9
|
+
only: [:id, :data_file_name, :updated_at],
|
10
|
+
methods: [:tag_list, :image?]
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,4 +1,11 @@
|
|
1
1
|
class Ckeditor::AttachmentFile < Ckeditor::Asset
|
2
|
+
|
3
|
+
include Elasticsearch::Model
|
4
|
+
include Elasticsearch::Model::Callbacks
|
5
|
+
index_name 'ckeditor-assets'
|
6
|
+
document_type 'asset'
|
7
|
+
include Ckeditor::AssetSearch
|
8
|
+
|
2
9
|
mount_uploader :data, Ckeditor::AttachmentFileUploader, :mount_on => :data_file_name
|
3
10
|
|
4
11
|
def url_thumb
|
@@ -1,5 +1,11 @@
|
|
1
1
|
class Ckeditor::Picture < Ckeditor::Asset
|
2
2
|
|
3
|
+
include Elasticsearch::Model
|
4
|
+
include Elasticsearch::Model::Callbacks
|
5
|
+
index_name 'ckeditor-assets'
|
6
|
+
document_type 'asset'
|
7
|
+
include Ckeditor::AssetSearch
|
8
|
+
|
3
9
|
mount_uploader :data, Ckeditor::PictureUploader, mount_on: :data_file_name
|
4
10
|
|
5
11
|
has_many :contents, foreign_key: :image_id, class_name: Georgia::Content
|
@@ -21,4 +27,8 @@ class Ckeditor::Picture < Ckeditor::Asset
|
|
21
27
|
end
|
22
28
|
end
|
23
29
|
|
30
|
+
def image?
|
31
|
+
true
|
32
|
+
end
|
33
|
+
|
24
34
|
end
|
data/app/models/georgia/clone.rb
CHANGED
@@ -13,7 +13,9 @@ module Georgia
|
|
13
13
|
# The resulting instance has a '(Copy)' title and '-copy' slug
|
14
14
|
def copy
|
15
15
|
copy_page
|
16
|
-
|
16
|
+
revision = Georgia::CloneRevision.new(instance.current_revision, status: 'draft')
|
17
|
+
revision.revisionable = duplicate
|
18
|
+
duplicate.current_revision = revision
|
17
19
|
alter_slug
|
18
20
|
alter_title
|
19
21
|
duplicate.save!
|
@@ -8,16 +8,15 @@ module Georgia
|
|
8
8
|
included do
|
9
9
|
has_many :contents, as: :contentable, dependent: :destroy, class_name: Georgia::Content
|
10
10
|
accepts_nested_attributes_for :contents
|
11
|
-
attr_accessible :contents_attributes
|
12
11
|
|
13
|
-
scope :with_locale,
|
12
|
+
scope :with_locale, -> (locale) { joins(:contents).where(georgia_contents: {locale: locale}).uniq }
|
14
13
|
|
15
14
|
def content(locale=nil)
|
16
15
|
locale ||= I18n.locale.to_s
|
17
16
|
@content ||= contents.select{|c| c.locale == locale}.first || Georgia::Content.new(locale: locale)
|
18
17
|
end
|
19
18
|
|
20
|
-
|
19
|
+
delegate :title, :text, :excerpt, :keywords, :keyword_list, :image, :locale, to: :content
|
21
20
|
end
|
22
21
|
|
23
22
|
end
|