From bf00d96f19d98c6fe83b32afc4934f440e8849ac Mon Sep 17 00:00:00 2001 From: riveta Date: Sat, 23 Aug 2014 08:34:26 +0530 Subject: [PATCH 1/8] fixed media replace button --- app/assets/stylesheets/georgia/components/_assets.scss | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 app/assets/stylesheets/georgia/components/_assets.scss diff --git a/app/assets/stylesheets/georgia/components/_assets.scss b/app/assets/stylesheets/georgia/components/_assets.scss new file mode 100644 index 0000000..f0f8ec3 --- /dev/null +++ b/app/assets/stylesheets/georgia/components/_assets.scss @@ -0,0 +1,4 @@ +.js-replace-asset{ + // Overriding file input transform which translates view outside + @include transform(none); +} \ No newline at end of file From 6d898a07cdf30c9c35a4b6ac2e03423c594877ea Mon Sep 17 00:00:00 2001 From: riveta Date: Sat, 20 Sep 2014 14:00:21 +0530 Subject: [PATCH 2/8] fixed css for media replace button --- app/assets/stylesheets/georgia/components/_assets.scss | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/assets/stylesheets/georgia/components/_assets.scss b/app/assets/stylesheets/georgia/components/_assets.scss index f0f8ec3..673a342 100644 --- a/app/assets/stylesheets/georgia/components/_assets.scss +++ b/app/assets/stylesheets/georgia/components/_assets.scss @@ -1,4 +1,11 @@ .js-replace-asset{ // Overriding file input transform which translates view outside + position: static; + height: 10px; + padding: 0; + width: 30px; + margin: 0; + display: inline-block; + vertical-align: top; @include transform(none); } \ No newline at end of file From 4adf327149bd070f4309a579f6b315e5b702cdbc Mon Sep 17 00:00:00 2001 From: riveta Date: Mon, 22 Sep 2014 16:24:24 +0530 Subject: [PATCH 3/8] fixed N+1 query in admin/edit/revision page --- app/helpers/georgia/forms_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/georgia/forms_helper.rb b/app/helpers/georgia/forms_helper.rb index 8b85942..ea1e345 100644 --- a/app/helpers/georgia/forms_helper.rb +++ b/app/helpers/georgia/forms_helper.rb @@ -46,7 +46,7 @@ def parent_page_collection end def widgets_collection - @widgets_collection ||= options_from_collection_for_select(Georgia::Widget.all, :id, :title) + @widgets_collection ||= options_from_collection_for_select(Georgia::Widget.includes(:contents).all, :id, :title) end def extra_fields? From 9aa74336de235bc9b2fda4830a9176fef62eb52f Mon Sep 17 00:00:00 2001 From: riveta Date: Mon, 22 Sep 2014 16:25:41 +0530 Subject: [PATCH 4/8] fixed N+1 query in /admin/pages/search page --- lib/georgia/indexer/extensions/solr_adapter/georgia/page.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/georgia/indexer/extensions/solr_adapter/georgia/page.rb b/lib/georgia/indexer/extensions/solr_adapter/georgia/page.rb index 848586a..09f82c8 100644 --- a/lib/georgia/indexer/extensions/solr_adapter/georgia/page.rb +++ b/lib/georgia/indexer/extensions/solr_adapter/georgia/page.rb @@ -51,7 +51,7 @@ module GeorgiaPageExtension end def self.search_index model, params - model.search do + model.search(:include => [current_revision: :contents]) do fulltext params[:query] do fields(:title, :excerpt, :text, :keywords, :tags, :url, :template) end From ae559f0ae5274d886a05597110dbbc1062da8be2 Mon Sep 17 00:00:00 2001 From: riveta Date: Mon, 22 Sep 2014 16:26:07 +0530 Subject: [PATCH 5/8] fixed N+1 query in /admin page --- app/controllers/georgia/dashboard_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/georgia/dashboard_controller.rb b/app/controllers/georgia/dashboard_controller.rb index 8fdc6c5..0577967 100644 --- a/app/controllers/georgia/dashboard_controller.rb +++ b/app/controllers/georgia/dashboard_controller.rb @@ -3,7 +3,7 @@ class DashboardController < Georgia::ApplicationController def show if can?(:approve, Georgia::Revision) or can?(:review, Georgia::Revision) - @awaiting_revisions = Georgia::Revision.reviews.select{|r| r.revisionable.present?} + @awaiting_revisions = Georgia::Revision.reviews.includes([:revisionable, :contents]).select { |r| r.revisionable.present? } end if defined? GeorgiaMailer::Message if can?(:index, GeorgiaMailer::Message) From f523dec2c42c908703cc2ed75cb27918a44f84cc Mon Sep 17 00:00:00 2001 From: riveta Date: Mon, 22 Sep 2014 16:27:18 +0530 Subject: [PATCH 6/8] fixed N+1 query in admin/media/search page --- lib/georgia/indexer/extensions/solr_adapter/ckeditor/asset.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/georgia/indexer/extensions/solr_adapter/ckeditor/asset.rb b/lib/georgia/indexer/extensions/solr_adapter/ckeditor/asset.rb index 100e56e..f8e2b4d 100644 --- a/lib/georgia/indexer/extensions/solr_adapter/ckeditor/asset.rb +++ b/lib/georgia/indexer/extensions/solr_adapter/ckeditor/asset.rb @@ -27,7 +27,7 @@ module CkeditorAssetExtension end def self.search_index model, params - model.search do + model.search(:include => [{contents: :contentable}]) do fulltext params[:query] do fields(:filename, :tags) end From d5a617eec22e39445541bdb384b3dbebe2481a76 Mon Sep 17 00:00:00 2001 From: riveta Date: Mon, 22 Sep 2014 16:28:05 +0530 Subject: [PATCH 7/8] fixed N+1 query in /admin/widgets page --- app/controllers/georgia/widgets_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/georgia/widgets_controller.rb b/app/controllers/georgia/widgets_controller.rb index 1c04888..3a4def4 100644 --- a/app/controllers/georgia/widgets_controller.rb +++ b/app/controllers/georgia/widgets_controller.rb @@ -4,7 +4,7 @@ class WidgetsController < ApplicationController load_and_authorize_resource class: Georgia::Widget def index - @widgets = Widget.order(:created_at).page(params[:page]).in_groups_of(4, false) + @widgets = Widget.order(:created_at).includes(:contents).page(params[:page]).in_groups_of(4, false) @widget = Widget.new @widget.contents.build(locale: current_locale) end From 8aa6916a24ab0956ba6859eec7d23841360b1f5f Mon Sep 17 00:00:00 2001 From: riveta Date: Mon, 20 Oct 2014 12:40:59 +0530 Subject: [PATCH 8/8] removed check for manage while updating revisions --- app/services/georgia/update_revision.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/services/georgia/update_revision.rb b/app/services/georgia/update_revision.rb index e69a863..7d67370 100644 --- a/app/services/georgia/update_revision.rb +++ b/app/services/georgia/update_revision.rb @@ -13,9 +13,7 @@ def initialize controller, page, revision, attributes end def call - if can? :manage, revision - admin_update_attributes - elsif can? :review, revision + if can? :review, revision contributor_update_attributes else false