ui_bibz 2.0.0.alpha6 → 2.0.0.alpha7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48834e340f99c3833605fac9c56239478bb7fd7d
4
- data.tar.gz: a07e1f0f7e530f3e38d03482610a0c5b88a7d909
3
+ metadata.gz: 9892158649dce637c38ca278b77b54e985e8987b
4
+ data.tar.gz: 10c26c09a4b67c10536e278c090d19fcdcdd5159
5
5
  SHA512:
6
- metadata.gz: 41e634c09f2eae61ea7bd6b48f6d4a890ba64a82ed603fa827feb0a9231658ae037858f021d65728ae2cd741975129be98d1e0b435b4f6078c84b85bcd195e0e
7
- data.tar.gz: 5406607b5d8a25948ce186f8854780fdb1b8f023cf25040e82dffef4f075bb73e29dfdc6c0f47642d05b3c850719fe9d38f234f816875c2505c76ac506de475f
6
+ metadata.gz: 8d621fcfe794989895cc5d9bb25973162ad74eee6f55a8800eff197ef387d53f1ab2fb10d7452d42008859cdce642aaf076f2ae31882fdf4c190cb5de46245aa
7
+ data.tar.gz: 34a4451f9708d3b8d877f21a5941ac4bbaf112a455feb4b9ebba8d57425875e7b863d97b9dde481b0fbb0f4db50133658a30521893f9fcf418a8f56afd1d28e0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ui_bibz (2.0.0.alpha6)
4
+ ui_bibz (2.0.0.alpha7)
5
5
  bootstrap (< 4.0.0.alpha3)
6
6
  bundler (>= 1.8.4)
7
7
  font-awesome-sass
@@ -52,7 +52,7 @@ GEM
52
52
  thread_safe (~> 0.3, >= 0.3.4)
53
53
  tzinfo (~> 1.1)
54
54
  arel (6.0.3)
55
- autoprefixer-rails (6.3.6)
55
+ autoprefixer-rails (6.3.6.1)
56
56
  execjs
57
57
  awesome_print (1.6.1)
58
58
  bootstrap (4.0.0.alpha2)
@@ -61,7 +61,7 @@ GEM
61
61
  builder (3.2.2)
62
62
  codeclimate-test-reporter (0.5.0)
63
63
  simplecov (>= 0.7.1, < 1.0.0)
64
- concurrent-ruby (1.0.1)
64
+ concurrent-ruby (1.0.2)
65
65
  docile (1.1.5)
66
66
  erubis (2.7.0)
67
67
  execjs (2.6.0)
@@ -70,7 +70,7 @@ GEM
70
70
  factory_girl_rails (4.7.0)
71
71
  factory_girl (~> 4.7.0)
72
72
  railties (>= 3.0.0)
73
- font-awesome-sass (4.5.0)
73
+ font-awesome-sass (4.6.2)
74
74
  sass (>= 3.2)
75
75
  globalid (0.3.6)
76
76
  activesupport (>= 4.1.0)
@@ -97,7 +97,7 @@ GEM
97
97
  mime-types-data (~> 3.2015)
98
98
  mime-types-data (3.2016.0221)
99
99
  mini_portile2 (2.0.0)
100
- minitest (5.8.4)
100
+ minitest (5.9.0)
101
101
  nokogiri (1.6.7.2)
102
102
  mini_portile2 (~> 2.0.0.rc2)
103
103
  rack (1.6.4)
@@ -130,7 +130,7 @@ GEM
130
130
  rake (11.1.2)
131
131
  rdoc (4.2.2)
132
132
  json (~> 1.4)
133
- ruby_parser (3.8.1)
133
+ ruby_parser (3.8.2)
134
134
  sexp_processor (~> 4.1)
135
135
  sass (3.4.22)
136
136
  sass-rails (5.0.4)
@@ -155,7 +155,7 @@ GEM
155
155
  sqlite3 (1.3.11)
156
156
  thor (0.19.1)
157
157
  thread_safe (0.3.5)
158
- tilt (2.0.2)
158
+ tilt (2.0.4)
159
159
  tzinfo (1.2.2)
160
160
  thread_safe (~> 0.1)
161
161
  will-paginate-i18n (0.1.15)
@@ -1,10 +1,11 @@
1
1
  @UiBibzForm = class Form
