dorsale 1.2.5 → 1.2.6

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: 8c1f2038601f77df85cfdb79bc7fac4f70d806d9
4
- data.tar.gz: 0a53b7d1bf65277155ef15d2023f2dd66f2fd3f1
3
+ metadata.gz: 2a025272aac91888fd99c7aaf70f50909b372604
4
+ data.tar.gz: e27a2fcfab1e0aa69eef0f547c2e8ad0ee2697a3
5
5
  SHA512:
6
- metadata.gz: 17b1000006e5f0345bf449cb9e868ad68637485517181ee600c73171cf01b5427a5bc07c81e880137993214e34dc55de9e9bc96257c7b4e93de4a521d2eceb28
7
- data.tar.gz: f27b3222afd2e44f04ec0e6d05a27067d142d83e96e11c380fa7dd334cb7b2ee4d6f218f6d255afed84da74ba3ff273fd212e4fd496c10050e6891f94d239b42
6
+ metadata.gz: f93af679b24e6064cefa516dc4689c0e227a3ef61621363ea0e66e13dfe4f974255a47972ceab1c4e125dcd606fbba97cc2496a2649a77d08260fd009f65d863
7
+ data.tar.gz: b5039a3754dbfdb3165936941cbd99c7b02f32d2ad2e59ab3a6fe70533abc5cc74f1d2c2b7785e6361eb71df402b35a1648dce4dae061d1681400a43d0656c17
@@ -7,6 +7,7 @@ module Dorsale
7
7
  include FormHelper
8
8
  include LinkHelper
9
9
  include PaginationHelper
10
+ include RoutesHelper
10
11
  include TextHelper
11
12
  end
12
13
  end
@@ -0,0 +1,20 @@
1
+ module Dorsale
2
+ module RoutesHelper
3
+ def engine_polymorphic_path(obj, opts = {})
4
+ if obj.class.parent == Object
5
+ routes = main_app
6
+ else
7
+ routes = obj.class.parent::Engine.routes
8
+ end
9
+
10
+ opts = {
11
+ :controller => obj.class.model_name.collection,
12
+ :action => :show,
13
+ :id => obj.to_param,
14
+ :only_path => true
15
+ }.merge(opts)
16
+
17
+ routes.url_for(opts)
18
+ end
19
+ end
20
+ end
@@ -1,11 +1,41 @@
1
1
  module Dorsale
2
2
  module TextHelper
3
3
  def euros(n)
4
- number_to_currency(n)
4
+ return if n.nil?
5
+
6
+ number(n) + " €"
5
7
  end
6
8
 
7
9
  def percentage(n)
8
- number_to_percentage(n, precision: 2, format: "%n %")
10
+ return if n.nil?
11
+
12
+ number(n) + " %"
13
+ end
14
+
15
+ def number(n)
16
+ return if n.nil?
17
+
18
+ opts = {}
19
+
20
+ if n.class.to_s.match(/Float|Decimal/i)
21
+ opts[:precision] = 2
22
+ else
23
+ opts[:precision] = 0
24
+ end
25
+
26
+ opts[:delimiter] = I18n.t("number.format.delimiter")
27
+ opts[:separator] = I18n.t("number.format.separator")
28
+
29
+ number_with_precision(n, opts)
30
+ end
31
+
32
+ def hours(n)
33
+ return if n.nil?
34
+
35
+ number = number_with_precision(n, precision: 2)
36
+ text = I18n.t("datetime.prompts.hour").downcase
37
+ text = text.pluralize if n > 1
38
+ "#{number} #{text}"
9
39
  end
10
40
 
11
41
  def text2html(str)
@@ -1,5 +1,6 @@
1
1
  fr:
2
2
  actions: &actions
3
+ actions : "Actions"
3
4
  index : "Liste"
4
5
  list : "Liste"
5
6
  new : "Nouveau"
@@ -44,7 +45,7 @@ fr:
44
45
  sign_up : "S'enregistrer"
45
46
  signup : "S'enregistrer"
46
47
 
47
- labels: &labels
48
+ attributes: &attributes
48
49
  id : "Id"
49
50
  code : "Code"
