blocks 3.0.0.rc4 → 3.0.0.rc5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -2
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +3 -0
  5. data/CHANGELOG.rdoc +7 -0
  6. data/Gemfile +10 -3
  7. data/README.md +25 -9
  8. data/_config.yml +20 -0
  9. data/bin/deploy_docs +2 -0
  10. data/docs/.gitignore +4 -0
  11. data/docs/404.html +23 -0
  12. data/docs/_includes/acknowledgements.md +13 -0
  13. data/docs/_includes/caller-id.md +3 -0
  14. data/docs/_includes/configuration.md +3 -0
  15. data/docs/_includes/custom-builders.md +3 -0
  16. data/docs/_includes/defining.md +615 -0
  17. data/docs/_includes/demos/hooks-and-wrappers-output.html +109 -0
  18. data/docs/_includes/hooks.md +1156 -0
  19. data/docs/_includes/installation.md +25 -0
  20. data/docs/_includes/introduction.md +18 -0
  21. data/docs/_includes/option-merging.md +5 -0
  22. data/docs/_includes/rendering.md +622 -0
  23. data/docs/_includes/reserved-keywords.md +59 -0
  24. data/docs/_includes/skipping.md +403 -0
  25. data/docs/_includes/slate/assets.html +34 -0
  26. data/docs/_includes/slate/language-tabs.html +11 -0
  27. data/docs/_includes/templating.md +48 -0
  28. data/docs/_includes/templating/bootstrap_4_cards.md +753 -0
  29. data/docs/_includes/use-cases.md +23 -0
  30. data/docs/_includes/wip.md +34 -0
  31. data/docs/_includes/wrappers.md +629 -0
  32. data/docs/_layouts/slate.html +75 -0
  33. data/docs/_plugins/gem_version.rb +11 -0
  34. data/docs/_plugins/highlight_with_div.rb +25 -0
  35. data/docs/_sass/_default_styling.scss +627 -0
  36. data/docs/_sass/_icon-font.scss +26 -0
  37. data/docs/_sass/_normalize.scss +427 -0
  38. data/docs/_sass/_styling_overrides.scss +31 -0
  39. data/docs/_sass/_syntax.scss +78 -0
  40. data/docs/_sass/_variable_overrides.scss +10 -0
  41. data/docs/_sass/_variables.scss +105 -0
  42. data/docs/assets/javascripts/script.js +18 -0
  43. data/docs/assets/stylesheets/formChanges.less +106 -0
  44. data/docs/assets/stylesheets/style.css +46 -0
  45. data/docs/fonts/slate.eot +0 -0
  46. data/docs/fonts/slate.svg +14 -0
  47. data/docs/fonts/slate.ttf +0 -0
  48. data/docs/fonts/slate.woff +0 -0
  49. data/docs/fonts/slate.woff2 +0 -0
  50. data/docs/hooks.html +149 -0
  51. data/docs/hooks_and_wrappers_demo.html +313 -0
  52. data/docs/images/favicon.ico +0 -0
  53. data/docs/images/logo.png +0 -0
  54. data/docs/images/navbar.png +0 -0
  55. data/docs/images/placeholder.jpg +0 -0
  56. data/docs/images/render_strategies.png +0 -0
  57. data/docs/images/templating.png +0 -0
  58. data/docs/index.md +32 -0
  59. data/docs/javascripts/all.js +4 -0
  60. data/docs/javascripts/all_nosearch.js +3 -0
  61. data/docs/javascripts/app/lang.js +166 -0
  62. data/docs/javascripts/app/search.js +75 -0
  63. data/docs/javascripts/app/toc.js +57 -0
  64. data/docs/javascripts/demos/hooks_and_wrappers.js +9 -0
  65. data/docs/javascripts/lib/energize.js +169 -0
  66. data/docs/javascripts/lib/imagesloaded.min.js +7 -0
  67. data/docs/javascripts/lib/jquery.highlight.js +108 -0
  68. data/docs/javascripts/lib/jquery.js +9831 -0
  69. data/docs/javascripts/lib/jquery.tocify.js +1042 -0
  70. data/docs/javascripts/lib/jquery_ui.js +566 -0
  71. data/docs/javascripts/lib/lunr.js +1910 -0
  72. data/docs/stylesheets/demos/hooks_and_wrappers.scss +32 -0
  73. data/docs/stylesheets/print.scss +150 -0
  74. data/docs/stylesheets/screen.scss +10 -0
  75. data/lib/blocks/action_view_extensions/view_extensions.rb +1 -0
  76. data/lib/blocks/renderers/renderer.rb +1 -0
  77. data/lib/blocks/renderers/runtime_context.rb +30 -17
  78. data/lib/blocks/utilities/hash_with_render_strategy.rb +3 -0
  79. data/lib/blocks/version.rb +1 -1
  80. metadata +70 -2
