georgia 0.7.7 → 0.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +78 -5
- data/app/assets/javascripts/georgia/components/asset-uploader.js.coffee +1 -1
- data/app/controllers/georgia/api/media_controller.rb +2 -2
- data/app/controllers/georgia/api/tags_controller.rb +1 -1
- data/app/controllers/georgia/media_controller.rb +7 -6
- data/app/controllers/georgia/pages_controller.rb +2 -2
- data/app/helpers/georgia/ui_helper.rb +5 -0
- data/app/models/ckeditor/asset.rb +6 -1
- data/app/models/ckeditor/attachment_file.rb +1 -1
- data/app/models/ckeditor/picture.rb +10 -1
- data/app/presenters/georgia/list_facet_presenter.rb +1 -1
- data/app/services/create_media_asset.rb +51 -0
- data/app/uploaders/ckeditor/attachment_file_uploader.rb +19 -0
- data/app/uploaders/ckeditor/picture_uploader.rb +23 -0
- data/app/views/georgia/ckeditor/pictures/_picture.html.erb +1 -1
- data/app/views/georgia/media/create.js.erb +6 -1
- data/app/views/georgia/media/edit.html.erb +3 -3
- data/app/views/layouts/georgia/_header.html.erb +2 -2
- data/lib/generators/georgia/install/install_generator.rb +14 -13
- data/lib/generators/georgia/install/templates/README +1 -3
- data/lib/generators/georgia/install/templates/config/initializers/carrierwave.example.rb +44 -0
- data/lib/generators/georgia/install/templates/config/initializers/georgia.rb +4 -0
- data/lib/generators/georgia/views/templates/app/views/pages/templates/_one-column.html.erb +1 -1
- data/lib/georgia.rb +4 -0
- data/lib/georgia/indexer/extensions/solr_adapter/acts_as_taggable_on/tag.rb +1 -1
- data/lib/georgia/indexer/extensions/solr_adapter/ckeditor/asset.rb +1 -1
- data/lib/georgia/indexer/extensions/solr_adapter/georgia/page.rb +2 -2
- data/lib/georgia/indexer/extensions/tire_adapter/acts_as_taggable_on/tag.rb +12 -2
- data/lib/georgia/indexer/extensions/tire_adapter/ckeditor/asset.rb +5 -1
- data/lib/georgia/indexer/extensions/tire_adapter/georgia/page.rb +1 -1
- data/lib/georgia/uploader/adapter.rb +23 -0
- data/lib/georgia/uploader/storage/cloudinary.rb +21 -0
- data/lib/georgia/uploader/storage/fog.rb +23 -0
- data/lib/georgia/version.rb +1 -1
- data/lib/tasks/georgia.rake +56 -5
- metadata +23 -6
- data/app/helpers/georgia/modals_helper.rb +0 -7
- data/app/uploaders/ckeditor_attachment_file_uploader.rb +0 -16
- data/app/uploaders/ckeditor_picture_uploader.rb +0 -36
- data/app/uploaders/georgia/attachment_uploader.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 299c38cb8ad39e71ee60b95ec7257d07e34065f3
|
4
|
+
data.tar.gz: 08ad778ae03b46ff2cfde384e120eb4b87ecddfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e384d34497ed13604fcafde5553b76b9e80fbb42fd2e1275ce95b0735dcea7e1e54a2a29088909825f3529e898cbb4fa411be7ceec294b55fcbb490a938d8d52
|
7
|
+
data.tar.gz: 3aad07802f87602d35395ef8fdba06c4077a4137c1389d8d7fd745243e17c2ac4a7b3961b9523b0d2ed99b5de87c9ee7c7f153bb903677f7741d54933d78e500
|
data/README.md
CHANGED
@@ -32,11 +32,17 @@ Rails. Engine. CMS. Plug-and-play content management system for Ruby on Rails. H
|
|
32
32
|
|
33
33
|
### Getting started
|
34
34
|
|
35
|
+
Add Georgia to your Gemfile
|
36
|
+
|
37
|
+
gem 'georgia'
|
38
|
+
|
35
39
|
Make sure you have properly identify your default locale and possible available ones.
|
36
40
|
Georgia uses available_locales to know which translations should be configured or not.
|
37
41
|
|
38
|
-
|
39
|
-
|
42
|
+
``` ruby
|
43
|
+
config.i18n.default_locale = :en
|
44
|
+
config.i18n.available_locales = [:en]
|
45
|
+
```
|
40
46
|
|
41
47
|
Then run the generator to mount routes, run migrations & setup initial instances.
|
42
48
|
|
@@ -48,21 +54,88 @@ We built Georgia to help you quickly develop an application with a CMS (Content
|
|
48
54
|
|
49
55
|
Start your server (`rails server`) and go to [http://localhost:3000/admin](http://localhost:3000/admin) to get started.
|
50
56
|
|
57
|
+
### Cloud Storage
|
58
|
+
|
59
|
+
Georgia's media library stores your documents and images on the cloud. You'll need to configure the solution that best fits your needs. Two options for you: Cloudinary or Custom Storage with Fog (e.g. Amazon S3, Rackspace Cloud Files)
|
60
|
+
|
61
|
+
#### Cloudinary
|
62
|
+
|
63
|
+
This will only work if you plan to have only pictures/images in your Media Library. Cloudinary won't work for `.pdf` files and other documents.
|
64
|
+
|
65
|
+
1. Add cloudinary gem to your Gemfile.
|
66
|
+
|
67
|
+
gem 'cloudinary'
|
68
|
+
|
69
|
+
2. Set storage to `:cloudinary` in the `config/initializers/georgia.rb` file.
|
70
|
+
|
71
|
+
``` ruby
|
72
|
+
Georgia.setup do |config|
|
73
|
+
...
|
74
|
+
|
75
|
+
# Storage
|
76
|
+
config.storage = :cloudinary
|
77
|
+
end
|
78
|
+
```
|
79
|
+
|
80
|
+
3. Open a Cloudinary Account
|
81
|
+
|
82
|
+
You can skip this step if you plan on using Heroku. Otherwise, take 10 seconds to open an account on Cloudinary if not already done. Download your `cloudinary.yml` file and add to your config folder.
|
83
|
+
|
84
|
+
#### Custom Storage
|
85
|
+
|
86
|
+
The `georgia:install` generator added a `carrierwave.example.rb` file to your initializers. Use it to configure your custom location.
|
87
|
+
|
51
88
|
### Heroku
|
52
89
|
|
53
|
-
|
90
|
+
Georgia will run smoothly and cheaply (read free) on Heroku but you will need certain addons to make it work, all free.
|
91
|
+
|
92
|
+
#### Sengrid
|
93
|
+
|
94
|
+
Add sendgrid addon to handle emails
|
54
95
|
|
55
|
-
heroku addons:add bonsai
|
56
96
|
heroku addons:add sendgrid
|
57
97
|
|
98
|
+
Add sendgrid config to your production environment file
|
99
|
+
|
100
|
+
``` ruby
|
101
|
+
# Send emails via sendgrid
|
102
|
+
config.action_mailer.smtp_settings = {
|
103
|
+
:address => 'smtp.sendgrid.net',
|
104
|
+
:port => '587',
|
105
|
+
:authentication => :plain,
|
106
|
+
:user_name => ENV['SENDGRID_USERNAME'],
|
107
|
+
:password => ENV['SENDGRID_PASSWORD'],
|
108
|
+
:domain => 'heroku.com',
|
109
|
+
:enable_starttls_auto => true
|
110
|
+
}
|
111
|
+
```
|
112
|
+
|
113
|
+
#### Bonsai
|
114
|
+
|
115
|
+
Add bonsai addon to handle elasticsearch
|
116
|
+
|
117
|
+
heroku addons:add bonsai
|
118
|
+
|
58
119
|
Add `config/initializers/bonsai.rb` with:
|
59
120
|
|
60
121
|
ENV['ELASTICSEARCH_URL'] = ENV['BONSAI_URL']
|
61
122
|
|
62
|
-
Create your indices with these commands:
|
123
|
+
Create your elasticsearch indices with these commands:
|
124
|
+
|
125
|
+
*** After your first deploy *** You need tire installed on Heroku to perform this.
|
63
126
|
|
64
127
|
heroku run rake environment tire:import CLASS=Georgia::Page FORCE=true
|
65
128
|
heroku run rake environment tire:import CLASS=Ckeditor::Asset FORCE=true
|
129
|
+
heroku run rake environment tire:import CLASS=Ckeditor::Picture FORCE=true
|
130
|
+
heroku run rake environment tire:import CLASS=ActsAsTaggableOn::Tag FORCE=true
|
131
|
+
|
132
|
+
#### Cloudinary
|
133
|
+
|
134
|
+
Add cloudinary addon to handle media library cloud storage
|
135
|
+
|
136
|
+
heroku addons:add cloudinary
|
137
|
+
|
138
|
+
#### Create your admin user
|
66
139
|
|
67
140
|
Finally, create your first admin user to access to web panel:
|
68
141
|
|
@@ -3,8 +3,8 @@ module Georgia
|
|
3
3
|
class MediaController < Georgia::ApplicationController
|
4
4
|
|
5
5
|
def pictures
|
6
|
-
@
|
7
|
-
@pictures = Ckeditor::PictureDecorator.decorate_collection(@
|
6
|
+
@search = Georgia::Indexer.search(Ckeditor::Picture, params.merge(per: 12))
|
7
|
+
@pictures = Ckeditor::PictureDecorator.decorate_collection(@search.results)
|
8
8
|
render layout: false
|
9
9
|
end
|
10
10
|
|
@@ -11,15 +11,16 @@ module Georgia
|
|
11
11
|
|
12
12
|
def search
|
13
13
|
@asset = Ckeditor::Asset.new
|
14
|
-
@
|
15
|
-
@assets = Ckeditor::AssetDecorator.decorate_collection(@results)
|
14
|
+
@search = Georgia::Indexer.search(Ckeditor::Asset, params)
|
15
|
+
@assets = Ckeditor::AssetDecorator.decorate_collection(@search.results)
|
16
16
|
end
|
17
17
|
|
18
18
|
def create
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
begin
|
20
|
+
@assets = params[:assets].map{|asset| CreateMediaAsset.new(asset).call}
|
21
|
+
@assets = Ckeditor::AssetDecorator.decorate_collection(@assets)
|
22
|
+
rescue ArgumentError => ex
|
23
|
+
flash.now[:alert] = ex.message
|
23
24
|
end
|
24
25
|
render layout: false
|
25
26
|
end
|
@@ -149,8 +149,8 @@ module Georgia
|
|
149
149
|
|
150
150
|
def search
|
151
151
|
session[:search_params] = params
|
152
|
-
@
|
153
|
-
@pages = Georgia::PageDecorator.decorate_collection(@results)
|
152
|
+
@search = Georgia::Indexer.adapter.search(model, params)
|
153
|
+
@pages = Georgia::PageDecorator.decorate_collection(@search.results)
|
154
154
|
end
|
155
155
|
|
156
156
|
private
|
@@ -31,6 +31,11 @@ module Georgia
|
|
31
31
|
link_to text, url, options.reverse_merge(data: {confirm: 'Are you sure?'}, method: :delete, class: 'btn btn-danger')
|
32
32
|
end
|
33
33
|
|
34
|
+
# Link to close modal box
|
35
|
+
def link_to_close
|
36
|
+
content_tag :button, icon_tag('times'), class: 'close', data: {dismiss: 'modal'}, aria: {hidden: true}, type: 'button'
|
37
|
+
end
|
38
|
+
|
34
39
|
def tooltip_tag icon, tooltip, options={}
|
35
40
|
content_tag(:span, icon, options.reverse_merge(title: tooltip, class: 'js-tooltip', data: {placement: 'right'}))
|
36
41
|
end
|
@@ -10,7 +10,7 @@ class Ckeditor::Asset < ActiveRecord::Base
|
|
10
10
|
|
11
11
|
delegate :url, :current_path, :content_type, to: :data
|
12
12
|
|
13
|
-
mount_uploader :data,
|
13
|
+
mount_uploader :data, Ckeditor::AttachmentFileUploader, mount_on: :data_file_name
|
14
14
|
|
15
15
|
validates :data, presence: true
|
16
16
|
attr_accessible :data
|
@@ -29,7 +29,12 @@ class Ckeditor::Asset < ActiveRecord::Base
|
|
29
29
|
}
|
30
30
|
end
|
31
31
|
|
32
|
+
def short_name
|
33
|
+
@short_name ||= self.data.file.filename.dup.gsub(/(.*)\.#{extension}/, '\1') if data.file and data.file.filename
|
34
|
+
end
|
35
|
+
|
32
36
|
def extension
|
37
|
+
self.data_content_type ||= self.data.file.content_type
|
33
38
|
@extension ||= data_content_type.gsub(/.*\/(.*)/, '\1')
|
34
39
|
end
|
35
40
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class Ckeditor::AttachmentFile < Ckeditor::Asset
|
2
|
-
mount_uploader :data,
|
2
|
+
mount_uploader :data, Ckeditor::AttachmentFileUploader, :mount_on => :data_file_name
|
3
3
|
|
4
4
|
def url_thumb
|
5
5
|
@url_thumb ||= Ckeditor::Utils.filethumb(filename)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Ckeditor::Picture < Ckeditor::Asset
|
2
2
|
|
3
|
-
mount_uploader :data,
|
3
|
+
mount_uploader :data, Ckeditor::PictureUploader, mount_on: :data_file_name
|
4
4
|
|
5
5
|
has_many :contents, foreign_key: :image_id, class_name: Georgia::Content
|
6
6
|
|
@@ -12,4 +12,13 @@ class Ckeditor::Picture < Ckeditor::Asset
|
|
12
12
|
@pages ||= contents.map(&:contentable).map(&:page).compact.uniq
|
13
13
|
end
|
14
14
|
|
15
|
+
def filename
|
16
|
+
@filename ||=
|
17
|
+
if defined?(Cloudinary)
|
18
|
+
data_file_name.dup.gsub(/v\d{10}\/(.*)/, '\1') || data_file_name
|
19
|
+
else
|
20
|
+
data_file_name
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
15
24
|
end
|
@@ -0,0 +1,51 @@
|
|
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
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Ckeditor
|
2
|
+
class AttachmentFileUploader < CarrierWave::Uploader::Base
|
3
|
+
include Ckeditor::Backend::CarrierWave
|
4
|
+
|
5
|
+
# Fallback to file system. Files will be attached to emails when sent
|
6
|
+
case Georgia.storage
|
7
|
+
when :fog then storage(:fog)
|
8
|
+
when :cloudinary then storage(:file)
|
9
|
+
end
|
10
|
+
|
11
|
+
def store_dir
|
12
|
+
"assets/#{model.id}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def extension_white_list
|
16
|
+
%w(doc docx odt xls ods csv pdf rar zip tar tar.gz ppt pptx) + Ckeditor.image_file_types
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Ckeditor
|
2
|
+
class PictureUploader < CarrierWave::Uploader::Base
|
3
|
+
|
4
|
+
include Georgia::Uploader::Adapter
|
5
|
+
|
6
|
+
def extension_white_list
|
7
|
+
Ckeditor.image_file_types
|
8
|
+
end
|
9
|
+
|
10
|
+
version :tiny do
|
11
|
+
process resize_to_fill: [65, 65]
|
12
|
+
end
|
13
|
+
|
14
|
+
version :thumb do
|
15
|
+
process resize_to_fill: [160, 120]
|
16
|
+
end
|
17
|
+
|
18
|
+
version :content do
|
19
|
+
process resize_to_limit: [800, 800]
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
</td>
|
5
5
|
<td class='thumbnail-cell'>
|
6
6
|
<%= link_to picture.url_content, class: 'media-link bg-transparent', rel: 'shadowbox[gallery]' do %>
|
7
|
-
<%= image_tag picture.url(:tiny), title: picture.
|
7
|
+
<%= image_tag picture.url(:tiny), title: picture.filename, class: 'media-image' %>
|
8
8
|
<% end %>
|
9
9
|
</td>
|
10
10
|
<td>
|
@@ -8,7 +8,7 @@
|
|
8
8
|
<div class="col-md-9">
|
9
9
|
|
10
10
|
<h2>
|
11
|
-
<%= link_to @asset.
|
11
|
+
<%= link_to @asset.filename, @asset.url %>
|
12
12
|
<% unless @asset.is_a?(Ckeditor::Picture) %>
|
13
13
|
<%= link_to icon_tag('link'), @asset.url, title: @asset.url, target: '_blank', class: 'btn btn-default' %>
|
14
14
|
<% end -%>
|
@@ -25,7 +25,7 @@
|
|
25
25
|
</span>
|
26
26
|
<% end -%>
|
27
27
|
</div>
|
28
|
-
<%= image_tag @asset.url(:content), title: @asset.
|
28
|
+
<%= image_tag @asset.url(:content), title: @asset.filename, class: 'media-image--inline' %>
|
29
29
|
</div>
|
30
30
|
<% end -%>
|
31
31
|
</div>
|
@@ -36,7 +36,7 @@
|
|
36
36
|
</div>
|
37
37
|
<div class="panel-body">
|
38
38
|
<p>
|
39
|
-
<b>File Name</b>: <%= @asset.
|
39
|
+
<b>File Name</b>: <%= @asset.filename %><br />
|
40
40
|
<b>Content Type</b>: <%= @asset.data_content_type %><br />
|
41
41
|
<% if @asset.is_a?(Ckeditor::Picture) %>
|
42
42
|
<b>File Size</b>: <%= number_to_human_size(@asset.data_file_size) %><br />
|
@@ -20,7 +20,7 @@
|
|
20
20
|
<ul class="nav navbar-nav navbar-right">
|
21
21
|
<% if can? :index, Georgia::User %>
|
22
22
|
<li>
|
23
|
-
<%= link_to icon_tag('users'), users_path, class: 'header-link--icon' %>
|
23
|
+
<%= link_to icon_tag('users'), georgia.users_path, class: 'header-link--icon' %>
|
24
24
|
</li>
|
25
25
|
<% end -%>
|
26
26
|
<li class='dropdown'>
|
@@ -30,7 +30,7 @@
|
|
30
30
|
<%= content_tag(:b, nil, class: 'caret') %>
|
31
31
|
<% end -%>
|
32
32
|
<ul class="dropdown-menu">
|
33
|
-
<li><%= link_to('Logout', destroy_user_session_path, method: :delete) %></li>
|
33
|
+
<li><%= link_to('Logout', georgia.destroy_user_session_path, method: :delete) %></li>
|
34
34
|
</ul>
|
35
35
|
</li>
|
36
36
|
</ul>
|
@@ -1,11 +1,8 @@
|
|
1
|
-
|
2
|
-
require 'rails/generators/migration'
|
3
|
-
require 'rails/generators/active_record'
|
1
|
+
require 'bundler'
|
4
2
|
|
5
3
|
module Georgia
|
6
4
|
module Generators
|
7
5
|
class InstallGenerator < ::Rails::Generators::Base
|
8
|
-
include Rails::Generators::Migration
|
9
6
|
source_root File.expand_path('../templates', __FILE__)
|
10
7
|
|
11
8
|
desc "Installs Georgia CMS:\n
|
@@ -24,10 +21,6 @@ module Georgia
|
|
24
21
|
route "mount Georgia::Engine => '/admin'"
|
25
22
|
end
|
26
23
|
|
27
|
-
def self.next_migration_number(number)
|
28
|
-
ActiveRecord::Generators::Base.next_migration_number(number)
|
29
|
-
end
|
30
|
-
|
31
24
|
def run_migrations
|
32
25
|
rake "railties:install:migrations"
|
33
26
|
rake "db:migrate"
|
@@ -40,15 +33,23 @@ module Georgia
|
|
40
33
|
|
41
34
|
def copy_templates
|
42
35
|
copy_file "config/initializers/georgia.rb"
|
36
|
+
copy_file "config/initializers/carrierwave.example.rb"
|
43
37
|
copy_file "app/controllers/pages_controller.rb"
|
44
38
|
end
|
45
39
|
|
46
|
-
def
|
47
|
-
if defined?
|
48
|
-
|
49
|
-
|
50
|
-
|
40
|
+
def add_default_indexer
|
41
|
+
return if defined?(Sunspot)
|
42
|
+
if !defined?(Tire)
|
43
|
+
say("Adding Tire gem for Elasticsearch", :yellow)
|
44
|
+
gem 'tire'
|
45
|
+
Bundler.with_clean_env do
|
46
|
+
run "bundle install"
|
47
|
+
end
|
51
48
|
end
|
49
|
+
say("Creating elasticsearch indices", :yellow)
|
50
|
+
rake "environment tire:import CLASS=Georgia::Page FORCE=true"
|
51
|
+
rake "environment tire:import CLASS=Ckeditor::Asset FORCE=true"
|
52
|
+
rake "environment tire:import CLASS=Ckeditor::Picture FORCE=true"
|
52
53
|
end
|
53
54
|
|
54
55
|
def show_readme
|
@@ -5,8 +5,6 @@ Some setup you must do manually if you haven't yet:
|
|
5
5
|
1. Ensure you overwrite default options in your georgia initializer.
|
6
6
|
Find me at config/initializers/georgia.rb
|
7
7
|
|
8
|
-
2. Ensure
|
9
|
-
|
10
|
-
3. Ensure you chose one of the 2 indexers currently available (solr or elasticsearch).
|
8
|
+
2. Ensure the routes we've just added did not messed up anything.
|
11
9
|
|
12
10
|
===============================================================================
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# This file was added by Georgia for you to customize a storage location
|
2
|
+
|
3
|
+
# Follow example configs from CarrierWave README file
|
4
|
+
# Here are some of their examples for Amazon, Rackspace and Google Storage
|
5
|
+
|
6
|
+
# AMAZON S3
|
7
|
+
# https://github.com/carrierwaveuploader/carrierwave#using-amazon-s3
|
8
|
+
# CarrierWave.configure do |config|
|
9
|
+
# config.fog_credentials = {
|
10
|
+
# :provider => 'AWS', # required
|
11
|
+
# :aws_access_key_id => 'xxx', # required
|
12
|
+
# :aws_secret_access_key => 'yyy', # required
|
13
|
+
# :region => 'eu-west-1', # optional, defaults to 'us-east-1'
|
14
|
+
# :host => 's3.example.com', # optional, defaults to nil
|
15
|
+
# :endpoint => 'https://s3.example.com:8080' # optional, defaults to nil
|
16
|
+
# }
|
17
|
+
# config.fog_directory = 'name_of_directory' # required
|
18
|
+
# config.fog_public = false # optional, defaults to true
|
19
|
+
# config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} # optional, defaults to {}
|
20
|
+
# end
|
21
|
+
|
22
|
+
# RACKSPACE
|
23
|
+
# https://github.com/carrierwaveuploader/carrierwave#using-rackspace-cloud-files
|
24
|
+
# CarrierWave.configure do |config|
|
25
|
+
# config.fog_credentials = {
|
26
|
+
# :provider => 'Rackspace',
|
27
|
+
# :rackspace_username => 'xxxxxx',
|
28
|
+
# :rackspace_api_key => 'yyyyyy',
|
29
|
+
# :rackspace_region => :ord # optional, defaults to :dfw
|
30
|
+
# }
|
31
|
+
# config.fog_directory = 'name_of_directory'
|
32
|
+
# config.asset_host = "http://c000000.cdn.rackspacecloud.com"
|
33
|
+
# end
|
34
|
+
|
35
|
+
# GOOGLE STORAGE
|
36
|
+
# https://github.com/carrierwaveuploader/carrierwave#using-google-storage-for-developers
|
37
|
+
# CarrierWave.configure do |config|
|
38
|
+
# config.fog_credentials = {
|
39
|
+
# :provider => 'Google',
|
40
|
+
# :google_storage_access_key_id => 'xxxxxx',
|
41
|
+
# :google_storage_secret_access_key => 'yyyyyy'
|
42
|
+
# }
|
43
|
+
# config.fog_directory = 'name_of_directory'
|
44
|
+
# end
|
@@ -1 +1 @@
|
|
1
|
-
<%= @page.text.html_safe %>
|
1
|
+
<%= @page.text.try(:html_safe) %>
|
data/lib/georgia.rb
CHANGED
@@ -2,6 +2,7 @@ require "georgia/version"
|
|
2
2
|
require "georgia/paths"
|
3
3
|
require "georgia/engine"
|
4
4
|
require "georgia/indexer"
|
5
|
+
require "georgia/uploader/adapter"
|
5
6
|
|
6
7
|
module Georgia
|
7
8
|
|
@@ -20,6 +21,9 @@ module Georgia
|
|
20
21
|
mattr_accessor :indexer
|
21
22
|
@@indexer = :tire
|
22
23
|
|
24
|
+
mattr_accessor :storage
|
25
|
+
@@storage = :fog
|
26
|
+
|
23
27
|
def self.setup
|
24
28
|
yield self
|
25
29
|
end
|
@@ -51,7 +51,7 @@ module Georgia
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def self.search_index model, params
|
54
|
-
|
54
|
+
model.search do
|
55
55
|
fulltext params[:query] do
|
56
56
|
fields(:title, :excerpt, :text, :keywords, :tags, :url, :template)
|
57
57
|
end
|
@@ -64,7 +64,7 @@ module Georgia
|
|
64
64
|
order_by (params[:o] || :updated_at), (params[:dir] || :desc)
|
65
65
|
paginate(page: params[:page], per_page: (params[:per] || 25))
|
66
66
|
instance_eval &model.extra_search_params if model.respond_to? :extra_search_params
|
67
|
-
end
|
67
|
+
end
|
68
68
|
end
|
69
69
|
|
70
70
|
end
|
@@ -4,7 +4,6 @@ module Georgia
|
|
4
4
|
module Indexer
|
5
5
|
module TireAdapter
|
6
6
|
module ActsAsTaggableOnTagExtension
|
7
|
-
|
8
7
|
extend ActiveSupport::Concern
|
9
8
|
|
10
9
|
included do
|
@@ -16,8 +15,19 @@ module Georgia
|
|
16
15
|
{name: name}.to_json
|
17
16
|
end
|
18
17
|
|
19
|
-
|
18
|
+
def self.search_index params
|
19
|
+
search(page: (params[:page] || 1), per_page: (params[:per] || 10)) do
|
20
|
+
if params[:q].present?
|
21
|
+
query do
|
22
|
+
boolean do
|
23
|
+
must { string params[:q], default_operator: "AND" }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
20
29
|
|
30
|
+
end
|
21
31
|
end
|
22
32
|
end
|
23
33
|
end
|
@@ -12,6 +12,10 @@ module Georgia
|
|
12
12
|
include ::Tire::Model::Search
|
13
13
|
include ::Tire::Model::Callbacks
|
14
14
|
|
15
|
+
after_rollback do
|
16
|
+
self.index.remove(self)
|
17
|
+
end
|
18
|
+
|
15
19
|
def to_indexed_json
|
16
20
|
indexed_hash = {
|
17
21
|
widt: width,
|
@@ -42,7 +46,7 @@ module Georgia
|
|
42
46
|
end
|
43
47
|
sort { by (params[:o] || :updated_at), (params[:dir] || :desc) } if params[:query].blank?
|
44
48
|
end
|
45
|
-
end
|
49
|
+
end
|
46
50
|
end
|
47
51
|
|
48
52
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
require 'georgia/uploader/storage/cloudinary'
|
3
|
+
require 'georgia/uploader/storage/fog'
|
4
|
+
|
5
|
+
module Georgia
|
6
|
+
module Uploader
|
7
|
+
module Adapter
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
case Georgia.storage
|
12
|
+
when :cloudinary
|
13
|
+
include(Georgia::Uploader::Storage::Cloudinary)
|
14
|
+
when :fog
|
15
|
+
include(Georgia::Uploader::Storage::Fog)
|
16
|
+
else
|
17
|
+
include(Georgia::Uploader::Storage::Fog)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
|
3
|
+
module Georgia
|
4
|
+
module Uploader
|
5
|
+
module Storage
|
6
|
+
module Cloudinary
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do
|
10
|
+
'georgia/uploader/storage/cloudinary'
|
11
|
+
include ::Cloudinary::CarrierWave
|
12
|
+
end
|
13
|
+
|
14
|
+
def public_id
|
15
|
+
model.short_name
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
|
3
|
+
module Georgia
|
4
|
+
module Uploader
|
5
|
+
module Storage
|
6
|
+
module Fog
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do
|
10
|
+
include Ckeditor::Backend::CarrierWave
|
11
|
+
require 'carrierwave/processing/mini_magick'
|
12
|
+
include CarrierWave::MiniMagick
|
13
|
+
storage :fog
|
14
|
+
end
|
15
|
+
|
16
|
+
def store_dir
|
17
|
+
"assets/#{model.id}"
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/georgia/version.rb
CHANGED
data/lib/tasks/georgia.rake
CHANGED
@@ -2,12 +2,63 @@ namespace :georgia do
|
|
2
2
|
|
3
3
|
desc "Creates an Admin user to get started"
|
4
4
|
task seed: :environment do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
require "highline/import"
|
6
|
+
|
7
|
+
class InvalidUser < StandardError; end
|
8
|
+
|
9
|
+
def echo_off
|
10
|
+
with_tty do
|
11
|
+
system "stty -echo"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def echo_on
|
16
|
+
with_tty do
|
17
|
+
system "stty echo"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def with_tty(&block)
|
22
|
+
return unless $stdin.isatty
|
23
|
+
begin
|
24
|
+
yield
|
25
|
+
rescue
|
26
|
+
# fails on windows
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def ask_for_password message
|
31
|
+
print message
|
32
|
+
echo_off
|
33
|
+
password = $stdin.gets.to_s.strip
|
34
|
+
puts
|
35
|
+
echo_on
|
36
|
+
password
|
37
|
+
end
|
38
|
+
|
39
|
+
def user_instance
|
40
|
+
first_name = ask("First name: ")
|
41
|
+
last_name = ask("Last name: ")
|
42
|
+
email = ask("Email: ")
|
43
|
+
password = ask_for_password("Password (typing will be hidden): ")
|
44
|
+
|
45
|
+
user = Georgia::User.new(
|
46
|
+
first_name: first_name,
|
47
|
+
last_name: last_name,
|
48
|
+
email: email,
|
49
|
+
password: password,
|
50
|
+
password_confirmation: password)
|
10
51
|
user.roles << Georgia::Role.all
|
52
|
+
user
|
53
|
+
end
|
54
|
+
|
55
|
+
begin
|
56
|
+
user = user_instance
|
57
|
+
raise InvalidUser, "#{user.errors.full_messages.join('. ')}" unless user.valid?
|
58
|
+
say(HighLine.color("Admin user successfully created.", :green)) if user.save
|
59
|
+
rescue InvalidUser => ex
|
60
|
+
say(HighLine.color(ex.message, :red))
|
61
|
+
retry
|
11
62
|
end
|
12
63
|
end
|
13
64
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: georgia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathieu Gagné
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.2.6
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: highline
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: jquery-rails
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -499,7 +513,6 @@ files:
|
|
499
513
|
- app/helpers/georgia/states_helper.rb
|
500
514
|
- app/helpers/georgia/facets_helper.rb
|
501
515
|
- app/helpers/georgia/ui_helper.rb
|
502
|
-
- app/helpers/georgia/modals_helper.rb
|
503
516
|
- app/helpers/georgia/checkboxes_helper.rb
|
504
517
|
- app/helpers/georgia/menus_helper.rb
|
505
518
|
- app/helpers/georgia/devise_helper.rb
|
@@ -690,9 +703,9 @@ files:
|
|
690
703
|
- app/presenters/georgia/presenter.rb
|
691
704
|
- app/presenters/georgia/sidebar_link_presenter.rb
|
692
705
|
- app/presenters/georgia/media_library_presenter.rb
|
693
|
-
- app/
|
694
|
-
- app/uploaders/
|
695
|
-
- app/uploaders/
|
706
|
+
- app/services/create_media_asset.rb
|
707
|
+
- app/uploaders/ckeditor/attachment_file_uploader.rb
|
708
|
+
- app/uploaders/ckeditor/picture_uploader.rb
|
696
709
|
- app/policies/georgia/policy.rb
|
697
710
|
- app/policies/georgia/revision_policy.rb
|
698
711
|
- config/locales/georgia.en.yml
|
@@ -725,6 +738,9 @@ files:
|
|
725
738
|
- lib/templates/erb/scaffold/_form.html.erb
|
726
739
|
- lib/georgia/version.rb
|
727
740
|
- lib/georgia/paths.rb
|
741
|
+
- lib/georgia/uploader/adapter.rb
|
742
|
+
- lib/georgia/uploader/storage/cloudinary.rb
|
743
|
+
- lib/georgia/uploader/storage/fog.rb
|
728
744
|
- lib/georgia/indexer.rb
|
729
745
|
- lib/georgia/engine.rb
|
730
746
|
- lib/georgia/indexer/adapter.rb
|
@@ -743,6 +759,7 @@ files:
|
|
743
759
|
- lib/generators/georgia/views/templates/app/views/pages/templates/_sidebar-right.html.erb
|
744
760
|
- lib/generators/georgia/views/templates/app/views/pages/show.html.erb
|
745
761
|
- lib/generators/georgia/install/install_generator.rb
|
762
|
+
- lib/generators/georgia/install/templates/config/initializers/carrierwave.example.rb
|
746
763
|
- lib/generators/georgia/install/templates/config/initializers/georgia.rb
|
747
764
|
- lib/generators/georgia/install/templates/app/controllers/pages_controller.rb
|
748
765
|
- lib/generators/georgia/install/templates/Procfile
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
class CkeditorAttachmentFileUploader < CarrierWave::Uploader::Base
|
3
|
-
include Ckeditor::Backend::CarrierWave
|
4
|
-
|
5
|
-
storage :fog
|
6
|
-
|
7
|
-
def store_dir
|
8
|
-
"assets/#{model.id}"
|
9
|
-
end
|
10
|
-
|
11
|
-
def extension_white_list
|
12
|
-
%w(doc docx odt xls ods csv pdf rar zip tar tar.gz ppt pptx) + Ckeditor.image_file_types
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
class CkeditorPictureUploader < CarrierWave::Uploader::Base
|
3
|
-
|
4
|
-
include Ckeditor::Backend::CarrierWave
|
5
|
-
require 'carrierwave/processing/mini_magick'
|
6
|
-
include CarrierWave::MiniMagick
|
7
|
-
|
8
|
-
storage :fog
|
9
|
-
|
10
|
-
def store_dir
|
11
|
-
"assets/#{model.id}"
|
12
|
-
end
|
13
|
-
|
14
|
-
def extension_white_list
|
15
|
-
Ckeditor.image_file_types
|
16
|
-
end
|
17
|
-
|
18
|
-
process :read_dimensions
|
19
|
-
|
20
|
-
version :tiny do
|
21
|
-
process resize_to_fill: [65, 65]
|
22
|
-
end
|
23
|
-
|
24
|
-
version :thumb do
|
25
|
-
process resize_to_fill: [160, 120]
|
26
|
-
end
|
27
|
-
|
28
|
-
version :big_thumb do
|
29
|
-
process resize_to_fill: [460, 280, 'North']
|
30
|
-
end
|
31
|
-
|
32
|
-
version :content do
|
33
|
-
process resize_to_limit: [800, 800]
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module Georgia
|
3
|
-
class AttachmentUploader < CarrierWave::Uploader::Base
|
4
|
-
|
5
|
-
storage :fog
|
6
|
-
|
7
|
-
def store_dir
|
8
|
-
"/uploads/ckeditor/attachments/#{model.id}"
|
9
|
-
end
|
10
|
-
|
11
|
-
def extension_white_list
|
12
|
-
Ckeditor.attachment_file_types
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|