リビジョン | cc2dbf353c285c78423a8a29d7adf233e1651c6e (tree) |
---|---|
日時 | 2015-04-25 11:46:26 |
作者 | yasushiito <yas@pen-...> |
コミッター | yasushiito |
Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
@@ -144,6 +144,8 @@ class Locmare.FormModule.FieldModule.HelperModule.ColorModule.Status extends Bac | ||
144 | 144 | initialize: (options) -> |
145 | 145 | @field = options.field |
146 | 146 | @helper = options.helper |
147 | + @hex = new Tag.Div({}) | |
148 | + @rgb = new Tag.Div({}) | |
147 | 149 | |
148 | 150 | render: () -> |
149 | 151 | @attr = { |
@@ -151,8 +153,6 @@ class Locmare.FormModule.FieldModule.HelperModule.ColorModule.Status extends Bac | ||
151 | 153 | } |
152 | 154 | this.$el.attr(@attr) |
153 | 155 | |
154 | - @hex = new Tag.Div({}) | |
155 | - @rgb = new Tag.Div({}) | |
156 | 156 | this.$el.html('') |
157 | 157 | this.$el.append(@hex.render().el) |
158 | 158 | this.$el.append(@rgb.render().el) |
@@ -4,14 +4,19 @@ class Manifest.ModelModule.AssociationModule.HasOne extends ManifestBase.NameVal | ||
4 | 4 | super() |
5 | 5 | @values['item_name'] ||= @name |
6 | 6 | @values['foreign_key'] ||= @parent.item_name() + '_id' |
7 | + @values['list_action_name'] ||= 'by_' + @parent.item_name() | |
7 | 8 | |
8 | 9 | init: () -> |
9 | 10 | super() |
10 | 11 | @item_name = @values['item_name'] |
11 | 12 | @foreign_key = @values['foreign_key'] |
13 | + @list_action_name = @values['list_action_name'] | |
12 | 14 | |
13 | 15 | is_through: () -> |
14 | - !@through | |
16 | + if @through | |
17 | + true | |
18 | + else | |
19 | + false | |
15 | 20 | |
16 | 21 | model: () -> |
17 | 22 | Manifest.item_name_to_model @item_name |
@@ -9,9 +9,20 @@ class Pettanr.GroundColor extends Peta.Element | ||
9 | 9 | |
10 | 10 | defaults: { |
11 | 11 | id: null, |
12 | - code: 0, | |
12 | + code: 0xeeeeee, | |
13 | + orientation: 0 | |
13 | 14 | } |
14 | 15 | |
16 | + @pick_item_name: () -> | |
17 | + 'ground_color' | |
18 | + | |
19 | + @traceable_item_names: () -> | |
20 | + [] | |
21 | + | |
22 | + pick: (picked_item) -> | |
23 | + { | |
24 | + } | |
25 | + | |
15 | 26 | @has_picture: () -> |
16 | 27 | false |
17 | 28 |
@@ -118,9 +118,10 @@ class Peta.Item extends Backbone.Model | ||
118 | 118 | |
119 | 119 | has_one: (has_one_name) -> |
120 | 120 | has_one_manifest = @my_class().my_manifest().associations.has_one[has_one_name] |
121 | + controller_name = has_one_manifest.model().table_name() | |
121 | 122 | action_name = has_one_manifest.list_action_name |
122 | 123 | Locmare.ListGroup.list( |
123 | - has_one_name, action_name, {id: @get('id')} | |
124 | + controller_name, action_name, {id: @get('id')} | |
124 | 125 | ) |
125 | 126 | |
126 | 127 | boosts: (level) -> |
@@ -5,30 +5,42 @@ class Pettanr.Views.GroundColor.NewElement extends Backbone.View | ||
5 | 5 | initialize: (options) -> |
6 | 6 | @parent = options.parent |
7 | 7 | @target_model = options.target_model |
8 | - @pick_model = @target_model.pick_model() | |
9 | 8 | |
10 | 9 | clear: () -> |
11 | - this.$el.html('new or inspire') | |
10 | + this.$el.html('') | |
11 | + @pick_icon = new Pettanr.Views.Common.PickIcon({name: 'pick'}) | |
12 | + @inspire_icon = new Pettanr.Views.Common.PickIcon({name: 'inspire'}) | |
13 | + @listenTo(@pick_icon, 'click', @pick_click) | |
14 | + @listenTo(@inspire_icon, 'click', @inspire_click) | |
15 | + this.$el.append(@pick_icon.render().el) | |
16 | + this.$el.append(@inspire_icon.render().el) | |
12 | 17 | this |
13 | 18 | |
14 | - render: (form) -> | |
15 | - this.$el.html('') | |
16 | - this.$el.append(@form.render().el) | |
19 | + render: () -> | |
17 | 20 | this |
18 | 21 | |
22 | + pick_click: () -> | |
23 | + model = @target_model | |
24 | + new_item = new model() | |
25 | + # new_item.set({}, {silent: true}) | |
26 | + @success(new_item) | |
27 | + | |
28 | + inspire_click: () -> | |
29 | + params = { | |
30 | + controller: @target_model.path_name(), action: 'index', | |
31 | + page_size: 6, format: 'html' | |
32 | + } | |
33 | + @dialog().start(@target_model, params, null) | |
34 | + @listenTo(@dialog(), 'pick', @pick) | |
35 | + | |
19 | 36 | pick: (item) -> |
20 | - if item.item_name() == @target_model.item_name() | |
21 | - # Inspire | |
22 | - new_item = new @target_model(item.attributes) | |
23 | - else if @target_model.is_traceable(item.item_name()) | |
24 | - # Trace | |
25 | - n = @target_model['trace_from_' + item.item_name()] | |
26 | - n() | |
27 | - else if item.item_name() == @target_model.pick_item_name() | |
28 | - # Pick | |
29 | - model = @target_model.pick_model() | |
30 | - new_item = new model() | |
37 | + new_item = new @target_model(item.attributes) | |
38 | + new_item.unset('id', {silent: true}) | |
39 | + new_item.set({panel_id: @editor().item.get('id')}, {silent: true}) | |
31 | 40 | @dialog().stop() |
41 | + @success(new_item) | |
42 | + | |
43 | + success: (new_item) -> | |
32 | 44 | @set_form(new_item) |
33 | 45 | @trigger('pick', new_item) |
34 | 46 |
@@ -14,7 +14,7 @@ class Pettanr.Views.GroundColor.Symbol extends Backbone.View | ||
14 | 14 | |
15 | 15 | render: () -> |
16 | 16 | this.$el.addClass(@class_name) |
17 | - this.$el.html(@fore_color()) | |
17 | + this.$el.html(@bg_color()) | |
18 | 18 | attr = { |
19 | 19 | style: Pettanr.to_style(@style()) |
20 | 20 | } |
@@ -25,6 +25,8 @@ class Pettanr.Views.GroundPicture.NewElement extends Backbone.View | ||
25 | 25 | if item.item_name() == @target_model.item_name() |
26 | 26 | # Inspire |
27 | 27 | new_item = new @target_model(item.attributes) |
28 | + new_item.unset('id', {silent: true}) | |
29 | + new_item.set({panel_id: @editor().item.get('id')}, {silent: true}) | |
28 | 30 | else if @target_model.is_traceable(item.item_name()) |
29 | 31 | # Trace |
30 | 32 | n = @target_model['trace_from_' + item.item_name()] |
@@ -25,6 +25,8 @@ class Pettanr.Views.PanelPicture.NewElement extends Backbone.View | ||
25 | 25 | if item.item_name() == @target_model.item_name() |
26 | 26 | # Inspire |
27 | 27 | new_item = new @target_model(item.attributes) |
28 | + new_item.unset('id', {silent: true}) | |
29 | + new_item.set({panel_id: @editor().item.get('id')}, {silent: true}) | |
28 | 30 | else if @target_model.is_traceable(item.item_name()) |
29 | 31 | # Trace |
30 | 32 | n = @target_model['trace_from_' + item.item_name()] |
@@ -25,8 +25,26 @@ class Pettanr.Views.SpeechBalloon.NewElement extends Backbone.View | ||
25 | 25 | @listenTo(this, 'ready', @ready) |
26 | 26 | if item.item_name() == @target_model.item_name() |
27 | 27 | # Inspire |
28 | - new_item = new @target_model(item.attributes) | |
29 | - @trigger('ready', new_item) | |
28 | + balloon_list = item.has_one('balloon') | |
29 | + speech_list = item.has_one('speech') | |
30 | + balloon_list.open(() => | |
31 | + balloon = balloon_list.items()[0] | |
32 | + speech_list.open(() => | |
33 | + speech = speech_list.items()[0] | |
34 | + new_item = new @target_model(item.attributes) | |
35 | + new_item.unset('id', {silent: true}) | |
36 | + new_item.set({panel_id: @editor().item.get('id')}, {silent: true}) | |
37 | + balloon.unset('id', {silent: true}) | |
38 | + balloon.unset('speech_balloon_id', {silent: true}) | |
39 | + speech.unset('id', {silent: true}) | |
40 | + speech.unset('speech_balloon_id', {silent: true}) | |
41 | + new_item.boosts 'post' | |
42 | + balloon.boosts 'post' | |
43 | + speech.boosts 'post' | |
44 | + new_item.set({balloon: balloon, speech: speech}, {silent: true}) | |
45 | + @trigger('ready', new_item) | |
46 | + ) | |
47 | + ) | |
30 | 48 | else if @target_model.is_traceable(item.item_name()) |
31 | 49 | # Trace |
32 | 50 | n = @target_model['trace_from_' + item.item_name()] |
@@ -61,7 +61,7 @@ class GroundPicture < Peta::Element | ||
61 | 61 | 'position' => 'absolute', 'top' => '0px', 'left' => '0px', 'z-index' => self.z, |
62 | 62 | 'background-image' => "url(#{self.picture.url})", |
63 | 63 | 'background-repeat' => self.repeat_text, |
64 | - 'background-position' => "#{self.x}px #{self.attr_y}px" | |
64 | + 'background-position' => "#{self.x}px #{self.y}px" | |
65 | 65 | } |
66 | 66 | self.merge_opacity(r, opacity) if spot and spot != self |
67 | 67 | r |