@@ -0,0 +1,32 @@
1
+ ---
2
+ ---
3
+
4
+ .bg-primary, .bg-warning, .bg-info, .bg-success, .bg-danger {
5
+ border: 3px solid black;
6
+ margin: 10px;
7
+ padding: 5px;
8
+ font-size: 14px !important;
9
+ line-height: 20px !important;
10
+ }
11
+
12
+ #blocks div:not(.bg-primary, .bg-warning, .bg-info, .bg-success, .bg-danger, #actual_block) {
13
+ margin: 0;
14
+ padding: 0;
15
+ border: 0;
16
+ font-size: 0;
17
+ line-height: 0;
18
+ }
19
+
20
+ #blocks div:not(#actual_block) {
21
+ font-size: 0;
22
+ /*border: 0;*/
23
+ /*margin: 0;*/
24
+ /*padding: 0;*/
25
+ /*background-color: white;*/
26
+ /*line-height: 0;*/
27
+ }
28
+
29
+ #actual_block {
30
+ font-size: 14px;
31
+ /*background-color: inherit;*/
32
+ }
@@ -0,0 +1,150 @@
1
+ ---
2
+ ---
3
+ @charset "utf-8";
4
+ @import 'normalize';
5
+ @import 'variables';
6
+ @import 'icon-font';
7
+ @import 'syntax';
8
+
9
+ /*
10
+ Copyright 2008-2013 Concur Technologies, Inc.
11
+
12
+ Licensed under the Apache License, Version 2.0 (the "License"); you may
13
+ not use this file except in compliance with the License. You may obtain
14
+ a copy of the License at
15
+
16
+ http://www.apache.org/licenses/LICENSE-2.0
17
+
18
+ Unless required by applicable law or agreed to in writing, software
19
+ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
20
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
21
+ License for the specific language governing permissions and limitations
22
+ under the License.
23
+ */
24
+
25
+ $print-color: #999;
26
+ $print-color-light: #ccc;
27
+ $print-font-size: 12px;
28
+
29
+ body {
30
+ @extend %default-font;
31
+ }
32
+
33
+ .tocify, .toc-footer, .lang-selector, .search, #nav-button {
34
+ display: none;
35
+ }
36
+
37
+ .tocify-wrapper>img {
38
+ margin: 0 auto;
39
+ display: block;
40
+ }
41
+
42
+ .content {
43
+ font-size: 12px;
44
+
45
+ pre, code {
46
+ @extend %code-font;
47
+ @extend %break-words;
48
+ border: 1px solid $print-color;
49
+ border-radius: 5px;
50
+ font-size: 0.8em;
51
+ }
52
+
53
+ pre {
54
+ code {
55
+ border: 0;
56
+ }
57
+ }
58
+
59
+ pre {
60
+ padding: 1.3em;
61
+ }
62
+
63
+ code {
64
+ padding: 0.2em;
65
+ }
66
+
67
+ table {
68
+ border: 1px solid $print-color;
69
+ tr {
70
+ border-bottom: 1px solid $print-color;
71
+ }
72
+ td,th {
73
+ padding: 0.7em;
74
+ }
75
+ }
76
+
77
+ p {
78
+ line-height: 1.5;
79
+ }
80
+
81
+ a {
82
+ text-decoration: none;
83
+ color: #000;
84
+ }
85
+
86
+ h1 {
87
+ @extend %header-font;
88
+ font-size: 2.5em;
89
+ padding-top: 0.5em;
90
+ padding-bottom: 0.5em;
91
+ margin-top: 1em;
92
+ margin-bottom: $h1-margin-bottom;
93
+ border: 2px solid $print-color-light;
94
+ border-width: 2px 0;
95
+ text-align: center;
96
+ }
97
+
98
+ h2 {
99
+ @extend %header-font;
100
+ font-size: 1.8em;
101
+ margin-top: 2em;
102
+ border-top: 2px solid $print-color-light;
103
+ padding-top: 0.8em;
104
+ }
105
+
106
+ h1+h2, h1+div+h2 {
107
+ border-top: none;
108
+ padding-top: 0;
109
+ margin-top: 0;
110
+ }
111
+
112
+ h3, h4 {
113
+ @extend %header-font;
114
+ font-size: 0.8em;
115
+ margin-top: 1.5em;
116
+ margin-bottom: 0.8em;
117
+ text-transform: uppercase;
118
+ }
119
+
120
+ h5, h6 {
121
+ text-transform: uppercase;
122
+ }
123
+
124
+ aside {
125
+ padding: 1em;
126
+ border: 1px solid $print-color-light;
127
+ border-radius: 5px;
128
+ margin-top: 1.5em;
129
+ margin-bottom: 1.5em;
130
+ line-height: 1.6;
131
+ }
132
+
133
+ aside:before {
134
+ vertical-align: middle;
135
+ padding-right: 0.5em;
136
+ font-size: 14px;
137
+ }
138
+
139
+ aside.notice:before {
140
+ @extend %icon-info-sign;
141
+ }
142
+
143
+ aside.warning:before {
144
+ @extend %icon-exclamation-sign;
145
+ }
146
+
147
+ aside.success:before {
148
+ @extend %icon-ok-sign;
149
+ }
150
+ }
@@ -0,0 +1,10 @@
1
+ ---
2
+ ---
3
+ @charset "utf-8";
4
+ @import '../_sass/normalize';
5
+ @import '../_sass/variable_overrides';
6
+ @import '../_sass/variables';
7
+ @import '../_sass/icon-font';
8
+ @import '../_sass/syntax';
9
+ @import '../_sass/default_styling';
10
+ @import '../_sass/styling_overrides';
@@ -14,6 +14,7 @@ module Blocks
14
14
  # builder = builder.clone
