diff --git a/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee
index 058a842c9..af3ad74af 100644
--- a/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee
+++ b/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee
@@ -63,7 +63,7 @@ class App.ControllerTable extends App.Controller
bindCol:
host:
events:
- 'click': colEvent
+ 'click': colClick
bindCheckbox:
events:
'click': rowClick
diff --git a/app/assets/javascripts/app/views/generic/table.jst.eco b/app/assets/javascripts/app/views/generic/table.jst.eco
index 5328cfda5..e42bbd1ee 100644
--- a/app/assets/javascripts/app/views/generic/table.jst.eco
+++ b/app/assets/javascripts/app/views/generic/table.jst.eco
@@ -78,13 +78,13 @@
<% end %>
<% #console.log('HH', item_clone.name, item_clone.type, item_clone.translate, item_clone, object.translate(), refObject, translation) %>
- <% if item_clone.link: %><% end %>
+ <% if item_clone.link: %>target="<%= item_clone.target %>"<% end %>><% end %>
<% if item_clone.translate || ( translation && !refObject && object.translate && object.translate() ) || ( translation && refObject && refObject.translate && refObject.translate() ) : %>
class="<%= item_clone.class %>"<% end %>><%- @T( @P( value, item_clone ) ) %>
<% else if item_clone.type is 'time': %>
?
<% else: %>
- class="<%= item_clone.class %>"<% end %> <% if item_clone.title: %>title="<%= item_clone.title %>"<% end %> <% if item_clone.data: %>data-id="<%= item_clone.data.id %><% end %>"><%= @P(value) %>
+ class="<%= item_clone.class %>"<% end %> <% if item_clone.title: %>title="<%= item_clone.title %>"<% end %> <% if item_clone.data: %><% for data_key, data_item of item_clone.data: %>data-<%- data_key %>="<%= data_item %>" <% end %><% end %>><%= @P(value) %>
<% end %>
<% if item_clone.link: %><% end %>
|
diff --git a/public/assets/tests/table.js b/public/assets/tests/table.js
index cc6d01a74..ffd3f9aa4 100644
--- a/public/assets/tests/table.js
+++ b/public/assets/tests/table.js
@@ -459,6 +459,18 @@ test( "table test 3", function() {
attribute.class = 'glyphicon glyphicon-user'
attribute.link = '#'
attribute.title = App.i18n.translateInline('Switch to')
+ if (object.id == 55) {
+ attribute.data = {
+ some: 'value55',
+ xxx: 55,
+ }
+ }
+ else {
+ attribute.data = {
+ some: 'value56',
+ xxx: 56,
+ }
+ }
return value
}
var switchTo = function(id, e) {
@@ -494,6 +506,8 @@ test( "table test 3", function() {
equal( el.find('tbody > tr:nth-child(1) > td:nth-child(3) > a > span').hasClass('glyphicon-user'), true, 'check row 1')
equal( el.find('tbody > tr:nth-child(1) > td:nth-child(3) > a > span').hasClass('glyphicon'), true, 'check row 1')
equal( el.find('tbody > tr:nth-child(1) > td:nth-child(3) > a > span').attr('title'), 'Switch to', 'check row 1')
+ equal( el.find('tbody > tr:nth-child(1) > td:nth-child(3) > a > span').data('some'), 'value55', 'check row 2')
+ equal( el.find('tbody > tr:nth-child(1) > td:nth-child(3) > a > span').data('xxx'), '55', 'check row 2')
equal( el.find('tbody > tr:nth-child(2) > td').length, 3, 'check row 2')
equal( el.find('tbody > tr:nth-child(2) > td:nth-child(1)').text().trim(), 'realname 56', 'check row 2')
equal( el.find('tbody > tr:nth-child(2) > td:nth-child(2)').text().trim(), 'email 56', 'check row 2')
@@ -501,5 +515,7 @@ test( "table test 3", function() {
equal( el.find('tbody > tr:nth-child(2) > td:nth-child(3) > a > span').hasClass('glyphicon-user'), true, 'check row 2')
equal( el.find('tbody > tr:nth-child(2) > td:nth-child(3) > a > span').hasClass('glyphicon'), true, 'check row 2')
equal( el.find('tbody > tr:nth-child(2) > td:nth-child(3) > a > span').attr('title'), 'Switch to', 'check row 2')
+ equal( el.find('tbody > tr:nth-child(2) > td:nth-child(3) > a > span').data('some'), 'value56', 'check row 2')
+ equal( el.find('tbody > tr:nth-child(2) > td:nth-child(3) > a > span').data('xxx'), '56', 'check row 2')
});