2
2
 
3
3
  constructor: ->
4
- @selectPicker()
5
- @switch()
6
- @multiSelect()
7
- @multiColumn()
4
+ @switch() if $('input.switch').length > 0
5
+ @selectPicker() if $('select.selectpicker').length > 0
6
+ @multiSelect() if $('.multi-select').length > 0
7
+ @multiColumn() if $('.multi-column').length > 0
8
+ @formula() if $('.formula_field_input').length > 0
8
9
 
9
10
  selectPicker: ->
10
11
  $('select.selectpicker').selectpicker
@@ -23,6 +24,43 @@
23
24
  data = Object.assign({ inheritClass: true }, data)
24
25
  $(this).multiselect(data)
25
26
 
27
+ formula: ->
28
+ me = this
29
+ formula_input_field = $('.formula_field_input')
30
+ me.updateFormulaField(formula_input_field)
31
+
32
+ formula_input_field.on 'keyup', ->
33
+ me.updateFormulaField($(this))
34
+
35
+ updateFormulaField: (field) ->
36
+ formulaInputField = field
37
+ formulaSignField = formulaInputField.siblings('.formula_field_sign')
38
+ formulaResultField = formulaInputField.siblings('.formula_field_result')
39
+ formulaAlert = formulaInputField.siblings('.formula_field_alert')
40
+
41
+ f = new window.UiBibzFormula()
42
+ result = f.go(formulaInputField.val())
43
+ error = result[0]
44
+ response = result[1]
45
+
46
+ if !!error
47
+ formulaAlert.attr('data-original-title', error)
48
+ formulaAlert.attr('style', 'display: table-cell;')
49
+ formulaResultField.addClass('fix-border-right')
50
+ else
51
+ formulaAlert.hide()
52
+ formulaResultField.val(eval(response))
53
+ formulaResultField.removeClass('fix-border-right')
54
+
55
+ if isNaN(response)
56
+ formulaSignField.attr('style', 'display: table-cell;')
57
+ formulaResultField.attr('style', 'display: table-cell; visible: visible')
58
+ formulaInputField.addClass('fix-border-right')
59
+ else
60
+ formulaSignField.hide()
61
+ formulaResultField.attr('style', 'visible: hidden;')
62
+ formulaInputField.removeClass('fix-border-right')
63
+
26
64
  multiColumn: ->
27
65
  $('.multi-column').each ->
28
66
  data = $(this).data()
@@ -0,0 +1,69 @@
1
+ # http://www.developpez.net/forums/d940195-2/webmasters-developpement-web/general-conception-web/contribuez/eval-calcul-risque/
2
+ @UiBibzFormula = class Formula
3
+
4
+ contructor: ->
5
+
6
+ res: ''
7
+
8
+ suite: (q) ->
9
+ me = this
10
+ par1 = q.match(/\(/g)
11
+ par2 = q.match(/\)/g)
12
+ if (par1? and par2? and par1.length isnt par2.length) or (not par1? and par2?) or (par1? and not par2?)
13
+ me.res = "Unclosed parenthesis."
14
+ else if /.*[\+x\*\/\-]$/.test(q)
15
+ me.res = "Formula ending with an operator."
16
+ else
17
+ me.res = "Undefined Error."
18
+
19
+ go: (ch) ->
20
+ me = this
21
+ flag = 0
22
+ for i of me.rg2
23
+ ch = ch.replace(eval(i), me.rg2[i])
24
+ finalvalue = ch
25
+ try
26
+ op = String(ch).match(/[\+x\*\/\-]{2,}/g)
27
+ ch = ch.toUpperCase()
28
+ ch = eval(ch)
29
+ me.res = "Multiple Operators in a row. <br/> Result is probably wrong." if op?
30
+ dec = (if not isNaN(ch) then ch.toFixed(3) else "It is a string.")
31
+ me.res = (if String(dec).search(/\.0+$/) isnt -1 then String(dec).substring(0, String(dec).indexOf(".")) else dec)
32
+ me.res = ''
33
+ catch er
34
+ for i of me.rg
35
+ if ch.match(eval(i))?
36
+ me.res = me.rg[i]
37
+ break
38
+ flag++
39
+ me.suite ch if flag is 5
40
+ return [me.res, finalvalue]
41
+
42
+ t:
43
+ x: "*"
44
+ X: "*"
45
+ ":": "/"
46
+
47
+ rg:
48
+ "/[^\\+\\*\\/\\-\\(\\)\\s\\d\\.]/": "It is not a number"
49
+ "/[\\+\\*\\/\\-\\(]\\)/": "Parenthesis ending with a incorrect expression."
50
+ "/([\\+\\x\\*\\/\\-]{2,})|([\\+\\x\\*\\/\\-]\\s[\\+\\x\\*\\/\\-])/i": "Multiple Operators in a row."
51
+ "/(\\D\\.)|(\\.[\\D\\s]+)|(\\.\\d+\\.)/": "Wrong Decimal."
52
+ "/\\d\\s+\\d/": "Cut Integer."
53
+ "/\\([\\/\\*]/": "First operator within parenthesis is wrong."
54
+ "/^[\\*\\/]+/": "First operator within string is wrong"
55
+
56
+ rg2:
57
+ "/\\s+/g": " "
58
+ "/([^\\.\\,\\;\\d]|^)0+([\\,\\.\\;\\d])/g": "$10$2"
59
+ "/[,;]/g": "."
60
+ "/([^\\d\\.\\,\\;])0+(\\d)/g": "$1$2"
61
+ "/^(0)(\\d)/g": "$2"
62
+ "/[\\[\\]\\|\\&\\=\\!]/g": ""
63
+ "/([\\d\\)])(\\()/g": "$1*$2"
64
+ "/(\\))([\\d\\(])/g": "$1*$2"
65
+ "/\\/+/g": "/"
66
+ "/[xX:]/g": (o) ->
67
+ t[o]
68
+
69
+ "/\\/+/g": "/"
@@ -25,6 +25,7 @@
25
25
  # Ui Bibz
