push_type_core 0.7.0 → 0.8.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/push_type/application_controller_methods.rb +1 -2
  3. data/app/controllers/front_end_controller.rb +16 -0
  4. data/app/fields/push_type/wysiwyg_field.rb +19 -0
  5. data/app/models/concerns/push_type/unexposable.rb +1 -2
  6. data/db/migrate/20160201150228_drop_legacy_push_type_taxonomies.rb +13 -0
  7. data/lib/push_type/config.rb +0 -4
  8. data/lib/push_type/core.rb +0 -4
  9. data/lib/push_type/rails/routes.rb +1 -7
  10. data/lib/push_type/testing/common_rake.rb +0 -2
  11. data/lib/push_type/testing/factories.rb +0 -5
  12. data/lib/push_type/testing/setup.rb +1 -1
  13. data/lib/push_type/version.rb +1 -1
  14. data/test/controllers/{nodes_front_end_controller_test.rb → front_end_controller_test.rb} +1 -1
  15. data/test/dummy/config/initializers/push_type.rb +1 -1
  16. data/test/dummy/config/secrets.yml +2 -2
  17. data/test/dummy/db/migrate/20160206155139_drop_legacy_push_type_taxonomies.push_type.rb +14 -0
  18. data/test/dummy/db/schema.rb +1 -21
  19. data/test/dummy/log/test.log +8013 -8654
  20. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/0ANSDcZJu9gPyqtYPIW729qm1kriQ29Vn9LU8T2SGQU.cache +0 -0
  21. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/_d65qW7wxRtKVSYpmfSenECz5QUWVI9pppUgV7TA1Rk.cache +0 -0
  22. data/test/dummy/tmp/generators/app/presenters/page_presenter.rb +12 -0
  23. data/test/fields/push_type/wysiwyg_field_test.rb +23 -0
  24. data/test/lib/push_type/core_test.rb +0 -27
  25. metadata +38 -71
  26. data/app/controllers/nodes_front_end_controller.rb +0 -21
  27. data/app/controllers/taxonomies_front_end_controller.rb +0 -25
  28. data/app/models/push_type/taxonomy.rb +0 -44
  29. data/db/migrate/20150310115933_create_push_type_taxonomies.rb +0 -18
  30. data/db/migrate/20150310123230_create_push_type_taxonomy_hierarchies.rb +0 -16
  31. data/lib/generators/push_type/taxonomy/USAGE +0 -8
  32. data/lib/generators/push_type/taxonomy/taxonomy_generator.rb +0 -13
  33. data/lib/generators/push_type/taxonomy/templates/taxonomy.html.erb +0 -3
  34. data/lib/generators/push_type/taxonomy/templates/taxonomy.rb +0 -7
  35. data/test/controllers/taxonomies_front_end_controller_test.rb +0 -58
  36. data/test/dummy/app/models/category.rb +0 -7
  37. data/test/dummy/app/views/taxonomies/category.html.erb +0 -3
  38. data/test/dummy/db/migrate/20160122151528_create_push_type_taxonomies.push_type.rb +0 -19
  39. data/test/dummy/db/migrate/20160122151529_create_push_type_taxonomy_hierarchies.push_type.rb +0 -17
  40. data/test/dummy/tmp/generators/config/initializers/push_type.rb +0 -50
  41. data/test/dummy/tmp/generators/config/routes.rb +0 -59
  42. data/test/lib/generators/push_type/taxonomy_generator_test.rb +0 -17
  43. data/test/models/push_type/taxonomy_test.rb +0 -37
  44. /data/test/dummy/db/migrate/{20160122151524_create_push_type_users.push_type.rb → 20160206155134_create_push_type_users.push_type.rb} +0 -0
  45. /data/test/dummy/db/migrate/{20160122151525_create_push_type_nodes.push_type.rb → 20160206155135_create_push_type_nodes.push_type.rb} +0 -0
  46. /data/test/dummy/db/migrate/{20160122151526_create_push_type_node_hierarchies.push_type.rb → 20160206155136_create_push_type_node_hierarchies.push_type.rb} +0 -0
  47. /data/test/dummy/db/migrate/{20160122151527_create_push_type_assets.push_type.rb → 20160206155137_create_push_type_assets.push_type.rb} +0 -0
  48. /data/test/dummy/db/migrate/{20160122151530_add_field_store_default_values.push_type.rb → 20160206155138_add_field_store_default_values.push_type.rb} +0 -0
  49. /data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{A0UfNVcNn48aSCOiAvcHrJ1BASyXJCELidVIQ6drqQM.cache → BXXMCMRu7JahLHdf-HLwTSs6u6Pfn4DhDNK5wg5hgy0.cache} +0 -0
  50. /data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{RLSLZQ8zubBDFwRzJo2WPXEPjX3gpp-T1h5FK-UnAYo.cache → TUwu9oRcnc80mNVFDhhX5AqieKa5hmp5Ro9HIoQjdA4.cache} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9157c07fb81b39a6edec686caa23945b733d9676
