1 class Pettanr.Panel extends Peta.Root
\r
19 new Pettanr.Cache.Retriever(Pettanr.Author, @get('author_id'))
\r
21 with_elements: () ->
\r
22 new Pettanr.Panel.WithElements({id: @get('id')})
\r
24 overwrite: (options) ->
\r
25 operators = options.operators
\r
26 return false if not operators.author
\r
27 @set('author_id', operators.author.id)
\r
29 is_visible: (operators) ->
\r
30 switch super(operators)
\r
31 when null # super return
\r
36 return true if @isNew()
\r
39 overwrite: (options) ->
\r
40 @set('author_id', options.operators.author.id)
\r
42 is_usable: (operators) ->
\r
43 @is_visible(operators)
\r
48 @licensed_pictures: (panels) ->
\r
50 _.each panels, (panel) ->
\r
51 _.extend r, panel.licensed_pictures()
\r
54 licensed_pictures: () ->
\r
56 _.each @scenario_elements(), (elm) ->
\r
57 return if not elm.my_class().has_picture()
\r
58 pid = elm.get('picture_id')
\r
59 r[pid] = elm.picture() if not r[pid]
\r
63 '/' + @path_name() + '/' + @get('id')
\r
65 initialize: (attr = {}, options = {}) ->
\r
69 @bind('change:width', () ->
\r
73 class Pettanr.Panel.WithElements extends Pettanr.Panel
\r
76 @url = @my_url() + '?with_elements=true'
\r
81 method = if @isNew()
\r
86 xhr = @sync(method, this, {
\r
87 attrs: {panel: attrs},
\r
88 success: (model, response, options) =>
\r
89 _this.trigger('save:success', _this, response)
\r
90 error: (model, response, options) =>
\r
91 _this.trigger('save:fail', _this, response)
\r
95 destroy: (options) ->
\r