26
26
  #= require table
27
27
  #= require interface
28
+ #= require formula
28
29
  #= require form
29
30
  #= require fix_bootstrap
30
31
 
@@ -3,7 +3,7 @@
3
3
  @import font-awesome
4
4
 
5
5
  // Bootstrap
6
- @import bootstrap/variables
6
+ @import bootstrap/_variables
7
7
  //@import bootstrap-sprockets
8
8
  @import bootstrap
9
9
  @import tether.min
@@ -58,3 +58,32 @@ select.form-control
58
58
  .multiselect-container
59
59
  .filter
60
60
  margin: 5px
61
+
62
+ .formula_field
63
+ input
64
+ border-bottom-right-radius: 0.25rem !important
65
+ border-top-right-radius: 0.25rem !important
66
+ .fix-border-right
67
+ border-bottom-right-radius: 0 !important
68
+ border-top-right-radius: 0 !important
69
+ width: 100%
70
+ .formula_field_sign
71
+ width: auto
72
+ min-width: 16px
73
+ padding: 4px 5px
74
+ font-weight: 400
75
+ line-height: 1.42857143
76
+ text-align: center
77
+ text-shadow: 0 1px 0 #fff
78
+ vertical-align: middle
79
+ background-color: #eee
80
+ border: solid #ccc
81
+ border-width: 1px 0
82
+ margin-left: -5px
83
+ margin-right: -5px
84
+ border-left: none
85
+ border-right: none
86
+ .form-control[readonly]
87
+ background-color: white
88
+ .formula_field_alert, .formula_field_result, .formula_field_sign
89
+ display: none
@@ -6,10 +6,52 @@ module CustomInputs
6
6
  label_method, value_method = detect_collection_methods
7
7
  i = UiBibz::Ui::Core::DropdownSelectField.new(attribute_name, options, input_html_options)
8
8
 
