card 1.93.11 → 1.93.12

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: 24da04d2280fb8e76a07ae6be4cab46f37507f48
4
- data.tar.gz: 338e675444a36b74741beaf87fa704b2c60dad61
3
+ metadata.gz: 8e72652d9310645908db02675e5c91fb124101d7
4
+ data.tar.gz: 3af5b0c51954f0e16a2d445d1d9b51c845857dc6
5
5
  SHA512:
6
- metadata.gz: 057db396bec5424de6ad49ee8c99ada4d0d1132c7b9fc618009f43287dc3ca4550aa87e6d8e22fc20fbd7105a67d2c79c3af964f02125915e149d42bdbd1216d
7
- data.tar.gz: abc51603e41b426f0e504ef0338e223b4d35be495a0ff0d97b01785d9d49068547c639b29ffc3f88e983996b5d7ff3747426734f1951001e789dfa75609640e3
6
+ metadata.gz: 203c7f479d04d566c10e8d68b6bc35d8f5e058da6b8e23c52ac68fbee1a3d18c60a314ca444c63a14cfbc95a5d36e8328b8236c159a2cd642d7be52d874f7d9a
7
+ data.tar.gz: 91ed62e15d4870e8ad7a8edbaf560353038262f15d6692bfc75ba79c3301dbfd1494143a1172e52731cedecfa8d75fa1fb46a08428582977d774672dfe249302
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.11
1
+ 0.3.12
@@ -73,7 +73,7 @@ class Card
73
73
  when "" then ""
74
74
  when "*previous", :previous then :previous
75
75
  when %r{^(http|/)} then value
76
- when /^TEXT:\s*(.+)/ then Regexp.last_match(1)
76
+ when /^TEXT:\s*(.+)/ then Regexp.last_match(1)
77
77
  when /^REDIRECT:\s*(.+)/
78
78
  @redirect = true
79
79
  process_target Regexp.last_match(1)
@@ -40,7 +40,7 @@ format :html do
40
40
  def setup_hidden_fields
41
41
  hidden_tags(
42
42
  setup: true,
43
- success: "REDIRECT: #{Card.path_setting '/'}",
43
+ success: "REDIRECT: #{path mark: ''}",
44
44
  "card[type_id]" => Card.default_accounted_type_id
45
45
  )
46
46
  end
@@ -146,12 +146,6 @@ module ClassMethods
146
146
  end
147
147
  end
148
148
 
149
- def path_setting name # shouldn't this be in location helper?
150
- name ||= "/"
151
- return name if name =~ /^(http|mailto)/
152
- "#{Card.config.relative_url_root}#{name}"
153
- end
154
-
155
149
  def toggle val
156
150
  val.to_s.strip == "1"
157
151
  end
@@ -34,7 +34,7 @@ RSpec.describe Card::Format::HtmlFormat do
34
34
  is_expected.to have_tag "header" do
35
35
  with_tag 'a.nav-link.internal-link[href="/"]', text: "Home"
36
36
  with_tag 'a.nav-link.internal-link[href="/:recent"]', text: "Recent"
37
- with_tag 'form.navbox-form[action="/:search"]' do
37
+ with_tag 'form.navbox-form[action="/*search"]' do
38
38
  with_tag 'input[name="_keyword"]'
39
39
  end
40
40
  end
@@ -179,6 +179,10 @@ def item args={}
179
179
  item_names(args).first
180
180
  end
181
181
 
182
+ def count
183
+ all_raw_items.size
184
+ end
185
+
182
186
  def item_names args={}
183
187
  raw_items(args[:content], args[:limit], args[:offset]).map do |item|
184
188
  polish_item item, args[:context]
@@ -186,13 +190,16 @@ def item_names args={}
186
190
  end
187
191
 
188
192
  def raw_items content, limit, offset
189
- content ||= self.content
190
- items = content.to_s.split(/\n+/)
193
+ items = all_raw_items content
191
194
  limit = limit.to_i
192
195
  return items unless limit.positive?
193
196
  items[offset.to_i, limit] || []
194
197
  end
195
198
 
199
+ def all_raw_items content=nil
200
+ (content || self.content).to_s.split(/\n+/)
201
+ end
202
+
196
203
  def polish_item item, context
197
204
  item = strip_item(item).to_name
198
205
  return item if context == :raw
@@ -23,7 +23,7 @@ format :html do
23
23
  end
24
24
 
25
25
  view :core do
26
- form_tag Card.path_setting("/:search"),
26
+ form_tag path(mark: :search),
27
27
  method: "get", role: "search",
28
28
  class: classy("navbox-form", "nodblclick") do
29
29
  _render_raw
@@ -64,6 +64,6 @@ format :html do
64
64
  end
65
65
 
66
66
  def path_to_previous
67
- Card.path_setting "/*previous"
67
+ path mark: "*previous"
68
68
  end
69
69
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.93.11
4
+ version: 1.93.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-02-21 00:00:00.000000000 Z
14
+ date: 2018-03-01 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: cardname
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.3.11
22
+ version: 0.3.12
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.3.11
29
+ version: 0.3.12
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: haml
32
32
  requirement: !ruby/object:Gem::Requirement