circle_speech_balloon 0.0.36 → 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/assets/javascripts/circle_speech_balloon/circle_speech_balloon.js.coffee +13 -0
- data/app/views/circle_speech_balloon/balloons/_form.html.erb +3 -5
- data/app/views/circle_speech_balloon/speeches/_form.html.erb +16 -30
- data/lib/circle_speech_balloon/version.rb +1 -1
- metadata +3 -3
- data/app/assets/javascripts/circle_speech_balloon/balloons.js.coffee +0 -99
@@ -0,0 +1,13 @@
|
|
1
|
+
class PettanrCircleSpeechBalloon
|
2
|
+
WritingFormat = window.PettanrWritingFormat
|
3
|
+
@engine_name = 'circle_speech_balloon'
|
4
|
+
@id = 0
|
5
|
+
@onLoad = () ->
|
6
|
+
PettanrCircleSpeechBalloon.id = window.PettanrSpeechBalloonTemplate.id(PettanrCircleSpeechBalloon.engine_name)
|
7
|
+
|
8
|
+
@add_helper = (opt) ->
|
9
|
+
RHelper = window.PettanrBalloonRHelper
|
10
|
+
RHelper.add_helper($('.r-wrap'))
|
11
|
+
|
12
|
+
window.PettanrSpeechBalloonTemplate.scripts[PettanrCircleSpeechBalloon.engine_name] = PettanrCircleSpeechBalloon
|
13
|
+
@PettanrCircleSpeechBalloon = PettanrCircleSpeechBalloon
|
@@ -2,11 +2,9 @@
|
|
2
2
|
<div class="field">
|
3
3
|
<%= f.label :r %>
|
4
4
|
<%= f.number_field :r, balloon.field_tag_attributes(:r, no_attr, :size => 5) %>
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
<button class="r-reset" value="0">reset</button>
|
9
|
-
</span>
|
5
|
+
<% if balloon.has_helper?(:r) %>
|
6
|
+
<%= render balloon.form_helper_template(:r), :elm => balloon, :no_attr => no_attr %>
|
7
|
+
<% end %>
|
10
8
|
</div>
|
11
9
|
|
12
10
|
<div class="field">
|
@@ -1,46 +1,32 @@
|
|
1
1
|
<div class="field">
|
2
|
-
<%= f.label :writing_format_id
|
3
|
-
<%= f.collection_select :writing_format_id, WritingFormat.list.map {|l| [l.caption, l.id] },
|
2
|
+
<%= f.label :writing_format_id %>
|
3
|
+
<%= f.collection_select :writing_format_id, WritingFormat.list.map {|l| [l.caption, l.id] }, *speech.select_tag_attributes(speech.writing_format_id, :writing_format_id, no_attr) %>
|
4
|
+
|
5
|
+
<%= f.label :font_size %>
|
6
|
+
<%= f.collection_select :font_size, t_select_items(MagicNumber['speech_font_size_items']), *speech.select_tag_attributes(speech.font_size, :font_size, no_attr) %>
|
4
7
|
</div>
|
5
8
|
|
6
9
|
<div class="field">
|
7
|
-
<%= f.label :
|
8
|
-
<%= f.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
<%= f.label :font_size %><br />
|
13
|
-
<%= f.collection_select :font_size, t_select_items(MagicNumber['speech_font_size_items']), :last, :first, {:html => {:selected => speech.font_size}}, speech.field_tag_attributes(:font_size, no_attr) %>
|
10
|
+
<%= f.label :text_align %>
|
11
|
+
<%= f.collection_select :text_align, t_select_items(MagicNumber['speech_text_align_items']), *speech.select_tag_attributes(speech.text_align, :text_align, no_attr) %>
|
12
|
+
|
13
|
+
<%= f.label :quotes %>
|
14
|
+
<%= f.text_field :quotes, speech.field_tag_attributes(:quotes, no_attr, :size => 5) %>
|
14
15
|
</div>
|
15
16
|
|
16
17
|
<div class="field">
|
17
|
-
<%= f.label :
|
18
|
-
<%= f.
|
18
|
+
<%= f.label :content %><br />
|
19
|
+
<%= f.text_area :content, speech.field_tag_attributes(:content, no_attr, :size => ' 45x5') %>
|
19
20
|
</div>
|
20
21
|
|
21
22
|
<div class="field">
|
22
23
|
<%= f.label :fore_color %>
|
23
24
|
<%= f.text_field :fore_color, speech.field_tag_attributes(:fore_color, no_attr, :size => 8) %>
|
24
|
-
|
25
|
-
<div class="
|
26
|
-
|
27
|
-
<div id="<%= speech.tag_id(:code_green) -%>" class="colorpicker-green"></div>
|
28
|
-
<div id="<%= speech.tag_id(:code_blue) -%>" class="colorpicker-blue"></div>
|
25
|
+
<% if speech.has_helper?(:fore_color) %>
|
26
|
+
<div class="speech-fore_color-wrap">
|
27
|
+
<%= render speech.form_helper_template(:fore_color), :elm => speech, :no_attr => no_attr %>
|
29
28
|
</div>
|
30
|
-
|
31
|
-
<div id="<%= speech.tag_id(:code_swatch) -%>" class="ui-widget-content ui-corner-all code_swatch"></div>
|
32
|
-
</div>
|
33
|
-
<div style="float: left;">
|
34
|
-
<div id="<%= speech.tag_id(:code_hex) -%>"></div>
|
35
|
-
<div id="<%= speech.tag_id(:code_rgb) -%>"></div>
|
36
|
-
</div>
|
37
|
-
<div style="clear: both;"></div>
|
38
|
-
</div>
|
39
|
-
</div>
|
40
|
-
|
41
|
-
<div class="field">
|
42
|
-
<%= f.label :quotes %>
|
43
|
-
<%= f.text_field :quotes, speech.field_tag_attributes(:quotes, no_attr, :size => 5) %>
|
29
|
+
<% end %>
|
44
30
|
</div>
|
45
31
|
|
46
32
|
<%= f.hidden_field :x, speech.field_tag_attributes(:x, no_attr) %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: circle_speech_balloon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.37
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -51,7 +51,7 @@ extensions: []
|
|
51
51
|
extra_rdoc_files: []
|
52
52
|
files:
|
53
53
|
- app/assets/javascripts/circle_speech_balloon/application.js
|
54
|
-
- app/assets/javascripts/circle_speech_balloon/
|
54
|
+
- app/assets/javascripts/circle_speech_balloon/circle_speech_balloon.js.coffee
|
55
55
|
- app/assets/stylesheets/circle_speech_balloon/application.css
|
56
56
|
- app/assets/stylesheets/circle_speech_balloon/balloons.css
|
57
57
|
- app/assets/stylesheets/circle_speech_balloon/speeches.css
|
@@ -1,99 +0,0 @@
|
|
1
|
-
$ ->
|
2
|
-
# balloon r helper
|
3
|
-
balloon_input_r = (btn) ->
|
4
|
-
wrapper = $(btn).parent()
|
5
|
-
balloon_trace = '#panel' + $(wrapper).attr('panel_id') + 'speech_balloon' + $(wrapper).attr('element_id') + 'balloon' + $(wrapper).attr('element_part_id')
|
6
|
-
input_r = $(balloon_trace + 'r')
|
7
|
-
input_r
|
8
|
-
balloon_r_step = () ->
|
9
|
-
circle_speech_balloon_settings['speech_balloon']['r_step']
|
10
|
-
balloon_next_index = (input_r, r_step, d) ->
|
11
|
-
v = parseInt(input_r.val()) + r_step * d
|
12
|
-
tr = v % 360
|
13
|
-
tr = 360 + tr if tr < 0
|
14
|
-
offset = r_step / 2.0
|
15
|
-
idx = Math.floor(((tr + offset) % 360) / r_step)
|
16
|
-
if idx == 0
|
17
|
-
ir = 0
|
18
|
-
else
|
19
|
-
if v < 0
|
20
|
-
ir = Math.floor(idx * r_step) - 360
|
21
|
-
else
|
22
|
-
ir = Math.floor(idx * r_step)
|
23
|
-
input_r.val(ir)
|
24
|
-
idx
|
25
|
-
balloon_index = (input_r, r_step) ->
|
26
|
-
v = parseInt(input_r.val())
|
27
|
-
tr = v % 360
|
28
|
-
tr = 360 + tr if tr < 0
|
29
|
-
offset = r_step / 2.0
|
30
|
-
idx = Math.floor(((tr + offset) % 360) / r_step)
|
31
|
-
idx
|
32
|
-
refresh_balloon = (bln, idx) ->
|
33
|
-
sp_id = circle_speech_balloon_settings[String(idx)]['balloon']['system_picture_id']
|
34
|
-
fn = '/system_pictures/' + String(sp_id) + '.png'
|
35
|
-
ofn = bln.attr('src')
|
36
|
-
if fn == ofn
|
37
|
-
else
|
38
|
-
if bln.attr('src')
|
39
|
-
bln.attr('src', fn)
|
40
|
-
balloon_trace = '#panel' + $(bln).attr('panel_id') + 'speech_balloon' + $(bln).attr('element_id') + 'balloon' + $(bln).attr('element_part_id')
|
41
|
-
$(balloon_trace + 'system_picture_id').val(sp_id)
|
42
|
-
myform = (input) ->
|
43
|
-
div_trace = '#panel' + $(input).attr('panel_id') + 'speech_balloon' + $(input).attr('element_id') + 'balloon' + $(input).attr('element_part_id')
|
44
|
-
classname = $(div_trace + 'form').attr('classname')
|
45
|
-
if classname == 'CircleSpeechBalloon'
|
46
|
-
r = true
|
47
|
-
else
|
48
|
-
r = false
|
49
|
-
r
|
50
|
-
|
51
|
-
$('input').map ->
|
52
|
-
if $(@).attr('element_type') and $(@).attr('element_type') == 'speech_balloon' and $(@).attr('column') == 'r'
|
53
|
-
if myform($(@))
|
54
|
-
$(@).spinner {
|
55
|
-
spin: ( event, ui ) ->
|
56
|
-
balloon_trace = '#panel' + $(@).attr('panel_id') + 'speech_balloon' + $(@).attr('element_id') + 'balloon' + $(@).attr('element_part_id')
|
57
|
-
r_step = balloon_r_step()
|
58
|
-
idx = balloon_index($(balloon_trace + 'r'), r_step)
|
59
|
-
refresh_balloon($(balloon_trace), idx)
|
60
|
-
}
|
61
|
-
|
62
|
-
$('.r-wrap').map ->
|
63
|
-
$(@).css('display', 'block')
|
64
|
-
|
65
|
-
$('.r-down').map ->
|
66
|
-
$(@).click ->
|
67
|
-
r_step = balloon_r_step()
|
68
|
-
idx = balloon_next_index(balloon_input_r($(@)), r_step, -1)
|
69
|
-
wrapper = $(@).parent()
|
70
|
-
balloon_trace = '#panel' + $(wrapper).attr('panel_id') + 'speech_balloon' + $(wrapper).attr('element_id') + 'balloon' + $(wrapper).attr('element_part_id')
|
71
|
-
refresh_balloon($(balloon_trace), idx)
|
72
|
-
false
|
73
|
-
$('.r-up').map ->
|
74
|
-
$(@).click ->
|
75
|
-
r_step = balloon_r_step()
|
76
|
-
idx = balloon_next_index(balloon_input_r($(@)), r_step, 1)
|
77
|
-
wrapper = $(@).parent()
|
78
|
-
balloon_trace = '#panel' + $(wrapper).attr('panel_id') + 'speech_balloon' + $(wrapper).attr('element_id') + 'balloon' + $(wrapper).attr('element_part_id')
|
79
|
-
refresh_balloon($(balloon_trace), idx)
|
80
|
-
false
|
81
|
-
$('.r-reset').map ->
|
82
|
-
$(@).click ->
|
83
|
-
wrapper = $(@).parent()
|
84
|
-
balloon_trace = '#panel' + $(wrapper).attr('panel_id') + 'speech_balloon' + $(wrapper).attr('element_id') + 'balloon' + $(wrapper).attr('element_part_id')
|
85
|
-
balloon_input_r($(@)).val(0)
|
86
|
-
refresh_balloon($(balloon_trace), 0)
|
87
|
-
false
|
88
|
-
|
89
|
-
# sync view
|
90
|
-
$('input').map ->
|
91
|
-
if $(@).attr('element_type') and $(@).attr('element_type') == 'speech_balloon'
|
92
|
-
if myform($(@))
|
93
|
-
$(@).focusout ->
|
94
|
-
switch $(@).attr('column')
|
95
|
-
when 'r'
|
96
|
-
balloon_trace = '#panel' + $(@).attr('panel_id') + 'speech_balloon' + $(@).attr('element_id') + 'balloon' + $(@).attr('element_part_id')
|
97
|
-
r_step = balloon_r_step()
|
98
|
-
idx = balloon_index($(balloon_trace + 'r'), r_step)
|
99
|
-
refresh_balloon($(balloon_trace), idx)
|