9
- @builder.collection_select(
10
- attribute_name, collection, value_method, label_method,
11
- input_options, i.html_options
12
- )
9
+ input_options.delete(:prompt)
10
+ input_options.merge!({include_blank: false})
11
+
12
+ if options[:grouped] == true
13
+ @builder.grouped_collection_select(
14
+ attribute_name, grouped_collection,
15
+ group_method, group_label_method,
16
+ value_method, label_method,
17
+ input_options, i.html_options
18
+ )
19
+ else
20
+ @builder.collection_select(
21
+ attribute_name, collection, value_method, label_method,
22
+ input_options, i.html_options
23
+ )
24
+ end
25
+ end
26
+
27
+ def grouped_collection
28
+ @grouped_collection ||= begin
29
+ grouped_collection = options.delete(:collection)
30
+ grouped_collection.respond_to?(:call) ? grouped_collection.call : grouped_collection.to_a
31
+ end
32
+ end
33
+
34
+ def collection
35
+ if options[:grouped]
36
+ @collection ||= grouped_collection.map { |collection| collection.try(:send, group_method) }.detect(&:present?) || []
37
+ else
38
+ @collection ||= options[:collection]
39
+ end
40
+ end
41
+
42
+ def group_method
43
+ @group_method ||= options.delete(:group_method)
44
+ end
45
+
46
+ def group_label_method
47
+ label = options.delete(:group_label_method)
48
+
49
+ unless label
50
+ common_method_for = detect_common_display_methods(detect_collection_classes(grouped_collection))
51
+ label = common_method_for[:label]
52
+ end
53
+
54
+ label
13
55
  end
14
56
  end
15
57
  end
@@ -0,0 +1,11 @@
1
+ module CustomInputs
2
+ class FormulaInput < SimpleForm::Inputs::StringInput
3
+ include UiBibz::Ui::Core
4
+
5
+ def input(wrapper_options)
6
+ options = @options.merge({ builder: @builder })
7
+ UiBibz::Ui::Core::FormulaField.new(attribute_name, options, input_html_options).render
8
+ end
9
+
10
+ end
11
+ end
data/lib/ui_bibz.rb CHANGED
@@ -30,6 +30,7 @@ module UiBibz
30
30
  autoload :AutocompleteField, "ui_bibz/ui/core/input/autocomplete_field"
31
31
  autoload :DatePickerField, "ui_bibz/ui/core/input/date_picker_field"
32
32
  autoload :DropdownSelectField, "ui_bibz/ui/core/input/dropdown_select_field"
33
+ autoload :FormulaField, "ui_bibz/ui/core/input/formula_field"
33
34
  autoload :MultiColumnField, "ui_bibz/ui/core/input/multi_column_field"
34
35
  autoload :MultiSelectField, "ui_bibz/ui/core/input/multi_select_field"
35
36
  autoload :SurroundField, "ui_bibz/ui/core/input/surround_field"
@@ -61,6 +61,10 @@ module UiBibz::Helpers::UiCoreHelper
61
61
  UiBibz::Ui::Core::MultiSelectField.new(content, options, html_options, &block).render
62
62
  end
63
63
 
64
+ def formula_field content = nil, options = nil, html_options = nil, &block
65
+ UiBibz::Ui::Core::FormulaField.new(content, options, html_options, &block).render
66
+ end
67
+
64
68
  def surround_field content = nil, options = nil, html_options = nil, &block
65
69
  UiBibz::Ui::Core::SurroundField.new(content, options, html_options, &block).render
66
70
  end
@@ -64,10 +64,6 @@ module UiBibz::Ui::Core
64
64
  { role: type }
65
65
  end
66
66
 
67
- def component_html_data
68
- add_html_data "toggle", "buttons"
69
- end
70
-
71
67
  def type
72
68
  options[:type] || :group
73
69
  end
@@ -78,10 +78,5 @@ module UiBibz::Ui::Core
78
78
  @datalist ||= "#{ html_options[:id] || content }-datalist"
79
79
  end
80
80
 
81
- # :lg, :sm or :xs
82
- def size
83
- "input-group-#{ options[:size] }" if options[:size]
84
- end
85
-
86
81
  end
87
82
  end
