class Pettanr.View extends Backbone.View render: () -> this.$el.html('') icon = new Pettanr.View.Minicon(Pettanr.View.Image.icon_loading_file()) this.$el.html(icon.render().el) this @rb: (options = null) -> new Tag.RowBreak(options).render().el rb: (options = null) -> @constructor.rb(options) append_rb: (options = null) -> this.$el.append(@rb()) div: (content, options = {}) -> options.content = content new Tag.Div(options) span: (content, options = {}) -> options.content = content new Tag.Span(options) open_error_dialog: (response, options) -> error_dialog = new Editor.Error.Dialog({parent: this}) this.$el.append(error_dialog.render().el) error_dialog.$el.dialog({ autoOpen: false, resizable: false, width: 500, height: 600, modal: true, buttons: { close: () -> $(@).dialog('close') } }) error_dialog.start(response, options) @replace_empty: (caption) -> if Pettanr.is_blank(caption) empty = new Pettanr.View.EmptyDiv() empty.render().el else caption @any_button: (item, url, icon, options = {}) -> new Pettanr.View.Button(url, icon.render().el, options) @mini_any_button: (item, url, icon, options = {}) -> new Pettanr.View.Button(url, icon.render().el, options) @face_button: (item, image, options = {}) -> icon = new Pettanr.View.Icon(image) @any_button(item, item.show_url(), icon, options) @mini_face_button: (item, image, options = {}) -> icon = new Pettanr.View.Minicon(image) @any_button(item, item.show_url(), icon, options) @prof_button: (url, options = {}) -> file = Pettanr.View.Image.icon_prof_file() icon = new Pettanr.View.Icon(file) new Pettanr.View.Button(url, icon.render().el, options) @mini_prof_button: (url, options = {}) -> file = Pettanr.View.Image.icon_prof_file() icon = new Pettanr.View.Minicon(file) new Pettanr.View.Button(url, icon.render().el, options)