1 class Pettanr.OriginalPicture extends Peta.Content
\r
15 new Pettanr.Cache.Retriever(Pettanr.Picture, @get('picture_id'))
\r
18 new Pettanr.Cache.Retriever(Pettanr.Artist, @get('artist_id'))
\r
20 is_visible: (operators = Pettanr.cache.operators) ->
\r
24 @get('id') + '.' + @get('ext')
\r
27 'image/' + @get('ext')
\r
30 '/original_pictures/' + @filename()
\r
33 '/original_picture_license_groups/new/' + @get('id')
\r
36 {src: @r_url(), width: @get('width'), height: @get('height')}
\r
38 tmb_opt_img_tag: () ->
\r
39 new Pettanr.Image.SymbolPicture({
\r
46 symbol_option: () ->
\r
49 @trigger('ready:symbol', item.tmb_opt_img_tag())
\r
52 filer_caption: () ->
\r
53 history = @history()
\r
54 history.fetch({cache: true}).done =>
\r
55 caption = if _.isEmpty(history.models)
\r
58 head = _.first(history.models)
\r
59 Pettanr.to_s(head.get('revision'))
\r
60 @trigger('ready:caption', caption)
\r
63 new Pettanr.OriginalPicture.Head({original_picture: this})
\r
66 new Pettanr.OriginalPicture.History({original_picture: this})
\r
68 is_unpublished: () ->
\r
69 @get('published_at') == null and @get('stopped_at') == null
\r
72 @get('stopped_at') != null
\r
74 is_unlicensed: () ->
\r
75 dt = @get('published_at') || @get('stopped_at')
\r
76 return false if not dt
\r
77 @get('uploaded_at') > dt
\r
80 @get('published_at') != null
\r
84 when @is_unpublished()
\r
86 when @is_unlicensed()
\r
90 when @is_published()
\r
93 initialize: (attr = {}, options = {}) ->
\r
94 super(attr, options)
\r
96 class Pettanr.OriginalPicture.History extends Backbone.Collection
\r
98 initialize: (options) ->
\r
99 @original_picture = options.original_picture
\r
100 @model = Pettanr.Picture
\r
101 @url = @original_picture.default_url() + '/history'
\r
103 class Pettanr.OriginalPicture.Head extends Pettanr.View
\r
106 initialize: (options) ->
\r
107 @original_picture = options.original_picture
\r
108 @pictures = new Pettanr.OriginalPicture.History({id: @original_picture.get('id')})
\r
111 @pictures.fetch({cache: true}).done =>
\r
112 head = @pictures.models[0]
\r
114 head.get('revision')
\r
117 this.$el.html(value)
\r