From cde771e007a112a78657321b9df87cfd4f9261db Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Wed, 8 Oct 2014 00:07:54 -0400 Subject: [PATCH] got map screenshot working decent --- Procfile | 2 + app/assets/images/missing-map.png | Bin 0 -> 16291 bytes .../javascripts/src/Metamaps.Backbone.js | 1 + app/assets/javascripts/src/Metamaps.JIT.js | 4 +- app/models/map.rb | 26 +++- app/views/layouts/_templates.html.erb | 4 +- app/workers/grab_map_screenshot_worker.rb | 8 +- diff.txt | 130 ------------------ script/phantomjs-save-screenshot.js | 35 ++--- 9 files changed, 51 insertions(+), 159 deletions(-) create mode 100644 Procfile create mode 100644 app/assets/images/missing-map.png delete mode 100644 diff.txt diff --git a/Procfile b/Procfile new file mode 100644 index 00000000..3a5d09e8 --- /dev/null +++ b/Procfile @@ -0,0 +1,2 @@ +web: bundle exec rails server -p $PORT +worker: bundle exec sidekiq -c 5 -v \ No newline at end of file diff --git a/app/assets/images/missing-map.png b/app/assets/images/missing-map.png new file mode 100644 index 0000000000000000000000000000000000000000..5a51221ac597958e5837fda2746dcc22ffa2d4ec GIT binary patch literal 16291 zcmV;UKU~0xP)m|DXEn?p5@uyb^~PfQI>iKm>ynhag40Ouc04 zO5zZM!Qq3sx&7b&=l=%t%fEu*QwU+bQ?b_4!^MZe1HZfL*z_NPj?epGy1qC2wl#-i zYuc_eg>z<8*XCo>n7Xd$XZ`%UuSt+A6Xfd9=a1J)&&SGVxfMQh{Tn+T`-)%xS(?Ag z*OQm7ec*K=0p3TDN5CJB=Fiv8eD3$=7=d3Fh52i{F(LjPH@K=QQAX z4~rk4SLhDotSO4(@r6q04+-Fc`_a>b{UH$!*{;5cP+|-i)EEdZ~P?r(h z+s%doM_B$qp0^=arisBU{CWJ%Df-urOJ?p&`u=XNP58Ha^IB7oy8$bLA3(0FGQQQu zG@C}U6G7gdeRzPrh?d`ELFlT$&(9+R{o7@1{%z@(+=cK8$Uo%Ohb(iW853CXIs#h( zH>MOBdvJ9anB!~Ku)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MiWomRnnm$j=%_<`zEP)TPlok2s6h z=Ir0h&6xmxMP{fyX&3w{i*KJzJ6OTO&ydV&03$u&th_}&F(h|&W-d_f!>`dxIw|Ph zU=&VT?S651v5b{62~Ss#@%N$i*qPNtRQN(ql!`7=T7 z)!X>b`8l_6XukCx>}7JkvHU!bSo?bEMLLVNch)?V}Xg_Ne93J+1U2;{=MmeqZm zP125Wvx(#DdUUsqdVHm!w|8)8CbW+;7Jaqs%`-9~znb(kuK}D%X)5EAHQ_PPY@Zsr z!L1J&d-Ex))qc;j|A}nQt$?>@+?QK0bU)}kSzIb zXTJ7dJOj!w=!;_1dwe8-Th5HBdvoJp-zNkATENdMu=j#}Jxl-FSbFD<_gV$pla8y) zt_2=Cn|6P|K<2&q+Hqej4R^qNCydt7A6am2dK`GqSJA!9U`@eD~!Z zw}RpEyYgCp>gMdsqaTz8vtjDW5hHd65>Lfo68sy#V-?|nI;nIgUG=1`G4`JG3G3YE zsntFY_@rN|TBh0a)^df*N6qFcj17DLr>`3E*%glOoDxAA4p)$NB&LrejaimFfI^#0 zp5m@0BR|)ExY5lqj~2|9+xq72+@tQx^W7V@N_Y66_U(us>-zs{nVd{GRQ*Vuib6Ml z^xZ3&VOu;!h)MHDiIQ-y<-XIEom%TNpkGP$<#nKc@P^!Tl6P6eXT~3A0$!aSQqwd* zBg5IosT@ulzGaSWlIB~x@Hdk_xyRbyQ?Z)6Cni@~n^^SM`MLo8e?DsEIWKMQEBcrh z>6I@5|CZqO((}HF337e*%GXmJccXJ)Z5qVzym=k>mZa~)ebUa)W!ER5|B0Z^{MY{% ZU;zH03AX4(D#HK(002ovPDHLkV1jyu&AI>p literal 0 HcmV?d00001 diff --git a/app/assets/javascripts/src/Metamaps.Backbone.js b/app/assets/javascripts/src/Metamaps.Backbone.js index edc87d12..dd9d5cfb 100644 --- a/app/assets/javascripts/src/Metamaps.Backbone.js +++ b/app/assets/javascripts/src/Metamaps.Backbone.js @@ -72,6 +72,7 @@ Metamaps.Backbone.Map = Backbone.Model.extend({ topic_count_string: this.get('topic_count') == 1 ? ' topic' : ' topics', synapse_count_number: '' + this.get('synapse_count') + '', synapse_count_string: this.get('synapse_count') == 1 ? ' synapse' : ' synapses', + screenshot: '' }; return obj; } diff --git a/app/assets/javascripts/src/Metamaps.JIT.js b/app/assets/javascripts/src/Metamaps.JIT.js index d0d4c70c..29e08dce 100644 --- a/app/assets/javascripts/src/Metamaps.JIT.js +++ b/app/assets/javascripts/src/Metamaps.JIT.js @@ -7,7 +7,7 @@ Metamaps.JIT = { newSynapse: 'Metamaps:JIT:events:newSynapse', removeSynapse: 'Metamaps:JIT:events:removeSynapse', pan: 'Metamaps:JIT:events:pan', - zoom: 'Metamaps:JIT:events:zoom' + zoom: 'Metamaps:JIT:events:zoom', animationDone: 'Metamaps:JIT:events:animationDone', }, vizData: [], // contains the visualization-compatible graph @@ -230,7 +230,7 @@ Metamaps.JIT = { duration: 800, onComplete: function () { Metamaps.Visualize.mGraph.busy = false; - $(document).trigger(Metamaps.JIT.events.animationDone, [event]); + $(document).trigger(Metamaps.JIT.events.animationDone); } }, animateFDLayout: { diff --git a/app/models/map.rb b/app/models/map.rb index 87fb358d..3d6591e5 100644 --- a/app/models/map.rb +++ b/app/models/map.rb @@ -13,8 +13,9 @@ class Map < ActiveRecord::Base # This method associates the attribute ":image" with a file attachment has_attached_file :screenshot, :styles => { :thumb => ['188x126#', :png], - :full => ['1880x1260#', :png] - } + :full => ['940x630#', :png] + }, + :default_url => "/assets/missing-map.png" # Validate the attached image is image/jpg, image/png, etc validates_attachment_content_type :screenshot, :content_type => /\Aimage\/.*\Z/ @@ -64,6 +65,10 @@ class Map < ActiveRecord::Base self.contributors.length end + def screenshot_url + self.screenshot.url(:thumb) + end + def created_at_str self.created_at.strftime("%m/%d/%Y") end @@ -73,7 +78,7 @@ class Map < ActiveRecord::Base end def as_json(options={}) - json = super(:methods =>[:user_name, :user_image, :topic_count, :synapse_count, :contributor_count], :except => [:created_at, :updated_at]) + json = super(:methods =>[:user_name, :user_image, :topic_count, :synapse_count, :contributor_count, :screenshot_url], :except => [:screenshot_content_type, :screenshot_file_size, :screenshot_file_name, :screenshot_updated_at, :created_at, :updated_at]) json[:created_at] = self.created_at_str json[:updated_at] = self.updated_at_str json @@ -118,4 +123,19 @@ class Map < ActiveRecord::Base GrabMapScreenshotWorker.perform_async(self.id) end + def decode_base64(imgBase64) + decoded_data = Base64.decode64(imgBase64) + + data = StringIO.new(decoded_data) + data.class_eval do + attr_accessor :content_type, :original_filename + end + + data.content_type = "image/png" + data.original_filename = File.basename(self.id.to_s + '-' + 'screenshot.png') + + self.screenshot = data + self.save + end + end diff --git a/app/views/layouts/_templates.html.erb b/app/views/layouts/_templates.html.erb index fd02f3e9..a25999cb 100644 --- a/app/views/layouts/_templates.html.erb +++ b/app/views/layouts/_templates.html.erb @@ -46,8 +46,8 @@ {{name}}
- -
+ {{{screenshot}}} +
{{desc}} diff --git a/app/workers/grab_map_screenshot_worker.rb b/app/workers/grab_map_screenshot_worker.rb index 730d4a7d..71fe2441 100644 --- a/app/workers/grab_map_screenshot_worker.rb +++ b/app/workers/grab_map_screenshot_worker.rb @@ -6,12 +6,8 @@ class GrabMapScreenshotWorker imgBase64 = '' Phantomjs.run('./script/phantomjs-save-screenshot.js', map_id.to_s) { |line| imgBase64 << line - puts line } - - #this doesn't work yet - #map = Map.find(map_id) - #map.add_attachment(imgBase64) - #map.save! + map = Map.find(map_id) + map.decode_base64(imgBase64) end end diff --git a/diff.txt b/diff.txt deleted file mode 100644 index badb2420..00000000 --- a/diff.txt +++ /dev/null @@ -1,130 +0,0 @@ - - -diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css -index bb0edb6..bb56ab0 100644 ---- a/app/assets/stylesheets/application.css -+++ b/app/assets/stylesheets/application.css -@@ -74,8 +74,9 @@ body, - /* forgot password fix */ - - .forgotPassword input[type="submit"] { -- padding: 0 5px; -- width: auto; -+ width: 300px; -+ color: #f5f5f5; -+ font-family: din-regular; - } - html { - -@@ -189,36 +190,55 @@ input[type="submit"]:active { - border-radius: 5px; - color: black; - box-shadow: 6px 6px 8px rgba(0, 0, 0, 0.4); -+ position:absolute; - top: 50%; - left:50%; -- position:absolute; -- margin-left: -166px; -+ - } -+ - .forgotPassword { - height: 134px; - margin-top: -83px; -+ font-family: din-medium; -+ color:#424242; -+ text-transform: uppercase; -+ box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.23), 0px 3px 3px rgba(0, 0, 0, 0.16); -+ font-size: 17px; -+ margin-left: -166px; -+ -+} -+ -+.emailText { -+ font-family: din-regular; -+ font-size: 14px; -+ color:#424242; -+ padding-top:24px; -+ padding-bottom: 6px; -+ text-transform: none; -+ margin: 0px; - } - .centerGreyForm input[type="text"], - .centerGreyForm input[type="email"], - .centerGreyForm input[type="password"] { -- width: 250px; -+ width: 300px; - height: 32px; - font-size: 15px; - direction: ltr; - -webkit-appearance: none; - appearance: none; - display: inline-block; -- margin: 0; -- padding: 0 8px; -+ margin: 0px 0px 6px 0px; -+ padding: 10px 0px 0px 9px; - background: #fff; -+ color: #bdbdbd; - border: 1px solid #d9d9d9; - border-top: 1px solid #c0c0c0; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -- -webkit-border-radius: 1px; -- -moz-border-radius: 1px; -- border-radius: 1px; -+ -webkit-border-radius: 2px; -+ -moz-border-radius: 2px; -+ border-radius: 2px; - font: -webkit-small-control; - color: initial; - letter-spacing: normal; -@@ -227,8 +247,10 @@ input[type="submit"]:active { - text-indent: 0px; - text-shadow: none; - display: inline-block; -- text-align: start; -+ font: din-medium; -+ text-align: left; - } -+ - .centerGreyForm input[type="text"]:hover, - .centerGreyForm input[type="email"]:hover, - .centerGreyForm input[type="password"]:hover { -@@ -237,7 +259,9 @@ input[type="submit"]:active { - -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); - -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); - box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); -+ color: #424242; - } -+ - .new_topic { - /* start it off screen while it initializes the spinner, then it will be hidden with jquery */ - top: -1000px; -diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb -index 738d5c6..70d6de7 100644 ---- a/app/views/users/edit.html.erb -+++ b/app/views/users/edit.html.erb -@@ -17,4 +17,3 @@ - <%= form.submit "Update", class: "update" %> - <% end %> -
-- -diff --git a/app/views/users/passwords/new.html.erb b/app/views/users/passwords/new.html.erb -index 88dddb4..3238a81 100644 ---- a/app/views/users/passwords/new.html.erb -+++ b/app/views/users/passwords/new.html.erb -@@ -6,10 +6,10 @@ - -

