pageflow-internal-links 0.2.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.scss-lint.yml +40 -0
  4. data/.travis.yml +13 -0
  5. data/CHANGELOG.md +8 -12
  6. data/Gemfile +1 -6
  7. data/README.md +8 -5
  8. data/app/assets/javascripts/pageflow/internal_links/editor/config.js +0 -10
  9. data/app/assets/javascripts/pageflow/internal_links/editor/models/page_link.js +18 -1
  10. data/app/assets/javascripts/pageflow/internal_links/editor/models/page_link_file_selection_handler.js +17 -0
  11. data/app/assets/javascripts/pageflow/internal_links/editor/views/edit_page_link_view.js +18 -8
  12. data/app/assets/javascripts/pageflow/internal_links/editor/views/grid_configuration_editor_view.js +1 -1
  13. data/app/assets/javascripts/pageflow/internal_links/editor/views/list_configuration_editor_view.js +1 -1
  14. data/app/assets/javascripts/pageflow/internal_links/editor/views/list_item_embedded_view.js +13 -4
  15. data/app/assets/javascripts/pageflow/internal_links/grid_page_type.js +3 -12
  16. data/app/assets/javascripts/pageflow/internal_links/list_page_type.js +25 -10
  17. data/app/assets/stylesheets/pageflow/{internal_links.css.scss → internal_links.scss} +0 -0
  18. data/app/assets/stylesheets/pageflow/internal_links/{editor.css.scss → editor.scss} +0 -0
  19. data/app/assets/stylesheets/pageflow/internal_links/editor/{embedded_grid_item.css.scss → embedded_grid_item.scss} +0 -0
  20. data/app/assets/stylesheets/pageflow/internal_links/grid.scss +3 -51
  21. data/app/assets/stylesheets/pageflow/internal_links/themes/default.scss +3 -0
  22. data/app/assets/stylesheets/pageflow/internal_links/themes/default/grid/colors.scss +41 -0
  23. data/app/assets/stylesheets/pageflow/internal_links/themes/default/grid/typography.scss +35 -0
  24. data/app/assets/stylesheets/pageflow/internal_links/themes/default/list_as_multiple_choice.scss +64 -11
  25. data/app/helpers/pageflow/internal_links/grid_helper.rb +1 -1
  26. data/app/helpers/pageflow/internal_links/list_helper.rb +1 -1
  27. data/app/helpers/pageflow/internal_links/page_links.rb +30 -8
  28. data/app/views/pageflow/internal_links/grid/page.html.erb +6 -16
  29. data/app/views/pageflow/internal_links/list/_page_link.html.erb +2 -3
  30. data/app/views/pageflow/internal_links/list/page.html.erb +6 -17
  31. data/bin/rspec +29 -0
  32. data/config/locales/de.yml +12 -1
  33. data/config/locales/en.yml +12 -13
  34. data/lib/pageflow/internal_links/grid_page_type.rb +4 -0
  35. data/lib/pageflow/internal_links/list_page_type.rb +4 -0
  36. data/lib/pageflow/internal_links/plugin.rb +1 -0
  37. data/lib/pageflow/internal_links/version.rb +1 -1
  38. data/pageflow-internal-links.gemspec +9 -3
  39. data/spec/integration/page_types_spec.rb +90 -0
  40. data/spec/spec_helper.rb +14 -0
  41. data/spec/support/config/factory_bot.rb +6 -0
  42. metadata +87 -13
@@ -14,6 +14,10 @@ module Pageflow
14
14
  def view_helpers
15
15
  [GridHelper]
16
16
  end
17
+
18
+ def export_version
19
+ VERSION
20
+ end
17
21
  end
18
22
  end
19
23
  end
@@ -14,6 +14,10 @@ module Pageflow
14
14
  def view_helpers
15
15
  [InternalLinks::ListHelper]
16
16
  end
17
+
18
+ def export_version
19
+ VERSION
20
+ end
17
21
  end
18
22
  end
19
23
  end
@@ -2,6 +2,7 @@ module Pageflow
2
2
  module InternalLinks
3
3
  class Plugin < Pageflow::Plugin
4
4
  def configure(config)
5
+ config.page_types.register(InternalLinks.grid_page_type)
5
6
  config.features.register(PageTypeFeature.new(InternalLinks.list_page_type))
6
7
  end
7
8
  end
@@ -1,5 +1,5 @@
1
1
  module Pageflow
2
2
  module InternalLinks
3
- VERSION = '0.2.0'.freeze
3
+ VERSION = '1.4.0'.freeze
4
4
  end
5
5
  end
@@ -13,12 +13,18 @@ Gem::Specification.new do |spec|
13
13
  spec.license = 'MIT'
14
14
 
15
15
  spec.files = `git ls-files`.split($/)
16
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
17
  spec.require_paths = ['lib']
19
18
 
20
- spec.add_runtime_dependency('pageflow', '~> 0.10')
19
+ spec.required_ruby_version = '~> 2.1'
20
+
21
+ spec.add_runtime_dependency 'pageflow', '~> 15.x'
22
+
23
+ spec.add_development_dependency 'bundler', ['>= 1.0', '< 3']
24
+ spec.add_development_dependency 'pageflow-support', '~> 15.x'
25
+ spec.add_development_dependency 'rake', '~> 12.0'
26
+ spec.add_development_dependency 'rspec-rails', '~> 3.0'
21
27
 