@@ -0,0 +1,93 @@
1
+ module UiBibz::Ui::Core
2
+
3
+ # Create a FormulaField
4
+ #
5
+ # This element is an extend of UiBibz::Ui::Core::Component.
6
+ #
7
+ # ==== Attributes
8
+ #
9
+ # * +content+ - Content of element
10
+ # * +options+ - Options of element
11
+ # * +html_options+ - Html Options of element
12
+ #
13
+ # ==== Options
14
+ #
15
+ # You can add HTML attributes using the +html_options+.
16
+ # You can pass arguments in options attribute:
17
+ # * - formula_field_name, String || Symbol (default: "#{content}_formula")
18
+ #
19
+ # ==== Signatures
20
+ #
21
+ # UiBibz::Ui::Core::FormulaField.new(content, options = {}, html_options = {}).render
22
+ #
23
+ # UiBibz::Ui::Core::FormulaField.new(options = {}, html_options = {}) do
24
+ # content
25
+ # end.render
26
+ #
27
+ # ==== Examples
28
+ #
29
+ # UiBibz::Ui::Core::FormulaField.new('value', { formula_field_name: :formula }, { class: 'test' })
30
+ #
31
+ # UiBibz::Ui::Core::FormulaField.new do
32
+ # 'value'
33
+ # end
34
+ #
35
+ # ==== Helper
36
+ #
37
+ # formula_field(value, options = {}, html_options = {})
38
+ #
39
+ class FormulaField < Component
40
+
41
+ # See UiBibz::Ui::Core::Component.initialize
42
+ def initialize content = nil, options = nil, html_options = nil, &block
43
+ super
44
+ end
45
+
46
+ # Render html tag
47
+ def render
48
+ content_tag :div, class: 'input-group formula_field' do
49
+ concat text_field_formula_input_tag
50
+ concat formula_field_sign
51
+ concat text_field_input_tag
52
+ concat formula_field_alert
53
+ end
54
+ end
55
+
56
+ private
57
+
58
+ def text_field_input_tag
59
+ if options[:builder].nil?
60
+ text_field_tag content, html_options[:value], readonly: true, class: 'formula_field_result form-control'
61
+ else
62
+ options[:builder].text_field content, readonly: true, class: 'formula_field_result form-control'
63
+ end
64
+ end
65
+
66
+ def text_field_formula_input_tag
67
+ if options[:builder].nil?
68
+ text_field_tag formula_field_name, '', html_options
69
+ else
70
+ options[:builder].text_field formula_field_name, html_options
71
+ end
72
+ end
73
+
74
+ def component_html_classes
75
+ 'formula_field_input form-control'
76
+ end
77
+
78
+ def formula_field_alert
79
+ content_tag :span, class: 'formula_field_alert input-group-addon', data: { toggle: 'tooltip' } do
80
+ UiBibz::Ui::Core::Glyph.new('exclamation-triangle', state: :danger ).render
81
+ end
82
+ end
83
+
84
+ def formula_field_name
85
+ options[:formula_field_name] || "#{ content }_formula"
86
+ end
87
+
88
+ def formula_field_sign
89
+ content_tag :span, '=', class: 'formula_field_sign input-group-addon'
90
+ end
91
+
92
+ end
93
+ end
@@ -0,0 +1,32 @@
1
+ module UiBibz::Ui::Ux
2
+
3
+ # As
4
+ #
5
+ class As
6
+
7
+ def initialize col, record, content
8
+ @col = col
9
+ @record = record
10
+ @content = content
11
+ end
12
+
13
+ def render
14
+ case @col.as
15
+ when :boolean
16
+ boolean_render
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def boolean_render
23
+ if @content == true
24
+ glyph = UiBibz::Ui::Core::Glyph.new('check-circle', state: :success)
25
+ else
26
+ glyph = UiBibz::Ui::Core::Glyph.new('minus-circle', state: :danger)
27
+ end
28
+ glyph.render
29
+ end
30
+
31
+ end
32
+ end
@@ -1,7 +1,7 @@
1
1
  module UiBibz::Ui::Ux
2
2
  class Column < UiBibz::Ui::Core::Component
3
3
 
4
- attr_accessor :hidden, :link, :name, :data_index, :date_format, :sort, :format, :date_format, :count, :custom_sort, :parent, :id
4
+ attr_accessor :hidden, :link, :name, :class, :as, :data_index, :date_format, :sort, :format, :date_format, :count, :custom_sort, :parent, :id
5
5
 
6
6
  def initialize content = nil, options = nil, html_options = nil, &block
7
7
  super
@@ -15,7 +15,9 @@ module UiBibz::Ui::Ux
15
15
  @custom_sort = @options[:custom_sort]
16
16
  @parent = @options[:parent]
17
17
  @count = @options[:count]
18
+ @as = @options[:as]
18
19
  @format = @options[:format]
20
+ @class = @options[:class]
19
21
  @hidden = @options[:hidden]
