Version version of group by.

This commit is contained in:
Martin Edenhofer 2012-11-03 09:52:22 +01:00
parent 0253aa1953
commit a4db7dd839
8 changed files with 37 additions and 17 deletions

View file

@ -75,8 +75,8 @@ class App.ControllerTable extends App.Controller
dataTypesForCols = []
for row in overview
dataTypesForCols.push {
name: row,
link: true,
name: row
link: true
}
# extended table format
@ -111,11 +111,12 @@ class App.ControllerTable extends App.Controller
@log 'table', 'header', header, 'overview', dataTypesForCols, 'objects', data.objects
table = App.view('generic/table')(
header: header,
overview: dataTypesForCols,
objects: data.objects,
checkbox: data.checkbox,
radio: data.radio,
header: header
overview: dataTypesForCols
objects: data.objects
checkbox: data.checkbox
radio: data.radio
groupBy: data.groupBy
)
# convert to jquery object

View file

@ -140,13 +140,17 @@ class Index extends App.Controller
)
@el.find('.table-overview').append(table)
else
shown_all_attributes = @ticketTableAttributes( App.Overview.find(@overview.id).view.s.overview )
shown_all_attributes = @ticketTableAttributes( App.Overview.find( @overview.id ).view.s.overview )
new App.ControllerTable(
el: @el.find('.table-overview'),
overview_extended: shown_all_attributes,
model: App.Ticket,
objects: @ticket_list_show,
checkbox: checkbox,
groupBy:
display: 'roup'
data: 'group',
data_id: 'group_id',
)
# start user popups

View file

@ -16,7 +16,7 @@ class App.ChatWidget extends App.Controller
App.Event.bind 'ajax:auth', (user) =>
if !user
@messageLog = []
@el.html()
@el.html('')
else
@start()
@ -24,10 +24,10 @@ class App.ChatWidget extends App.Controller
@start()
start: =>
@focus = false
@focus = false
@isShown = false
@render()
@hide()
@interval @position, 200, 'chat-widget'
App.Event.bind(
@ -77,9 +77,11 @@ class App.ChatWidget extends App.Controller
)
show: =>
@isShown = true
@el.find('#chat_content').removeClass('hide')
hide: =>
@isShown = false
@el.find('#chat_content').addClass('hide')
focusIn: =>
@ -104,6 +106,10 @@ class App.ChatWidget extends App.Controller
document.getElementById('chat_log_container').scrollTop = 10000
if @focus
@el.find('[name=chat_message]').focus()
if @isShown
@show()
else
@hide()
position: =>
chatHeigth = $(@el).find('div').height()
@ -115,8 +121,8 @@ class App.ChatWidget extends App.Controller
scrollPositonY = window.pageYOffset
scrollPositonX = window.pageXOffset
heigth = windowHeigth + scrollPositonY - chatHeigth - 10
width = windowWidth - chatWidth - 50
heigth = windowHeigth + scrollPositonY - chatHeigth - 15
width = windowWidth - chatWidth - 55
@el.offset( left: width, top: heigth )
@el.css( width: '200px' )

View file

@ -1,5 +1,5 @@
<div class="well well-demand span3">
<h3><%- @T('Chat') %><a href="#" class="close">&times;</a></h3>
<h4><%- @T('Chat') %><a href="#" class="close">&times;</a></h4>
<div id="chat_content">
<div id="chat_log_container" class="max-size-scroll">
<% for message in @messages: %>

View file

@ -17,7 +17,14 @@
</thead>
<tbody>
<% position = 0 %>
<% groupLast = '' %>
<% for object in @objects: %>
<% if @groupBy: %>
<% if groupLast isnt object[@groupBy.data_id]: %>
<tr class=""><td colspan="<%= @overview.length + 1 %>"><b><%- @P( object[@groupBy.data] ) %></b></td></tr>
<% groupLast = object[@groupBy.data_id] %>
<% end %>
<% end %>
<% position++ %>
<tr class="item <% if object.active is false: %>not-active<% end %>" data-id="<%= object.id %>" data-position="<%= position %>" >
<% if @checkbox: %>

View file

@ -58,6 +58,10 @@ h3 {
font-size: 18px;
line-height: 26px;
}
h4 {
font-size: 14px;
line-height: 20px;
}
.navbar .nav > li > a {
padding: 10px 12px 10px;
}

View file

@ -262,7 +262,7 @@ class Ticket < ApplicationModel
tickets = Ticket.select( 'id' ).
where( :group_id => group_ids ).
where( overview_selected.condition ).
order( overview_selected[:order][:by].to_s + ' ' + overview_selected[:order][:direction].to_s ).
order( 'group_id, ' + overview_selected[:order][:by].to_s + ' ' + overview_selected[:order][:direction].to_s ).
limit( 500 )
ticket_ids = []

View file

@ -102,8 +102,6 @@ EventMachine.run {
# get spool messages
if data['action'] == 'spool'
@spool.each { |message|
puts message.inspect
puts data['timestamp']
if !data['timestamp'] || data['timestamp'] < message[:timestamp]
puts "send spool msg to #{client_id} #{ message[:msg] }"
@clients[client_id][:websocket].send( "[#{ message[:msg] }]" )