bhf 0.9.1 → 0.9.2

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: dae4152f9ff30476941024292a0b3c14084e75f0
4
- data.tar.gz: 7a0608945e50916118d4fa32648c55b311fa0226
3
+ metadata.gz: 5e11f1b3a941a6246b9913a969711d7e8cb35af0
4
+ data.tar.gz: c1ee24fe0023ab269a5aca72136a99f887477da5
5
5
  SHA512:
6
- metadata.gz: 7018abe3d2bd151236bd0bbbfc78e4f4fd8aedd717340f36498d1088b4015f5644a5fb7193a4c6509b92499427d6434f063e2924e402efa2473d18b8880b923d
7
- data.tar.gz: 225e770798d889438e68a884a590c8f75eec8a021c5dfb7dbfc62ea6dc0386b9a04fee7653ec4fbca36a79a8143230abaf0e94c261053d8b51c5af7aba1eff1e
6
+ metadata.gz: 6c4108e0e03a28f8de09660a3140d3bced156331c35090165e5e4bf450b5fa73d7a7e1ae685f5d6898069f2df0ae77c927c990091b651385d18e8f387dc86311
7
+ data.tar.gz: e71e10d4b7e53fd92e5324ac6629092b0fc6e0dd2722ff69d31f3f20d88ad81e18bd91e4ae3a8b0f9b51d49aca278ba88aa2fd830cd5bd437474d20562afdf85
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.1
1
+ 0.9.2
@@ -31,10 +31,10 @@ Turbolinks.pagesCached(0);
31
31
  var linkElem = this.linkElem;
32
32
  var rowElem = this.linkElem.getParent('tr');
33
33
  if (rowElem) {
34
- rowElem.addClass('animate');
35
- setTimeout(function(){
36
- rowElem.removeClass('animate');
37
- }, 600);
34
+ rowElem.addClass('animate');
35
+ setTimeout(function(){
36
+ rowElem.removeClass('animate');
37
+ }, 600);
38
38
  }
39
39
  setTimeout(function(){
40
40
  linkElem.removeClass('live_edit');
@@ -331,15 +331,14 @@ Turbolinks.pagesCached(0);
331
331
  });
332
332
 
333
333
  mainScope.getElements('.ninja_file_field').addEvent('change', function(){
334
- var text = (this.value || '').split('\\');
335
- var parent = this.getParent();
336
- var newText = parent.get('data-empty-field-text');
337
- if (this.value) {
338
- newText = text.getLast() || this.value;
339
- }
340
- parent.getElement('.h_text').set('text', newText);
341
- });
342
-
334
+ var text = (this.value || '').split('\\');
335
+ var parent = this.getParent();
336
+ var newText = parent.get('data-empty-field-text');
337
+ if (this.value) {
338
+ newText = text.getLast() || this.value;
339
+ }
340
+ parent.getElement('.h_text').set('text', newText);
341
+ });
343
342
 
344
343
  ajaxNote.success();
345
344
  });
@@ -17,25 +17,25 @@ provides:
17
17
  ...
18
18
  */
19
19
 
