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
29 symbol_option: (context, options) ->
\r
31 success: (symbol_item) =>
\r
32 options.success.call(context, symbol_item.symbol_file())
\r
33 fail: (response, opt) =>
\r
34 options.fail.call(context, response, opt)
\r
37 filer_caption: (context, options) ->
\r
38 controller = Manifest.manifest().controllers['original_pictures']
\r
39 action = controller.actions['history']
\r
40 list = action.find(id: @get('id'))
\r
42 success: (pictures) =>
\r
43 caption = if _.isEmpty(pictures)
\r
46 head = _.first(pictures)
\r
47 Pettanr.to_s(head.get('revision'))
\r
48 options.success.call(context, caption)
\r
49 fail: (response, opt) =>
\r
50 options.fail.call(context, response, opt)
\r
53 is_unpublished: () ->
\r
54 @get('published_at') == null and @get('stopped_at') == null
\r
57 @get('stopped_at') != null
\r
59 is_unlicensed: () ->
\r
60 dt = @get('published_at') || @get('stopped_at')
\r
61 return false if not dt
\r
62 @get('uploaded_at') > dt
\r
65 @get('published_at') != null
\r
69 when @is_unpublished()
\r
71 when @is_unlicensed()
\r
75 when @is_published()
\r
78 initialize: (attr = {}, options = {}) ->
\r
79 super(attr, options)
\r