4
- data.tar.gz: 6eaba2fdcccd35b7f2c2c270205cc395c98a263d
3
+ metadata.gz: 736fd951736c5f385dab1cc64436cc1ee814803d
4
+ data.tar.gz: d1f4e9137d3be16efb3ab35ace1e2ded80a3e014
5
5
  SHA512:
6
- metadata.gz: 320537d485fcc3523b1283ef0a376c0c7f5eee7a0f1667595490b1be25705374dc84bb65edbc98e38e5f760c030dfbbd7c045c14a9f38f93c664c7e4f38e83e4
7
- data.tar.gz: cb7dc8dc5f7e9d7c12910f8b7f51f217f81c0ceeccc2539a9c2c0d597c3c937f5d3d1b04de9b7639c94cadb9898870bf59aa60d097ff4a427f6c36eebb44491c
6
+ metadata.gz: 38b1f4ad6d34d5dbe7aec1ea6803bfa5e82cc6eecadc637a35f1a0d9bba24b40098415a5f4b6e489aa88b1d97bc2779da7aa1ef2601d2748eb72b55580c9e72b
7
+ data.tar.gz: dc61b1b66d2166be460287c81c9ed4e80c9b21441b98d848acc86330fc7417e256b7051f26fff3c3814a19e331eb98a9e889dde7df97d0947e144b1e6c07be0c
@@ -3,8 +3,7 @@ module PushType
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  FILTERS = [
6
- :before_node_load_filters, :before_node_action_filters, :after_node_action_filters,
7
- :before_taxonomy_load_filters, :before_taxonomy_action_filters, :after_taxonomy_action_filters
6
+ :before_node_load_filters, :before_node_action_filters, :after_node_action_filters
8
7
  ]
9
8
 
10
9
  included do
@@ -2,6 +2,13 @@ class FrontEndController < ApplicationController
2
2
 
3
3
  include PushType::Filterable
4
4
 
5
+ before_action :load_node, only: :show
6
+ hooks_for :node, only: :show
7
+
8
+ def show
9
+ render *@node.template_args
10
+ end
11
+
5
12
  private
6
13
 
7
14
  def root_path?
@@ -16,4 +23,13 @@ class FrontEndController < ApplicationController
16
23
  end
17
24
  end
18
25
 
26
+ def load_node
27
+ @node = PushType::Node.exposed.published.find_by_path permalink_path
28
+ if @node
29
+ instance_variable_set "@#{ @node.type.underscore }", @node.present!(view_context)
30
+ else
31
+ raise_404
32
+ end
33
+ end
34
+
19
35
  end
@@ -0,0 +1,19 @@
1
+ module PushType
2
+ class WysiwygField < PushType::FieldType
3
+
4
+ options template: 'wysiwyg', toolbar: 'full'
5
+
6
+ def form_helper
7
+ :text_area
8
+ end
9
+
10
+ def toolbar
11
+ @opts[:toolbar]
12
+ end
13
+
14
+ def html_options
15
+ super.merge(:'v-froala' => true, :'froala-toolbar' => toolbar)
16
+ end
17
+
18
+ end
19
+ end
@@ -28,8 +28,7 @@ module PushType
28
28
 
29
29
  def unexposure_method
30
30
  case _ct.base_class.name.demodulize
31
- when 'Node' then :unexposed_nodes
32
- when 'Taxonomy' then :unexposed_taxonomies
31
+ when 'Node' then :unexposed_nodes
33
32
  end
34
33
  end
35
34
 
