pagelet_rails 0.1.8 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97462c6b25fab3b82e8fe2bba67bb3016e55d24e
4
- data.tar.gz: 5ebaa4854e612096b42136b486fc4f7f1cdad17e
3
+ metadata.gz: d4e4d6d941dd7ae780bb1e934f157e092fa3a09c
4
+ data.tar.gz: 59f346de0c8ae0a2b8c909d6e15baad70fd73179
5
5
  SHA512:
6
- metadata.gz: a6ac654ef6e579b77207b9d492c030675f35f6f5d2ca2b1767d520b95702a337ae455d07202a14f41749b0ed4451f042edc2572657780accbce91e4778c33f0e
7
- data.tar.gz: 5cb1c8361d0f6223dde0b989b2dc43923144ac4c2bbd8abe7b1643631d3e144b79f5528b4b9dfae1f30d88242e7208518be42f959f3c0a70e4a0795b780f0055
6
+ metadata.gz: 5f834814d7a35ffe3e71079961fee5225fa51516a9c152565372d43924f8df8ea7b3cfc0e94320a4cd4d77801ba84202fad58fa0ec89dc778d9b0bb6de98e9be
7
+ data.tar.gz: 9ebfd6f85d0481e4878285f0d165d9207e29903b514dfcf4a0dd08a5355400657c414c5156b7c4222b412cd0ecf6bfaff7a23fd1bb1edd4ee771aa9c9ee03a6b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### 0.2.0
2
+
3
+ - Fixed bug when original html class is lost (#12)
4
+ - Simplified rendering, now it always renders outside div container
5
+ - New feature to trigger refresh of other pagelets on the page (`identified_by` and `trigger_change` methods)
6
+ - `redirect_to` inside pagelet does not affect the main page when redirect destination is also pagelet
7
+
1
8
  ### 0.1.8
2
9
 
3
10
  - Fix executable "rails" conflicts with railties (#11)
@@ -1,7 +1,7 @@
1
1
  module PageletsHelper
2
2
 
3
3
  def html_container_attributes
4
- html_opts = pagelet_options.html || {}
4
+ html_opts = pagelet_options.html.deep_dup || {}
5
5
  classes = html_opts.fetch(:class, '').split(' ')
6
6
  classes << "pagelet-#{controller_name}"
7
7
  classes << "pagelet-#{controller_name}-#{action_name}"
data/bin/rails ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails gems
3
+ # installed from the root of your application.
4
+
5
+ ENGINE_ROOT = File.expand_path('../..', __FILE__)
6
+ ENGINE_PATH = File.expand_path('../../lib/pagelet_rails/engine', __FILE__)
7
+
8
+ # Set up gems listed in the Gemfile.
9
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
10
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
11
+
12
+ require 'rails/all'
13
+ require 'rails/engine/commands'
@@ -60,7 +60,8 @@ module PageletRails::Concerns::Controller
60
60
  end
61
61
 
62
62
  def pagelet_encoded_original_options new_opts = {}
63
- encode_data = pagelet_options.original_options.to_h.except('remote').merge(new_opts)
63
+ encode_data = pagelet_options.original_options.to_h
64
+ .with_indifferent_access.except('remote').deep_merge(new_opts)
64
65
  PageletRails::Encryptor.encode(encode_data)
65
66
  end
66
67
 
@@ -84,9 +85,23 @@ module PageletRails::Concerns::Controller
84
85
  end
85
86
 
86
87
  def redirect_to *args
87
- options = args.extract_options!
88
- new_params = options.merge(original_pagelet_options: pagelet_encoded_original_options)
88
+ begin
89
+ redirect_url = url_for(*args)
90
+ path_opts = Rails.application.routes.recognize_path(redirect_url)
91
+ rescue ActionController::RoutingError
92
+ return super
93
+ end
94
+
95
+ controller_class = path_opts[:controller].camelize.concat('Controller').safe_constantize
96
+ is_pagelet = controller_class && controller_class.include?(PageletRails::Concerns::Controller)
97
+
98
+ if is_pagelet
99
+ options = args.extract_options!
100
+ new_params = options.merge(original_pagelet_options: pagelet_encoded_original_options)
89
101
 
90
- render plain: pagelet(url_for(*args, new_params))
102
+ render plain: pagelet(url_for(*args, new_params))
103
+ else
104
+ super
105
+ end
91
106
  end
92
107
  end
@@ -1,3 +1,3 @@
1
1
  module PageletRails
2
- VERSION = '0.1.8'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -26,6 +26,5 @@ Gem::Specification.new do |s|
26
26
 
27
27
  s.files = `git ls-files`.split("\n")
28
28
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
29
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
30
29
  s.require_paths = ['lib']
31
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagelet_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Katunin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-30 00:00:00.000000000 Z
11
+ date: 2017-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -165,6 +165,7 @@ files:
165
165
  - app/views/layouts/pagelet_rails/container.erb
166
166
  - app/views/layouts/pagelet_rails/inner.erb
167
167
  - app/views/layouts/pagelet_rails/loading_placeholder.erb
168
+ - bin/rails
168
169
  - config/routes.rb
169
170
  - gemfiles/rails_4.2.8.gemfile
170
171
  - gemfiles/rails_5.0.2.gemfile