From d2a17869f5a5fb9a33ddad29887c8f03a129c407 Mon Sep 17 00:00:00 2001 From: yasushiito Date: Mon, 27 Jul 2015 14:06:21 +0900 Subject: [PATCH] fix: views --- app/assets/javascripts/editor.js.coffee | 2 +- .../javascripts/editor/panel_editor.js.coffee | 2 +- .../editor/panel_editor/dialog.js.coffee | 2 +- .../editor/panel_editor/scenario/element.js.coffee | 2 +- .../editor/picture_publisher/dialog.js.coffee | 2 +- .../javascripts/locmare/filer/body.js.coffee | 2 +- .../file_body/file_item/summary/template.js.coffee | 6 +- .../locmare/form/field/helper/color.js.coffee | 2 +- .../locmare/list_group/lib/pager.js.coffee | 2 +- .../locmare/list_group/lib/play_pager.js.coffee | 2 +- .../javascripts/models/resource_picture.js.coffee | 5 + app/assets/javascripts/peta/item.js.coffee | 4 + app/assets/javascripts/peta/leaf.js.coffee | 14 +-- app/assets/javascripts/pettanr/inspire.js.coffee | 23 ++--- app/assets/javascripts/view.js.coffee | 15 ++- app/assets/javascripts/view/credit.js.coffee | 9 +- app/assets/javascripts/view/layout.js.coffee | 2 +- app/assets/javascripts/view/show.js.coffee | 7 ++ app/assets/javascripts/view/summary.js.coffee | 14 +-- .../javascripts/view/summary/binder.js.coffee | 20 ++-- app/assets/javascripts/view/summary/leaf.js.coffee | 107 +++++++++++---------- .../javascripts/views/authors/summary.js.coffee | 2 +- .../javascripts/views/balloons/summary.js.coffee | 19 ++-- .../javascripts/views/folders/summary.js.coffee | 1 + .../views/ground_colors/summary.js.coffee | 19 ++-- .../views/ground_pictures/summary.js.coffee | 17 ++-- app/assets/javascripts/views/history.js.coffee | 3 +- .../javascripts/views/licenses/summary.js.coffee | 13 ++- .../views/original_pictures/show.js.coffee | 100 ++++++++++--------- .../views/original_pictures/summary.js.coffee | 19 +--- .../views/panel_pictures/summary.js.coffee | 19 ++-- app/assets/javascripts/views/panels/body.js.coffee | 47 --------- app/assets/javascripts/views/panels/show.js.coffee | 72 ++++++++------ .../javascripts/views/panels/summary.js.coffee | 23 +++-- .../javascripts/views/pictures/history.js.coffee | 21 ++-- .../views/resource_pictures/show.js.coffee | 10 +- .../views/resource_pictures/summary.js.coffee | 13 ++- .../javascripts/views/scrolls/play.js.coffee | 10 +- app/assets/javascripts/views/sheets/play.js.coffee | 2 +- .../views/speech_balloons/element_face.js.coffee | 2 +- .../views/speech_balloons/summary.js.coffee | 17 ++-- .../javascripts/views/speeches/summary.js.coffee | 17 ++-- .../javascripts/views/users/account.js.coffee | 2 +- app/assets/javascripts/work/models.js.coffee.erb | 4 + app/assets/stylesheets/test.css.scss | 10 +- .../speech_balloon_templates_controller.rb | 4 +- public/manifest.json | 2 + 47 files changed, 347 insertions(+), 365 deletions(-) diff --git a/app/assets/javascripts/editor.js.coffee b/app/assets/javascripts/editor.js.coffee index da3b08f2..3aed291f 100644 --- a/app/assets/javascripts/editor.js.coffee +++ b/app/assets/javascripts/editor.js.coffee @@ -71,7 +71,7 @@ class Editor.EditorModule.DockModule.BoardBay extends Editor.EditorModule.DockMo render: () -> this.$el.html('') @el.className = @body.dom_class() - @rb() + @append_rb() this dom_labels_class: () -> diff --git a/app/assets/javascripts/editor/panel_editor.js.coffee b/app/assets/javascripts/editor/panel_editor.js.coffee index ff26b0f0..d22fec91 100644 --- a/app/assets/javascripts/editor/panel_editor.js.coffee +++ b/app/assets/javascripts/editor/panel_editor.js.coffee @@ -49,7 +49,7 @@ class Editor.PanelEditor extends Pettanr.View this.$el.append(@body.render().el) this.$el.append(@dock.render().el) this.$el.append(@credits.render().el) - @rb() + @append_rb() @dock.init_tabs() @dock.$el.tabs() this diff --git a/app/assets/javascripts/editor/panel_editor/dialog.js.coffee b/app/assets/javascripts/editor/panel_editor/dialog.js.coffee index 65ffd9bd..f984f473 100644 --- a/app/assets/javascripts/editor/panel_editor/dialog.js.coffee +++ b/app/assets/javascripts/editor/panel_editor/dialog.js.coffee @@ -14,7 +14,7 @@ class Editor.PanelEditor.Dialog extends Editor.Dialog refresh: (view) -> this.$el.html('') this.$el.append(@history.render().el) - @rb() + @append_rb() this.$el.append(view.el) getter_proxy: () -> diff --git a/app/assets/javascripts/editor/panel_editor/scenario/element.js.coffee b/app/assets/javascripts/editor/panel_editor/scenario/element.js.coffee index 75925c0b..381c325f 100644 --- a/app/assets/javascripts/editor/panel_editor/scenario/element.js.coffee +++ b/app/assets/javascripts/editor/panel_editor/scenario/element.js.coffee @@ -18,7 +18,7 @@ class Editor.EditorModule.DockModule.ScenarioBay.Element extends Pettanr.View }) this.$el.append(@label.render().$el) this.$el.append(@body.render().$el) - @rb() + @append_rb() this refresh: () -> diff --git a/app/assets/javascripts/editor/picture_publisher/dialog.js.coffee b/app/assets/javascripts/editor/picture_publisher/dialog.js.coffee index 593321ad..fbe10f87 100644 --- a/app/assets/javascripts/editor/picture_publisher/dialog.js.coffee +++ b/app/assets/javascripts/editor/picture_publisher/dialog.js.coffee @@ -29,7 +29,7 @@ class Editor.PicturePublisher.Dialog extends Editor.Dialog next: (opl) -> @title({controller: 'original_picture_licenses', action: 'new'}) - @rb() + @append_rb() @form = Locmare.Form.factory({ form_name: opl.item_name(), use_name: 'default', diff --git a/app/assets/javascripts/locmare/filer/body.js.coffee b/app/assets/javascripts/locmare/filer/body.js.coffee index 18faa76d..b882982d 100644 --- a/app/assets/javascripts/locmare/filer/body.js.coffee +++ b/app/assets/javascripts/locmare/filer/body.js.coffee @@ -15,7 +15,7 @@ class Locmare.FilerModule.Body extends Pettanr.View render: () -> this.$el.append(@file_header.render().el) this.$el.append(@file_body.render().el) - @rb() + @append_rb() this manifest: () -> diff --git a/app/assets/javascripts/locmare/filer/body/file_body/file_item/summary/template.js.coffee b/app/assets/javascripts/locmare/filer/body/file_body/file_item/summary/template.js.coffee index 4f1ed3f3..a5d2869e 100644 --- a/app/assets/javascripts/locmare/filer/body/file_body/file_item/summary/template.js.coffee +++ b/app/assets/javascripts/locmare/filer/body/file_body/file_item/summary/template.js.coffee @@ -4,10 +4,10 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SummaryItemCo super(options) render: () -> - view = Pettanr.Views[@item.singular()] - summary = new view[view.summary()]({item: @item}) + summary = @item.summary(this, { + }) @listenTo(summary, 'http_get', @http_get) - this.$el.html(summary.el) + this.$el.html(summary.render().el) this http_get: (url) -> diff --git a/app/assets/javascripts/locmare/form/field/helper/color.js.coffee b/app/assets/javascripts/locmare/form/field/helper/color.js.coffee index 042736c3..12534bc4 100644 --- a/app/assets/javascripts/locmare/form/field/helper/color.js.coffee +++ b/app/assets/javascripts/locmare/form/field/helper/color.js.coffee @@ -19,7 +19,7 @@ class Locmare.FormModule.FieldModule.HelperModule.Color extends Locmare.FormModu this.$el.append(@picker.render().el) this.$el.append(@swatch.render().el) this.$el.append(@status.render().el) - @rb() + @append_rb() this refresh: () -> diff --git a/app/assets/javascripts/locmare/list_group/lib/pager.js.coffee b/app/assets/javascripts/locmare/list_group/lib/pager.js.coffee index 2b706e44..fc58dfb5 100644 --- a/app/assets/javascripts/locmare/list_group/lib/pager.js.coffee +++ b/app/assets/javascripts/locmare/list_group/lib/pager.js.coffee @@ -77,7 +77,7 @@ class Locmare.ListGroupModule.LibModule.PagerModule.Default extends Pettanr.View @listenTo(view, 'navigate', @navigate) @listenTo(view, 'page', @click) this.$el.append(view.render().el) - @rb() + @append_rb() this range: () -> diff --git a/app/assets/javascripts/locmare/list_group/lib/play_pager.js.coffee b/app/assets/javascripts/locmare/list_group/lib/play_pager.js.coffee index 4709e11f..a62d5b8d 100644 --- a/app/assets/javascripts/locmare/list_group/lib/play_pager.js.coffee +++ b/app/assets/javascripts/locmare/list_group/lib/play_pager.js.coffee @@ -20,7 +20,7 @@ class Locmare.ListGroupModule.LibModule.PlayPagerModule.Default extends Locmare. @listenTo(view, 'navigate', @navigate) @listenTo(view, 'page', @click) this.$el.append(view.render().el) - @rb() + @append_rb() this class Locmare.ListGroupModule.LibModule.PlayPagerModule.NextPage extends Locmare.ListGroupModule.LibModule.PagerModule.Part diff --git a/app/assets/javascripts/models/resource_picture.js.coffee b/app/assets/javascripts/models/resource_picture.js.coffee index 6a82a510..7ca045e7 100644 --- a/app/assets/javascripts/models/resource_picture.js.coffee +++ b/app/assets/javascripts/models/resource_picture.js.coffee @@ -10,6 +10,11 @@ class Pettanr.ResourcePicture extends Peta.Content id: null } + @trace_routes: () -> + { + picture: ['resource_picture_picture', 'picture'] + } + is_visible: (operators = Pettanr.cache.operators) -> @is_user_visible(operators) diff --git a/app/assets/javascripts/peta/item.js.coffee b/app/assets/javascripts/peta/item.js.coffee index c3e10843..84f5a576 100644 --- a/app/assets/javascripts/peta/item.js.coffee +++ b/app/assets/javascripts/peta/item.js.coffee @@ -346,6 +346,10 @@ class Peta.Item extends Backbone.Model mini_faced_label: (options) -> new Pettanr.View.MiniFacedLabel(this, options) + summary: (context, options) -> + klass = Pettanr.Views[@singular()].Summary + new klass(this, context, options) + @index_url: () -> Pettanr.url(@table_name(), 'index', {id: null}) diff --git a/app/assets/javascripts/peta/leaf.js.coffee b/app/assets/javascripts/peta/leaf.js.coffee index a9bf4870..89b2ae35 100644 --- a/app/assets/javascripts/peta/leaf.js.coffee +++ b/app/assets/javascripts/peta/leaf.js.coffee @@ -1,17 +1,17 @@ class Peta.Leaf extends Peta.Content - parent_model: () -> - Manifest.manifest().models[@my_class().my_peta().parent_item_name].classify() + @parent_model: () -> + Manifest.manifest().models[@my_peta().parent_item_name].classify() - binder_model: () -> + @binder_model: () -> @parent_model() - destination_model: () -> - Manifest.manifest().models[@my_class().my_peta().destination_item_name].classify() + @destination_model: () -> + Manifest.manifest().models[@my_peta().destination_item_name].classify() - binder_key: () -> + @binder_key: () -> @my_class().my_peta().parent_item_name + '_id' - destination_key: () -> + @destination_key: () -> @my_class().my_peta().destination_item_name + '_id' diff --git a/app/assets/javascripts/pettanr/inspire.js.coffee b/app/assets/javascripts/pettanr/inspire.js.coffee index d967e0a2..1943085c 100644 --- a/app/assets/javascripts/pettanr/inspire.js.coffee +++ b/app/assets/javascripts/pettanr/inspire.js.coffee @@ -1,10 +1,9 @@ class Pettanr.Inspire - constructor: (options) -> + constructor: (@item) -> _.extend(this, Backbone.Events) - @item = options.item - inspire: () -> + go: (context, options) -> @item = @item.with_elements() # retake panel for 'with_elements' mode @item.fetch({cache: false}).done => @item.attributes = @item.replaced_attributes() @@ -12,7 +11,7 @@ class Pettanr.Inspire @item.overwrite({}) @set_root() @set_elements() - @save() + @save(context, options) set_root: () -> @root_form = Locmare.Form.factory({ @@ -34,14 +33,18 @@ class Pettanr.Inspire form.add_elements() form - save: () -> + save: (context, options) -> # merge panel and elements attrs = @root_form.save_data() delete attrs['id'] _.extend(attrs, @elements_save_data()) # save json data by panel form - @listenTo(@root_form, 'success', @post_success) - @listenTo(@root_form, 'fail', @post_fail) + success = (model, response) -> + options.success.call(context, model) + fail = (model, response) -> + options.fail.call(context, response) + @listenTo(@root_form, 'success', success) + @listenTo(@root_form, 'fail', fail) @root_form.save(attrs) elements_save_data: () -> @@ -65,9 +68,3 @@ class Pettanr.Inspire attrs[name].push(d) attrs - post_success: (model, response) -> - @trigger('inspire', model) - - post_fail: (model, response) -> - @trigger('fail', response) - diff --git a/app/assets/javascripts/view.js.coffee b/app/assets/javascripts/view.js.coffee index df7de310..ff1557eb 100644 --- a/app/assets/javascripts/view.js.coffee +++ b/app/assets/javascripts/view.js.coffee @@ -1,18 +1,27 @@ class Pettanr.View extends Backbone.View + render: () -> + this.$el.html('') + icon = new Pettanr.View.Minicon(Pettanr.View.Image.icon_loading_file()) + this.$el.html(icon.render().el) + this + @rb: (options = null) -> - rb = new Tag.RowBreak(options).render().el + new Tag.RowBreak(options).render().el rb: (options = null) -> @constructor.rb(options) + append_rb: (options = null) -> + this.$el.append(@rb()) + div: (content, options = {}) -> options.content = content - new Tag.Span(options) + new Tag.Div(options) span: (content, options = {}) -> options.content = content - new Tag.Div(options) + new Tag.Span(options) @replace_empty: (caption) -> if Pettanr.is_blank(caption) diff --git a/app/assets/javascripts/view/credit.js.coffee b/app/assets/javascripts/view/credit.js.coffee index 8558a799..dd83880c 100644 --- a/app/assets/javascripts/view/credit.js.coffee +++ b/app/assets/javascripts/view/credit.js.coffee @@ -13,7 +13,7 @@ class Pettanr.View.Credit extends Pettanr.View this.$el.html('') if @icon_options icon = new Pettanr.View.Credit.Icon(@item) - @listenTo(icon, 'click:icon', @click_icon) + @listenTo(icon, 'click', @click_icon) this.$el.append(icon.render().el) data = new Pettanr.View.Credit.Data(@item, @data_options) this.$el.append(data.render().el) @@ -33,7 +33,7 @@ class Pettanr.View.Credit.Data extends Pettanr.View @credit_api_url = @item.url + '/credit' render: () -> - this.$el.html('') + super() if @item.credit_data @append_credit_data() else @@ -44,11 +44,12 @@ class Pettanr.View.Credit.Data extends Pettanr.View this append_credit_data: () -> + this.$el.html('') this.$el.append(@item.credit_data) - @rb() + @append_rb() class Pettanr.View.Credit.Icon extends Pettanr.View - tagName: 'span' + tagName: 'div' className: 'credit-icon' constructor: (@item, options) -> diff --git a/app/assets/javascripts/view/layout.js.coffee b/app/assets/javascripts/view/layout.js.coffee index 6f58ac4d..33052a50 100644 --- a/app/assets/javascripts/view/layout.js.coffee +++ b/app/assets/javascripts/view/layout.js.coffee @@ -19,7 +19,7 @@ class Pettanr.View.Layout.Sns extends Pettanr.View.Layout.Base this.$el.html('') this.$el.append(@header.render().el) this.$el.append(@history.render().el) - @rb() + @append_rb() this.$el.append(@body.render().el) this.$el.append(@footer.render().el) this diff --git a/app/assets/javascripts/view/show.js.coffee b/app/assets/javascripts/view/show.js.coffee index af08756b..bc1fe49a 100644 --- a/app/assets/javascripts/view/show.js.coffee +++ b/app/assets/javascripts/view/show.js.coffee @@ -58,8 +58,15 @@ class Pettanr.View.Show extends Pettanr.View @credits = new Pettanr.View.Credits(this, options) @listenTo(@credits, 'click:credit:icon', @click_credit_icon) this.$el.append(@credits.render().el) + @append_rb() @credits.push(@panel.licensed_pictures()) + add_credit: (picture, options = {icon: true}) -> + credit = new Pettanr.View.Credit(picture, options) + this.$el.append(credit.render().el) + @listenTo(credit, 'click:icon', @click_credit_icon) + @append_rb() + click_authored_by: (author) -> @trigger('http_get', author.show_url()) diff --git a/app/assets/javascripts/view/summary.js.coffee b/app/assets/javascripts/view/summary.js.coffee index 16dba531..fae4ca32 100644 --- a/app/assets/javascripts/view/summary.js.coffee +++ b/app/assets/javascripts/view/summary.js.coffee @@ -1,18 +1,8 @@ class Pettanr.View.Summary extends Pettanr.View - constructor: (options) -> + constructor: (@item, @context, options) -> super(options) initialize: (options) -> - @clear() - @listenTo(this, 'ready', @render) - - clear: () -> - icon = new Pettanr.View.Minicon(Pettanr.View.Image.icon_loading_file()) - this.$el.html(icon.render().el) - this - - render: () -> - this.$el.html('') - this + super(options) diff --git a/app/assets/javascripts/view/summary/binder.js.coffee b/app/assets/javascripts/view/summary/binder.js.coffee index 291ac055..0956877a 100644 --- a/app/assets/javascripts/view/summary/binder.js.coffee +++ b/app/assets/javascripts/view/summary/binder.js.coffee @@ -1,33 +1,25 @@ -class Pettanr.View.Summary.Binder extends Pettanr.View +class Pettanr.View.Summary.Binder extends Pettanr.View.Summary initialize: (options) -> super(options) - @item = options.item @visible_t = options.visible_t @visible_column_name = options.visible_column_name - @load() - load: () -> + render: () -> + super() @visible = new Tag.Div({ content: Pettanr.AppHelper.t_selected_item(@visible_t, @item.get(@visible_column_name)) }) @item.get_parent('author', this, { success: (@author) => @author_mini_faced_label = @author.mini_faced_label({ - context: this, + context: @context, click: () => @trigger('http_get', @author.show_url()) }) + this.$el.html('') + this.$el.append(@visible.render().el) this.$el.append(@author_mini_faced_label.render().el) - @trigger('ready') }) - - render: () -> - this.$el.html('') - this.$el.append(@visible.render().el) - this.$el.append(@author_mini_faced_label.render().el) this - author_click: () -> - @trigger('http_get', @author_icon_with_caption.url()) - diff --git a/app/assets/javascripts/view/summary/leaf.js.coffee b/app/assets/javascripts/view/summary/leaf.js.coffee index 7adf4eda..c5488ad6 100644 --- a/app/assets/javascripts/view/summary/leaf.js.coffee +++ b/app/assets/javascripts/view/summary/leaf.js.coffee @@ -1,76 +1,83 @@ -class Pettanr.View.Summary.Leaf extends Pettanr.View +class Pettanr.View.Summary.Leaf extends Pettanr.View.Summary initialize: (options) -> super(options) - @item = options.item - @binder = new Pettanr.View.Summary.Leaf.Binder(@item, {}) - @destination = new Pettanr.View.Summary.Leaf.Binder(@item, options.destination_item_name, {}) - @load() + @binder = new Pettanr.View.Summary.Leaf.Binder(@item, @context) + @destination = new Pettanr.View.Summary.Leaf.Destination(@item, @context) - load: () -> - @listenTo(this, 'load_binder', @load_destination) - @listenTo(this, 'load_destination', @ready) - @load_binder() + render: () -> + super() + this.$el.html('') + this.$el.append(@binder.render().el) + this.$el.append(@destination.render().el) + this - ready: () -> - @trigger('ready') + http_get: (url) -> + @trigger('http_get', url) - load_binder: () -> +class Pettanr.View.Summary.Leaf.Binder extends Pettanr.View + tagName: 'span' - load_destination: () -> - @item.get_parent(@destination_item_name, this, { - success: (@destination) => - @destination_icon = @destination.icon_view(true) - @listenTo(@destination_icon, 'click', @destination_click) - @destination.get_parent('author', this, { - success: (@destination_author) => - @destination_author_mini_faced_label = @destination_author.mini_faced_label({ - context: this, + constructor: (@item, @context, options) -> + @binder_model = @item.my_class().binder_model() + super(options) + + initialize: (options) -> + super(options) + + render: () -> + super() + @item.get_parent(@binder_model.item_name(), this, { + success: (@binder) => + @face_button = @binder.mini_face_button({ + context: @context, + click: () => + @trigger('http_get', @binder.show_url()) + }) + @binder.get_parent('author', this, { + success: (@author) => + @author_mini_faced_label = @author.mini_faced_label({ + context: @context, click: () => - @trigger('http_get', @destination_author.show_url()) + @trigger('http_get', @author.show_url()) }) - this.$el.append(@destination_author_mini_faced_label.render().el) - @trigger('load_destination') + this.$el.html('') + this.$el.append(@face_button.render().el) + this.$el.append(@author_mini_faced_label.render().el) }) }) - - render: () -> - this.$el.html('') - this.$el.append(@binder_author_mini_faced_label.render().el) - this.$el.append(@destination_author_mini_faced_label.render().el) this - binder_click: () -> - @trigger('http_get', @binder_icon.url()) - - destination_click: () -> - @trigger('http_get', @destination_icon.url()) +class Pettanr.View.Summary.Leaf.Destination extends Pettanr.View + tagName: 'span' - binder_author_click: () -> - @trigger('http_get', @binder_author_icon_with_caption.url()) - - destination_author_click: () -> - @trigger('http_get', @destination_author_icon_with_caption.url()) - -class Pettanr.View.Summary.Leaf.Binder extends Tag.Span - - constructor: (@item, @binder_item_name, options) -> + constructor: (@item, @context, options) -> + @destination_model = @item.my_class().destination_model() super(options) - @binder_model = @item.my_class().binder_model() initialize: (options) -> - @item.get_parent(@binder_model.item_name(), this, { - success: (@binder) => - @face_button = @binder.mini_face_button(true) - @binder.get_parent('author', this, { + super(options) + + render: () -> + super() + @item.get_parent(@destination_model.item_name(), this, { + success: (@destination) => + @face_button = @destination.mini_face_button({ + context: @context, + click: () => + @trigger('http_get', @binder.show_url()) + }) + @destination.get_parent('author', this, { success: (@author) => @author_mini_faced_label = @author.mini_faced_label({ - context: this, + context: @context, click: () => @trigger('http_get', @author.show_url()) }) + this.$el.html('') + this.$el.append(@face_button.render().el) this.$el.append(@author_mini_faced_label.render().el) - @trigger('load_binder') }) }) + this diff --git a/app/assets/javascripts/views/authors/summary.js.coffee b/app/assets/javascripts/views/authors/summary.js.coffee index c8a97eca..f251a902 100644 --- a/app/assets/javascripts/views/authors/summary.js.coffee +++ b/app/assets/javascripts/views/authors/summary.js.coffee @@ -2,9 +2,9 @@ class Pettanr.Views.Author.Summary extends Pettanr.View.Summary initialize: (options) -> super(options) - @trigger('ready') render: () -> + super() this.$el.html('') this.$el.append('-') this diff --git a/app/assets/javascripts/views/balloons/summary.js.coffee b/app/assets/javascripts/views/balloons/summary.js.coffee index c83ab0ae..dd089a55 100644 --- a/app/assets/javascripts/views/balloons/summary.js.coffee +++ b/app/assets/javascripts/views/balloons/summary.js.coffee @@ -2,31 +2,30 @@ class Pettanr.Views.Balloon.Summary extends Pettanr.View.Summary initialize: (options) -> super(options) - @item = options.item + + render: () -> + super() @item.get_parent('speech_balloon', this, { success: (@speech_balloon) => @speech_balloon.get_parent('panel', this, { success: (@panel) => @panel_face_button = @panel.mini_face_button({ context: this, - click: () -> + click: () => @trigger('http_get', @panel.show_url()) }) @panel.get_parent('author', this, { success: (@author) => @author_faced_label = @author.mini_faced_label({ context: this, - click: () -> + click: () => @trigger('http_get', @author.show_url()) - }) - @trigger('ready') + }) + this.$el.html('') + this.$el.append(@panel_face_button.render().el) + this.$el.append(@author_faced_label.render().el) }) }) }) - - render: () -> - this.$el.html('') - this.$el.append(@panel_face_button.render().el) - this.$el.append(@author_faced_label.render().el) this diff --git a/app/assets/javascripts/views/folders/summary.js.coffee b/app/assets/javascripts/views/folders/summary.js.coffee index 0c0c7058..105de4ee 100644 --- a/app/assets/javascripts/views/folders/summary.js.coffee +++ b/app/assets/javascripts/views/folders/summary.js.coffee @@ -5,6 +5,7 @@ class Pettanr.Views.Folder.Summary extends Pettanr.View.Summary @trigger('ready') render: () -> + super() this.$el.html('') this.$el.append('-') this diff --git a/app/assets/javascripts/views/ground_colors/summary.js.coffee b/app/assets/javascripts/views/ground_colors/summary.js.coffee index 4793d034..3462eb54 100644 --- a/app/assets/javascripts/views/ground_colors/summary.js.coffee +++ b/app/assets/javascripts/views/ground_colors/summary.js.coffee @@ -2,28 +2,27 @@ class Pettanr.Views.GroundColor.Summary extends Pettanr.View.Summary initialize: (options) -> super(options) - @item = options.item + + render: () -> + super() @item.get_parent('panel', this, { success: (@panel) => @panel_face_button = @panel.mini_face_button({ - context: this, - click: () -> + context: @context, + click: () => @trigger('http_get', @panel.show_url()) }) @panel.get_parent('author', this, { success: (@author) => @author_faced_label = @author.mini_faced_label({ context: this, - click: () -> + click: () => @trigger('http_get', @author.show_url()) }) - @trigger('ready') + this.$el.html('') + this.$el.append(@panel_face_button.render().el) + this.$el.append(@author_faced_label.render().el) }) }) - - render: () -> - this.$el.html('') - this.$el.append(@panel_face_button.render().el) - this.$el.append(@author_faced_label.render().el) this diff --git a/app/assets/javascripts/views/ground_pictures/summary.js.coffee b/app/assets/javascripts/views/ground_pictures/summary.js.coffee index ff79981c..c858b3db 100644 --- a/app/assets/javascripts/views/ground_pictures/summary.js.coffee +++ b/app/assets/javascripts/views/ground_pictures/summary.js.coffee @@ -2,24 +2,23 @@ class Pettanr.Views.GroundPicture.Summary extends Pettanr.View.Summary initialize: (options) -> super(options) - @item = options.item + + render: () -> + super() @item.get_parent('picture', this, { success: (@picture) => - @credit = new Pettanr.View.Credit(@picture, {}) + @credit = new Pettanr.View.Credit(@picture, {icon: false}) @item.get_parent('panel', this, { success: (@panel) => @panel_face_button = @panel.mini_face_button({ context: this, - click: () -> + click: () => @trigger('http_get', @panel.show_url()) }) - @trigger('ready') + this.$el.html('') + this.$el.append(@credit.render().el) + this.$el.append(@panel_face_button.render().el) }) }) - - render: () -> - this.$el.html('') - this.$el.append(@credit.render().el) - this.$el.append(@panel_face_button.render().el) this diff --git a/app/assets/javascripts/views/history.js.coffee b/app/assets/javascripts/views/history.js.coffee index 843c93e8..7e315798 100644 --- a/app/assets/javascripts/views/history.js.coffee +++ b/app/assets/javascripts/views/history.js.coffee @@ -116,8 +116,7 @@ class Pettanr.Views.History.Root extends Pettanr.View tagName: 'div' initialize: (options) -> - image = new Pettanr.ImageFile(Pettanr.View.Image.icon_root_file()) - icon = new Pettanr.View.Icon(image) + icon = new Pettanr.View.Minicon(Pettanr.View.Image.icon_root_file()) @button = new Pettanr.View.Button('/', icon.render().el, { context: this, click: () => diff --git a/app/assets/javascripts/views/licenses/summary.js.coffee b/app/assets/javascripts/views/licenses/summary.js.coffee index 53140ca5..d2c7f6a4 100644 --- a/app/assets/javascripts/views/licenses/summary.js.coffee +++ b/app/assets/javascripts/views/licenses/summary.js.coffee @@ -2,15 +2,14 @@ class Pettanr.Views.License.Summary extends Pettanr.View.Summary initialize: (options) -> super(options) - @item = options.item + + render: () -> + super() @item.get_parent('system_picture', this, { success: (@system_picture) => - @img = new Pettanr.View.Icon(@system_picture.symbol_file()) - @trigger('ready') + this.$el.html('') + @img = @system_picture.real_picture() + this.$el.html(@img.render().el) }) - - render: () -> - this.$el.html('') - this.$el.html(@img.render().el) this diff --git a/app/assets/javascripts/views/original_pictures/show.js.coffee b/app/assets/javascripts/views/original_pictures/show.js.coffee index 2e04f4d2..4b2bbca7 100644 --- a/app/assets/javascripts/views/original_pictures/show.js.coffee +++ b/app/assets/javascripts/views/original_pictures/show.js.coffee @@ -1,46 +1,47 @@ -class Pettanr.Views.OriginalPicture.ShowModule -class Pettanr.Views.OriginalPicture.ShowModule.History extends Pettanr.View +class Pettanr.Views.OriginalPicture.Show extends Pettanr.View.Show initialize: (options) -> - super(options) - @item = options.item - @list = @item.history() + @header = new Pettanr.View.Show.Header(@item, this, @default_header_options()) + @authored_by = @item.authored_by() + @listenTo(@header, 'click:pick', @click_pick) + @listenTo(@authored_by, 'click', @click_authored_by) + @body = new Pettanr.Views.OriginalPicture.Show.Body(@item, {}) + @history = new Pettanr.Views.OriginalPicture.Show.History(@item, {}) + @listenTo(@history, 'http_get', @http_get) render: () -> this.$el.html('') - h = new Tag.H2({ - content: I18n.t('original_pictures.show.history') - }) - this.$el.append(h.render().el) - @list.fetch().done => - _.each @list.models, (picture) => - view = picture.history_view() - @listenTo(view, 'http_get', @http_get) - this.$el.append(view.render().el) + this.$el.append(@header.render().el) + this.$el.append(@authored_by.render().el) + this.$el.append(@body.render().el) + this.$el.append(@history.render().el) this http_get: (url) -> @trigger('http_get', url) -class Pettanr.Views.OriginalPicture.Show extends Pettanr.View.Show + is_pickable: () -> + false + +class Pettanr.Views.OriginalPicture.Show.Body extends Pettanr.View + className: 'op-body' + + constructor: (@item, options) -> + super(options) initialize: (options) -> - @header = new Pettanr.View.Show.Header(@item, this, @default_header_options()) - @authored_by = @item.authored_by() @img = @item.real_picture() - @listenTo(@header, 'click:pick', @click_pick) - @listenTo(@authored_by, 'click', @click_authored_by) @owner = new Pettanr.View.Show.Footer(@item, this, { actions: { select: { - url: @original_picture.license_url(), + url: @item.license_url(), dic_name: 'original_pictures.show.select', click: () => @create_dialog() @trigger('click:license', @dialog) }, replace: { - url: @original_picture.edit_url(), + url: @item.edit_url(), dic_name: 'original_pictures.show.replace', click: () => @trigger('http_get', @item.edit_url()) @@ -54,31 +55,17 @@ class Pettanr.Views.OriginalPicture.Show extends Pettanr.View.Show }, }, }) - @history = new Pettanr.Views.OriginalPicture.ShowModule.History({item: @item}) - @listenTo(@history, 'http_get', @http_get) + @summary = @item.summary(this, {}) + @listenTo(@summary, 'http_get', @http_get) render: () -> this.$el.html('') - this.$el.append(@header.render().el) - this.$el.append(@authored_by.render().el) this.$el.append(@img.render().el) - @item.get_parent('picture', this, { - success: (@picture) => - @credit = new Pettanr.View.Credit(@picture, { - icon: { - click: () => - @trigger('http_get', @picture.show_url()) - } - }) - this.$el.append(@credit.render().el) - this.$el.append(@owner.render().el) - }) - this.$el.append(@history.render().el) + this.$el.append(@summary.render().el) + @append_rb() + this.$el.append(@owner.render().el) this - http_get: (url) -> - @trigger('http_get', url) - create_dialog: () -> @dialog = new Editor.PicturePublisher.Dialog({ parent: this @@ -99,9 +86,6 @@ class Pettanr.Views.OriginalPicture.Show extends Pettanr.View.Show @dialog.start(params, null) @dialog - is_pickable: () -> - false - success: (resource_picture) -> #Pettanr.cache.fix(@item) @trigger('success', @params, @dialog) @@ -112,3 +96,33 @@ class Pettanr.Views.OriginalPicture.Show extends Pettanr.View.Show #Pettanr.cache.release(@item) @trigger('click:close', @dialog) +class Pettanr.Views.OriginalPicture.Show.History extends Pettanr.View + className: 'op-history' + + constructor: (@item, options) -> + super(options) + + initialize: (options) -> + super(options) + controller = Manifest.manifest().controllers['original_pictures'] + action = controller.actions['history'] + @list = action.find(id: @item.get('id')) + + render: () -> + this.$el.html('') + h = new Tag.H2({ + content: I18n.t('original_pictures.show.history') + }) + this.$el.append(h.render().el) + @list.open(this, { + success: (pictures) => + _.each pictures, (picture) => + history = new Pettanr.Views.Picture.History(picture) + @listenTo(history, 'http_get', @http_get) + this.$el.append(history.render().el) + }) + this + + http_get: (url) -> + @trigger('http_get', url) + diff --git a/app/assets/javascripts/views/original_pictures/summary.js.coffee b/app/assets/javascripts/views/original_pictures/summary.js.coffee index 2979ef08..9a911cc7 100644 --- a/app/assets/javascripts/views/original_pictures/summary.js.coffee +++ b/app/assets/javascripts/views/original_pictures/summary.js.coffee @@ -3,33 +3,24 @@ class Pettanr.Views.OriginalPicture.Summary extends Pettanr.View.Summary initialize: (options) -> super(options) - @item = options.item - @load() - - load: () -> - @trigger('ready') render: () -> - this.$el.html('') + super() @visible = new Tag.Span({ class_name: 'state', content: I18n.t('original_pictures.' + @item.state()) }) + this.$el.html('') this.$el.append(@visible.render().el) @item.get_child('resource_picture', this, { success: (@resource_picture) => if @resource_picture - @item.get_parent('picture', this, { + @resource_picture.get_parent('picture', this, { success: (@picture) => - @credit = new Pettanr.View.Credit(@picture, {icon: true}) - @listenTo(@credit, 'click:icon', @picture_click) + @credit = new Pettanr.View.Credit(@picture, {icon: false}) this.$el.append(@credit.render().el) + @append_rb() }) }) - @rb() this - # in credit - picture_click: (picture) -> - @trigger('http_get', picture.show_url()) - diff --git a/app/assets/javascripts/views/panel_pictures/summary.js.coffee b/app/assets/javascripts/views/panel_pictures/summary.js.coffee index b8bf1944..5bc98719 100644 --- a/app/assets/javascripts/views/panel_pictures/summary.js.coffee +++ b/app/assets/javascripts/views/panel_pictures/summary.js.coffee @@ -2,24 +2,23 @@ class Pettanr.Views.PanelPicture.Summary extends Pettanr.View.Summary initialize: (options) -> super(options) - @item = options.item + + render: () -> + super() @item.get_parent('picture', this, { success: (@picture) => - @credit = new Pettanr.View.Credit(@picture, {}) + @credit = new Pettanr.View.Credit(@picture, {icon: false}) @item.get_parent('panel', this, { success: (@panel) => - @panel_face_button =@panel.mini_face_button({ + @panel_face_button = @panel.mini_face_button({ context: this, - click: () -> + click: () => @trigger('http_get', @panel.show_url()) }) - @trigger('ready') + this.$el.html('') + this.$el.append(@credit.render().el) + this.$el.append(@panel_face_button.render().el) }) }) - - render: () -> - this.$el.html('') - this.$el.append(@credit.render().el) - this.$el.append(@panel_face_button.render().el) this diff --git a/app/assets/javascripts/views/panels/body.js.coffee b/app/assets/javascripts/views/panels/body.js.coffee index d458d4f9..48f79b61 100644 --- a/app/assets/javascripts/views/panels/body.js.coffee +++ b/app/assets/javascripts/views/panels/body.js.coffee @@ -112,50 +112,3 @@ class Pettanr.Views.Panel.Body.Edit extends Pettanr.Views.Panel.Body element_class: (element) -> Pettanr.Views[element.singular()].Element.Edit -class Pettanr.Views.Panel.Footer extends Pettanr.View - tagName: 'table' - className: 'no-border' - - initialize: (options) -> - @panel = options.panel - - render: () -> - this.$el.html('') - @panel.get_parent('author', this, { - success: (@author) => - panel_face_button = @panel.mini_face_button({ - context: this, - click: () -> - @trigger('click:panel') - }) - author_face_button = @author.mini_face_button({ - context: this, - click: () -> - @trigger('click:author') - }) - this.$el.append(panel_face_button.render().el) - this.$el.append(author_face_button.render().el) - this.$el.append( - Pettanr.AppHelper.distance_of_time_in_words_to_now(@panel.get('updated_at')) - ) - if Pettanr.cache.operators.is_author() - inspire_button = Pettanr.View.mini_face_button( - @panel, - Pettanr.View.Image.icon_inspire_file(), - { - context: this, - click: () => - @trigger('click:inspire') - } - ) - this.$el.append(inspire_icon.render().el) - if @panel.is_own() - edit_button = new Pettanr.View.Button.ItemAction(@panel, 'edit', { - context: this, - click: () => - @trigger('click:edit') - }) - this.$el.append(edit_button.render().el) - }) - this - diff --git a/app/assets/javascripts/views/panels/show.js.coffee b/app/assets/javascripts/views/panels/show.js.coffee index 3c06ee97..34cb4067 100644 --- a/app/assets/javascripts/views/panels/show.js.coffee +++ b/app/assets/javascripts/views/panels/show.js.coffee @@ -1,52 +1,35 @@ # panel: panel item # spot: no opacity element -class Pettanr.Views.Panel.Show extends Pettanr.View +class Pettanr.Views.Panel.Show extends Pettanr.View.Show - initialize: (@panel, options) -> + initialize: (options) -> + @panel = @item @spot = options.spot @header = new Pettanr.View.Show.Header(@item, this, @default_header_options()) + @authored_by = @item.authored_by() @body = new Pettanr.Views.Panel.Body({ panel: @panel, spot: @spot }) - @footer = new Pettanr.Views.Panel.Footer({ - panel: @panel, + inspire = new Pettanr.Inspire(@panel, this, ) + @footer = new Pettanr.Views.Panel.Show.Footer(@panel, { + inspire: inspire }) - @owner = new Pettanr.Views.Panel.ShowModule.Owner({item: @panel}) + @owner = new Pettanr.View.Show.Footer(@item, this, @default_footer_options()) @listenTo(@header, 'click:pick', @click_pick) - @listenTo(@footer, 'click:panel', @click_show) - @listenTo(@footer, 'click:author', @click_author) - @listenTo(@footer, 'click:edit', @click_edit) - @listenTo(@footer, 'click:inspire', @click_inspire) - @listenTo(@owner, 'click:edit', @click_edit) - @listenTo(@owner, 'click:destroy', @click_destroy) + @listenTo(@authored_by, 'click', @click_authored_by) render: () -> this.$el.html('') this.$el.append(@header.render().el) + this.$el.append(@authored_by.render().el) this.$el.append(@body.render().el) this.$el.append(@footer.render().el) @add_credits() - this.$el.append(@owner.render().el) + this.$el.append(@owner.render().el) if @item.is_own() this - click_author: () -> - @trigger('http_get', @panel.author().show_url()) - - click_edit: () -> - @trigger('http_get', @panel.edit_url()) - - click_destroy: () -> - redirect = (url) => - @trigger('http_get', url) - Pettanr.Proxy.destroy(@panel, {redirect: redirect}) - - click_inspire: () -> - inspire = new Pettanr.Inspire({item: @panel}) - @listenTo(inspire, 'inspire', @inspire) - inspire.inspire() - click_pick: () -> @trigger('pick', @item) @@ -56,6 +39,35 @@ class Pettanr.Views.Panel.Show extends Pettanr.View add_pick: (target_model) -> @header.add_pick(target_model) - inspire: (item) -> - @trigger('http_get', item.show_url()) +class Pettanr.Views.Panel.Show.Footer extends Pettanr.View + tagName: 'ul' + + constructor: (@panel, options) -> + super(options) + + initialize: (options) -> + @inspire = options.inspire + + render: () -> + super() + this.$el.html('') + this.$el.append( + Pettanr.AppHelper.distance_of_time_in_words_to_now(@panel.get('updated_at')) + ) + if Pettanr.cache.operators.is_author() + inspire_button = Pettanr.View.mini_face_button( + @panel, + Pettanr.View.Image.icon_inspire_file(), { + context: this, + click: () => + @inspire.go(@inspire.context, { + success: (item) -> + @trigger('http_get', item.show_url()) + fail: (response) -> + console.log(response) + }) + } + ) + this.$el.append(inspire_button.render().el) + this diff --git a/app/assets/javascripts/views/panels/summary.js.coffee b/app/assets/javascripts/views/panels/summary.js.coffee index 8153d4a6..df706005 100644 --- a/app/assets/javascripts/views/panels/summary.js.coffee +++ b/app/assets/javascripts/views/panels/summary.js.coffee @@ -2,27 +2,26 @@ class Pettanr.Views.Panel.Summary extends Pettanr.View.Summary initialize: (options) -> super(options) - @item = options.item options['visible_t'] = 'panel_publish_items' options['visible_column_name'] = 'publish' @visible_t = options.visible_t @visible_column_name = options.visible_column_name + + render: () -> + super() @item.get_parent('author', this, { success: (@author) => @visible = new Tag.Div({ content: Pettanr.AppHelper.t_selected_item(@visible_t, @item.get(@visible_column_name)) }) - @author_icon_with_caption = @author.icon_with_caption_view(true, 'name', 12) - @listenTo(@author_icon_with_caption, 'click', @author_click) - @trigger('ready') + @author_mini_faced_label = @author.mini_faced_label({ + context: @context, + click: () => + @trigger('http_get', @author.show_url()) + }) + this.$el.html('') + this.$el.append(@visible.render().el) + this.$el.append(@author_mini_faced_label.render().el) }) - - render: () -> - this.$el.html('') - this.$el.append(@visible.render().el) - this.$el.append(@author_icon_with_caption.render().el) this - author_click: () -> - @trigger('http_get', @author_icon_with_caption.url()) - diff --git a/app/assets/javascripts/views/pictures/history.js.coffee b/app/assets/javascripts/views/pictures/history.js.coffee index 16b6c9a0..58e4fc45 100644 --- a/app/assets/javascripts/views/pictures/history.js.coffee +++ b/app/assets/javascripts/views/pictures/history.js.coffee @@ -6,28 +6,29 @@ class Pettanr.Views.Picture.History extends Pettanr.View render: () -> this.$el.html('') - r = new Tag.A({ - attr: {href: '/' + @item.show_url()}, - content: @item.get('revision') + r = new Pettanr.View.Button(@item.show_url(), @item.get('revision'), { + context: this, + click: () => + @trigger('http_get', @item.show_url()) }) - @listenTo(r, 'click', @click_show) h = new Tag.H3({ content: Pettanr.AppHelper.t_m('Picture.revision') + ':' }) d = new Tag.Div({ content: Pettanr.AppHelper.t_m('Picture.created_at') + ':' + @item.get('created_at') }) - credit = @item.credit_view() - @listenTo(credit, 'click:icon', @click_icon) this.$el.append(h.render().el) h.$el.append(r.render().el) this.$el.append(d.render().el) - this.$el.append(credit.render().el) + @add_credit(@item) this - click_show: () -> + click_credit_icon: () -> @trigger('http_get', @item.show_url()) - click_icon: () -> - @trigger('http_get', @item.show_url()) + add_credit: (picture, options = {icon: true}) -> + credit = new Pettanr.View.Credit(picture, options) + this.$el.append(credit.render().el) + @listenTo(credit, 'click:icon', @click_credit_icon) + @append_rb() diff --git a/app/assets/javascripts/views/resource_pictures/show.js.coffee b/app/assets/javascripts/views/resource_pictures/show.js.coffee index 905d8de4..4d3fe3d9 100644 --- a/app/assets/javascripts/views/resource_pictures/show.js.coffee +++ b/app/assets/javascripts/views/resource_pictures/show.js.coffee @@ -42,14 +42,8 @@ class Pettanr.Views.ResourcePicture.Show extends Pettanr.View.Show }, }) @item.get_parent('picture', this, { - success: (@picture) => - @credit = new Pettanr.View.Credit(@picture, { - icon: { - click: () => - @trigger('http_get', @picture.show_url()) - } - }) - this.$el.append(@credit.render().el) + success: (picture) => + @add_credit(picture) this.$el.append(@owner.render().el) }) }) diff --git a/app/assets/javascripts/views/resource_pictures/summary.js.coffee b/app/assets/javascripts/views/resource_pictures/summary.js.coffee index 5ae01e97..4ffdbb47 100644 --- a/app/assets/javascripts/views/resource_pictures/summary.js.coffee +++ b/app/assets/javascripts/views/resource_pictures/summary.js.coffee @@ -2,15 +2,14 @@ class Pettanr.Views.ResourcePicture.Summary extends Pettanr.View.Summary initialize: (options) -> super(options) - @item = options.item + + render: () -> + super() @item.get_parent('picture', this, { success: (@picture) => - @credit = new Pettanr.View.Credit(@picture, {}) - @trigger('ready') + @credit = new Pettanr.View.Credit(@picture, {icon: false}) + this.$el.html('') + this.$el.append(@credit.render().el) }) - - render: () -> - this.$el.html('') - this.$el.append(@credit.render().el) this diff --git a/app/assets/javascripts/views/scrolls/play.js.coffee b/app/assets/javascripts/views/scrolls/play.js.coffee index 87d56258..9ebf743f 100644 --- a/app/assets/javascripts/views/scrolls/play.js.coffee +++ b/app/assets/javascripts/views/scrolls/play.js.coffee @@ -83,9 +83,9 @@ class Pettanr.Views.Scroll.PlayModule.Footer extends Pettanr.View this.$el.append(l2.render().el) if @scroll.is_own() this.$el.append(@insert_button.render().el) - @rb() + @append_rb() this.$el.append(@move_button.render().el) - @rb() + @append_rb() this.$el.append(@destroy_button.render().el) }) this @@ -182,7 +182,7 @@ class Pettanr.Views.Scroll.PlayModule.Panel extends Pettanr.View @listenTo(@footer, 'click:edit', @click_edit) @listenTo(@footer, 'click:destroy', @click_destroy) this.$el.append(@insert_point.clear().el) - @rb() + @append_rb() this.$el.append(body.render().el) this.$el.append(@footer_switch.render().el) this.$el.append(@footer.render().el) @@ -473,7 +473,7 @@ class Pettanr.Views.Scroll.PlayModule.Body extends Pettanr.View @listenTo(@panels, 'dialog:close', @close_dialog) @listenTo(@pager, 'page', @continue) this.$el.append(@panels.render().el) - @rb() + @append_rb() @appender = new Pettanr.Views.Scroll.PlayModule.Append({ }) @listenTo(@appender, 'click', @click_append) @@ -482,7 +482,7 @@ class Pettanr.Views.Scroll.PlayModule.Body extends Pettanr.View @appender.enable() this.$el.append(@pager.render().el) this.$el.append(credits.render().el) - @rb() + @append_rb() this click_credit_icon: (item) -> diff --git a/app/assets/javascripts/views/sheets/play.js.coffee b/app/assets/javascripts/views/sheets/play.js.coffee index ba8d7661..763d7544 100644 --- a/app/assets/javascripts/views/sheets/play.js.coffee +++ b/app/assets/javascripts/views/sheets/play.js.coffee @@ -104,7 +104,7 @@ class Pettanr.Views.Sheet.PlayModule.Body extends Pettanr.View }) this.$el.append(panels.render().el) this.$el.append(credits.render().el) - @rb() + @append_rb() # paginate(@pager) this diff --git a/app/assets/javascripts/views/speech_balloons/element_face.js.coffee b/app/assets/javascripts/views/speech_balloons/element_face.js.coffee index cbf96697..99588864 100644 --- a/app/assets/javascripts/views/speech_balloons/element_face.js.coffee +++ b/app/assets/javascripts/views/speech_balloons/element_face.js.coffee @@ -28,6 +28,6 @@ class Pettanr.Views.SpeechBalloon.ElementFace extends Pettanr.View this.$el.html('') symbol = new Pettanr.Views.SpeechBalloon.ElementSymbol({element: @element}) this.$el.append(symbol.render().el) - @rb() + @append_rb() this diff --git a/app/assets/javascripts/views/speech_balloons/summary.js.coffee b/app/assets/javascripts/views/speech_balloons/summary.js.coffee index 89948a65..a5323c60 100644 --- a/app/assets/javascripts/views/speech_balloons/summary.js.coffee +++ b/app/assets/javascripts/views/speech_balloons/summary.js.coffee @@ -2,28 +2,27 @@ class Pettanr.Views.SpeechBalloon.Summary extends Pettanr.View.Summary initialize: (options) -> super(options) - @item = options.item + + render: () -> + super() @item.get_parent('panel', this, { success: (@panel) => @panel_face_button = @panel.mini_face_button({ context: this, - click: () -> + click: () => @trigger('http_get', @panel.show_url()) }) @panel.get_parent('author', this, { success: (@author) => @author_faced_label = @author.mini_faced_label({ context: this, - click: () -> + click: () => @trigger('http_get', @author.show_url()) }) - @trigger('ready') + this.$el.html('') + this.$el.append(@panel_face_button.render().el) + this.$el.append(@author_faced_label.render().el) }) }) - - render: () -> - this.$el.html('') - this.$el.append(@panel_face_button.render().el) - this.$el.append(@author_faced_label.render().el) this diff --git a/app/assets/javascripts/views/speeches/summary.js.coffee b/app/assets/javascripts/views/speeches/summary.js.coffee index aab236a1..eb6aa3e5 100644 --- a/app/assets/javascripts/views/speeches/summary.js.coffee +++ b/app/assets/javascripts/views/speeches/summary.js.coffee @@ -2,31 +2,30 @@ class Pettanr.Views.Speech.Summary extends Pettanr.View.Summary initialize: (options) -> super(options) - @item = options.item + + render: () -> + super() @item.get_parent('speech_balloon', this, { success: (@speech_balloon) => @speech_balloon.get_parent('panel', this, { success: (@panel) => @panel_face_button = @panel.mini_face_button({ context: this, - click: () -> + click: () => @trigger('http_get', @panel.show_url()) }) @panel.get_parent('author', this, { success: (@author) => @author_faced_label = @author.mini_faced_label({ context: this, - click: () -> + click: () => @trigger('http_get', @author.show_url()) }) - @trigger('ready') + this.$el.html('') + this.$el.append(@panel_face_button.render().el) + this.$el.append(@author_faced_label.render().el) }) }) }) - - render: () -> - this.$el.html('') - this.$el.append(@panel_face_button.render().el) - this.$el.append(@author_faced_label.render().el) this diff --git a/app/assets/javascripts/views/users/account.js.coffee b/app/assets/javascripts/views/users/account.js.coffee index 5f20f468..a8ec80c7 100644 --- a/app/assets/javascripts/views/users/account.js.coffee +++ b/app/assets/javascripts/views/users/account.js.coffee @@ -10,7 +10,7 @@ class Pettanr.Views.User.Account extends Pettanr.View this.$el.html('') @logo = new Pettanr.View.Layout.Logo({ context: this, - click: () -> + click: () => @trigger('http_get', '') }) this.$el.append(@logo.render().el) diff --git a/app/assets/javascripts/work/models.js.coffee.erb b/app/assets/javascripts/work/models.js.coffee.erb index ef01e4c6..5c51e4a4 100644 --- a/app/assets/javascripts/work/models.js.coffee.erb +++ b/app/assets/javascripts/work/models.js.coffee.erb @@ -1122,6 +1122,8 @@ }, artist: { }, + original_picture: { + }, system_picture: { }, }, @@ -1233,6 +1235,8 @@ belongs_to: { original_picture: { }, + picture: { + }, license_group: { }, license: { diff --git a/app/assets/stylesheets/test.css.scss b/app/assets/stylesheets/test.css.scss index 6a610bf1..95ee688c 100644 --- a/app/assets/stylesheets/test.css.scss +++ b/app/assets/stylesheets/test.css.scss @@ -748,7 +748,7 @@ ul.pagination li { float: left; } -.credit .credit-icon { +.credit div { float: left; } @@ -764,3 +764,11 @@ ul.pagination li { float: left; } +.op-body { + float: left; +} + +.op-history { + float: left; +} + diff --git a/app/controllers/speech_balloon_templates_controller.rb b/app/controllers/speech_balloon_templates_controller.rb index 2b38a27c..574bb5ac 100644 --- a/app/controllers/speech_balloon_templates_controller.rb +++ b/app/controllers/speech_balloon_templates_controller.rb @@ -14,11 +14,11 @@ class SpeechBalloonTemplatesController < ApplicationController 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 diff --git a/public/manifest.json b/public/manifest.json index ed9e2d2b..b29c1875 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -2466,6 +2466,7 @@ "belongs_to": { "license": {}, "artist": {}, + "original_picture": {}, "system_picture": {} }, "has_many": { @@ -2569,6 +2570,7 @@ "associations": { "belongs_to": { "original_picture": {}, + "picture": {}, "license_group": {}, "license": {}, "artist": {}, -- 2.11.0