22
28
  # Semantic versioning rake tasks
23
- spec.add_development_dependency 'semmy', '~> 0.2'
29
+ spec.add_development_dependency 'semmy', '~> 1.0'
24
30
  end
@@ -0,0 +1,90 @@
1
+ require 'spec_helper'
2
+ require 'pageflow/lint'
3
+ require 'pageflow/used_file_test_helper'
4
+
5
+ Pageflow::Lint.page_type(Pageflow::InternalLinks.grid_page_type)
6
+ Pageflow::Lint.page_type(Pageflow::InternalLinks.list_page_type)
7
+
8
+ module Pageflow
9
+ module InternalLinks
10
+ describe 'page type', type: :helper do
11
+ include RenderPageTestHelper
12
+ include UsedFileTestHelper
13
+
14
+ before do
15
+ pageflow_configure do |config|
16
+ config.plugin(InternalLinks.plugin)
17
+ config.features.enable_by_default('page_type.internal_links_list')
18
+ end
19
+
20
+ helper.extend(Pageflow::FileThumbnailsHelper)
21
+ helper.extend(Pageflow::PagesHelper)
22
+ end
23
+
24
+ describe 'grid' do
25
+ it 'renders internal links' do
26
+ revision = create(:revision)
27
+ other_page = create(:page, revision: revision)
28
+ page = create(:page,
29
+ template: InternalLinks.grid_page_type.name,
30
+ revision: revision,
31
+ configuration: {
32
+ internal_links: [
33
+ {
34
+ target_page_id: other_page.perma_id
35
+ }
36
+ ]
37
+ })
38
+
39
+ html = render_page(page)
40
+
41
+ expect(html).to have_selector("nav a[data-page=#{other_page.perma_id}]")
42
+ end
43
+ end
44
+
45
+ describe 'list' do
46
+ it 'renders internal links' do
47
+ revision = create(:revision)
48
+ other_page = create(:page, revision: revision)
49
+ page = create(:page,
50
+ template: InternalLinks.list_page_type.name,
51
+ revision: revision,
52
+ configuration: {
53
+ internal_links: [
54
+ {
55
+ target_page_id: other_page.perma_id
56
+ }
57
+ ]
58
+ })
59
+
60
+ html = render_page(page)
61
+
62
+ expect(html).to have_selector("nav a[data-page=#{other_page.perma_id}]")
63
+ end
64
+
65
+ it 'looks up custom thumbnail by perma id' do
66
+ revision = create(:revision)
67
+ entry = Pageflow::PublishedEntry.new(create(:entry), revision)
68
+ other_page = create(:page, revision: revision)
69
+ image_file = create_used_file(:image_file, entry: entry)
70
+ page = create(:page,
71
+ template: InternalLinks.list_page_type.name,
72
+ revision: revision,
73
+ configuration: {
74
+ internal_links: [
75
+ {
76
+ target_page_id: other_page.perma_id,
77
+ thumbnail_image_id: image_file.perma_id
78
+ }
79
+ ]
80
+ })
81
+
82
+ html = render_page(page)
83
+
84
+ expect(html)
85
+ .to have_selector("nav a .pageflow_image_file_link_thumbnail_large_#{image_file.perma_id}")
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,14 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+ ENV['PAGEFLOW_PLUGIN_ENGINE'] = 'pageflow_internal_links'
3
+
4
+ require 'pageflow/support'
5
+ Pageflow::Dummy.setup
6
+
7
+ require 'rspec/rails'
8
+
9
+ engine_root = File.join(File.dirname(__FILE__), '..')
10
+ Dir[File.join(engine_root, 'spec/support/**/*.rb')].each { |file| require(file) }
11
+
12
+ RSpec.configure do |config|
13
+ config.use_transactional_fixtures = true
14
+ end
@@ -0,0 +1,6 @@
1
+ require 'factory_bot_rails'
2
+
3
+ RSpec.configure do |config|
4
+ # Allow to use build and create methods without FactoryBot prefix.
5
+ config.include FactoryBot::Syntax::Methods
6
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pageflow-internal-links
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Codevise Solutions
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-09 00:00:00.000000000 Z
11
+ date: 2020-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pageflow
@@ -16,28 +16,90 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.10'
19
+ version: 15.x
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.10'
26
+ version: 15.x
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '3'
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '1.0'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '3'
47
+ - !ruby/object:Gem::Dependency
48
+ name: pageflow-support
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: 15.x
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: 15.x
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '12.0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '12.0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rspec-rails
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '3.0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '3.0'
27
89
  - !ruby/object:Gem::Dependency
28
90
  name: semmy
29
91
  requirement: !ruby/object:Gem::Requirement
30
92
  requirements:
31
93
  - - "~>"
32
94
  - !ruby/object:Gem::Version
33
- version: '0.2'
95
+ version: '1.0'
34
96
  type: :development
