X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fmodels%2Fground_color.js.coffee;h=eff28006101fec113bb197d1d327a792225556a4;hb=289993687b12d7f0b482c7ee04e75b48c19116fa;hp=303398a85cc0ecf48a3b558314ec408d0dc69ca4;hpb=2e1fe642e8bf2e237f6bcfb605d4d26da96fe2e9;p=pettanr%2Fpettanr.git diff --git a/app/assets/javascripts/models/ground_color.js.coffee b/app/assets/javascripts/models/ground_color.js.coffee index 303398a8..eff28006 100644 --- a/app/assets/javascripts/models/ground_color.js.coffee +++ b/app/assets/javascripts/models/ground_color.js.coffee @@ -1,4 +1,6 @@ class Pettanr.GroundColor extends Peta.Element + url: '/ground_colors/' + @singular: () -> 'GroundColor' @@ -7,65 +9,34 @@ class Pettanr.GroundColor extends Peta.Element defaults: { id: null, - code: 0, + code: 0xeeeeee, + orientation: 0 } - @has_picture: () -> - false - - div_offset: () -> - if @get('xy') - @get('xy') - else - 0 + @pick_item_name: () -> + 'ground_color' - div_size: () -> - if @get('wh') - @get('wh') - else - 100 - @div_offset() + @traceable_item_names: () -> + [] - div_x: () -> - if @get('orientation') == 0 - 0 - else - @div_offset() + pick: (picked_item) -> + { + } - div_y: () -> - if @get('orientation') == 0 - @div_offset() - else - 0 + @has_picture: () -> + false - div_width: () -> - if @get('orientation') == 0 - 100 - else - @div_size() + @pick_item_name: () -> + '' - div_height: () -> - if @get('orientation') == 0 - @div_size() - else - 100 + panel: () -> + new Pettanr.Cache.Retriever(Pettanr.Panel, @get('panel_id')) - style: (spot = null, opacity = 20) -> - r = { - position: 'absolute', - 'z-index': @get('z'), - top: Pettanr.to_s(@div_y()) + '%', - left: Pettanr.to_s(@div_x()) + '%', - width: Pettanr.to_s(@div_width()) + '%', - height: Pettanr.to_s(@div_height()) + '%', - 'background-color': '#' + ('000000' + Pettanr.to_s(@get('code'))).slice(-6) - } - @merge_opacity(r, opacity) if spot and spot != this - r + element_face: () -> + new Pettanr.Views.GroundColor.ElementFace({element: this}) - initialize: () -> + initialize: (attr, options) -> + super(attr, options) if @id @url = @url + @id -class Pettanr.GroundColor.Collection extends Backbone.Collection - model: Pettanr.GroundColor - url: '/ground_colors'