15
15
  # TODO: figure out what to do here
16
16
  else
17
+ # TODO: options shouldn't have to be passed both here and to the render_with_overrides call below - need it to be just one place
17
18
  builder = Blocks.builder_class.new(self, options)
18
19
  end
19
20
  builder.render_with_overrides(options.merge(partial: partial), &block)
@@ -12,6 +12,7 @@ module Blocks
12
12
  options = args.extract_options!
13
13
  name = args.first
14
14
  if name.is_a?(Symbol) || name.is_a?(String)
15
+ # TODO: block needs to be handled differently so as to provide overrides
15
16
  block_with_hooks_renderer.render(*args, options, &block)
16
17
  elsif options[:partial]
17
18
  partial_renderer.render(options.delete(:partial), options, &block)
@@ -17,8 +17,7 @@ module Blocks
17
17
  :render_options_set,
18
18
  :block_options_set,
19
19
  :proxy_options_set,
20
- :parent_options_set,
21
- :merged_options_set
20
+ :parent_runtime_context
22
21
 
23
22
  delegate :skip_content, :skip_completely, to: :block_options_set, allow_nil: true
24
23
 
@@ -38,16 +37,20 @@ module Blocks
38
37
  self.runtime_block = runtime_block
39
38
  self.proxy_options_set = OptionsSet.new("Proxy Options Set")
40
39
 
41
- convert_render_options(runtime_args.extract_options!)
42
- identify_block(runtime_args.shift)
40
+ render_options = runtime_args.extract_options!
41
+ block_name = runtime_args.shift
42
+
43
+ convert_render_options(render_options)
44
+ identify_block(block_name)
43
45
 