@@ -0,0 +1,13 @@
1
+ class DropLegacyPushTypeTaxonomies < ActiveRecord::Migration
2
+ def up
3
+ if ActiveRecord::Base.connection.table_exists? :push_type_taxonomies
4
+ drop_table :push_type_taxonomies
5
+ end
6
+ if ActiveRecord::Base.connection.table_exists? :push_type_taxonomy_hierarchies
7
+ drop_table :push_type_taxonomy_hierarchies
8
+ end
9
+ if ActiveRecord::Base.connection.column_exists? :push_type_assets, :tags
10
+ remove_column :push_type_assets, :tags
11
+ end
12
+ end
13
+ end
@@ -18,10 +18,6 @@ module PushType
18
18
  mattr_accessor :unexposed_nodes
19
19
  @@unexposed_nodes = []
20
20
 
21
- # Taxonomy types that are not exposed to the front end
22
- mattr_accessor :unexposed_taxonomies
23
- @@unexposed_taxonomies = []
24
-
25
21
  # Hash of geometry strings used for resizing images
26
22
  mattr_accessor :media_styles
27
23
  @@media_styles = {
@@ -27,10 +27,6 @@ module PushType
27
27
  subclasses_from_list(:node, config.unexposed_nodes)
28
28
  end
29
29
 
30
- def unexposed_taxonomies
31
- subclasses_from_list(:taxonomy, config.unexposed_taxonomies)
32
- end
33
-
34
30
  def subclasses_from_list(scope, types = nil)
35
31
  return [] unless types
36
32
  descendants = "push_type/#{ scope }".camelcase.constantize.descendants.map { |c| c.name.underscore }
@@ -6,8 +6,7 @@ module ActionDispatch::Routing
6
6
  path: '/push_type',
7
7
  home: PushType.config.home_slug,
8
8
  actions: {
9
- node: 'nodes_front_end#show',
10
- taxonomy: 'taxonomies_front_end#show',
9
+ node: 'front_end#show'
11
10
  }
12
11
  }.deep_merge!(options)
13
12
 
@@ -21,11 +20,6 @@ module ActionDispatch::Routing
21
20
  asset.media params[:style]
22
21
  }, as: 'media'
23
22
 
24
- # Taxonomies
25
- get ":taxonomy/*permalink" => opts[:actions][:taxonomy], as: 'taxonomy', constraints: ->(params, req) {
26
- PushType::Taxonomy.descendants(exposed: true).map(&:base_slug).include? params[:taxonomy]
27
- }
28
-
29
23
  # A catch-all root for the nodes
30
24
  get '*permalink' => opts[:actions][:node], as: 'node'
31
25
  root to: opts[:actions][:node], permalink: opts[:home]
@@ -1,7 +1,6 @@
1
1
  require 'generators/push_type/dummy/dummy_generator'
2
2
  require 'generators/push_type/install/install_generator'
3
3
  require 'generators/push_type/node/node_generator'
4
- require 'generators/push_type/taxonomy/taxonomy_generator'
5
4
  require 'generators/push_type/structure/structure_generator'
6
5
 
7
6
  namespace :common do
@@ -18,7 +17,6 @@ namespace :common do
18
17
  system 'bundle exec rake db:drop db:create'
19
18
  PushType::InstallGenerator.start ['--quiet']
20
19
  PushType::NodeGenerator.start ['page', '--quiet']
21
- PushType::TaxonomyGenerator.start ['category', '--quiet']
22
20
  PushType::StructureGenerator.start ['location', '--quiet']
23
21
  end
24
22
  end
@@ -42,10 +42,5 @@ FactoryGirl.define do
42
42
  file { Rack::Test::UploadedFile.new(PushType::Core::Engine.root.join('test', 'files/document.pdf')) }
43
43
  end
44
44
  end
45
-
46
- factory :taxonomy, class: 'PushType::Taxonomy' do
47
- title { generate :title }
48
- slug { generate :slug }
49
- end
50
45
 
51
46
  end
@@ -14,7 +14,7 @@ Dragonfly.app.use_datastore :memory
14
14
 
15
15
  class ActiveSupport::TestCase
16
16
  # Due to test weirdness / dodgy code need to reference some classes
17
- Page && Category && Location
17
+ Page && Location
18
18
 
19
19
  before :each do
20
20
  DatabaseCleaner.start
@@ -1,3 +1,3 @@
1
1
  module PushType
2
- VERSION = '0.7.0'
2
+ VERSION = '0.8.0.beta.1'
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class NodesFrontEndControllerTest < ActionController::TestCase
3
+ class FrontEndControllerTest < ActionController::TestCase
4
4
 
