pages_cms 0.1.0 → 0.1.1

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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +28 -18
  3. data/app/views/pages_cms/admin/pages/edit.html.haml +0 -5
  4. data/app/views/pages_cms/pages/_main.html.haml +2 -1
  5. data/lib/generators/pages_cms/Install_generator.rb +31 -19
  6. data/lib/pages_cms/version.rb +1 -1
  7. data/test/dummy/app/assets/javascripts/application.js +1 -1
  8. data/test/dummy/app/assets/stylesheets/pages_cms/pages_cms.scss +16 -0
  9. data/test/dummy/app/controllers/application_controller.rb +0 -8
  10. data/test/dummy/app/helpers/application_helper.rb +0 -5
  11. data/test/dummy/app/views/layouts/pages_cms/_header.html.erb +35 -0
  12. data/test/dummy/app/views/layouts/pages_cms/application.html.erb +34 -0
  13. data/test/dummy/app/views/pages_cms/admin/articles/_form.html.haml +12 -0
  14. data/test/dummy/app/views/pages_cms/admin/articles/edit.html.haml +3 -0
  15. data/test/dummy/app/views/pages_cms/admin/articles/index.html.haml +38 -0
  16. data/test/dummy/app/views/pages_cms/admin/articles/new.html.haml +3 -0
  17. data/test/dummy/app/views/pages_cms/admin/images/index.html.haml +15 -0
  18. data/test/dummy/app/views/pages_cms/admin/pages/_jumbotron_fields.html.haml +9 -0
  19. data/test/dummy/app/views/pages_cms/admin/pages/_page_block_fields.html.haml +19 -0
  20. data/test/dummy/app/views/pages_cms/admin/pages/_text_box_fields.html.haml +7 -0
  21. data/test/dummy/app/views/pages_cms/admin/pages/_thumbnail_fields.html.haml +8 -0
  22. data/test/dummy/app/views/pages_cms/admin/pages/edit.html.haml +45 -0
  23. data/test/dummy/app/views/pages_cms/admin/pages/index.html.haml +35 -0
  24. data/test/dummy/app/views/pages_cms/articles/index.html.erb +25 -0
  25. data/test/dummy/app/views/pages_cms/articles/show.html.haml +10 -0
  26. data/test/dummy/app/views/pages_cms/pages/_main.html.haml +21 -0
  27. data/test/dummy/app/views/pages_cms/pages/show.html.haml +15 -0
  28. data/test/dummy/config/routes.rb +0 -1
  29. data/test/dummy/db/migrate/20150616171349_create_initial_db.pages_cms.rb +95 -0
  30. data/test/dummy/db/schema.rb +122 -0
  31. data/test/dummy/log/development.log +286 -0
  32. metadata +42 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65624dc8f365d7f8ea8ac64e5c9fc84d86549439
4
- data.tar.gz: f3d3e419acb3240d16f3334332dec50118ddfc2c
3
+ metadata.gz: a0694257868bb654ec40d1c90d6b94cffae5f2dc
4
+ data.tar.gz: 3454c415c9954566bf3f68d08fe8c46e07447e41
5
5
  SHA512:
6
- metadata.gz: 14203a00b50d570da99d945207cbe3c30d1ce0d4c753f911d9df8a2a7f5cad5652929489b1a9e41c8e86c620fadf2b4b898a0027cd2cafac78178495a8cc44e0
7
- data.tar.gz: f9adcfb3ddc264417fdabb1fc5d850d76f9f122d356b2312a035682c7891566c80be0444b835ba559df86774db9d2713fd8b23dad9d1be7897fabe20c19091b2
6
+ metadata.gz: 86450ff8b6936215eedacb550b7afb98a9bf645fc5ac5548ea3bd5062dac13e79e011da26b447129fe110750c05fbfd0409b9468c28bad18525a2801e7b3cc76
7
+ data.tar.gz: 62260a4f133a1402f76ce8e63d11b0b297ed7ac12dbf528d32244b07bb7f50480bcbc897c2741062849bed085721987eec77817ec7946b8004dbf9f70b14a53d
data/README.md CHANGED
@@ -1,33 +1,42 @@
1
1
  #PagesCms
2
2
 
