1 class Pettanr.Panel extends Peta.Root
\r
19 new Pettanr.Author({id: @get('author_id')})
\r
22 new Pettanr.PanelPicture({id: @get('pp_id')})
\r
24 with_elements: () ->
\r
25 new Pettanr.Panel.WithElements({id: @get('id')})
\r
27 overwrite: (options) ->
\r
28 operators = options.operators
\r
29 return false if not operators.author
\r
30 @set('author_id', operators.author.id)
\r
32 is_visible: (operators) ->
\r
33 switch super(operators)
\r
34 when null # super return
\r
39 return true if @isNew()
\r
42 overwrite: (options) ->
\r
43 @set('author_id', options.operators.author.id)
\r
45 is_usable: (operators) ->
\r
46 @is_visible(operators)
\r
51 @licensed_pictures: (panels) ->
\r
53 _.each panels, (panel) ->
\r
54 _.extend r, panel.licensed_pictures()
\r
57 licensed_pictures: () ->
\r
59 _.each @scenario_elements(), (elm) ->
\r
60 return if not elm.my_class().has_picture()
\r
61 pid = elm.get('picture_id')
\r
62 r[pid] = elm.picture() if not r[pid]
\r
66 '/' + @path_name() + '/' + @get('id')
\r
68 initialize: (attr = {}, options = {}) ->
\r
72 @bind('change:width', () ->
\r
76 class Pettanr.Panel.WithElements extends Pettanr.Panel
\r
79 @url = @my_url() + '?with_elements=true'
\r
84 method = if @isNew()
\r
89 xhr = @sync(method, this, {
\r
90 attrs: {panel: attrs},
\r
91 success: (model, response, options) =>
\r
92 _this.trigger('save:success', _this, response)
\r
93 error: (model, response, options) =>
\r
94 _this.trigger('save:fail', _this, response)
\r
98 destroy: (options) ->
\r