• R/O
  • HTTP
  • SSH
  • HTTPS

pettanr: コミット

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


コミットメタ情報

リビジョン8284bc968718f2f7017c10111f5e230a12fe4ae3 (tree)
日時2013-05-22 23:13:55
作者itozyun <itozyun@user...>
コミッターitozyun

ログメッセージ

Client is version 0.5.38, fixed _destroy.

変更サマリ

差分

--- a/app/assets/javascripts/peta-apps.js
+++ b/app/assets/javascripts/peta-apps.js
@@ -1,6 +1,6 @@
11 /*
22 * pettanR peta.apps.js
3- * version 0.5.57
3+ * version 0.5.58
44 *
55 * author:
66 * itozyun
@@ -1391,7 +1391,9 @@ var Editor = gOS.registerApplication( function(){
13911391 comicID = -1,
13921392 panelID = -1,
13931393 panelTimming = -1,
1394- phase = -1;
1394+ phase = -1,
1395+ postedImage = [],
1396+ postedBalloon = [];
13951397
13961398 var kill = function(){
13971399 var o = this, v;
@@ -1855,14 +1857,16 @@ var Editor = gOS.registerApplication( function(){
18551857 };
18561858 function onSave(){
18571859 PanelConsole.boot( Model.createPanel( {
1858- comicID : comicID,
1859- panelID : panelID,
1860- panelTimming : panelTimming,
1861- panelW : PANEL_CONTROL.w,
1862- panelH : PANEL_CONTROL.h,
1863- borderSize : 2,
1864- panelElementArray : PANEL_ELEMENT_ARRAY,
1865- publish : true
1860+ comicID : comicID,
1861+ panelID : panelID,
1862+ panelTimming : panelTimming,
1863+ panelW : PANEL_CONTROL.w,
1864+ panelH : PANEL_CONTROL.h,
1865+ borderSize : 2,
1866+ panelElements : PANEL_ELEMENT_ARRAY,
1867+ postedImage : postedImage,
1868+ postedBalloon : postedBalloon,
1869+ publish : true
18661870 } ) );
18671871 };
18681872 function onSaveQuit(){
@@ -3981,6 +3985,8 @@ var Editor = gOS.registerApplication( function(){
39813985 var elmContainer = null,
39823986 currentElement = null,
39833987 node = null,
3988+ postedImage = [],
3989+ postedBalloon = [],
39843990 panelX, panelY, panelW, panelH,
39853991 startX, startY;
39863992 /*
@@ -4450,10 +4456,11 @@ var Editor = gOS.registerApplication( function(){
44504456 for( var i = 0; i < panelElements.length; ++i ){
44514457 panelElm = panelElements[ i ];
44524458 if( panelElm.balloons ){
4453- alert( panelElm.id )
4459+ postedBalloon.push( panelElm.id );
44544460 PANEL_ELEMENT_CONTROL.createTextElement( panelElm );
44554461 } else
44564462 if( panelElm.picture ){
4463+ postedImage.push( panelElm.id );
44574464 PANEL_ELEMENT_CONTROL.createImageElement( panelElm );
44584465 };
44594466 };
@@ -5116,24 +5123,26 @@ var PanelConsole = gOS.registerApplication( function(){
51165123 var Model = ( function(){
51175124
51185125 var PanelModelClass = function( panel ){
5119- var comicID = panel.comicID || -1,
5120- panelID = panel.panelID || -1,
5121- panelTimming = panel.panelTimming || -1,
5122- panelW = panel.panelW,
5123- panelH = panel.panelH,
5124- borderSize = panel.borderSize,
5125- panelElementArray = panel.panelElementArray,
5126- publish = panel.publish,
5127- timing = 0;
5126+ var comicID = panel.comicID || -1,
5127+ panelID = panel.panelID || -1,
5128+ panelTimming = panel.panelTimming || -1,
5129+ panelW = panel.panelW,
5130+ panelH = panel.panelH,
5131+ borderSize = panel.borderSize,
5132+ panelElements = panel.panelElements,
5133+ publish = panel.publish,
5134+ postedImage = panel.postedImage,
5135+ postedBalloon = panel.postedBalloon,
5136+ timing = 0;
51285137
51295138 function getPanelElementByTiming(){
5130- var i, l = panelElementArray.length;
5139+ var i, l = panelElements.length;
51315140 while( timing < l * 2 ){
51325141 for( i = 0; i < l; ++i ){
5133- if( timing === panelElementArray[ i ].timing ){
5134- // console.log( timing + ' , ' + panelElementArray[ i ].timing );
5142+ if( timing === panelElements[ i ].timing ){
5143+ // console.log( timing + ' , ' + panelElements[ i ].timing );
51355144 ++timing;
5136- return panelElementArray[ i ];
5145+ return panelElements[ i ];
51375146 };
51385147 };
51395148 ++timing;
@@ -5258,28 +5267,46 @@ var Model = ( function(){
52585267 var JSON_STRING_ARRAY = [],
52595268 IMAGE_ARRAY = [],
52605269 BALLOON_ARRAY = [],
5261- l = panelElementArray.length,
5262- _panelElement, n,
5270+ l = panelElements.length,
5271+ _panelElement, n, i,
52635272 cr = pettanr.LINE_FEED_CODE_TEXTAREA;
52645273
52655274 while( IMAGE_ARRAY.length + BALLOON_ARRAY.length <= l ){
52665275 _panelElement = getPanelElementByTiming();
52675276 if( _panelElement === null) break;
52685277 n = IMAGE_ARRAY.length + BALLOON_ARRAY.length;
5269- _panelElement.type === 0 ?
5270- IMAGE_ARRAY.push( [ '"new', n, '": ', imageToJson( _panelElement, n ) ].join( '' ) ) :
5278+ if( _panelElement.type === 0 ){
5279+ IMAGE_ARRAY.push( [ '"new', n, '": ', imageToJson( _panelElement, n ) ].join( '' ) );
5280+ if( postedImage ){
5281+ i = Util.getIndex( postedImage, _panelElement.panelElementID );
5282+ i !== -1 && postedImage.splice( i, 1 );
5283+ };
5284+ } else {
52715285 BALLOON_ARRAY.push( [ '"new', n, '": ', balloonToJson( _panelElement, n ) ].join( '' ) );
5286+ if( postedBalloon ){
5287+ i = Util.getIndex( postedBalloon, _panelElement.panelElementID );
5288+ i !== -1 && postedBalloon.splice( i, 1 );
5289+ };
5290+ };
5291+ };
5292+ for( i = postedImage.length; i; ){
5293+ IMAGE_ARRAY.push( [ '"oldImage', i, '": {', cr,
5294+ '"id": ', postedImage[ --i ], ',', cr,
5295+ '"_destroy": true', cr,
5296+ '}' ].join( '' ) );
5297+ };
5298+ for( i = postedBalloon.length; i; ){
5299+ BALLOON_ARRAY.push( [ '"oldBalloon', i, '": {', cr,
5300+ '"id": ', postedBalloon[ --i ], ',', cr,
5301+ '"_destroy": true', cr,
5302+ '}' ].join( '' ) );
52725303 };
52735304 return [
52745305 '{', cr,
52755306 panelID !== -1 ? ( '"id": ' + panelID + ',' + cr ) : '',
5276- //panelID !== -1 ? ( '"panel_id": ' + panelID + ',' + cr ) : '',
5277- // comicID !== -1 ? ( '"comic_id": ' + comicID + ',' + cr ) : '',
52785307 '"width": ', panelW, ',', cr,
52795308 '"height": ', panelH, ',', cr,
52805309 '"border": ', borderSize, ',', cr,
5281-
5282- // '"picture_id": 1,', cr,
52835310 '"x": ', 0, ',', cr,
52845311 '"y": ', 0, ',', cr,
52855312 '"z": ', 1, ',', cr,
@@ -5299,7 +5326,7 @@ var Model = ( function(){
52995326
53005327 var JSON_STRING_ARRAY = [],
53015328 ELEMENT_ARRAY = [],
5302- l = panelElementArray.length,
5329+ l = panelElements.length,
53035330 cr = pettanr.LINE_FEED_CODE_TEXTAREA,
53045331 _panelElement;
53055332
@@ -5333,7 +5360,7 @@ var Model = ( function(){
53335360 timing = 0;
53345361
53355362 var HTML_ARRAY = [],
5336- l = panelElementArray.length,
5363+ l = panelElements.length,
53375364 _panelElement;
53385365
53395366 while( HTML_ARRAY.length < l ){
@@ -5363,7 +5390,7 @@ var Model = ( function(){
53635390 return publish = Type.isBoolean( v ) === true ? v : publish;
53645391 };
53655392 this.destroy = function(){
5366- panel = panelElementArray = null;
5393+ panel = panelElements = null;
53675394 };
53685395 };
53695396
@@ -5382,7 +5409,7 @@ var OutputConsole = gOS.registerApplication( function(){
53825409 comboboxFormat, inputOption,
53835410 buttonSubmit, buttonClose,
53845411 windowW, windowH,
5385- comicID, panelID, panelTimming, panelW, panelH, borderSize, panelElementArray,
5412+ comicID, panelID, panelTimming, panelW, panelH, borderSize, panelElements,
53865413 app = this,
53875414 model = null;
53885415
@@ -5445,7 +5472,7 @@ var OutputConsole = gOS.registerApplication( function(){
54455472
54465473 delete app.onInit;
54475474 };
5448- this.onOpen = function( _w, _h, _comicID, _panelID, _panelTimming, _panelW, _panelH, _borderSize, _panelElementArray ){
5475+ this.onOpen = function( _w, _h, _comicID, _panelID, _panelTimming, _panelW, _panelH, _borderSize, _panelElements ){
54495476 elmOutputArea = document.getElementById( 'output-area' );
54505477
54515478 node = eventRoot.createNode( app.rootElement, true, true );
@@ -5470,7 +5497,7 @@ var OutputConsole = gOS.registerApplication( function(){
54705497 panelW : _panelW,
54715498 panelH : _panelH,
54725499 borderSize : _borderSize,
5473- panelElementArray : _panelElementArray,
5500+ panelElements : _panelElements,
54745501 publish : true
54755502 } );
54765503
@@ -5488,7 +5515,7 @@ var OutputConsole = gOS.registerApplication( function(){
54885515 this.onClose = function(){
54895516 elmOutputArea.value = '';
54905517 model.destroy();
5491- elmOutputArea = comboboxFormat = inputOption = buttonSubmit = buttonClose = panelElementArray = model = null;
5518+ elmOutputArea = comboboxFormat = inputOption = buttonSubmit = buttonClose = panelElements = model = null;
54925519 };
54935520 }, true, false, 'Output Console', 'outputConsole', null, '#2D89F0' );
54945521
旧リポジトリブラウザで表示