activeadmin_cms 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG +3 -0
- data/README.md +8 -0
- data/app/admin/manage_pages.rb +22 -23
- data/app/admin/manage_posts.rb +1 -1
- data/app/assets/javascripts/activeadmin_cms/base.js +2 -1
- data/app/assets/javascripts/activeadmin_cms/editor/ace.js +20 -10
- data/app/assets/javascripts/activeadmin_cms/helpers/assets_uploader.js +47 -0
- data/app/assets/stylesheets/activeadmin_cms/base.css +23 -1
- data/app/assets/stylesheets/activeadmin_cms/editor/ace.css +2 -2
- data/app/controllers/activeadmin_cms/assets_controller.rb +23 -0
- data/app/models/activeadmin_cms/asset.rb +20 -0
- data/app/models/activeadmin_cms/page.rb +1 -6
- data/app/models/activeadmin_cms/post.rb +1 -4
- data/app/services/activeadmin_cms/assets_service.rb +17 -0
- data/app/views/admin/pages/_form.html.slim +26 -0
- data/config/routes.rb +1 -0
- data/db/migrate/20131020224503_create_activeadmin_cms_assets.rb +14 -0
- data/lib/activeadmin_cms/engine.rb +12 -0
- data/lib/activeadmin_cms/version.rb +1 -1
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +14 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +35 -0
- data/test/dummy/log/test.log +55 -0
- data/test/models/activeadmin_cms/asset_test.rb +9 -0
- metadata +38 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NmU5ODcxMmM0OGJjMTAyYTc2ODJiNDZmOGY3MDY3YzU1YTgxMDgxNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGM2ODkxYmMwNmFmNTUwMWUxYTFmOTBkNmUwZWQ4N2U1NWJhMTc1OQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTM2ZjVkZDAzZGZmOWM2OWMwMWE0NjA0NDM5ZGEzYzcyY2M2ZDgxYWU1Y2I5
|
10
|
+
YTA1ZWRjY2I1ZDhiNDNmODk1OTRkYmNjMDgxOThkYjg2NTRiOGQ2NGM2MmNj
|
11
|
+
MjI0MjdlZGI3Yzc2NTYxYjY5N2QwNDFkZGNjZjI5NjA1MDMxNzY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OWQyMDQ0ZTc1NzEwMTU5ZWJiYTMxMDI3NjkzNTRlODQwYmYyNzg3NDg2MWE4
|
14
|
+
ZDFlOTE5ZjE4NzUwOTNiOWZkZGU2OTk4YmUxMzE2MDA3YTE1ZmNkZDNjMzMz
|
15
|
+
Yjg3MzQ3YmU5MmMwYjMwMmQ4N2E2ZDhhZmU2NTE5NDAxNzgxOWE=
|
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -12,6 +12,7 @@ NOTE: ActiveAdminCms is only compatible with Rails 4 and cares only about admin
|
|
12
12
|
gem 'activeadmin', github: "gregbell/active_admin"
|
13
13
|
gem 'activeadmin_cms'
|
14
14
|
gem 'acts-as-taggable-on', github: 'mbleigh/acts-as-taggable-on' // if you are going to use tags
|
15
|
+
gem 'paperclip' // if you are going to use tags
|
15
16
|
```
|
16
17
|
|
17
18
|
#### 2. Execute in console:
|
@@ -39,3 +40,10 @@ Append to active_admin.css (add it in `app/assets/stylesheets` if not exists)
|
|
39
40
|
//= require "activeadmin_cms/base";
|
40
41
|
```
|
41
42
|
|
43
|
+
#### Add routes
|
44
|
+
|
45
|
+
Append following line to your `routes.rb` file
|
46
|
+
|
47
|
+
```
|
48
|
+
mount ActiveadminCms::Engine => "/activeadmin_cms"
|
49
|
+
```
|
data/app/admin/manage_pages.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
ActiveAdmin.register ActiveadminCms::Page, as: 'Page' do
|
2
2
|
menu parent: "CMS"
|
3
3
|
filter :title
|
4
|
-
|
4
|
+
filter :category
|
5
|
+
|
5
6
|
action_item only: :show do
|
6
7
|
if page.has_unpublished_changes? || !page.published?
|
7
8
|
link_to "Publish", publish_admin_page_path, method: :put
|
@@ -12,6 +13,7 @@ ActiveAdmin.register ActiveadminCms::Page, as: 'Page' do
|
|
12
13
|
|
13
14
|
index do
|
14
15
|
column :id
|
16
|
+
column :category
|
15
17
|
column :title do |page|
|
16
18
|
if page.has_unpublished_changes?
|
17
19
|
"* #{page.title}"
|
@@ -38,41 +40,38 @@ ActiveAdmin.register ActiveadminCms::Page, as: 'Page' do
|
|
38
40
|
end
|
39
41
|
|
40
42
|
controller do
|
43
|
+
def create
|
44
|
+
@page = ActiveadminCms::Page.new
|
45
|
+
save_page(@page)
|
46
|
+
end
|
47
|
+
|
41
48
|
def update
|
42
49
|
@page = ActiveadminCms::Page.find(params[:id])
|
50
|
+
save_page(@page)
|
51
|
+
end
|
43
52
|
|
44
|
-
|
53
|
+
def save_page(page)
|
54
|
+
page_params = permitted_params[:page]
|
55
|
+
asset_ids_str = page_params.delete(:asset_ids).to_s
|
56
|
+
puts asset_ids_str.gsub(/[\[\]]*/, '').split(',').map(&:strip).map(&:to_i)
|
57
|
+
page.asset_ids = asset_ids_str.gsub(/[\[\]]*/, '').split(',').map(&:strip).map(&:to_i)
|
58
|
+
page.attributes = page_params
|
59
|
+
if page.save
|
45
60
|
if params[:commit].downcase != 'save'
|
46
|
-
ActiveadminCms::PagesService.publish(
|
61
|
+
ActiveadminCms::PagesService.publish(page)
|
47
62
|
end
|
48
|
-
redirect_to admin_page_path(
|
63
|
+
redirect_to admin_page_path(page)
|
49
64
|
else
|
50
|
-
render :edit
|
65
|
+
render (page.new_record? ? :new : :edit)
|
51
66
|
end
|
52
67
|
end
|
53
68
|
end
|
54
69
|
|
55
|
-
form
|
56
|
-
config = ActiveadminCms::Engine.config
|
57
|
-
f.inputs "Details" do
|
58
|
-
f.input :title
|
59
|
-
if config.page_categories.any?
|
60
|
-
f.input :category, collection: config.page_categories, include_blank: false
|
61
|
-
end
|
62
|
-
f.input :draft_content, label: false
|
63
|
-
if config.page_editor_backend = 'ace_editor'
|
64
|
-
f.form_buffers.last << content_tag(:div, page.draft_content, id: 'editor')
|
65
|
-
end
|
66
|
-
end
|
67
|
-
f.buttons do
|
68
|
-
f.submit('Save') +
|
69
|
-
f.submit('Save & Publish')
|
70
|
-
end
|
71
|
-
end
|
70
|
+
form partial: "form"
|
72
71
|
|
73
72
|
controller do
|
74
73
|
def permitted_params
|
75
|
-
params.
|
74
|
+
params.permit page: [:title, :draft_content, :category, :asset_ids, :slug]
|
76
75
|
end
|
77
76
|
end
|
78
77
|
|
data/app/admin/manage_posts.rb
CHANGED
@@ -3,15 +3,25 @@
|
|
3
3
|
//= require ace/mode-html.js
|
4
4
|
//= require_self
|
5
5
|
|
6
|
+
if (!window.EditorWrapper) {
|
7
|
+
window.EditorWrapper = {}
|
8
|
+
}
|
9
|
+
|
6
10
|
$(function (){
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
if ($('#editor').length) {
|
12
|
+
var $content = $('#page_draft_content')
|
13
|
+
$content.hide()
|
14
|
+
var editor = ace.edit("editor")
|
15
|
+
editor.setTheme("ace/theme/tomorrow");
|
16
|
+
editor.getSession().setMode("ace/mode/html");
|
17
|
+
editor.getSession().setUseWrapMode(true);
|
18
|
+
editor.setFontSize("16px");
|
19
|
+
editor.on('change', function (e) {
|
20
|
+
$content.val(editor.getValue())
|
21
|
+
})
|
22
|
+
|
23
|
+
window.EditorWrapper.insert = function (data) {
|
24
|
+
editor.insert(data);
|
25
|
+
}
|
26
|
+
}
|
17
27
|
})
|
@@ -0,0 +1,47 @@
|
|
1
|
+
//= require jquery-fileupload/basic
|
2
|
+
//= require_self
|
3
|
+
|
4
|
+
var getAssetIds = function () {
|
5
|
+
return $('#page_asset_ids').val().replace(/[\[\]]*/g, '').split(',').filter(function(n) {return n});
|
6
|
+
}
|
7
|
+
var setAssetIds = function (assetIds) {
|
8
|
+
$('#page_asset_ids').val(assetIds.join(','))
|
9
|
+
}
|
10
|
+
|
11
|
+
$(function () {
|
12
|
+
var $uploader = $('#uploader')
|
13
|
+
$uploader.fileupload({
|
14
|
+
autoUpload: true,
|
15
|
+
dataType: 'json',
|
16
|
+
type: 'POST',
|
17
|
+
url: "/activeadmin_cms/assets.json",
|
18
|
+
fileInput: $('#uploader-file'),
|
19
|
+
paramName: 'asset[image]',
|
20
|
+
formData: {
|
21
|
+
_method: 'POST'
|
22
|
+
},
|
23
|
+
done: function(e, data) {
|
24
|
+
var assetIds = getAssetIds();
|
25
|
+
assetIds.push(data.result.id)
|
26
|
+
setAssetIds(assetIds)
|
27
|
+
var $el = $('<li />')
|
28
|
+
$el.addClass('asset')
|
29
|
+
$el.attr('data-id', data.result.id)
|
30
|
+
$el.attr('data-url', data.result.image_url)
|
31
|
+
$el.append($('<span class="delete">x</span>'))
|
32
|
+
$el.append($('<img src="' + data.result.image_thumb_url + '" />'))
|
33
|
+
$el.appendTo($('#uploader-images'))
|
34
|
+
}
|
35
|
+
})
|
36
|
+
$(document).on('click', '#uploader-images .asset .delete', function () {
|
37
|
+
var $el = $(this).closest('.asset')
|
38
|
+
$.post("/activeadmin_cms/assets/" + $el.data('id') + ".json", {_method: 'delete'});
|
39
|
+
$el.empty().remove()
|
40
|
+
var assetIds = getAssetIds()
|
41
|
+
assetIds.splice( assetIds.indexOf($el.data('id')), 1 );
|
42
|
+
setAssetIds(assetIds)
|
43
|
+
})
|
44
|
+
$(document).on('click', '#uploader-images .asset', function () {
|
45
|
+
EditorWrapper.insert($(this).data('url'))
|
46
|
+
})
|
47
|
+
})
|
@@ -1 +1,23 @@
|
|
1
|
-
//= require activeadmin_cms/editor/ace
|
1
|
+
//= require activeadmin_cms/editor/ace
|
2
|
+
|
3
|
+
#active_admin_content #assets-container {
|
4
|
+
padding: 10px;
|
5
|
+
}
|
6
|
+
|
7
|
+
#active_admin_content #assets-container #uploader-images li {
|
8
|
+
display: inline-block;
|
9
|
+
width: 100px;
|
10
|
+
height: 100px;
|
11
|
+
position: relative;
|
12
|
+
cursor: pointer;
|
13
|
+
}
|
14
|
+
|
15
|
+
#active_admin_content #assets-container #uploader-images li .delete {
|
16
|
+
position: absolute;
|
17
|
+
top: 5px;
|
18
|
+
right: 5px;
|
19
|
+
cursor: pointer;
|
20
|
+
background: #fff;
|
21
|
+
font-size: 16px;
|
22
|
+
padding: 2px 6px;
|
23
|
+
}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
#active_admin_content form.
|
1
|
+
#active_admin_content form.activeadmin_cms_page {
|
2
2
|
position: relative;
|
3
3
|
}
|
4
|
-
#active_admin_content form.
|
4
|
+
#active_admin_content form.activeadmin_cms_page #editor {
|
5
5
|
width: 100%;
|
6
6
|
height: 500px;
|
7
7
|
position: relative;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module ActiveadminCms
|
2
|
+
class AssetsController < ApplicationController
|
3
|
+
before_filter :authenticate_admin_user!
|
4
|
+
respond_to :json
|
5
|
+
|
6
|
+
def create
|
7
|
+
respond_with service.create(permited_params)
|
8
|
+
end
|
9
|
+
|
10
|
+
def destroy
|
11
|
+
respond_with service.destroy(params[:id])
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
def service
|
16
|
+
ActiveadminCms::AssetsService
|
17
|
+
end
|
18
|
+
|
19
|
+
def permited_params
|
20
|
+
params.require(:asset).permit(:image)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module ActiveadminCms
|
2
|
+
class Asset < ActiveRecord::Base
|
3
|
+
if ActiveadminCms::Engine.config.assets_backend == 'paperclip'
|
4
|
+
has_attached_file :image, styles: { thumb: '100x100#' }
|
5
|
+
end
|
6
|
+
|
7
|
+
def image_url
|
8
|
+
image.url
|
9
|
+
end
|
10
|
+
|
11
|
+
def image_thumb_url
|
12
|
+
image.url(:thumb)
|
13
|
+
end
|
14
|
+
|
15
|
+
def as_json(options = {})
|
16
|
+
options[:methods] = [:image_url, :image_thumb_url]
|
17
|
+
super(options)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -2,15 +2,10 @@ module ActiveadminCms
|
|
2
2
|
class Page < ActiveRecord::Base
|
3
3
|
validates :slug, presence: true, uniqueness: true
|
4
4
|
validates :title, presence: true
|
5
|
+
has_many :assets, as: :content
|
5
6
|
|
6
7
|
def has_unpublished_changes?
|
7
8
|
content != draft_content
|
8
9
|
end
|
9
|
-
|
10
|
-
def publish!
|
11
|
-
self.content = draft_content
|
12
|
-
self.published = true
|
13
|
-
self.save
|
14
|
-
end
|
15
10
|
end
|
16
11
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module ActiveadminCms
|
2
|
+
class AssetsService
|
3
|
+
class << self
|
4
|
+
def create(attributes)
|
5
|
+
asset = ActiveadminCms::Asset.new(attributes)
|
6
|
+
asset.save
|
7
|
+
asset
|
8
|
+
end
|
9
|
+
|
10
|
+
def destroy(asset_id)
|
11
|
+
asset = ActiveadminCms::Asset.find(asset_id)
|
12
|
+
asset.destroy
|
13
|
+
asset
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
- config = ActiveadminCms::Engine.config
|
2
|
+
= semantic_form_for [:admin, @page] do |f|
|
3
|
+
= f.inputs do
|
4
|
+
= f.input :title
|
5
|
+
= f.input :slug
|
6
|
+
|
7
|
+
- if config.page_categories.any?
|
8
|
+
= f.input :category, collection: config.page_categories, include_blank: false
|
9
|
+
|
10
|
+
= f.input :draft_content, label: false
|
11
|
+
li#editor-container
|
12
|
+
- if config.page_editor_backend = 'ace_editor'
|
13
|
+
#editor= @page.draft_content
|
14
|
+
|
15
|
+
= f.input :asset_ids, as: :hidden
|
16
|
+
li#assets-container
|
17
|
+
ul#uploader-images
|
18
|
+
- @page.assets.each do |asset|
|
19
|
+
li.asset data-id=(asset.id) data-url=(asset.image_url)
|
20
|
+
span.delete x
|
21
|
+
= image_tag asset.image_thumb_url, width: 100, height: 100
|
22
|
+
input#uploader-file type="file"
|
23
|
+
#uploader
|
24
|
+
= f.actions
|
25
|
+
= f.submit('Save')
|
26
|
+
= f.submit('Save & Publish')
|
data/config/routes.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateActiveadminCmsAssets < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :activeadmin_cms_assets do |t|
|
4
|
+
t.integer :content_id
|
5
|
+
t.string :content_type
|
6
|
+
t.string :image_file_name
|
7
|
+
t.string :image_content_type
|
8
|
+
t.integer :image_file_size
|
9
|
+
t.datetime :image_updated_at
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
add_index :activeadmin_cms_assets, [:content_type, :content_id]
|
13
|
+
end
|
14
|
+
end
|
@@ -1,11 +1,18 @@
|
|
1
1
|
require 'activeadmin'
|
2
2
|
require 'ace-rails-ap'
|
3
3
|
require 'jquery-rails'
|
4
|
+
require 'jquery-fileupload-rails'
|
4
5
|
require 'liquid'
|
6
|
+
|
5
7
|
begin
|
6
8
|
require 'acts-as-taggable-on'
|
7
9
|
rescue LoadError
|
8
10
|
end
|
11
|
+
begin
|
12
|
+
require 'paperclip'
|
13
|
+
rescue LoadError
|
14
|
+
end
|
15
|
+
|
9
16
|
module ActiveadminCms
|
10
17
|
class Engine < ::Rails::Engine
|
11
18
|
isolate_namespace ActiveadminCms
|
@@ -26,6 +33,11 @@ module ActiveadminCms
|
|
26
33
|
else
|
27
34
|
config.tags_backend = false
|
28
35
|
end
|
36
|
+
if defined?(Paperclip)
|
37
|
+
config.assets_backend = 'paperclip'
|
38
|
+
else
|
39
|
+
config.assets_backend = false
|
40
|
+
end
|
29
41
|
config.page_editor_backend = 'ace_editor'
|
30
42
|
config.page_categories = ['main']
|
31
43
|
end
|
Binary file
|
data/test/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,20 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20131020224503) do
|
15
|
+
|
16
|
+
create_table "activeadmin_cms_assets", force: true do |t|
|
17
|
+
t.integer "content_id"
|
18
|
+
t.string "content_type"
|
19
|
+
t.string "image_file_name"
|
20
|
+
t.string "image_content_type"
|
21
|
+
t.integer "image_file_size"
|
22
|
+
t.datetime "image_updated_at"
|
23
|
+
t.datetime "created_at"
|
24
|
+
t.datetime "updated_at"
|
25
|
+
end
|
26
|
+
|
27
|
+
add_index "activeadmin_cms_assets", ["content_type", "content_id"], name: "index_activeadmin_cms_assets_on_content_type_and_content_id"
|
15
28
|
|
16
29
|
create_table "activeadmin_cms_pages", force: true do |t|
|
17
30
|
t.string "title"
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -33,3 +33,38 @@ Migrating to AddSlugToActiveadminCmsPages (20131020181730)
|
|
33
33
|
[1m[36mSQL (1.7ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20131020181730"]]
|
34
34
|
[1m[35m (1.0ms)[0m commit transaction
|
35
35
|
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
36
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
37
|
+
Migrating to CreateActiveadminCmsAssets (20131020224503)
|
38
|
+
[1m[35m (0.1ms)[0m begin transaction
|
39
|
+
[1m[36m (0.6ms)[0m [1mCREATE TABLE "activeadmin_cms_assets" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "content_id" integer, "content_type" varchar(255), "image_file_name" varchar(255), "image_content_type" varchar(255), "image_file_size" integer, "image_updated_at" datetime, "created_at" datetime, "updated_at" datetime) [0m
|
40
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_activeadmin_cms_assets_on_content_type_and_content_id" ON "activeadmin_cms_assets" ("content_type", "content_id")
|
41
|
+
[1m[36mSQL (1.8ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20131020224503"]]
|
42
|
+
[1m[35m (38.6ms)[0m commit transaction
|
43
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
44
|
+
[1m[36m (1.4ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
45
|
+
[1m[35m (1.0ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
46
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
47
|
+
Migrating to CreateActiveadminCmsPosts (20131020140024)
|
48
|
+
[1m[35m (0.1ms)[0m begin transaction
|
49
|
+
[1m[36m (0.5ms)[0m [1mCREATE TABLE "activeadmin_cms_posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "content" text, "published" boolean DEFAULT 'f', "created_at" datetime, "updated_at" datetime) [0m
|
50
|
+
[1m[35mSQL (1.7ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131020140024"]]
|
51
|
+
[1m[36m (1.2ms)[0m [1mcommit transaction[0m
|
52
|
+
Migrating to CreateActiveadminCmsPages (20131020152912)
|
53
|
+
[1m[35m (0.1ms)[0m begin transaction
|
54
|
+
[1m[36m (0.5ms)[0m [1mCREATE TABLE "activeadmin_cms_pages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "category" varchar(255), "content" text, "draft_content" text, "published" boolean DEFAULT 'f', "created_at" datetime, "updated_at" datetime) [0m
|
55
|
+
[1m[35m (0.2ms)[0m CREATE INDEX "index_activeadmin_cms_pages_on_category" ON "activeadmin_cms_pages" ("category")
|
56
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20131020152912"]]
|
57
|
+
[1m[35m (1.0ms)[0m commit transaction
|
58
|
+
Migrating to AddSlugToActiveadminCmsPages (20131020181730)
|
59
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
60
|
+
[1m[35m (0.3ms)[0m ALTER TABLE "activeadmin_cms_pages" ADD "slug" varchar(255)
|
61
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_activeadmin_cms_pages_on_slug" ON "activeadmin_cms_pages" ("slug")[0m
|
62
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131020181730"]]
|
63
|
+
[1m[36m (1.2ms)[0m [1mcommit transaction[0m
|
64
|
+
Migrating to CreateActiveadminCmsAssets (20131020224503)
|
65
|
+
[1m[35m (0.1ms)[0m begin transaction
|
66
|
+
[1m[36m (0.3ms)[0m [1mCREATE TABLE "activeadmin_cms_assets" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "content_id" integer, "content_type" varchar(255), "image_file_name" varchar(255), "image_content_type" varchar(255), "image_file_size" integer, "image_updated_at" datetime, "created_at" datetime, "updated_at" datetime) [0m
|
67
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_activeadmin_cms_assets_on_content_type_and_content_id" ON "activeadmin_cms_assets" ("content_type", "content_id")
|
68
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20131020224503"]]
|
69
|
+
[1m[35m (1.0ms)[0m commit transaction
|
70
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
data/test/dummy/log/test.log
CHANGED
@@ -803,3 +803,58 @@ ActiveadminCmsTest: test_truth
|
|
803
803
|
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
804
804
|
[1m[35m (0.0ms)[0m ROLLBACK TO SAVEPOINT active_record_1
|
805
805
|
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
806
|
+
[1m[36m (1.6ms)[0m [1mDELETE FROM "activeadmin_cms_posts";[0m
|
807
|
+
[1m[35m (0.1ms)[0m SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
|
808
|
+
[1m[36m (0.1ms)[0m [1mDELETE FROM sqlite_sequence where name = 'activeadmin_cms_posts';[0m
|
809
|
+
[1m[35m (1.0ms)[0m DELETE FROM "activeadmin_cms_pages";
|
810
|
+
[1m[36m (0.1ms)[0m [1mSELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';[0m
|
811
|
+
[1m[35m (0.1ms)[0m DELETE FROM sqlite_sequence where name = 'activeadmin_cms_pages';
|
812
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
813
|
+
-----------------------------------------------------
|
814
|
+
#publish: test_0001_should change status to published
|
815
|
+
-----------------------------------------------------
|
816
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
817
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
818
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
819
|
+
[1m[36mSQL (13.2ms)[0m [1mINSERT INTO "activeadmin_cms_posts" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?)[0m [["content", "Foo content"], ["created_at", Mon, 21 Oct 2013 00:21:19 UTC +00:00], ["title", "Foo post"], ["updated_at", Mon, 21 Oct 2013 00:21:19 UTC +00:00]]
|
820
|
+
[1m[35mSQL (0.2ms)[0m UPDATE "activeadmin_cms_posts" SET "published" = ?, "updated_at" = ? WHERE "activeadmin_cms_posts"."id" = 1 [["published", true], ["updated_at", Mon, 21 Oct 2013 00:21:19 UTC +00:00]]
|
821
|
+
[1m[36mActiveadminCms::Post Load (0.1ms)[0m [1mSELECT "activeadmin_cms_posts".* FROM "activeadmin_cms_posts" WHERE "activeadmin_cms_posts"."id" = ? LIMIT 1[0m [["id", 1]]
|
822
|
+
[1m[35m (0.1ms)[0m ROLLBACK TO SAVEPOINT active_record_1
|
823
|
+
[1m[36m (0.4ms)[0m [1mrollback transaction[0m
|
824
|
+
[1m[35m (0.1ms)[0m begin transaction
|
825
|
+
-----------------------------------------------------
|
826
|
+
#publish: test_0001_should change status to published
|
827
|
+
-----------------------------------------------------
|
828
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
829
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
830
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
831
|
+
[1m[35mActiveadminCms::Page Exists (0.1ms)[0m SELECT 1 AS one FROM "activeadmin_cms_pages" WHERE "activeadmin_cms_pages"."slug" = 'slug-1' LIMIT 1
|
832
|
+
[1m[36mSQL (0.6ms)[0m [1mINSERT INTO "activeadmin_cms_pages" ("content", "created_at", "slug", "title", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["content", "Foo content"], ["created_at", Mon, 21 Oct 2013 00:21:19 UTC +00:00], ["slug", "slug-1"], ["title", "Foo page"], ["updated_at", Mon, 21 Oct 2013 00:21:19 UTC +00:00]]
|
833
|
+
[1m[35mActiveadminCms::Page Exists (0.1ms)[0m SELECT 1 AS one FROM "activeadmin_cms_pages" WHERE ("activeadmin_cms_pages"."slug" = 'slug-1' AND "activeadmin_cms_pages"."id" != 1) LIMIT 1
|
834
|
+
[1m[36mSQL (0.2ms)[0m [1mUPDATE "activeadmin_cms_pages" SET "content" = ?, "published" = ?, "updated_at" = ? WHERE "activeadmin_cms_pages"."id" = 1[0m [["content", nil], ["published", true], ["updated_at", Mon, 21 Oct 2013 00:21:19 UTC +00:00]]
|
835
|
+
[1m[35mActiveadminCms::Page Load (0.1ms)[0m SELECT "activeadmin_cms_pages".* FROM "activeadmin_cms_pages" WHERE "activeadmin_cms_pages"."id" = ? LIMIT 1 [["id", 1]]
|
836
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK TO SAVEPOINT active_record_1[0m
|
837
|
+
[1m[35m (0.5ms)[0m rollback transaction
|
838
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
839
|
+
--------------------------------------------------
|
840
|
+
#publish: test_0002_should move content from draft
|
841
|
+
--------------------------------------------------
|
842
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
843
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
844
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
845
|
+
[1m[36mActiveadminCms::Page Exists (0.1ms)[0m [1mSELECT 1 AS one FROM "activeadmin_cms_pages" WHERE "activeadmin_cms_pages"."slug" = 'slug-2' LIMIT 1[0m
|
846
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "activeadmin_cms_pages" ("content", "created_at", "slug", "title", "updated_at") VALUES (?, ?, ?, ?, ?) [["content", "Foo content"], ["created_at", Mon, 21 Oct 2013 00:21:19 UTC +00:00], ["slug", "slug-2"], ["title", "Foo page"], ["updated_at", Mon, 21 Oct 2013 00:21:19 UTC +00:00]]
|
847
|
+
[1m[36mActiveadminCms::Page Exists (0.1ms)[0m [1mSELECT 1 AS one FROM "activeadmin_cms_pages" WHERE ("activeadmin_cms_pages"."slug" = 'slug-2' AND "activeadmin_cms_pages"."id" != 1) LIMIT 1[0m
|
848
|
+
[1m[35mSQL (0.1ms)[0m UPDATE "activeadmin_cms_pages" SET "draft_content" = ?, "content" = ?, "published" = ?, "updated_at" = ? WHERE "activeadmin_cms_pages"."id" = 1 [["draft_content", "new content"], ["content", "new content"], ["published", true], ["updated_at", Mon, 21 Oct 2013 00:21:19 UTC +00:00]]
|
849
|
+
[1m[36mActiveadminCms::Page Load (0.0ms)[0m [1mSELECT "activeadmin_cms_pages".* FROM "activeadmin_cms_pages" WHERE "activeadmin_cms_pages"."id" = ? LIMIT 1[0m [["id", 1]]
|
850
|
+
[1m[35m (0.1ms)[0m ROLLBACK TO SAVEPOINT active_record_1
|
851
|
+
[1m[36m (0.5ms)[0m [1mrollback transaction[0m
|
852
|
+
[1m[35m (0.0ms)[0m begin transaction
|
853
|
+
------------------------------
|
854
|
+
ActiveadminCmsTest: test_truth
|
855
|
+
------------------------------
|
856
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
857
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
858
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
859
|
+
[1m[35m (0.0ms)[0m ROLLBACK TO SAVEPOINT active_record_1
|
860
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Iskander Haziev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ! '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: jquery-fileupload-rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: liquid
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +94,20 @@ dependencies:
|
|
80
94
|
- - ! '>='
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: slim-rails
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
112
|
name: sqlite3
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -189,11 +217,15 @@ files:
|
|
189
217
|
- app/admin/manage_posts.rb
|
190
218
|
- app/assets/javascripts/activeadmin_cms/base.js
|
191
219
|
- app/assets/javascripts/activeadmin_cms/editor/ace.js
|
220
|
+
- app/assets/javascripts/activeadmin_cms/helpers/assets_uploader.js
|
192
221
|
- app/assets/stylesheets/activeadmin_cms/base.css
|
193
222
|
- app/assets/stylesheets/activeadmin_cms/editor/ace.css
|
194
223
|
- app/controllers/activeadmin_cms/application_controller.rb
|
224
|
+
- app/controllers/activeadmin_cms/assets_controller.rb
|
225
|
+
- app/models/activeadmin_cms/asset.rb
|
195
226
|
- app/models/activeadmin_cms/page.rb
|
196
227
|
- app/models/activeadmin_cms/post.rb
|
228
|
+
- app/services/activeadmin_cms/assets_service.rb
|
197
229
|
- app/services/activeadmin_cms/composer_service.rb
|
198
230
|
- app/services/activeadmin_cms/menu_builder_service.rb
|
199
231
|
- app/services/activeadmin_cms/pages_service.rb
|
@@ -201,11 +233,13 @@ files:
|
|
201
233
|
- app/services/activeadmin_cms/processors/base.rb
|
202
234
|
- app/services/activeadmin_cms/processors/parse_menu.rb
|
203
235
|
- app/services/activeadmin_cms/processors/parse_template.rb
|
236
|
+
- app/views/admin/pages/_form.html.slim
|
204
237
|
- app/views/layouts/activeadmin_cms/application.html.erb
|
205
238
|
- config/routes.rb
|
206
239
|
- db/migrate/20131020140024_create_activeadmin_cms_posts.rb
|
207
240
|
- db/migrate/20131020152912_create_activeadmin_cms_pages.rb
|
208
241
|
- db/migrate/20131020181730_add_slug_to_activeadmin_cms_pages.rb
|
242
|
+
- db/migrate/20131020224503_create_activeadmin_cms_assets.rb
|
209
243
|
- lib/activeadmin_cms/engine.rb
|
210
244
|
- lib/activeadmin_cms/version.rb
|
211
245
|
- lib/activeadmin_cms.rb
|
@@ -254,6 +288,7 @@ files:
|
|
254
288
|
- test/factories/pages.rb
|
255
289
|
- test/factories/posts.rb
|
256
290
|
- test/factories/sequences.rb
|
291
|
+
- test/models/activeadmin_cms/asset_test.rb
|
257
292
|
- test/models/activeadmin_cms/page_test.rb
|
258
293
|
- test/models/activeadmin_cms/post_test.rb
|
259
294
|
- test/services/pages_service_test.rb
|
@@ -323,6 +358,7 @@ test_files:
|
|
323
358
|
- test/factories/pages.rb
|
324
359
|
- test/factories/posts.rb
|
325
360
|
- test/factories/sequences.rb
|
361
|
+
- test/models/activeadmin_cms/asset_test.rb
|
326
362
|
- test/models/activeadmin_cms/page_test.rb
|
327
363
|
- test/models/activeadmin_cms/post_test.rb
|
328
364
|
- test/services/pages_service_test.rb
|