44
46
  self.runtime_args = runtime_args
45
47
  merge_options_and_identify_render_item
46
48
  extract_control_options
47
49
  end
48
50
 
51
+ # TODO: this method needs to clone without context, i.e. with render_strategy, item, etc
49
52
  def extend_to_block_definition(block_definition)
50
- RuntimeContext.new(builder, block_definition, parent_options_set: merged_options_set.clone).tap do |rc|
53
+ RuntimeContext.new(builder, block_definition, parent_runtime_context: self).tap do |rc|
51
54
  rc.runtime_args = self.runtime_args
52
55
  end
53
56
  end
@@ -88,7 +91,7 @@ module Blocks
88
91
  if !render_options.is_a?(HashWithIndifferentAccess)
89
92
  render_options = render_options.with_indifferent_access
90
93
  end
91
- self.parent_options_set = render_options.delete(:parent_options_set)
94
+ self.parent_runtime_context = render_options.delete(:parent_runtime_context)
92
95
  self.render_options_set = OptionsSet.new(
93
96
  "Render Options",
94
97
  defaults: render_options.delete(:defaults),
@@ -133,14 +136,27 @@ module Blocks
133
136
 
134
137
  def merge_options_and_identify_render_item
135
138
  determined_render_item = false
136
- all_options_sets = [
137
- render_options_set,
138
- block_options_set,
139
- OptionsSet.new("Runtime Block", block: self.runtime_block),
140
- builder_options_set,
141
- Blocks.global_options_set,
142
- parent_options_set
143
- ].compact
139
+ all_options_sets = if parent_runtime_context
140
+ [
141
+ parent_runtime_context.render_options_set.clone,
142
+ block_options_set,
143
+ parent_runtime_context.block_options_set.clone,
144
+ # TODO: figure out how to deal with these - they don't technically belong here
145
+ parent_runtime_context.proxy_options_set.clone,
146
+ builder_options_set,
147
+ Blocks.global_options_set
148
+ ].compact
149
+ else
150
+ [
151
+ render_options_set,
152
+ block_options_set,
153
+ # TODO: consider having the runtime_block be merged into the
154
+ # default render options set
155
+ OptionsSet.new("Runtime Block", block: self.runtime_block),
156
+ builder_options_set,
157
+ Blocks.global_options_set
158
+ ].compact
159
+ end
144
160
 
145
161
  options_set_with_render_strategy_index = nil
146
162
  all_options_sets.
@@ -159,16 +175,13 @@ module Blocks
159
175
  self.render_item = add_proxy_options render_item
160
176
  end
161
177
 
162
- self.merged_options_set = OptionsSet.new("Parent Options Set")
163
178
  [:runtime_options, :standard_options, :default_options].each do |option_level|
164
179
  all_options_sets.each_with_index do |options_set, index|
165
180
  options_for_level = options_set.send(option_level)
166
- merged_options_set.send(option_level).add_options(options_for_level)
167
181
  add_options options_for_level
168
182
 
169
183
  if index == options_set_with_render_strategy_index
170
184
  options_for_level = proxy_options_set.send(option_level)
171
- merged_options_set.send(option_level).add_options(options_for_level)
172
185
  add_options options_for_level
173
186
  end
174
187
  end
@@ -23,6 +23,9 @@ module Blocks
23
23
  self.clone.tap {|cloned| cloned.add_options(options) }
24
24
  end
25
25
 
26
+ # TODO: need to implement either merge or update to update
27
+ # both the hash and the callers hash
28
+
26
29
  def add_options(*args, &block)
27
30
  options = args.extract_options!
28
31
  if !options.is_a?(HashWithIndifferentAccess)
@@ -1,3 +1,3 @@
1
1
  module Blocks
2
- VERSION = "3.0.0.rc4"
2
+ VERSION = "3.0.0.rc5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blocks
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.rc4
4
+ version: 3.0.0.rc5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Hunter
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-03 00:00:00.000000000 Z
11
+ date: 2017-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: call_with_params
@@ -61,6 +61,7 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - ".gitignore"
63
63
  - ".rspec"
64
+ - ".ruby-version"
64
65
  - ".travis.yml"
65
66
  - CHANGELOG.rdoc
66
67
  - Gemfile
@@ -68,9 +69,76 @@ files:
68
69
  - LICENSE.txt
69
70
  - README.md
70
71
  - Rakefile
72
+ - _config.yml
71
73
  - bin/console
74
+ - bin/deploy_docs
72
75
  - bin/setup
73
76
  - blocks.gemspec
77
+ - docs/.gitignore
78
+ - docs/404.html
79
+ - docs/_includes/acknowledgements.md
80
+ - docs/_includes/caller-id.md
81
+ - docs/_includes/configuration.md
82
+ - docs/_includes/custom-builders.md
83
+ - docs/_includes/defining.md
84
+ - docs/_includes/demos/hooks-and-wrappers-output.html
85
+ - docs/_includes/hooks.md
86
+ - docs/_includes/installation.md
87
+ - docs/_includes/introduction.md
88
+ - docs/_includes/option-merging.md
89
+ - docs/_includes/rendering.md
90
+ - docs/_includes/reserved-keywords.md
91
+ - docs/_includes/skipping.md
92
+ - docs/_includes/slate/assets.html
93
+ - docs/_includes/slate/language-tabs.html
94
+ - docs/_includes/templating.md
95
+ - docs/_includes/templating/bootstrap_4_cards.md
96
+ - docs/_includes/use-cases.md
97
+ - docs/_includes/wip.md
98
+ - docs/_includes/wrappers.md
99
+ - docs/_layouts/slate.html
100
+ - docs/_plugins/gem_version.rb
101
+ - docs/_plugins/highlight_with_div.rb
102
+ - docs/_sass/_default_styling.scss
103
+ - docs/_sass/_icon-font.scss
104
+ - docs/_sass/_normalize.scss
105
+ - docs/_sass/_styling_overrides.scss
106
+ - docs/_sass/_syntax.scss
107
+ - docs/_sass/_variable_overrides.scss
108
+ - docs/_sass/_variables.scss
109
+ - docs/assets/javascripts/script.js
110
+ - docs/assets/stylesheets/formChanges.less
111
+ - docs/assets/stylesheets/style.css
112
+ - docs/fonts/slate.eot
113
+ - docs/fonts/slate.svg
114
+ - docs/fonts/slate.ttf
115
+ - docs/fonts/slate.woff
116
+ - docs/fonts/slate.woff2
117
+ - docs/hooks.html
118
+ - docs/hooks_and_wrappers_demo.html
119
+ - docs/images/favicon.ico
120
+ - docs/images/logo.png
121
+ - docs/images/navbar.png
122
+ - docs/images/placeholder.jpg
123
+ - docs/images/render_strategies.png
124
+ - docs/images/templating.png
125
+ - docs/index.md
126
+ - docs/javascripts/all.js
127
+ - docs/javascripts/all_nosearch.js
128
+ - docs/javascripts/app/lang.js
129
+ - docs/javascripts/app/search.js
130
+ - docs/javascripts/app/toc.js
131
+ - docs/javascripts/demos/hooks_and_wrappers.js
132
+ - docs/javascripts/lib/energize.js
133
+ - docs/javascripts/lib/imagesloaded.min.js
134
+ - docs/javascripts/lib/jquery.highlight.js
135
+ - docs/javascripts/lib/jquery.js
136
+ - docs/javascripts/lib/jquery.tocify.js
137
+ - docs/javascripts/lib/jquery_ui.js
138
+ - docs/javascripts/lib/lunr.js
139
+ - docs/stylesheets/demos/hooks_and_wrappers.scss
140
+ - docs/stylesheets/print.scss
141
+ - docs/stylesheets/screen.scss
74
142
  - gemfiles/Gemfile.rails-3-0-stable
75
143
  - gemfiles/Gemfile.rails-3-1-stable
76
144
  - gemfiles/Gemfile.rails-3-2-stable