bhf 0.10.13 → 0.10.14

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: 2a140fe70021fd5465f86cbd6df27bb58bc47fd1
4
- data.tar.gz: 3099b6a20bd3fa24a6bbbaa388d97d5d1476d09c
3
+ metadata.gz: d52f22e8e17c8a3f1385b4322105b1f56d0df108
4
+ data.tar.gz: 36bcbe73fbf572dbcbccd2da1fc0b9719d70fb14
5
5
  SHA512:
6
- metadata.gz: c9d6903797d6fb4017631d798c9132e7841e5e23d1891e136576bd4f3266d796241cb6a7584dd68f675774f20d5b0d5da6d350428228a2864821dc8d99348477
7
- data.tar.gz: b3e00412522c5f9354b69ba9857e8af065a87e5d8cbd1bdd8803fd6cb2ca3a29ffdd6128e9bbb9934918f360afef34da9737f0b8602176161bc2c4080797b967
6
+ metadata.gz: 76508689f724d0ce51b33898565fe61297ddf3ef2031456db5976dd64b7cc15d4c6eb6b76ea8711273fba2ce21107d35a37cdc8313b5b7c5ae44d3c5236e344d
7
+ data.tar.gz: d7209cae58d7e66103978a2f5cfc26f66299906119607310c214ae869b70b622ad37f3a81dacba4bd03bceb80b1dedc94ed29fd60add2beeb690db81d3780ff9
data/README.md CHANGED
@@ -14,6 +14,11 @@ Also see [Getting Started](Getting_Started.md) document for additional info.
14
14
  * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
15
15
 
16
16
 
17
+ ## Roadmap
18
+
19
+ * Adding unit tests and integration tests
20
+ * Adding bulk edit for the table view (aka platform)
21
+
17
22
  ## Support
18
23
 
19
24
  <p><a href='https://pledgie.com/campaigns/25956'><img alt='Click here to lend your support to: bhf and make a donation at pledgie.com !' src='https://pledgie.com/campaigns/25956.png?skin_name=chrome' border='0' ></a></p>
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.13
1
+ 0.10.14
Binary file
Binary file
@@ -105,7 +105,7 @@ Turbolinks.pagesCached(0);
105
105
  }
106
106
  }
107
107
  if (eventNames.contains('successAndChange')) {
108
- if (entry) {
108
+ if (entry && parsedTemplate) {
109
109
  entry.innerHTML = parsedTemplate;
110
110
  }
111
111
  }
@@ -206,11 +206,21 @@ Turbolinks.pagesCached(0);
206
206
  });
207
207
  });
208
208
 
209
+ mainScope.addEvent('click:relay(.js_toggle)', function(e){
210
+ e.target.addEvents({
211
+ 'ajax:success': function(xhr, responseJSON){
212
+ updateElementsAfterQuickEditSuccess(['successAndChange'], e.target, responseJSON);
213
+ },
214
+ 'ajax:failure': function(){
215
+ alert(Locale.get('Notifications.failure'));
216
+ }
217
+ });
218
+ });
209
219
 
