rabbet 0.0.1 → 0.0.3

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
  SHA256:
3
- metadata.gz: 554748439b9cc1915c38da2308c8913a3a8b2d405f6024bef1b0ccfb0d8ce21b
4
- data.tar.gz: 5247052f1cca4fc305a40b8ff89525c43a060caab83b58fe478768c99aa79643
3
+ metadata.gz: 79aa8c3ed6f45d0b3260c1207bc8755596fe8590732a0cbe18fe54e7e169f661
4
+ data.tar.gz: e7cb567498a596937e8e28aeaeac645c6e0d63e26f2588c38d2df9e482cccdab
5
5
  SHA512:
6
- metadata.gz: e9983583657ec3404263bad5d5f6b18ad093af20132b58fda8a1314849542c6be39eb9a839d64896df91e1dcc0e522a6087cd8ee9c99868d148bba7e5a36d9f5
7
- data.tar.gz: 00ef5251bf38bfef75d8cc3d98540bf939c2ade61f7b80b065090b470929a3c98e80ab4f7b31c9fe1edefd94d5ec7b97d03be5926620de0d285d28fd0ec94d2f
6
+ metadata.gz: 0f906478f205c7189349542d2b29fa9c144b45deda53a2bb0bc655c2840103f041fa9f718b5b03db8f50568af02c7cfd1061c7af00b04d338d22f8dbe35bb6fe
7
+ data.tar.gz: 2827cd61b4a4627e98346ccaa3a7c5d62d45da1cae9d7cc57c2c49035b5c767b730250abc9729aee0358708dda941c1ac78d6a096dfa65629acbb758fd081c17
data/Rakefile CHANGED
@@ -1,8 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
3
+ require "bundler/gem_tasks"
5
4
 
5
+ require "rspec/core/rake_task"
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
- task default: :spec
8
+ require "rubocop/rake_task"
9
+ RuboCop::RakeTask.new(:rubocop)
10
+
11
+ task default: %i[rubocop spec]
@@ -12,7 +12,13 @@ body {
12
12
  align-items: center;
13
13
 
14
14
  &-left, &-center, &-right {
15
- width: 33.3%;
15
+ display: flex;
16
+ flex-basis: 33.3%;
17
+ position: static;
18
+ padding: 12px;
19
+ color: #FFFFFF;
20
+ margin: 2px;
21
+ align-items: center;
16
22
  }
17
23
 
18
24
  &-left {
@@ -34,12 +40,4 @@ body {
34
40
  .muted {
35
41
  display: none;
36
42
  }
37
-
38
- & * {
39
- max-height: 50px;
40
- color: #FFFFFF;
41
- display: flex;
42
- margin: 2px;
43
- align-items: center;
44
- }
45
43
  }
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rabbet
4
+ module Views
5
+ # View helpers -- currently used to help facilitate view injection
6
+ module Helpers
7
+ # Execute all registered view content injectors passing
8
+ # a context hash with information that is currently provided
9
+ # by the UIState#current_user.
10
+ #
11
+ # @param [Hash] context a hash with useful information that can be accessed by injectors.
12
+ #
13
+ def apply_injected_content(context:)
14
+ Rabbet::Views.injectors.each do |section, injector|
15
+ next if injector_is_nil?(section, injector)
16
+
17
+ view_context = instance_exec(context, &injector)
18
+
19
+ next if view_context.nil?
20
+
21
+ # Avoid duplicate injector payloads
22
+ next if content_for?(section) && @view_flow.get(section).include?(view_context)
23
+
24
+ # Evaluates the content generator block within
25
+ # the current view's context
26
+ content_for section, view_context
27
+ end
28
+ end
29
+
30
+ def injector_is_nil?(section, injector)
31
+ section.nil? || injector.nil?
32
+ end
33
+ end
34
+ end
35
+ end
data/docs/README.md CHANGED
@@ -30,6 +30,15 @@ require "rabbet"
30
30
  @import "rabbet";
31
31
  ```
32
32
 
33
+ 1. Include the view helpers to help with injection
34
+
35
+ ```ruby
36
+ # application_helper.rb
37
+
38
+ include Rabbet::Views::Helpers
39
+
40
+ ```
41
+
33
42
  ## Usage 🐇
34
43
 
35
44
  You can find a list of available pieces in [app/views/rabbet](https://github.com/powerhome/power-tools/blob/main/packages/rabbet/app/views/rabbet/). If, for example, you'd like to add the topbar to your application, you can view the injectible pieces in [that specific file](https://github.com/powerhome/power-tools/blob/main/packages/rabbet/app/views/rabbet/_topbar.html.erb). In topbar, pieces that are injectible include:
data/lib/rabbet/engine.rb CHANGED
@@ -1,6 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "sassc-rails"
2
4
 
3
5
  module Rabbet
6
+ # Define engine
4
7
  class Engine < ::Rails::Engine
5
8
  isolate_namespace Rabbet
6
9
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rabbet
4
- VERSION = '0.0.1'
4
+ VERSION = "0.0.3"
5
5
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rabbet
4
+ # View injection
5
+ module Views
6
+ class << self
7
+ def inject(section: :head, &block)
8
+ injectors << [section, block]
9
+ end
10
+
11
+ def injectors
12
+ @injectors ||= []
13
+ end
14
+ end
15
+ end
16
+ end
data/lib/rabbet.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "rabbet/engine"
4
+ require "rabbet/views"
4
5
 
6
+ # A ruby-based visual application layout
5
7
  module Rabbet
6
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Palhares
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-12-19 00:00:00.000000000 Z
12
+ date: 2023-01-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cygnet
@@ -219,15 +219,18 @@ files:
219
219
  - Rakefile
220
220
  - app/assets/stylesheets/rabbet.scss
221
221
  - app/assets/stylesheets/rabbet/_topbar.scss
222
+ - app/helpers/rabbet/views/helpers.rb
222
223
  - app/views/rabbet/_topbar.html.erb
223
224
  - docs/README.md
224
225
  - lib/rabbet.rb
225
226
  - lib/rabbet/engine.rb
226
227
  - lib/rabbet/version.rb
228
+ - lib/rabbet/views.rb
227
229
  homepage: https://github.com/powerhome/power-tools
228
230
  licenses:
229
231
  - MIT
230
- metadata: {}
232
+ metadata:
233
+ rubygems_mfa_required: 'true'
231
234
  post_install_message:
232
235
  rdoc_options: []
233
236
  require_paths:
@@ -243,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
246
  - !ruby/object:Gem::Version
244
247
  version: '0'
245
248
  requirements: []
246
- rubygems_version: 3.3.26
249
+ rubygems_version: 3.4.1
247
250
  signing_key:
248
251
  specification_version: 4
249
252
  summary: A ruby-based visual application layout