20
- (function($){
21
- var domReadyCallback = function(){
22
- rails.csrf = {
23
- token: rails.getCsrf('token'),
24
- param: rails.getCsrf('param')
25
- };
20
+ window.addEvent('domready', function(){
26
21
 
27
- rails.applyEvents();
22
+ rails.csrf = {
23
+ token: rails.getCsrf('token'),
24
+ param: rails.getCsrf('param')
28
25
  };
29
- window.addEvent('domready', domReadyCallback);
30
- document.addEventListener('page:load', domReadyCallback);
26
+
27
+ rails.applyEvents();
28
+ });
31
29
 
30
+ (function($){
31
+
32
32
  window.rails = {
33
33
  /**
34
34
  * If el is passed as argument, events will only be applied to
35
35
  * elements within el. Otherwise applied to document body.
36
36
  */
37
37
  applyEvents: function(el){
38
- el = $(el || document.body);
38
+ el = $(el || document);
39
39
  var apply = function(selector, action, callback){
40
40
  el.addEvent(action + ':relay(' + selector + ')', callback);
41
41
  };
@@ -5,9 +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})
8
+ = render(partial: "bhf/table/#{column.macro}/#{column.show_type}", locals: {column_value: column_value, object: @object, link: false, add_quick_link: false})
9
9
 
10
10
  - if @platform.show_extra_fields and @platform.show_extra_fields.any?
11
11
  .content_box
12
12
  - @platform.show_extra_fields.each do |name|
13
- = render(partial: "bhf/table/column/#{name}", locals: {name: name, object: @object})
13
+ = render(partial: "bhf/table/column/#{name}", locals: {name: name, object: @object, link: false, add_quick_link: false})
@@ -1,4 +1,3 @@
1
- - cached_partials = {}
2
1
  - platform.pagination.template = self
3
2
  - referral_id = nil
4
3
  - if flash[:referral_entry] && referral_entry = flash[:referral_entry].clone.symbolize_keys
@@ -7,6 +6,8 @@
7
6
  - if platform.custom_partial
8
7
  = render partial: "bhf/platform/#{platform.custom_partial}", locals: {platform: platform, referral_id: referral_id}
9
8
  - else
9
+ - cached_partials = {}
10
+ - local_names = [:column_value, :object, :link, :add_quick_link]
10
11
  %table.data_table{id: "#{platform.name}_platform", class: (platform.custom_columns? ? :custom_columns : :default_columns)}
11
12
  %caption
12
13
  %h4= platform.title
@@ -34,7 +35,7 @@
34
35
  - if platform.objects.any?
35
36
  - platform.objects.each do |object|
36
37
  - edit_link = platform.hide_edit ? "##{object.id}_#{platform.name}" : edit_entry_path(platform.name, object)
37
- - custom_link = send(platform.custom_link, platform.name, object) if platform.custom_link
38
+ - custom_link = send(platform.custom_link, platform: platform.name, id: object) if platform.custom_link
38
39
  %tr.quick_edit_entry{id: "#{object.id}_#{platform.name}", class: ('animate live_edit initial_referral' if referral_id == object.id)}
39
40
  - if platform.sortable
40
41
  %td.drag
@@ -45,17 +46,14 @@
45
46
  - if column.display_type == :primary_key && column_value.to_s.length > 6
46
47
  - css_classes << :key_long
47
48
  %td{class: css_classes}
48
- - value = if column.display_type != :boolean && column_value.blank?
49
- - '&nbsp;'.html_safe
49
+ - partial_name = if column.display_type != :boolean && column_value.blank?
50
+ - 'column/empty'
50
51
  - else
51
- - if column.display_type == :string
52
- - column_value
53
- - else
54
- - partial_name = "#{column.macro}/#{column.display_type}"
55
- - cached_partials[partial_name] ||= lookup_context.find_template(partial_name, ['bhf/table'], true, [:column_value, :object])
56
- - cached_partials[partial_name].render(self, {column_value: column_value, object: object})
57
- -# render(partial: "bhf/table/#{column.macro}/#{column.display_type}", locals: {column_value: column_value, object: object})
58
- = link_to value, (platform.custom_link ? custom_link : edit_link), class: ('quick_edit' if !platform.custom_link && platform.table_quick_edit)
52
+ - "#{column.macro}/#{column.display_type}"
53
+ - cached_partials[partial_name] ||= lookup_context.find_template(partial_name, ['bhf/table'], true, local_names)
54
+ - 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)}
55
+ = cached_partials[partial_name].render(self, locals)
56
+ -# render(partial: "bhf/table/#{column.macro}/#{column.display_type}", locals: {column_value: column_value, object: object})
59
57
 
60
58
  %td.action{class: ('wider' if platform.show_duplicate && !platform.hide_edit && !platform.hide_delete)}
61
59
  - if platform.show_duplicate
@@ -79,9 +77,9 @@
79
77
  %span.handle.icon &nbsp;
80
78
  - platform.columns.each do |column|
81
79
  - css_classes = [column.macro, column.display_type]
82
- - custom_link = send(platform.custom_link, platform.name, '{object_id}') if platform.custom_link
80
+ - custom_link = send(platform.custom_link, platform: platform.name, id: '{object_id}') if platform.custom_link
83
81
  %td{class: css_classes}
84
- = link_to "{#{column.name}}", (platform.custom_link ? custom_link : edit_link), class: ('quick_edit' unless platform.custom_link)
82
+ = 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)})
85
83
 
86
84
  %td.action{class: ('wider' if platform.show_duplicate && !platform.hide_edit && !platform.hide_delete)}
87
85
  - if platform.show_duplicate