210
220
  if (platforms.length) {
211
221
  quickEditOptions = Object.merge({
212
222
  onSuccessAndNext: function(){
213
- var tr = this.linkElem;
223
+ var tr = this.linkElem.getParent('tr');
214
224
  var nextTr = tr.getNext('tr');
215
225
 
216
226
  if (nextTr) {
@@ -35,11 +35,11 @@ var PlatformHelper = new Class({
35
35
  }
36
36
  }).send({data: e.target});
37
37
  });
38
- scope.getElements('.quick_edit').addEvent('click', function(e){
38
+ scope.addEvent('click:relay(.quick_edit)', function(e){
39
39
  e.preventDefault();
40
40
  _this.fireEvent('quickEditStart', [this]);
41
41
  });
42
- scope.getElements('.action a').addEvent('click', function(e){
42
+ scope.addEvent('click:relay(.action a, .js_toggle)', function(e){
43
43
  this.addClass('clicked');
44
44
  setTimeout(function(){
45
45
  this.removeClass('clicked');
@@ -119,45 +119,6 @@ window.addEvent('domready', function(){
119
119
  }
120
120
  };
121
121
 
122
- var _reqestClassMethods = {
123
- initialize: function(element, options){
124
- this.el = element;
125
- this.parent(Object.merge({
126
- method: this.el.get('method') || this.el.get('data-method') || 'get',
127
- url: this.el.get('action') || this.el.get('href')
128
- }, options));
129
- this.addRailsEvents();
130
- },
131
-
132
- send: function(options) {
133
- this.el.fireEvent('ajax:before');
134
- if (this.el.get('tag') === 'form'){
135
- this.options.data = this.el;
136
- }
137
- this.parent(options);
138
- this.el.fireEvent('ajax:after', this.xhr);
139
- },
140
-
141
- addRailsEvents: function(){
142
- this.addEvent('request', function(){
143
- this.el.fireEvent('ajax:loading', this.xhr);
144
- });
145
-
146
- this.addEvent('success', function(){
147
- this.el.fireEvent('ajax:success', this.xhr);
148
- });
149
-
150
- this.addEvent('complete', function(){
151
- this.el.fireEvent('ajax:complete', this.xhr);
152
- this.el.fireEvent('ajax:loaded', this.xhr);
153
- });
154
-
155
- this.addEvent('failure', function(){
156
- this.el.fireEvent('ajax:failure', this.xhr);
157
- });
158
- }
159
- };
160
-
161
122
  var _reqestClassMethods = {
162
123
  initialize: function(element, options){
163
124
  this.el = element;
@@ -189,8 +150,8 @@ window.addEvent('domready', function(){
189
150
  this.el.fireEvent('ajax:loading', this.xhr);
190
151
  });
191
152
 
192
- this.addEvent('success', function(){
193
- this.el.fireEvent('ajax:success', this.xhr);
153
+ this.addEvent('success', function(responseJSON){
154
+ this.el.fireEvent('ajax:success', [this.xhr, responseJSON]);
194
155
  });
195
156
 
196
157
  this.addEvent('complete', function(){
@@ -40,7 +40,7 @@ body
40
40
 
41
41
  a
42
42
  text-decoration: none
43
- color: inherit
43
+ color: inherit
44
44
  &:focus,
45
45
  &:active
46
46
  outline: 0
@@ -93,7 +93,7 @@ header
93
93
  +box-shadow(0, 1, 4)
94
94
  &:active
95
95
  background: $b2
96
-
96
+
97
97
  .content_box
98
98
  margin: 10px 20px 20px 20px
99
99
  .dl
@@ -129,7 +129,7 @@ header
129
129
 
130
130
  .font_size_bigger
131
131
  font-size: 1.2em
132
-
132
+
133
133
 
134
134
  .quick_edit_holder,
135
135
  #main
@@ -143,7 +143,7 @@ header
143
143
  > h3
144
144
  padding: 9px 20px
145
145
  background: $g3
146
-
146
+
147
147
 
148
148
  #area_select
149
149
  -webkit-appearance: none
@@ -163,7 +163,7 @@ header
163
163
  cursor: pointer
164
164
  background-color: transparent
165
165
  background-position: -393px 0
166
-
166
+
167
167
 
168
168
 
169
169
  #content
@@ -202,11 +202,11 @@ header
202
202
  .input
203
203
  padding-top: 0
204
204
  min-height: 31px
205
-
205
+
206
206
  textarea
207
207
  width: 300px
208
208
  height: 100px
209
-
209
+
210
210
  .group
211
211
  margin-top: 0
212
212
  margin-bottom: 10px
@@ -232,7 +232,7 @@ header
232
232
  &:focus,
233
233
  &:hover
234
234
  background-position: -140px -90px
235
-
235
+
236
236
 
237
237
  .quick_edit_helper > a
238
238
  &.cancel,
@@ -280,7 +280,7 @@ table.data_table
280
280
  padding-left: 17px
281
281
  th:first-child
282
282
  padding-left: 20px
283
-
283
+
284
284
  thead
285
285
  th
286
286
  padding: 4px 0
@@ -290,7 +290,7 @@ table.data_table
290
290
  color: $g5
291
291
  &.primary_key
292
292
  text-transform: uppercase
293
- &.sorted
293
+ &.sorted
294
294
  & a:after,
295
295
  &.desc:hover a:after
296
296
  content: ' ▲'
@@ -345,7 +345,7 @@ table.data_table
345
345
 
346
346
  .handle
347
347
  display: block
348
-
348
+
349
349
 
350
350
  tr
351
351
  &.animate td
@@ -365,6 +365,14 @@ table.data_table
365
365
  background-position: 0 -50px
366
366
  &:hover
367
367
  background-position: 0 -100px
368
+ .toggle
369
+ background-position: -448px -50px
370
+ &:hover
371
+ background-position: -448px -100px
372
+ &.h_true
373
+ background-position: -448px -200px
374
+ &:hover
375
+ background-position: -448px -250px
368
376
  .delete
369
377
  background-position: -50px -50px
370
378
  &:hover
@@ -375,6 +383,8 @@ table.data_table
375
383
  background-position: -98px -100px
376
384
  .duplicate,
377
385
  .edit,
386
+ .toggle,
387
+ .toggle.h_true,
378
388
  .delete
379
389
  &.clicked
380
390
  background: image-url('bhf/small_ajax_loader_h.gif') no-repeat center center
@@ -425,6 +435,7 @@ table.data_table
425
435
  width: 20px
426
436
  height: 20px
427
437
  background: image-url('bhf/pictos.png') no-repeat
438
+ &.toggle,
428
439
  &.duplicate,
429
440
  &.edit,
430
441
  &.delete
@@ -435,6 +446,11 @@ table.data_table
435
446
  background-position: -348px 0
436
447
  &.delete
437
448
  background-position: -50px 0
449
+ &.toggle
450
+ width: 24px
451
+ background-position: -448px 0
452
+ &.h_true
453
+ background-position: -448px -150px
438
454
  &.handle
439
455
  background-position: -98px 0
440
456
  cursor: move
@@ -522,7 +538,7 @@ form
522
538
  &.live_edit,
523
539
  &:hover
524
540
  background-position: 0 -200px
525
-
541
+
526
542
  .input
527
543
  input[type="file"]
528
544
  display: block
@@ -542,7 +558,7 @@ form
542
558
  .quick_edit_holder &
543
559
  width: 320px
544
560
  margin-top: 0px
545
-
561
+
546
562
  textarea
547
563
  width: 500px
548
564
  height: 200px
@@ -595,7 +611,7 @@ form
595
611
  color: $b1
596
612
  .warning
597
613
  font-weight: bold
598
-
614
+
599
615
  input[type="submit"]
600
616
  margin-right: 20px
601
617
  input[type="submit"].alt_button
@@ -616,7 +632,7 @@ form
616
632
  color: $g6
617
633
  a
618
634
  text-decoration: underline
619
-
635
+
620
636
  .error_explanation
621
637
  h5
622
638
  padding: 10px 20px
@@ -789,7 +805,7 @@ input[type="submit"].alt_button,
789
805
  padding: 0 8px
790
806
  a, span, em
791
807
  @extend .alt_button
792
-
808
+
793
809
  span
794
810
  color: $g4
795
811
  cursor: default
@@ -802,7 +818,7 @@ input[type="submit"].alt_button,
802
818
  border-color: $g4
803
819
  &:hover
804
820
  color: $w1
805
-
821
+
806
822
  em
807
823
  font-style: normal
808
824
  font-weight: bold
@@ -869,8 +885,8 @@ input[type="submit"].alt_button,
869
885
  padding: 2px 4px 4px 4px !important
870
886
  &:hover
871
887
  background: $g4 !important
872
-
873
-
888
+
889
+
874
890
  .datepicker
875
891
  position: absolute
876
892
  width: 172px
@@ -920,7 +936,7 @@ input[type="submit"].alt_button,
920
936
  > div
921
937
  margin-top: 2px
922
938
  margin-left: 2px
923
-
939
+
924
940
  .time
925
941
  position: relative
926
942
  width: 100%
@@ -969,7 +985,7 @@ input[type="submit"].alt_button,
969
985
  background-color: $w1
970
986
  color: $b2
971
987
  +border-radius(2)
972
-
988
+
973
989
  .otherMonth
974
990
  color: $g5
975
991
  .selected
@@ -1042,7 +1058,7 @@ input[type="submit"].alt_button,
1042
1058
  clear: both
1043
1059
  .animate
1044
1060
  +transition-duration
1045
-
1061
+
1046
1062
  #ajax_holder
1047
1063
  text-indent: -9999px
1048
1064
  height: 60px
@@ -1066,18 +1082,18 @@ input[type="submit"].alt_button,
1066
1082
  width: auto
1067
1083
  opacity: 1
1068
1084
  top: 0
1069
- text-indent: 0px
1085
+ text-indent: 0px
1070
1086
  +transition-duration(0)
1071
1087
  height: auto
1072
1088
  color: white
1073
1089
  padding: 20px
1074
1090
  marign-left: -120px
1075
1091
  font-weight: bold
1076
-
1092
+
1077
1093
 
1078
1094
 
1079
1095
  .wmd-preview,
1080
- .wmd-output
1096
+ .wmd-output
1081
1097
  @extend .default_input
1082
1098
  width: 700px
1083
1099
  margin: 0 -6px 0 -6px
@@ -1104,7 +1120,7 @@ input[type="submit"].alt_button,
1104
1120
  text-decoration: underline
1105
1121
  color: $b2
1106
1122
  font-weight: bold
1107
-
1123
+
1108
1124
  .preview_switch
1109
1125
  padding-right: 6px
1110
1126
  span
@@ -1114,7 +1130,7 @@ input[type="submit"].alt_button,
1114
1130
  &.active
1115
1131
  color: $b2
1116
1132
 
1117
- .wmd-output
1133
+ .wmd-output
1118
1134
  font-size: 12px
1119
1135
  line-height: 16px
1120
1136
  background: $g6
@@ -1123,7 +1139,7 @@ input[type="submit"].alt_button,
1123
1139
  font-family: Monaco,Consolas,"Andale Mono WT","Andale Mono","Lucida Console","Courier New",Courier,monospace
1124
1140
  white-space: pre-wrap
1125
1141
 
1126
- .wmd-button-row
1142
+ .wmd-button-row
1127
1143
  width: 700px
1128
1144
  background: $w1
1129
1145
  padding: 6px 5px 1px 5px
@@ -1135,17 +1151,17 @@ input[type="submit"].alt_button,
1135
1151
 
1136
1152
 
1137
1153
  .wmd-spacer
1138
- width: 1px
1139
- height: 20px
1154
+ width: 1px
1155
+ height: 20px
1140
1156
  margin-left: 14px
1141
1157
  position: absolute
1142
1158
  background-color: Silver
1143
- display: inline-block
1159
+ display: inline-block
1144
1160
  list-style: none
1145
1161
 
1146
1162
  .wmd-button
1147
- width: 20px
1148
- height: 20px
1163
+ width: 20px
1164
+ height: 20px
1149
1165
  margin-left: 5px
1150
1166
  margin-right: 5px
1151
1167
  position: relative
@@ -1203,11 +1219,11 @@ input[type="submit"].alt_button,
1203
1219
  .wmd-prompt-dialog
1204
1220
  border: 1px solid $g5
1205
1221
  background-color: $g1
1206
- > div
1222
+ > div
1207
1223
  font-size: 0.8em
1208
1224
  font-family: arial, helvetica, sans-serif
1209
1225
  > form
1210
- input[type="text"]
1226
+ input[type="text"]
1211
1227
  border: 0
1212
1228
  color: black
1213
1229
  input[type="button"]
@@ -1219,11 +1235,9 @@ input[type="submit"].alt_button,
1219
1235
 
1220
1236
  .translation_missing
1221
1237
  color: $r1 !important
1222
-
1238
+
1223
1239
 
1224
1240
  @media screen and (-webkit-min-device-pixel-ratio: 1.5), screen and (min--moz-device-pixel-ratio: 1.5), screen and (min-device-pixel-ratio: 1.5)
1225
1241
  .icon
1226
1242
  background-image: image-url('bhf/pictos_2x.png')
1227
- background-size: 440px 260px
1228
-
1229
-
1243
+ background-size: 510px 280px
@@ -116,11 +116,30 @@ class Bhf::EntriesController < Bhf::ApplicationController
116
116
  extra_data.merge!(@object.to_bhf_hash) if @object.respond_to?(:to_bhf_hash)
117
117
 
118
118
  @platform.columns.each_with_object(extra_data) do |column, hash|
119
- column_value = @object.send(column.name)
120
- unless column.macro == :column && column_value.blank?
121
- p = "bhf/table/#{column.macro}/#{column.display_type}"
122
- hash[column.name] = render_to_string partial: p, formats: [:html], locals: {object: @object, column_value: column_value, link: false, add_quick_link: false}
119
+ respond_to_column = @object.respond_to?(column.name)
120
+ column_value = @object.send(column.name) if respond_to_column
121
+ custom_link = send(@platform.custom_link, platform: @platform.name, id: @object) if @platform.custom_link
122
+ if column.display_type == :toggle
123
+ query = {}
124
+ query[@platform.model_name] = {}
125
+ query[@platform.model_name][column.name] = !column_value
126
+ custom_link = entry_path(@platform.name, @object, query)
123
127
  end
128
+ edit_link = @platform.hide_edit ? "##{@object.id}_#{@platform.name}" : edit_entry_path(@platform.name, @object)
129
+ partial_name = if respond_to_column && ! column.type_ignore_emtpy? && column_value.blank?
130
+ 'column/empty'
131
+ else
132
+ "#{column.macro}/#{column.display_type}"
133
+ end
134
+ hash[column.name] = render_to_string(
135
+ partial: "bhf/table/#{column.macro}/#{column.display_type}",
136
+ formats: [:html],
137
+ locals: {
138
+ object: @object, column_value: column_value,
139
+ link: (custom_link ? custom_link : edit_link),
140
+ add_quick_link: (!custom_link && @platform.table_quick_edit)
141
+ }
142
+ )
124
143
  end
125
144
  end
126
145
 
@@ -5,7 +5,9 @@
5
5
  - column_value = @object.send(column.name)
6
6
  - if ! column_value.blank?
7
7
  = definition_item @object, column do
8
- = render(partial: "bhf/table/#{column.macro}/#{column.show_type}", locals: {column_value: column_value, object: @object, link: false, add_quick_link: false})
8
+ = render(partial: "bhf/table/#{column.macro}/#{column.show_type}",
9
+ locals: {column_value: column_value,
10
+ object: @object, link: false, add_quick_link: false})
9
11
 
10
12
  - if @platform.show_extra_fields and @platform.show_extra_fields.any?
11
13
  .content_box
@@ -47,18 +47,25 @@
47
47
  %td.drag
48
48
  %span.handle.icon &nbsp;
49
49
  - platform.columns.each do |column|
50
- - css_classes = [column.macro, column.display_type]
51
50
  - respond_to_column = object.respond_to?(column.name)
52
51
  - column_value = object.send(column.name) if respond_to_column
52
+ - if column.display_type == :toggle
53
+ - query = {}
54
+ - query[platform.model_name] = {}
55
+ - query[platform.model_name][column.name] = !column_value
56
+ - custom_link = entry_path(platform.name, object, query)
57
+ - css_classes = [column.macro, column.display_type]
53
58
  - if column.display_type == :primary_key && column_value.to_s.length > 6
54
59
  - css_classes << :key_long
55
60
  %td{class: css_classes}
56
- - partial_name = if respond_to_column && column.display_type != :boolean && column_value.blank?
61
+ - partial_name = if respond_to_column && ! column.type_ignore_emtpy? && column_value.blank?
57
62
  - 'column/empty'
58
63
  - else
59
64
  - "#{column.macro}/#{column.display_type}"
60
65
  - cached_partials[partial_name] ||= lookup_context.find_template(partial_name, ['bhf/table'], true, local_names)
61
- - locals = {column_value: column_value, object: object, link: (platform.custom_link ? custom_link : edit_link), add_quick_link: (!platform.custom_link && platform.table_quick_edit)}
66
+ - locals = { column_value: column_value, object: object,
67
+ link: (custom_link ? custom_link : edit_link),
68
+ add_quick_link: (!custom_link && platform.table_quick_edit) }
62
69
  = cached_partials[partial_name].render(self, locals)
63
70
  -# render(partial: "bhf/table/#{column.macro}/#{column.display_type}", locals: {column_value: column_value, object: object})
64
71
 
@@ -76,24 +83,22 @@
76
83
  - unless platform.hide_create
77
84
  = link_to new_t(platform), new_entry_path(platform.name)
78
85
 
79
- - if platform.table_quick_edit
80
- %template.quick_edit_template{type: 'text/template'}
81
- %tr.quick_edit_entry{id: "{object_id}_#{platform.name}"}
82
- - edit_link = edit_entry_path(platform.name, '{object_id}')
83
- - if platform.sortable
84
- %td.drag
85
- %span.handle.icon &nbsp;
86
- - platform.columns.each do |column|
87
- - css_classes = [column.macro, column.display_type]
88
- - custom_link = send(platform.custom_link, platform: platform.name, id: '{object_id}') if platform.custom_link
89
- %td{class: css_classes}
90
- = render(partial: "bhf/table/#{column.macro}/#{column.display_type}", locals: {column_value: "{#{column.name}}", object: platform.model.new, link: (platform.custom_link ? custom_link : edit_link), add_quick_link: (!platform.custom_link && platform.table_quick_edit)})
86
+ %template.quick_edit_template{type: 'text/template'}
87
+ %tr.quick_edit_entry{id: "{object_id}_#{platform.name}"}
88
+ - edit_link = edit_entry_path(platform.name, '{object_id}')
89
+ - if platform.sortable
90
+ %td.drag
91
+ %span.handle.icon &nbsp;
92
+ - platform.columns.each do |column|
93
+ - css_classes = [column.macro, column.display_type]
94
+ %td{class: css_classes}
95
+ = "{#{column.name}}"
91
96
 
92
- %td.action{class: ('wider' if platform.show_duplicate && !platform.hide_edit && !platform.hide_delete)}
93
- - if platform.show_duplicate
94
- - dt = duplicate_t(platform)
95
- = link_to dt, duplicate_entry_path(platform.name, '{object_id}'), class: 'icon duplicate', method: :post, title: dt
96
- - unless platform.hide_edit
97
- = link_to edit_t(platform), edit_link, class: 'icon edit'
98
- - unless platform.hide_delete
99
- = link_to delete_t(platform), entry_path(platform.name, '{object_id}'), method: :delete, remote: true, class: 'icon delete js_delete', data: {type: :json, confirm: t('bhf.helpers.promts.confirm', platform_title: platform.title_singular.titleize)}
97
+ %td.action{class: ('wider' if platform.show_duplicate && !platform.hide_edit && !platform.hide_delete)}
98
+ - if platform.show_duplicate
99
+ - dt = duplicate_t(platform)
100
+ = link_to dt, duplicate_entry_path(platform.name, '{object_id}'), class: 'icon duplicate', method: :post, title: dt
101
+ - unless platform.hide_edit
102
+ = link_to edit_t(platform), edit_link, class: 'icon edit'
103
+ - unless platform.hide_delete
104
+ = link_to delete_t(platform), entry_path(platform.name, '{object_id}'), method: :delete, remote: true, class: 'icon delete js_delete', data: {type: :json, confirm: t('bhf.helpers.promts.confirm', platform_title: platform.title_singular.titleize)}
@@ -0,0 +1,4 @@
1
+ - if link
2
+ = link_to t('bhf.helpers.entry.toggle'), link, method: :patch, remote: true, class: ['icon toggle js_toggle', ('h_true' if column_value)], data: {type: :json}
3
+ - else
4
+ = t("bhf.helpers.boolean.#{!!column_value}")
data/bhf.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: bhf 0.10.13 ruby lib
5
+ # stub: bhf 0.10.14 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "bhf"
9
- s.version = "0.10.13"
9
+ s.version = "0.10.14"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Anton Pawlik"]
14
- s.date = "2015-10-27"
14
+ s.date = "2015-11-01"
15
15
  s.description = "A simple to use Rails-Engine-Gem that offers an admin interface for trusted user. Easy integratable and highly configurable and agnostic. Works with ActiveRecord and Mongoid."
16
16
  s.email = "anton.pawlik@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -129,6 +129,7 @@ Gem::Specification.new do |s|
129
129
  "app/views/bhf/table/column/_string.html.haml",
130
130
  "app/views/bhf/table/column/_text.html.haml",
131
131
  "app/views/bhf/table/column/_thumbnail.html.haml",
132
+ "app/views/bhf/table/column/_toggle.html.haml",
132
133
  "app/views/bhf/table/column/_type.html.haml",
133
134
  "app/views/bhf/table/embeds_many/_default.html.haml",
134
135
  "app/views/bhf/table/embeds_one/_default.html.haml",
@@ -20,6 +20,7 @@ de:
20
20
  show: "%{platform_title} anzeigen"
21
21
  new: "%{platform_title} anlegen"
22
22
  duplicate: "%{platform_title} duplizieren"
23
+ toggle: "umschalten"
23
24
  edit: "%{platform_title} editieren"
24
25
  delete: "%{platform_title} löschen"
25
26
  empty: Leer
@@ -23,6 +23,7 @@ en:
23
23
  new: "New %{platform_title}"
24
24
  show: "Show %{platform_title}"
25
25
  duplicate: "Duplicate %{platform_title}"
26
+ toggle: "Toggle"
26
27
  edit: "Edit %{platform_title}"
27
28
  delete: "Delete %{platform_title}"
28
29
  empty: Empty
@@ -27,6 +27,10 @@ module Bhf::Platform::Attribute
27
27
  @options_display_type || @name
28
28
  end
29
29
 
30
+ def type_ignore_emtpy?
31
+ false
32
+ end
33
+
30
34
  def show_type
31
35
  @options_show_type || display_type || @name
32
36
  end
@@ -44,6 +44,10 @@ module Bhf::Platform::Attribute
44
44
  end
45
45
  end
46
46
 
47
+ def type_ignore_emtpy?
48
+ display_type == :boolean || display_type == :toggle
49
+ end
50
+
47
51
  def show_type
48
52
  @options_show_type || display_type
49
53
  end
@@ -63,7 +67,7 @@ module Bhf::Platform::Attribute
63
67
  private
64
68
 
65
69
  def supported_types(check_type)
66
- if [:boolean, :text, :array, :hash].include?(check_type)
70
+ if [:boolean, :toggle, :text, :array, :hash].include?(check_type)
67
71
  check_type
68
72
  elsif type_sym = group_types(check_type)
69
73
  type_sym
@@ -31,6 +31,10 @@ module Bhf::Platform::Attribute
31
31
  @options_display_type || :default
32
32
  end
33
33
 
34
+ def type_ignore_emtpy?
35
+ false
36
+ end
37
+
34
38
  def show_type
35
39
  @options_show_type || display_type
36
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bhf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.13
4
+ version: 0.10.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Pawlik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-27 00:00:00.000000000 Z
11
+ date: 2015-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -270,6 +270,7 @@ files:
270
270
  - app/views/bhf/table/column/_string.html.haml
271
271
  - app/views/bhf/table/column/_text.html.haml
272
272
  - app/views/bhf/table/column/_thumbnail.html.haml
273
+ - app/views/bhf/table/column/_toggle.html.haml
273
274
  - app/views/bhf/table/column/_type.html.haml
274
275
  - app/views/bhf/table/embeds_many/_default.html.haml
275
276
  - app/views/bhf/table/embeds_one/_default.html.haml