tell-them 0.1.4 → 0.1.5

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: d1f23e7985e3b73b5aab87f0d45b9f1459551008
4
- data.tar.gz: 0c9781a5e4c6e7720c0665b5582734a3c0677440
3
+ metadata.gz: 679acfc9d82e7f1b84cfcb32ac4295071eaf59f9
4
+ data.tar.gz: ade7409a005ffe812d99510b47f8dc82ff9a8f92
5
5
  SHA512:
6
- metadata.gz: b991a719cd39001de1a223d832cf01859844b2d1e06fb27f8dc792a6ccb584d20c2f2c5161a6f35669488b3665ca5760c84241f39801fc0c8b54b77b27e07d43
7
- data.tar.gz: 777342e721c7dfca930175b60e57a2d2da99993b1e1830cdd2a30855a9cebd1f5ccd80be5a04a54c00b05aad0c97bd2834f47fed022820614a54e914972b0b1d
6
+ metadata.gz: 3b30931910b234438dd180adca8bf8d543dc62a2953982308d273bbb0d794a4c702cce546f2b409d1e6bf2dea082124ae39a4fc5a15e274859b426ddd8135f14
7
+ data.tar.gz: 5b7aebdfb26e32b54bc41a097fb015f6b42ab859f91a51379906247bedc854ed8c70dcf24f3856475e36685dee437a901df4705d47f72aa158664da6716158b7
@@ -63,6 +63,7 @@ $pad: 2%
63
63
  width: 50%
64
64
  height: 50%
65
65
  border: 1px solid black
66
+ margin: 0 0
66
67
  padding: 0 0
67
68
  background-color: white
68
69
  cursor: pointer
@@ -97,7 +98,7 @@ $pad: 2%
97
98
  border-radius: 1em
98
99
  padding: $pad
99
100
  background-color: white
100
- .list-item
101
+ .list-header
101
102
  font-weight: bold
102
103
  &:hover, &.pinned
103
104
  cursor: default
@@ -1,4 +1,11 @@
1
1
  module TellThem
2
+
3
+ MAX_URL_DISPLAY_LENGTH = 60
4
+
5
+ def self.reset
6
+ TellThemStore.instance
7
+ end
8
+
2
9
  def self.add(data)
3
10
  TellThemStore.instance.add(data)
4
11
  end
@@ -30,14 +37,14 @@ module TellThem
30
37
  box += ' </div>'
31
38
  box += ' <button class="pin">Pin</button>'
32
39
  box += ' </div>'
33
- box += ' <dl class="items">'
40
+ box += ' <dl class="list">'
34
41
  data.each do |k,v|
35
- box += " <dt>#{k}</dt>"
42
+ box += " <dt class=\"list-header\">#{k}</dt>"
36
43
  begin
37
44
  URI::parse(v)
38
- box += " <dd><a href=\"#{v}\">#{v}</a></dd>"
45
+ box += " <dd class=\"list-value\"><a href=\"#{v}\">#{shorten(v)}</a></dd>"
39
46
  rescue URI::InvalidURIError
40
- box += " <dd>#{v}</dd>"
47
+ box += " <dd class=\"list-header\">#{v}</dd>"
41
48
  end
42
49
  end
43
50
  box += ' </dl>'
@@ -46,10 +53,20 @@ module TellThem
46
53
  box
47
54
  end
48
55
 
56
+ def shorten(value)
57
+ if value.length > MAX_URL_DISPLAY_LENGTH
58
+ value[0..MAX_URL_DISPLAY_LENGTH] + "..."
59
+ end
60
+ end
61
+
49
62
  class TellThemStore
50
63
  include Singleton
51
64
 
52
65
  def initialize
66
+ reset
67
+ end
68
+
69
+ def reset
53
70
  @data_store = {}
54
71
  end
55
72
 
@@ -1,5 +1,5 @@
1
1
  module TellThem
2
2
  module Rails
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tell-them
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - K M Lawrence