FORGOT PASSWORD?

- --
<%= f.label :email, "Enter Your Email:" %> -+
<%= f.label :email, "Enter your email:", :class => "emailText" %> - <%= f.email_field :email, :autofocus => true %>
- --
<%= f.submit "Send Reset Password Instructions" %>
-+
<%= f.submit "Send Password Reset Instructions" %>
- - <% end %> -
diff --git a/script/phantomjs-save-screenshot.js b/script/phantomjs-save-screenshot.js index f79a894e..c945bb7a 100755 --- a/script/phantomjs-save-screenshot.js +++ b/script/phantomjs-save-screenshot.js @@ -8,9 +8,9 @@ if (args.length <= 1) { //configurable variables - CHANGE ME var mapID = args[1]; -var url = 'http://localhost:3000/maps/' + mapID; -var width = 188; -var height = 126; +var url = 'http://metamaps.herokuapp.com/maps/' + mapID; +var width = 940; +var height = 630; //set up page and the area we'll render as a PNG var page = require('webpage').create(); @@ -23,25 +23,28 @@ page.open(url, function (status) { if (status === 'success') { //since this isn't evaluateAsync, it should also ensure the asynchronous //js stuff is loaded too, hopefully? + + page.onCallback = function(data){ + + //pass to ruby + console.log(page.renderBase64('PNG')); + + //render to the metamaps_gen002 directory for debug + //page.render('map1.png', 'PNG'); + + phantom.exit(); + }; + page.evaluate(function() { $(document).on(Metamaps.JIT.events.animationDone, function(){ - $('.upperLeftUI, .upperRightUI, .mapControls, .infoAndHelp, #barometer_tab').hide(); - Metamaps.Famous.logo.hide() + $('.upperLeftUI, .upperRightUI, .mapControls, .infoAndHelp, .uv-icon, .footer').hide(); Metamaps.JIT.zoomExtents(); - console.log('got here'); + if (typeof window.callPhantom === 'function') { + window.callPhantom(); + } });//document.on animationDone });//page.evaluate - - //pass to ruby - //console.log(page.renderBase64('PNG')); - - //render to the metamaps_gen002 directory for debug - page.render('map1.png', 'PNG'); - } else { //failed to load }//if - - setTimeout(phantom.exit,5000); - //phantom.exit(); });