• R/O
  • HTTP
  • SSH
  • HTTPS

pettanr: コミット

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


コミットメタ情報

リビジョンb49c73c78a5625e0b59de9d1a0d5b2f67e853c25 (tree)
日時2015-10-22 11:51:43
作者yasushiito <yas@pen-...>
コミッターyasushiito

ログメッセージ

add: social button

変更サマリ

差分

--- a/app/assets/javascripts/models/balloon.js.coffee
+++ b/app/assets/javascripts/models/balloon.js.coffee
@@ -15,9 +15,13 @@ class Pettanr.Balloon extends Peta.Element
1515 r: 0
1616 }
1717
18+ @pick_item_name: () ->
19+ 'speech_balloon_template'
20+
1821 @trace_routes: () ->
1922 {
2023 speech_balloon: 'speech_balloon',
24+ speech_balloon_template: ['speech_balloon', 'speech_balloon_template'],
2125 symbol: ['speech_balloon', 'speech_balloon_template', 'system_picture']
2226 }
2327
--- a/app/assets/javascripts/models/picture.js.coffee
+++ b/app/assets/javascripts/models/picture.js.coffee
@@ -42,7 +42,7 @@ class Pettanr.Picture extends Peta.Content
4242 symbol_option: (context, options) ->
4343 @retrieve(this, {
4444 success: (symbol_item) =>
45- options.success.call(context, symbol_item.to_symbol())
45+ options.success.call(context, symbol_item.symbol_file())
4646 fail: (response, opt) =>
4747 options.fail.call(context, response, opt)
4848 })
--- a/app/assets/javascripts/models/speech.js.coffee
+++ b/app/assets/javascripts/models/speech.js.coffee
@@ -14,9 +14,13 @@ class Pettanr.Speech extends Peta.Element
1414 height: 100
1515 }
1616
17+ @pick_item_name: () ->
18+ 'speech_balloon_template'
19+
1720 @trace_routes: () ->
1821 {
1922 speech_balloon: 'speech_balloon',
23+ speech_balloon_template: ['speech_balloon', 'speech_balloon_template'],
2024 symbol: ['speech_balloon', 'speech_balloon_template', 'system_picture']
2125 }
2226
--- a/app/assets/javascripts/view/layout.js.coffee
+++ b/app/assets/javascripts/view/layout.js.coffee
@@ -123,6 +123,8 @@ class Pettanr.View.Layout.Sns extends Pettanr.View.Layout.Base
123123 @listenTo(view, 'http_get', @body_http_get)
124124 @listenTo(view, 'http_post', @body_http_post)
125125 @body.refresh(view)
126+ if view.social
127+ view.social.refresh()
126128
127129 body_fail: (response, options) ->
128130 @error_dialog.start(response, options)
--- /dev/null
+++ b/app/assets/javascripts/view/social.js.coffee
@@ -0,0 +1,46 @@
1+class Pettanr.View.Social extends Pettanr.View
2+
3+ constructor: (@item, @context, options) ->
4+ super(options)
5+
6+ initialize: (options) ->
7+ super(options)
8+ @twitter = new Pettanr.View.Social.Twitter()
9+ @facebook = new Pettanr.View.Social.Facebook()
10+ @hatena = new Pettanr.View.Social.Hatena()
11+
12+ render: () ->
13+ this.$el.html('')
14+ this.$el.append(@twitter.render().el)
15+ this.$el.append(@facebook.render().el)
16+ this.$el.append(@hatena.render().el)
17+ this
18+
19+class Pettanr.View.Social.Twitter extends Pettanr.View
20+
21+ render: () ->
22+ this.$el.html('')
23+ this.$el.append('<script type="text/javascript"src="http://platform.twitter.com/widgets.js"></script><a href="http://twitter.com/share" class="twitter-share-button"data-count="horizontal" data-via="opsatwit"data-lang="ja">Tweet</a>')
24+ this
25+
26+ refresh: () ->
27+
28+class Pettanr.View.Social.Facebook extends Pettanr.View
29+
30+ render: () ->
31+ this.$el.html('')
32+ this.$el.append('<div class="fb-like" data-href="' + window.location.href + '" data-layout="button_count" data-action="like" data-show-faces="true" data-share="false"></div>')
33+ this
34+
35+ refresh: () ->
36+ FB.XFBML.parse()
37+
38+class Pettanr.View.Social.Hatena extends Pettanr.View
39+
40+ render: () ->
41+ this.$el.html('')
42+ this.$el.append('<a href="http://b.hatena.ne.jp/entry/" class="hatena-bookmark-button" data-hatena-bookmark-layout="standard-balloon" data-hatena-bookmark-lang="ja" title="add bookmark"><img src="https://b.st-hatena.com/images/entry-button/button-only@2x.png" alt="add hatebu" width="20" height="20" style="border: none;" /></a><script type="text/javascript" src="https://b.st-hatena.com/js/bookmark_button.js" charset="utf-8" async="async"></script>')
43+ this
44+
45+ refresh: () ->
46+
--- a/app/assets/javascripts/views/scrolls/play.js.coffee
+++ b/app/assets/javascripts/views/scrolls/play.js.coffee
@@ -666,6 +666,8 @@ class Pettanr.Views.Scroll.Play extends Pettanr.View.Show
666666 this.$el.append(@header.render().el)
667667 this.$el.append(@authored_by.render().el)
668668 this.$el.append(@body.render().el)
669+ @social = new Pettanr.View.Social()
670+ this.$el.append(@social.render().el)
669671 # this.$el.append(@owner.render().el) if @item.is_own()
670672 this
671673
--- a/app/assets/javascripts/views/scrolls/show.js.coffee
+++ b/app/assets/javascripts/views/scrolls/show.js.coffee
@@ -11,9 +11,22 @@ class Pettanr.Views.Scroll.Show extends Pettanr.View.Show
1111 this.$el.html('')
1212 this.$el.append(@header.render().el)
1313 this.$el.append(@authored_by.render().el)
14+ h3 = new Tag.H3({content: Pettanr.AppHelper.t_m('Scroll.description')})
15+ this.$el.append(h3.render().el)
16+ desc = new Tag.Div({content: @item.escape('description'), class_name: 'scroll-description'})
17+ this.$el.append(desc.render().el)
18+ label_button = new Pettanr.View.Button(@item.play_url(), I18n.t('scrolls.play.title'), {
19+ click: () =>
20+ @trigger('http_get', @item.play_url())
21+ })
22+ h2 = new Tag.H2({content: label_button.render().el})
23+ this.$el.append(h2.render().el)
1424 this.$el.append(@owner.render().el) if @item.is_own()
1525 this
1626
27+ http_get: (url) ->
28+ @trigger('http_get', url)
29+
1730 click_pick: () ->
1831 @trigger('pick', @item)
1932
--- a/app/assets/javascripts/work/forms.js.coffee.erb
+++ b/app/assets/javascripts/work/forms.js.coffee.erb
@@ -1413,6 +1413,7 @@
14131413 tag: {
14141414 type: 'select',
14151415 },
1416+ row_break: true,
14161417 },
14171418 license_settings: {
14181419 # boost_name: 'license_group',
--- a/app/assets/stylesheets/test.css.scss
+++ b/app/assets/stylesheets/test.css.scss
@@ -405,6 +405,12 @@ ul.scenarios_elements {
405405 margin-left: 20px;
406406 }
407407
408+.scroll-description {
409+ margin-left: 20px;
410+ margin-bottom: 20px;
411+ font-size: 1.8em;
412+}
413+
408414 .player {
409415 list-style-type: none;
410416 margin: 0;
@@ -438,6 +444,10 @@ ul.scenarios_elements {
438444 width: 150px;
439445 }
440446
447+.show-owner-footer a {
448+ margin: 0.5em;
449+}
450+
441451 .filer {
442452 list-style-type: none;
443453 margin: 0;
--- a/app/views/layouts/yasapp.html.erb
+++ b/app/views/layouts/yasapp.html.erb
@@ -13,6 +13,16 @@
1313
1414 <div id="pettanr">
1515 </div>
16+<div id="fb-root"></div>
17+ <script>
18+ (function(d, s, id) {
19+ var js, fjs = d.getElementsByTagName(s)[0];
20+ if (d.getElementById(id)) return;
21+ js = d.createElement(s); js.id = id;
22+ js.src = "//connect.facebook.net/ja_JP/sdk.js#xfbml=1&version=v2.5";
23+ fjs.parentNode.insertBefore(js, fjs);
24+ }(document, 'script', 'facebook-jssdk'));
25+ </script>
1626 <script type="text/template" id="header_template">
1727 <span id="logo">
1828 <a class="logo" href="/"><&= title &></a>
--- a/public/local_manifest.json
+++ b/public/local_manifest.json
@@ -3446,7 +3446,8 @@
34463446 "license_id": {
34473447 "tag": {
34483448 "type": "select"
3449- }
3449+ },
3450+ "row_break": true
34503451 },
34513452 "license_settings": {
34523453 "row_break": true
旧リポジトリブラウザで表示