2011-11-10 01:43:19 +00:00
|
|
|
class Locomotive.Views.ApplicationView extends Backbone.View
|
|
|
|
|
|
|
|
el: 'body'
|
|
|
|
|
|
|
|
render: ->
|
|
|
|
@render_flash_messages(@options.flash)
|
|
|
|
|
2011-11-16 10:19:57 +00:00
|
|
|
@add_submenu_behaviours()
|
|
|
|
|
2011-11-16 00:39:16 +00:00
|
|
|
@center_ui_dialog()
|
|
|
|
|
2011-11-10 12:29:59 +00:00
|
|
|
if @options.view?
|
|
|
|
@view = new @options.view
|
|
|
|
@view.render()
|
|
|
|
|
2011-11-18 23:20:37 +00:00
|
|
|
window.TinyMceDefaultSettings.language = window.locale # set the default tinyMCE language
|
|
|
|
|
2011-11-10 01:43:19 +00:00
|
|
|
return @
|
|
|
|
|
|
|
|
render_flash_messages: (messages) ->
|
|
|
|
_.each messages, (couple) ->
|
|
|
|
$.growl couple[0], couple[1]
|
2011-11-16 00:39:16 +00:00
|
|
|
|
|
|
|
center_ui_dialog: ->
|
|
|
|
$(window).resize ->
|
|
|
|
$('.ui-dialog-content:visible').dialog('option', 'position', 'center')
|
2011-11-16 10:19:57 +00:00
|
|
|
|
|
|
|
add_submenu_behaviours: ->
|
|
|
|
# sub menu links
|
|
|
|
$('#submenu ul li.hoverable').hover(
|
|
|
|
->
|
|
|
|
$(@).find('a').addClass('hover')
|
|
|
|
$(@).find('.popup').show()
|
|
|
|
->
|
|
|
|
$(@).find('a').removeClass('hover');
|
|
|
|
$(@).find('.popup').hide()
|
|
|
|
)
|
|
|
|
|
|
|
|
css = $('#submenu > ul').attr('class')
|
|
|
|
$("#submenu > ul > li.#{css}").addClass('on') if css != ''
|
|
|
|
|