OSDN Git Service

fix:balloon edit
authoryasushiito <yas@pen-chan.jp>
Tue, 28 Apr 2015 22:28:28 +0000 (07:28 +0900)
committeryasushiito <yas@pen-chan.jp>
Tue, 28 Apr 2015 22:28:28 +0000 (07:28 +0900)
app/assets/javascripts/models/resource_picture.js.coffee
app/assets/javascripts/pettanr/pettan_imager.js.coffee
app/assets/javascripts/views/balloons/element.js.coffee
app/controllers/panels_controller.rb
app/models/resource_picture.rb
lib/manifest/manifest.rb

index 1b5de0e..f54e87c 100644 (file)
@@ -30,14 +30,16 @@ class Pettanr.ResourcePicture extends Peta.Content
     'image/' + @get('ext')\r
   \r
   r_url: (subdir = null) ->\r
-    opt = if Pettanr.to_s(@subdir).empty\r
+    opt = if _.isEmpty(subdir)\r
       ''\r
     else\r
       '?subdir=' + Pettanr.to_s(subdir)\r
     '/resource_pictures/' + @filename() + opt\r
   \r
   tmb_opt_img_tag: () ->\r
-    new Pettanr.Image.SymbolPicture({\r
+    klass = if true # thumbnail\r
+      Pettanr.Image.SymbolPicture\r
+    new klass({\r
       attr: {\r
         src: @r_url()\r
       },\r
index 8eacb89..bb4d938 100644 (file)
@@ -14,8 +14,8 @@ class Pettanr.Imager
     else
       100
     r = if wr < hr
-      [w*wr/100, h*wr/100]
+      [Math.floor(w*wr/100), Math.floor(h*wr/100)]
     else
-      [w*hr/100, h*hr/100]
+      [Math.floor(w*hr/100), Math.floor(h*hr/100)]
     r
   
index 89cc58d..ce492b7 100644 (file)
@@ -57,7 +57,7 @@ class Pettanr.Views.Balloon.Element.Edit extends Pettanr.Views.Balloon.Element
         \r
         resize_div.css('top', '0px')\r
         resize_div.css('left', '0px')\r
-        resize_div.css('z-index', 1)\r
+        resize_div.css('z-index', 1)\r
         width = ui.size.width\r
         height = ui.size.height\r
         top = speech_balloon_div.position().top\r
@@ -79,9 +79,6 @@ class Pettanr.Views.Balloon.Element.Edit extends Pettanr.Views.Balloon.Element
           height: height\r
         }, {silent: true})\r
         elm.trigger('resize')\r
-     resize: (event, ui) ->\r
-        resize_div = $(@)\r
-        speech_balloon_div = resize_div.parent()\r
       handles: 'all',\r
       autoHide: true\r
     }\r
@@ -89,6 +86,8 @@ class Pettanr.Views.Balloon.Element.Edit extends Pettanr.Views.Balloon.Element
   \r
   style: () ->\r
     {\r
+      top: '0px',\r
+      left: '0px',\r
       width: Pettanr.to_s(@element.get('width')) + 'px', \r
       height: Pettanr.to_s(@element.get('height')) + 'px',\r
       'z-index': 1  # play case\r
index 926acda..ad67b3e 100644 (file)
@@ -142,7 +142,6 @@ class PanelsController < ApplicationController
         updated_html_format format
         updated_json_format format
       else
-    p @item.errors
         format.html {
           flash[:notice] = I18n.t('flash.notice.not_updated', :model => @my_model_class.model_name.human)
           @editor = Editor::PanelEditor.new @item, @operators
index 36d57e5..7a08169 100644 (file)
@@ -230,4 +230,13 @@ class ResourcePicture < Peta::Content
     "#{self.license_group_module_name.tableize}/attributes/full_credit"
   end
   
+  def self.remake_all
+    ResourcePicture.find(:all).each do |resource_picture|
+      resource_picture.boosts 'post'
+      full = resource_picture.restore 'full'
+      imager = PettanImager.load full
+      resource_picture.store_picture_with_gif(imager)
+    end
+  end
+  
 end
index bc56116..ce33eea 100644 (file)
@@ -32,6 +32,8 @@ module Manifest
     
     def init_after_load_manifest
       @system_resources.init
+      PettanImager.tmb_w = @magic_numbers['thumbnail_width']
+      PettanImager.tmb_h = @magic_numbers['thumbnail_height']
     end
     
     def replace_action_alias