20
22
  end
21
23
 
@@ -3,6 +3,7 @@ require "ui_bibz/ui/ux/table/components/columns"
3
3
  require "ui_bibz/ui/ux/table/components/column"
4
4
  require "ui_bibz/ui/ux/table/components/actions"
5
5
  require "ui_bibz/ui/ux/table/components/thead"
6
+ require "ui_bibz/ui/ux/table/components/as"
6
7
  require "ui_bibz/ui/ux/table/extensions/paginable"
7
8
  require "ui_bibz/ui/ux/table/extensions/paginable"
8
9
  require "ui_bibz/ui/ux/table/extensions/searchable"
@@ -157,7 +158,7 @@ module UiBibz::Ui::Ux
157
158
  content_tag(:table, html_options) do
158
159
 
159
160
  ths = cols.collect do |col|
160
- content_tag(:th, sort.header(col)) unless col.hidden?
161
+ content_tag(:th, sort.header(col), class: col.class) unless col.hidden?
161
162
  end
162
163
 
163
164
  ths = action.header ths
@@ -165,7 +166,7 @@ module UiBibz::Ui::Ux
165
166
 
166
167
  trs = store.records.collect do |record|
167
168
  tds = cols.collect do |col|
168
- content_tag(:td, td_content(record, col)) unless col.hidden?
169
+ content_tag(:td, td_content(record, col), class: col.class) unless col.hidden?
169
170
  end
170
171
 
171
172
  tds = action.body record, tds
@@ -183,6 +184,7 @@ module UiBibz::Ui::Ux
183
184
  content = content.strftime(col.date_format) unless col.date_format.nil?
184
185
  content = link_to content, action.inject_url(col.link, record) unless col.link.nil?
185
186
  content = col.format.call(@store.records, record) unless col.format.nil?
187
+ content = As.new(col, record, content).render unless col.as.nil?
186
188
  content
187
189
  end
188
190
  end
@@ -1,3 +1,3 @@
1
1
  module UiBibz
2
- VERSION = "2.0.0.alpha6"
2
+ VERSION = "2.0.0.alpha7"
3
3
  end
@@ -14,7 +14,7 @@ class ButtonTest < ActionView::TestCase
14
14
  actual = UiBibz::Ui::Core::ButtonGroup.new position: :vertical do
15
15
  UiBibz::Ui::Core::Button.new('toto').render
16
16
  end.render
17
- expected = "<div data-toggle=\"buttons\" class=\"btn-group btn-group-vertical\" role=\"group\"><button class=\"btn-primary btn\">toto</button></div>"
17
+ expected = "<div class=\"btn-group btn-group-vertical\" role=\"group\"><button class=\"btn-primary btn\">toto</button></div>"
18
18
 
19
19
  assert_equal expected, actual
20
20
  end
@@ -52,7 +52,7 @@ class ButtonTest < ActionView::TestCase
52
52
  concat UiBibz::Ui::Core::ButtonChoice.new('Toto1').render
53
53
  concat UiBibz::Ui::Core::ButtonChoice.new('Toto2').render
54
54
  end.render
55
- expected = "<div data-toggle=\"buttons\" class=\"btn-group\" role=\"group\"><label class=\"btn-primary btn\"><input type=\"checkbox\" autocomplete=\"off\" />Toto1</label><label class=\"btn-primary btn\"><input type=\"checkbox\" autocomplete=\"off\" />Toto2</label></div>"
55
+ expected = "<div class=\"btn-group\" role=\"group\"><label class=\"btn-primary btn\"><input type=\"checkbox\" autocomplete=\"off\" />Toto1</label><label class=\"btn-primary btn\"><input type=\"checkbox\" autocomplete=\"off\" />Toto2</label></div>"
56
56
 
57
57
  assert_equal expected, actual
58
58
  end
@@ -62,7 +62,7 @@ class ButtonTest < ActionView::TestCase
62
62
  concat UiBibz::Ui::Core::ButtonChoice.new('Toto1', type: :radio).render
63
63
  concat UiBibz::Ui::Core::ButtonChoice.new('Toto2', type: :radio).render
64
64
  end.render
