cambium 1.2.3 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +8 -3
- data/.ruby-version +1 -0
- data/README.md +301 -0
- data/Rakefile +20 -1
- data/app/assets/javascripts/cambium/admin/application.js.coffee +1 -0
- data/app/assets/javascripts/cambium/admin/routers/router.js.coffee +8 -17
- data/app/assets/javascripts/cambium/admin/templates/image_cropper.jst.ejs +20 -0
- data/app/assets/javascripts/cambium/admin/templates/modal.jst.ejs +3 -0
- data/app/assets/javascripts/cambium/admin/views/editor.js.coffee +14 -0
- data/app/assets/javascripts/cambium/admin/views/image_cropper.js.coffee +27 -0
- data/app/assets/javascripts/cambium/admin/views/keyboard_shortcuts.js.coffee +17 -0
- data/app/assets/javascripts/cambium/admin/views/media_picker.js.coffee +38 -0
- data/app/assets/stylesheets/cambium/admin/application.scss +4 -0
- data/app/assets/stylesheets/cambium/admin/partials/_globals.scss +14 -0
- data/app/assets/stylesheets/cambium/admin/partials/components.scss +5 -4
- data/app/assets/stylesheets/cambium/admin/partials/forms.scss +95 -2
- data/app/assets/stylesheets/cambium/admin/partials/modal.scss +40 -0
- data/app/assets/stylesheets/cambium/admin/partials/pagination.scss +28 -0
- data/app/assets/stylesheets/cambium/admin/partials/tables.scss +18 -27
- data/app/assets/stylesheets/cambium/admin/partials/tiles.scss +57 -0
- data/app/controllers/cambium/admin/documents_controller.rb +11 -0
- data/app/controllers/cambium/admin/pages_controller.rb +15 -0
- data/app/controllers/cambium/admin/settings_controller.rb +32 -0
- data/app/controllers/cambium/admin_controller.rb +21 -9
- data/app/controllers/cambium/pages_controller.rb +17 -0
- data/app/helpers/cambium/cambium_helper.rb +148 -116
- data/app/models/cambium/document.rb +59 -0
- data/app/models/cambium/page.rb +84 -0
- data/app/models/cambium/page_template.rb +85 -0
- data/app/models/cambium/setting.rb +40 -0
- data/app/models/concerns/publishable.rb +0 -21
- data/app/views/cambium/admin/documents/index.html.erb +21 -0
- data/app/views/cambium/admin/pages/edit.html.erb +16 -0
- data/app/views/cambium/admin/paper_trail/versions/_version.html.erb +1 -1
- data/app/views/cambium/admin/search/index.html.erb +2 -1
- data/app/views/cambium/admin/settings/index.html.erb +15 -0
- data/app/views/cambium/pages/home_missing.html.erb +2 -0
- data/app/views/layouts/admin.html.erb +1 -1
- data/app/views/pages/default.html.erb +13 -0
- data/bin/rails +12 -0
- data/cambium.gemspec +9 -3
- data/config/routes.rb +12 -0
- data/db/migrate/20160107161039_create_cambium_pages.rb +19 -0
- data/db/migrate/20160108160638_create_cambium_documents.rb +11 -0
- data/db/migrate/20160108185904_create_cambium_settings.rb +10 -0
- data/db/migrate/20160111154240_add_is_home_to_pages.rb +5 -0
- data/db/migrate/20160125174822_add_page_path_to_pages.rb +5 -0
- data/db/migrate/20160205190935_add_upload_gravity_to_documents.rb +5 -0
- data/lib/cambium.rb +3 -0
- data/lib/cambium/engine.rb +21 -0
- data/lib/cambium/version.rb +1 -1
- data/lib/generators/cambium/admin_generator.rb +1 -1
- data/lib/generators/templates/config/admin/documents.yml +23 -0
- data/lib/generators/templates/config/admin/pages.yml +56 -0
- data/lib/generators/templates/config/admin/settings.yml +19 -0
- data/lib/generators/templates/config/admin/sidebar.yml +15 -0
- data/lib/generators/templates/config/initializers/assets.rb +3 -1
- data/spec/controllers/cambium/admin/documents_controller_spec.rb +7 -0
- data/spec/controllers/cambium/admin/pages_controller_spec.rb +7 -0
- data/spec/controllers/cambium/admin/settings_controller_spec.rb +7 -0
- data/spec/controllers/cambium/pages_controller_spec.rb +7 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +32 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/cambium_documents.rb +7 -0
- data/spec/factories/cambium_pages.rb +6 -0
- data/spec/factories/cambium_settings.rb +7 -0
- data/spec/models/cambium/document_spec.rb +7 -0
- data/spec/models/cambium/page_spec.rb +7 -0
- data/spec/models/cambium/setting_spec.rb +7 -0
- data/spec/spec_helper.rb +18 -0
- metadata +219 -11
- data/test/controllers/cambium/admin/dashboard_controller_test.rb +0 -9
- data/test/controllers/cambium/admin/users_controller_test.rb +0 -9
- data/test/controllers/cambium/admin_controller_test.rb +0 -9
data/config/routes.rb
CHANGED
@@ -4,7 +4,19 @@ Cambium::Engine.routes.draw do
|
|
4
4
|
get '/' => 'dashboard#index', :as => :root
|
5
5
|
get 'dashboard' => 'dashboard#show', :as => :dashboard
|
6
6
|
get 'search' => 'search#index', :as => :search
|
7
|
+
resources :documents
|
8
|
+
resources :pages, :param => :slug
|
7
9
|
resources :users
|
10
|
+
resources :settings
|
11
|
+
end
|
12
|
+
|
13
|
+
if ActiveRecord::Base.connection.table_exists?('cambium_pages')
|
14
|
+
Cambium::Page.published.each do |page|
|
15
|
+
begin
|
16
|
+
get page.page_path => 'pages#show' unless page.page_path.blank?
|
17
|
+
rescue
|
18
|
+
end
|
19
|
+
end
|
8
20
|
end
|
9
21
|
|
10
22
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreateCambiumPages < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :cambium_pages do |t|
|
4
|
+
t.string :title
|
5
|
+
t.string :slug
|
6
|
+
t.text :description
|
7
|
+
t.text :markdown
|
8
|
+
t.text :html
|
9
|
+
t.string :template_name
|
10
|
+
t.string :ancestry
|
11
|
+
t.integer :position, :default => 0
|
12
|
+
t.json :template_data, :default => {}
|
13
|
+
t.datetime :active_at
|
14
|
+
t.datetime :inactive_at
|
15
|
+
|
16
|
+
t.timestamps null: false
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/cambium.rb
CHANGED
@@ -4,13 +4,16 @@ require 'cambium/configuration'
|
|
4
4
|
|
5
5
|
# Gem to load by default (in case they are removed from
|
6
6
|
# Gemfile)
|
7
|
+
require 'ancestry'
|
7
8
|
require 'bones-rails'
|
9
|
+
require 'dragonfly'
|
8
10
|
require 'kaminari'
|
9
11
|
require 'mark_it_zero'
|
10
12
|
require 'paper_trail'
|
11
13
|
require 'pg_search'
|
12
14
|
require 'pickadate-rails'
|
13
15
|
require 'superslug'
|
16
|
+
require 'trumbowyg_rails'
|
14
17
|
|
15
18
|
# Temp (hopefully) monkeypatch solution for Kaminari
|
16
19
|
require 'kaminari/helpers/tag'
|
data/lib/cambium/engine.rb
CHANGED
@@ -2,6 +2,27 @@ require 'rails'
|
|
2
2
|
|
3
3
|
module Cambium
|
4
4
|
class Engine < ::Rails::Engine
|
5
|
+
|
5
6
|
isolate_namespace Cambium
|
7
|
+
|
8
|
+
config.generators do |g|
|
9
|
+
g.test_framework :rspec, :fixture => false
|
10
|
+
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
|
11
|
+
g.assets false
|
12
|
+
g.helper false
|
13
|
+
end
|
14
|
+
|
15
|
+
initializer :append_migrations do |app|
|
16
|
+
unless app.root.to_s.match root.to_s
|
17
|
+
config.paths["db/migrate"].expanded.each do |expanded_path|
|
18
|
+
app.config.paths["db/migrate"] << expanded_path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def root
|
24
|
+
@root ||= Gem::Specification.find_by_name('cambium').gem_dir.to_s
|
25
|
+
end
|
26
|
+
|
6
27
|
end
|
7
28
|
end
|
data/lib/cambium/version.rb
CHANGED
@@ -56,7 +56,7 @@ module Cambium
|
|
56
56
|
# Add admin sidebar file to the project
|
57
57
|
#
|
58
58
|
def add_admin_routes
|
59
|
-
['sidebar','users'].each do |file|
|
59
|
+
['sidebar','users','pages','documents','settings'].each do |file|
|
60
60
|
template "config/admin/#{file}.yml", "config/admin/#{file}.yml"
|
61
61
|
end
|
62
62
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
model: Cambium::Document
|
2
|
+
table:
|
3
|
+
title: Media Library
|
4
|
+
scope: last_created
|
5
|
+
columns:
|
6
|
+
title:
|
7
|
+
heading: Title
|
8
|
+
buttons:
|
9
|
+
new: New File
|
10
|
+
form:
|
11
|
+
buttons:
|
12
|
+
delete: Delete File
|
13
|
+
new: &new
|
14
|
+
title: New File
|
15
|
+
fields:
|
16
|
+
title:
|
17
|
+
type: string
|
18
|
+
upload:
|
19
|
+
type: file
|
20
|
+
label: File
|
21
|
+
edit:
|
22
|
+
<<: *new
|
23
|
+
title: Edit File
|
@@ -0,0 +1,56 @@
|
|
1
|
+
model: Page
|
2
|
+
table:
|
3
|
+
title: Site Pages
|
4
|
+
scope: all
|
5
|
+
columns:
|
6
|
+
title:
|
7
|
+
heading: Title
|
8
|
+
template_name:
|
9
|
+
heading: Template
|
10
|
+
path_preview:
|
11
|
+
heading: URL Path
|
12
|
+
buttons:
|
13
|
+
new: New Page
|
14
|
+
export:
|
15
|
+
button: Export Pages
|
16
|
+
columns:
|
17
|
+
title:
|
18
|
+
label: Title
|
19
|
+
form:
|
20
|
+
buttons:
|
21
|
+
delete: Delete Page
|
22
|
+
new: &new
|
23
|
+
title: New Page
|
24
|
+
fields:
|
25
|
+
title:
|
26
|
+
type: string
|
27
|
+
template_name:
|
28
|
+
type: select
|
29
|
+
options: Cambium::PageTemplate.names
|
30
|
+
parent_id:
|
31
|
+
type: select
|
32
|
+
options: Cambium::Page.alpha
|
33
|
+
label: Parent Page
|
34
|
+
description:
|
35
|
+
type: string
|
36
|
+
html:
|
37
|
+
type: wysiwyg
|
38
|
+
label: Body
|
39
|
+
publishable:
|
40
|
+
type: heading
|
41
|
+
label: Publish Dates
|
42
|
+
active_at:
|
43
|
+
type: datetime
|
44
|
+
label: Publish At
|
45
|
+
inactive_at:
|
46
|
+
type: datetime
|
47
|
+
label: Unpublish At
|
48
|
+
home:
|
49
|
+
type: heading
|
50
|
+
label: Home Page
|
51
|
+
is_home:
|
52
|
+
type: boolean
|
53
|
+
label: Set As Home Page
|
54
|
+
edit:
|
55
|
+
<<: *new
|
56
|
+
title: Edit Page
|
@@ -0,0 +1,19 @@
|
|
1
|
+
model: Cambium::Setting
|
2
|
+
table:
|
3
|
+
title: Site Settings
|
4
|
+
export:
|
5
|
+
button: Export Settings
|
6
|
+
columns:
|
7
|
+
key:
|
8
|
+
label: Title
|
9
|
+
value:
|
10
|
+
label: Setting
|
11
|
+
form:
|
12
|
+
edit:
|
13
|
+
fields:
|
14
|
+
site_title:
|
15
|
+
type: string
|
16
|
+
label: Site Title
|
17
|
+
site_description:
|
18
|
+
type: text
|
19
|
+
label: Site Description
|
@@ -2,8 +2,23 @@ dashboard:
|
|
2
2
|
label: Dashboard
|
3
3
|
route: cambium.admin_dashboard
|
4
4
|
icon: dashboard
|
5
|
+
pages:
|
6
|
+
label: Pages
|
7
|
+
route: cambium.admin_pages
|
8
|
+
icon: file
|
9
|
+
controllers: ['pages']
|
10
|
+
documents:
|
11
|
+
label: Library
|
12
|
+
route: cambium.admin_documents
|
13
|
+
icon: image
|
14
|
+
controllers: ['documents']
|
5
15
|
users:
|
6
16
|
label: Users
|
7
17
|
route: cambium.admin_users
|
8
18
|
icon: users
|
9
19
|
controllers: ['users']
|
20
|
+
settings:
|
21
|
+
label: Settings
|
22
|
+
route: cambium.admin_settings
|
23
|
+
icon: cog
|
24
|
+
controllers: ['settings']
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/spec/dummy/Rakefile
ADDED
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/spec/dummy/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
system "bundle check || bundle install"
|
14
|
+
|
15
|
+
# puts "\n== Copying sample files =="
|
16
|
+
# unless File.exist?("config/database.yml")
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
18
|
+
# end
|
19
|
+
|
20
|
+
puts "\n== Preparing database =="
|
21
|
+
system "bin/rake db:setup"
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system "rm -f log/*"
|
25
|
+
system "rm -rf tmp/cache"
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system "touch tmp/restart.txt"
|
29
|
+
end
|