• R/O
  • HTTP
  • SSH
  • HTTPS

pettanr: コミット

サーバ側、Railsシステム本体


コミットメタ情報

リビジョン9edc3731389bcae0de05ef6045cceb6b7581cc8f (tree)
日時2015-10-13 07:05:35
作者yasushiito <yas@pen-...>
コミッターyasushiito

ログメッセージ

fix: any

変更サマリ

差分

--- a/app/assets/javascripts/models/speech.js.coffee
+++ b/app/assets/javascripts/models/speech.js.coffee
@@ -39,7 +39,7 @@ class Pettanr.Speech extends Peta.Element
3939
4040 scenario: () ->
4141 @boosts('read')
42- @render(@escape('content'))
42+ @render(Pettanr.to_s(@get('content')))
4343
4444 plain_scenario: () ->
4545 @escape('content')
--- a/app/assets/javascripts/views/scrolls/play.js.coffee
+++ b/app/assets/javascripts/views/scrolls/play.js.coffee
@@ -16,7 +16,7 @@ class Pettanr.Views.Scroll.PlayModule.FooterSwitch extends Pettanr.View
1616 render: () ->
1717 this.$el.html('')
1818 attr = {
19- style: Pettanr.to_style({height: Pettanr.to_s(@panel.get('height')) + 'px'})
19+ style: Pettanr.to_style({height: Pettanr.to_s(@height()) + 'px'})
2020 }
2121 this.$el.attr(attr)
2222 face = if @visible
@@ -28,6 +28,12 @@ class Pettanr.Views.Scroll.PlayModule.FooterSwitch extends Pettanr.View
2828 this.$el.append(caption.render().el) if @enabled
2929 this
3030
31+ height: () ->
32+ if @panel
33+ @panel.get('height')
34+ else
35+ 20
36+
3137 click: () ->
3238 return false if !@enabled
3339 @visible = !@visible
@@ -48,6 +54,7 @@ class Pettanr.Views.Scroll.PlayModule.Footer extends Pettanr.View
4854 className: 'player-item-footer'
4955
5056 initialize: (options) ->
57+ @parent = options.parent
5158 @scroll = options.scroll
5259 @scroll_panel = options.scroll_panel
5360 @panel = options.panel
@@ -55,56 +62,63 @@ class Pettanr.Views.Scroll.PlayModule.Footer extends Pettanr.View
5562 render: () ->
5663 this.$el.html('')
5764 @hide()
58- @panel.get_parent('author', this, {
59- success: (@author) =>
60- @panel_face_button = @panel.mini_face_button({
61- context: this,
62- click: () ->
63- @trigger('click:panel')
64- })
65- @author_face_button = @author.mini_face_button({
66- context: this,
67- click: () ->
68- @trigger('click:author', @author)
69- })
70- l1 = new Tag.H3({
71- content: Pettanr.AppHelper.t_m('Panel')
72- })
73- l2 = new Tag.H3({
74- content: Pettanr.AppHelper.t_m('ScrollPanel')
75- })
76- this.$el.append(l1.render().el)
77- this.$el.append(@panel_face_button.render().el)
78- this.$el.append(@author_face_button.render().el)
79- this.$el.append(
80- Pettanr.AppHelper.distance_of_time_in_words_to_now(@panel.get('updated_at'))
81- )
82- this.$el.append(l2.render().el)
83- if @scroll.is_own()
84- @new_scroll_panel = new Pettanr.ScrollPanel()
85- @insert_button = new Pettanr.View.Button.ItemAction(@new_scroll_panel, 'new', 'scroll_panels.player.before_insert', {
65+ if @panel
66+ @panel.get_parent('author', this, {
67+ success: (@author) =>
68+ @panel_face_button = @panel.mini_face_button({
8669 context: this,
8770 click: () ->
88- @trigger('click:insert')
71+ @trigger('click:panel')
8972 })
90- @move_button = new Pettanr.View.Button.ItemAction(@scroll_panel, 'edit', 'scroll_panels.player.move', {
73+ @author_face_button = @author.mini_face_button({
9174 context: this,
9275 click: () ->
93- @trigger('click:move')
76+ @trigger('click:author', @author)
9477 })
95- @destroy_button = new Pettanr.View.Button.ItemAction(@scroll_panel, 'destroy', 'scroll_panels.player.destroy', {
96- context: this,
97- click: () ->
98- @trigger('click:destroy')
78+ l1 = new Tag.H3({
79+ content: Pettanr.AppHelper.t_m('Panel')
9980 })
100- this.$el.append(@insert_button.render().el)
101- @append_rb()
102- this.$el.append(@move_button.render().el)
103- @append_rb()
104- this.$el.append(@destroy_button.render().el)
105- })
81+ this.$el.append(l1.render().el)
82+ this.$el.append(@panel_face_button.render().el)
83+ this.$el.append(@author_face_button.render().el)
84+ this.$el.append(
85+ Pettanr.AppHelper.distance_of_time_in_words_to_now(@panel.get('updated_at'))
86+ )
87+ @append_scroll_panel()
88+ })
89+ else
90+ @append_scroll_panel()
10691 this
10792
93+ append_scroll_panel: () ->
94+ l2 = new Tag.H3({
95+ content: Pettanr.AppHelper.t_m('ScrollPanel')
96+ })
97+ this.$el.append(l2.render().el)
98+ if @scroll.is_own()
99+ @new_scroll_panel = new Pettanr.ScrollPanel()
100+ @insert_button = new Pettanr.View.Button.ItemAction(@new_scroll_panel, 'new', 'scroll_panels.player.before_insert', {
101+ context: this,
102+ click: () ->
103+ @trigger('click:insert')
104+ })
105+ @move_button = new Pettanr.View.Button.ItemAction(@scroll_panel, 'edit', 'scroll_panels.player.move', {
106+ context: this,
107+ click: () ->
108+ @trigger('click:move')
109+ })
110+ @destroy_button = new Pettanr.View.Button.ItemAction(@scroll_panel, 'destroy', 'scroll_panels.player.destroy', {
111+ context: this,
112+ click: () ->
113+ @trigger('click:destroy')
114+ })
115+ this.$el.append(@insert_button.render().el)
116+ @append_rb()
117+ if @is_movable()
118+ this.$el.append(@move_button.render().el)
119+ @append_rb()
120+ this.$el.append(@destroy_button.render().el)
121+
108122 hide: () ->
109123 attr = {
110124 style: Pettanr.to_style({display: 'none'})
@@ -117,6 +131,9 @@ class Pettanr.Views.Scroll.PlayModule.Footer extends Pettanr.View
117131 }
118132 this.$el.attr(attr)
119133
134+ is_movable: () ->
135+ @parent.parent.views.length > 1
136+
120137 class Pettanr.Views.Scroll.PlayModule.PanelBody extends Pettanr.View
121138 tagName: 'div'
122139 className: 'player-item-panel'
@@ -130,22 +147,36 @@ class Pettanr.Views.Scroll.PlayModule.PanelBody extends Pettanr.View
130147 panel: @panel,
131148 spot: null
132149 })
150+ @listenTo(body, 'http_get', @http_get)
133151 this.$el.append(body.render().el)
134152 this
135153
154+ http_get: (url) ->
155+ @trigger('http_get', url)
156+
136157 class Pettanr.Views.Scroll.PlayModule.Panel extends Pettanr.View
137158 tagName: 'li'
138159 className: 'player-item'
139160
140161 initialize: (options) ->
162+ @parent = options.parent
141163 @scroll = options.scroll
142164 @scroll_panel = options.scroll_panel
165+ @panel = options.panel
143166
144167 clear: () ->
145168 this.$el.html('')
146169 @scroll_panel.get_parent('panel', this, {
147170 success: (@panel) =>
171+ @trigger('exist', this)
148172 @render()
173+ fail: (response, opt) =>
174+ @panel = null
175+ @append_insert_point()
176+ this.$el.append('Not found')
177+ @append_footer_switch()
178+ @append_footer()
179+ @trigger('lost', response, opt)
149180 })
150181 this
151182
@@ -155,44 +186,56 @@ class Pettanr.Views.Scroll.PlayModule.Panel extends Pettanr.View
155186 @panel.fetch({
156187 success: (model, response, opt) =>
157188 @panel.attributes = @panel.decoded_attributes()
189+ @append_insert_point()
158190 body = new Pettanr.Views.Scroll.PlayModule.PanelBody({
159191 panel: @panel
160192 })
161- @footer_switch = new Pettanr.Views.Scroll.PlayModule.FooterSwitch({
162- scroll_panel: @scroll_panel,
163- panel: @panel
164- })
165- @listenTo(@footer_switch, 'click', @click_footer_switch)
166- move_to = new Tag.A({
167- attr: {href: '/' + @scroll_panel.edit_url()},
168- content: I18n.t('scroll_panels.player.move_to')
169- })
170- @insert_point = new Pettanr.Views.Scroll.PlayModule.InsertPoint({
171- class_name: 'insert-point', content: move_to.render().el
172- })
173- @footer = new Pettanr.Views.Scroll.PlayModule.Footer({
174- scroll: @scroll,
175- scroll_panel: @scroll_panel,
176- panel: @panel,
177- })
178- @listenTo(move_to, 'click', @click_move_to)
179- @listenTo(@footer, 'click:panel', @click_show)
180- @listenTo(@footer, 'click:author', @click_author)
181- @listenTo(@footer, 'click:insert', @click_insert)
182- @listenTo(@footer, 'click:move', @click_move)
183- @listenTo(@footer, 'click:edit', @click_edit)
184- @listenTo(@footer, 'click:destroy', @click_destroy)
185- this.$el.append(@insert_point.clear().el)
186- @append_rb()
193+ @listenTo(body, 'http_get', @http_get)
187194 this.$el.append(body.render().el)
188- this.$el.append(@footer_switch.render().el)
189- this.$el.append(@footer.render().el)
195+ @append_footer_switch()
196+ @append_footer()
190197 @trigger('ready', @panel)
191198 error: (item, response, opt) =>
192199 @open_error_dialog(response, opt)
193200 })
194201 this
195202
203+ append_insert_point: () ->
204+ move_to = new Tag.A({
205+ attr: {href: '/' + @scroll_panel.edit_url()},
206+ content: I18n.t('scroll_panels.player.move_to')
207+ })
208+ @insert_point = new Pettanr.Views.Scroll.PlayModule.InsertPoint({
209+ class_name: 'insert-point', content: move_to.render().el
210+ })
211+ @listenTo(move_to, 'click', @click_move_to)
212+ this.$el.append(@insert_point.clear().el)
213+ @append_rb()
214+
215+ append_footer_switch: () ->
216+ @footer_switch = new Pettanr.Views.Scroll.PlayModule.FooterSwitch({
217+ parent: this,
218+ scroll_panel: @scroll_panel,
219+ panel: @panel
220+ })
221+ @listenTo(@footer_switch, 'click', @click_footer_switch)
222+ this.$el.append(@footer_switch.render().el)
223+
224+ append_footer: () ->
225+ @footer = new Pettanr.Views.Scroll.PlayModule.Footer({
226+ parent: this,
227+ scroll: @scroll,
228+ scroll_panel: @scroll_panel,
229+ panel: @panel,
230+ })
231+ @listenTo(@footer, 'click:panel', @click_show)
232+ @listenTo(@footer, 'click:author', @click_author)
233+ @listenTo(@footer, 'click:insert', @click_insert)
234+ @listenTo(@footer, 'click:move', @click_move)
235+ @listenTo(@footer, 'click:edit', @click_edit)
236+ @listenTo(@footer, 'click:destroy', @click_destroy)
237+ this.$el.append(@footer.render().el)
238+
196239 hide: () ->
197240 @set_style({display: 'none'})
198241
@@ -240,6 +283,9 @@ class Pettanr.Views.Scroll.PlayModule.Panel extends Pettanr.View
240283 click_move_to: () ->
241284 @trigger('click:move_to', this)
242285
286+ http_get: (url) ->
287+ @trigger('http_get', url)
288+
243289 class Pettanr.Views.Scroll.PlayModule.InsertPoint extends Tag.Div
244290
245291 clear: () ->
@@ -306,22 +352,28 @@ class Pettanr.Views.Scroll.PlayModule.Panels extends Pettanr.View
306352 append_scroll_panel: (scroll_panel) ->
307353 return if not scroll_panel.has_panel()
308354 panel_view = @create_panel_view(scroll_panel)
355+ @views.push(panel_view)
309356 this.$el.append(panel_view.clear().el)
310357 @refresh_empty_notice()
311358
312359 create_panel_view: (scroll_panel) ->
313360 panel_view = new Pettanr.Views.Scroll.PlayModule.Panel({
314- scroll: @binder, scroll_panel: scroll_panel,
361+ parent: this, scroll: @binder, scroll_panel: scroll_panel,
315362 })
363+ @listenTo(panel_view, 'exist', @exist)
364+ @listenTo(panel_view, 'lost', @lost)
316365 @listenTo(panel_view, 'ready', @ready)
317366 @listenTo(panel_view, 'http_get', @http_get)
318367 @listenTo(panel_view, 'click:insert', @click_insert)
319368 @listenTo(panel_view, 'click:move', @click_move)
320369 @listenTo(panel_view, 'click:destroy', @click_destroy)
321370 @listenTo(panel_view, 'click:move_to', @click_move_to)
322- @views.push(panel_view)
323371 panel_view
324372
373+ exist: (panel_view) ->
374+
375+ lost: (response, opt) ->
376+
325377 ready: (panel) ->
326378 this.credits.push(panel.licensed_pictures())
327379
@@ -545,8 +597,6 @@ class Pettanr.Views.Scroll.PlayModule.Body extends Pettanr.View
545597 if !@pager.hasNextPage()
546598 @appender.enable()
547599 this.$el.append(@pager.render().el)
548- this.$el.append(credits.render().el)
549- @append_rb()
550600 true
551601
552602 click_credit_icon: (item) ->
--- a/app/models/panel_picture.rb
+++ b/app/models/panel_picture.rb
@@ -130,7 +130,7 @@ class PanelPicture < Peta::Element
130130 if self.link =~ /\:\/\//
131131 self.link
132132 else
133- '/' + self.link
133+ '/' + self.link.to_s
134134 end
135135 end
136136
旧リポジトリブラウザで表示