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 = Pettanr.cache.operators
\r
26 return false if not operators.author
\r
27 @set('author_id', operators.author.id)
\r
29 is_visible: (operators = Pettanr.cache.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', Pettanr.cache.operators.author.id)
\r
42 is_usable: (operators = Pettanr.cache.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
67 '/' + @path_name() + s
\r
69 initialize: (attr = {}, options = {}) ->
\r
70 super(attr, options)
\r
75 class Pettanr.Panel.WithElements extends Pettanr.Panel
\r
78 @url = @my_url() + '?with_elements=true'
\r
83 method = if @isNew()
\r
88 xhr = @sync(method, this, {
\r
89 attrs: {panel: attrs},
\r
90 success: (model, response, options) =>
\r
91 _this.set(model, {silent: true})
\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