65
- expected = "<div data-toggle=\"buttons\" class=\"btn-group\" role=\"group\"><label class=\"btn-primary btn\"><input type=\"radio\" autocomplete=\"off\" />Toto1</label><label class=\"btn-primary btn\"><input type=\"radio\" autocomplete=\"off\" />Toto2</label></div>"
65
+ expected = "<div class=\"btn-group\" role=\"group\"><label class=\"btn-primary btn\"><input type=\"radio\" autocomplete=\"off\" />Toto1</label><label class=\"btn-primary btn\"><input type=\"radio\" autocomplete=\"off\" />Toto2</label></div>"
66
66
 
67
67
  assert_equal expected, actual
68
68
  end
@@ -86,4 +86,11 @@ class InputsTest < ActionView::TestCase
86
86
 
87
87
  assert_equal expected, actual
88
88
  end
89
+
90
+ test 'formula_field' do
91
+ actual = UiBibz::Ui::Core::FormulaField.new('value').render
92
+ expected = "<div class=\"input-group formula_field\"><input type=\"text\" name=\"value_formula\" id=\"value_formula\" value=\"\" class=\"formula_field_input form-control\" /><span class=\"formula_field_sign input-group-addon\">=</span><input type=\"text\" name=\"value\" id=\"value\" readonly=\"readonly\" class=\"formula_field_result form-control\" /><span class=\"formula_field_alert input-group-addon\" data-toggle=\"tooltip\"><i class=\"glyph-danger glyph fa fa-exclamation-triangle\"></i></span></div>"
93
+
94
+ assert_equal expected, actual
95
+ end
89
96
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ui_bibz
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.alpha6
4
+ version: 2.0.0.alpha7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thooams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-19 00:00:00.000000000 Z
11
+ date: 2016-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -237,6 +237,7 @@ files:
237
237
  - Rakefile
238
238
  - app/assets/javascripts/fix_bootstrap.coffee
239
239
  - app/assets/javascripts/form.coffee
240
+ - app/assets/javascripts/formula.coffee
240
241
  - app/assets/javascripts/interface.coffee
241
242
  - app/assets/javascripts/table.coffee
242
243
  - app/assets/javascripts/ui_bibz.coffee
@@ -248,6 +249,7 @@ files:
248
249
  - app/inputs/custom_inputs/autocomplete_input.rb
249
250
  - app/inputs/custom_inputs/date_picker_input.rb
250
251
  - app/inputs/custom_inputs/dropdown_select_input.rb
252
+ - app/inputs/custom_inputs/formula_input.rb
251
253
  - app/inputs/custom_inputs/multi_column_input.rb
252
254
  - app/inputs/custom_inputs/multi_select_input.rb
253
255
  - app/inputs/custom_inputs/surround_input.rb
@@ -397,6 +399,7 @@ files:
397
399
  - lib/ui_bibz/ui/core/input/autocomplete_field.rb
398
400
  - lib/ui_bibz/ui/core/input/date_picker_field.rb
399
401
  - lib/ui_bibz/ui/core/input/dropdown_select_field.rb
402
+ - lib/ui_bibz/ui/core/input/formula_field.rb
400
403
  - lib/ui_bibz/ui/core/input/multi_column_field.rb
401
404
  - lib/ui_bibz/ui/core/input/multi_select_field.rb
402
405
  - lib/ui_bibz/ui/core/input/surround_field.rb
@@ -427,6 +430,7 @@ files:
427
430
  - lib/ui_bibz/ui/core/progress.rb
428
431
  - lib/ui_bibz/ui/core/stars.rb
429
432
  - lib/ui_bibz/ui/ux/table/components/actions.rb
433
+ - lib/ui_bibz/ui/ux/table/components/as.rb
430
434
  - lib/ui_bibz/ui/ux/table/components/column.rb
431
435
  - lib/ui_bibz/ui/ux/table/components/columns.rb
432
436
  - lib/ui_bibz/ui/ux/table/components/store.rb
@@ -509,6 +513,7 @@ files:
509
513
  - test/ui/table_test.rb
510
514
  - test/ui_bibz_test.rb
511
515
  - test/ui_helper_test.rb
516
+ - ui_bibz-2.0.0.alpha.gem
512
517
  - ui_bibz.gemspec
513
518
  - vendor/assets/images/switch.png
514
519
  - vendor/assets/javascripts/bootstrap-datepicker.min.js