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
47 retriever = @retriever()
\r
48 @listenTo(retriever, 'retrieve', @retrieve_symbol)
\r
49 retriever.retrieve()
\r
51 retrieve_symbol: (item) ->
\r
52 @trigger('ready:symbol', item.tmb_opt_img_tag())
\r
54 filer_caption: () ->
\r
55 history = @history()
\r
56 history.fetch({cache: true}).done =>
\r
57 caption = if _.isEmpty(history.models)
\r
60 head = _.first(history.models)
\r
61 Pettanr.to_s(head.get('revision'))
\r
62 @trigger('ready:caption', caption)
\r
65 new Pettanr.OriginalPicture.Head({original_picture: this})
\r
68 new Pettanr.OriginalPicture.History({original_picture: this})
\r
70 is_unpublished: () ->
\r
71 @get('published_at') == null and @get('stopped_at') == null
\r
74 @get('stopped_at') != null
\r
76 is_unlicensed: () ->
\r
77 dt = @get('published_at') || @get('stopped_at')
\r
78 return false if not dt
\r
79 @get('uploaded_at') > dt
\r
82 @get('published_at') != null
\r
86 when @is_unpublished()
\r
88 when @is_unlicensed()
\r
92 when @is_published()
\r
95 initialize: (attr = {}, options = {}) ->
\r
96 super(attr, options)
\r
98 class Pettanr.OriginalPicture.History extends Backbone.Collection
\r
100 initialize: (options) ->
\r
101 @original_picture = options.original_picture
\r
102 @model = Pettanr.Picture
\r
103 @url = @original_picture.default_url() + '/history'
\r
105 class Pettanr.OriginalPicture.Head extends Backbone.View
\r
108 initialize: (options) ->
\r
109 @original_picture = options.original_picture
\r
110 @pictures = new Pettanr.OriginalPicture.History({id: @original_picture.get('id')})
\r
113 @pictures.fetch({cache: true}).done =>
\r
114 head = @pictures.models[0]
\r
116 head.get('revision')
\r
119 this.$el.html(value)
\r