hamloft 0.2.7 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/lib/hamloft/engine.rb +1 -1
- data/lib/hamloft/helpers.rb +8 -6
- data/lib/hamloft/version.rb +1 -1
- data/lib/hamloft.rb +3 -4
- metadata +2 -3
- data/lib/hamloft/widget.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8569026b061930afc52b6ab828d4d8148020ff87
|
4
|
+
data.tar.gz: 07a4764607bf3ecee70ad7dd7435bcdbc3b483dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8f309ab38a398063b273ff0097af269d5ca3c479e092e7f6663aa4cc8969a64583cb35817e04ce3e867cdae05a2cb5b9bd3e5f2264ccd7074c1ffc4ba2595d3
|
7
|
+
data.tar.gz: 60a36a85a83e142ab2ac07ffedd6dee280d82fb1a3ace22c5e7ab0cdcc44b273e9815d0760df54220fc1cb929f5e5974d3fe93af6ed6f224cea129ba7b2f4768
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hamloft (0.2
|
4
|
+
hamloft (2.0.2)
|
5
5
|
haml (~> 5.0)
|
6
6
|
nokogiri (~> 1.8)
|
7
7
|
|
@@ -11,7 +11,7 @@ GEM
|
|
11
11
|
ast (2.3.0)
|
12
12
|
coderay (1.1.1)
|
13
13
|
diff-lcs (1.3)
|
14
|
-
haml (5.0.
|
14
|
+
haml (5.0.2)
|
15
15
|
temple (>= 0.8.0)
|
16
16
|
tilt
|
17
17
|
method_source (0.8.2)
|
@@ -52,7 +52,7 @@ GEM
|
|
52
52
|
ruby-progressbar (1.8.1)
|
53
53
|
slop (3.6.0)
|
54
54
|
temple (0.8.0)
|
55
|
-
tilt (2.0.
|
55
|
+
tilt (2.0.8)
|
56
56
|
unicode-display_width (1.2.1)
|
57
57
|
|
58
58
|
PLATFORMS
|
@@ -65,4 +65,4 @@ DEPENDENCIES
|
|
65
65
|
rubocop (~> 0.49)
|
66
66
|
|
67
67
|
BUNDLED WITH
|
68
|
-
1.
|
68
|
+
1.15.1
|
data/lib/hamloft/engine.rb
CHANGED
data/lib/hamloft/helpers.rb
CHANGED
@@ -41,7 +41,10 @@ module Hamloft
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
def link(href, &block)
|
44
|
+
def link(href, referrer = 'Baker', &block)
|
45
|
+
if referrer && !referrer.empty? && !href.include?('referrer=')
|
46
|
+
href = "#{href}#{href.include?('?') ? '&' : '?'}referrer=#{referrer}"
|
47
|
+
end
|
45
48
|
haml_tag :a, href: href do
|
46
49
|
yield if block
|
47
50
|
end
|
@@ -72,11 +75,10 @@ module Hamloft
|
|
72
75
|
haml_tag :div, class: '_typeloft_widget_drop_container'
|
73
76
|
end
|
74
77
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
yield(widget) if block
|
78
|
+
def widget(identifier, options={}, &block)
|
79
|
+
widget = Hamloft.widgets[identifier].new(options, self)
|
80
|
+
haml_tag :widget, widget.widget_options do
|
81
|
+
widget.template(&block)
|
80
82
|
end
|
81
83
|
end
|
82
84
|
end
|
data/lib/hamloft/version.rb
CHANGED
data/lib/hamloft.rb
CHANGED
@@ -5,11 +5,10 @@ require 'hamloft/engine'
|
|
5
5
|
require 'hamloft/style_builder'
|
6
6
|
require 'hamloft/helpers'
|
7
7
|
require 'hamloft/template'
|
8
|
-
require 'hamloft/widget'
|
9
8
|
|
10
9
|
module Hamloft
|
11
10
|
@@_templates = {}
|
12
|
-
@@_widgets =
|
11
|
+
@@_widgets = {}
|
13
12
|
@@_block_resolver = nil
|
14
13
|
@@_asset_uri = nil
|
15
14
|
|
@@ -37,8 +36,8 @@ module Hamloft
|
|
37
36
|
@@_templates[key] = template
|
38
37
|
end
|
39
38
|
|
40
|
-
def self.register_widget(klass)
|
41
|
-
@@_widgets
|
39
|
+
def self.register_widget(identifier, klass)
|
40
|
+
@@_widgets[identifier] = klass
|
42
41
|
end
|
43
42
|
|
44
43
|
def self.widgets
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hamloft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Strebitzer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: haml
|
@@ -99,7 +99,6 @@ files:
|
|
99
99
|
- lib/hamloft/style_builder.rb
|
100
100
|
- lib/hamloft/template.rb
|
101
101
|
- lib/hamloft/version.rb
|
102
|
-
- lib/hamloft/widget.rb
|
103
102
|
- spec/fixtures/template/tumblr.rb
|
104
103
|
- spec/fixtures/test.haml
|
105
104
|
- spec/fixtures/widget/sample.rb
|
data/lib/hamloft/widget.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
module Hamloft
|
2
|
-
class Widget
|
3
|
-
include Hamloft::Helpers
|
4
|
-
attr_accessor :options
|
5
|
-
|
6
|
-
def identifier
|
7
|
-
'base'
|
8
|
-
end
|
9
|
-
|
10
|
-
def defaults
|
11
|
-
{}
|
12
|
-
end
|
13
|
-
|
14
|
-
def initialize(options)
|
15
|
-
@options = defaults.merge(options)
|
16
|
-
end
|
17
|
-
|
18
|
-
def typeloft_widget_options
|
19
|
-
attributes = {
|
20
|
-
:class => '_typeloft_widget',
|
21
|
-
:"data-widget-identifier" => identifier
|
22
|
-
}
|
23
|
-
@options.each do |k, v|
|
24
|
-
attributes["data-attribute-#{k}"] = v
|
25
|
-
end
|
26
|
-
attributes
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|