1 class Pettanr.OriginalPicture extends Peta.Content
\r
14 is_visible: (operators = Pettanr.cache.operators) ->
\r
18 @get('id') + '.' + @get('ext')
\r
21 'image/' + @get('ext')
\r
24 '/original_pictures/' + @filename()
\r
27 '/original_picture_license_groups/new/' + @get('id')
\r
30 {src: @r_url(), width: @get('width'), height: @get('height')}
\r
32 tmb_opt_img_tag: () ->
\r
33 new Pettanr.Image.SymbolPicture({
\r
40 symbol_option: (context, options) ->
\r
42 success: (symbol_item) =>
\r
43 options.success.call(context, symbol_item.to_symbol())
\r
46 filer_caption: (context, options) ->
\r
47 history = @history()
\r
48 history.fetch({cache: true}).done =>
\r
49 caption = if _.isEmpty(history.models)
\r
52 head = _.first(history.models)
\r
53 Pettanr.to_s(head.get('revision'))
\r
54 options.success.call(context, caption)
\r
57 new Pettanr.OriginalPicture.Head({original_picture: this})
\r
60 new Pettanr.OriginalPicture.History({original_picture: this})
\r
62 is_unpublished: () ->
\r
63 @get('published_at') == null and @get('stopped_at') == null
\r
66 @get('stopped_at') != null
\r
68 is_unlicensed: () ->
\r
69 dt = @get('published_at') || @get('stopped_at')
\r
70 return false if not dt
\r
71 @get('uploaded_at') > dt
\r
74 @get('published_at') != null
\r
78 when @is_unpublished()
\r
80 when @is_unlicensed()
\r
84 when @is_published()
\r
87 initialize: (attr = {}, options = {}) ->
\r
88 super(attr, options)
\r
90 class Pettanr.OriginalPicture.History extends Backbone.Collection
\r
92 initialize: (options) ->
\r
93 @original_picture = options.original_picture
\r
94 @model = Pettanr.Picture
\r
95 @url = @original_picture.default_url() + '/history'
\r
97 class Pettanr.OriginalPicture.Head extends Pettanr.View
\r
100 initialize: (options) ->
\r
101 @original_picture = options.original_picture
\r
102 @pictures = new Pettanr.OriginalPicture.History({id: @original_picture.get('id')})
\r
105 @pictures.fetch({cache: true}).done =>
\r
106 head = @pictures.models[0]
\r
108 head.get('revision')
\r
111 this.$el.html(value)
\r