1 class Pettanr.OriginalPicture extends Peta.Content
\r
2 url: '/original_pictures/'
\r
16 new Pettanr.Picture({id: @get('picture_id')})
\r
18 is_visible: (operators) ->
\r
22 @get('id') + '.' + @get('ext')
\r
25 'image/' + @get('ext')
\r
28 '/original_pictures/' + @filename()
\r
31 {src: @r_url(), width: @get('width'), height: @get('height')}
\r
33 tmb_opt_img_tag: () ->
\r
34 new Pettanr.Image.SymbolPicture({
\r
41 symbol_option: () ->
\r
42 @fetch({cache: true}).done =>
\r
43 @trigger('ready:symbol', @tmb_opt_img_tag())
\r
45 filer_caption: () ->
\r
46 history = @history()
\r
47 history.fetch({cache: true}).done =>
\r
48 caption = if _.isEmpty(history.models)
\r
51 head = _.first(history.models)
\r
52 Pettanr.to_s(head.get('revision'))
\r
53 @trigger('ready:caption', caption)
\r
56 new Pettanr.OriginalPicture.Head({original_picture: this})
\r
59 new Pettanr.OriginalPicture.History({original_picture: this})
\r
61 is_unpublished: () ->
\r
62 @get('published_at') == null and @get('stopped_at') == null
\r
65 @get('stopped_at') != null
\r
67 is_unlicensed: () ->
\r
68 dt = @get('published_at') || @get('stopped_at')
\r
69 return false if not dt
\r
70 @get('uploaded_at') > dt
\r
73 @get('published_at') != null
\r
77 when @is_unpublished()
\r
79 when @is_unlicensed()
\r
83 when @is_published()
\r
86 initialize: (attr = {}, options = {}) ->
\r
87 super(attr, options)
\r
91 class Pettanr.OriginalPicture.History extends Backbone.Collection
\r
92 url: '/original_pictures/'
\r
94 initialize: (options) ->
\r
95 @original_picture = options.original_picture
\r
96 @model = Pettanr.Picture
\r
97 @url = @url + @original_picture.get('id') + '/history'
\r
99 class Pettanr.OriginalPicture.Head extends Backbone.View
\r
101 initialize: (options) ->
\r
102 @original_picture = options.original_picture
\r
103 @pictures = new Pettanr.OriginalPicture.History({id: @original_picture.get('id')})
\r
106 @pictures.fetch({cache: true}).done =>
\r
107 head = @pictures.models[0]
\r
109 head.get('revision')
\r
112 this.$el.html(value)
\r