50
51
  reference : "Référence"
@@ -77,6 +78,11 @@ fr:
77
78
  country : "Pays"
78
79
  tags : "Tags"
79
80
  tag_list : "Tags"
81
+ budget : "Budget"
82
+ probability : "Probabilité"
83
+ access : "Accès"
84
+ color : "Couleur"
85
+ data : "Informations"
80
86
 
81
- attributes:
82
- <<: *labels
87
+ labels:
88
+ <<: *attributes
@@ -1,3 +1,3 @@
1
1
  module Dorsale
2
- VERSION = "1.2.5"
2
+ VERSION = "1.2.6"
3
3
  end
@@ -1,14 +1,21 @@
1
- ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
1
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
2
2
   (0.1ms) begin transaction
3
3
   (0.1ms) rollback transaction
4
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
5
4
   (0.1ms) begin transaction
5
+  (0.0ms) rollback transaction
6
+  (0.1ms) begin transaction
7
+  (0.0ms) rollback transaction
8
+  (0.0ms) begin transaction
9
+  (0.0ms) rollback transaction
10
+  (0.0ms) begin transaction
6
11
   (0.1ms) rollback transaction
7
12
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
8
13
   (0.1ms) begin transaction
9
14
   (0.1ms) rollback transaction
15
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
10
16
   (0.1ms) begin transaction
11
17
   (0.1ms) rollback transaction
18
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
12
19
   (0.1ms) begin transaction
13
20
   (0.1ms) rollback transaction
14
21
  ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
@@ -16,13 +23,22 @@
16
23
   (0.1ms) rollback transaction
17
24
   (0.1ms) begin transaction
18
25
   (0.1ms) rollback transaction
26
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
27
+  (0.1ms) begin transaction
28
+  (0.1ms) rollback transaction
29
+  (0.1ms) begin transaction
30
+  (0.1ms) rollback transaction
31
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
19
32
   (0.1ms) begin transaction
20
33
   (0.1ms) rollback transaction
21
- ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
34
+  (0.1ms) begin transaction
35
+  (0.1ms) rollback transaction
36
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
22
37
   (0.1ms) begin transaction
23
38
   (0.1ms) rollback transaction
24
39
   (0.1ms) begin transaction
25
40
   (0.1ms) rollback transaction
41
+ ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
26
42
   (0.1ms) begin transaction
27
43
   (0.1ms) rollback transaction
28
44
   (0.1ms) begin transaction
@@ -32,7 +48,7 @@
32
48
   (0.1ms) rollback transaction
33
49
   (0.1ms) begin transaction
34
50
   (0.1ms) rollback transaction
35
-  (0.0ms) begin transaction
51
+  (0.1ms) begin transaction
36
52
   (0.0ms) rollback transaction
37
53
   (0.1ms) begin transaction
38
54
   (0.0ms) rollback transaction
@@ -41,16 +57,61 @@
41
57
   (0.1ms) rollback transaction
42
58
   (0.1ms) begin transaction
43
59
   (0.1ms) rollback transaction
60
+  (0.0ms) begin transaction
61
+  (0.1ms) rollback transaction
62
+  (0.1ms) begin transaction
63
+  (0.1ms) rollback transaction
64
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
44
65
   (0.1ms) begin transaction
45
66
   (0.1ms) rollback transaction
46
67
   (0.1ms) begin transaction
68
+  (0.0ms) rollback transaction
69
+  (0.1ms) begin transaction
70
+  (0.0ms) rollback transaction
71
+  (0.1ms) begin transaction
47
72
   (0.1ms) rollback transaction
48
73
  ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
74
+  (0.2ms) begin transaction
75
+  (0.1ms) rollback transaction
76
+  (0.1ms) begin transaction
77
+  (0.1ms) rollback transaction
78
+  (0.1ms) begin transaction
79
+  (0.0ms) rollback transaction
80
+  (0.1ms) begin transaction
81
+  (0.0ms) rollback transaction
82
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
49
83
   (0.1ms) begin transaction
50
84
   (0.1ms) rollback transaction
51
85
   (0.1ms) begin transaction
52
86
   (0.1ms) rollback transaction