35
97
  prerelease: false
36
98
  version_requirements: !ruby/object:Gem::Requirement
37
99
  requirements:
38
100
  - - "~>"
39
101
  - !ruby/object:Gem::Version
40
- version: '0.2'
102
+ version: '1.0'
41
103
  description:
42
104
  email:
43
105
  - info@codevise.de
@@ -47,6 +109,8 @@ extra_rdoc_files: []
47
109
  files:
48
110
  - ".gitignore"
49
111
  - ".jshintrc"
112
+ - ".scss-lint.yml"
113
+ - ".travis.yml"
50
114
  - CHANGELOG.md
51
115
  - Gemfile
52
116
  - README.md
@@ -71,6 +135,7 @@ files:
71
135
  - app/assets/javascripts/pageflow/internal_links/editor/controllers/side_bar_controller.js
72
136
  - app/assets/javascripts/pageflow/internal_links/editor/models/page_configuration_mixin.js
73
137
  - app/assets/javascripts/pageflow/internal_links/editor/models/page_link.js
138
+ - app/assets/javascripts/pageflow/internal_links/editor/models/page_link_file_selection_handler.js
74
139
  - app/assets/javascripts/pageflow/internal_links/editor/routers/side_bar_router.js
75
140
  - app/assets/javascripts/pageflow/internal_links/editor/templates/edit_page_link.jst.ejs
76
141
  - app/assets/javascripts/pageflow/internal_links/editor/templates/grid_item_embedded.jst.ejs
@@ -85,13 +150,15 @@ files:
85
150
  - app/assets/javascripts/pageflow/internal_links/editor/views/page_link_embedded_view.js
86
151
  - app/assets/javascripts/pageflow/internal_links/grid_page_type.js
87
152
  - app/assets/javascripts/pageflow/internal_links/list_page_type.js
88
- - app/assets/stylesheets/pageflow/internal_links.css.scss
89
- - app/assets/stylesheets/pageflow/internal_links/editor.css.scss
90
- - app/assets/stylesheets/pageflow/internal_links/editor/embedded_grid_item.css.scss
153
+ - app/assets/stylesheets/pageflow/internal_links.scss
154
+ - app/assets/stylesheets/pageflow/internal_links/editor.scss
155
+ - app/assets/stylesheets/pageflow/internal_links/editor/embedded_grid_item.scss
91
156
  - app/assets/stylesheets/pageflow/internal_links/editor/embedded_list_item.scss
92
157
  - app/assets/stylesheets/pageflow/internal_links/grid.scss
93
158
  - app/assets/stylesheets/pageflow/internal_links/list.scss
94
159
  - app/assets/stylesheets/pageflow/internal_links/themes/default.scss
160
+ - app/assets/stylesheets/pageflow/internal_links/themes/default/grid/colors.scss
161
+ - app/assets/stylesheets/pageflow/internal_links/themes/default/grid/typography.scss
95
162
  - app/assets/stylesheets/pageflow/internal_links/themes/default/list_as_multiple_choice.scss
96
163
  - app/helpers/pageflow/internal_links/grid_helper.rb
97
164
  - app/helpers/pageflow/internal_links/list_helper.rb
@@ -101,6 +168,7 @@ files:
101
168
  - app/views/pageflow/internal_links/list/_list.html.erb
102
169
  - app/views/pageflow/internal_links/list/_page_link.html.erb
103
170
  - app/views/pageflow/internal_links/list/page.html.erb
171
+ - bin/rspec
104
172
  - config/locales/de.yml
105
173
  - config/locales/en.yml
106
174
  - db/migrate/20150109121800_rename_internal_links_page_type.rb
@@ -111,6 +179,9 @@ files:
111
179
  - lib/pageflow/internal_links/plugin.rb
112
180
  - lib/pageflow/internal_links/version.rb
113
181
  - pageflow-internal-links.gemspec
182
+ - spec/integration/page_types_spec.rb
183
+ - spec/spec_helper.rb
184
+ - spec/support/config/factory_bot.rb
114
185
  homepage: https://github.com/codevise/pageflow-internal-links
115
186
  licenses:
116
187
  - MIT
@@ -121,9 +192,9 @@ require_paths:
121
192
  - lib
122
193
  required_ruby_version: !ruby/object:Gem::Requirement
123
194
  requirements:
124
- - - ">="
195
+ - - "~>"
125
196
  - !ruby/object:Gem::Version
126
- version: '0'
197
+ version: '2.1'
127
198
  required_rubygems_version: !ruby/object:Gem::Requirement
128
199
  requirements:
129
200
  - - ">="
@@ -131,8 +202,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
202
  version: '0'
132
203
  requirements: []
133
204
  rubyforge_project:
134
- rubygems_version: 2.2.5
205
+ rubygems_version: 2.7.9
135
206
  signing_key:
136
207
  specification_version: 4
137
208
  summary: Pageflow page types for linking to other pages.
138
- test_files: []
209
+ test_files:
210
+ - spec/integration/page_types_spec.rb
211
+ - spec/spec_helper.rb
212
+ - spec/support/config/factory_bot.rb