georgia 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -9
- data/app/assets/javascripts/georgia/ckeditor/config.js +0 -2
- data/app/controllers/georgia/dashboard_controller.rb +4 -2
- data/app/mailers/georgia/notifier.rb +0 -2
- data/app/models/acts_as_taggable_on/tag.rb +9 -0
- data/app/models/ckeditor/asset.rb +6 -3
- data/app/models/georgia/page.rb +6 -1
- data/config/routes.rb +0 -12
- data/lib/georgia.rb +2 -2
- data/lib/georgia/engine.rb +0 -10
- data/lib/georgia/indexer.rb +25 -7
- data/lib/georgia/indexer/extensions/solr_adapter/acts_as_taggable_on_tag.rb +21 -0
- data/lib/georgia/indexer/extensions/solr_adapter/ckeditor_asset.rb +46 -0
- data/lib/georgia/indexer/extensions/solr_adapter/georgia_page.rb +75 -0
- data/lib/georgia/indexer/extensions/tire_adapter/acts_as_taggable_on_tag.rb +24 -0
- data/lib/georgia/indexer/extensions/tire_adapter/ckeditor_asset.rb +41 -0
- data/lib/georgia/indexer/extensions/tire_adapter/georgia_page.rb +55 -0
- data/lib/georgia/indexer/solr_adapter.rb +9 -16
- data/lib/georgia/indexer/tire_adapter.rb +8 -14
- data/lib/georgia/version.rb +1 -1
- metadata +17 -89
- data/app/assets/javascripts/georgia/components/tables/messages.js.coffee +0 -59
- data/app/controllers/georgia/messages_controller.rb +0 -66
- data/app/controllers/messages_controller.rb +0 -29
- data/app/decorators/georgia/message_decorator.rb +0 -21
- data/app/decorators/georgia/messages_decorator.rb +0 -4
- data/app/helpers/georgia/messages_helper.rb +0 -9
- data/app/models/georgia/message.rb +0 -30
- data/app/presenters/georgia/message_actions_presenter.rb +0 -51
- data/app/views/georgia/header/_messages.html.erb +0 -3
- data/app/views/georgia/messages/_message.html.erb +0 -26
- data/app/views/georgia/messages/destroy.js.erb +0 -3
- data/app/views/georgia/messages/search.html.erb +0 -58
- data/app/views/georgia/messages/show.html.erb +0 -46
- data/app/views/messages/create.js.erb +0 -0
- data/app/workers/spam_worker.rb +0 -12
- data/lib/georgia/indexer/adapter.rb +0 -10
- data/lib/georgia/indexer/solr/acts_as_taggable_on/tag.rb +0 -17
- data/lib/georgia/indexer/solr/ckeditor/asset.rb +0 -43
- data/lib/georgia/indexer/solr/georgia/message.rb +0 -31
- data/lib/georgia/indexer/solr/georgia/page.rb +0 -71
- data/lib/georgia/indexer/tire/ckeditor/asset.rb +0 -38
- data/lib/georgia/indexer/tire/georgia/message.rb +0 -41
- data/lib/georgia/indexer/tire/georgia/page.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3f4c9543e2181d35f09f90bd82cf2f523053974
|
4
|
+
data.tar.gz: 05657441a546365bb0011bc5e9b518acf44d602c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03bc9f24c25a6972570bb1636b38f1c5cf4d65a9f807bcde8cbc33e55c70cee9aa84b073594bed7fda169eda3f9069c434cb17d2bcb38f0ca9f9ddf4c3640511
|
7
|
+
data.tar.gz: a8c4409742f2d91a1a2dd2c9eed84f49158c1983d107e1be6d4cbdf56904d6904255455aaa8561bb4b80a2d3f70fd48a56bc403862a7e5488213dc3e6a480cb1
|
data/README.md
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/georgia.png)](http://badge.fury.io/rb/georgia)
|
4
4
|
[![Build Status](https://travis-ci.org/georgia-cms/georgia.png?branch=master)](https://travis-ci.org/georgia-cms/georgia)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/georgia-cms/georgia.png)](https://codeclimate.com/github/georgia-cms/georgia)
|
6
|
+
[![Coverage Status](https://coveralls.io/repos/georgia-cms/georgia/badge.png)](https://coveralls.io/r/georgia-cms/georgia)
|
6
7
|
|
7
8
|
Rails. Engine. CMS. Plug-and-play content management system for Ruby on Rails. Have a peak at the [demo](http://sorrynodemoyet.com/i-promise-it-s-on-its-way).
|
8
9
|
|
@@ -11,8 +12,9 @@ Rails. Engine. CMS. Plug-and-play content management system for Ruby on Rails. H
|
|
11
12
|
* Media library on the cloud
|
12
13
|
* Spam filter on emails
|
13
14
|
* Multilingual from the get-go
|
14
|
-
* Review
|
15
|
-
*
|
15
|
+
* Review you pairs and draft new pages
|
16
|
+
* Preview before publishing
|
17
|
+
* Rollback to previous revisions when it hits the fan
|
16
18
|
* Great UI, nice search, gravatars
|
17
19
|
* Editable menus
|
18
20
|
* Extendable
|
@@ -39,7 +41,7 @@ Georgia uses available_locales to know which translations should be configured o
|
|
39
41
|
|
40
42
|
Then run the generator to mount routes, run migrations & setup initial instances.
|
41
43
|
|
42
|
-
|
44
|
+
rails generate georgia:install
|
43
45
|
|
44
46
|
Start your server (`rails server`) and go to [http://localhost:3000/admin](http://localhost:3000/admin) to get started.
|
45
47
|
|
@@ -57,11 +59,6 @@ Add `config/initializers/bonsai.rb` with:
|
|
57
59
|
Finally, create your indices with these commands:
|
58
60
|
|
59
61
|
heroku run rake environment tire:import CLASS=Georgia::Page FORCE=true
|
60
|
-
heroku run rake environment tire:import CLASS=Georgia::Message FORCE=true
|
61
62
|
heroku run rake environment tire:import CLASS=Ckeditor::Asset FORCE=true
|
62
63
|
|
63
|
-
For more information, you can also follow these [instructions](https://gist.github.com/nz/2041121) to setup bonsai.io. More [here](https://devcenter.heroku.com/articles/bonsai) on heroku.com
|
64
|
-
|
65
|
-
### Spam filtering
|
66
|
-
|
67
|
-
TODO
|
64
|
+
For more information, you can also follow these [instructions](https://gist.github.com/nz/2041121) to setup bonsai.io. More [here](https://devcenter.heroku.com/articles/bonsai) on heroku.com
|
@@ -1,7 +1,5 @@
|
|
1
|
-
var CKEDITOR_BASEPATH = '/assets/ckeditor/';
|
2
1
|
CKEDITOR.config.ignoreEmptyParagraph = false;
|
3
2
|
CKEDITOR.config.allowedContent = true;
|
4
|
-
CKEDITOR.config.baseHref = '/assets/ckeditor/';
|
5
3
|
CKEDITOR.config.height = 400;
|
6
4
|
CKEDITOR.config.width = '95.5%';
|
7
5
|
CKEDITOR.config.toolbarStartupExpanded = false;
|
@@ -5,8 +5,10 @@ module Georgia
|
|
5
5
|
if can?(:approve, Georgia::Revision) or can?(:review, Georgia::Revision)
|
6
6
|
@awaiting_revisions = Georgia::Revision.reviews.select{|r| r.revisionable.present?}
|
7
7
|
end
|
8
|
-
if
|
9
|
-
|
8
|
+
if defined? GeorgiaMailer::Message
|
9
|
+
if can?(:index, Georgia::Message)
|
10
|
+
@messages = Georgia::Message.ham.latest.limit(5).decorate
|
11
|
+
end
|
10
12
|
end
|
11
13
|
end
|
12
14
|
|
@@ -1,11 +1,16 @@
|
|
1
1
|
class Ckeditor::Asset < ActiveRecord::Base
|
2
2
|
|
3
|
+
include Georgia::Indexer::Adapter
|
4
|
+
is_searchable({
|
5
|
+
solr: Georgia::Indexer::SolrAdapter::CkeditorAssetExtension,
|
6
|
+
tire: Georgia::Indexer::TireAdapter::CkeditorAssetExtension,
|
7
|
+
})
|
8
|
+
|
3
9
|
# to allow media_path in to_jq_upload
|
4
10
|
include Georgia::Engine.routes.url_helpers
|
5
11
|
|
6
12
|
include Ckeditor::Orm::ActiveRecord::AssetBase
|
7
13
|
include Georgia::Concerns::Taggable
|
8
|
-
include Georgia::Indexer
|
9
14
|
|
10
15
|
delegate :url, :current_path, :content_type, to: :data
|
11
16
|
|
@@ -40,6 +45,4 @@ class Ckeditor::Asset < ActiveRecord::Base
|
|
40
45
|
'> 1 MB' => 1000..999999
|
41
46
|
}
|
42
47
|
|
43
|
-
|
44
|
-
|
45
48
|
end
|
data/app/models/georgia/page.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
module Georgia
|
2
2
|
class Page < ActiveRecord::Base
|
3
3
|
|
4
|
-
include Georgia::Indexer
|
4
|
+
include Georgia::Indexer::Adapter
|
5
|
+
is_searchable({
|
6
|
+
solr: Georgia::Indexer::SolrAdapter::GeorgiaPageExtension,
|
7
|
+
tire: Georgia::Indexer::TireAdapter::GeorgiaPageExtension
|
8
|
+
})
|
9
|
+
|
5
10
|
include Georgia::Concerns::Taggable
|
6
11
|
include Georgia::Concerns::Orderable
|
7
12
|
include Georgia::Concerns::Slugable
|
data/config/routes.rb
CHANGED
@@ -51,24 +51,12 @@ Georgia::Engine.routes.draw do
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
resources :users
|
54
|
-
resources :messages do
|
55
|
-
collection do
|
56
|
-
get :search
|
57
|
-
get :destroy_all_spam
|
58
|
-
end
|
59
|
-
member do
|
60
|
-
get :spam
|
61
|
-
get :ham
|
62
|
-
end
|
63
|
-
end
|
64
54
|
resources :menus, path: 'navigation'
|
65
55
|
resources :links, only: [:create, :show]
|
66
56
|
resources :widgets
|
67
57
|
resources :ui_associations, path: 'ui-associations', only: [:new]
|
68
58
|
resources :slides, only: [:new]
|
69
59
|
|
70
|
-
match '/search/messages', to: 'search#messages'
|
71
|
-
|
72
60
|
unauthenticated do
|
73
61
|
as :user do
|
74
62
|
root :to => 'users/sessions#new'
|
data/lib/georgia.rb
CHANGED
@@ -16,10 +16,10 @@ module Georgia
|
|
16
16
|
@@url = "http://www.example.com"
|
17
17
|
|
18
18
|
mattr_accessor :navigation
|
19
|
-
@@navigation = %w(dashboard pages
|
19
|
+
@@navigation = %w(dashboard pages media navigation widgets)
|
20
20
|
|
21
21
|
mattr_accessor :indexer
|
22
|
-
@@indexer = :
|
22
|
+
@@indexer = :tire
|
23
23
|
|
24
24
|
def self.setup
|
25
25
|
yield self
|
data/lib/georgia/engine.rb
CHANGED
@@ -17,12 +17,8 @@ module Georgia
|
|
17
17
|
require 'carrierwave'
|
18
18
|
require 'draper'
|
19
19
|
require 'ancestry'
|
20
|
-
require 'cloudfiles'
|
21
20
|
require 'state_machine'
|
22
|
-
require 'sendgrid'
|
23
21
|
require 'routing_concerns'
|
24
|
-
require 'rakismet'
|
25
|
-
require 'sidekiq'
|
26
22
|
|
27
23
|
require 'sass-rails'
|
28
24
|
require 'bourbon'
|
@@ -36,13 +32,7 @@ module Georgia
|
|
36
32
|
|
37
33
|
initializer 'georgia.action_controller' do |app|
|
38
34
|
ActiveSupport.on_load :action_controller do
|
39
|
-
helper Georgia::DeviseHelper
|
40
|
-
helper Georgia::FormsHelper
|
41
|
-
helper Georgia::RoutesHelper
|
42
|
-
helper Georgia::UiHelper
|
43
|
-
helper Georgia::MenusHelper
|
44
35
|
helper Georgia::MetaTagsHelper
|
45
|
-
helper Georgia::TwitterHelper
|
46
36
|
helper Georgia::InternationalizationHelper
|
47
37
|
end
|
48
38
|
end
|
data/lib/georgia/indexer.rb
CHANGED
@@ -1,26 +1,44 @@
|
|
1
|
-
require '
|
1
|
+
require 'active_support/concern'
|
2
2
|
|
3
3
|
module Georgia
|
4
4
|
module Indexer
|
5
5
|
autoload :SolrAdapter, 'georgia/indexer/solr_adapter'
|
6
6
|
autoload :TireAdapter, 'georgia/indexer/tire_adapter'
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
def self.included(base)
|
8
|
+
def self.adapter
|
11
9
|
@@adapter ||= adapter_lookup
|
12
10
|
end
|
13
11
|
|
12
|
+
# Delegates search to the adapter
|
13
|
+
def self.search model, params
|
14
|
+
adapter.search model, params
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.searching model, extension
|
18
|
+
adapter.searching model, extension
|
19
|
+
end
|
20
|
+
|
14
21
|
private
|
15
22
|
|
16
23
|
def self.adapter_lookup
|
17
24
|
(case Georgia.indexer
|
18
|
-
when :solr then
|
19
|
-
when :tire then
|
25
|
+
when :solr then SolrAdapter.new
|
26
|
+
when :tire then TireAdapter.new
|
20
27
|
else
|
21
|
-
|
28
|
+
TireAdapter.new
|
22
29
|
end)
|
23
30
|
end
|
24
31
|
|
32
|
+
module Adapter
|
33
|
+
extend ActiveSupport::Concern
|
34
|
+
|
35
|
+
included do
|
36
|
+
def self.is_searchable extensions={}
|
37
|
+
raise "No extension for the #{Georgia.indexer} indexer" unless extensions[Georgia.indexer].present?
|
38
|
+
self.send(:include, extensions[Georgia.indexer])
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
25
43
|
end
|
26
44
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
|
3
|
+
module Georgia
|
4
|
+
module Indexer
|
5
|
+
class SolrAdapter
|
6
|
+
module ActsAsTaggableOnTagExtension
|
7
|
+
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
|
12
|
+
searchable do
|
13
|
+
text :name
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
|
3
|
+
module Georgia
|
4
|
+
module Indexer
|
5
|
+
class SolrAdapter
|
6
|
+
module CkeditorAssetExtension
|
7
|
+
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
|
12
|
+
searchable do
|
13
|
+
text :filename, stored: true
|
14
|
+
text :tags do
|
15
|
+
tag_list.join(', ')
|
16
|
+
end
|
17
|
+
string :tags, stored: true, multiple: true do
|
18
|
+
tag_list
|
19
|
+
end
|
20
|
+
string :extension, stored: true do
|
21
|
+
extension.try(:downcase)
|
22
|
+
end
|
23
|
+
time :updated_at
|
24
|
+
integer :size, stored: true do
|
25
|
+
size / 1024 # gives size in KB
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.search_index model, params
|
30
|
+
@search = model.search do
|
31
|
+
fulltext params[:query] do
|
32
|
+
fields(:filename, :tags)
|
33
|
+
end
|
34
|
+
with(:extension, params[:e]) unless params[:e].blank?
|
35
|
+
with(:tags).any_of(params[:tg]) unless params[:tg].blank?
|
36
|
+
order_by (params[:o] || :updated_at), (params[:dir] || :desc)
|
37
|
+
paginate(page: params[:page], per_page: (params[:per] || 8))
|
38
|
+
end.results
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
|
3
|
+
module Georgia
|
4
|
+
module Indexer
|
5
|
+
class SolrAdapter
|
6
|
+
module GeorgiaPageExtension
|
7
|
+
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
|
12
|
+
searchable do
|
13
|
+
text :title, stored: true do
|
14
|
+
revisions.map{|r| r.contents.map(&:title)}.flatten.uniq.join(', ')
|
15
|
+
end
|
16
|
+
text :excerpt, stored: true do
|
17
|
+
revisions.map{|r| r.contents.map(&:excerpt)}.flatten.uniq.join(', ')
|
18
|
+
end
|
19
|
+
text :text do
|
20
|
+
revisions.map{|r| r.contents.map(&:text)}.flatten.uniq.join(', ')
|
21
|
+
end
|
22
|
+
text :keywords do
|
23
|
+
revisions.map{|r| r.contents.map(&:keyword_list)}.flatten.uniq.join(', ')
|
24
|
+
end
|
25
|
+
text :template do
|
26
|
+
revisions.map(&:template).uniq.join(', ')
|
27
|
+
end
|
28
|
+
text :tags do
|
29
|
+
tag_list.join(', ')
|
30
|
+
end
|
31
|
+
text :url
|
32
|
+
string :class_name do
|
33
|
+
self.class.name
|
34
|
+
end
|
35
|
+
string :title
|
36
|
+
string :excerpt
|
37
|
+
string :text
|
38
|
+
string :url
|
39
|
+
string :template
|
40
|
+
string :state do
|
41
|
+
publish_state
|
42
|
+
end
|
43
|
+
string :keywords, stored: true, multiple: true do
|
44
|
+
revisions.map{|r| r.contents.map(&:keyword_list)}.flatten.uniq
|
45
|
+
end
|
46
|
+
string :tag_list, stored: true, multiple: true #Facets (multiple)
|
47
|
+
string :tags do #Ordering (single list)
|
48
|
+
tag_list.join(', ')
|
49
|
+
end
|
50
|
+
time :updated_at # default for ordering
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.search_index model, params
|
54
|
+
@search = model.search do
|
55
|
+
fulltext params[:query] do
|
56
|
+
fields(:title, :excerpt, :text, :keywords, :tags, :url, :template)
|
57
|
+
end
|
58
|
+
facet :state, :template, :tag_list
|
59
|
+
# ensure pages indexed in the wrong bucket don't get displayed
|
60
|
+
with(:class_name, model.to_s)
|
61
|
+
with(:state, params[:s]) unless params[:s].blank?
|
62
|
+
with(:template, params[:t]) unless params[:t].blank?
|
63
|
+
with(:tag_list).all_of(params[:tg]) unless params[:tg].blank?
|
64
|
+
order_by (params[:o] || :updated_at), (params[:dir] || :desc)
|
65
|
+
paginate(page: params[:page], per_page: (params[:per] || 25))
|
66
|
+
instance_eval &model.extra_search_params if model.respond_to? :extra_search_params
|
67
|
+
end.results
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
|
3
|
+
module Georgia
|
4
|
+
module Indexer
|
5
|
+
class TireAdapter
|
6
|
+
module ActsAsTaggableOnTagExtension
|
7
|
+
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
|
12
|
+
include ::Tire::Model::Search
|
13
|
+
include ::Tire::Model::Callbacks
|
14
|
+
|
15
|
+
def to_indexed_json
|
16
|
+
{name: name}.to_json
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
|
3
|
+
module Georgia
|
4
|
+
module Indexer
|
5
|
+
class TireAdapter
|
6
|
+
module CkeditorAssetExtension
|
7
|
+
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
|
12
|
+
include ::Tire::Model::Search
|
13
|
+
include ::Tire::Model::Callbacks
|
14
|
+
|
15
|
+
mapping do
|
16
|
+
indexes :id, :index => :not_analyzed
|
17
|
+
indexes :filename
|
18
|
+
indexes :tags
|
19
|
+
indexes :extension
|
20
|
+
indexes :updated_at, :type => 'date'
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.search model, params
|
24
|
+
model.tire.search(page: (params[:page] || 1), per_page: (params[:per] || 8)) do
|
25
|
+
if params[:query].present?
|
26
|
+
query do
|
27
|
+
boolean do
|
28
|
+
must { string params[:query], default_operator: "AND" }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
sort { by (params[:o] || :updated_at), (params[:dir] || :desc) }
|
32
|
+
end
|
33
|
+
end.results
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|