53
87
   (0.1ms) begin transaction
54
88
   (0.1ms) rollback transaction
55
-  (0.0ms) begin transaction
89
+  (0.1ms) begin transaction
90
+  (0.1ms) rollback transaction
91
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
92
+  (0.1ms) begin transaction
93
+  (0.1ms) rollback transaction
94
+  (0.1ms) begin transaction
95
+  (0.1ms) rollback transaction
96
+  (0.1ms) begin transaction
97
+  (0.0ms) rollback transaction
98
+  (0.1ms) begin transaction
99
+  (0.0ms) rollback transaction
100
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
101
+  (0.1ms) begin transaction
102
+  (0.1ms) rollback transaction
103
+  (0.1ms) begin transaction
104
+  (0.1ms) rollback transaction
105
+  (0.1ms) begin transaction
106
+  (0.1ms) rollback transaction
107
+  (0.1ms) begin transaction
108
+  (0.0ms) rollback transaction
109
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
110
+  (0.1ms) begin transaction
111
+  (0.1ms) rollback transaction
112
+  (0.1ms) begin transaction
113
+  (0.1ms) rollback transaction
114
+  (0.1ms) begin transaction
115
+  (0.0ms) rollback transaction
116
+  (0.1ms) begin transaction
56
117
   (0.1ms) rollback transaction
@@ -0,0 +1,32 @@
1
+ require 'rails_helper'
2
+
3
+ describe Dorsale::TextHelper, type: :helper do
4
+ it "hours" do
5
+ expect(hours(nil)).to be nil
6
+ expect(hours(1)).to eq "1.00 hour"
7
+ expect(hours(3)).to eq "3.00 hours"
8
+ expect(hours(3.5)).to eq "3.50 hours"
9
+ expect(hours(3.123)).to eq "3.12 hours"
10
+ end
11
+
12
+ it "number" do
13
+ expect(number(nil)).to be nil
14
+ expect(number(1)).to eq "1"
15
+ expect(number(1.2)).to eq "1.20"
16
+ expect(number(1.234)).to eq "1.23"
17
+ expect(number(123456.789)).to eq "123,456.79"
18
+ end
19
+
20
+ it "percentage" do
21
+ expect(percentage(nil)).to be nil
22
+ expect(percentage(1)).to eq "1 %"
23
+ expect(percentage(1.123)).to eq "1.12 %"
24
+ end
25
+
26
+ it "euros" do
27
+ expect(euros(nil)).to be nil
28
+ expect(euros(1)).to eq "1 €"
29
+ expect(euros(1.123)).to eq "1.12 €"
30
+ end
31
+
32
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dorsale
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - agilidée
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-04 00:00:00.000000000 Z
11
+ date: 2015-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -283,6 +283,7 @@ files:
283
283
  - app/helpers/dorsale/form_helper.rb
284
284
  - app/helpers/dorsale/link_helper.rb
285
285
  - app/helpers/dorsale/pagination_helper.rb
286
+ - app/helpers/dorsale/routes_helper.rb
286
287
  - app/helpers/dorsale/text_helper.rb
287
288
  - app/models/dorsale/address.rb
288
289
  - app/models/dorsale/comment.rb
@@ -345,6 +346,7 @@ files:
345
346
  - spec/dummy/public/favicon.ico
346
347
  - spec/factories/dorsale_addresses.rb
347
348
  - spec/helpers/dorsale/link_helper_spec.rb
349
+ - spec/helpers/dorsale/text_helper_spec.rb
348
350
  - spec/models/dorsale/address_spec.rb
349
351
  - spec/models/dorsale/small_data/filter_spec.rb
350
352
  - spec/rails_helper.rb
@@ -412,6 +414,7 @@ test_files:
412
414
  - spec/dummy/README.rdoc
413
415
  - spec/factories/dorsale_addresses.rb
414
416
  - spec/helpers/dorsale/link_helper_spec.rb
417
+ - spec/helpers/dorsale/text_helper_spec.rb
415
418
  - spec/models/dorsale/address_spec.rb
416
419
  - spec/models/dorsale/small_data/filter_spec.rb
417
420
  - spec/rails_helper.rb