render: () ->\r
this.$el.html('')\r
@el.className = @body.dom_class()\r
- @rb()\r
+ @append_rb()\r
this\r
\r
dom_labels_class: () ->\r
this.$el.append(@body.render().el)\r
this.$el.append(@dock.render().el)\r
this.$el.append(@credits.render().el)\r
- @rb()\r
+ @append_rb()\r
@dock.init_tabs()\r
@dock.$el.tabs()\r
this\r
refresh: (view) ->\r
this.$el.html('')\r
this.$el.append(@history.render().el)\r
- @rb()\r
+ @append_rb()\r
this.$el.append(view.el)\r
\r
getter_proxy: () ->\r
})\r
this.$el.append(@label.render().$el)\r
this.$el.append(@body.render().$el)\r
- @rb()\r
+ @append_rb()\r
this\r
\r
refresh: () ->\r
\r
next: (opl) ->\r
@title({controller: 'original_picture_licenses', action: 'new'})\r
- @rb()\r
+ @append_rb()\r
@form = Locmare.Form.factory({\r
form_name: opl.item_name(), \r
use_name: 'default', \r
render: () ->\r
this.$el.append(@file_header.render().el)\r
this.$el.append(@file_body.render().el)\r
- @rb()\r
+ @append_rb()\r
this\r
\r
manifest: () ->\r
super(options)\r
\r
render: () ->\r
- view = Pettanr.Views[@item.singular()]\r
- summary = new view[view.summary()]({item: @item})\r
+ summary = @item.summary(this, {\r
+ })\r
@listenTo(summary, 'http_get', @http_get)\r
- this.$el.html(summary.el)\r
+ this.$el.html(summary.render().el)\r
this\r
\r
http_get: (url) ->\r
this.$el.append(@picker.render().el)\r
this.$el.append(@swatch.render().el)\r
this.$el.append(@status.render().el)\r
- @rb()\r
+ @append_rb()\r
this\r
\r
refresh: () ->\r
@listenTo(view, 'navigate', @navigate)\r
@listenTo(view, 'page', @click)\r
this.$el.append(view.render().el)\r
- @rb()\r
+ @append_rb()\r
this\r
\r
range: () ->\r
@listenTo(view, 'navigate', @navigate)\r
@listenTo(view, 'page', @click)\r
this.$el.append(view.render().el)\r
- @rb()\r
+ @append_rb()\r
this\r
\r
class Locmare.ListGroupModule.LibModule.PlayPagerModule.NextPage extends Locmare.ListGroupModule.LibModule.PagerModule.Part\r
id: null\r
} \r
\r
+ @trace_routes: () ->\r
+ {\r
+ picture: ['resource_picture_picture', 'picture']\r
+ }\r
+ \r
is_visible: (operators = Pettanr.cache.operators) ->\r
@is_user_visible(operators)\r
\r
mini_faced_label: (options) ->\r
new Pettanr.View.MiniFacedLabel(this, options)\r
\r
+ summary: (context, options) ->\r
+ klass = Pettanr.Views[@singular()].Summary\r
+ new klass(this, context, options)\r
+ \r
@index_url: () ->\r
Pettanr.url(@table_name(), 'index', {id: null})\r
\r
class Peta.Leaf extends Peta.Content\r
\r
- parent_model: () ->\r
- Manifest.manifest().models[@my_class().my_peta().parent_item_name].classify()\r
+ @parent_model: () ->\r
+ Manifest.manifest().models[@my_peta().parent_item_name].classify()\r
\r
- binder_model: () ->\r
+ @binder_model: () ->\r
@parent_model()\r
\r
- destination_model: () ->\r
- Manifest.manifest().models[@my_class().my_peta().destination_item_name].classify()\r
+ @destination_model: () ->\r
+ Manifest.manifest().models[@my_peta().destination_item_name].classify()\r
\r
- binder_key: () ->\r
+ @binder_key: () ->\r
@my_class().my_peta().parent_item_name + '_id'\r
\r
- destination_key: () ->\r
+ @destination_key: () ->\r
@my_class().my_peta().destination_item_name + '_id'\r
\r
class Pettanr.Inspire\r
\r
- constructor: (options) ->\r
+ constructor: (@item) ->\r
_.extend(this, Backbone.Events)\r
- @item = options.item\r
\r
- inspire: () -> \r
+ go: (context, options) -> \r
@item = @item.with_elements() # retake panel for 'with_elements' mode\r
@item.fetch({cache: false}).done =>\r
@item.attributes = @item.replaced_attributes()\r
@item.overwrite({})\r
@set_root()\r
@set_elements()\r
- @save()\r
+ @save(context, options)\r
\r
set_root: () ->\r
@root_form = Locmare.Form.factory({\r
form.add_elements()\r
form\r
\r
- save: () ->\r
+ save: (context, options) ->\r
# merge panel and elements\r
attrs = @root_form.save_data()\r
delete attrs['id']\r
_.extend(attrs, @elements_save_data())\r
# save json data by panel form\r
- @listenTo(@root_form, 'success', @post_success)\r
- @listenTo(@root_form, 'fail', @post_fail)\r
+ success = (model, response) ->\r
+ options.success.call(context, model)\r
+ fail = (model, response) ->\r
+ options.fail.call(context, response)\r
+ @listenTo(@root_form, 'success', success)\r
+ @listenTo(@root_form, 'fail', fail)\r
@root_form.save(attrs)\r
\r
elements_save_data: () ->\r
attrs[name].push(d)\r
attrs\r
\r
- post_success: (model, response) ->\r
- @trigger('inspire', model)\r
- \r
- post_fail: (model, response) ->\r
- @trigger('fail', response)\r
- \r
class Pettanr.View extends Backbone.View\r
\r
+ render: () ->\r
+ this.$el.html('')\r
+ icon = new Pettanr.View.Minicon(Pettanr.View.Image.icon_loading_file())\r
+ this.$el.html(icon.render().el)\r
+ this\r
+ \r
@rb: (options = null) ->\r
- rb = new Tag.RowBreak(options).render().el\r
+ new Tag.RowBreak(options).render().el\r
\r
rb: (options = null) ->\r
@constructor.rb(options)\r
\r
+ append_rb: (options = null) ->\r
+ this.$el.append(@rb())\r
+ \r
div: (content, options = {}) ->\r
options.content = content\r
- new Tag.Span(options)\r
+ new Tag.Div(options)\r
\r
span: (content, options = {}) ->\r
options.content = content\r
- new Tag.Div(options)\r
+ new Tag.Span(options)\r
\r
@replace_empty: (caption) ->\r
if Pettanr.is_blank(caption)\r
this.$el.html('')\r
if @icon_options\r
icon = new Pettanr.View.Credit.Icon(@item)\r
- @listenTo(icon, 'click:icon', @click_icon)\r
+ @listenTo(icon, 'click', @click_icon)\r
this.$el.append(icon.render().el)\r
data = new Pettanr.View.Credit.Data(@item, @data_options)\r
this.$el.append(data.render().el)\r
@credit_api_url = @item.url + '/credit'\r
\r
render: () ->\r
- this.$el.html('')\r
+ super()\r
if @item.credit_data\r
@append_credit_data()\r
else\r
this\r
\r
append_credit_data: () ->\r
+ this.$el.html('')\r
this.$el.append(@item.credit_data)\r
- @rb()\r
+ @append_rb()\r
\r
class Pettanr.View.Credit.Icon extends Pettanr.View\r
- tagName: 'span'\r
+ tagName: 'div'\r
className: 'credit-icon'\r
\r
constructor: (@item, options) ->\r
this.$el.html('')\r
this.$el.append(@header.render().el)\r
this.$el.append(@history.render().el)\r
- @rb()\r
+ @append_rb()\r
this.$el.append(@body.render().el)\r
this.$el.append(@footer.render().el)\r
this\r
@credits = new Pettanr.View.Credits(this, options)\r
@listenTo(@credits, 'click:credit:icon', @click_credit_icon)\r
this.$el.append(@credits.render().el)\r
+ @append_rb()\r
@credits.push(@panel.licensed_pictures())\r
\r
+ add_credit: (picture, options = {icon: true}) ->\r
+ credit = new Pettanr.View.Credit(picture, options)\r
+ this.$el.append(credit.render().el)\r
+ @listenTo(credit, 'click:icon', @click_credit_icon)\r
+ @append_rb()\r
+ \r
click_authored_by: (author) ->\r
@trigger('http_get', author.show_url())\r
\r
class Pettanr.View.Summary extends Pettanr.View\r
\r
- constructor: (options) ->\r
+ constructor: (@item, @context, options) ->\r
super(options)\r
\r
initialize: (options) ->\r
- @clear()\r
- @listenTo(this, 'ready', @render)\r
- \r
- clear: () ->\r
- icon = new Pettanr.View.Minicon(Pettanr.View.Image.icon_loading_file())\r
- this.$el.html(icon.render().el)\r
- this\r
- \r
- render: () ->\r
- this.$el.html('')\r
- this\r
+ super(options)\r
\r
-class Pettanr.View.Summary.Binder extends Pettanr.View\r
+class Pettanr.View.Summary.Binder extends Pettanr.View.Summary\r
\r
initialize: (options) ->\r
super(options)\r
- @item = options.item\r
@visible_t = options.visible_t\r
@visible_column_name = options.visible_column_name\r
- @load()\r
\r
- load: () ->\r
+ render: () ->\r
+ super()\r
@visible = new Tag.Div({\r
content: Pettanr.AppHelper.t_selected_item(@visible_t, @item.get(@visible_column_name))\r
})\r
@item.get_parent('author', this, {\r
success: (@author) =>\r
@author_mini_faced_label = @author.mini_faced_label({\r
- context: this,\r
+ context: @context,\r
click: () =>\r
@trigger('http_get', @author.show_url())\r
})\r
+ this.$el.html('')\r
+ this.$el.append(@visible.render().el)\r
this.$el.append(@author_mini_faced_label.render().el)\r
- @trigger('ready')\r
})\r
- \r
- render: () ->\r
- this.$el.html('')\r
- this.$el.append(@visible.render().el)\r
- this.$el.append(@author_mini_faced_label.render().el)\r
this\r
\r
- author_click: () ->\r
- @trigger('http_get', @author_icon_with_caption.url())\r
- \r
-class Pettanr.View.Summary.Leaf extends Pettanr.View\r
+class Pettanr.View.Summary.Leaf extends Pettanr.View.Summary\r
\r
initialize: (options) ->\r
super(options)\r
- @item = options.item\r
- @binder = new Pettanr.View.Summary.Leaf.Binder(@item, {})\r
- @destination = new Pettanr.View.Summary.Leaf.Binder(@item, options.destination_item_name, {})\r
- @load()\r
+ @binder = new Pettanr.View.Summary.Leaf.Binder(@item, @context)\r
+ @destination = new Pettanr.View.Summary.Leaf.Destination(@item, @context)\r
\r
- load: () ->\r
- @listenTo(this, 'load_binder', @load_destination)\r
- @listenTo(this, 'load_destination', @ready)\r
- @load_binder()\r
+ render: () ->\r
+ super()\r
+ this.$el.html('')\r
+ this.$el.append(@binder.render().el)\r
+ this.$el.append(@destination.render().el)\r
+ this\r
\r
- ready: () ->\r
- @trigger('ready')\r
+ http_get: (url) ->\r
+ @trigger('http_get', url)\r
\r
- load_binder: () ->\r
+class Pettanr.View.Summary.Leaf.Binder extends Pettanr.View\r
+ tagName: 'span'\r
\r
- load_destination: () ->\r
- @item.get_parent(@destination_item_name, this, {\r
- success: (@destination) =>\r
- @destination_icon = @destination.icon_view(true)\r
- @listenTo(@destination_icon, 'click', @destination_click)\r
- @destination.get_parent('author', this, {\r
- success: (@destination_author) =>\r
- @destination_author_mini_faced_label = @destination_author.mini_faced_label({\r
- context: this,\r
+ constructor: (@item, @context, options) ->\r
+ @binder_model = @item.my_class().binder_model()\r
+ super(options)\r
+ \r
+ initialize: (options) ->\r
+ super(options)\r
+ \r
+ render: () ->\r
+ super()\r
+ @item.get_parent(@binder_model.item_name(), this, {\r
+ success: (@binder) =>\r
+ @face_button = @binder.mini_face_button({\r
+ context: @context,\r
+ click: () =>\r
+ @trigger('http_get', @binder.show_url())\r
+ })\r
+ @binder.get_parent('author', this, {\r
+ success: (@author) =>\r
+ @author_mini_faced_label = @author.mini_faced_label({\r
+ context: @context,\r
click: () =>\r
- @trigger('http_get', @destination_author.show_url())\r
+ @trigger('http_get', @author.show_url())\r
})\r
- this.$el.append(@destination_author_mini_faced_label.render().el)\r
- @trigger('load_destination')\r
+ this.$el.html('')\r
+ this.$el.append(@face_button.render().el)\r
+ this.$el.append(@author_mini_faced_label.render().el)\r
})\r
})\r
- \r
- render: () ->\r
- this.$el.html('')\r
- this.$el.append(@binder_author_mini_faced_label.render().el)\r
- this.$el.append(@destination_author_mini_faced_label.render().el)\r
this\r
\r
- binder_click: () ->\r
- @trigger('http_get', @binder_icon.url())\r
- \r
- destination_click: () ->\r
- @trigger('http_get', @destination_icon.url())\r
+class Pettanr.View.Summary.Leaf.Destination extends Pettanr.View\r
+ tagName: 'span'\r
\r
- binder_author_click: () ->\r
- @trigger('http_get', @binder_author_icon_with_caption.url())\r
- \r
- destination_author_click: () ->\r
- @trigger('http_get', @destination_author_icon_with_caption.url())\r
- \r
-class Pettanr.View.Summary.Leaf.Binder extends Tag.Span\r
- \r
- constructor: (@item, @binder_item_name, options) ->\r
+ constructor: (@item, @context, options) ->\r
+ @destination_model = @item.my_class().destination_model()\r
super(options)\r
- @binder_model = @item.my_class().binder_model()\r
\r
initialize: (options) ->\r
- @item.get_parent(@binder_model.item_name(), this, {\r
- success: (@binder) =>\r
- @face_button = @binder.mini_face_button(true)\r
- @binder.get_parent('author', this, {\r
+ super(options)\r
+ \r
+ render: () ->\r
+ super()\r
+ @item.get_parent(@destination_model.item_name(), this, {\r
+ success: (@destination) =>\r
+ @face_button = @destination.mini_face_button({\r
+ context: @context,\r
+ click: () =>\r
+ @trigger('http_get', @binder.show_url())\r
+ })\r
+ @destination.get_parent('author', this, {\r
success: (@author) =>\r
@author_mini_faced_label = @author.mini_faced_label({\r
- context: this,\r
+ context: @context,\r
click: () =>\r
@trigger('http_get', @author.show_url())\r
})\r
+ this.$el.html('')\r
+ this.$el.append(@face_button.render().el)\r
this.$el.append(@author_mini_faced_label.render().el)\r
- @trigger('load_binder')\r
})\r
})\r
+ this\r
\r
\r
initialize: (options) ->\r
super(options)\r
- @trigger('ready')\r
\r
render: () ->\r
+ super()\r
this.$el.html('')\r
this.$el.append('-')\r
this\r
\r
initialize: (options) ->\r
super(options)\r
- @item = options.item\r
+ \r
+ render: () ->\r
+ super()\r
@item.get_parent('speech_balloon', this, {\r
success: (@speech_balloon) =>\r
@speech_balloon.get_parent('panel', this, {\r
success: (@panel) =>\r
@panel_face_button = @panel.mini_face_button({\r
context: this, \r
- click: () ->\r
+ click: () =>\r
@trigger('http_get', @panel.show_url())\r
})\r
@panel.get_parent('author', this, {\r
success: (@author) =>\r
@author_faced_label = @author.mini_faced_label({\r
context: this, \r
- click: () ->\r
+ click: () =>\r
@trigger('http_get', @author.show_url())\r
- })\r
- @trigger('ready')\r
+ })\r
+ this.$el.html('')\r
+ this.$el.append(@panel_face_button.render().el)\r
+ this.$el.append(@author_faced_label.render().el)\r
})\r
})\r
})\r
- \r
- render: () ->\r
- this.$el.html('')\r
- this.$el.append(@panel_face_button.render().el)\r
- this.$el.append(@author_faced_label.render().el)\r
this\r
\r
@trigger('ready')\r
\r
render: () ->\r
+ super()\r
this.$el.html('')\r
this.$el.append('-')\r
this\r
\r
initialize: (options) ->\r
super(options)\r
- @item = options.item\r
+ \r
+ render: () ->\r
+ super()\r
@item.get_parent('panel', this, {\r
success: (@panel) =>\r
@panel_face_button = @panel.mini_face_button({\r
- context: this, \r
- click: () ->\r
+ context: @context, \r
+ click: () =>\r
@trigger('http_get', @panel.show_url())\r
})\r
@panel.get_parent('author', this, {\r
success: (@author) =>\r
@author_faced_label = @author.mini_faced_label({\r
context: this, \r
- click: () ->\r
+ click: () =>\r
@trigger('http_get', @author.show_url())\r
})\r
- @trigger('ready')\r
+ this.$el.html('')\r
+ this.$el.append(@panel_face_button.render().el)\r
+ this.$el.append(@author_faced_label.render().el)\r
})\r
})\r
- \r
- render: () ->\r
- this.$el.html('')\r
- this.$el.append(@panel_face_button.render().el)\r
- this.$el.append(@author_faced_label.render().el)\r
this\r
\r
\r
initialize: (options) ->\r
super(options)\r
- @item = options.item\r
+ \r
+ render: () ->\r
+ super()\r
@item.get_parent('picture', this, {\r
success: (@picture) =>\r
- @credit = new Pettanr.View.Credit(@picture, {})\r
+ @credit = new Pettanr.View.Credit(@picture, {icon: false})\r
@item.get_parent('panel', this, {\r
success: (@panel) =>\r
@panel_face_button = @panel.mini_face_button({\r
context: this, \r
- click: () ->\r
+ click: () =>\r
@trigger('http_get', @panel.show_url())\r
})\r
- @trigger('ready')\r
+ this.$el.html('')\r
+ this.$el.append(@credit.render().el)\r
+ this.$el.append(@panel_face_button.render().el)\r
})\r
})\r
- \r
- render: () ->\r
- this.$el.html('')\r
- this.$el.append(@credit.render().el)\r
- this.$el.append(@panel_face_button.render().el)\r
this\r
\r
tagName: 'div'\r
\r
initialize: (options) ->\r
- image = new Pettanr.ImageFile(Pettanr.View.Image.icon_root_file())\r
- icon = new Pettanr.View.Icon(image)\r
+ icon = new Pettanr.View.Minicon(Pettanr.View.Image.icon_root_file())\r
@button = new Pettanr.View.Button('/', icon.render().el, {\r
context: this,\r
click: () =>\r
\r
initialize: (options) ->\r
super(options)\r
- @item = options.item\r
+ \r
+ render: () ->\r
+ super()\r
@item.get_parent('system_picture', this, {\r
success: (@system_picture) =>\r
- @img = new Pettanr.View.Icon(@system_picture.symbol_file())\r
- @trigger('ready')\r
+ this.$el.html('')\r
+ @img = @system_picture.real_picture()\r
+ this.$el.html(@img.render().el)\r
})\r
- \r
- render: () ->\r
- this.$el.html('')\r
- this.$el.html(@img.render().el)\r
this\r
\r
-class Pettanr.Views.OriginalPicture.ShowModule\r
-class Pettanr.Views.OriginalPicture.ShowModule.History extends Pettanr.View\r
+class Pettanr.Views.OriginalPicture.Show extends Pettanr.View.Show\r
\r
initialize: (options) ->\r
- super(options)\r
- @item = options.item\r
- @list = @item.history()\r
+ @header = new Pettanr.View.Show.Header(@item, this, @default_header_options())\r
+ @authored_by = @item.authored_by()\r
+ @listenTo(@header, 'click:pick', @click_pick)\r
+ @listenTo(@authored_by, 'click', @click_authored_by)\r
+ @body = new Pettanr.Views.OriginalPicture.Show.Body(@item, {})\r
+ @history = new Pettanr.Views.OriginalPicture.Show.History(@item, {})\r
+ @listenTo(@history, 'http_get', @http_get)\r
\r
render: () ->\r
this.$el.html('')\r
- h = new Tag.H2({\r
- content: I18n.t('original_pictures.show.history')\r
- })\r
- this.$el.append(h.render().el)\r
- @list.fetch().done =>\r
- _.each @list.models, (picture) =>\r
- view = picture.history_view()\r
- @listenTo(view, 'http_get', @http_get)\r
- this.$el.append(view.render().el)\r
+ this.$el.append(@header.render().el)\r
+ this.$el.append(@authored_by.render().el)\r
+ this.$el.append(@body.render().el)\r
+ this.$el.append(@history.render().el)\r
this\r
\r
http_get: (url) ->\r
@trigger('http_get', url)\r
\r
-class Pettanr.Views.OriginalPicture.Show extends Pettanr.View.Show\r
+ is_pickable: () ->\r
+ false\r
+ \r
+class Pettanr.Views.OriginalPicture.Show.Body extends Pettanr.View\r
+ className: 'op-body'\r
+ \r
+ constructor: (@item, options) ->\r
+ super(options)\r
\r
initialize: (options) ->\r
- @header = new Pettanr.View.Show.Header(@item, this, @default_header_options())\r
- @authored_by = @item.authored_by()\r
@img = @item.real_picture()\r
- @listenTo(@header, 'click:pick', @click_pick)\r
- @listenTo(@authored_by, 'click', @click_authored_by)\r
@owner = new Pettanr.View.Show.Footer(@item, this, {\r
actions: {\r
select: {\r
- url: @original_picture.license_url(),\r
+ url: @item.license_url(),\r
dic_name: 'original_pictures.show.select', \r
click: () =>\r
@create_dialog()\r
@trigger('click:license', @dialog)\r
}, \r
replace: {\r
- url: @original_picture.edit_url(),\r
+ url: @item.edit_url(),\r
dic_name: 'original_pictures.show.replace', \r
click: () =>\r
@trigger('http_get', @item.edit_url())\r
}, \r
}, \r
})\r
- @history = new Pettanr.Views.OriginalPicture.ShowModule.History({item: @item})\r
- @listenTo(@history, 'http_get', @http_get)\r
+ @summary = @item.summary(this, {})\r
+ @listenTo(@summary, 'http_get', @http_get)\r
\r
render: () ->\r
this.$el.html('')\r
- this.$el.append(@header.render().el)\r
- this.$el.append(@authored_by.render().el)\r
this.$el.append(@img.render().el)\r
- @item.get_parent('picture', this, {\r
- success: (@picture) =>\r
- @credit = new Pettanr.View.Credit(@picture, {\r
- icon: {\r
- click: () =>\r
- @trigger('http_get', @picture.show_url())\r
- }\r
- })\r
- this.$el.append(@credit.render().el)\r
- this.$el.append(@owner.render().el)\r
- })\r
- this.$el.append(@history.render().el)\r
+ this.$el.append(@summary.render().el)\r
+ @append_rb()\r
+ this.$el.append(@owner.render().el)\r
this\r
\r
- http_get: (url) ->\r
- @trigger('http_get', url)\r
- \r
create_dialog: () ->\r
@dialog = new Editor.PicturePublisher.Dialog({\r
parent: this\r
@dialog.start(params, null)\r
@dialog\r
\r
- is_pickable: () ->\r
- false\r
- \r
success: (resource_picture) ->\r
#Pettanr.cache.fix(@item)\r
@trigger('success', @params, @dialog)\r
#Pettanr.cache.release(@item)\r
@trigger('click:close', @dialog)\r
\r
+class Pettanr.Views.OriginalPicture.Show.History extends Pettanr.View\r
+ className: 'op-history'\r
+ \r
+ constructor: (@item, options) ->\r
+ super(options)\r
+ \r
+ initialize: (options) ->\r
+ super(options)\r
+ controller = Manifest.manifest().controllers['original_pictures']\r
+ action = controller.actions['history']\r
+ @list = action.find(id: @item.get('id'))\r
+ \r
+ render: () ->\r
+ this.$el.html('')\r
+ h = new Tag.H2({\r
+ content: I18n.t('original_pictures.show.history')\r
+ })\r
+ this.$el.append(h.render().el)\r
+ @list.open(this, {\r
+ success: (pictures) => \r
+ _.each pictures, (picture) =>\r
+ history = new Pettanr.Views.Picture.History(picture)\r
+ @listenTo(history, 'http_get', @http_get)\r
+ this.$el.append(history.render().el)\r
+ })\r
+ this\r
+ \r
+ http_get: (url) ->\r
+ @trigger('http_get', url)\r
+ \r
\r
initialize: (options) ->\r
super(options)\r
- @item = options.item\r
- @load()\r
- \r
- load: () ->\r
- @trigger('ready')\r
\r
render: () ->\r
- this.$el.html('')\r
+ super()\r
@visible = new Tag.Span({\r
class_name: 'state',\r
content: I18n.t('original_pictures.' + @item.state())\r
})\r
+ this.$el.html('')\r
this.$el.append(@visible.render().el)\r
@item.get_child('resource_picture', this, {\r
success: (@resource_picture) =>\r
if @resource_picture\r
- @item.get_parent('picture', this, {\r
+ @resource_picture.get_parent('picture', this, {\r
success: (@picture) =>\r
- @credit = new Pettanr.View.Credit(@picture, {icon: true})\r
- @listenTo(@credit, 'click:icon', @picture_click)\r
+ @credit = new Pettanr.View.Credit(@picture, {icon: false})\r
this.$el.append(@credit.render().el)\r
+ @append_rb()\r
})\r
})\r
- @rb()\r
this\r
\r
- # in credit\r
- picture_click: (picture) ->\r
- @trigger('http_get', picture.show_url())\r
- \r
\r
initialize: (options) ->\r
super(options)\r
- @item = options.item\r
+ \r
+ render: () ->\r
+ super()\r
@item.get_parent('picture', this, {\r
success: (@picture) =>\r
- @credit = new Pettanr.View.Credit(@picture, {})\r
+ @credit = new Pettanr.View.Credit(@picture, {icon: false})\r
@item.get_parent('panel', this, {\r
success: (@panel) =>\r
- @panel_face_button =@panel.mini_face_button({\r
+ @panel_face_button = @panel.mini_face_button({\r
context: this, \r
- click: () ->\r
+ click: () =>\r
@trigger('http_get', @panel.show_url())\r
})\r
- @trigger('ready')\r
+ this.$el.html('')\r
+ this.$el.append(@credit.render().el)\r
+ this.$el.append(@panel_face_button.render().el)\r
})\r
})\r
- \r
- render: () ->\r
- this.$el.html('')\r
- this.$el.append(@credit.render().el)\r
- this.$el.append(@panel_face_button.render().el)\r
this\r
\r
element_class: (element) ->\r
Pettanr.Views[element.singular()].Element.Edit\r
\r
-class Pettanr.Views.Panel.Footer extends Pettanr.View\r
- tagName: 'table'\r
- className: 'no-border'\r
- \r
- initialize: (options) ->\r
- @panel = options.panel\r
- \r
- render: () ->\r
- this.$el.html('')\r
- @panel.get_parent('author', this, {\r
- success: (@author) =>\r
- panel_face_button = @panel.mini_face_button({\r
- context: this, \r
- click: () ->\r
- @trigger('click:panel')\r
- })\r
- author_face_button = @author.mini_face_button({\r
- context: this, \r
- click: () ->\r
- @trigger('click:author')\r
- })\r
- this.$el.append(panel_face_button.render().el)\r
- this.$el.append(author_face_button.render().el)\r
- this.$el.append(\r
- Pettanr.AppHelper.distance_of_time_in_words_to_now(@panel.get('updated_at'))\r
- )\r
- if Pettanr.cache.operators.is_author()\r
- inspire_button = Pettanr.View.mini_face_button(\r
- @panel, \r
- Pettanr.View.Image.icon_inspire_file(), \r
- {\r
- context: this, \r
- click: () =>\r
- @trigger('click:inspire')\r
- }\r
- )\r
- this.$el.append(inspire_icon.render().el)\r
- if @panel.is_own()\r
- edit_button = new Pettanr.View.Button.ItemAction(@panel, 'edit', {\r
- context: this, \r
- click: () =>\r
- @trigger('click:edit')\r
- })\r
- this.$el.append(edit_button.render().el)\r
- })\r
- this\r
- \r
# panel: panel item\r
# spot: no opacity element\r
-class Pettanr.Views.Panel.Show extends Pettanr.View\r
+class Pettanr.Views.Panel.Show extends Pettanr.View.Show\r
\r
- initialize: (@panel, options) ->\r
+ initialize: (options) ->\r
+ @panel = @item\r
@spot = options.spot\r
\r
@header = new Pettanr.View.Show.Header(@item, this, @default_header_options())\r
+ @authored_by = @item.authored_by()\r
@body = new Pettanr.Views.Panel.Body({\r
panel: @panel,\r
spot: @spot\r
})\r
- @footer = new Pettanr.Views.Panel.Footer({\r
- panel: @panel,\r
+ inspire = new Pettanr.Inspire(@panel, this, )\r
+ @footer = new Pettanr.Views.Panel.Show.Footer(@panel, {\r
+ inspire: inspire\r
})\r
- @owner = new Pettanr.Views.Panel.ShowModule.Owner({item: @panel})\r
+ @owner = new Pettanr.View.Show.Footer(@item, this, @default_footer_options())\r
@listenTo(@header, 'click:pick', @click_pick)\r
- @listenTo(@footer, 'click:panel', @click_show)\r
- @listenTo(@footer, 'click:author', @click_author)\r
- @listenTo(@footer, 'click:edit', @click_edit)\r
- @listenTo(@footer, 'click:inspire', @click_inspire)\r
- @listenTo(@owner, 'click:edit', @click_edit)\r
- @listenTo(@owner, 'click:destroy', @click_destroy)\r
+ @listenTo(@authored_by, 'click', @click_authored_by)\r
\r
render: () ->\r
this.$el.html('')\r
this.$el.append(@header.render().el)\r
+ this.$el.append(@authored_by.render().el)\r
this.$el.append(@body.render().el)\r
this.$el.append(@footer.render().el)\r
@add_credits()\r
- this.$el.append(@owner.render().el)\r
+ this.$el.append(@owner.render().el) if @item.is_own()\r
this\r
\r
- click_author: () ->\r
- @trigger('http_get', @panel.author().show_url())\r
- \r
- click_edit: () ->\r
- @trigger('http_get', @panel.edit_url())\r
- \r
- click_destroy: () ->\r
- redirect = (url) =>\r
- @trigger('http_get', url)\r
- Pettanr.Proxy.destroy(@panel, {redirect: redirect})\r
- \r
- click_inspire: () ->\r
- inspire = new Pettanr.Inspire({item: @panel})\r
- @listenTo(inspire, 'inspire', @inspire)\r
- inspire.inspire()\r
- \r
click_pick: () ->\r
@trigger('pick', @item)\r
\r
add_pick: (target_model) ->\r
@header.add_pick(target_model)\r
\r
- inspire: (item) ->\r
- @trigger('http_get', item.show_url())\r
+class Pettanr.Views.Panel.Show.Footer extends Pettanr.View\r
+ tagName: 'ul'\r
+ \r
+ constructor: (@panel, options) ->\r
+ super(options)\r
+ \r
+ initialize: (options) ->\r
+ @inspire = options.inspire\r
+ \r
+ render: () ->\r
+ super()\r
+ this.$el.html('')\r
+ this.$el.append(\r
+ Pettanr.AppHelper.distance_of_time_in_words_to_now(@panel.get('updated_at'))\r
+ )\r
+ if Pettanr.cache.operators.is_author()\r
+ inspire_button = Pettanr.View.mini_face_button(\r
+ @panel, \r
+ Pettanr.View.Image.icon_inspire_file(), {\r
+ context: this,\r
+ click: () =>\r
+ @inspire.go(@inspire.context, {\r
+ success: (item) ->\r
+ @trigger('http_get', item.show_url())\r
+ fail: (response) ->\r
+ console.log(response)\r
+ })\r
+ }\r
+ )\r
+ this.$el.append(inspire_button.render().el)\r
+ this\r
\r
\r
initialize: (options) ->\r
super(options)\r
- @item = options.item\r
options['visible_t'] = 'panel_publish_items'\r
options['visible_column_name'] = 'publish'\r
@visible_t = options.visible_t\r
@visible_column_name = options.visible_column_name\r
+ \r
+ render: () ->\r
+ super()\r
@item.get_parent('author', this, {\r
success: (@author) =>\r
@visible = new Tag.Div({\r
content: Pettanr.AppHelper.t_selected_item(@visible_t, @item.get(@visible_column_name))\r
})\r
- @author_icon_with_caption = @author.icon_with_caption_view(true, 'name', 12)\r
- @listenTo(@author_icon_with_caption, 'click', @author_click)\r
- @trigger('ready')\r
+ @author_mini_faced_label = @author.mini_faced_label({\r
+ context: @context,\r
+ click: () =>\r
+ @trigger('http_get', @author.show_url())\r
+ })\r
+ this.$el.html('')\r
+ this.$el.append(@visible.render().el)\r
+ this.$el.append(@author_mini_faced_label.render().el)\r
})\r
- \r
- render: () ->\r
- this.$el.html('')\r
- this.$el.append(@visible.render().el)\r
- this.$el.append(@author_icon_with_caption.render().el)\r
this\r
\r
- author_click: () ->\r
- @trigger('http_get', @author_icon_with_caption.url())\r
- \r
\r
render: () ->\r
this.$el.html('')\r
- r = new Tag.A({\r
- attr: {href: '/' + @item.show_url()},\r
- content: @item.get('revision')\r
+ r = new Pettanr.View.Button(@item.show_url(), @item.get('revision'), {\r
+ context: this, \r
+ click: () =>\r
+ @trigger('http_get', @item.show_url())\r
})\r
- @listenTo(r, 'click', @click_show)\r
h = new Tag.H3({\r
content: Pettanr.AppHelper.t_m('Picture.revision') + ':'\r
})\r
d = new Tag.Div({\r
content: Pettanr.AppHelper.t_m('Picture.created_at') + ':' + @item.get('created_at')\r
})\r
- credit = @item.credit_view()\r
- @listenTo(credit, 'click:icon', @click_icon)\r
this.$el.append(h.render().el)\r
h.$el.append(r.render().el)\r
this.$el.append(d.render().el)\r
- this.$el.append(credit.render().el)\r
+ @add_credit(@item)\r
this\r
\r
- click_show: () ->\r
+ click_credit_icon: () ->\r
@trigger('http_get', @item.show_url())\r
\r
- click_icon: () ->\r
- @trigger('http_get', @item.show_url())\r
+ add_credit: (picture, options = {icon: true}) ->\r
+ credit = new Pettanr.View.Credit(picture, options)\r
+ this.$el.append(credit.render().el)\r
+ @listenTo(credit, 'click:icon', @click_credit_icon)\r
+ @append_rb()\r
\r
}, \r
})\r
@item.get_parent('picture', this, {\r
- success: (@picture) =>\r
- @credit = new Pettanr.View.Credit(@picture, {\r
- icon: {\r
- click: () =>\r
- @trigger('http_get', @picture.show_url())\r
- }\r
- })\r
- this.$el.append(@credit.render().el)\r
+ success: (picture) =>\r
+ @add_credit(picture)\r
this.$el.append(@owner.render().el)\r
})\r
})\r
\r
initialize: (options) ->\r
super(options)\r
- @item = options.item\r
+ \r
+ render: () ->\r
+ super()\r
@item.get_parent('picture', this, {\r
success: (@picture) =>\r
- @credit = new Pettanr.View.Credit(@picture, {})\r
- @trigger('ready')\r
+ @credit = new Pettanr.View.Credit(@picture, {icon: false})\r
+ this.$el.html('')\r
+ this.$el.append(@credit.render().el)\r
})\r
- \r
- render: () ->\r
- this.$el.html('')\r
- this.$el.append(@credit.render().el)\r
this\r
\r
this.$el.append(l2.render().el)\r
if @scroll.is_own()\r
this.$el.append(@insert_button.render().el)\r
- @rb()\r
+ @append_rb()\r
this.$el.append(@move_button.render().el)\r
- @rb()\r
+ @append_rb()\r
this.$el.append(@destroy_button.render().el)\r
})\r
this\r
@listenTo(@footer, 'click:edit', @click_edit)\r
@listenTo(@footer, 'click:destroy', @click_destroy)\r
this.$el.append(@insert_point.clear().el)\r
- @rb()\r
+ @append_rb()\r
this.$el.append(body.render().el)\r
this.$el.append(@footer_switch.render().el)\r
this.$el.append(@footer.render().el)\r
@listenTo(@panels, 'dialog:close', @close_dialog)\r
@listenTo(@pager, 'page', @continue)\r
this.$el.append(@panels.render().el)\r
- @rb()\r
+ @append_rb()\r
@appender = new Pettanr.Views.Scroll.PlayModule.Append({\r
})\r
@listenTo(@appender, 'click', @click_append)\r
@appender.enable()\r
this.$el.append(@pager.render().el)\r
this.$el.append(credits.render().el)\r
- @rb()\r
+ @append_rb()\r
this\r
\r
click_credit_icon: (item) ->\r
})\r
this.$el.append(panels.render().el)\r
this.$el.append(credits.render().el)\r
- @rb()\r
+ @append_rb()\r
# paginate(@pager)\r
this\r
\r
this.$el.html('')\r
symbol = new Pettanr.Views.SpeechBalloon.ElementSymbol({element: @element})\r
this.$el.append(symbol.render().el)\r
- @rb()\r
+ @append_rb()\r
this\r
\r
\r
initialize: (options) ->\r
super(options)\r
- @item = options.item\r
+ \r
+ render: () ->\r
+ super()\r
@item.get_parent('panel', this, {\r
success: (@panel) =>\r
@panel_face_button = @panel.mini_face_button({\r
context: this, \r
- click: () ->\r
+ click: () =>\r
@trigger('http_get', @panel.show_url())\r
})\r
@panel.get_parent('author', this, {\r
success: (@author) =>\r
@author_faced_label = @author.mini_faced_label({\r
context: this, \r
- click: () ->\r
+ click: () =>\r
@trigger('http_get', @author.show_url())\r
})\r
- @trigger('ready')\r
+ this.$el.html('')\r
+ this.$el.append(@panel_face_button.render().el)\r
+ this.$el.append(@author_faced_label.render().el)\r
})\r
})\r
- \r
- render: () ->\r
- this.$el.html('')\r
- this.$el.append(@panel_face_button.render().el)\r
- this.$el.append(@author_faced_label.render().el)\r
this\r
\r
\r
initialize: (options) ->\r
super(options)\r
- @item = options.item\r
+ \r
+ render: () ->\r
+ super()\r
@item.get_parent('speech_balloon', this, {\r
success: (@speech_balloon) =>\r
@speech_balloon.get_parent('panel', this, {\r
success: (@panel) =>\r
@panel_face_button = @panel.mini_face_button({\r
context: this, \r
- click: () ->\r
+ click: () =>\r
@trigger('http_get', @panel.show_url())\r
})\r
@panel.get_parent('author', this, {\r
success: (@author) =>\r
@author_faced_label = @author.mini_faced_label({\r
context: this, \r
- click: () ->\r
+ click: () =>\r
@trigger('http_get', @author.show_url())\r
})\r
- @trigger('ready')\r
+ this.$el.html('')\r
+ this.$el.append(@panel_face_button.render().el)\r
+ this.$el.append(@author_faced_label.render().el)\r
})\r
})\r
})\r
- \r
- render: () ->\r
- this.$el.html('')\r
- this.$el.append(@panel_face_button.render().el)\r
- this.$el.append(@author_faced_label.render().el)\r
this\r
\r
this.$el.html('')\r
@logo = new Pettanr.View.Layout.Logo({\r
context: this, \r
- click: () ->\r
+ click: () =>\r
@trigger('http_get', '')\r
})\r
this.$el.append(@logo.render().el)\r
}, \r
artist: {\r
}, \r
+ original_picture: {\r
+ }, \r
system_picture: {\r
}, \r
},\r
belongs_to: {\r
original_picture: {\r
}, \r
+ picture: {\r
+ }, \r
license_group: {\r
}, \r
license: {\r
float: left;
}
-.credit .credit-icon {
+.credit div {
float: left;
}
float: left;
}
+.op-body {
+ float: left;
+}
+
+.op-history {
+ float: left;
+}
+
end
def by_panel
- filer_list
+ filer_list param: params[:id]
end
def by_system_picture
- filer_list
+ filer_list param: params[:id]
end
def show_html_format format
"belongs_to": {\r
"license": {},\r
"artist": {},\r
+ "original_picture": {},\r
"system_picture": {}\r
},\r
"has_many": {\r
"associations": {\r
"belongs_to": {\r
"original_picture": {},\r
+ "picture": {},\r
"license_group": {},\r
"license": {},\r
"artist": {},\r