test_speech_balloon 0.0.53

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +29 -0
  4. data/app/assets/javascripts/test_speech_balloon/application.js +15 -0
  5. data/app/assets/javascripts/test_speech_balloon/balloons.js +2 -0
  6. data/app/assets/javascripts/test_speech_balloon/speech_balloons.js +2 -0
  7. data/app/assets/javascripts/test_speech_balloon/speeches.js +2 -0
  8. data/app/assets/stylesheets/test_speech_balloon/application.css +13 -0
  9. data/app/assets/stylesheets/test_speech_balloon/balloons.css +4 -0
  10. data/app/assets/stylesheets/test_speech_balloon/speech_balloons.css +4 -0
  11. data/app/assets/stylesheets/test_speech_balloon/speeches.css +4 -0
  12. data/app/controllers/test_speech_balloon/application_controller.rb +4 -0
  13. data/app/controllers/test_speech_balloon/balloons_controller.rb +6 -0
  14. data/app/controllers/test_speech_balloon/speech_balloons_controller.rb +6 -0
  15. data/app/controllers/test_speech_balloon/speeches_controller.rb +6 -0
  16. data/app/helpers/test_speech_balloon/application_helper.rb +4 -0
  17. data/app/helpers/test_speech_balloon/balloons_helper.rb +4 -0
  18. data/app/helpers/test_speech_balloon/speech_balloons_helper.rb +4 -0
  19. data/app/helpers/test_speech_balloon/speeches_helper.rb +4 -0
  20. data/app/models/test_speech_balloon/balloon.rb +10 -0
  21. data/app/models/test_speech_balloon/speech.rb +10 -0
  22. data/app/models/test_speech_balloon/speech_balloon.rb +10 -0
  23. data/app/views/layouts/test_speech_balloon/application.html.erb +14 -0
  24. data/app/views/test_speech_balloon/balloons/_form.html.erb +30 -0
  25. data/app/views/test_speech_balloon/speech_balloons/_form.html.erb +41 -0
  26. data/app/views/test_speech_balloon/speech_balloons/_scenario.html.erb +19 -0
  27. data/app/views/test_speech_balloon/speech_balloons/_standard.html.erb +6 -0
  28. data/app/views/test_speech_balloon/speech_balloons/edit.html.erb +7 -0
  29. data/app/views/test_speech_balloon/speech_balloons/new.html.erb +7 -0
  30. data/app/views/test_speech_balloon/speech_balloons/show.html.erb +92 -0
  31. data/app/views/test_speech_balloon/speeches/_form.html.erb +18 -0
  32. data/config/routes.rb +2 -0
  33. data/db/migrate/20130623003554_create_test_speech_balloon_speech_balloons.rb +9 -0
  34. data/db/migrate/20130623003605_create_test_speech_balloon_balloons.rb +9 -0
  35. data/db/migrate/20130623003616_create_test_speech_balloon_speeches.rb +9 -0
  36. data/lib/tasks/test_speech_balloon_tasks.rake +4 -0
  37. data/lib/test_speech_balloon/engine.rb +5 -0
  38. data/lib/test_speech_balloon/version.rb +3 -0
  39. data/lib/test_speech_balloon.rb +99 -0
  40. metadata +100 -0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = TestSpeechBalloon
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'TestSpeechBalloon'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+
28
+ Bundler::GemHelper.install_tasks
29
+
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ module TestSpeechBalloon
2
+ class ApplicationController < ::ApplicationController
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ require_dependency "test_speech_balloon/application_controller"
2
+
3
+ module TestSpeechBalloon
4
+ class BalloonsController < ApplicationController
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ require_dependency "test_speech_balloon/application_controller"
2
+
3
+ module TestSpeechBalloon
4
+ class SpeechBalloonsController < ApplicationController
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ require_dependency "test_speech_balloon/application_controller"
2
+
3
+ module TestSpeechBalloon
4
+ class SpeechesController < ApplicationController
5
+ end
6
+ end
@@ -0,0 +1,4 @@
1
+ module TestSpeechBalloon
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module TestSpeechBalloon
2
+ module BalloonsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module TestSpeechBalloon
2
+ module SpeechBalloonsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module TestSpeechBalloon
2
+ module SpeechesHelper
3
+ end
4
+ end
@@ -0,0 +1,10 @@
1
+ module TestSpeechBalloon
2
+ class Balloon < ActiveRecord::Base
3
+ # attr_accessible :title, :body
4
+ validates :b, :presence => true, :numericality => {:greater_than => 50}
5
+
6
+ def supply_default
7
+ end
8
+
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module TestSpeechBalloon
2
+ class Speech < ActiveRecord::Base
3
+ # attr_accessible :title, :body
4
+ validates :c, :presence => true, :numericality => {:greater_than => 10}
5
+
6
+ def supply_default
7
+ end
8
+
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module TestSpeechBalloon
2
+ class SpeechBalloon < ActiveRecord::Base
3
+ # attr_accessible :title, :body
4
+ validates :a, :presence => true, :length => {:maximum => 1}
5
+
6
+ def supply_default
7
+ end
8
+
9
+ end
10
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>TestSpeechBalloon</title>
5
+ <%= stylesheet_link_tag "test_speech_balloon/application", :media => "all" %>
6
+ <%= javascript_include_tag "test_speech_balloon/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,30 @@
1
+
2
+ <div class="field">
3
+ <%= f.label :x %><br />
4
+ <%= f.number_field :x %>
5
+ </div>
6
+
7
+ <div class="field">
8
+ <%= f.label :y %><br />
9
+ <%= f.number_field :y %>
10
+ </div>
11
+
12
+ <div class="field">
13
+ <%= f.label :width %><br />
14
+ <%= f.number_field :width %>
15
+ </div>
16
+
17
+ <div class="field">
18
+ <%= f.label :height %><br />
19
+ <%= f.number_field :height %>
20
+ </div>
21
+
22
+ <div class="field">
23
+ <%= f.label :settings %><br />
24
+ <%= 'b' %><br />
25
+ <%= number_field_tag 'speech_balloon[balloon_attributes][settings][b]', @speech_balloon.balloon.extend_balloon.b %>
26
+ </div>
27
+
28
+ <%= f.hidden_field :r %>
29
+ <%= f.hidden_field :system_picture_id %>
30
+ <%= f.hidden_field :speech_balloon_id %>
@@ -0,0 +1,41 @@
1
+ <%= form_for(@speech_balloon) do |f| %>
2
+ <%= render 'system/error_explanation', :obj => @speech_balloon %>
3
+ <%= render 'system/error_explanation', :obj => @speech_balloon_extend %>
4
+ <%= render 'system/error_explanation', :obj => @balloon_extend %>
5
+ <%= render 'system/error_explanation', :obj => @speech_extend %>
6
+
7
+ <div class="field">
8
+ <%= f.label :caption %><br />
9
+ <%= f.number_field :caption %>
10
+ </div>
11
+ <div class="field">
12
+ <%= f.label :z %><br />
13
+ <%= f.number_field :z %>
14
+ </div>
15
+ <div class="field">
16
+ <%= f.label :t %><br />
17
+ <%= f.number_field :t %>
18
+ </div>
19
+
20
+ <div class="field">
21
+ <%= f.label :settings %><br />
22
+ <%= 'a' %><br />
23
+ <%= text_field_tag 'speech_balloon[settings][a]', @speech_balloon.extend_speech_balloon.a %>
24
+ </div>
25
+
26
+ <%= f.fields_for(:balloon) do |bf| %>
27
+ <%= render @speech_balloon.speech_balloon_template.engine_name + '/balloons/form', :f => bf %>
28
+ <% end %>
29
+
30
+ <%= f.fields_for(:speech) do |sf| %>
31
+ <%= render @speech_balloon.speech_balloon_template.engine_name + '/speeches/form', :f => sf %>
32
+ <% end %>
33
+
34
+ <%= f.hidden_field :panel_id %>
35
+ <%= f.hidden_field :classname %>
36
+ <%= f.hidden_field :speech_balloon_template_id %>
37
+
38
+ <div class="actions">
39
+ <%= f.submit %>
40
+ </div>
41
+ <% end %>
@@ -0,0 +1,19 @@
1
+ <% if element.speech.quotes.blank? -%>
2
+ <% else -%>
3
+ <style>
4
+ <!--
5
+ #<%= element.speech.dom_item_id('scenario') -%>:before {
6
+ content:"<%= element.speech.arrayed_quotes[0] -%>";
7
+ }
8
+ #<%= element.speech.dom_item_id('scenario') -%>:after {
9
+ content:"<%= element.speech.arrayed_quotes[1] -%>";
10
+ }
11
+ -->
12
+ </style>
13
+ <% end -%>
14
+ <%= content_tag :div, '', element.balloon.tag_attributes('scenario', :class => "test_speech_balloon-balloon-scenario") do %>
15
+ <%= h(element.caption) %>
16
+ <% end %>
17
+ <%= content_tag :div, '', element.speech.tag_attributes('scenario', :class => "test_speech_balloon-speech-scenario") do %>
18
+ <%= h(element.speech.content) %>
19
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <b><%= t_m 'Panel.caption' -%>:</b>
2
+ <%= h(panel.caption) %>
3
+ <%= render 'panels/body', :panel => panel, :author => author, :spot => spot %>
4
+ <%= render 'panels/footer', :panel => panel, :author => author %>
5
+ <%= render 'panels/licensed_pictures', :licensed_pictures => panel.licensed_pictures %>
6
+
@@ -0,0 +1,7 @@
1
+ <h1><%= t('.title') %></h1>
2
+ <p id="notice"><%= notice %></p>
3
+
4
+ <h2><%= t('home.index.catch') -%></h2>
5
+ <%= render 'panels/standard', :panel => @panel, :author => @author %>
6
+ <h2><%= t('speech_balloons.update_speech_balloon') -%></h2>
7
+ <%= render @speech_balloon.speech_balloon_template.engine_name + '/speech_balloons/form' %>
@@ -0,0 +1,7 @@
1
+ <h1><%= t('.title') %></h1>
2
+ <p id="notice"><%= notice %></p>
3
+
4
+ <h2><%= t('home.index.catch') -%></h2>
5
+ <%= render 'panels/standard', :panel => @panel, :author => @author %>
6
+ <h2><%= t('speech_balloons.create_speech_balloon') -%></h2>
7
+ <%= render @speech_balloon.speech_balloon_template.engine_name + '/speech_balloons/form' %>
@@ -0,0 +1,92 @@
1
+ <h1><%= t('.title') %></h1>
2
+ <p id="notice"><%= notice %></p>
3
+
4
+ <%= render 'speech_balloons/standard', :panel => @speech_balloon.panel, :author => @author, :spot => @speech_balloon %>
5
+
6
+ <p>
7
+ <b><%= t_m 'SpeechBalloon.caption' -%>:</b>
8
+ <%= h @speech_balloon.caption %>
9
+ </p>
10
+
11
+ <p>
12
+ <b><%= t_m 'SpeechBalloon.speech_balloon_template_id' -%>:</b>
13
+ <%= link_to h(@speech_balloon.speech_balloon_template.caption), @speech_balloon.speech_balloon_template %>
14
+ </p>
15
+
16
+ <p>
17
+ <b><%= t_m 'SpeechBalloon.classname' -%>:</b>
18
+ <%= @speech_balloon.classname %>
19
+ </p>
20
+
21
+ <p>
22
+ <b><%= t_m 'SpeechBalloon.z' -%>:</b>
23
+ <%= @speech_balloon.z %>
24
+ </p>
25
+
26
+ <p>
27
+ <b><%= t_m 'SpeechBalloon.t' -%>:</b>
28
+ <%= @speech_balloon.t %>
29
+ </p>
30
+
31
+ <p>
32
+ <b><%= t_m 'Balloon.x' -%>:</b>
33
+ <%= @speech_balloon.balloon.x %>
34
+ </p>
35
+
36
+ <p>
37
+ <b><%= t_m 'Balloon.y' -%>:</b>
38
+ <%= @speech_balloon.balloon.y %>
39
+ </p>
40
+
41
+ <p>
42
+ <b><%= t_m 'Balloon.width' -%>:</b>
43
+ <%= @speech_balloon.balloon.width %>
44
+ </p>
45
+
46
+ <p>
47
+ <b><%= t_m 'Balloon.height' -%>:</b>
48
+ <%= @speech_balloon.balloon.height %>
49
+ </p>
50
+
51
+ <p>
52
+ <b><%= t_m 'Balloon.r' -%>:</b>
53
+ <%= @speech_balloon.balloon.r %>
54
+ </p>
55
+
56
+ <p>
57
+ <b><%= t_m 'Speech.content' -%>:</b>
58
+ <%= @speech_balloon.speech.content %>
59
+ </p>
60
+
61
+ <p>
62
+ <b><%= t_m 'Speech.x' -%>:</b>
63
+ <%= @speech_balloon.speech.x %>
64
+ </p>
65
+
66
+ <p>
67
+ <b><%= t_m 'Speech.y' -%>:</b>
68
+ <%= @speech_balloon.speech.y %>
69
+ </p>
70
+
71
+ <p>
72
+ <b><%= t_m 'Speech.width' -%>:</b>
73
+ <%= @speech_balloon.speech.width %>
74
+ </p>
75
+
76
+ <p>
77
+ <b><%= t_m 'Speech.height' -%>:</b>
78
+ <%= @speech_balloon.speech.height %>
79
+ </p>
80
+
81
+ <p>
82
+ <b><%= t_m 'SpeechBalloon.created_at' -%>:</b>
83
+ <%= l @speech_balloon.created_at %>
84
+ </p>
85
+
86
+ <p>
87
+ <b><%= t_m 'SpeechBalloon.updated_at' -%>:</b>
88
+ <%= l @speech_balloon.updated_at %>
89
+ </p>
90
+
91
+ <%= link_to t('link.edit'), pettanr_square_v01_sbt.edit_speech_balloon_path(@speech_balloon) %>
92
+ <%= link_to t('link.destroy'), pettanr_square_v01_sbt.speech_balloon_path(@speech_balloon), :method => :delete %>
@@ -0,0 +1,18 @@
1
+
2
+ <div class="field">
3
+ <%= f.label :content %><br />
4
+ <%= f.number_field :content %>
5
+ </div>
6
+
7
+ <div class="field">
8
+ <%= f.label :settings %><br />
9
+ <%= 'c' %><br />
10
+ <%= number_field_tag 'speech_balloon[speech_attributes][settings][c]', @speech_balloon.speech.extend_speech.c %>
11
+ </div>
12
+
13
+ <%= f.hidden_field :x %>
14
+ <%= f.hidden_field :y %>
15
+ <%= f.hidden_field :width %>
16
+ <%= f.hidden_field :height %>
17
+ <%= f.hidden_field :speech_balloon_id %>
18
+
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ TestSpeechBalloon::Engine.routes.draw do
2
+ end
@@ -0,0 +1,9 @@
1
+ class CreateTestSpeechBalloonSpeechBalloons < ActiveRecord::Migration
2
+ def change
3
+ create_table :test_speech_balloon_speech_balloons do |t|
4
+ t.string :a, :null => false, :limit => 100
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class CreateTestSpeechBalloonBalloons < ActiveRecord::Migration
2
+ def change
3
+ create_table :test_speech_balloon_balloons do |t|
4
+ t.integer :b, :null => false
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class CreateTestSpeechBalloonSpeeches < ActiveRecord::Migration
2
+ def change
3
+ create_table :test_speech_balloon_speeches do |t|
4
+ t.integer :c, :null => false
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :test_speech_balloon do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,5 @@
1
+ module TestSpeechBalloon
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace TestSpeechBalloon
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module TestSpeechBalloon
2
+ VERSION = "0.0.53"
3
+ end
@@ -0,0 +1,99 @@
1
+ require "test_speech_balloon/engine"
2
+
3
+ module TestSpeechBalloon
4
+ module SpeechBalloonModule
5
+ def supply_default
6
+ super
7
+ self.speech_balloon_template_classname = self.speech_balloon_template.classname
8
+ end
9
+
10
+ def speech_balloon_extend
11
+ self.new_speech_balloon unless @speech_balloon_extend
12
+ @speech_balloon_extend
13
+ end
14
+
15
+ def speech_balloon_extend= params
16
+ # load attributes
17
+ @speech_balloon_extend = TestSpeechBalloon::SpeechBalloon.new params
18
+ # no supply default params
19
+ end
20
+
21
+ def new_speech_balloon params = {}
22
+ @speech_balloon_extend = TestSpeechBalloon::SpeechBalloon.new params
23
+ @speech_balloon_extend.supply_default
24
+ end
25
+
26
+ def parsed_settings
27
+ @parsed_settings ||= self.speech_balloon_template.parsed_settings
28
+ end
29
+
30
+ end
31
+
32
+ module BalloonModule
33
+ def supply_default parsed_settings
34
+ s = self.parsed_settings['all']['balloon']
35
+ self.x = 0
36
+ self.y = 0
37
+ self.width = self.parsed_settings['speech_balloon']['default_width']
38
+ self.height = self.parsed_settings['speech_balloon']['default_height']
39
+ self.r = 0
40
+ end
41
+
42
+ def balloon_extend
43
+ self.new_balloon unless @balloon_extend
44
+ @balloon_extend
45
+ end
46
+
47
+ def balloon_extend= params
48
+ @balloon_extend = TestSpeechBalloon::Balloon.new params
49
+ end
50
+
51
+ def new_balloon params = {}
52
+ @balloon_extend = TestSpeechBalloon::Balloon.new params
53
+ @balloon_extend.supply_default
54
+ end
55
+
56
+ def parsed_settings
57
+ @parsed_settings ||= self.speech_balloon_template.parsed_settings
58
+ end
59
+
60
+ def select_system_picture
61
+ s = self.parsed_settings['all']['balloon']
62
+ self.system_picture_id = s['system_picture_id']
63
+ end
64
+
65
+ end
66
+
67
+ module SpeechModule
68
+ def supply_default parsed_settings
69
+ s = self.parsed_settings['all']['speech']
70
+ self.x = s['x_rate']
71
+ self.y = s['y_rate']
72
+ self.width = s['width_rate']
73
+ self.height = s['height_rate']
74
+ self.font_size = self.parsed_settings['speech_balloon']['default_font_size']
75
+ self.text_align = self.parsed_settings['speech_balloon']['default_text_align']
76
+ self.fore_color = self.parsed_settings['speech_balloon']['default_fore_color']
77
+ end
78
+
79
+ def speech_extend
80
+ self.new_speech unless @speech_extend
81
+ @speech_extend
82
+ end
83
+
84
+ def speech_extend= params
85
+ @speech_extend = TestSpeechBalloon::Speech.new params
86
+ end
87
+
88
+ def new_speech params = {}
89
+ @speech_extend = TestSpeechBalloon::Speech.new params
90
+ @speech_extend.supply_default
91
+ end
92
+
93
+ def parsed_settings
94
+ @parsed_settings ||= self.speech_balloon_template.parsed_settings
95
+ end
96
+
97
+ end
98
+
99
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: test_speech_balloon
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.53
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - yasushiito
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-04-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: sqlite3
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: This software is a SpeechBalloon plugin for PettanR
31
+ email:
32
+ - yasusiito@gmail.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - app/assets/javascripts/test_speech_balloon/application.js
38
+ - app/assets/javascripts/test_speech_balloon/balloons.js
39
+ - app/assets/javascripts/test_speech_balloon/speeches.js
40
+ - app/assets/javascripts/test_speech_balloon/speech_balloons.js
41
+ - app/assets/stylesheets/test_speech_balloon/application.css
42
+ - app/assets/stylesheets/test_speech_balloon/balloons.css
43
+ - app/assets/stylesheets/test_speech_balloon/speeches.css
44
+ - app/assets/stylesheets/test_speech_balloon/speech_balloons.css
45
+ - app/controllers/test_speech_balloon/application_controller.rb
46
+ - app/controllers/test_speech_balloon/balloons_controller.rb
47
+ - app/controllers/test_speech_balloon/speeches_controller.rb
48
+ - app/controllers/test_speech_balloon/speech_balloons_controller.rb
49
+ - app/helpers/test_speech_balloon/application_helper.rb
50
+ - app/helpers/test_speech_balloon/balloons_helper.rb
51
+ - app/helpers/test_speech_balloon/speeches_helper.rb
52
+ - app/helpers/test_speech_balloon/speech_balloons_helper.rb
53
+ - app/models/test_speech_balloon/balloon.rb
54
+ - app/models/test_speech_balloon/speech.rb
55
+ - app/models/test_speech_balloon/speech_balloon.rb
56
+ - app/views/layouts/test_speech_balloon/application.html.erb
57
+ - app/views/test_speech_balloon/balloons/_form.html.erb
58
+ - app/views/test_speech_balloon/speeches/_form.html.erb
59
+ - app/views/test_speech_balloon/speech_balloons/edit.html.erb
60
+ - app/views/test_speech_balloon/speech_balloons/new.html.erb
61
+ - app/views/test_speech_balloon/speech_balloons/show.html.erb
62
+ - app/views/test_speech_balloon/speech_balloons/_form.html.erb
63
+ - app/views/test_speech_balloon/speech_balloons/_scenario.html.erb
64
+ - app/views/test_speech_balloon/speech_balloons/_standard.html.erb
65
+ - config/routes.rb
66
+ - db/migrate/20130623003554_create_test_speech_balloon_speech_balloons.rb
67
+ - db/migrate/20130623003605_create_test_speech_balloon_balloons.rb
68
+ - db/migrate/20130623003616_create_test_speech_balloon_speeches.rb
69
+ - lib/tasks/test_speech_balloon_tasks.rake
70
+ - lib/test_speech_balloon/engine.rb
71
+ - lib/test_speech_balloon/version.rb
72
+ - lib/test_speech_balloon.rb
73
+ - MIT-LICENSE
74
+ - Rakefile
75
+ - README.rdoc
76
+ homepage: https://github.com/yasushiito/test_speech_balloon/wiki
77
+ licenses: []
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 1.8.25
97
+ signing_key:
98
+ specification_version: 3
99
+ summary: Test for PettanR SpeechBalloon
100
+ test_files: []