5
5
  before { @routes = Rails.application.routes }
6
6
 
@@ -45,6 +45,6 @@ PushType.setup do |config|
45
45
  # secret_access_key: ENV['SECRET_ACCESS_KEY_ID']
46
46
  # }
47
47
 
48
- # config.dragonfly_secret = '271df62782ac8231fd83d982acbbaf45552ecd92777925f7f664a6cee3ba9738'
48
+ # config.dragonfly_secret = 'cddb3d46c0d8274b6211613824e13c3240acf6b873554e91622c5c3dc9b71479'
49
49
 
50
50
  end
@@ -11,10 +11,10 @@
11
11
  # if you're sharing your code publicly.
12
12
 
13
13
  development:
14
- secret_key_base: 8f3024409a00bb714abf072147d19aeac045966e9c5df452fb6f4d2fb637338131a8558bd629e3b585db96a43d285663ed2c81e220e16c89d33c441971037b9d
14
+ secret_key_base: d149cd01c6eee217b8287d12912221801883ca082c1ba1c3511b1a5081338da74422e2b029ef2019336ffc4786be44e6b1cf6b6c7452d8ccdd62a1a5416682e6
15
15
 
16
16
  test:
17
- secret_key_base: 5531a988ccefaee0fd9df7e0203712ad461e87af88e408d27ebe39e6c33569cda48b9d57676d8070dafb69d090060fffc16f8d470081dd64d3c80293cad6738d
17
+ secret_key_base: 599444d947e59bb318b4083a4b8dcdfa6a214b3b677e99dd4354558de92c3d0ddbe8870375b729b874a82d1bc1dc7e80cb17acbc0db4e62ffe542f78ed94fb90
18
18
 
19
19
  # Do not keep production secrets in the repository,
20
20
  # instead read values from the environment.
@@ -0,0 +1,14 @@
1
+ # This migration comes from push_type (originally 20160201150228)
2
+ class DropLegacyPushTypeTaxonomies < ActiveRecord::Migration
3
+ def up
4
+ if ActiveRecord::Base.connection.table_exists? :push_type_taxonomies
5
+ drop_table :push_type_taxonomies
6
+ end
7
+ if ActiveRecord::Base.connection.table_exists? :push_type_taxonomy_hierarchies
8
+ drop_table :push_type_taxonomy_hierarchies
9
+ end
10
+ if ActiveRecord::Base.connection.column_exists? :push_type_assets, :tags
11
+ remove_column :push_type_assets, :tags
12
+ end
13
+ end
14
+ end
@@ -11,7 +11,7 @@
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: 20160122151530) do
14
+ ActiveRecord::Schema.define(version: 20160206155139) do
15
15
 
16
16
  # These are extensions that must be enabled in order to support this database
17
17
  enable_extension "plpgsql"
@@ -28,7 +28,6 @@ ActiveRecord::Schema.define(version: 20160122151530) do
28
28
  t.datetime "created_at", null: false
29
29
  t.datetime "updated_at", null: false
30
30
  t.datetime "deleted_at"
31
- t.string "tags", array: true
32
31
  end
33
32
 
34
33
  create_table "push_type_node_hierarchies", id: false, force: :cascade do |t|
@@ -57,25 +56,6 @@ ActiveRecord::Schema.define(version: 20160122151530) do
57
56
  t.datetime "deleted_at"
58
57
  end
59
58
 
60
- create_table "push_type_taxonomies", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t|
61
- t.string "type"
62
- t.string "title"
63
- t.string "slug"
64
- t.uuid "parent_id"
65
- t.integer "sort_order"
66
- t.datetime "created_at", null: false
67
- t.datetime "updated_at", null: false
68
- end
69
-
70
- create_table "push_type_taxonomy_hierarchies", id: false, force: :cascade do |t|
71
- t.uuid "ancestor_id", null: false
72
- t.uuid "descendant_id", null: false
73
- t.integer "generations", null: false
74
- end
75
-
76
- add_index "push_type_taxonomy_hierarchies", ["ancestor_id", "descendant_id", "generations"], name: "taxonomy_anc_desc_idx", unique: true, using: :btree
77
- add_index "push_type_taxonomy_hierarchies", ["descendant_id"], name: "taxonomy_desc_idx", using: :btree
78
-
79
59
  create_table "push_type_users", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t|
80
60
  t.string "name"
81
61
  t.string "email"