• R/O
  • HTTP
  • SSH
  • HTTPS

pettanr: コミット

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


コミットメタ情報

リビジョン2bd5f6aca898d5227ba35115a6cf0a09cffb1746 (tree)
日時2013-10-28 10:43:03
作者yasushiito <yas@pen-...>
コミッターyasushiito

ログメッセージ

Merge branch 'v06sheet' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06sheet

変更サマリ

差分

--- a/Gemfile
+++ b/Gemfile
@@ -33,6 +33,7 @@ end
3333
3434 gem 'jquery-rails'
3535 gem 'jquery-ui-rails'
36+gem "jquery-validation-rails"
3637
3738 # To use ActiveModel has_secure_password
3839 gem 'bcrypt-ruby', '~> 3.0.0'
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -7,7 +7,11 @@
77 //= require jquery
88 //= require jquery_ujs
99 //= require jquery.ui.all
10+//= require jquery.validate
11+//= require jquery.validate.additional-methods
12+//= require jquery.validate.localization/messages_ja
1013 //= require textchange
14+//= require configurations
1115 //= require pettanr_editor
1216 //= require pettanr_sheeter
1317 //= require writing_formats
--- /dev/null
+++ b/app/assets/javascripts/configurations.js.coffee
@@ -0,0 +1,1486 @@
1+@configurations = {
2+ models: {
3+ Panel: 'panel',
4+ panel: {
5+ class_name: 'Panel',
6+ table_name: 'panels',
7+ attributes: {
8+ id: {
9+ type: 'number',
10+ primary_key: 1,
11+ rules : {
12+ number: true,
13+ }
14+ },
15+ width: {
16+ type: 'number',
17+ rules : {
18+ required: true,
19+ number: true,
20+ min: 1,
21+ }
22+ },
23+ height: {
24+ type: 'number',
25+ rules : {
26+ required: true,
27+ number: true,
28+ min: 1,
29+ }
30+ },
31+ border: {
32+ type: 'number',
33+ rules : {
34+ required: true,
35+ number: true,
36+ min: 0,
37+ }
38+ },
39+ caption: {
40+ type: 'text',
41+ rules : {
42+ }
43+ },
44+ publish: {
45+ type: 'number',
46+ rules : {
47+ required: true,
48+ number: true,
49+ }
50+ },
51+ author_id: {
52+ type: 'number',
53+ rules : {
54+ required: true,
55+ number: true,
56+ }
57+ },
58+ created_at: {
59+ type: 'datetime',
60+ },
61+ updated_at: {
62+ type: 'datetime',
63+ }
64+ }
65+ },
66+ PanelPicture: 'panel_picture',
67+ panel_picture: {
68+ class_name: 'PanelPicture',
69+ table_name: 'panel_pictures',
70+ attributes: {
71+ id: {
72+ type: 'number',
73+ primary_key: 1,
74+ rules : {
75+ number: true,
76+ }
77+ },
78+ panel_id: {
79+ type: 'number',
80+ rules : {
81+ number: true,
82+ }
83+ },
84+ picture_id: {
85+ type: 'number',
86+ rules : {
87+ required: true,
88+ number: true,
89+ }
90+ },
91+ caption: {
92+ type: 'text',
93+ rules : {
94+ }
95+ },
96+ x: {
97+ type: 'number',
98+ rules : {
99+ required: true,
100+ number: true,
101+ }
102+ },
103+ y: {
104+ type: 'number',
105+ rules : {
106+ required: true,
107+ number: true,
108+ }
109+ },
110+ width: {
111+ type: 'number',
112+ rules : {
113+ required: true,
114+ number: true,
115+ }
116+ },
117+ height: {
118+ type: 'number',
119+ rules : {
120+ required: true,
121+ number: true,
122+ }
123+ },
124+ link: {
125+ type: 'text',
126+ rules : {
127+ url: true,
128+ }
129+ },
130+ z: {
131+ type: 'number',
132+ rules : {
133+ required: true,
134+ number: true,
135+ min: 1,
136+ }
137+ },
138+ t: {
139+ type: 'number',
140+ rules : {
141+ required: true,
142+ number: true,
143+ min: 0,
144+ }
145+ },
146+ created_at: {
147+ type: 'datetime',
148+ },
149+ updated_at: {
150+ type: 'datetime',
151+ }
152+ }
153+ },
154+ SpeechBalloon: 'speech_balloon',
155+ speech_balloon: {
156+ class_name: 'SpeechBalloon',
157+ table_name: 'speech_balloons',
158+ extend: 'classname',
159+ attributes: {
160+ id: {
161+ type: 'number',
162+ primary_key: 1,
163+ rules : {
164+ number: true,
165+ }
166+ },
167+ panel_id: {
168+ type: 'number',
169+ rules : {
170+ number: true,
171+ }
172+ },
173+ speech_balloon_template_id: {
174+ type: 'number',
175+ rules : {
176+ required: true,
177+ number: true,
178+ }
179+ },
180+ classname: {
181+ type: 'text',
182+ rules : {
183+ required: true,
184+ }
185+ },
186+ z: {
187+ type: 'number',
188+ rules : {
189+ required: true,
190+ number: true,
191+ min: 1,
192+ }
193+ },
194+ t: {
195+ type: 'number',
196+ rules : {
197+ required: true,
198+ number: true,
199+ min: 0,
200+ }
201+ },
202+ settings: {
203+ type: 'text',
204+ rules : {
205+ }
206+ },
207+ caption: {
208+ type: 'text',
209+ rules : {
210+ }
211+ },
212+ created_at: {
213+ type: 'datetime',
214+ },
215+ updated_at: {
216+ type: 'datetime',
217+ }
218+ }
219+ },
220+ Balloon: 'balloon',
221+ balloon: {
222+ class_name: 'Balloon',
223+ table_name: 'balloons',
224+ attributes: {
225+ id: {
226+ type: 'number',
227+ primary_key: 1,
228+ rules : {
229+ number: true,
230+ }
231+ },
232+ speech_balloon_id: {
233+ type: 'number',
234+ rules : {
235+ number: true,
236+ }
237+ },
238+ system_picture_id: {
239+ type: 'number',
240+ rules : {
241+ required: true,
242+ number: true,
243+ }
244+ },
245+ x: {
246+ type: 'number',
247+ rules : {
248+ required: true,
249+ number: true,
250+ }
251+ },
252+ y: {
253+ type: 'number',
254+ rules : {
255+ required: true,
256+ number: true,
257+ }
258+ },
259+ width: {
260+ type: 'number',
261+ rules : {
262+ required: true,
263+ number: true,
264+ min: 1,
265+ }
266+ },
267+ height: {
268+ type: 'number',
269+ rules : {
270+ required: true,
271+ number: true,
272+ min: 1,
273+ }
274+ },
275+ r: {
276+ type: 'number',
277+ rules : {
278+ required: true,
279+ number: true,
280+ }
281+ },
282+ settings: {
283+ type: 'text',
284+ rules : {
285+ }
286+ },
287+ created_at: {
288+ type: 'datetime',
289+ },
290+ updated_at: {
291+ type: 'datetime',
292+ }
293+ }
294+ },
295+ Speech: 'speech',
296+ speech: {
297+ class_name: 'Speech',
298+ table_name: 'speeches',
299+ attributes: {
300+ id: {
301+ type: 'number',
302+ primary_key: 1,
303+ rules : {
304+ number: true,
305+ }
306+ },
307+ speech_balloon_id: {
308+ type: 'number',
309+ rules : {
310+ number: true,
311+ }
312+ },
313+ writing_format_id: {
314+ type: 'number',
315+ rules : {
316+ required: true,
317+ number: true,
318+ }
319+ },
320+ content: {
321+ type: 'text',
322+ rules : {
323+ }
324+ },
325+ font_size: {
326+ type: 'float',
327+ rules : {
328+ required: true,
329+ number: true,
330+ min: 0,
331+ }
332+ },
333+ text_align: {
334+ type: 'number',
335+ rules : {
336+ required: true,
337+ number: true,
338+ range: [0, 3],
339+ }
340+ },
341+ fore_color: {
342+ type: 'number',
343+ rules : {
344+ required: true,
345+ number: true,
346+ range: [0, 0xffffff],
347+ }
348+ },
349+ x: {
350+ type: 'number',
351+ rules : {
352+ required: true,
353+ number: true,
354+ }
355+ },
356+ y: {
357+ type: 'number',
358+ rules : {
359+ required: true,
360+ number: true,
361+ }
362+ },
363+ width: {
364+ type: 'number',
365+ rules : {
366+ required: true,
367+ number: true,
368+ min: 1,
369+ }
370+ },
371+ height: {
372+ type: 'number',
373+ rules : {
374+ required: true,
375+ number: true,
376+ min: 1,
377+ }
378+ },
379+ quotes: {
380+ type: 'text',
381+ rules : {
382+ }
383+ },
384+ settings: {
385+ type: 'text',
386+ rules : {
387+ }
388+ },
389+ created_at: {
390+ type: 'datetime',
391+ },
392+ updated_at: {
393+ type: 'datetime',
394+ }
395+ }
396+ },
397+ GroundPicture: 'ground_picture',
398+ ground_picture: {
399+ class_name: 'GroundPicture',
400+ table_name: 'ground_pictures',
401+ attributes: {
402+ id: {
403+ type: 'number',
404+ primary_key: 1,
405+ rules : {
406+ number: true,
407+ }
408+ },
409+ panel_id: {
410+ type: 'number',
411+ rules : {
412+ number: true,
413+ }
414+ },
415+ picture_id: {
416+ type: 'number',
417+ rules : {
418+ required: true,
419+ number: true,
420+ }
421+ },
422+ caption: {
423+ type: 'text',
424+ rules : {
425+ }
426+ },
427+ repeat: {
428+ type: 'number',
429+ rules : {
430+ required: true,
431+ number: true,
432+ range: [0, 3],
433+ }
434+ },
435+ x: {
436+ type: 'number',
437+ rules : {
438+ required: true,
439+ number: true,
440+ }
441+ },
442+ y: {
443+ type: 'number',
444+ rules : {
445+ required: true,
446+ number: true,
447+ }
448+ },
449+ z: {
450+ type: 'number',
451+ rules : {
452+ required: true,
453+ number: true,
454+ min: 1,
455+ }
456+ },
457+ t: {
458+ type: 'number',
459+ rules : {
460+ required: true,
461+ number: true,
462+ min: 0,
463+ }
464+ },
465+ created_at: {
466+ type: 'datetime',
467+ },
468+ updated_at: {
469+ type: 'datetime',
470+ }
471+ }
472+ },
473+ GroundColor: 'ground_color',
474+ ground_color: {
475+ class_name: 'GroundColor',
476+ table_name: 'ground_colors',
477+ attributes: {
478+ id: {
479+ type: 'number',
480+ primary_key: 1,
481+ rules : {
482+ number: true,
483+ }
484+ },
485+ panel_id: {
486+ type: 'number',
487+ rules : {
488+ number: true,
489+ }
490+ },
491+ caption: {
492+ type: 'text',
493+ rules : {
494+ }
495+ },
496+ code: {
497+ type: 'number',
498+ rules : {
499+ required: true,
500+ number: true,
501+ range: [0, 0xffffff],
502+ }
503+ },
504+ z: {
505+ type: 'number',
506+ rules : {
507+ required: true,
508+ number: true,
509+ min: 1,
510+ }
511+ },
512+ t: {
513+ type: 'number',
514+ rules : {
515+ required: true,
516+ number: true,
517+ min: 0,
518+ }
519+ },
520+ created_at: {
521+ type: 'datetime',
522+ },
523+ updated_at: {
524+ type: 'datetime',
525+ }
526+ }
527+ },
528+ WritingFormat: 'writing_format',
529+ writing_format: {
530+ class_name: 'WritingFormat',
531+ table_name: 'writing_formats',
532+ attributes: {
533+ id: {
534+ type: 'number',
535+ primary_key: 1,
536+ rules : {
537+ number: true,
538+ }
539+ },
540+ name: {
541+ type: 'text',
542+ rules : {
543+ required: true,
544+ }
545+ },
546+ classname: {
547+ type: 'text',
548+ rules : {
549+ required: true,
550+ }
551+ },
552+ caption: {
553+ type: 'text',
554+ rules : {
555+ required: true,
556+ }
557+ },
558+ system_picture_id: {
559+ type: 'number',
560+ rules : {
561+ required: true,
562+ number: true,
563+ }
564+ },
565+ settings: {
566+ type: 'text',
567+ rules : {
568+ required: true,
569+ }
570+ },
571+ created_at: {
572+ type: 'datetime',
573+ },
574+ updated_at: {
575+ type: 'datetime',
576+ }
577+ }
578+ },
579+
580+ },
581+ elements: [
582+ {
583+ name: 'panel_picture',
584+ path_name: 'panel_pictures',
585+ parts: []
586+ },
587+ {
588+ name: 'speech_balloon',
589+ path_name: 'circle_speech_balloon/speech_balloons',
590+ parts: ['balloon', 'speech']
591+ },
592+ {
593+ name: 'ground_picture',
594+ path_name: 'ground_pictures',
595+ parts: []
596+ },
597+ {
598+ name: 'ground_color',
599+ path_name: 'ground_colors',
600+ parts: []
601+ },
602+ ],
603+ forms: {
604+ Panel: 'panel',
605+ panel: {
606+ attributes: {
607+ caption: {
608+ column: 'caption',
609+ type: 'text',
610+ label: {
611+ },
612+ options: {
613+ row_break: true
614+ }
615+ },
616+ width: {
617+ column: 'width',
618+ type: 'number',
619+ label: {
620+ },
621+ options: {
622+ size: 5,
623+ },
624+ },
625+ height: {
626+ column: 'height',
627+ type: 'number',
628+ label: {
629+ },
630+ options: {
631+ size: 5,
632+ row_break: true
633+ },
634+ },
635+ border: {
636+ column: 'border',
637+ type: 'number',
638+ label: {
639+ },
640+ options: {
641+ size: 5,
642+ },
643+ },
644+ publish: {
645+ column: 'publish',
646+ type: 'select',
647+ label: {
648+ },
649+ options: {
650+ source: 'magic_number',
651+ key: 'comic_visible_items',
652+ size: 5,
653+ row_break: true
654+ }
655+ },
656+ id: {
657+ column: 'id',
658+ type: 'hidden',
659+ label: {
660+ type: 'hidden'
661+ },
662+ options: {
663+ }
664+ },
665+ author_id: {
666+ column: 'author_id',
667+ type: 'hidden',
668+ label: {
669+ type: 'hidden'
670+ },
671+ options: {
672+ }
673+ },
674+ },
675+ fields: [
676+ 'caption',
677+ 'width',
678+ 'height',
679+ 'border',
680+ 'publish',
681+ 'id',
682+ 'author_id',
683+ ]
684+ },
685+ PanelPicture: 'panel_picture',
686+ panel_picture: {
687+ attributes: {
688+ caption: {
689+ column: 'caption',
690+ type: 'text',
691+ label: {
692+ },
693+ options: {
694+ row_break: true
695+ }
696+ },
697+ x: {
698+ column: 'x',
699+ type: 'number',
700+ label: {
701+ },
702+ options: {
703+ size: 5,
704+ }
705+ },
706+ y: {
707+ column: 'y',
708+ type: 'number',
709+ label: {
710+ },
711+ options: {
712+ size: 5,
713+ row_break: true
714+ }
715+ },
716+ width: {
717+ column: 'width',
718+ type: 'number',
719+ label: {
720+ },
721+ options: {
722+ size: 5,
723+ row_break: true
724+ },
725+ helpers: {
726+ size: {
727+ path: 'panels/size_helper',
728+ options: {
729+ class: 'panel_picture_width_tool',
730+ }
731+ }
732+ },
733+ },
734+ height: {
735+ column: 'height',
736+ type: 'number',
737+ label: {
738+ },
739+ options: {
740+ size: 5,
741+ row_break: true
742+ },
743+ helpers: {
744+ size: {
745+ path: 'panels/size_helper',
746+ options: {
747+ class: 'panel_picture_height_tool',
748+ }
749+ }
750+ },
751+ },
752+ link: {
753+ column: 'link',
754+ type: 'text',
755+ label: {
756+ },
757+ options: {
758+ row_break: true
759+ }
760+ },
761+ id: {
762+ column: 'id',
763+ type: 'hidden',
764+ label: {
765+ type: 'hidden'
766+ },
767+ options: {
768+ }
769+ },
770+ panel_id: {
771+ column: 'panel_id',
772+ type: 'hidden',
773+ label: {
774+ type: 'hidden'
775+ },
776+ options: {
777+ }
778+ },
779+ picture_id: {
780+ column: 'picture_id',
781+ type: 'hidden',
782+ label: {
783+ type: 'hidden'
784+ },
785+ options: {
786+ }
787+ },
788+ z: {
789+ column: 'z',
790+ type: 'hidden',
791+ label: {
792+ type: 'hidden'
793+ },
794+ options: {
795+ }
796+ },
797+ t: {
798+ column: 't',
799+ type: 'hidden',
800+ label: {
801+ type: 'hidden'
802+ },
803+ options: {
804+ }
805+ },
806+ },
807+ fields: [
808+ 'caption',
809+ 'x',
810+ 'y',
811+ 'width',
812+ 'height',
813+ 'link',
814+ 'id',
815+ 'panel_id',
816+ 'picture_id',
817+ 'z',
818+ 't',
819+ ]
820+ },
821+ speech_balloon: {
822+ attributes: {
823+ 'speech_balloon.id': {
824+ column: 'id',
825+ type: 'hidden',
826+ label: {
827+ type: 'hidden'
828+ },
829+ options: {
830+ }
831+ },
832+ 'speech_balloon.panel_id': {
833+ column: 'panel_id',
834+ type: 'hidden',
835+ label: {
836+ type: 'hidden'
837+ },
838+ options: {
839+ }
840+ },
841+ 'speech_balloon.speech_balloon_template_id': {
842+ column: 'speech_balloon_template_id',
843+ type: 'hidden',
844+ label: {
845+ type: 'hidden'
846+ },
847+ options: {
848+ }
849+ },
850+ 'speech_balloon.caption': {
851+ column: 'caption',
852+ type: 'text',
853+ label: {
854+ },
855+ options: {
856+ row_break: true
857+ }
858+ },
859+ 'speech_balloon.z': {
860+ column: 'z',
861+ type: 'hidden',
862+ label: {
863+ type: 'hidden'
864+ },
865+ options: {
866+ }
867+ },
868+ 'speech_balloon.t': {
869+ column: 't',
870+ type: 'hidden',
871+ label: {
872+ type: 'hidden'
873+ },
874+ options: {
875+ }
876+ },
877+ 'speech_balloon.classname': {
878+ column: 'classname',
879+ type: 'hidden',
880+ label: {
881+ type: 'hidden'
882+ },
883+ options: {
884+ }
885+ },
886+ 'speech_balloon.settings': {
887+ column: 'settings',
888+ type: 'hidden',
889+ label: {
890+ type: 'hidden'
891+ },
892+ options: {
893+ }
894+ },
895+ 'balloon.id': {
896+ model: 'balloon',
897+ part: 'balloon',
898+ column: 'id',
899+ type: 'hidden',
900+ label: {
901+ type: 'hidden'
902+ },
903+ options: {
904+ }
905+ },
906+ 'balloon.speech_balloon_id': {
907+ model: 'balloon',
908+ part: 'balloon',
909+ column: 'speech_balloon_id',
910+ type: 'hidden',
911+ label: {
912+ type: 'hidden'
913+ },
914+ options: {
915+ }
916+ },
917+ 'balloon.system_picture_id': {
918+ model: 'balloon',
919+ part: 'balloon',
920+ column: 'system_picture_id',
921+ type: 'hidden',
922+ label: {
923+ type: 'hidden'
924+ },
925+ options: {
926+ }
927+ },
928+ 'balloon.r': {
929+ model: 'balloon',
930+ part: 'balloon',
931+ column: 'r',
932+ type: 'number',
933+ label: {
934+ },
935+ options: {
936+ size: 5,
937+ row_break: true
938+ },
939+ helpers: {
940+ tail_angle: {
941+ path: 'panels/tail_angle_helper',
942+ options: {
943+ }
944+ }
945+ }
946+ },
947+ 'balloon.x': {
948+ model: 'balloon',
949+ part: 'balloon',
950+ column: 'x',
951+ type: 'number',
952+ label: {
953+ },
954+ options: {
955+ size: 5,
956+ }
957+ },
958+ 'balloon.y': {
959+ model: 'balloon',
960+ part: 'balloon',
961+ column: 'y',
962+ type: 'number',
963+ label: {
964+ },
965+ options: {
966+ size: 5,
967+ row_break: true
968+ }
969+ },
970+ 'balloon.width': {
971+ model: 'balloon',
972+ part: 'balloon',
973+ column: 'width',
974+ type: 'number',
975+ label: {
976+ },
977+ options: {
978+ size: 5,
979+ }
980+ },
981+ 'balloon.height': {
982+ model: 'balloon',
983+ part: 'balloon',
984+ column: 'height',
985+ type: 'number',
986+ label: {
987+ },
988+ options: {
989+ size: 5,
990+ row_break: true
991+ }
992+ },
993+ 'balloon.settings': {
994+ model: 'balloon',
995+ part: 'balloon',
996+ column: 'settings',
997+ type: 'hidden',
998+ label: {
999+ type: 'hidden'
1000+ },
1001+ options: {
1002+ }
1003+ },
1004+ 'speech.id': {
1005+ model: 'speech',
1006+ part: 'speech',
1007+ column: 'id',
1008+ type: 'hidden',
1009+ label: {
1010+ type: 'hidden'
1011+ },
1012+ options: {
1013+ }
1014+ },
1015+ 'speech.speech_balloon_id': {
1016+ model: 'speech',
1017+ part: 'speech',
1018+ column: 'speech_balloon_id',
1019+ type: 'hidden',
1020+ label: {
1021+ type: 'hidden'
1022+ },
1023+ options: {
1024+ }
1025+ },
1026+ 'speech.x': {
1027+ model: 'speech',
1028+ part: 'speech',
1029+ column: 'x',
1030+ type: 'hidden',
1031+ label: {
1032+ type: 'hidden'
1033+ },
1034+ options: {
1035+ }
1036+ },
1037+ 'speech.y': {
1038+ model: 'speech',
1039+ part: 'speech',
1040+ column: 'y',
1041+ type: 'hidden',
1042+ label: {
1043+ type: 'hidden'
1044+ },
1045+ options: {
1046+ }
1047+ },
1048+ 'speech.width': {
1049+ model: 'speech',
1050+ part: 'speech',
1051+ column: 'width',
1052+ type: 'hidden',
1053+ label: {
1054+ type: 'hidden'
1055+ },
1056+ options: {
1057+ }
1058+ },
1059+ 'speech.height': {
1060+ model: 'speech',
1061+ part: 'speech',
1062+ column: 'height',
1063+ type: 'hidden',
1064+ label: {
1065+ type: 'hidden'
1066+ },
1067+ options: {
1068+ }
1069+ },
1070+ 'speech.writing_format_id': {
1071+ model: 'speech',
1072+ part: 'speech',
1073+ column: 'writing_format_id',
1074+ type: 'select',
1075+ label: {
1076+ },
1077+ options: {
1078+ source: 'model',
1079+ model: 'writing_format',
1080+ method: 'enable_list',
1081+ caption: 'caption'
1082+ }
1083+ },
1084+ 'speech.font_size': {
1085+ model: 'speech',
1086+ part: 'speech',
1087+ column: 'font_size',
1088+ type: 'select',
1089+ label: {
1090+ },
1091+ options: {
1092+ source: 'magic_number',
1093+ key: 'speech_font_size_items',
1094+ row_break: true
1095+ }
1096+ },
1097+ 'speech.text_align': {
1098+ model: 'speech',
1099+ part: 'speech',
1100+ column: 'text_align',
1101+ type: 'select',
1102+ label: {
1103+ },
1104+ options: {
1105+ source: 'magic_number',
1106+ key: 'speech_text_align_items',
1107+ }
1108+ },
1109+ 'speech.quotes': {
1110+ model: 'speech',
1111+ part: 'speech',
1112+ column: 'quotes',
1113+ type: 'text',
1114+ label: {
1115+ },
1116+ options: {
1117+ size: 5,
1118+ }
1119+ },
1120+ 'speech.content': {
1121+ model: 'speech',
1122+ part: 'speech',
1123+ column: 'content',
1124+ type: 'text_area',
1125+ label: {
1126+ row_break: true
1127+ },
1128+ options: {
1129+ size: '45x5',
1130+ }
1131+ },
1132+ 'speech.fore_color': {
1133+ model: 'speech',
1134+ part: 'speech',
1135+ column: 'fore_color',
1136+ type: 'hidden',
1137+ label: {
1138+ row_break: true
1139+ },
1140+ options: {
1141+ },
1142+ helpers: {
1143+ color: {
1144+ path: 'panels/color_helper',
1145+ options: {
1146+ },
1147+ wrapper: 'speech-fore_color-wrap'
1148+ }
1149+ }
1150+ },
1151+ 'speech.settings': {
1152+ model: 'speech',
1153+ part: 'speech',
1154+ column: 'settings',
1155+ type: 'hidden',
1156+ label: {
1157+ type: 'hidden'
1158+ },
1159+ options: {
1160+ }
1161+ },
1162+ },
1163+ },
1164+ CircleSpeechBalloon: 'circle_speech_balloon',
1165+ circle_speech_balloon: {
1166+ base: 'speech_balloon',
1167+ attributes: {
1168+ },
1169+ fields: [
1170+ 'speech_balloon.caption',
1171+ 'balloon.r',
1172+ 'balloon.x',
1173+ 'balloon.y',
1174+ 'balloon.width',
1175+ 'balloon.height',
1176+ 'balloon.id',
1177+ 'balloon.speech_balloon_id',
1178+ 'balloon.system_picture_id',
1179+ 'balloon.settings',
1180+ 'speech.writing_format_id',
1181+ 'speech.font_size',
1182+ 'speech.text_align',
1183+ 'speech.quotes',
1184+ 'speech.content',
1185+ 'speech.fore_color',
1186+ 'speech.id',
1187+ 'speech.speech_balloon_id',
1188+ 'speech.x',
1189+ 'speech.y',
1190+ 'speech.width',
1191+ 'speech.height',
1192+ 'speech.settings',
1193+ 'speech_balloon.id',
1194+ 'speech_balloon.panel_id',
1195+ 'speech_balloon.speech_balloon_template_id',
1196+ 'speech_balloon.classname',
1197+ 'speech_balloon.z',
1198+ 'speech_balloon.t',
1199+ 'speech_balloon.settings',
1200+ ]
1201+ },
1202+ PlainSpeechBalloon: 'plain_speech_balloon',
1203+ plain_speech_balloon: {
1204+ base: 'speech_balloon',
1205+ attributes: {
1206+ 'balloon.r': {
1207+ model: 'balloon',
1208+ part: 'balloon',
1209+ column: 'r',
1210+ type: 'hidden',
1211+ label: {
1212+ type: 'hidden'
1213+ },
1214+ options: {
1215+ },
1216+ },
1217+ },
1218+ fields: [
1219+ 'speech_balloon.caption',
1220+ 'balloon.r',
1221+ 'balloon.x',
1222+ 'balloon.y',
1223+ 'balloon.width',
1224+ 'balloon.height',
1225+ 'balloon.id',
1226+ 'balloon.speech_balloon_id',
1227+ 'balloon.system_picture_id',
1228+ 'balloon.settings',
1229+ 'speech.writing_format_id',
1230+ 'speech.font_size',
1231+ 'speech.text_align',
1232+ 'speech.quotes',
1233+ 'speech.content',
1234+ 'speech.fore_color',
1235+ 'speech.id',
1236+ 'speech.speech_balloon_id',
1237+ 'speech.x',
1238+ 'speech.y',
1239+ 'speech.width',
1240+ 'speech.height',
1241+ 'speech.settings',
1242+ 'speech_balloon.id',
1243+ 'speech_balloon.panel_id',
1244+ 'speech_balloon.speech_balloon_template_id',
1245+ 'speech_balloon.classname',
1246+ 'speech_balloon.z',
1247+ 'speech_balloon.t',
1248+ 'speech_balloon.settings',
1249+ ]
1250+ },
1251+ SquareSpeechBalloon: 'square_speech_balloon',
1252+ square_speech_balloon: {
1253+ base: 'speech_balloon',
1254+ attributes: {
1255+ 'balloon.r': {
1256+ model: 'balloon',
1257+ part: 'balloon',
1258+ column: 'r',
1259+ type: 'hidden',
1260+ label: {
1261+ type: 'hidden'
1262+ },
1263+ options: {
1264+ },
1265+ },
1266+ },
1267+ fields: [
1268+ 'speech_balloon.caption',
1269+ 'balloon.r',
1270+ 'balloon.x',
1271+ 'balloon.y',
1272+ 'balloon.width',
1273+ 'balloon.height',
1274+ 'balloon.id',
1275+ 'balloon.speech_balloon_id',
1276+ 'balloon.system_picture_id',
1277+ 'balloon.settings',
1278+ 'speech.writing_format_id',
1279+ 'speech.font_size',
1280+ 'speech.text_align',
1281+ 'speech.quotes',
1282+ 'speech.content',
1283+ 'speech.fore_color',
1284+ 'speech.id',
1285+ 'speech.speech_balloon_id',
1286+ 'speech.x',
1287+ 'speech.y',
1288+ 'speech.width',
1289+ 'speech.height',
1290+ 'speech.settings',
1291+ 'speech_balloon.id',
1292+ 'speech_balloon.panel_id',
1293+ 'speech_balloon.speech_balloon_template_id',
1294+ 'speech_balloon.classname',
1295+ 'speech_balloon.z',
1296+ 'speech_balloon.t',
1297+ 'speech_balloon.settings',
1298+ ]
1299+ },
1300+ GroundPicture: 'ground_picture',
1301+ ground_picture: {
1302+ attributes: {
1303+ id: {
1304+ column: 'id',
1305+ type: 'hidden',
1306+ label: {
1307+ type: 'hidden'
1308+ },
1309+ options: {
1310+ }
1311+ },
1312+ panel_id: {
1313+ column: 'panel_id',
1314+ type: 'hidden',
1315+ label: {
1316+ type: 'hidden'
1317+ },
1318+ options: {
1319+ }
1320+ },
1321+ picture_id: {
1322+ column: 'picture_id',
1323+ type: 'hidden',
1324+ label: {
1325+ type: 'hidden'
1326+ },
1327+ options: {
1328+ }
1329+ },
1330+ caption: {
1331+ column: 'caption',
1332+ type: 'text',
1333+ label: {
1334+ },
1335+ options: {
1336+ row_break: true
1337+ }
1338+ },
1339+ repeat: {
1340+ column: 'repeat',
1341+ type: 'select',
1342+ label: {
1343+ },
1344+ options: {
1345+ source: 'magic_number',
1346+ key: 'ground_picture_repeat_items',
1347+ row_break: true
1348+ }
1349+ },
1350+ x: {
1351+ column: 'x',
1352+ type: 'number',
1353+ label: {
1354+ },
1355+ options: {
1356+ size: 5,
1357+ }
1358+ },
1359+ y: {
1360+ column: 'y',
1361+ type: 'number',
1362+ label: {
1363+ },
1364+ options: {
1365+ size: 5,
1366+ row_break: true
1367+ }
1368+ },
1369+ z: {
1370+ column: 'z',
1371+ type: 'hidden',
1372+ label: {
1373+ type: 'hidden'
1374+ },
1375+ options: {
1376+ }
1377+ },
1378+ t: {
1379+ column: 't',
1380+ type: 'hidden',
1381+ label: {
1382+ type: 'hidden'
1383+ },
1384+ options: {
1385+ }
1386+ },
1387+ },
1388+ fields: [
1389+ 'caption',
1390+ 'repeat',
1391+ 'x',
1392+ 'y',
1393+ 'z',
1394+ 't',
1395+ 'id',
1396+ 'panel_id',
1397+ 'picture_id',
1398+ ]
1399+ },
1400+ GroundColor: 'ground_color',
1401+ ground_color: {
1402+ attributes: {
1403+ id: {
1404+ column: 'id',
1405+ type: 'hidden',
1406+ label: {
1407+ type: 'hidden'
1408+ },
1409+ options: {
1410+ }
1411+ },
1412+ panel_id: {
1413+ column: 'panel_id',
1414+ type: 'hidden',
1415+ label: {
1416+ type: 'hidden'
1417+ },
1418+ options: {
1419+ }
1420+ },
1421+ caption: {
1422+ column: 'caption',
1423+ type: 'text',
1424+ label: {
1425+ },
1426+ options: {
1427+ row_break: true
1428+ }
1429+ },
1430+ code: {
1431+ column: 'code',
1432+ type: 'hidden',
1433+ label: {
1434+ row_break: true
1435+ },
1436+ options: {
1437+ row_break: true
1438+ }
1439+ helpers: {
1440+ color: {
1441+ path: 'panels/color_helper',
1442+ options: {
1443+ },
1444+ wrapper: 'ground_color-code-wrap'
1445+ }
1446+ },
1447+ },
1448+ z: {
1449+ column: 'z',
1450+ type: 'hidden',
1451+ label: {
1452+ type: 'hidden'
1453+ },
1454+ options: {
1455+ }
1456+ },
1457+ t: {
1458+ column: 't',
1459+ type: 'hidden',
1460+ label: {
1461+ type: 'hidden'
1462+ },
1463+ options: {
1464+ }
1465+ },
1466+ },
1467+ fields: [
1468+ 'id',
1469+ 'panel_id',
1470+ 'caption',
1471+ 'code',
1472+ 'z',
1473+ 't',
1474+ ]
1475+ }
1476+ },
1477+ locales: {
1478+ ja: {
1479+ }
1480+ },
1481+}
1482+
1483+@repeat_texts = ['repeat', 'repeat-x', 'repeat-y', 'no-repeat']
1484+
1485+@text_align_texts = ['left', 'left', 'right', 'center']
1486+
--- a/app/assets/javascripts/panels.js.coffee
+++ b/app/assets/javascripts/panels.js.coffee
@@ -2,6 +2,7 @@ $ ->
22 confirm_confirm_confirm = () ->
33 confirm( )
44 editor = window.PettanrEditor
5+ configurations = window.configurations
56 WritingFormat = window.PettanrWritingFormat
67 WritingFormat.load($('#writing_formats'))
78 SpeechBalloonTemplate = window.PettanrSpeechBalloonTemplate
@@ -12,6 +13,93 @@ $ ->
1213 PictureSizeHelper = window.PettanrPictureSizeHelper
1314 ColorHelper = window.PettanrColorHelper
1415
16+ find_configurations = ( hash, key) ->
17+ if typeof(hash[key]) == 'string'
18+ find_configurations(hash, hash[key])
19+ else
20+ return hash[key]
21+
22+ set_validates = (form) ->
23+ rules = {}
24+ $('input', form).map ->
25+ model_name = $(@).attr('data-model')
26+ column_name = $(@).attr('column')
27+ name = $(@).attr('name')
28+ if model_name and column_name
29+ model = find_configurations(configurations['models'], model_name)
30+ rule = model['attributes'][column_name]['rules']
31+ trace = editor.element_tag_id($(@))
32+ if rule
33+ rules[name] = rule
34+ $(@).focusout ->
35+ if editor.is_panel(form)
36+ validate_panel(form)
37+ else
38+ validate_element(form)
39+ if Object.keys(rules).length > 0
40+ v = form.validate({ignore:[],rules: rules})
41+
42+ validate_panel = (form) ->
43+ valid = form.valid()
44+ bc = if valid
45+ ''
46+ else
47+ '#ef29ef'
48+ $('a', $('#tabs-1-tab')).map ->
49+ $(@).css('background-color', bc)
50+ valid
51+
52+ display_element = (element, vis) ->
53+ v = if vis
54+ ''
55+ else
56+ 'none'
57+ trace = editor.element_tag_id(element)
58+ switch element.attr('element_type')
59+ when 'panel_picture'
60+ trace = trace + 'div'
61+ $(trace).css('display', v)
62+
63+ validate_element = (form) ->
64+ valid = form.valid()
65+ bc = if valid
66+ ''
67+ else
68+ '#ef29ef'
69+ display_element(form, valid)
70+ trace = editor.element_tag_id(form)
71+ $('.elements-tab', $(trace + 'element_tab')).map ->
72+ $(@).css('background-color', bc)
73+ valid
74+
75+ validate_forms = () ->
76+ valid = true
77+ $('form', $('#tabs-1')).map ->
78+ form_name = $(@).attr('data-form-name')
79+ if form_name
80+ if validate_panel($(@))
81+ else
82+ valid = false
83+ invalid_elements = []
84+ $('form', $('#tabs-2')).map ->
85+ form_name = $(@).attr('data-form-name')
86+ if form_name
87+ if validate_element($(@))
88+ else
89+ valid = false
90+ invalid_elements.push form_name
91+ if invalid_elements.length > 0
92+ bc = '#ef29ef'
93+ else
94+ bc = ''
95+ $('a', $('#tabs-2-tab')).map ->
96+ $(@).css('background-color', bc)
97+ return valid
98+ $('form').map ->
99+ form_name = $(@).attr('data-form-name')
100+ if form_name
101+ form = $(this)
102+ set_validates(form)
15103 $('.panel-editor').map ->
16104 if $(@).attr('current') and parseInt($(@).attr('current')) > 0
17105 editor.pettanr_current_panel_id = parseInt($(@).attr('panel_id'))
@@ -72,11 +160,7 @@ $ ->
72160 $(trace + 'tab_panel').css('display', 'none')
73161 $(trace + 'zsort').css('display', 'none')
74162 $(trace + 'tsort').css('display', 'none')
75- switch $(@).attr('element_type')
76- when 'panel_picture'
77- trace = trace + 'div'
78- $(trace).css('display', 'none')
79-
163+ display_element($(@), false)
80164
81165 $('#pettanr-panel-submit').focusin ->
82166 editor.refresh_attribute($('#pettanr-panel-json'))
@@ -421,6 +505,11 @@ $ ->
421505
422506 $('.edit_panel' ).map ->
423507 if $(@).attr('jqform')
508+ $(@).submit ->
509+ if validate_forms()
510+ true
511+ else
512+ false
424513 else
425514 $(@).submit ->
426515 false
@@ -443,4 +532,6 @@ $ ->
443532 $('.new-element').map ->
444533 $(@).click ->
445534 false
446-
535+ j = JSON.stringify(window.configurations)
536+ $('#pettanr-configurations').val(j)
537+
--- a/app/assets/javascripts/pettanr_editor.js.coffee
+++ b/app/assets/javascripts/pettanr_editor.js.coffee
@@ -39,6 +39,11 @@ class PettanrEditor
3939 return true
4040 else
4141 return false
42+ @is_panel = (o) ->
43+ if PettanrEditor.is_element(o)
44+ return false
45+ else
46+ return true
4247 @is_element = (o) ->
4348 if o.attr('element_type')
4449 return true
--- a/app/assets/stylesheets/test.css.scss
+++ b/app/assets/stylesheets/test.css.scss
@@ -16,6 +16,20 @@ div.md5 {
1616 text-align: left;
1717 }
1818
19+input.error {
20+ border-width: 3px;
21+ border-style: solid;
22+ border-color: #ef29ef;
23+}
24+textarea.error {
25+ border-style: solid;
26+ border-color: #111;
27+}
28+select.error {
29+ border-style: solid;
30+ border-color: #111;
31+}
32+
1933 .sheet {
2034 position: relative;
2135 overflow: hidden;
@@ -34,6 +48,7 @@ div.md5 {
3448 .sheet_panel {
3549 position: absolute;
3650 }
51+
3752 .pettanr-comic-wrapper {
3853 margin: 1em auto;
3954 }
@@ -289,6 +304,8 @@ font-family : monospace;
289304 .ui-tabs .ui-tabs-nav li.ui-tabs-active {
290305 margin-bottom: 0.2em;
291306 }
307+.element-tab {
308+}
292309 .elements-tab {
293310 width: 100%;
294311 overflow: hidden;
@@ -333,3 +350,9 @@ font-family : monospace;
333350 clear: both;
334351 }
335352
353+.field {
354+ float: left;
355+}
356+.row_break {
357+ clear: both;
358+}
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -136,6 +136,21 @@ class ApplicationController < ActionController::Base
136136 export_from_provider(url)
137137 end
138138
139+ rescue_from Pettanr::NotWork, :with => :render_not_work
140+ def render_not_work(exception = nil)
141+ if exception
142+ logger.info "Rendering , :: #{exception.message}"
143+ end
144+ respond_to do |format|
145+ format.html {
146+ render :file => "#{Rails.root}/public/not_work.html", :layout => false
147+ }
148+ format.json {
149+ render :text => "400 Not work", :status => 400
150+ }
151+ end
152+ end
153+
139154 if Rails.env == 'production'
140155 rescue_from ActiveRecord::RecordNotFound, :with => :render_404
141156 rescue_from ActiveRecord::Forbidden, :with => :render_403
--- a/app/controllers/ground_colors_controller.rb
+++ b/app/controllers/ground_colors_controller.rb
@@ -31,6 +31,7 @@ class GroundColorsController < ApplicationController
3131 end
3232
3333 def new
34+ raise Pettanr::NotWork unless @author.working_panel
3435 @panel = Panel.edit(@author.working_panel, @author)
3536 @ground_color = GroundColor.new :panel_id => @panel.id, :code => params[:code].to_i
3637 @ground_color.supply_default
@@ -51,6 +52,7 @@ class GroundColorsController < ApplicationController
5152 end
5253
5354 def create
55+ raise Pettanr::NotWork unless @author.working_panel
5456 @panel = Panel.edit(@author.working_panel, @author)
5557
5658 @ground_color = GroundColor.new
--- a/app/controllers/ground_pictures_controller.rb
+++ b/app/controllers/ground_pictures_controller.rb
@@ -31,6 +31,7 @@ class GroundPicturesController < ApplicationController
3131 end
3232
3333 def new
34+ raise Pettanr::NotWork unless @author.working_panel
3435 @picture = Picture.show params[:picture_id], @author
3536 raise ActiveRecord::Forbidden unless @picture.enable?
3637 @panel = Panel.edit(@author.working_panel, @author)
@@ -54,6 +55,7 @@ class GroundPicturesController < ApplicationController
5455 end
5556
5657 def create
58+ raise Pettanr::NotWork unless @author.working_panel
5759 @panel = Panel.edit(@author.working_panel, @author)
5860
5961 @ground_picture = GroundPicture.new
--- a/app/controllers/panel_pictures_controller.rb
+++ b/app/controllers/panel_pictures_controller.rb
@@ -51,6 +51,7 @@ class PanelPicturesController < ApplicationController
5151 end
5252
5353 def new
54+ raise Pettanr::NotWork unless @author.working_panel
5455 @picture = Picture.show params[:picture_id], @author
5556 raise ActiveRecord::Forbidden unless @picture.enable?
5657 @panel = Panel.edit(@author.working_panel, @author)
@@ -74,6 +75,7 @@ class PanelPicturesController < ApplicationController
7475 end
7576
7677 def create
78+ raise Pettanr::NotWork unless @author.working_panel
7779 @panel = Panel.edit(@author.working_panel, @author)
7880
7981 @panel_picture = PanelPicture.new
--- a/app/controllers/speech_balloons_controller.rb
+++ b/app/controllers/speech_balloons_controller.rb
@@ -50,6 +50,7 @@ class SpeechBalloonsController < ApplicationController
5050 end
5151
5252 def new
53+ raise Pettanr::NotWork unless @author.working_panel
5354 @speech_balloon_template = SpeechBalloonTemplate.show params[:speech_balloon_template_id], @author
5455
5556 @panel = Panel.edit(@author.working_panel, @author)
@@ -82,6 +83,7 @@ class SpeechBalloonsController < ApplicationController
8283 end
8384
8485 def create
86+ raise Pettanr::NotWork unless @author.working_panel
8587 SpeechBalloon.fold_extend_settings params
8688 @panel = Panel.edit(@author.working_panel, @author)
8789 @speech_balloon = SpeechBalloon.new
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -83,4 +83,1427 @@ module ApplicationHelper
8383 }.join("\n")
8484 end
8585
86+ def configurations
87+ JSON.parse(<<HD
88+{
89+ "models": {
90+ "Panel": "panel",
91+ "panel": {
92+ "class_name": "Panel",
93+ "table_name": "panels",
94+ "attributes": {
95+ "id": {
96+ "type": "number",
97+ "primary_key": 1,
98+ "rules": {
99+ "number": true
100+ }
101+ },
102+ "width": {
103+ "type": "number",
104+ "rules": {
105+ "required": true,
106+ "number": true,
107+ "min": 1
108+ }
109+ },
110+ "height": {
111+ "type": "number",
112+ "rules": {
113+ "required": true,
114+ "number": true,
115+ "min": 1
116+ }
117+ },
118+ "border": {
119+ "type": "number",
120+ "rules": {
121+ "required": true,
122+ "number": true,
123+ "min": 0
124+ }
125+ },
126+ "caption": {
127+ "type": "text",
128+ "rules": {
129+ }
130+ },
131+ "publish": {
132+ "type": "number",
133+ "rules": {
134+ "required": true,
135+ "number": true
136+ }
137+ },
138+ "author_id": {
139+ "type": "number",
140+ "rules": {
141+ "required": true,
142+ "number": true
143+ }
144+ },
145+ "created_at": {
146+ "type": "datetime"
147+ },
148+ "updated_at": {
149+ "type": "datetime"
150+ }
151+ }
152+ },
153+ "PanelPicture": "panel_picture",
154+ "panel_picture": {
155+ "class_name": "PanelPicture",
156+ "table_name": "panel_pictures",
157+ "attributes": {
158+ "id": {
159+ "type": "number",
160+ "primary_key": 1,
161+ "rules": {
162+ "number": true
163+ }
164+ },
165+ "panel_id": {
166+ "type": "number",
167+ "rules": {
168+ "number": true
169+ }
170+ },
171+ "picture_id": {
172+ "type": "number",
173+ "rules": {
174+ "required": true,
175+ "number": true
176+ }
177+ },
178+ "caption": {
179+ "type": "text",
180+ "rules": {}
181+ },
182+ "x": {
183+ "type": "number",
184+ "rules": {
185+ "required": true,
186+ "number": true
187+ }
188+ },
189+ "y": {
190+ "type": "number",
191+ "rules": {
192+ "required": true,
193+ "number": true
194+ }
195+ },
196+ "width": {
197+ "type": "number",
198+ "rules": {
199+ "required": true,
200+ "number": true
201+ }
202+ },
203+ "height": {
204+ "type": "number",
205+ "rules": {
206+ "required": true,
207+ "number": true
208+ }
209+ },
210+ "link": {
211+ "type": "text",
212+ "rules": {
213+ "url": true
214+ }
215+ },
216+ "z": {
217+ "type": "number",
218+ "rules": {
219+ "required": true,
220+ "number": true,
221+ "min": 1
222+ }
223+ },
224+ "t": {
225+ "type": "number",
226+ "rules": {
227+ "required": true,
228+ "number": true,
229+ "min": 0
230+ }
231+ },
232+ "created_at": {
233+ "type": "datetime"
234+ },
235+ "updated_at": {
236+ "type": "datetime"
237+ }
238+ }
239+ },
240+ "SpeechBalloon": "speech_balloon",
241+ "speech_balloon": {
242+ "class_name": "SpeechBalloon",
243+ "table_name": "speech_balloons",
244+ "extend": "classname",
245+ "attributes": {
246+ "id": {
247+ "type": "number",
248+ "primary_key": 1,
249+ "rules": {
250+ "number": true
251+ }
252+ },
253+ "panel_id": {
254+ "type": "number",
255+ "rules": {
256+ "number": true
257+ }
258+ },
259+ "speech_balloon_template_id": {
260+ "type": "number",
261+ "rules": {
262+ "required": true,
263+ "number": true
264+ }
265+ },
266+ "classname": {
267+ "type": "text",
268+ "rules": {
269+ "required": true
270+ }
271+ },
272+ "z": {
273+ "type": "number",
274+ "rules": {
275+ "required": true,
276+ "number": true,
277+ "min": 1
278+ }
279+ },
280+ "t": {
281+ "type": "number",
282+ "rules": {
283+ "required": true,
284+ "number": true,
285+ "min": 0
286+ }
287+ },
288+ "settings": {
289+ "type": "text",
290+ "rules": {}
291+ },
292+ "caption": {
293+ "type": "text",
294+ "rules": {}
295+ },
296+ "created_at": {
297+ "type": "datetime"
298+ },
299+ "updated_at": {
300+ "type": "datetime"
301+ }
302+ }
303+ },
304+ "Balloon": "balloon",
305+ "balloon": {
306+ "class_name": "Balloon",
307+ "table_name": "balloons",
308+ "attributes": {
309+ "id": {
310+ "type": "number",
311+ "primary_key": 1,
312+ "rules": {
313+ "number": true
314+ }
315+ },
316+ "speech_balloon_id": {
317+ "type": "number",
318+ "rules": {
319+ "number": true
320+ }
321+ },
322+ "system_picture_id": {
323+ "type": "number",
324+ "rules": {
325+ "required": true,
326+ "number": true
327+ }
328+ },
329+ "x": {
330+ "type": "number",
331+ "rules": {
332+ "required": true,
333+ "number": true
334+ }
335+ },
336+ "y": {
337+ "type": "number",
338+ "rules": {
339+ "required": true,
340+ "number": true
341+ }
342+ },
343+ "width": {
344+ "type": "number",
345+ "rules": {
346+ "required": true,
347+ "number": true,
348+ "min": 1
349+ }
350+ },
351+ "height": {
352+ "type": "number",
353+ "rules": {
354+ "required": true,
355+ "number": true,
356+ "min": 1
357+ }
358+ },
359+ "r": {
360+ "type": "number",
361+ "rules": {
362+ "required": true,
363+ "number": true
364+ }
365+ },
366+ "settings": {
367+ "type": "text",
368+ "rules": {}
369+ },
370+ "created_at": {
371+ "type": "datetime"
372+ },
373+ "updated_at": {
374+ "type": "datetime"
375+ }
376+ }
377+ },
378+ "Speech": "speech",
379+ "speech": {
380+ "class_name": "Speech",
381+ "table_name": "speeches",
382+ "attributes": {
383+ "id": {
384+ "type": "number",
385+ "primary_key": 1,
386+ "rules": {
387+ "number": true
388+ }
389+ },
390+ "speech_balloon_id": {
391+ "type": "number",
392+ "rules": {
393+ "number": true
394+ }
395+ },
396+ "writing_format_id": {
397+ "type": "number",
398+ "rules": {
399+ "required": true,
400+ "number": true
401+ }
402+ },
403+ "content": {
404+ "type": "text",
405+ "rules": {}
406+ },
407+ "font_size": {
408+ "type": "float",
409+ "rules": {
410+ "required": true,
411+ "number": true,
412+ "min": 0
413+ }
414+ },
415+ "text_align": {
416+ "type": "number",
417+ "rules": {
418+ "required": true,
419+ "number": true,
420+ "range": [
421+ 0,
422+ 3
423+ ]
424+ }
425+ },
426+ "fore_color": {
427+ "type": "number",
428+ "rules": {
429+ "required": true,
430+ "number": true,
431+ "range": [
432+ 0,
433+ 16777215
434+ ]
435+ }
436+ },
437+ "x": {
438+ "type": "number",
439+ "rules": {
440+ "required": true,
441+ "number": true
442+ }
443+ },
444+ "y": {
445+ "type": "number",
446+ "rules": {
447+ "required": true,
448+ "number": true
449+ }
450+ },
451+ "width": {
452+ "type": "number",
453+ "rules": {
454+ "required": true,
455+ "number": true,
456+ "min": 1
457+ }
458+ },
459+ "height": {
460+ "type": "number",
461+ "rules": {
462+ "required": true,
463+ "number": true,
464+ "min": 1
465+ }
466+ },
467+ "quotes": {
468+ "type": "text",
469+ "rules": {}
470+ },
471+ "settings": {
472+ "type": "text",
473+ "rules": {}
474+ },
475+ "created_at": {
476+ "type": "datetime"
477+ },
478+ "updated_at": {
479+ "type": "datetime"
480+ }
481+ }
482+ },
483+ "GroundPicture": "ground_picture",
484+ "ground_picture": {
485+ "class_name": "GroundPicture",
486+ "table_name": "ground_pictures",
487+ "attributes": {
488+ "id": {
489+ "type": "number",
490+ "primary_key": 1,
491+ "rules": {
492+ "number": true
493+ }
494+ },
495+ "panel_id": {
496+ "type": "number",
497+ "rules": {
498+ "number": true
499+ }
500+ },
501+ "picture_id": {
502+ "type": "number",
503+ "rules": {
504+ "required": true,
505+ "number": true
506+ }
507+ },
508+ "caption": {
509+ "type": "text",
510+ "rules": {}
511+ },
512+ "repeat": {
513+ "type": "number",
514+ "rules": {
515+ "required": true,
516+ "number": true,
517+ "range": [
518+ 0,
519+ 3
520+ ]
521+ }
522+ },
523+ "x": {
524+ "type": "number",
525+ "rules": {
526+ "required": true,
527+ "number": true
528+ }
529+ },
530+ "y": {
531+ "type": "number",
532+ "rules": {
533+ "required": true,
534+ "number": true
535+ }
536+ },
537+ "z": {
538+ "type": "number",
539+ "rules": {
540+ "required": true,
541+ "number": true,
542+ "min": 1
543+ }
544+ },
545+ "t": {
546+ "type": "number",
547+ "rules": {
548+ "required": true,
549+ "number": true,
550+ "min": 0
551+ }
552+ },
553+ "created_at": {
554+ "type": "datetime"
555+ },
556+ "updated_at": {
557+ "type": "datetime"
558+ }
559+ }
560+ },
561+ "GroundColor": "ground_color",
562+ "ground_color": {
563+ "class_name": "GroundColor",
564+ "table_name": "ground_colors",
565+ "attributes": {
566+ "id": {
567+ "type": "number",
568+ "primary_key": 1,
569+ "rules": {
570+ "number": true
571+ }
572+ },
573+ "panel_id": {
574+ "type": "number",
575+ "rules": {
576+ "number": true
577+ }
578+ },
579+ "caption": {
580+ "type": "text",
581+ "rules": {}
582+ },
583+ "code": {
584+ "type": "number",
585+ "rules": {
586+ "required": true,
587+ "number": true,
588+ "range": [
589+ 0,
590+ 16777215
591+ ]
592+ }
593+ },
594+ "z": {
595+ "type": "number",
596+ "rules": {
597+ "required": true,
598+ "number": true,
599+ "min": 1
600+ }
601+ },
602+ "t": {
603+ "type": "number",
604+ "rules": {
605+ "required": true,
606+ "number": true,
607+ "min": 0
608+ }
609+ },
610+ "created_at": {
611+ "type": "datetime"
612+ },
613+ "updated_at": {
614+ "type": "datetime"
615+ }
616+ }
617+ },
618+ "WritingFormat": "writing_format",
619+ "writing_format": {
620+ "class_name": "WritingFormat",
621+ "table_name": "writing_formats",
622+ "attributes": {
623+ "id": {
624+ "type": "number",
625+ "primary_key": 1,
626+ "rules": {
627+ "number": true
628+ }
629+ },
630+ "name": {
631+ "type": "text",
632+ "rules": {
633+ "required": true
634+ }
635+ },
636+ "classname": {
637+ "type": "text",
638+ "rules": {
639+ "required": true
640+ }
641+ },
642+ "caption": {
643+ "type": "text",
644+ "rules": {
645+ "required": true
646+ }
647+ },
648+ "system_picture_id": {
649+ "type": "number",
650+ "rules": {
651+ "required": true,
652+ "number": true
653+ }
654+ },
655+ "settings": {
656+ "type": "text",
657+ "rules": {
658+ "required": true
659+ }
660+ },
661+ "created_at": {
662+ "type": "datetime"
663+ },
664+ "updated_at": {
665+ "type": "datetime"
666+ }
667+ }
668+ }
669+ },
670+ "elements": [
671+ {
672+ "name": "panel_picture",
673+ "path_name": "panel_pictures",
674+ "parts": []
675+ },
676+ {
677+ "name": "speech_balloon",
678+ "path_name": "circle_speech_balloon/speech_balloons",
679+ "parts": [
680+ "balloon",
681+ "speech"
682+ ]
683+ },
684+ {
685+ "name": "ground_picture",
686+ "path_name": "ground_pictures",
687+ "parts": []
688+ },
689+ {
690+ "name": "ground_color",
691+ "path_name": "ground_colors",
692+ "parts": []
693+ }
694+ ],
695+ "forms": {
696+ "Panel": "panel",
697+ "panel": {
698+ "attributes": {
699+ "caption": {
700+ "column": "caption",
701+ "type": "text",
702+ "label": {},
703+ "options": {
704+ "row_break": true
705+ }
706+ },
707+ "width": {
708+ "column": "width",
709+ "type": "number",
710+ "label": {},
711+ "options": {
712+ "size": 5
713+ }
714+ },
715+ "height": {
716+ "column": "height",
717+ "type": "number",
718+ "label": {},
719+ "options": {
720+ "size": 5,
721+ "row_break": true
722+ }
723+ },
724+ "border": {
725+ "column": "border",
726+ "type": "number",
727+ "label": {},
728+ "options": {
729+ "size": 5
730+ }
731+ },
732+ "publish": {
733+ "column": "publish",
734+ "type": "select",
735+ "label": {},
736+ "options": {
737+ "source": "magic_number",
738+ "key": "comic_visible_items",
739+ "size": 5,
740+ "row_break": true
741+ }
742+ },
743+ "id": {
744+ "column": "id",
745+ "type": "hidden",
746+ "label": {
747+ "type": "hidden"
748+ },
749+ "options": {}
750+ },
751+ "author_id": {
752+ "column": "author_id",
753+ "type": "hidden",
754+ "label": {
755+ "type": "hidden"
756+ },
757+ "options": {}
758+ }
759+ },
760+ "fields": [
761+ "caption",
762+ "width",
763+ "height",
764+ "border",
765+ "publish",
766+ "id",
767+ "author_id"
768+ ]
769+ },
770+ "PanelPicture": "panel_picture",
771+ "panel_picture": {
772+ "attributes": {
773+ "caption": {
774+ "column": "caption",
775+ "type": "text",
776+ "label": {},
777+ "options": {
778+ "row_break": true
779+ }
780+ },
781+ "x": {
782+ "column": "x",
783+ "type": "number",
784+ "label": {},
785+ "options": {
786+ "size": 5
787+ }
788+ },
789+ "y": {
790+ "column": "y",
791+ "type": "number",
792+ "label": {},
793+ "options": {
794+ "size": 5,
795+ "row_break": true
796+ }
797+ },
798+ "width": {
799+ "column": "width",
800+ "type": "number",
801+ "label": {},
802+ "options": {
803+ "size": 5,
804+ "row_break": true
805+ },
806+ "helpers": {
807+ "size": {
808+ "path": "panels/size_helper",
809+ "options": {
810+ "class": "panel_picture_width_tool"
811+ }
812+ }
813+ }
814+ },
815+ "height": {
816+ "column": "height",
817+ "type": "number",
818+ "label": {},
819+ "options": {
820+ "size": 5,
821+ "row_break": true
822+ },
823+ "helpers": {
824+ "size": {
825+ "path": "panels/size_helper",
826+ "options": {
827+ "class": "panel_picture_height_tool"
828+ }
829+ }
830+ }
831+ },
832+ "link": {
833+ "column": "link",
834+ "type": "text",
835+ "label": {},
836+ "options": {
837+ "row_break": true
838+ }
839+ },
840+ "id": {
841+ "column": "id",
842+ "type": "hidden",
843+ "label": {
844+ "type": "hidden"
845+ },
846+ "options": {}
847+ },
848+ "panel_id": {
849+ "column": "panel_id",
850+ "type": "hidden",
851+ "label": {
852+ "type": "hidden"
853+ },
854+ "options": {}
855+ },
856+ "picture_id": {
857+ "column": "picture_id",
858+ "type": "hidden",
859+ "label": {
860+ "type": "hidden"
861+ },
862+ "options": {}
863+ },
864+ "z": {
865+ "column": "z",
866+ "type": "hidden",
867+ "label": {
868+ "type": "hidden"
869+ },
870+ "options": {}
871+ },
872+ "t": {
873+ "column": "t",
874+ "type": "hidden",
875+ "label": {
876+ "type": "hidden"
877+ },
878+ "options": {}
879+ }
880+ },
881+ "fields": [
882+ "caption",
883+ "x",
884+ "y",
885+ "width",
886+ "height",
887+ "link",
888+ "id",
889+ "panel_id",
890+ "picture_id",
891+ "z",
892+ "t"
893+ ]
894+ },
895+ "speech_balloon": {
896+ "attributes": {
897+ "speech_balloon.id": {
898+ "column": "id",
899+ "type": "hidden",
900+ "label": {
901+ "type": "hidden"
902+ },
903+ "options": {}
904+ },
905+ "speech_balloon.panel_id": {
906+ "column": "panel_id",
907+ "type": "hidden",
908+ "label": {
909+ "type": "hidden"
910+ },
911+ "options": {}
912+ },
913+ "speech_balloon.speech_balloon_template_id": {
914+ "column": "speech_balloon_template_id",
915+ "type": "hidden",
916+ "label": {
917+ "type": "hidden"
918+ },
919+ "options": {}
920+ },
921+ "speech_balloon.caption": {
922+ "column": "caption",
923+ "type": "text",
924+ "label": {},
925+ "options": {
926+ "row_break": true
927+ }
928+ },
929+ "speech_balloon.z": {
930+ "column": "z",
931+ "type": "hidden",
932+ "label": {
933+ "type": "hidden"
934+ },
935+ "options": {}
936+ },
937+ "speech_balloon.t": {
938+ "column": "t",
939+ "type": "hidden",
940+ "label": {
941+ "type": "hidden"
942+ },
943+ "options": {}
944+ },
945+ "speech_balloon.classname": {
946+ "column": "classname",
947+ "type": "hidden",
948+ "label": {
949+ "type": "hidden"
950+ },
951+ "options": {}
952+ },
953+ "speech_balloon.settings": {
954+ "column": "settings",
955+ "type": "hidden",
956+ "label": {
957+ "type": "hidden"
958+ },
959+ "options": {}
960+ },
961+ "balloon.id": {
962+ "model": "balloon",
963+ "part": "balloon",
964+ "column": "id",
965+ "type": "hidden",
966+ "label": {
967+ "type": "hidden"
968+ },
969+ "options": {}
970+ },
971+ "balloon.speech_balloon_id": {
972+ "model": "balloon",
973+ "part": "balloon",
974+ "column": "speech_balloon_id",
975+ "type": "hidden",
976+ "label": {
977+ "type": "hidden"
978+ },
979+ "options": {}
980+ },
981+ "balloon.system_picture_id": {
982+ "model": "balloon",
983+ "part": "balloon",
984+ "column": "system_picture_id",
985+ "type": "hidden",
986+ "label": {
987+ "type": "hidden"
988+ },
989+ "options": {}
990+ },
991+ "balloon.r": {
992+ "model": "balloon",
993+ "part": "balloon",
994+ "column": "r",
995+ "type": "number",
996+ "label": {},
997+ "options": {
998+ "size": 5,
999+ "row_break": true
1000+ },
1001+ "helpers": {
1002+ "tail_angle": {
1003+ "path": "panels/tail_angle_helper",
1004+ "options": {}
1005+ }
1006+ }
1007+ },
1008+ "balloon.x": {
1009+ "model": "balloon",
1010+ "part": "balloon",
1011+ "column": "x",
1012+ "type": "number",
1013+ "label": {},
1014+ "options": {
1015+ "size": 5
1016+ }
1017+ },
1018+ "balloon.y": {
1019+ "model": "balloon",
1020+ "part": "balloon",
1021+ "column": "y",
1022+ "type": "number",
1023+ "label": {},
1024+ "options": {
1025+ "size": 5,
1026+ "row_break": true
1027+ }
1028+ },
1029+ "balloon.width": {
1030+ "model": "balloon",
1031+ "part": "balloon",
1032+ "column": "width",
1033+ "type": "number",
1034+ "label": {},
1035+ "options": {
1036+ "size": 5
1037+ }
1038+ },
1039+ "balloon.height": {
1040+ "model": "balloon",
1041+ "part": "balloon",
1042+ "column": "height",
1043+ "type": "number",
1044+ "label": {},
1045+ "options": {
1046+ "size": 5,
1047+ "row_break": true
1048+ }
1049+ },
1050+ "balloon.settings": {
1051+ "model": "balloon",
1052+ "part": "balloon",
1053+ "column": "settings",
1054+ "type": "hidden",
1055+ "label": {
1056+ "type": "hidden"
1057+ },
1058+ "options": {}
1059+ },
1060+ "speech.id": {
1061+ "model": "speech",
1062+ "part": "speech",
1063+ "column": "id",
1064+ "type": "hidden",
1065+ "label": {
1066+ "type": "hidden"
1067+ },
1068+ "options": {}
1069+ },
1070+ "speech.speech_balloon_id": {
1071+ "model": "speech",
1072+ "part": "speech",
1073+ "column": "speech_balloon_id",
1074+ "type": "hidden",
1075+ "label": {
1076+ "type": "hidden"
1077+ },
1078+ "options": {}
1079+ },
1080+ "speech.x": {
1081+ "model": "speech",
1082+ "part": "speech",
1083+ "column": "x",
1084+ "type": "hidden",
1085+ "label": {
1086+ "type": "hidden"
1087+ },
1088+ "options": {}
1089+ },
1090+ "speech.y": {
1091+ "model": "speech",
1092+ "part": "speech",
1093+ "column": "y",
1094+ "type": "hidden",
1095+ "label": {
1096+ "type": "hidden"
1097+ },
1098+ "options": {}
1099+ },
1100+ "speech.width": {
1101+ "model": "speech",
1102+ "part": "speech",
1103+ "column": "width",
1104+ "type": "hidden",
1105+ "label": {
1106+ "type": "hidden"
1107+ },
1108+ "options": {}
1109+ },
1110+ "speech.height": {
1111+ "model": "speech",
1112+ "part": "speech",
1113+ "column": "height",
1114+ "type": "hidden",
1115+ "label": {
1116+ "type": "hidden"
1117+ },
1118+ "options": {}
1119+ },
1120+ "speech.writing_format_id": {
1121+ "model": "speech",
1122+ "part": "speech",
1123+ "column": "writing_format_id",
1124+ "type": "select",
1125+ "label": {},
1126+ "options": {
1127+ "source": "model",
1128+ "model": "writing_format",
1129+ "method": "enable_list",
1130+ "caption": "caption"
1131+ }
1132+ },
1133+ "speech.font_size": {
1134+ "model": "speech",
1135+ "part": "speech",
1136+ "column": "font_size",
1137+ "type": "select",
1138+ "label": {},
1139+ "options": {
1140+ "source": "magic_number",
1141+ "key": "speech_font_size_items",
1142+ "row_break": true
1143+ }
1144+ },
1145+ "speech.text_align": {
1146+ "model": "speech",
1147+ "part": "speech",
1148+ "column": "text_align",
1149+ "type": "select",
1150+ "label": {},
1151+ "options": {
1152+ "source": "magic_number",
1153+ "key": "speech_text_align_items"
1154+ }
1155+ },
1156+ "speech.quotes": {
1157+ "model": "speech",
1158+ "part": "speech",
1159+ "column": "quotes",
1160+ "type": "text",
1161+ "label": {},
1162+ "options": {
1163+ "size": 5
1164+ }
1165+ },
1166+ "speech.content": {
1167+ "model": "speech",
1168+ "part": "speech",
1169+ "column": "content",
1170+ "type": "text_area",
1171+ "label": {
1172+ "row_break": true
1173+ },
1174+ "options": {
1175+ "size": "45x5"
1176+ }
1177+ },
1178+ "speech.fore_color": {
1179+ "model": "speech",
1180+ "part": "speech",
1181+ "column": "fore_color",
1182+ "type": "hidden",
1183+ "label": {
1184+ "row_break": true
1185+ },
1186+ "options": {},
1187+ "helpers": {
1188+ "color": {
1189+ "path": "panels/color_helper",
1190+ "options": {},
1191+ "wrapper": "speech-fore_color-wrap"
1192+ }
1193+ }
1194+ },
1195+ "speech.settings": {
1196+ "model": "speech",
1197+ "part": "speech",
1198+ "column": "settings",
1199+ "type": "hidden",
1200+ "label": {
1201+ "type": "hidden"
1202+ },
1203+ "options": {}
1204+ }
1205+ }
1206+ },
1207+ "CircleSpeechBalloon": "circle_speech_balloon",
1208+ "circle_speech_balloon": {
1209+ "base": "speech_balloon",
1210+ "attributes": {},
1211+ "fields": [
1212+ "speech_balloon.caption",
1213+ "balloon.r",
1214+ "balloon.x",
1215+ "balloon.y",
1216+ "balloon.width",
1217+ "balloon.height",
1218+ "balloon.id",
1219+ "balloon.speech_balloon_id",
1220+ "balloon.system_picture_id",
1221+ "balloon.settings",
1222+ "speech.writing_format_id",
1223+ "speech.font_size",
1224+ "speech.text_align",
1225+ "speech.quotes",
1226+ "speech.content",
1227+ "speech.fore_color",
1228+ "speech.id",
1229+ "speech.speech_balloon_id",
1230+ "speech.x",
1231+ "speech.y",
1232+ "speech.width",
1233+ "speech.height",
1234+ "speech.settings",
1235+ "speech_balloon.id",
1236+ "speech_balloon.panel_id",
1237+ "speech_balloon.speech_balloon_template_id",
1238+ "speech_balloon.classname",
1239+ "speech_balloon.z",
1240+ "speech_balloon.t",
1241+ "speech_balloon.settings"
1242+ ]
1243+ },
1244+ "PlainSpeechBalloon": "plain_speech_balloon",
1245+ "plain_speech_balloon": {
1246+ "base": "speech_balloon",
1247+ "attributes": {
1248+ "balloon.r": {
1249+ "model": "balloon",
1250+ "part": "balloon",
1251+ "column": "r",
1252+ "type": "hidden",
1253+ "label": {
1254+ "type": "hidden"
1255+ },
1256+ "options": {}
1257+ }
1258+ },
1259+ "fields": [
1260+ "speech_balloon.caption",
1261+ "balloon.r",
1262+ "balloon.x",
1263+ "balloon.y",
1264+ "balloon.width",
1265+ "balloon.height",
1266+ "balloon.id",
1267+ "balloon.speech_balloon_id",
1268+ "balloon.system_picture_id",
1269+ "balloon.settings",
1270+ "speech.writing_format_id",
1271+ "speech.font_size",
1272+ "speech.text_align",
1273+ "speech.quotes",
1274+ "speech.content",
1275+ "speech.fore_color",
1276+ "speech.id",
1277+ "speech.speech_balloon_id",
1278+ "speech.x",
1279+ "speech.y",
1280+ "speech.width",
1281+ "speech.height",
1282+ "speech.settings",
1283+ "speech_balloon.id",
1284+ "speech_balloon.panel_id",
1285+ "speech_balloon.speech_balloon_template_id",
1286+ "speech_balloon.classname",
1287+ "speech_balloon.z",
1288+ "speech_balloon.t",
1289+ "speech_balloon.settings"
1290+ ]
1291+ },
1292+ "SquareSpeechBalloon": "square_speech_balloon",
1293+ "square_speech_balloon": {
1294+ "base": "speech_balloon",
1295+ "attributes": {
1296+ "balloon.r": {
1297+ "model": "balloon",
1298+ "part": "balloon",
1299+ "column": "r",
1300+ "type": "hidden",
1301+ "label": {
1302+ "type": "hidden"
1303+ },
1304+ "options": {}
1305+ }
1306+ },
1307+ "fields": [
1308+ "speech_balloon.caption",
1309+ "balloon.r",
1310+ "balloon.x",
1311+ "balloon.y",
1312+ "balloon.width",
1313+ "balloon.height",
1314+ "balloon.id",
1315+ "balloon.speech_balloon_id",
1316+ "balloon.system_picture_id",
1317+ "balloon.settings",
1318+ "speech.writing_format_id",
1319+ "speech.font_size",
1320+ "speech.text_align",
1321+ "speech.quotes",
1322+ "speech.content",
1323+ "speech.fore_color",
1324+ "speech.id",
1325+ "speech.speech_balloon_id",
1326+ "speech.x",
1327+ "speech.y",
1328+ "speech.width",
1329+ "speech.height",
1330+ "speech.settings",
1331+ "speech_balloon.id",
1332+ "speech_balloon.panel_id",
1333+ "speech_balloon.speech_balloon_template_id",
1334+ "speech_balloon.classname",
1335+ "speech_balloon.z",
1336+ "speech_balloon.t",
1337+ "speech_balloon.settings"
1338+ ]
1339+ },
1340+ "GroundPicture": "ground_picture",
1341+ "ground_picture": {
1342+ "attributes": {
1343+ "id": {
1344+ "column": "id",
1345+ "type": "hidden",
1346+ "label": {
1347+ "type": "hidden"
1348+ },
1349+ "options": {}
1350+ },
1351+ "panel_id": {
1352+ "column": "panel_id",
1353+ "type": "hidden",
1354+ "label": {
1355+ "type": "hidden"
1356+ },
1357+ "options": {}
1358+ },
1359+ "picture_id": {
1360+ "column": "picture_id",
1361+ "type": "hidden",
1362+ "label": {
1363+ "type": "hidden"
1364+ },
1365+ "options": {}
1366+ },
1367+ "caption": {
1368+ "column": "caption",
1369+ "type": "text",
1370+ "label": {},
1371+ "options": {
1372+ "row_break": true
1373+ }
1374+ },
1375+ "repeat": {
1376+ "column": "repeat",
1377+ "type": "select",
1378+ "label": {},
1379+ "options": {
1380+ "source": "magic_number",
1381+ "key": "ground_picture_repeat_items",
1382+ "row_break": true
1383+ }
1384+ },
1385+ "x": {
1386+ "column": "x",
1387+ "type": "number",
1388+ "label": {},
1389+ "options": {
1390+ "size": 5
1391+ }
1392+ },
1393+ "y": {
1394+ "column": "y",
1395+ "type": "number",
1396+ "label": {},
1397+ "options": {
1398+ "size": 5,
1399+ "row_break": true
1400+ }
1401+ },
1402+ "z": {
1403+ "column": "z",
1404+ "type": "hidden",
1405+ "label": {
1406+ "type": "hidden"
1407+ },
1408+ "options": {}
1409+ },
1410+ "t": {
1411+ "column": "t",
1412+ "type": "hidden",
1413+ "label": {
1414+ "type": "hidden"
1415+ },
1416+ "options": {}
1417+ }
1418+ },
1419+ "fields": [
1420+ "caption",
1421+ "repeat",
1422+ "x",
1423+ "y",
1424+ "z",
1425+ "t",
1426+ "id",
1427+ "panel_id",
1428+ "picture_id"
1429+ ]
1430+ },
1431+ "GroundColor": "ground_color",
1432+ "ground_color": {
1433+ "attributes": {
1434+ "id": {
1435+ "column": "id",
1436+ "type": "hidden",
1437+ "label": {
1438+ "type": "hidden"
1439+ },
1440+ "options": {}
1441+ },
1442+ "panel_id": {
1443+ "column": "panel_id",
1444+ "type": "hidden",
1445+ "label": {
1446+ "type": "hidden"
1447+ },
1448+ "options": {}
1449+ },
1450+ "caption": {
1451+ "column": "caption",
1452+ "type": "text",
1453+ "label": {},
1454+ "options": {
1455+ "row_break": true
1456+ }
1457+ },
1458+ "code": {
1459+ "column": "code",
1460+ "type": "hidden",
1461+ "label": {
1462+ "row_break": true
1463+ },
1464+ "options": {
1465+ "row_break": true
1466+ },
1467+ "helpers": {
1468+ "color": {
1469+ "path": "panels/color_helper",
1470+ "options": {},
1471+ "wrapper": "ground_color-code-wrap"
1472+ }
1473+ }
1474+ },
1475+ "z": {
1476+ "column": "z",
1477+ "type": "hidden",
1478+ "label": {
1479+ "type": "hidden"
1480+ },
1481+ "options": {}
1482+ },
1483+ "t": {
1484+ "column": "t",
1485+ "type": "hidden",
1486+ "label": {
1487+ "type": "hidden"
1488+ },
1489+ "options": {}
1490+ }
1491+ },
1492+ "fields": [
1493+ "id",
1494+ "panel_id",
1495+ "caption",
1496+ "code",
1497+ "z",
1498+ "t"
1499+ ]
1500+ }
1501+ },
1502+ "locales": {
1503+ "ja": {}
1504+ }
1505+}
1506+HD
1507+)
1508+ end
861509 end
--- a/app/models/panel.rb
+++ b/app/models/panel.rb
@@ -15,9 +15,6 @@ class Panel < ActiveRecord::Base
1515 validates :width, :presence => true, :numericality => true, :natural_number => true
1616 validates :height, :presence => true, :numericality => true, :natural_number => true
1717 validates :border, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
18- validates :x, :numericality => {:allow_blank => true}
19- validates :y, :numericality => {:allow_blank => true}
20- validates :z, :numericality => {:allow_blank => true, :greater_than => 0}
2118 validates :author_id, :presence => true, :numericality => true, :existence => {:both => false}
2219 validates :publish, :presence => true, :numericality => true
2320
@@ -86,8 +83,8 @@ class Panel < ActiveRecord::Base
8683 self.publish > 0
8784 end
8885
89- def tag_id
90- 'panel' + self.tag_panel_id
86+ def tag_id c = nil
87+ 'panel' + self.tag_panel_id + c.to_s
9188 end
9289
9390 def tag_panel_id
@@ -98,6 +95,34 @@ class Panel < ActiveRecord::Base
9895 self.tag_id + f.to_s
9996 end
10097
98+ def tag_attributes column = nil, opt = {}
99+ {
100+ :id => self.field_tag_id(column), :panel_id => self.tag_panel_id
101+ }.merge(opt)
102+ end
103+
104+ def select_tag_attributes(selected, column, opt = {})
105+ [
106+ :last, :first,
107+ {:html => {:selected => selected}},
108+ self.field_tag_attributes(column, opt)
109+ ]
110+ end
111+
112+ def field_tag_attributes column, opt = {}
113+ self.tag_attributes(column).merge(
114+ {:column => column}
115+ ).merge(opt)
116+ end
117+
118+ def tag_attr column = nil, opt = {}
119+ self.tag_attributes(column, opt).to_attr
120+ end
121+
122+ def field_tag_attr column, no_attr, opt = {}
123+ self.field_tag_attributes(column, no_attr, opt).to_attr
124+ end
125+
101126 def self.default_page_size
102127 25
103128 end
--- a/app/models/speech_balloon.rb
+++ b/app/models/speech_balloon.rb
@@ -47,6 +47,10 @@ class SpeechBalloon < ActiveRecord::Base
4747 false
4848 end
4949
50+ def extend_column
51+ 'classname'
52+ end
53+
5054 def supply_default
5155 if self.panel
5256 self.t = self.panel.new_t
--- a/app/views/comics/_form.html.erb
+++ b/app/views/comics/_form.html.erb
@@ -5,18 +5,26 @@
55 <%= f.label :title %><br />
66 <%= f.text_field :title %>
77 </div>
8+ <div class="row_break">
9+ </div>
810 <div class="field">
911 <%= f.label :description %><br />
1012 <%= f.text_area :description %>
1113 </div>
14+ <div class="row_break">
15+ </div>
1216 <div class="field">
1317 <%= f.label :visible %><br />
1418 <%= f.collection_select :visible, t_select_items(MagicNumber['comic_visible_items']), :last, :first, :html => {:selected => @comic.visible} %>
1519 </div>
20+ <div class="row_break">
21+ </div>
1622 <div class="field">
1723 <%= f.label :author_id %><br />
1824 <%= h @author.name %>
1925 </div>
26+ <div class="row_break">
27+ </div>
2028 <div class="actions">
2129 <%= f.submit %>
2230 </div>
--- a/app/views/ground_colors/_form.html.erb
+++ b/app/views/ground_colors/_form.html.erb
@@ -5,6 +5,8 @@
55 <%= f.label :caption %>
66 <%= f.text_field :caption, elm.field_tag_attributes(:caption, no_attr) %>
77 </div>
8+ <div class="row_break">
9+ </div>
810 <div class="field">
911 <%= f.label :code %>
1012 <%= f.text_field :code, elm.field_tag_attributes(:code, no_attr, :size => 8) %>
@@ -14,10 +16,15 @@
1416 </div>
1517 <% end %>
1618 </div>
19+ <div class="row_break">
20+ </div>
1721 <div class="field">
1822 <%= f.label :z %>
1923 <%= f.number_field :z, elm.field_tag_attributes(:z, no_attr, :size => 5) %>
20-
24+ </div>
25+ <div class="row_break">
26+ </div>
27+ <div class="field">
2128 <%= f.label :t %>
2229 <%= f.number_field :t, elm.field_tag_attributes(:t, no_attr, :size => 5) %>
2330 </div>
--- a/app/views/ground_pictures/_form.html.erb
+++ b/app/views/ground_pictures/_form.html.erb
@@ -5,21 +5,33 @@
55 <%= f.label :caption %>
66 <%= f.text_field :caption, elm.field_tag_attributes(:caption, no_attr) %>
77 </div>
8+ <div class="row_break">
9+ </div>
810 <div class="field">
911 <%= f.label :repeat %>
1012 <%= f.collection_select :repeat, t_select_items(MagicNumber['ground_picture_repeat_items']), *elm.select_tag_attributes(elm.repeat, :repeat, no_attr) %>
1113 </div>
14+ <div class="row_break">
15+ </div>
1216 <div class="field">
1317 <%= f.label :x %>
1418 <%= f.number_field :x, elm.field_tag_attributes(:x, no_attr, :size => 5) %>
15-
19+ </div>
20+ <div class="row_break">
21+ </div>
22+ <div class="field">
1623 <%= f.label :y %>
1724 <%= f.number_field :y, elm.field_tag_attributes(:y, no_attr, :size => 5) %>
1825 </div>
26+ <div class="row_break">
27+ </div>
1928 <div class="field">
2029 <%= f.label :z %>
2130 <%= f.number_field :z, elm.field_tag_attributes(:z, no_attr, :size => 5) %>
22-
31+ </div>
32+ <div class="row_break">
33+ </div>
34+ <div class="field">
2335 <%= f.label :t %>
2436 <%= f.number_field :t, elm.field_tag_attributes(:t, no_attr, :size => 5) %>
2537 </div>
--- a/app/views/home/index.html.erb
+++ b/app/views/home/index.html.erb
@@ -1,34 +1,41 @@
11 <h1><%= t '.title' -%></h1>
2-
32 <h2><%= link_to h(@author.name), main_app.author_path(@author) -%></h2>
43 <h3><%= t('.updated_scroll') -%></h3>
54 <table>
65 <tr height="100px">
76 <td width="200px" align="center" valign="middle">
87 <%= link_to t_m('Scroll'), '/home/scrolls' %>
8+ <%= link_to t('*'), new_scroll_path %>
99 </td>
1010 <td width="200px" align="center" valign="middle">
1111 <%= link_to t_m('ScrollPanel'), '/home/scroll_panels' %>
12+ <%= link_to t('*'), new_scroll_panel_path %>
1213 </td>
1314 <td width="200px" align="center" valign="middle">
1415 <%= link_to t_m('Comic'), '/home/comics' %>
16+ <%= link_to t('*'), new_comic_path %>
1517 </td>
1618 <td width="200px" align="center" valign="middle">
1719 <%= link_to t_m('Story'), '/home/stories' %>
20+ <%= link_to t('*'), new_story_path %>
1821 </td>
1922 </tr>
2023 <tr height="100px">
2124 <td width="200px" align="center" valign="middle">
2225 <%= link_to t_m('StorySheet'), '/home/story_sheets' %>
26+ <%= link_to t('*'), new_story_sheet_path %>
2327 </td>
2428 <td width="200px" align="center" valign="middle">
2529 <%= link_to t_m('Sheet'), '/home/sheets' %>
30+ <%= link_to t('*'), new_sheet_path %>
2631 </td>
2732 <td width="200px" align="center" valign="middle">
2833 <%= link_to t_m('SheetPanel'), '/home/sheet_panels' %>
34+ <%= link_to t('*'), new_sheet_panel_path %>
2935 </td>
3036 <td width="200px" align="center" valign="middle">
3137 <%= link_to t_m('Panel'), '/home/panels' %>
38+ <%= link_to t('*'), new_panel_path %>
3239 </td>
3340 </tr>
3441 </table>
@@ -58,6 +65,7 @@
5865 <tr height="100px">
5966 <td width="200px" align="center" valign="middle">
6067 <%= link_to t_m('OriginalPicture'), main_app.original_pictures_path %>
68+ <%= link_to t('*'), new_original_picture_path %>
6169 </td>
6270 <td width="200px" align="center" valign="middle">
6371 <%= link_to t_m('ResourcePicture'), '/home/resource_pictures' %>
--- a/app/views/layouts/test.html.erb
+++ b/app/views/layouts/test.html.erb
@@ -65,12 +65,17 @@
6565 <div width="100%" style="background-color: #fadddd; padding: 5px;">
6666 <%= link_to t('tab.creator.home'), '/home' %>
6767 <%= link_to t('tab.creator.comic'), '/home/comics' %>
68+ <%= link_to t('*'), new_comic_path %>
6869 <%= link_to t('tab.creator.story'), '/home/stories' %>
6970 <%= link_to t('tab.creator.sheet'), '/home/sheets' %>
71+ <%= link_to t('*'), new_sheet_path %>
7072 <%= link_to t('tab.creator.scroll'), '/home/scrolls' %>
73+ <%= link_to t('*'), new_scroll_path %>
7174 <%= link_to t('tab.creator.panel'), '/home/panels' %>
75+ <%= link_to t('*'), new_panel_path %>
7276 <% if @artist %>
7377 <%= link_to t('tab.creator.original_picture'), main_app.original_pictures_path %>
78+ <%= link_to t('*'), new_original_picture_path %>
7479 <%= link_to t('tab.creator.resource_picture'), '/home/resource_pictures' %>
7580 <% end %>
7681 <% if @author and @author.working? -%>
--- a/app/views/panel_pictures/_form.html.erb
+++ b/app/views/panel_pictures/_form.html.erb
@@ -5,20 +5,32 @@
55 <%= f.label :caption %>
66 <%= f.text_field :caption, elm.field_tag_attributes(:caption, no_attr) %>
77 </div>
8+ <div class="row_break">
9+ </div>
810 <div class="field">
911 <%= f.label :x %>
1012 <%= f.number_field :x, elm.field_tag_attributes(:x, no_attr, :size => 5) %>
11-
13+ </div>
14+ <div class="row_break">
15+ </div>
16+ <div class="field">
1217 <%= f.label :y %>
1318 <%= f.number_field :y, elm.field_tag_attributes(:y, no_attr, :size => 5) %>
1419 </div>
20+ <div class="row_break">
21+ </div>
1522 <div class="field">
1623 <%= f.label :z %>
1724 <%= f.number_field :z, elm.field_tag_attributes(:z, no_attr, :size => 5) %>
18-
25+ </div>
26+ <div class="row_break">
27+ </div>
28+ <div class="field">
1929 <%= f.label :t %>
2030 <%= f.number_field :t, elm.field_tag_attributes(:t, no_attr, :size => 5) %>
2131 </div>
32+ <div class="row_break">
33+ </div>
2234 <div class="field">
2335 <%= f.label :width %>
2436 <%= f.number_field :width, elm.field_tag_attributes(:width, no_attr, :size => 5) %>
@@ -26,6 +38,8 @@
2638 <%= render elm.form_helper_template(:width), :elm => elm, :no_attr => no_attr, :opt => {:class => "panel_picture_width_tool"} %>
2739 <% end %>
2840 </div>
41+ <div class="row_break">
42+ </div>
2943 <div class="field">
3044 <%= f.label :height %>
3145 <%= f.number_field :height, elm.field_tag_attributes(:height, no_attr, :size => 5) %>
@@ -33,6 +47,8 @@
3347 <%= render elm.form_helper_template(:height), :elm => elm, :no_attr => no_attr, :opt => {:class => "panel_picture_height_tool"} %>
3448 <% end %>
3549 </div>
50+ <div class="row_break">
51+ </div>
3652 <div class="field">
3753 <%= f.label :link %>
3854 <%= f.text_field :link, elm.field_tag_attributes(:link, no_attr) %>
--- /dev/null
+++ b/app/views/panels/_element_form.html.erb
@@ -0,0 +1,87 @@
1+<% element_name = elm.element_name %>
2+<% extend_element_name = elm.extend_element_name %>
3+<% form_configurations = elm.find_configurations @configurations['forms'], extend_element_name %>
4+<% base_attributes = if form_configurations['base'] %>
5+ <% @configurations['forms'][form_configurations['base']]['attributes'] %>
6+<% else %>
7+ <% {} %>
8+<% end %>
9+<% extend_attributes = form_configurations['attributes'] || {} %>
10+<% form_attributes = base_attributes.merge(extend_attributes) %>
11+<% form_model_name = form_configurations['model'] || form_configurations['base'] || element_name %>
12+<%= form_for(elm, :html => elm.tag_attributes('form', 'data-form-name' => extend_element_name)) do |f| %>
13+ <% form_configurations['fields'].each do |field_name| %>
14+ <% field_configurations = form_attributes[field_name] || {} %>
15+ <% field_model_name = field_configurations['model'] || form_model_name %>
16+ <% model_configurations = @configurations['models'][field_model_name] %>
17+ <% column = field_configurations['column'] %>
18+ <% model_configurations['attributes'] %>
19+ <% primary_key = model_configurations['attributes'][column]['primary_key'] %>
20+
21+ <% next if primary_key and elm.new_record? %>
22+
23+ <% options = field_configurations['options'] || {} %>
24+ <% opt = {} %>
25+ <% opt.merge!('data-model' => field_model_name) %>
26+ <% field_element = if field_configurations['part'] %>
27+ <% elm.__send__ field_configurations['part'] %>
28+ <% else %>
29+ <% elm %>
30+ <% end %>
31+ <% name = if field_configurations['part'] %>
32+ <% form_model_name + '[' + field_model_name + '_attributes][' + column + ']' %>
33+ <% else %>
34+ <% form_model_name + '[' + column + ']' %>
35+ <% end %>
36+ <div class="field">
37+ <% label = field_configurations['label'] || {} %>
38+ <% if label['type'] and label['type'] == 'hidden' %>
39+ <% else %>
40+ <%= t 'activerecord.attributes.' + field_model_name + '.' + column %>
41+ <% end %>
42+ <% if label['row_break'] %>
43+ <br>
44+ <% end %>
45+ <% case field_configurations['type'] %>
46+ <% when 'text' %>
47+ <% opt['size'] = field_configurations['options']['size'] if field_configurations['options']['size'] %>
48+ <%= text_field_tag name, field_element.attributes[column], field_element.field_tag_attributes(column, no_attr, opt) %>
49+ <% when 'text_area' %>
50+ <% opt['size'] = field_configurations['options']['size'] if field_configurations['options']['size'] %>
51+ <%= text_area_tag name, field_element.attributes[column], field_element.field_tag_attributes(column, no_attr, opt) %>
52+ <% when 'number' %>
53+ <% opt['size'] = field_configurations['options']['size'] if field_configurations['options']['size'] %>
54+ <%= number_field_tag name, field_element.attributes[column], field_element.field_tag_attributes(column, no_attr, opt) %>
55+ <% when 'hidden' %>
56+ <%= hidden_field_tag name, field_element.attributes[column], field_element.field_tag_attributes(column, no_attr, opt) %>
57+ <% when 'select' %>
58+ <% items = case options['source'] %>
59+ <% when 'model' %>
60+ <% select_model = options['model'] %>
61+ <% select_class = @configurations['models'][select_model]['class_name'] %>
62+ <% l = select_class.constantize.__send__ options['method'] %>
63+ <% l.map {|i| [i.attributes[options['caption']], i.id] } %>
64+ <% when 'magic_number' %>
65+ <% t_select_items(MagicNumber[options['key']]) %>
66+ <% else %>
67+ <% end %>
68+ <%= select_tag name, options_for_select(items, field_element.attributes[column]), field_element.field_tag_attributes(column, no_attr, opt) %>
69+ <% end %>
70+ <% if field_configurations['helpers'] %>
71+ <% field_configurations['helpers'].each do |n, helper| %>
72+ <% if helper['wrapper'] %>
73+ <div class="<%= helper['wrapper'] -%>">
74+ <% end %>
75+ <%= render helper['path'], :elm => field_element, :no_attr => no_attr, :opt => helper['options'] %>
76+ <% if helper['wrapper'] %>
77+ </div>
78+ <% end %>
79+ <% end %>
80+ <% end %>
81+ </div>
82+ <% if options['row_break'] %>
83+ <div class="row_break">
84+ </div>
85+ <% end %>
86+ <% end %>
87+<% end %>
--- a/app/views/panels/_element_tab.html.erb
+++ b/app/views/panels/_element_tab.html.erb
@@ -1,8 +1,8 @@
1-<li id="<%= elm.field_tag_id(:element_tab) -%>" panel_id="<%= elm.tag_panel_id -%>" element_id="<%= elm.tag_element_id -%>" element_type="<%= elm.tag_element_type -%>">
1+<li class="element_tab" <%= raw elm.tag_attr(:element_tab) -%>>
22 <a href="#elements-tabs-<%= elm.t -%>">
33 <div class="elements-tab">
44 <%= render elm.element_face_template, :elm => elm %>
55 </div>
66 </a>
7- <button class="ui-icon-destroy" id="<%= elm.field_tag_id(:_destroy_button) -%>" panel_id="<%= elm.tag_panel_id -%>" element_id="<%= elm.tag_element_id -%>" element_type="<%= elm.tag_element_type -%>"></button>
7+ <button class="ui-icon-destroy" <%= raw elm.tag_attr(:_destroy_button) -%>></button>
88 </li>
--- a/app/views/panels/_form.html.erb
+++ b/app/views/panels/_form.html.erb
@@ -1,35 +1,44 @@
1+<% @configurations = configurations %>
12 <div id="tabs" class="panel-editor" panel_id="<%= @panel.tag_panel_id -%>" current="1">
23 <ul>
3- <li><a href="#tabs-1">panel</a></li>
4- <li><a href="#tabs-2">elements</a></li>
5- <li><a href="#tabs-3">t order</a></li>
6- <li><a href="#tabs-4">z order</a></li>
7- <li><a href="#tabs-5">new</a></li>
4+ <li id="tabs-1-tab"><a href="#tabs-1">panel</a></li>
5+ <li id="tabs-2-tab"><a href="#tabs-2">elements</a></li>
6+ <li id="tabs-3-tab"><a href="#tabs-3">t order</a></li>
7+ <li id="tabs-4-tab"><a href="#tabs-4">z order</a></li>
8+ <li id="tabs-5-tab"><a href="#tabs-5">new</a></li>
89 </ul>
910 <div id="tabs-1">
10- <%= form_for(@panel) do |f| %>
11+ <%= form_for(@panel, :html => {:id => @panel.tag_id('form'), 'data-form-name' => 'panel'}) do |f| %>
1112 <%= render 'system/error_explanation', :obj => @panel %>
1213
1314 <div class="field">
1415 <%= f.label :caption %>
15- <%= f.text_field :caption, :id => @panel.field_tag_id(:caption), :panel_id => @panel.tag_panel_id, :column => :caption -%>
16+ <%= f.text_field :caption, @panel.field_tag_attributes(:caption, 'data-model' => 'panel') -%>
17+ </div>
18+ <div class="row_break">
1619 </div>
1720 <div class="field">
1821 <%= f.label :width %>
19- <%= f.number_field :width, :size => 5, :id => @panel.field_tag_id(:width), :panel_id => @panel.tag_panel_id, :column => :width %>
20-
22+ <%= f.number_field :width, @panel.field_tag_attributes(:width, :size => 5, 'data-model' => 'panel') %>
23+ </div>
24+ <div class="field">
2125 <%= f.label :height %>
22- <%= f.number_field :height, :size => 5, :id => @panel.field_tag_id(:height), :panel_id => @panel.tag_panel_id, :column => :height %>
23-
26+ <%= f.number_field :height, @panel.field_tag_attributes(:height, :size => 5, 'data-model' => 'panel') %>
27+ </div>
28+ <div class="row_break">
29+ </div>
30+ <div class="field">
2431 <%= f.label :border %>
25- <%= f.number_field :border, :size => 5, :id => @panel.field_tag_id(:border), :panel_id => @panel.tag_panel_id, :column => :border %>
32+ <%= f.number_field :border, @panel.field_tag_attributes(:border, :size => 5, 'data-model' => 'panel') %>
2633 </div>
2734 <div class="field">
2835 <%= f.label :publish %>
29- <%= f.collection_select :publish, t_select_items(MagicNumber['panel_visible_items']), :last, :first, {:html => {:selected => @panel.publish}}, {:id => @panel.field_tag_id(:publish), :panel_id => @panel.tag_panel_id, :column => :publish} %>
36+ <%= f.collection_select :publish, t_select_items(MagicNumber['panel_visible_items']), *@panel.select_tag_attributes(@panel.publish, :publish, 'data-model' => 'panel') %>
37+ </div>
38+ <div class="row_break">
3039 </div>
3140 <% unless @panel.new_record? %>
32- <%= f.hidden_field :id, :id => @panel.field_tag_id(:id), :panel_id => @panel.tag_panel_id, :column => :id %>
41+ <%= f.hidden_field :id, @panel.field_tag_attributes(:id, 'data-model' => 'panel') %>
3342 <% end %>
3443 <div class="actions">
3544 <%= f.submit 'panels.submit', :class => "submit" %>
@@ -44,10 +53,10 @@
4453 <% end %>
4554 </ul>
4655 <% @panel.panel_elements.each do |elm| %>
47- <div id="<%= elm.field_tag_id(:tab_panel) -%>" panel_id="<%= elm.tag_panel_id -%>" element_id="<%= elm.tag_element_id -%>" element_type="<%= elm.tag_element_type -%>">
56+ <div <%= raw elm.tag_attr(:tab_panel) -%>>
4857 <div id="elements-tabs-<%= elm.t -%>">
49- <%= render elm.form_template, :elm => elm, :no_attr => 0 %>
50- <%= hidden_field_tag '_destroy', '', :id => elm.field_tag_id(:_destroy), :panel_id => elm.tag_panel_id, :element_id => elm.tag_element_id, :element_type => elm.tag_element_type, :column => :_destroy %>
58+ <%= render 'element_form', :elm => elm, :no_attr => 0 %>
59+ <%= hidden_field_tag '_destroy', '', elm.field_tag_attributes(:_destroy, 0) %>
5160 </div>
5261 </div>
5362 <% end %>
@@ -55,9 +64,9 @@
5564 </div>
5665 <div id="tabs-3">
5766 <div class="tsort-box">
58- <ul id="<%= @panel.tag_id -%>tsort" class="tsort tsort-tabs-nav" panel_id="<%= @panel.tag_panel_id -%>">
67+ <ul class="tsort tsort-tabs-nav" <%= raw @panel.tag_attr(:tsort) -%>>
5968 <% @panel.panel_elements.each do |elm| %>
60- <li id="<%= elm.field_tag_id(:tsort) -%>" panel_id="<%= elm.tag_panel_id -%>" element_id="<%= elm.tag_element_id -%>" element_type="<%= elm.tag_element_type -%>">
69+ <li <%= raw elm.tag_attr(:tsort) -%>>
6170 <div class="elements-tab">
6271 <%= render elm.path_name + '/element_face', :elm => elm %>
6372 </div>
@@ -65,9 +74,9 @@
6574 <% end %>
6675 </ul>
6776 </div>
68- <div id="<%= @panel.tag_id -%>scenario" class="scenario" panel_id="<%= @panel.tag_panel_id -%>">
77+ <div class="scenario" <%= raw @panel.tag_attr(:scenario) -%>>
6978 <% @panel.panel_elements.each do |elm| %>
70- <div panel_id="<%= elm.tag_panel_id -%>" element_id="<%= elm.tag_element_id -%>" element_type="<%= elm.tag_element_type -%>">
79+ <div <%= raw elm.tag_attr() -%>>
7180 <%= render elm.scenario_template, :elm => elm, :no_attr => 0 %>
7281 </div>
7382 <% end %>
@@ -77,9 +86,9 @@
7786 </div>
7887 <div id="tabs-4">
7988 <div class="zsort-box">
80- <ul id="<%= @panel.tag_id -%>zsort" class="zsort zsort-tabs-nav" panel_id="<%= @panel.tag_panel_id -%>">
89+ <ul class="zsort zsort-tabs-nav" <%= raw @panel.tag_attr(:zsort) -%>>
8190 <% @panel.zorderd_elements.each do |elm| %>
82- <li id="<%= elm.field_tag_id(:zsort) -%>" panel_id="<%= elm.tag_panel_id -%>" element_id="<%= elm.tag_element_id -%>" element_type="<%= elm.tag_element_type -%>">
91+ <li <%= raw elm.tag_attr(:zsort) -%>>
8392 <div class="elements-tab">
8493 <%= render elm.class.to_s.tableize + '/element_face', :elm => elm %>
8594 </div>
@@ -171,3 +180,4 @@
171180 </div>
172181 <% end %>
173182 </div>
183+ <%# text_field_tag "json", '', :id => 'pettanr-configurations' %>
--- a/app/views/panels/_size_helper.html.erb
+++ b/app/views/panels/_size_helper.html.erb
@@ -1 +1 @@
1-<%= content_tag :span, '', elm.tag_attributes('', :class => opt[:class]) %>
1+<%= content_tag :span, '', elm.tag_attributes('', :class => opt[:class] || opt['class']) %>
--- a/app/views/scroll_panels/_form.html.erb
+++ b/app/views/scroll_panels/_form.html.erb
@@ -5,14 +5,20 @@
55 <%= f.label :scroll_id %><br />
66 <%= f.number_field :scroll_id %>
77 </div>
8+ <div class="row_break">
9+ </div>
810 <div class="field">
911 <%= f.label :t %><br />
1012 <%= f.number_field :t %>
1113 </div>
14+ <div class="row_break">
15+ </div>
1216 <div class="field">
1317 <%= f.label :panel_id %><br />
1418 <%= f.number_field :panel_id %>
1519 </div>
20+ <div class="row_break">
21+ </div>
1622
1723 <div class="actions">
1824 <%= f.submit %>
--- a/app/views/scroll_panels/edit.html.erb
+++ b/app/views/scroll_panels/edit.html.erb
@@ -2,4 +2,3 @@
22 <p id="notice"><%= notice %></p>
33
44 <%= render 'form' %>
5-<%= button_to 'Destroy', @scroll_panel, confirm: 'Are you sure?', method: :delete %>
--- a/app/views/scrolls/_form.html.erb
+++ b/app/views/scrolls/_form.html.erb
@@ -5,18 +5,26 @@
55 <%= f.label :title %><br />
66 <%= f.text_field :title %>
77 </div>
8+ <div class="row_break">
9+ </div>
810 <div class="field">
911 <%= f.label :description %><br />
1012 <%= f.text_area :description %>
1113 </div>
14+ <div class="row_break">
15+ </div>
1216 <div class="field">
1317 <%= f.label :visible %><br />
1418 <%= f.collection_select :visible, t_select_items(MagicNumber['scroll_visible_items']), :last, :first, :html => {:selected => @scroll.visible} %>
1519 </div>
20+ <div class="row_break">
21+ </div>
1622 <div class="field">
1723 <%= f.label :author_id %><br />
1824 <%= h @author.name %>
1925 </div>
26+ <div class="row_break">
27+ </div>
2028 <div class="actions">
2129 <%= f.submit %>
2230 </div>
--- a/app/views/scrolls/show.html.erb
+++ b/app/views/scrolls/show.html.erb
@@ -32,8 +32,8 @@
3232 <%= l @scroll.updated_at %>
3333 </p>
3434
35-<%= link_to t('link.edit'), edit_scroll_path(@scroll) %>
3635 <% if @scroll.own? @author -%>
36+ <%= link_to t('link.edit'), edit_scroll_path(@scroll) %>
3737 <h3><%= t('scroll_panels.append.new_panels') -%></h3>
3838 <table>
3939 <% @new_panels.each do |panel| %>
--- a/app/views/sheet_panels/_form.html.erb
+++ b/app/views/sheet_panels/_form.html.erb
@@ -31,6 +31,8 @@
3131 <%= f.number_field :y, elm.field_tag_attributes(:y, no_attr, :size => 5) %>
3232 <% end %>
3333 </div>
34+ <div class="row_break">
35+ </div>
3436 <div class="field">
3537 <%= f.label :z %>
3638 <% if elm.new_record? %>
@@ -46,6 +48,8 @@
4648 <%= f.number_field :t, elm.field_tag_attributes(:t, no_attr, :size => 5) %>
4749 <% end %>
4850 </div>
51+ <div class="row_break">
52+ </div>
4953
5054 <% unless elm.new_record? %>
5155 <%= f.hidden_field :id, elm.field_tag_attributes(:id, no_attr) %>
--- a/app/views/sheets/_form.html.erb
+++ b/app/views/sheets/_form.html.erb
@@ -14,6 +14,8 @@
1414 <%= f.label :caption %>
1515 <%= f.text_field :caption, :id => @sheet.field_tag_id(:caption), :sheet_id => @sheet.tag_sheet_id, :column => :caption -%>
1616 </div>
17+ <div class="row_break">
18+ </div>
1719 <div class="field">
1820 <%= f.label :width %>
1921 <%= f.number_field :width, :size => 5, :id => @sheet.field_tag_id(:width), :sheet_id => @sheet.tag_sheet_id, :column => :width %>
@@ -22,10 +24,14 @@
2224 <%= f.number_field :height, :size => 5, :id => @sheet.field_tag_id(:height), :sheet_id => @sheet.tag_sheet_id, :column => :height %>
2325
2426 </div>
27+ <div class="row_break">
28+ </div>
2529 <div class="field">
2630 <%= f.label :visible %>
2731 <%= f.collection_select :visible, t_select_items(MagicNumber['sheet_visible_items']), :last, :first, {:html => {:selected => @sheet.visible}}, {:id => @sheet.field_tag_id(:visible), :sheet_id => @sheet.tag_sheet_id, :column => :visible} %>
2832 </div>
33+ <div class="row_break">
34+ </div>
2935 <% unless @sheet.new_record? %>
3036 <%= f.hidden_field :id, :id => @sheet.field_tag_id(:id), :sheet_id => @sheet.tag_sheet_id, :column => :id %>
3137 <% end %>
--- a/app/views/speech_balloons/_form.html.erb
+++ /dev/null
@@ -1,35 +0,0 @@
1-<%= form_for(speech_balloon) do |f| %>
2- <%= render 'system/error_explanation', :obj => speech_balloon %>
3-
4- <div class="field">
5- <%= f.label :caption %><br />
6- <%= f.number_field :caption, :id => speech_balloon.field_tag_id(:caption), :panel_id => speech_balloon.tag_panel_id, :element_id => speech_balloon.tag_element_id, :element_type => speech_balloon.tag_element_type, :column => :caption, :tree => speech_balloon.field_tree(:caption) %>
7- </div>
8- <div class="field">
9- <%= f.label :z %><br />
10- <%= f.number_field :z, :id => speech_balloon.field_tag_id(:z), :panel_id => speech_balloon.tag_panel_id, :element_id => speech_balloon.tag_element_id, :element_type => speech_balloon.tag_element_type, :column => :z, :tree => speech_balloon.field_tree(:z) %>
11- </div>
12- <div class="field">
13- <%= f.label :t %><br />
14- <%= f.number_field :t, :id => speech_balloon.field_tag_id(:t), :panel_id => speech_balloon.tag_panel_id, :element_id => speech_balloon.tag_element_id, :element_type => speech_balloon.tag_element_type, :column => :t, :tree => speech_balloon.field_tree(:t) %>
15- </div>
16-
17- <%= f.fields_for(:balloon) do |bf| %>
18- <%= render 'balloons/form', :f => bf, :balloon => speech_balloon.balloon %>
19- <% end %>
20-
21- <%= f.fields_for(:speech) do |sf| %>
22- <%= render 'speeches/form', :f => sf, :speech => speech_balloon.speech %>
23- <% end %>
24-
25- <%= f.hidden_field :panel_id, :id => speech_balloon.field_tag_id(:panel_id), :panel_id => speech_balloon.tag_panel_id, :element_id => speech_balloon.tag_element_id, :element_type => speech_balloon.tag_element_type, :column => :panel_id, :tree => speech_balloon.field_tree(:panel_id) %>
26- <%= f.hidden_field :classname, :id => speech_balloon.field_tag_id(:classname), :panel_id => speech_balloon.tag_panel_id, :element_id => speech_balloon.tag_element_id, :element_type => speech_balloon.tag_element_type, :column => :classname, :tree => speech_balloon.field_tree(:classname) %>
27- <%= f.hidden_field :speech_balloon_template_id, :id => speech_balloon.field_tag_id(:speech_balloon_template_id), :panel_id => speech_balloon.tag_panel_id, :element_id => speech_balloon.tag_element_id, :element_type => speech_balloon.tag_element_type, :column => :speech_balloon_template_id, :tree => speech_balloon.field_tree(:speech_balloon_template_id) %>
28- <% unless speech_balloon.new_record? %>
29- <%= f.hidden_field :id, :id => speech_balloon.field_tag_id(:id), :panel_id => speech_balloon.tag_panel_id, :element_id => speech_balloon.tag_element_id, :element_type => speech_balloon.tag_element_type, :column => :id, :tree => speech_balloon.field_tree(:id) %>
30- <% end %>
31-
32- <div class="actions">
33- <%= f.submit t('speech_balloons.submit'), :class => "submit" %>
34- </div>
35-<% end %>
--- a/app/views/stories/_form.html.erb
+++ b/app/views/stories/_form.html.erb
@@ -5,26 +5,38 @@
55 <%= f.label :comic_id %><br />
66 <%= f.number_field :comic_id %>
77 </div>
8+ <div class="row_break">
9+ </div>
810 <div class="field">
911 <%= f.label :title %><br />
1012 <%= f.text_field :title %>
1113 </div>
14+ <div class="row_break">
15+ </div>
1216 <div class="field">
1317 <%= f.label :description %><br />
1418 <%= f.text_area :description %>
1519 </div>
20+ <div class="row_break">
21+ </div>
1622 <div class="field">
1723 <%= f.label :visible %><br />
1824 <%= f.collection_select :visible, t_select_items(MagicNumber['story_visible_items']), :last, :first, :html => {:selected => @story.visible} %>
1925 </div>
26+ <div class="row_break">
27+ </div>
2028 <div class="field">
2129 <%= f.label :author_id %><br />
2230 <%= h @author.name %>
2331 </div>
32+ <div class="row_break">
33+ </div>
2434 <div class="field">
2535 <%= f.label :t %><br />
2636 <%= f.number_field :t %>
2737 </div>
38+ <div class="row_break">
39+ </div>
2840
2941 <div class="actions">
3042 <%= f.submit %>
--- a/app/views/story_sheets/_form.html.erb
+++ b/app/views/story_sheets/_form.html.erb
@@ -5,14 +5,20 @@
55 <%= f.label :story_id %><br />
66 <%= f.number_field :story_id %>
77 </div>
8+ <div class="row_break">
9+ </div>
810 <div class="field">
911 <%= f.label :sheet_id %><br />
1012 <%= f.number_field :sheet_id %>
1113 </div>
14+ <div class="row_break">
15+ </div>
1216 <div class="field">
1317 <%= f.label :t %><br />
1418 <%= f.number_field :t %>
1519 </div>
20+ <div class="row_break">
21+ </div>
1622
1723 <div class="actions">
1824 <%= f.submit %>
--- a/app/views/story_sheets/edit.html.erb
+++ b/app/views/story_sheets/edit.html.erb
@@ -2,4 +2,3 @@
22 <p id="notice"><%= notice %></p>
33
44 <%= render 'form' %>
5-<%= button_to 'Destroy', @story_sheet, confirm: 'Are you sure?', method: :delete %>
--- a/config/application.rb
+++ b/config/application.rb
@@ -119,5 +119,7 @@ module Pettanr
119119 TestLayout = false
120120 class BadRequest < StandardError
121121 end
122+ class NotWork < StandardError
123+ end
122124 end
123125
--- a/db/migrate/20130911043458_copy_to_scroll.rb
+++ b/db/migrate/20130911043458_copy_to_scroll.rb
@@ -9,6 +9,9 @@ class CopyToScroll < ActiveRecord::Migration
99 ::Story.find(:all).each do |i|
1010 attr = i.attributes
1111 attr.delete 'id'
12+ attr.delete 'x'
13+ attr.delete 'y'
14+ attr.delete 'z'
1215 attr['scroll_id'] = attr['comic_id']
1316 attr.delete 'comic_id'
1417 ::ScrollPanel.create! attr
--- a/lib/element.rb
+++ b/lib/element.rb
@@ -48,6 +48,26 @@ module Element
4848 self.class.colum_structures[column_name] and self.class.colum_structures[column_name][:helper]
4949 end
5050
51+ def element_name
52+ self.class.to_s.underscore
53+ end
54+
55+ def extend_column
56+ nil
57+ end
58+
59+ def extend_element_name
60+ self.extend_column ? self.attributes[extend_column] : self.element_name
61+ end
62+
63+ def find_configurations hash, key
64+ if hash[key].is_a? String
65+ self.find_configurations hash, hash[key]
66+ else
67+ return hash[key]
68+ end
69+ end
70+
5171 def new_index
5272 @new_index
5373 end
--- /dev/null
+++ b/public/not_work.html
@@ -0,0 +1,26 @@
1+<!DOCTYPE html>
2+<html>
3+<head>
4+ <title>コマをつかんでいません</title>
5+ <style type="text/css">
6+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7+ div.dialog {
8+ width: 25em;
9+ padding: 0 4em;
10+ margin: 4em auto 0 auto;
11+ border: 1px solid #ccc;
12+ border-right-color: #999;
13+ border-bottom-color: #999;
14+ }
15+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16+ </style>
17+</head>
18+
19+<body>
20+ <!-- This file lives in public/404.html -->
21+ <div class="dialog">
22+ <h1>作業対象のコマが指定されていません。</h1>
23+ <p>エレメントを新規作成するなど、一部の操作ではコマをつかんでおく必要があります。</p>
24+ </div>
25+</body>
26+</html>
--- a/spec/models/panel_spec.rb
+++ b/spec/models/panel_spec.rb
@@ -31,9 +31,6 @@ describe Panel do
3131 @panel.width = 1
3232 @panel.height = 1
3333 @panel.border = 0
34- @panel.x = -99999
35- @panel.y = -99999
36- @panel.z = 1
3734 @panel.publish = 0
3835 @panel.should be_valid
3936 end
@@ -41,9 +38,6 @@ describe Panel do
4138 @panel.width = 99999
4239 @panel.height = 99999
4340 @panel.border = 99999
44- @panel.x = 99999
45- @panel.y = 99999
46- @panel.z = 99999
4741 @panel.publish = 99999
4842 @panel.should be_valid
4943 end
@@ -103,48 +97,6 @@ describe Panel do
10397 @panel.should be_valid
10498 end
10599 end
106- context 'xを検証するとき' do
107- it '数値でなければ失敗する' do
108- @panel.x = 'a'
109- @panel.should_not be_valid
110- end
111- it '0なら通る' do
112- @panel.x = '0'
113- @panel.should be_valid
114- end
115- it '負でも通る' do
116- @panel.x = -1
117- @panel.should be_valid
118- end
119- end
120- context 'yを検証するとき' do
121- it '数値でなければ失敗する' do
122- @panel.y = 'a'
123- @panel.should_not be_valid
124- end
125- it '0なら通る' do
126- @panel.y = '0'
127- @panel.should be_valid
128- end
129- it '負でも通る' do
130- @panel.y = -1
131- @panel.should be_valid
132- end
133- end
134- context 'zを検証するとき' do
135- it '数値でなければ失敗する' do
136- @panel.z = 'a'
137- @panel.should_not be_valid
138- end
139- it '0なら失敗する' do
140- @panel.z = '0'
141- @panel.should_not be_valid
142- end
143- it '負なら失敗する' do
144- @panel.z = -1
145- @panel.should_not be_valid
146- end
147- end
148100 context 'author_idを検証するとき' do
149101 it 'nullなら失敗する' do
150102 @panel.author_id = nil
旧リポジトリブラウザで表示