agilibox 1.4.4 → 1.5.0

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: 50533c797c86ed5da13f6fedb3821923824cdc6d2c78d156b1aafc73be7c6c4d
4
- data.tar.gz: c49c84be7fd166ef80f7af8774a1fd4f355b52c1b69d2723dc40508c3e104481
3
+ metadata.gz: 78700a2b997a191955b808d5661084cc2b3f7f60099607bf687463a7586193b1
4
+ data.tar.gz: 8f89357d1b2f33e0e0f5bc618657c828b8116f137ddb4ca4836f1b662bee8fa0
5
5
  SHA512:
6
- metadata.gz: 5bc4a05da4197008f36a2be0cbbe2331cf8b258d4ee7705a4bc2a221d8059d65c9cefb7b308250e2adacfe418f80ad8da718760f64f46aea676e100126f1e29c
7
- data.tar.gz: 1819da40af2426f857d3093671b5d09fc15dfb57d6982301ed62e2b701e039b649bc98ccb8a8fd7b741a18d7793b2bb478d6208af1eb24a0fcc9f8da317b12a8
6
+ metadata.gz: 1d79b5cbe922710c8ab5ce660dded77721635ae703e941029f8273a25a06ce52b257ff7c5070f8ee84eef99a53fae638b6dc016d024235e9f96617c682f19b36
7
+ data.tar.gz: e584536c5140385a38521dd2e79ef89cdcd859d7704ee9e9ef8e5b313a00fb988edde5f27f99276751f09807312af6fd58f7e24c15a53168a9c4055212d9f01e
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Next version
4
4
 
5
+ ## 1.5.0
6
+ - Add `GetHTTP`
7
+ - Add BS4 search form
8
+
5
9
  ## 1.4.4
6
10
  - Fix i18n error on `info` helper
7
11
 
@@ -47,9 +47,7 @@ module Agilibox::FormHelper
47
47
  simple_form_for(obj, opts, &block)
48
48
  end
49
49
 
50
- def search_form(opts = {})
51
- action = opts.delete(:action) || request.fullpath
52
-
50
+ def search_form(action: request.fullpath)
53
51
  render "agilibox/search/form", action: action
54
52
  end
55
53
 
@@ -0,0 +1,44 @@
1
+ class Agilibox::GetHTTP < Agilibox::Service
2
+ class Error < StandardError
3
+ end
4
+
5
+ EXCEPTIONS_TO_RERAISE = [
6
+ Net::HTTPBadResponse,
7
+ Net::HTTPExceptions,
8
+ Net::HTTPHeaderSyntaxError,
9
+ OpenSSL::SSL::SSLError,
10
+ SocketError,
11
+ SystemCallError,
12
+ Timeout::Error,
13
+ Zlib::Error,
14
+ ]
15
+
16
+ TIMEOUT = 10
17
+
18
+ initialize_with :url
19
+
20
+ def uri
21
+ uri = URI(url.to_s)
22
+ raise Error, "invalid URI type : #{uri.class}" unless uri.is_a?(URI::HTTP)
23
+ uri
24
+ end
25
+
26
+ def call
27
+ response = Timeout.timeout(TIMEOUT) do
28
+ Net::HTTP.get_response(uri)
29
+ end
30
+
31
+ if response.code.start_with?("3")
32
+ @url = response["Location"]
33
+ return call
34
+ end
35
+
36
+ unless response.code.start_with?("2")
37
+ raise Error, "invalid response code : #{response.code}"
38
+ end
39
+
40
+ response.body
41
+ rescue *EXCEPTIONS_TO_RERAISE => e
42
+ raise Error, e.message
43
+ end
44
+ end
@@ -1,12 +1 @@
1
- form.search method="get" action=action
2
- = form_hidden_submit
3
-
4
- p.input-group.search
5
- input.form-control name="q" placeholder=t("actions.search") size=25 value=params[:q]
6
-
7
- span.input-group-btn
8
- button.btn.btn-default.search-reset.reset type="submit"
9
- = icon :times
10
-
11
- button.btn.btn-default.search-submit type="submit"
12
- = icon :search
1
+ = render "agilibox/search/form_bs#{Bootstrap::VERSION[0]}", action: action
@@ -0,0 +1,12 @@
1
+ form.search.bs3 method="get" action=action
2
+ = form_hidden_submit
3
+
4
+ p.input-group.search
5
+ input.form-control name="q" placeholder=t("actions.search") size=25 value=params[:q]
6
+
7
+ span.input-group-btn
8
+ button.btn.btn-default.search-reset.reset type="submit"
9
+ = icon :times
10
+
11
+ button.btn.btn-default.search-submit type="submit"
12
+ = icon :search
@@ -0,0 +1,8 @@
1
+ form.search.bs4 method="get" action=action
2
+ = form_hidden_submit
3
+
4
+ .input-group.search
5
+ input.form-control.form-control-sm type="text" name="q" placeholder=ta(:search) value=params[:q]
6
+ span.input-group-append
7
+ button.btn.btn-sm.bg-light.border.search-reset.reset type="submit" = icon(:times)
8
+ button.btn.btn-sm.bg-light.border.search-submit type="submit" = icon(:search)
@@ -1,3 +1,3 @@
1
1
  module Agilibox
2
- VERSION = "1.4.4"
2
+ VERSION = "1.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agilibox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - agilidée
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-21 00:00:00.000000000 Z
11
+ date: 2018-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails-i18n
@@ -112,6 +112,7 @@ files:
112
112
  - app/libs/agilibox/collection_update.rb
113
113
  - app/libs/agilibox/fcm/notifier.rb
114
114
  - app/libs/agilibox/fcm/request.rb
115
+ - app/libs/agilibox/get_http.rb
115
116
  - app/libs/agilibox/initialize_with.rb
116
117
  - app/libs/agilibox/mini_model_serializer/serialize.rb
117
118
  - app/libs/agilibox/mini_model_serializer/serializer.rb
@@ -142,6 +143,8 @@ files:
142
143
  - app/views/agilibox/_flash.html.slim
143
144
  - app/views/agilibox/forms/_checkboxes_dropdown.html.slim
144
145
  - app/views/agilibox/search/_form.html.slim
146
+ - app/views/agilibox/search/_form_bs3.html.slim
147
+ - app/views/agilibox/search/_form_bs4.html.slim
145
148
  - config/cucumber.yml
146
149
  - config/locales/actions.en.yml
147
150
  - config/locales/actions.fr.yml