3
- Pages CMS uses nested forms and draggable items to allow the user to build a site within the predefined layout from a designer. It incorporates an image management system as well as a page management system. Get hacking right away with out of the box support for bootstrap.
3
+ > [Try out a demo](https://fierce-atoll-4068.herokuapp.com/)
4
4
 
5
- ##Installation
5
+ Pages CMS uses nested forms and draggable items to allow the user to build a site within the predefined layout from a designer. It incorporates an image management system as well as a page management system. It's like a wordpress page builder on rails.
6
6
 
7
- $ gem install 'pages_cms'
7
+ ####Advantages
8
+ - Get hacking right away with out of the box support for bootstrap.
9
+ - Easily drag page layouts into the position you want them.
10
+ - Built in blog.
11
+ - Limited dependencies.
12
+ - Easily customized.
13
+ - Lightweight and easy to understand: Built with simple rails techniques everyone can understand.
8
14
 
9
- or
15
+ ## Installation
10
16
 
11
- gem 'pages_cms'
17
+ 1. Add: `gem 'pages_cms'` to your `Gemfile`
18
+ 2. Run: `$ rails generate pages_cms:install`
19
+ 3. Add: `//= require cocoon` to your `application.js` file
12
20
 
13
- Then in your rails app
21
+ This has built everything that PagesCMS needs to work, but to get hacking with some default styling and layout included, follow the next steps:
14
22
 
15
- rails generate pages_cms:install
23
+ 1. Run: `rails generate pages_cms:views`
24
+ 2. Add: `gem "bootstrap-sass"` to your `Gemfile`
25
+ 3. Add: `//= require bootstrap` to your `application.js`
26
+ 4. Add: `*= require pages_cms/pages_cms` to your `application.css`
27
+ 5. Run: `$ bundle install`
16
28
 
17
- To get hacking immediately:
18
29
 
19
- 1. Run: `rails generate pages_cms:views`
20
- 2. Add: `gem "bootstrap-sass"` to your gemfile
21
- 3. Add: `//= require cocoon` to your application.js
22
- 4. Add: `//= require bootstrap` to your application.js
23
- 5. Add: `*= require pages_cms/pages_cms` to your application.css
30
+ > You should now be able to go to `/admin/pages` and start building pages!
24
31
 
32
+ #### The generator has added three methods to your App:
25
33
 
26
- You should now be able to go to /admin/pages and start building pages!
34
+ | Method | Usage |
35
+ | ------------------------- | ------------------------------------------------------- |
36
+ | `logged_in_admin` | Authorizes controllers in the `PagesCms` engine |
37
+ | `current_user_is_admin?` | Verifies that the current user is an admin in the views |
38
+ | `slugged_path` | Creates a slug of the path for user generated pages |
27
39
 
28
- This generator has added a `logged_in_admin` method to your application controller which will authorize the controllers in pages_cms/admin.
29
- It has also added a helper method `current_user_is_admin?` to your application helper, this verifies in the view that a user is an admin.
30
- It has also added a `slugged_path` helper method to your application helper, this provides a path helper to link to user pages.
31
40
  Make sure to fill these methods out to secure your application.
32
41
 
33
42
  ##Contributing
@@ -38,4 +47,5 @@ More than welcome!
38
47
  3. Submit Pull Request
39
48
 
40
49
  ##Decorators and Customization
41
- Coming soon
50
+
51
+ Coming soon.
@@ -36,11 +36,6 @@
36
36
  $( document ).ready(function() {
37
37
  $('.sortable').sortable({items: '.nested-fields', handle: 'span'});
38
38
  });
39
- $('.sortable').sortable().bind('sortupdate', function(e, ui) {
40
- $('.block-order').each(function(i){
41
- $(this).val(i+1);
42
- })
43
- });
44
39
  window.setInterval(function(){
45
40
  $('.block-order').each(function(i){
46
41
  $(this).val(i+1);
@@ -14,7 +14,8 @@
14
14
  %div.jumbotron
15
15
  %p
16
16
  = raw jumbo.content_rendered
17
- = link_to PagesCms::Page.find_by_slug(jumbo.link).title, slugged_path(jumbo.link), class: 'btn btn-primary'
17
+ - unless jumbo.link.nil?
18
+ = link_to(PagesCms::Page.find_by_slug(jumbo.link).title, slugged_path(jumbo.link), class: 'btn btn-primary')
18
19
 
19
20
  - block.text_boxes.each do |box|
20
21
  %p
@@ -4,6 +4,9 @@ module PagesCms
4
4
  class InstallGenerator < Rails::Generators::Base
5
5
 
6
6
  def copy_migrations
7
+ puts ' '
8
+ puts ' Installing PagesCMS'
9
+ puts ' -------------------'
7
10
  puts ' installing migrations'
8
11
  `rake pages_cms:install:migrations`
9
12
  end
@@ -14,10 +17,12 @@ module PagesCms
14
17
  end
15
18
 
16
19
  def create_home
17
- puts ' create homepage'
18
- page = Page.create(title: 'Home')
19
- page.save!
20
- page.build_sidebar(show: true)
20
+ puts ' create initial homepage'
21
+ page = Page.new(title: 'Home')
22
+ if page.valid?
23
+ page.save
24
+ page.build_sidebar(show: true)
25
+ end
21
26
  end
22
27
 
23
28
  def add_route
@@ -31,10 +36,6 @@ module PagesCms
31
36
  # Do something if admin
32
37
  # is not logged in
33
38
  # ie: redirect_to root_path unless current_user.admin
34
- end
35
- # added by PagesCMS. Use this helper to link to user created pages.
36
- def slugged_path(page)
37
- "/#{page.slug}"
38
39
  end
39
40
  RUBY
40
41
  end
@@ -45,28 +46,39 @@ module PagesCms
45
46
  # added by PagesCMS. Fill out this helper to protect your views.
46
47
  def current_user_is_admin?
47
48
  true
49
+ end
50
+ # added by PagesCMS. Use this helper to link to user created pages.
51
+ def slugged_path(page)
52
+ "/#{page.slug}"
48
53
  end
49
54
  RUBY
50
55
  end
51
56
  end
52
57
 
58
+ def add_javascript
59
+ js_manifest = 'app/assets/javascripts/application.js'
60
+ js_require_block = " //= require cocoon\n"
61
+ insert_into_file js_manifest, js_require_block, :after => "//= require jquery\n"
62
+ end
63
+
53
64
  def instructions
54
65
  puts ' '
55
- puts ' To get hacking immediately:'
56
- puts ' 1. Run: rails generate pages_cms:views'
57
- puts ' 2. Add: gem "bootstrap-sass" to your gemfile'
58
- puts ' 3. Add: `//= require cocoon` to your application.js'
59
- puts ' 4. Add: `//= require bootstrap` to your application.js'
60
- puts ' 5. Add: `*= require pages_cms/pages_cms` to your application.css'
66
+ puts ' To get hacking immediately: '
67
+ puts ' 1. Run: `rails generate pages_cms:views` '
68
+ puts ' 2. Add: `gem "bootstrap-sass"` to your `Gemfile` '
69
+ puts ' 3. Add: `//= require bootstrap` to your `application.js` '
70
+ puts ' 4. Add: `*= require pages_cms/pages_cms` to your `application.css`'
71
+ puts ' 5. Run: `$ bundle install` '
61
72
  puts ' '
62
73
  puts ' You should now be able to go to /admin/pages and start building pages!'
63
- puts ' '
64
- puts ' This generator has added a `logged_in_admin` method to your application controller which will authorize the controllers in pages_cms/admin.'
65
- puts ' It has also added a helper method `current_user_is_admin?` to your application helper, this verifies in the view that a user is an admin.'
66
- puts ' It has also added a `slugged_path` helper method to your application helper, this provides a path helper to link to user pages.'
67
- puts ' Make sure to fill these methods out to secure your application.'
68
74
  end
69
75
 
70
76
  end
71
77
  end
72
78
  end
79
+
80
+
81
+
82
+
83
+
84
+
@@ -1,3 +1,3 @@
1
1
  module PagesCms
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -12,8 +12,8 @@
12
12
  //
13
13
  //
14
14
  //= require jquery
15
- //= require jquery_ujs
16
15
  //= require cocoon
16
+ //= require jquery_ujs
17
17
  //= require bootstrap
18
18
  //= require_tree .
19
19
 
@@ -0,0 +1,16 @@
1
+ @import "bootstrap-sprockets";
2
+ @import "bootstrap";
3
+ .inline-form { display: inline-block; max-width: 200px; }
4
+ .indent-1 { margin-left: 2em; }
5
+ .indent-2 { margin-left: 3.5em; }
6
+ .small-text-area { width: 400px; }
7
+ .big { font-size: 3em; height: auto !important; }
8
+ .container-fluid { max-width: 1100px; }
9
+ .navbar { height: 50px; margin: 0; }
10
+ .gallery { height: 300px !important; width: auto; overflow: hidden;}
11
+ .center { text-align: center;}
12
+ .content { width: 700px; margin: auto;}
13
+ .block { border: #ccc thin solid; padding: 1em; margin-top: 1em; border-radius: 10px; position: relative; }
14
+ .med { font-size: 2em !important; height: auto !important; }
15
+ .right { width: auto; position: absolute; bottom: 1em; right: 1em; }
16
+ .sortable-placeholder { border: 1px dashed #CCC; background: none; height: 200px; }
@@ -3,12 +3,4 @@ class ApplicationController < ActionController::Base
3
3
  # For APIs, you may want to use :null_session instead.
4
4
  protect_from_forgery with: :exception
5
5
 
6
- # added by PagesCMS. Fill out this helper to protect your controllers."
7
- def logged_in_admin
8
- # Do something if admin
9
- # is not logged in
10
- # ie: redirect_to root_path unless current_user.admin
11
- end
12
-
13
-
14
6
  end
@@ -1,13 +1,8 @@
1
1
  module ApplicationHelper
2
-
3
2
  # added by PagesCMS. Fill out this helper to protect your views.
4
3
  def current_user_is_admin?
5
4
  true
6
5
  end
7
6
 
8
- def slugged_path(page)
9
- "/#{page.slug}"
10
- end
11
-
12
7
 
13
8
  end
@@ -0,0 +1,35 @@
1
+ <nav class="navbar navbar-default">
2
+ <div class="container-fluid">
3
+ <!-- Brand and toggle get grouped for better mobile display -->
4
+ <div class="navbar-header">
5
+ <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
6
+ <span class="sr-only">Toggle navigation</span>
7
+ <span class="icon-bar"></span>
8
+ <span class="icon-bar"></span>
9
+ <span class="icon-bar"></span>
10
+ </button>
11
+ <a class="navbar-brand" href="/">Brand</a>
12
+ </div>
13
+
14
+ <ul class="nav navbar-nav navbar-right">
15
+ <% PagesCms::Page.where(navbar_show: true).each do |page| %>
16
+ <% if page.children.exists? %>
17
+ <li class="dropdown">
18
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><%= page.title %><span class="caret"></span></a>
19
+ <ul class="dropdown-menu" role="menu">
20
+ <li><%= link_to page.title, slugged_path(page) %></li>
21
+ <% page.children.each do |child| %>
22
+ <li><%= link_to child.title, slugged_path(child) %></li>
23
+ <% end %>
24
+ </ul>
25
+ </li>
26
+ <% else %>
27
+ <li><%= link_to page.title, slugged_path(page) %></li>
28
+ <% end %>
29
+ <% end %>
30
+ <li><%= link_to 'Blog', articles_path %></li>
31
+ </ul>
32
+
33
+ </div><!-- /.navbar-collapse -->
34
+ </div><!-- /.container-fluid -->
35
+ </nav>
@@ -0,0 +1,34 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Coldogms</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
+ <%= render 'layouts/pages_cms/header' %>
12
+
13
+ <% flash.each do |message_type, message| %>
14
+ <div class="message alert alert-<%= message_type %>"><%= message %></div>
15
+ <% end %>
16
+
17
+ <div class="container-fluid">
18
+ <%= yield %>
19
+ </div>
20
+
21
+ <hr>
22
+
23
+ <% if current_user_is_admin? %>
24
+ <footer>
25
+ <ul>
26
+ <li><%= link_to 'Admin Pages', admin_pages_path %></li>
27
+ <li><%= link_to 'Admin Images', admin_images_path %></li>
28
+ <li><%= link_to 'Admin Articles', admin_articles_path %></li>
29
+ </ul>
30
+ </footer>
31
+ <% end %>
32
+
33
+ </body>
34
+ </html>
@@ -0,0 +1,12 @@
1
+ = form_for article, url: url, method: method do |f|
2
+ = f.text_field :title, placeholder: 'article title', class: 'form-control big'
3
+ = f.select(:image_id, PagesCms::Image.all.collect {|p| [p.name, p.id] }, {include_blank: 'Choose a picture'}, class: 'form-control inline-form')
4
+ = f.text_field :tags, placeholder: 'tags comma separated', class: 'form-control'
5
+ = f.text_area :content, placeholder: 'the content', class: 'form-control', rows: 20
6
+ = f.label :draft
7
+ = f.check_box :draft, value: false
8
+ = f.label :archived
9
+ = f.check_box :archived, value: false
10
+ = f.submit 'Submit', class: 'btn btn-primary'
11
+
12
+
@@ -0,0 +1,3 @@
1
+ %h1 Edit Article
2
+
3
+ = render partial: '/pages_cms/admin/articles/form', locals: { article: @article, method: :patch, url: admin_article_path(@article) }
@@ -0,0 +1,38 @@
1
+ %h1 Articles
2
+
3
+ = link_to 'New Article', new_admin_article_path, class: 'btn btn-default'
4
+
5
+ <hr>
6
+
7
+ = form_tag '#', method: :get, class: 'inline-form' do
8
+ = text_field_tag :search, params[:search], class: 'form-control inline-form', placeholder: 'search'
9
+ = select_tag(:status, options_for_select(%w"Archived Published Drafts", params[:status]), include_blank: 'Status', class: 'form-control inline-form')
10
+ <button class="btn btn-default btn-sm inline-form" type="submit">Search</button>
11
+
12
+ <hr>
13
+
14
+ %table.table
15
+ %thead
16
+ %tr
17
+ %th
18
+ Article
19
+ %th
20
+ Tags
21
+ %th
22
+ Created At
23
+ %th
24
+ Actions
25
+ - @articles.each do |article|
26
+ %tr
27
+ %th
28
+ = article.title
29
+ %th
30
+ - article.tags.each do |tag|
31
+ = link_to tag, articles_path(search: tag)
32
+ %th
33
+ = article.created_at.strftime("%B %d")
34
+ %th
35
+ = article.draft ? link_to( 'Publish',admin_article_path(article, article: { draft: false }), method: :put, class: 'btn btn-xs btn-default') : link_to( 'Make Draft',admin_article_path(article, article: { draft: true }), method: :put, class: 'btn btn-xs btn-default')
36
+ = link_to 'Archive', admin_article_path(article, article: { archived: false } ), method: :put, class: 'btn btn-xs btn-default'
37
+ = link_to 'Delete', admin_article_path(article), method: :delete, class: 'btn btn-xs btn-default'
38
+ = link_to 'Edit', edit_admin_article_path(article), class: 'btn btn-xs btn-default'
@@ -0,0 +1,3 @@
1
+ %h1 New Article
2
+
3
+ = render partial: '/pages_cms/admin/articles/form', locals: { article: @article, method: :post, url: admin_articles_path }
@@ -0,0 +1,15 @@
1
+ %h1 Images
2
+ = form_for @image, url: admin_images_path, method: :post, multipart: true do |f|
3
+ = f.text_field :name, placeholder: 'give your image a title'
4
+ = f.file_field :file
5
+ = f.submit 'Upload', class: 'btn btn-primary'
6
+
7
+ <hr>
8
+
9
+ %div.row
10
+ - @images.each do |image|
11
+ %div.col-md-3.col-sm-4.col-xs-6.thumbnail
12
+ = raw "<img class='gallery' src='/images/#{image.file}' />"
13
+ %p
14
+ = link_to "/images/#{image.file}", "/images/#{image.file}"
15
+ = link_to 'delete', admin_image_path(image), method: :delete, class: 'btn btn-xs btn-default'
@@ -0,0 +1,9 @@
1
+ .row
2
+ .nested-fields
3
+ %hr
4
+ %h5
5
+ Jumbotron
6
+ = link_to_remove_association 'remove', f
7
+ = f.text_area :content, placeholder: 'content', class: 'form-control', rows: 8
8
+ = f.label :link
9
+ = f.select(:link, PagesCms::Page.all.collect {|p| [p.title, p.slug] }, {include_blank: 'None'}, class: 'form-control inline-form')
@@ -0,0 +1,19 @@
1
+ .nested-fields
2
+ %div.block
3
+ <span style="cursor: crosshair">Reorder</span>
4
+ = f.text_field :name, placeholder: 'page block title (leave blank for no title)', class: 'form-control med'
5
+ = f.hidden_field :order, class: 'block-order'
6
+ %div
7
+ = f.fields_for :jumbotrons do |jumbotron|
8
+ = render 'jumbotron_fields', f: jumbotron
9
+ = f.fields_for :text_boxes do |text_box|
10
+ = render 'text_box_fields', f: text_box
11
+ %div.row
12
+ = f.fields_for :thumbnails do |thumbnail|
13
+ = render 'thumbnail_fields', f: thumbnail
14
+ %hr
15
+ = link_to_add_association 'Add Jumbotron', f, :jumbotrons, class: 'btn btn-default btn-xs'
16
+ = link_to_add_association 'Add Text Box', f, :text_boxes, class: 'btn btn-default btn-xs'
17
+ = link_to_add_association 'Add Thumbnail', f, :thumbnails, class: 'btn btn-default btn-xs'
18
+ %div.right
19
+ = link_to_remove_association 'Remove Block', f
@@ -0,0 +1,7 @@
1
+ .row
2
+ .nested-fields
3
+ %hr
4
+ %h5
5
+ Text Box
6
+ = link_to_remove_association 'remove', f
7
+ = f.text_area :content, placeholder: 'content', class: 'form-control', rows: 8
@@ -0,0 +1,8 @@
1
+ .nested-fields
2
+ %div.col-md-4
3
+ %h5
4
+ Thumbnail
5
+ = link_to_remove_association 'remove', f
6
+ = f.select(:image_id, PagesCms::Image.all.collect {|p| [p.name, p.id] }, {include_blank: 'Choose a picture'}, class: 'form-control')
7
+ = f.select(:link, PagesCms::Page.all.collect {|p| [p.title, p.slug] }, {include_blank: 'Choose a link'}, class: 'form-control')
8
+ = f.text_area :content, placeholder: 'content', class: 'form-control', rows: 8
@@ -0,0 +1,45 @@
1
+ = form_for @page, url: admin_page_path(@page), class: 'inline-form form-horizontal' do |f|
2
+ %div.row
3
+ %div.col-md-8
4
+ %span
5
+ %h2
6
+ Edit
7
+ = @page.title
8
+ = link_to 'Preview', slugged_path(@page), class: 'btn btn-default btn-xs'
9
+ = f.label 'Show in top navbar '
10
+ = f.check_box :navbar_show
11
+ = f.label 'Show in sidebar '
12
+ = f.check_box :sidebar_show
13
+ = f.text_field :title, placeholder: 'page title', class: 'form-control big'
14
+ = f.text_field :meta_tags, placeholder: 'meta tags', class: 'form-control inline-form'
15
+ = f.text_field :meta_description, placeholder: 'meta description', class: 'form-control inline-form'
16
+ = f.select(:parent_id, PagesCms::Page.where(parent_id: nil).collect {|p| [p.title, p.id] }, {include_blank: 'Is a sub-page of'}, class: 'form-control inline-form')
17
+ = f.submit 'Save', class: 'btn btn-primary inline-form'
18
+ %div.sortable
19
+ = f.fields_for :page_blocks, f.object.page_blocks.order(:order) do |page_block|
20
+ = render 'page_block_fields', f: page_block
21
+ %hr
22
+ = link_to_add_association 'Add Block', f, :page_blocks
23
+
24
+ %div.col-md-3
25
+ %h4 Sidebar
26
+ = f.fields_for :sidebar, @sidebar do |ss|
27
+ = ss.text_area :content, placeholder: 'content', class: 'form-control', rows: '20'
28
+ = ss.label 'Show sidebar on this page '
29
+ = ss.check_box :show
30
+ = ss.select(:use_instead, PagesCms::Page.all.includes(:sidebar).collect {|p| [p.title, p.sidebar.id] unless p.sidebar.nil? }, {include_blank: 'Use this sidebar instead'}, class: 'form-control inline-form')
31
+
32
+ %div.row
33
+ = f.submit 'Save', class: 'btn btn-primary center-block'
34
+
35
+ :javascript
36
+ $( document ).ready(function() {
37
+ $('.sortable').sortable({items: '.nested-fields', handle: 'span'});
38
+ });
39
+ window.setInterval(function(){
40
+ $('.block-order').each(function(i){
41
+ $(this).val(i+1);
42
+ })
43
+ }, 500);
44
+
45
+ = javascript_include_tag 'pages_cms/sortable.js'
@@ -0,0 +1,35 @@
1
+ %h1 All Pages
2
+
3
+ = link_to 'New Page', admin_pages_path(page: {title: "my page #{PagesCms::Page.last.id.to_i+1}"}), method: :post, class: 'btn btn-default'
4
+
5
+ %table.table
6
+ %thead
7
+ %tr
8
+ %th
9
+ Page
10
+ %th
11
+ SubPage
12
+ %th
13
+ Actions
14
+
15
+ - @pages.each do |page|
16
+ %tr
17
+ %td
18
+ = page.title
19
+ %td
20
+ &nbsp;
21
+ %td
22
+ = link_to 'edit', edit_admin_page_path(page), class: 'btn btn-default btn-xs'
23
+ = link_to 'show', slugged_path(page), class: 'btn btn-default btn-xs'
24
+ = link_to 'delete', admin_page_path(page), method: :delete, class: 'btn btn-default btn-xs'
25
+ - if page.children.exists?
26
+ - page.children.each do |subpage|
27
+ %tr
28
+ %td
29
+ &nbsp;
30
+ %td
31
+ = subpage.title
32
+ %td
33
+ = link_to 'edit', edit_admin_page_path(subpage), class: 'btn btn-default btn-xs'
34
+ = link_to 'show', slugged_path(subpage), class: 'btn btn-default btn-xs'
35
+ = link_to 'delete', admin_page_path(subpage), method: :delete, class: 'btn btn-default btn-xs'
@@ -0,0 +1,25 @@
1
+ <h1>Blog</h1>
2
+
3
+ <%= form_tag '#', method: :get, class: 'inline-form' do %>
4
+ <label>Search</label>
5
+ <%= text_field_tag :search, params[:search], class: 'form-control inline-form' %>
6
+ <% end %>
7
+
8
+ <% @articles.each do |post| %>
9
+ <div class="content">
10
+ <% unless post.image.nil? %>
11
+ <div class="image-post" ><%= image_tag post.image.file %></div>
12
+ <% end %>
13
+ <div style="cursor: pointer;" onclick="window.location='/articles/<%= post.id.to_s %>';">
14
+ <h2 class="center"><%= post.title %></h2>
15
+ <h6>Posted <%= post.created_at.strftime("%B %d") %></h6>
16
+ <p><%= truncate(post.content, length: 200) %></p>
17
+ </div>
18
+ <div><%= link_to 'Read More', article_path(post) %></div>
19
+ <div class="tags">
20
+ <% post.tags.each do |tag| %>
21
+ <%= link_to tag, articles_path(search: tag), class: 'btn btn-default btn-xs' %>
22
+ <% end %>
23
+ </div>
24
+ </div>
25
+ <% end %>
@@ -0,0 +1,10 @@
1
+ %h1
2
+ = @article.title
3
+
4
+ - @article.tags.each do |tag|
5
+ = link_to tag, articles_path(search: tag), class: 'btn btn-default btn-xs'
6
+ = @article.created_at.strftime("%B %d")
7
+
8
+ <hr>
9
+ %div.content
10
+ = raw @article.content_rendered
@@ -0,0 +1,21 @@
1
+ - page.page_blocks.order(:order).each do |block|
2
+ %h2
3
+ = block.name unless block.name.blank?
4
+ - block.thumbnails.each do |thumb|
5
+ %div.thumbnail.col-md-4.col-sm-6
6
+ - if thumb.image
7
+ = image_tag thumb.image.file
8
+ - else
9
+ = image_tag '/images/1434315758_my_name.jpg'
10
+ %h4
11
+ = link_to raw(thumb.content_rendered), thumb.link
12
+
13
+ - block.jumbotrons.each do |jumbo|
14
+ %div.jumbotron
15
+ %p
16
+ = raw jumbo.content_rendered
17
+ = link_to PagesCms::Page.find_by_slug(jumbo.link).title, slugged_path(jumbo.link), class: 'btn btn-primary'
18
+
19
+ - block.text_boxes.each do |box|
20
+ %p
21
+ = raw box.content_rendered
@@ -0,0 +1,15 @@
1
+ %h1
2
+ = @page.title
3
+ - if @sidebar
4
+ %div.row
5
+ %div.col-md-8
6
+ = render partial: 'pages_cms/pages/main', locals: { page: @page }
7
+ %div.col-md-4
8
+ = raw @sidebar.content_rendered
9
+ %ul.nav.nav-pills.nav-stacked
10
+ - PagesCms::Page.where(sidebar_show: true).each do |link|
11
+ %li
12
+ = link_to link.title, slugged_path(link)
13
+
14
+ - else
15
+ = render partial: 'pages_cms/pages/main', locals: { page: @page }
@@ -1,4 +1,3 @@
1
1
  Rails.application.routes.draw do
2
2
 
3
- mount PagesCms::Engine => '/'
4
3
  end
@@ -0,0 +1,95 @@
1
+ # This migration comes from pages_cms (originally 20150609171657)
2
+ class CreateInitialDb < ActiveRecord::Migration
3
+ def change
4
+
5
+ create_table :pages_cms_pages do |t|
6
+ t.string :title
7
+ t.string :slug
8
+ t.string :meta_tags
9
+ t.string :meta_description
10
+ t.boolean :draft
11
+ t.integer :parent_id, index: true
12
+ t.string :order
13
+ t.boolean :navbar_show, default: true
14
+ t.boolean :sidebar_show, default: true
15
+
16
+ t.timestamps null: false
17
+ end
18
+
19
+ create_table :pages_cms_images do |t|
20
+ t.string :name
21
+ t.string :file
22
+
23
+ t.timestamps null: false
24
+ end
25
+
26
+ create_table :pages_cms_page_blocks do |t|
27
+ t.integer :page_id, index: true
28
+ t.integer :order
29
+ t.string :name
30
+ t.string :order
31
+
32
+ t.timestamps null: false
33
+ end
34
+ add_foreign_key :pages_cms_page_blocks, :pages_cms_pages, column: :page_id
35
+
36
+ create_table :pages_cms_thumbnails do |t|
37
+ t.integer :page_block_id, index: true
38
+ t.integer :image_id, index: true
39
+ t.text :content
40
+ t.text :content_rendered
41
+ t.string :link
42
+ t.string :order
43
+
44
+ t.timestamps null: false
45
+ end
46
+ add_foreign_key :pages_cms_thumbnails, :pages_cms_page_blocks, column: :page_block_id
47
+ add_foreign_key :pages_cms_thumbnails, :pages_cms_images, column: :image_id
48
+
49
+ create_table :pages_cms_jumbotrons do |t|
50
+ t.integer :page_block_id, index: true
51
+ t.text :content
52
+ t.text :content_rendered
53
+ t.string :link
54
+ t.string :order
55
+
56
+ t.timestamps null: false
57
+ end
58
+ add_foreign_key :pages_cms_jumbotrons, :pages_cms_page_blocks, column: :page_block_id
59
+
60
+ create_table :pages_cms_text_boxes do |t|
61
+ t.integer :page_block_id, index: true
62
+ t.text :content
63
+ t.text :content_rendered
64
+ t.string :order
65
+
66
+ t.timestamps null: false
67
+ end
68
+ add_foreign_key :pages_cms_text_boxes, :pages_cms_page_blocks, column: :page_block_id
69
+
70
+ create_table :pages_cms_sidebars do |t|
71
+ t.integer :page_id, index: true
72
+ t.text :content
73
+ t.text :content_rendered
74
+ t.boolean :show, default: true
75
+ t.integer :use_instead
76
+
77
+ t.timestamps null: false
78
+ end
79
+ add_foreign_key :pages_cms_sidebars, :pages_cms_pages, column: :page_id
80
+
81
+ create_table :pages_cms_articles do |t|
82
+ t.integer :image_id, index: true
83
+ t.text :content
84
+ t.text :content_rendered
85
+ t.string :title
86
+ t.boolean :draft
87
+ t.boolean :archived
88
+ t.text :tags, array: true, default: []
89
+
90
+ t.timestamps null: false
91
+ end
92
+ add_foreign_key :pages_cms_articles, :pages_cms_images, column: :image_id
93
+
94
+ end
95
+ end
@@ -0,0 +1,122 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20150616171349) do
15
+
16
+ # These are extensions that must be enabled in order to support this database
17
+ enable_extension "plpgsql"
18
+
19
+ create_table "pages_cms_articles", force: :cascade do |t|
20
+ t.integer "image_id"
21
+ t.text "content"
22
+ t.text "content_rendered"
23
+ t.string "title"
24
+ t.boolean "draft"
25
+ t.boolean "archived"
26
+ t.text "tags", default: [], array: true
27
+ t.datetime "created_at", null: false
28
+ t.datetime "updated_at", null: false
29
+ end
30
+
31
+ add_index "pages_cms_articles", ["image_id"], name: "index_pages_cms_articles_on_image_id", using: :btree
32
+
33
+ create_table "pages_cms_images", force: :cascade do |t|
34
+ t.string "name"
35
+ t.string "file"
36
+ t.datetime "created_at", null: false
37
+ t.datetime "updated_at", null: false
38
+ end
39
+
40
+ create_table "pages_cms_jumbotrons", force: :cascade do |t|
41
+ t.integer "page_block_id"
42
+ t.text "content"
43
+ t.text "content_rendered"
44
+ t.string "link"
45
+ t.string "order"
46
+ t.datetime "created_at", null: false
47
+ t.datetime "updated_at", null: false
48
+ end
49
+
50
+ add_index "pages_cms_jumbotrons", ["page_block_id"], name: "index_pages_cms_jumbotrons_on_page_block_id", using: :btree
51
+
52
+ create_table "pages_cms_page_blocks", force: :cascade do |t|
53
+ t.integer "page_id"
54
+ t.string "order"
55
+ t.string "name"
56
+ t.datetime "created_at", null: false
57
+ t.datetime "updated_at", null: false
58
+ end
59
+
60
+ add_index "pages_cms_page_blocks", ["page_id"], name: "index_pages_cms_page_blocks_on_page_id", using: :btree
61
+
62
+ create_table "pages_cms_pages", force: :cascade do |t|
63
+ t.string "title"
64
+ t.string "slug"
65
+ t.string "meta_tags"
66
+ t.string "meta_description"
67
+ t.boolean "draft"
68
+ t.integer "parent_id"
69
+ t.string "order"
70
+ t.boolean "navbar_show", default: true
71
+ t.boolean "sidebar_show", default: true
72
+ t.datetime "created_at", null: false
73
+ t.datetime "updated_at", null: false
74
+ end
75
+
76
+ add_index "pages_cms_pages", ["parent_id"], name: "index_pages_cms_pages_on_parent_id", using: :btree
77
+
78
+ create_table "pages_cms_sidebars", force: :cascade do |t|
79
+ t.integer "page_id"
80
+ t.text "content"
81
+ t.text "content_rendered"
82
+ t.boolean "show", default: true
83
+ t.integer "use_instead"
84
+ t.datetime "created_at", null: false
85
+ t.datetime "updated_at", null: false
86
+ end
87
+
88
+ add_index "pages_cms_sidebars", ["page_id"], name: "index_pages_cms_sidebars_on_page_id", using: :btree
89
+
90
+ create_table "pages_cms_text_boxes", force: :cascade do |t|
91
+ t.integer "page_block_id"
92
+ t.text "content"
93
+ t.text "content_rendered"
94
+ t.string "order"
95
+ t.datetime "created_at", null: false
96
+ t.datetime "updated_at", null: false
97
+ end
98
+
99
+ add_index "pages_cms_text_boxes", ["page_block_id"], name: "index_pages_cms_text_boxes_on_page_block_id", using: :btree
100
+
101
+ create_table "pages_cms_thumbnails", force: :cascade do |t|
102
+ t.integer "page_block_id"
103
+ t.integer "image_id"
104
+ t.text "content"
105
+ t.text "content_rendered"
106
+ t.string "link"
107
+ t.string "order"
108
+ t.datetime "created_at", null: false
109
+ t.datetime "updated_at", null: false
110
+ end
111
+
112
+ add_index "pages_cms_thumbnails", ["image_id"], name: "index_pages_cms_thumbnails_on_image_id", using: :btree
113
+ add_index "pages_cms_thumbnails", ["page_block_id"], name: "index_pages_cms_thumbnails_on_page_block_id", using: :btree
114
+
115
+ add_foreign_key "pages_cms_articles", "pages_cms_images", column: "image_id"
116
+ add_foreign_key "pages_cms_jumbotrons", "pages_cms_page_blocks", column: "page_block_id"
117
+ add_foreign_key "pages_cms_page_blocks", "pages_cms_pages", column: "page_id"
118
+ add_foreign_key "pages_cms_sidebars", "pages_cms_pages", column: "page_id"
119
+ add_foreign_key "pages_cms_text_boxes", "pages_cms_page_blocks", column: "page_block_id"
120
+ add_foreign_key "pages_cms_thumbnails", "pages_cms_images", column: "image_id"
121
+ add_foreign_key "pages_cms_thumbnails", "pages_cms_page_blocks", column: "page_block_id"
122
+ end
@@ -9060,3 +9060,289 @@ Started GET "/assets/application.self-7e59640942256e07125f15e51f7eada5a93b9b4587
9060
9060
 
9061
9061
 
9062
9062
  Started GET "/assets/jquery_ujs.self-8e98a7a072a6cee1372d19fff9ff3e6aa1e39a37d89d6f06861637d061113ee7.js?body=1" for ::1 at 2015-06-15 15:29:22 -0700
9063
+ ActiveRecord::SchemaMigration Load (18.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
9064
+ Migrating to CreateInitialDb (20150616170412)
9065
+  (21.2ms) BEGIN
9066
+  (133.4ms) CREATE TABLE "pages_cms_pages" ("id" serial primary key, "title" character varying, "slug" character varying, "meta_tags" character varying, "meta_description" character varying, "draft" boolean, "parent_id" integer, "order" character varying, "navbar_show" boolean DEFAULT 't', "sidebar_show" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
9067
+ PG::DuplicateTable: ERROR: relation "pages_cms_pages" already exists
9068
+ : CREATE TABLE "pages_cms_pages" ("id" serial primary key, "title" character varying, "slug" character varying, "meta_tags" character varying, "meta_description" character varying, "draft" boolean, "parent_id" integer, "order" character varying, "navbar_show" boolean DEFAULT 't', "sidebar_show" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
9069
+  (0.1ms) ROLLBACK
9070
+  (0.2ms) BEGIN
9071
+ PagesCms::Page Exists (2.8ms) SELECT 1 AS one FROM "pages_cms_pages" WHERE "pages_cms_pages"."slug" = 'home' LIMIT 1
9072
+  (0.4ms) ROLLBACK
9073
+  (0.1ms) BEGIN
9074
+ PagesCms::Page Exists (0.5ms) SELECT 1 AS one FROM "pages_cms_pages" WHERE "pages_cms_pages"."slug" = 'home' LIMIT 1
9075
+  (0.2ms) ROLLBACK
9076
+ ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
9077
+ Migrating to CreateInitialDb (20150616170412)
9078
+  (0.2ms) BEGIN
9079
+  (85.5ms) CREATE TABLE "pages_cms_pages" ("id" serial primary key, "title" character varying, "slug" character varying, "meta_tags" character varying, "meta_description" character varying, "draft" boolean, "parent_id" integer, "order" character varying, "navbar_show" boolean DEFAULT 't', "sidebar_show" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
9080
+ PG::DuplicateTable: ERROR: relation "pages_cms_pages" already exists
9081
+ : CREATE TABLE "pages_cms_pages" ("id" serial primary key, "title" character varying, "slug" character varying, "meta_tags" character varying, "meta_description" character varying, "draft" boolean, "parent_id" integer, "order" character varying, "navbar_show" boolean DEFAULT 't', "sidebar_show" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
9082
+  (0.2ms) ROLLBACK
9083
+  (0.2ms) BEGIN
9084
+ PagesCms::Page Exists (2.1ms) SELECT 1 AS one FROM "pages_cms_pages" WHERE "pages_cms_pages"."slug" = 'home' LIMIT 1
9085
+  (0.2ms) ROLLBACK
9086
+  (0.1ms) BEGIN
9087
+ PagesCms::Page Exists (0.5ms) SELECT 1 AS one FROM "pages_cms_pages" WHERE "pages_cms_pages"."slug" = 'home' LIMIT 1
9088
+  (0.2ms) ROLLBACK
9089
+  (255.3ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
9090
+  (25.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
9091
+ ActiveRecord::SchemaMigration Load (1.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
9092
+ Migrating to CreateInitialDb (20150616171349)
9093
+  (0.3ms) BEGIN
9094
+  (168.4ms) CREATE TABLE "pages_cms_pages" ("id" serial primary key, "title" character varying, "slug" character varying, "meta_tags" character varying, "meta_description" character varying, "draft" boolean, "parent_id" integer, "order" character varying, "navbar_show" boolean DEFAULT 't', "sidebar_show" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
9095
+  (1.8ms) CREATE INDEX "index_pages_cms_pages_on_parent_id" ON "pages_cms_pages" ("parent_id")
9096
+  (6.1ms) CREATE TABLE "pages_cms_images" ("id" serial primary key, "name" character varying, "file" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
9097
+  (5.6ms) CREATE TABLE "pages_cms_page_blocks" ("id" serial primary key, "page_id" integer, "order" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
9098
+  (11.4ms) CREATE INDEX "index_pages_cms_page_blocks_on_page_id" ON "pages_cms_page_blocks" ("page_id")
9099
+  (130.6ms) ALTER TABLE "pages_cms_page_blocks" ADD CONSTRAINT "fk_rails_2f78dfe9ef"
9100
+ FOREIGN KEY ("page_id")
9101
+ REFERENCES "pages_cms_pages" ("id")
9102
+
9103
+  (5.8ms) CREATE TABLE "pages_cms_thumbnails" ("id" serial primary key, "page_block_id" integer, "image_id" integer, "content" text, "content_rendered" text, "link" character varying, "order" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
9104
+  (1.4ms) CREATE INDEX "index_pages_cms_thumbnails_on_page_block_id" ON "pages_cms_thumbnails" ("page_block_id")
9105
+  (1.5ms) CREATE INDEX "index_pages_cms_thumbnails_on_image_id" ON "pages_cms_thumbnails" ("image_id")
9106
+  (19.7ms) ALTER TABLE "pages_cms_thumbnails" ADD CONSTRAINT "fk_rails_3968b879ef"
9107
+ FOREIGN KEY ("page_block_id")
9108
+ REFERENCES "pages_cms_page_blocks" ("id")
9109
+
9110
+  (1.6ms) ALTER TABLE "pages_cms_thumbnails" ADD CONSTRAINT "fk_rails_94d9a79bcc"
9111
+ FOREIGN KEY ("image_id")
9112
+ REFERENCES "pages_cms_images" ("id")
9113
+ 
9114
+  (5.6ms) CREATE TABLE "pages_cms_jumbotrons" ("id" serial primary key, "page_block_id" integer, "content" text, "content_rendered" text, "link" character varying, "order" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
9115
+  (1.6ms) CREATE INDEX "index_pages_cms_jumbotrons_on_page_block_id" ON "pages_cms_jumbotrons" ("page_block_id")
9116
+  (2.3ms) ALTER TABLE "pages_cms_jumbotrons" ADD CONSTRAINT "fk_rails_756ebfb247"
9117
+ FOREIGN KEY ("page_block_id")
9118
+ REFERENCES "pages_cms_page_blocks" ("id")
9119
+
9120
+  (7.7ms) CREATE TABLE "pages_cms_text_boxes" ("id" serial primary key, "page_block_id" integer, "content" text, "content_rendered" text, "order" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
9121
+  (2.7ms) CREATE INDEX "index_pages_cms_text_boxes_on_page_block_id" ON "pages_cms_text_boxes" ("page_block_id")
9122
+  (2.5ms) ALTER TABLE "pages_cms_text_boxes" ADD CONSTRAINT "fk_rails_89e03effd1"
9123
+ FOREIGN KEY ("page_block_id")
9124
+ REFERENCES "pages_cms_page_blocks" ("id")
9125
+ 
9126
+  (6.6ms) CREATE TABLE "pages_cms_sidebars" ("id" serial primary key, "page_id" integer, "content" text, "content_rendered" text, "show" boolean DEFAULT 't', "use_instead" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
9127
+  (1.9ms) CREATE INDEX "index_pages_cms_sidebars_on_page_id" ON "pages_cms_sidebars" ("page_id")
9128
+  (2.5ms) ALTER TABLE "pages_cms_sidebars" ADD CONSTRAINT "fk_rails_72f631044d"
9129
+ FOREIGN KEY ("page_id")
9130
+ REFERENCES "pages_cms_pages" ("id")
9131
+
9132
+  (19.3ms) CREATE TABLE "pages_cms_articles" ("id" serial primary key, "image_id" integer, "content" text, "content_rendered" text, "title" character varying, "draft" boolean, "archived" boolean, "tags" text[] DEFAULT '{}', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
9133
+  (1.4ms) CREATE INDEX "index_pages_cms_articles_on_image_id" ON "pages_cms_articles" ("image_id")
9134
+  (1.7ms) ALTER TABLE "pages_cms_articles" ADD CONSTRAINT "fk_rails_9dc2606ec7"
9135
+ FOREIGN KEY ("image_id")
9136
+ REFERENCES "pages_cms_images" ("id")
9137
+ 
9138
+ SQL (35.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20150616171349"]]
9139
+  (4.6ms) COMMIT
9140
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
9141
+  (4.8ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
9142
+ FROM pg_constraint c
9143
+ JOIN pg_class t1 ON c.conrelid = t1.oid
9144
+ JOIN pg_class t2 ON c.confrelid = t2.oid
9145
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
9146
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
9147
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
9148
+ WHERE c.contype = 'f'
9149
+ AND t1.relname = 'pages_cms_articles'
9150
+ AND t3.nspname = ANY (current_schemas(false))
9151
+ ORDER BY c.conname
9152
+ 
9153
+  (4.1ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
9154
+ FROM pg_constraint c
9155
+ JOIN pg_class t1 ON c.conrelid = t1.oid
9156
+ JOIN pg_class t2 ON c.confrelid = t2.oid
9157
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
9158
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
9159
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
9160
+ WHERE c.contype = 'f'
9161
+ AND t1.relname = 'pages_cms_images'
9162
+ AND t3.nspname = ANY (current_schemas(false))
9163
+ ORDER BY c.conname
9164
+
9165
+  (4.1ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
9166
+ FROM pg_constraint c
9167
+ JOIN pg_class t1 ON c.conrelid = t1.oid
9168
+ JOIN pg_class t2 ON c.confrelid = t2.oid
9169
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
9170
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
9171
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
9172
+ WHERE c.contype = 'f'
9173
+ AND t1.relname = 'pages_cms_jumbotrons'
9174
+ AND t3.nspname = ANY (current_schemas(false))
9175
+ ORDER BY c.conname
9176
+ 
9177
+  (4.1ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
9178
+ FROM pg_constraint c
9179
+ JOIN pg_class t1 ON c.conrelid = t1.oid
9180
+ JOIN pg_class t2 ON c.confrelid = t2.oid
9181
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
9182
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
9183
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
9184
+ WHERE c.contype = 'f'
9185
+ AND t1.relname = 'pages_cms_page_blocks'
9186
+ AND t3.nspname = ANY (current_schemas(false))
9187
+ ORDER BY c.conname
9188
+
9189
+  (7.1ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
9190
+ FROM pg_constraint c
9191
+ JOIN pg_class t1 ON c.conrelid = t1.oid
9192
+ JOIN pg_class t2 ON c.confrelid = t2.oid
9193
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
9194
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
9195
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
9196
+ WHERE c.contype = 'f'
9197
+ AND t1.relname = 'pages_cms_pages'
9198
+ AND t3.nspname = ANY (current_schemas(false))
9199
+ ORDER BY c.conname
9200
+ 
9201
+  (5.7ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
9202
+ FROM pg_constraint c
9203
+ JOIN pg_class t1 ON c.conrelid = t1.oid
9204
+ JOIN pg_class t2 ON c.confrelid = t2.oid
9205
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
9206
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
9207
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
9208
+ WHERE c.contype = 'f'
9209
+ AND t1.relname = 'pages_cms_sidebars'
9210
+ AND t3.nspname = ANY (current_schemas(false))
9211
+ ORDER BY c.conname
9212
+
9213
+  (4.1ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
9214
+ FROM pg_constraint c
9215
+ JOIN pg_class t1 ON c.conrelid = t1.oid
9216
+ JOIN pg_class t2 ON c.confrelid = t2.oid
9217
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
9218
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
9219
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
9220
+ WHERE c.contype = 'f'
9221
+ AND t1.relname = 'pages_cms_text_boxes'
9222
+ AND t3.nspname = ANY (current_schemas(false))
9223
+ ORDER BY c.conname
9224
+ 
9225
+  (4.3ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
9226
+ FROM pg_constraint c
9227
+ JOIN pg_class t1 ON c.conrelid = t1.oid
9228
+ JOIN pg_class t2 ON c.confrelid = t2.oid
9229
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
9230
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
9231
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
9232
+ WHERE c.contype = 'f'
9233
+ AND t1.relname = 'pages_cms_thumbnails'
9234
+ AND t3.nspname = ANY (current_schemas(false))
9235
+ ORDER BY c.conname
9236
+
9237
+  (0.2ms) BEGIN
9238
+ PagesCms::Page Exists (21.7ms) SELECT 1 AS one FROM "pages_cms_pages" WHERE "pages_cms_pages"."slug" = 'home' LIMIT 1
9239
+ SQL (22.3ms) INSERT INTO "pages_cms_pages" ("title", "slug", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["title", "Home"], ["slug", "home"], ["created_at", "2015-06-16 17:14:00.552079"], ["updated_at", "2015-06-16 17:14:00.552079"]]
9240
+  (1.1ms) COMMIT
9241
+  (0.1ms) BEGIN
9242
+ PagesCms::Page Exists (0.8ms) SELECT 1 AS one FROM "pages_cms_pages" WHERE ("pages_cms_pages"."slug" = 'home' AND "pages_cms_pages"."id" != 1) LIMIT 1
9243
+  (0.2ms) COMMIT
9244
+ PagesCms::Sidebar Load (16.0ms) SELECT "pages_cms_sidebars".* FROM "pages_cms_sidebars" WHERE "pages_cms_sidebars"."page_id" = $1 LIMIT 1 [["page_id", 1]]
9245
+ ActiveRecord::SchemaMigration Load (0.7ms) SELECT "schema_migrations".* FROM "schema_migrations"
9246
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
9247
+  (4.9ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
9248
+ FROM pg_constraint c
9249
+ JOIN pg_class t1 ON c.conrelid = t1.oid
9250
+ JOIN pg_class t2 ON c.confrelid = t2.oid
9251
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
9252
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
9253
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
9254
+ WHERE c.contype = 'f'
9255
+ AND t1.relname = 'pages_cms_articles'
9256
+ AND t3.nspname = ANY (current_schemas(false))
9257
+ ORDER BY c.conname
9258
+ 
9259
+  (4.1ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
9260
+ FROM pg_constraint c
9261
+ JOIN pg_class t1 ON c.conrelid = t1.oid
9262
+ JOIN pg_class t2 ON c.confrelid = t2.oid
9263
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
9264
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
9265
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
9266
+ WHERE c.contype = 'f'
9267
+ AND t1.relname = 'pages_cms_images'
9268
+ AND t3.nspname = ANY (current_schemas(false))
9269
+ ORDER BY c.conname
9270
+
9271
+  (7.5ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
9272
+ FROM pg_constraint c
9273
+ JOIN pg_class t1 ON c.conrelid = t1.oid
9274
+ JOIN pg_class t2 ON c.confrelid = t2.oid
9275
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
9276
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
9277
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
9278
+ WHERE c.contype = 'f'
9279
+ AND t1.relname = 'pages_cms_jumbotrons'
9280
+ AND t3.nspname = ANY (current_schemas(false))
9281
+ ORDER BY c.conname
9282
+ 
9283
+  (5.6ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
9284
+ FROM pg_constraint c
9285
+ JOIN pg_class t1 ON c.conrelid = t1.oid
9286
+ JOIN pg_class t2 ON c.confrelid = t2.oid
9287
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
9288
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
9289
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
9290
+ WHERE c.contype = 'f'
9291
+ AND t1.relname = 'pages_cms_page_blocks'
9292
+ AND t3.nspname = ANY (current_schemas(false))
9293
+ ORDER BY c.conname
9294
+
9295
+  (4.1ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
9296
+ FROM pg_constraint c
9297
+ JOIN pg_class t1 ON c.conrelid = t1.oid
9298
+ JOIN pg_class t2 ON c.confrelid = t2.oid
9299
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
9300
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
9301
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
9302
+ WHERE c.contype = 'f'
9303
+ AND t1.relname = 'pages_cms_pages'
9304
+ AND t3.nspname = ANY (current_schemas(false))
9305
+ ORDER BY c.conname
9306
+ 
9307
+  (4.3ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
9308
+ FROM pg_constraint c
9309
+ JOIN pg_class t1 ON c.conrelid = t1.oid
9310
+ JOIN pg_class t2 ON c.confrelid = t2.oid
9311
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
9312
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
9313
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
9314
+ WHERE c.contype = 'f'
9315
+ AND t1.relname = 'pages_cms_sidebars'
9316
+ AND t3.nspname = ANY (current_schemas(false))
9317
+ ORDER BY c.conname
9318
+
9319
+  (4.2ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
9320
+ FROM pg_constraint c
9321
+ JOIN pg_class t1 ON c.conrelid = t1.oid
9322
+ JOIN pg_class t2 ON c.confrelid = t2.oid
9323
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
9324
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
9325
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
9326
+ WHERE c.contype = 'f'
9327
+ AND t1.relname = 'pages_cms_text_boxes'
9328
+ AND t3.nspname = ANY (current_schemas(false))
9329
+ ORDER BY c.conname
9330
+ 
9331
+  (4.1ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
9332
+ FROM pg_constraint c
9333
+ JOIN pg_class t1 ON c.conrelid = t1.oid
9334
+ JOIN pg_class t2 ON c.confrelid = t2.oid
9335
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
9336
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
9337
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
9338
+ WHERE c.contype = 'f'
9339
+ AND t1.relname = 'pages_cms_thumbnails'
9340
+ AND t3.nspname = ANY (current_schemas(false))
9341
+ ORDER BY c.conname
9342
+
9343
+  (0.2ms) BEGIN
9344
+ PagesCms::Page Exists (1.4ms) SELECT 1 AS one FROM "pages_cms_pages" WHERE "pages_cms_pages"."slug" = 'home' LIMIT 1
9345
+  (0.2ms) ROLLBACK
9346
+  (0.1ms) BEGIN
9347
+ PagesCms::Page Exists (0.4ms) SELECT 1 AS one FROM "pages_cms_pages" WHERE "pages_cms_pages"."slug" = 'home' LIMIT 1
9348
+  (0.2ms) ROLLBACK
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pages_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin Walker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-15 00:00:00.000000000 Z
11
+ date: 2015-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -253,8 +253,26 @@ files:
253
253
  - test/dummy/Rakefile
254
254
  - test/dummy/app/assets/javascripts/application.js
255
255
  - test/dummy/app/assets/stylesheets/application.css
256
+ - test/dummy/app/assets/stylesheets/pages_cms/pages_cms.scss
256
257
  - test/dummy/app/controllers/application_controller.rb
257
258
  - test/dummy/app/helpers/application_helper.rb
259
+ - test/dummy/app/views/layouts/pages_cms/_header.html.erb
260
+ - test/dummy/app/views/layouts/pages_cms/application.html.erb
261
+ - test/dummy/app/views/pages_cms/admin/articles/_form.html.haml
262
+ - test/dummy/app/views/pages_cms/admin/articles/edit.html.haml
263
+ - test/dummy/app/views/pages_cms/admin/articles/index.html.haml
264
+ - test/dummy/app/views/pages_cms/admin/articles/new.html.haml
265
+ - test/dummy/app/views/pages_cms/admin/images/index.html.haml
266
+ - test/dummy/app/views/pages_cms/admin/pages/_jumbotron_fields.html.haml
267
+ - test/dummy/app/views/pages_cms/admin/pages/_page_block_fields.html.haml
268
+ - test/dummy/app/views/pages_cms/admin/pages/_text_box_fields.html.haml
269
+ - test/dummy/app/views/pages_cms/admin/pages/_thumbnail_fields.html.haml
270
+ - test/dummy/app/views/pages_cms/admin/pages/edit.html.haml
271
+ - test/dummy/app/views/pages_cms/admin/pages/index.html.haml
272
+ - test/dummy/app/views/pages_cms/articles/index.html.erb
273
+ - test/dummy/app/views/pages_cms/articles/show.html.haml
274
+ - test/dummy/app/views/pages_cms/pages/_main.html.haml
275
+ - test/dummy/app/views/pages_cms/pages/show.html.haml
258
276
  - test/dummy/bin/bundle
259
277
  - test/dummy/bin/rails
260
278
  - test/dummy/bin/rake
@@ -278,6 +296,8 @@ files:
278
296
  - test/dummy/config/locales/en.yml
279
297
  - test/dummy/config/routes.rb
280
298
  - test/dummy/config/secrets.yml
299
+ - test/dummy/db/migrate/20150616171349_create_initial_db.pages_cms.rb
300
+ - test/dummy/db/schema.rb
281
301
  - test/dummy/log/development.log
282
302
  - test/dummy/log/test.log
283
303
  - test/dummy/public/404.html
@@ -1216,8 +1236,26 @@ summary: A CMS built with Rails that allows the user more freedom to build their
1216
1236
  test_files:
1217
1237
  - test/dummy/app/assets/javascripts/application.js
1218
1238
  - test/dummy/app/assets/stylesheets/application.css
1239
+ - test/dummy/app/assets/stylesheets/pages_cms/pages_cms.scss
1219
1240
  - test/dummy/app/controllers/application_controller.rb
1220
1241
  - test/dummy/app/helpers/application_helper.rb
1242
+ - test/dummy/app/views/layouts/pages_cms/_header.html.erb
1243
+ - test/dummy/app/views/layouts/pages_cms/application.html.erb
1244
+ - test/dummy/app/views/pages_cms/admin/articles/_form.html.haml
1245
+ - test/dummy/app/views/pages_cms/admin/articles/edit.html.haml
1246
+ - test/dummy/app/views/pages_cms/admin/articles/index.html.haml
1247
+ - test/dummy/app/views/pages_cms/admin/articles/new.html.haml
1248
+ - test/dummy/app/views/pages_cms/admin/images/index.html.haml
1249
+ - test/dummy/app/views/pages_cms/admin/pages/_jumbotron_fields.html.haml
1250
+ - test/dummy/app/views/pages_cms/admin/pages/_page_block_fields.html.haml
1251
+ - test/dummy/app/views/pages_cms/admin/pages/_text_box_fields.html.haml
1252
+ - test/dummy/app/views/pages_cms/admin/pages/_thumbnail_fields.html.haml
1253
+ - test/dummy/app/views/pages_cms/admin/pages/edit.html.haml
1254
+ - test/dummy/app/views/pages_cms/admin/pages/index.html.haml
1255
+ - test/dummy/app/views/pages_cms/articles/index.html.erb
1256
+ - test/dummy/app/views/pages_cms/articles/show.html.haml
1257
+ - test/dummy/app/views/pages_cms/pages/_main.html.haml
1258
+ - test/dummy/app/views/pages_cms/pages/show.html.haml
1221
1259
  - test/dummy/bin/bundle
1222
1260
  - test/dummy/bin/rails
1223
1261
  - test/dummy/bin/rake
@@ -1241,6 +1279,8 @@ test_files:
1241
1279
  - test/dummy/config/routes.rb
1242
1280
  - test/dummy/config/secrets.yml
1243
1281
  - test/dummy/config.ru
1282
+ - test/dummy/db/migrate/20150616171349_create_initial_db.pages_cms.rb
1283
+ - test/dummy/db/schema.rb
1244
1284
  - test/dummy/log/development.log
1245
1285
  - test/dummy/log/test.log
1246
1286
  - test/dummy/public/404.html