new Pettanr.Panel.WithElements({id: @get('id')})\r
\r
overwrite: (options) ->\r
- operators = options.operators\r
+ operators = Pettanr.cache.operators\r
return false if not operators.author\r
@set('author_id', operators.author.id)\r
\r
- is_visible: (operators) ->\r
+ is_visible: (operators = Pettanr.cache.operators) ->\r
switch super(operators)\r
when null # super return\r
return true\r
@is_publish()\r
\r
overwrite: (options) ->\r
- @set('author_id', options.operators.author.id)\r
+ @set('author_id', Pettanr.cache.operators.author.id)\r
\r
- is_usable: (operators) ->\r
+ is_usable: (operators = Pettanr.cache.operators) ->\r
@is_visible(operators)\r
\r
is_publish: () ->\r
r\r
\r
my_url: () ->\r
- '/' + @path_name() + '/' + @get('id')\r
+ s = if @get('id')\r
+ '/' + @get('id')\r
+ else\r
+ ''\r
+ '/' + @path_name() + s\r
\r
initialize: (attr = {}, options = {}) ->\r
+ super(attr, options)\r
@set(attr)\r
if @get('id')\r
@url = @my_url()\r
- @bind('change:width', () ->\r
- console.log('cng')\r
- )\r
\r
class Pettanr.Panel.WithElements extends Pettanr.Panel\r
\r
xhr = @sync(method, this, {\r
attrs: {panel: attrs},\r
success: (model, response, options) =>\r
+ _this.set(model, {silent: true})\r
_this.trigger('save:success', _this, response)\r
error: (model, response, options) =>\r
_this.trigger('save:fail', _this, response)\r