-class OriginalPicture extends Item\r
- @single: () ->\r
+class Pettanr.OriginalPicture extends Peta.Content\r
+ @singular: () ->\r
'OriginalPicture'\r
\r
@plural: () ->\r
'OriginalPictures'\r
\r
defaults: {\r
- id: 11\r
+ id: null,\r
+ artist_id: null\r
} \r
\r
+ is_visible: (operators) ->\r
+ @is_own(operators)\r
+ \r
+ filename: () ->\r
+ @get('id') + '.' + @get('ext')\r
+ \r
+ mime_type: () ->\r
+ 'image/' + @get('ext')\r
+ \r
+ r_url: () ->\r
+ '/original_pictures/' + @filename()\r
+ \r
+ opt_img_tag: () ->\r
+ {src: @r_url(), width: @get('width'), height: @get('height')}\r
+ \r
+ tmb_opt_img_tag: () ->\r
+ wh = Pettanr.Imager.thumbnail_size(@get('width'), @get('height'))\r
+ {src: @r_url(), width: wh[0], height: wh[1]}\r
+ \r
+ symbol_option: () ->\r
+ @tmb_opt_img_tag()\r
+ \r
+ revision: () ->\r
+ head = @history()[0]\r
+ if head\r
+ head.revision()\r
+ else\r
+ 'unpublished'\r
+ \r
+ is_unpublished: () ->\r
+ @get('published_at') == null and @get('stopped_at') == null\r
+ \r
+ is_stopped: () ->\r
+ @get('stopped_at') != null\r
+ \r
+ is_unlicensed: () ->\r
+ dt = @get('published_at') || @get('stopped_at')\r
+ return false if not dt\r
+ @get('uploaded_at') > dt\r
+ \r
+ is_published: () ->\r
+ @get('published_at') != null\r
+ \r
initialize: () ->\r
- confirm("Welcome to Panel")\r
- \r
- @test: () ->\r
- confirm( @single())\r
- confirm( @plural() )\r
- confirm( @class_name() )\r
- confirm( @element_name() )\r
- confirm( @table_name() )\r
- \r
- \r
- test: () ->\r
-\r
-@Panel = Panel\r
+ if @id\r
+ @url = @url + @id\r
+ \r
+class Pettanr.OriginalPicture.Collection extends Backbone.Collection\r
+ model: Pettanr.OriginalPicture\r
+ url: '/original_pictures'\r