1 class Pettanr.OriginalPicture extends Peta.Content
\r
2 url: '/original_pictures/'
\r
15 is_visible: (operators) ->
\r
19 @get('id') + '.' + @get('ext')
\r
22 'image/' + @get('ext')
\r
25 '/original_pictures/' + @filename()
\r
28 {src: @r_url(), width: @get('width'), height: @get('height')}
\r
30 tmb_opt_img_tag: () ->
\r
31 new Pettanr.Image.SymbolPicture({
\r
38 symbol_option: (cb) ->
\r
40 this.fetch({cache: true}).done ->
\r
41 cb(_this.tmb_opt_img_tag())
\r
44 new Pettanr.OriginalPicture.Head({original_picture: this})
\r
47 new Pettanr.OriginalPicture.History({original_picture: this})
\r
49 is_unpublished: () ->
\r
50 @get('published_at') == null and @get('stopped_at') == null
\r
53 @get('stopped_at') != null
\r
55 is_unlicensed: () ->
\r
56 dt = @get('published_at') || @get('stopped_at')
\r
57 return false if not dt
\r
58 @get('uploaded_at') > dt
\r
61 @get('published_at') != null
\r
67 class Pettanr.OriginalPicture.History extends Backbone.Collection
\r
68 url: '/original_pictures/'
\r
70 initialize: (options) ->
\r
71 @model = Pettanr.Picture
\r
72 @url = @url + options.id + '/history'
\r
74 class Pettanr.OriginalPicture.Head extends Backbone.View
\r
76 initialize: (options) ->
\r
77 @original_picture = options.original_picture
\r
78 @pictures = new Pettanr.OriginalPicture.History({id: @original_picture.get('id')})
\r
82 @pictures.fetch({cache: true}).done ->
\r
83 head = _this.pictures.models[0]
\r
85 head.get('revision')
\r
88 _this.$el.html(value)
\r