Implement tooltips for suppliers table view

This commit is contained in:
2013-03-11 21:46:56 +01:00
parent 0979eda9be
commit 7386768991
28 changed files with 6641 additions and 19 deletions
+15 -1
View File
@@ -17,10 +17,11 @@
// require bootstrap-popover
// require bootstrap-typeahead
//= require bootstrap
//= require mustache
//= require handlebars
//= require faye
//= require supplier/base
//= require qwaiter
//= require qtip
//= require_directory .
//= require_self
//= require moment
@@ -45,3 +46,16 @@ function redirect_to(mapping, variables){
function currency(num) {
return Qwaiter.currency(num);
}
Handlebars.registerHelper('t', function(tlocation) {
return t(tlocation)
})
Handlebars.registerHelper('currency', function(price) {
if(price.fn){
price = price.fn(this);
}
if(typeof(price) == 'function'){
price = price.call(this)
}
return new Handlebars.SafeString(currency(price))
})
@@ -6,7 +6,8 @@ root.Qsupplier=
if(e.event == 'new_order')
body = $('#active-orders-table tbody')
order = new Order(e.data)
body.append @mustache('#active-order-template', order)
if body.length
body.append @mustache('#active-order-template', order)
$('.section-table-list-'+order.list_id()).addClass('active_order')
else if(e.event == 'list_needs_help')
$('#list-needs-help-indicator-'+e.data.id).removeClass('hide')
@@ -202,6 +203,11 @@ root.Qsupplier=
mustache: (selector, locals)->
html = $(selector).html()
return '' unless html
template = Handlebars.compile(html)
container = $('<div></div>')
container.html(template(locals))
setTranslations(container)
return container.html()
locs = $.extend(locals,
currency: ->
(val)->
@@ -61,7 +61,7 @@ function setTranslations(selector){
list.find('.locale').show();
list.find('.locale-'+$locale).hide();
if(selector){
$(selector).find('[data-t]').each(function(){$(this).text(t($(this).data('t'), $(this).data('tAttributes')))})
$(selector).find('[data-t]').each(function(){$(this).html(t($(this).data('t'), $(this).data('tAttributes')))})
}else{
$('[data-t]').each(function(){$(this).html(t($(this).data('t'),$(this).data('tAttributes')))})
}
@@ -2,6 +2,7 @@
*= require 'twitter-bootstrap/bootstrap_and_overrides'
*= require 'twitter-bootstrap/bootstrap_overrides'
*= require 'jquery-ui-1.8.23.custom.css'
*= require qtip
*= require 'general'
*= require user/active_list
*= require_directory .
@@ -265,6 +265,11 @@ legend
border-top: 1px solid #222
+box-shadow(0 1px 0 #333333 inset)
.popover
color: #333
h3
color: #333
//=Progress bars
.progress
@extend .well
@@ -40,7 +40,7 @@ $table-width: 83px
background-color: rgba(0,0,0,0.4)
.section-table
position: absolute
cursor: move
cursor: pointer
&.occupied
background-color: #ffa
&.needs_help
@@ -59,6 +59,9 @@ $table-width: 83px
a
&:hover
text-decoration: none
&.section-tables-manage
.section-table
cursor: move
&.section-tables-inactive
.section-table
position: relative
@@ -76,3 +79,7 @@ table
content: " - "
.go-to-tables-view.hide
display: inline-block
ul#table-actions-list
list-style: none
margin: 0