@@ -1,2 +1 @@
1
- - ref_object = column_value
2
- = ref_object.blank? ? t('bhf.helpers.entry.empty', count: 1) : ref_object.to_bhf_s
1
+ = render partial: 'bhf/table/has_one/default', locals: {column_value: column_value, object: object, link: link, add_quick_link: add_quick_link}
@@ -1 +1,2 @@
1
- = column_value[0..5].join(', ')
1
+ = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
+ = column_value[0..5].join(', ')
@@ -1 +1,2 @@
1
- = t("bhf.helpers.boolean.#{!!column_value}")
1
+ = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
+ = t("bhf.helpers.boolean.#{!!column_value}")
@@ -1 +1,5 @@
1
- = l(column_value, format: :short) if column_value
1
+ = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
+ - if column_value.is_a?(String)
3
+ = column_value
4
+ - else
5
+ = l(column_value, format: :short)
@@ -0,0 +1,2 @@
1
+ = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
+ = '&nbsp;'.html_safe
@@ -1 +1 @@
1
- = link_to_if column_value, column_value, column_value
1
+ = link_to column_value, column_value
@@ -1 +1,2 @@
1
- = column_value.inspect
1
+ = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
+ = column_value.inspect
@@ -1 +1,2 @@
1
- = image_tag column_value, alt: column_value, class: 'preview_image'
1
+ = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
+ = image_tag column_value, alt: column_value, class: 'preview_image'
@@ -1 +1,2 @@
1
- = column_value
1
+ = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
+ = column_value
@@ -1,5 +1,6 @@
1
- - file = column_value
2
- - if type_is_image?(file.content_type)
3
- = image_tag find_smallest_size_url_for_file(file), alt: column_value, class: 'preview_image'
4
- - else
5
- = file.original_filename
1
+ = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
+ - file = column_value
3
+ - if type_is_image?(file.content_type)
4
+ = image_tag find_smallest_size_url_for_file(file), alt: column_value, class: 'preview_image'
5
+ - else
6
+ = file.original_filename
@@ -1 +1,2 @@
1
- %strong= column_value
1
+ = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
+ %strong= column_value
@@ -1 +1,2 @@
1
- = column_value
1
+ = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
+ = column_value
@@ -1 +1,2 @@
1
- = sanitize(column_value.to_s, tags: %w(strong em))
1
+ = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
+ = sanitize(column_value.to_s, tags: %w(strong em))
@@ -1 +1 @@
1
- = render partial: 'bhf/table/has_many/default', locals: {ref_objects: column_value}
1
+ = render partial: 'bhf/table/has_many/default', locals: {column_value: column_value, object: object, link: link, add_quick_link: add_quick_link}
@@ -1 +1 @@
1
- = render partial: 'bhf/table/has_one/default', locals: {ref_object: column_value}
1
+ = render partial: 'bhf/table/has_one/default', locals: {column_value: column_value, object: object, link: link, add_quick_link: add_quick_link}
@@ -1 +1 @@
1
- = render partial: 'bhf/table/has_many/default', locals: {ref_objects: column_value}
1
+ = render partial: 'bhf/table/has_many/default', locals: {column_value: column_value, object: object, link: link, add_quick_link: add_quick_link}
@@ -1,2 +1,5 @@
1
- - ref_objects ||= column_value
2
- = ref_objects.blank? ? t('bhf.helpers.entry.empty', count: 2) : ref_objects.collect(&:to_bhf_s).join(', ')
1
+ = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
+ - if column_value.is_a?(String)
3
+ = column_value
4
+ - else
5
+ = column_value.collect(&:to_bhf_s).join(', ')
@@ -1,2 +1,5 @@
1
- - ref_object ||= column_value
2
- = ref_object.blank? ? t('bhf.helpers.entry.empty', count: 1) : ref_object.to_bhf_s
1
+ = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
+ - if column_value.is_a?(String)
3
+ = column_value
4
+ - else
5
+ = column_value.to_bhf_s
data/bhf.gemspec CHANGED
@@ -2,11 +2,11 @@
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.9.1 ruby lib
5
+ # stub: bhf 0.9.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "bhf"
9
- s.version = "0.9.1"
9
+ s.version = "0.9.2"
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"]
@@ -113,6 +113,7 @@ Gem::Specification.new do |s|
113
113
  "app/views/bhf/table/column/_array.haml",
114
114
  "app/views/bhf/table/column/_boolean.haml",
115
115
  "app/views/bhf/table/column/_date.haml",
116
+ "app/views/bhf/table/column/_empty.haml",
116
117
  "app/views/bhf/table/column/_extern_link.haml",
117
118
  "app/views/bhf/table/column/_file.haml",
118
119
  "app/views/bhf/table/column/_hash.haml",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bhf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Pawlik
@@ -252,6 +252,7 @@ files:
252
252
  - app/views/bhf/table/column/_array.haml
253
253
  - app/views/bhf/table/column/_boolean.haml
254
254
  - app/views/bhf/table/column/_date.haml
255
+ - app/views/bhf/table/column/_empty.haml
255
256
  - app/views/bhf/table/column/_extern_link.haml
256
257
  - app/views/bhf/table/column/_file.haml
257
258
  - app/views/bhf/table/column/_hash.haml