This commit is contained in:
Bashar Jabbour 2014-11-18 14:50:17 -05:00
commit c4de02a958
42 changed files with 122 additions and 132 deletions

View file

@ -1,2 +1 @@
https://github.com/heroku/heroku-buildpack-ruby.git
https://github.com/stomita/heroku-buildpack-phantomjs.git
https://github.com/heroku/heroku-buildpack-ruby.git

View file

@ -6,8 +6,6 @@ gem 'rails', '3.2.17'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'phantomjs'
gem 'devise'
gem 'redis'
gem 'pg'
@ -19,9 +17,6 @@ gem 'rails3-jquery-autocomplete'
gem 'best_in_place' #in-place editing
gem 'kaminari' # pagination
gem 'uservoice-ruby'
gem 'sidekiq' # worker processes
gem 'sinatra', require: false
gem 'slim'
gem 'paperclip'
gem 'aws-sdk'

View file

@ -41,8 +41,6 @@ GEM
rails (~> 3.1)
builder (3.0.4)
cancan (1.6.10)
celluloid (0.15.2)
timers (~> 1.1.0)
climate_control (0.0.3)
activesupport (>= 3.0)
cocaine (0.5.4)
@ -54,7 +52,6 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.8.0)
connection_pool (2.0.0)
devise (3.4.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
@ -100,13 +97,10 @@ GEM
mime-types
pg (0.17.1)
pg (0.17.1-x86-mingw32)
phantomjs (1.9.7.1)
polyglot (0.3.5)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-protection (1.5.3)
rack
rack-ssl (1.3.4)
rack
rack-test (0.6.2)
@ -132,8 +126,6 @@ GEM
rdoc (3.12.2)
json (~> 1.4)
redis (3.1.0)
redis-namespace (1.5.1)
redis (~> 3.0, >= 3.0.4)
responders (1.1.1)
railties (>= 3.2, < 4.2)
sass (3.4.5)
@ -141,29 +133,14 @@ GEM
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
sidekiq (3.2.5)
celluloid (= 0.15.2)
connection_pool (>= 2.0.0)
json
redis (>= 3.0.6)
redis-namespace (>= 1.3.1)
sinatra (1.4.5)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
slim (2.0.3)
temple (~> 0.6.6)
tilt (>= 1.3.3, < 2.1)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
temple (0.6.8)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
timers (1.1.0)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
@ -196,13 +173,9 @@ DEPENDENCIES
kaminari
paperclip
pg
phantomjs
rails (= 3.2.17)
rails3-jquery-autocomplete
redis
sass-rails
sidekiq
sinatra
slim
uglifier (>= 1.0.3)
uservoice-ruby

View file

@ -1,2 +1 @@
web: bundle exec rails server -p $PORT
worker: bundle exec sidekiq -c 5 -v
web: bundle exec rails server -p $PORT

View file

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -324,7 +324,7 @@ Metamaps.GlobalUI.Account = {
Metamaps.Realtime.close();
Metamaps.Filter.close();
$('.sidebarAccountIcon div').addClass('hide');
$('.sidebarAccountIcon .tooltipsUnder').addClass('hide');
if (!self.isOpen && !self.changing) {
@ -339,7 +339,7 @@ Metamaps.GlobalUI.Account = {
close: function () {
var self = Metamaps.GlobalUI.Account;
$('.sidebarAccountIcon div').removeClass('hide');
$('.sidebarAccountIcon .tooltipsUnder').removeClass('hide');
if (!self.changing) {
self.changing = true;
$('.sidebarAccountBox #user_email').blur();

View file

@ -741,7 +741,7 @@ Metamaps.Create = {
}
},
engine: Hogan,
header: "<h3>Existing Synapses</h3>"
header: "<h3>Existing synapses</h3>"
}
]);
@ -1043,8 +1043,8 @@ Metamaps.TopicCard = {
});
$(showCard).find('.best_in_place_desc').bind("ajax:success", function () {
this.innerHTML = this.innerHTML.replace(/\r/g, '')
var desc = $(this).html();
this.innerHTML = this.innerHTML.replace(/\r/g, '');
var desc = $(this).html() === $(this).data('nil') ? "" : $(this).html();
topic.set("desc", desc);
topic.trigger('saved');
});
@ -1289,7 +1289,7 @@ Metamaps.SynapseCard = {
});
},
add_drop_down: function (edge, synapse) {
var list, i, synapses, l;
var list, i, synapses, l, desc;
synapses = edge.getData("synapses");
l = synapses.length;
@ -1311,7 +1311,9 @@ Metamaps.SynapseCard = {
list = '<ul id="switchSynapseList">';
for (i = 0; i < l; i++) {
if (synapses[i] !== synapse) { // don't add the current one to the list
list += '<li data-synapse-index="' + i + '">' + synapses[i].get('desc') + '</li>';
desc = synapses[i].get('desc');
desc = desc === "" || desc === null ? "(no description)" : desc;
list += '<li data-synapse-index="' + i + '">' + desc + '</li>';
}
}
list += '</ul>'

View file

@ -141,7 +141,7 @@ input[type="submit"]:active {
}
.leaveSpace {
display: block;
height: 50px;
height: 25px;
}
.hidden {
display: none;
@ -581,7 +581,7 @@ input[type="submit"]:active {
}
.new_synapse #synapse_desc,
.new_synapse .tt-hint {
width: 244px;
width: 258px;
background: #FFFFFF;
height: 14px;
margin: 0;
@ -1359,7 +1359,7 @@ float: left;
#new_topic .tt-suggestion,
#new_synapse .tt-suggestion {
background: #F5F5F5;
width: 256px;
width: 270px;
position: relative;
}
#new_topic .autocompleteSection {
@ -1380,9 +1380,9 @@ float: left;
line-height: 14px;
font-size: 14px;
padding: 9px 0 9px 8px;
display: inline-block;
}
#new_topic .expandTopicMetadata,
#new_synapse .expandSynapseMetadata {
#new_topic .expandTopicMetadata {
display:none;
width: 16px;
height: 16px;
@ -1394,19 +1394,14 @@ float: left;
background-position: 0 -32px;
}
#new_topic .tt-suggestion.tt-is-under-cursor .expandTopicMetadata,
#new_topic .tt-suggestion.tt-is-under-mouse-cursor .expandTopicMetadata,
#new_synapse .tt-suggestion.tt-is-under-cursor .expandSynapseMetadata,
#new_synapse .tt-suggestion.tt-is-under-mouse-cursor .expandSynapseMetadata {
#new_topic .tt-suggestion.tt-is-under-mouse-cursor .expandTopicMetadata {
display: block;
}
#new_topic .tt-suggestion.tt-is-under-cursor .topicMetadata,
#new_topic .tt-suggestion.tt-is-under-mouse-cursor .topicMetadata,
#new_synapse .tt-suggestion.tt-is-under-cursor .synapseMetadata,
#new_synapse .tt-suggestion.tt-is-under-mouse-cursor .synapseMetadata {
#new_topic .tt-suggestion.tt-is-under-mouse-cursor .topicMetadata {
display: block;
}
#new_topic .topicMetadata,
#new_synapse .synapseMetadata {
#new_topic .topicMetadata {
position: absolute;
display: none;
top: -18px;
@ -1417,8 +1412,7 @@ float: left;
font-family: 'din-regular', helvetica, sans-serif;
font-size: 14px;
}
#new_topic .topicPermission,
#new_synapse .synapsePermission {
#new_topic .topicPermission {
width: 32px;
height: 32px;
background-repeat: no-repeat;
@ -1439,8 +1433,7 @@ float: left;
#new_synapse .synapsePermission.private {
background-position: -32px 0;
}
#new_topic .topicNumMaps,
#new_synapse .synapseNumMaps {
#new_topic .topicNumMaps {
height: 14px;
padding: 1px 0 1px 32px;
background-image: url(metamap16.png);
@ -1458,14 +1451,12 @@ float: left;
position: absolute;
bottom: 10px;
}
#new_topic .topicOriginatorIcon,
#new_synapse .synapseOriginatorIcon {
#new_topic .topicOriginatorIcon {
position: absolute;
top: 8px;
right: 8px;
}
#new_topic .topicOriginatorIcon img,
#new_synapse .synapseOriginatorIcon img {
#new_topic .topicOriginatorIcon img {
border-radius: 12px;
}
#new_topic .topicOriginatorIcon:hover .tip,
@ -1493,17 +1484,59 @@ float: left;
background: #F5F5F5;
}
#new_synapse .tt-dropdown-menu h3 {
font-family: 'vinyl', helvetica, sans-serif;
text-transform: uppercase;
font-style: italic;
font-size: 14pxpx;
font-size: 14px;
line-height: 16px;
margin: 3px;
padding: 8px;
border-top: 1px solid #BFBFBF;
color: #808080;
}
#new_synapse .tt-suggestion .resultnoresult .synapsePermission,
#new_synapse .tt-suggestion .resultnoresult .synapseOriginatorIcon {
display: none;
}
#new_synapse .synapseMetadata {
width: 64px;
padding-left: 4px;
height: 32px;
position: absolute;
left: 202px;
top: 0;
}
#new_synapse .synapseOriginatorIcon {
position: absolute;
top: 4px;
}
#new_synapse .synapseOriginatorIcon .tooltips {
right: 36px;
top: -2px;
}
#new_synapse .synapseOriginatorIcon .tooltips:after {
content: '';
position: absolute;
top: 57%;
left: 100%;
margin-top: -6px;
width: 0;
height: 0;
border-left: 4px solid #000000;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
}
#new_synapse .synapseOriginatorIcon:hover .tooltips {
display:block;
}
#new_synapse .synapseOriginatorIcon img {
border-radius: 12px;
}
#new_synapse .synapsePermission {
position: absolute;
left: 32px;
width: 32px;
height: 32px;
background-repeat: no-repeat;
background-image: url(permissions32_sprite.png);
}
/* map info box */
/* map info box */
@ -1945,6 +1978,9 @@ and it won't be important on password protected instances */
color: #424242;
text-align: left;
}
.lightboxContent li {
list-style: none;
}
.openLightbox {
cursor: pointer;
}
@ -2156,10 +2192,8 @@ and it won't be important on password protected instances */
padding-bottom:12px;
}
#about > p, #getInvolved > p, #invite > p, #colophon p {
/* color: #000;
font-size: 16px;*/
margin: 0px 0px 20px 0px;
#about > p, #getInvolved > p, #invite > p, #colophon p, #donate > p {
margin: 0px 0px 10px 0px;
line-height: 20px;
}
#about ul {

View file

@ -746,14 +746,14 @@ font-family: 'din-regular', helvetica, sans-serif;
border-bottom: 1px solid #BBBBBB;
}
#switchSynapseList li {
padding: 8px;
padding: 8px 8px 8px 68px;
cursor: pointer;
font-family: 'din-regular';
font-size: 14px;
line-height: 16px;
}
#switchSynapseList li:hover {
background: #E0E0E0;
background: #DAB539;
}
#edgeUser {

View file

@ -704,6 +704,10 @@
.mapPage .infoAndHelp, .topicPage .infoAndHelp{
right: 70px;
}
.mapPage .openCheatsheet .tooltipsAbove, .topicPage .openCheatsheet .tooltipsAbove {
left: 29px;
}
.infoAndHelp {
position: fixed;
bottom: 20px;
@ -792,7 +796,7 @@
}
.zoomExtents:hover .tooltips, .zoomIn:hover .tooltips, .zoomOut:hover .tooltips, .takeScreenshot:hover .tooltips, .sidebarCollaborateIcon:hover .tooltipsUnder,
.sidebarFilterIcon:hover .tooltipsUnder, .sidebarForkIcon:hover .tooltipsUnder, .addMap:hover .tooltipsUnder, .sidebarAccountIcon:hover .tooltipsUnder,
.sidebarFilterIcon:hover .tooltipsUnder, .sidebarForkIcon:hover .tooltipsUnder, .addMap:hover .tooltipsUnder, .authenticated .sidebarAccountIcon:hover .tooltipsUnder,
.mapInfoIcon:hover .tooltipsAbove, .openCheatsheet:hover .tooltipsAbove {
display: block;
}
@ -878,7 +882,7 @@
}
.openCheatsheet .tooltipsAbove {
left: 29px;
left: -4px;
}
.sidebarAccountIcon .tooltipsUnder {
@ -899,11 +903,11 @@
border-bottom: 5px solid transparent;
}
.sidebarCollaborateIcon div:after, .sidebarFilterIcon div:after, .sidebarAccountIcon div:after {
.sidebarCollaborateIcon div:after, .sidebarFilterIcon div:after, .sidebarAccountIcon .tooltipsUnder:after {
left: 38%;
}
.sidebarCollaborateIcon div:after, .sidebarFilterIcon div:after, .sidebarForkIcon div:after, .addMap div:after, .sidebarAccountIcon div:after {
.sidebarCollaborateIcon div:after, .sidebarFilterIcon div:after, .sidebarForkIcon div:after, .addMap div:after, .sidebarAccountIcon .tooltipsUnder:after {
content: '';
position: absolute;
top: 128%;

View file

@ -194,9 +194,24 @@ class MainController < ApplicationController
topic2id = params[:topic2id]
if term && !term.empty?
@synapses = Synapse.select('DISTINCT "desc"').
where('LOWER("desc") like ?', '%' + term.downcase + '%').limit(5).order('"desc"')
@synapses = Synapse.select('DISTINCT "desc"').where('LOWER("desc") like ?', '%' + term.downcase + '%').order('"desc"')
# remove any duplicate synapse types that just differ by
# leading or trailing whitespaces
collectedDesc = []
@synapses.delete_if {|s|
desc = s.desc == nil || s.desc == "" ? "" : s.desc.strip
if collectedDesc.index(desc) == nil
collectedDesc.push(desc)
boolean = false
else
boolean = true
end
}
#limit to 5 results
@synapses = @synapses.slice(0,5)
render json: autocomplete_synapse_generic_json(@synapses)
elsif topic1id && !topic1id.empty?

View file

@ -20,12 +20,12 @@ module SynapsesHelper
synapses.each do |s|
synapse = {}
synapse['id'] = s.id
synapse['label'] = s.desc
synapse['label'] = s.desc == nil || s.desc == "" ? "(no description)" : s.desc
synapse['value'] = s.desc
synapse['permission'] = s.permission
synapse['mapCount'] = s.maps.count
synapse['originator'] = s.user.name
synapse['originatorImage'] = s.user.image
synapse['originatorImage'] = s.user.image.url(:square)
synapse['rtype'] = "synapse"
temp.push synapse

View file

@ -8,8 +8,6 @@ class Map < ActiveRecord::Base
has_many :topics, :through => :topicmappings
has_many :synapses, :through => :synapsemappings
#after_touch :save_screenshot
# This method associates the attribute ":image" with a file attachment
has_attached_file :screenshot, :styles => {
:thumb => ['188x126#', :png]
@ -121,17 +119,6 @@ class Map < ActiveRecord::Base
return true
end
def save_screenshot
# TODO - this will grab a map every single frickin' time a map is touched
# we need a system to throttle the amount to 1/hour or something like that
# maybe have a flag - last time this map was screenshotted
# don't update if it was less than an hour ago
# except this has the issue of a user updating map 7x, and it only screenshotting after
# the first time. We only want it to screenhsot the 7th time.
# We need to store a timestamp somewhere and do processing every hour, I think.
GrabMapScreenshotWorker.perform_async(self.id)
end
def decode_base64(imgBase64)
decoded_data = Base64.decode64(imgBase64)

View file

@ -158,6 +158,7 @@
<div class="lightboxContent" id="donate">
<h3>Donate!</h3>
<div class="leaveSpace"></div>
<p>The Metamaps.cc project has been bootstrapped through our own pockets, passion, and patrons - including a couple of small grants which have gone to supporting our core contributors. Some of us have used Metamaps.cc as a tool for our own freelance consulting practice, and we are starting to create hosted and customized installations of Metamaps for different clients as one business model.</p>
@ -166,6 +167,7 @@
<p>Financial contributions in the form of patronage/donations/gifts are greatly appreciated in support of our work. You can donate Bitcoin directly or give us a weekly gift of gratitude for the work we do on Gratipay using the links below.</p>
<p>If you'd like to know what your money is going towards, we publish our financials transparently - everything is recorded through our value accounting system.</p>
<div class="leaveSpace"></div>
<script data-gratipay-username="Metamaps.cc" src="//gttp.co/v1.js"></script>
<div style="font-size:16px;margin:0 auto;width:300px" class="blockchain-btn"
data-address="15z24wj6E9tTsJgEBjnK81CtJ7kZZmxJYN"

View file

@ -2,7 +2,7 @@
<div class="takeScreenshot mapControl"><div class="tooltips">Capture Screenshot</div></div>
<div class="zoomExtents mapControl"><div class="tooltips">Center View</div></div>
<div class="zoomIn mapControl"><div class="tooltips">Zoom In</div></div>
<div class="zoomOut mapControl"><div class="tooltips">Zoom In</div></div>
<div class="zoomOut mapControl"><div class="tooltips">Zoom Out</div></div>
</div>
<div class="infoAndHelp">

View file

@ -156,13 +156,11 @@
<script type="text/template" id="synapseAutocompleteTemplate">
<div class="result{{rtype}}">
<p class="autocompleteSection synapseDesc">{{label}}</p>
<div class="expandSynapseMetadata"></div>
<p class="autocompleteSection synapseDesc">{{label}}</p>
<div class="synapseMetadata">
<div class="synapseNumMaps">{{mapCount}}</div>
<div class="synapseOriginatorIcon hoverForTip">
<img width="24" height="24" src="{{originatorImage}}" />
<span class="tip synapseOriginator">{{originator}}</span>
<span class="tooltips synapseOriginator">{{originator}}</span>
</div>
<div class="synapsePermission {{permission}}"></div>
</div>

View file

@ -52,7 +52,7 @@
<% if authenticated? %>
<!-- fork map -->
<div class="sidebarFork upperRightEl">
<div class="sidebarForkIcon upperRightIcon"><div class="tooltipsUnder">Save to new map</div></div>
<div class="sidebarForkIcon upperRightIcon"><div class="tooltipsUnder">Save To New Map</div></div>
</div> <!-- end sidebarFork -->
<% end %>
@ -61,7 +61,7 @@
<% if authenticated? %>
<!-- create new map -->
<div class="addMap openLightbox upperRightEl upperRightIcon" data-open="newmap"><div class="tooltipsUnder">Create new map</div>
<div class="addMap openLightbox upperRightEl upperRightIcon" data-open="newmap"><div class="tooltipsUnder">Create New Map</div>
</div><!-- end addMap -->
<% end %>

View file

@ -147,6 +147,10 @@
<% end %>
</script>
<% if !authenticated? %>
<iframe width="1" height="1" src="http://support.metamaps.cc/logout.json"; style="visibility:hidden;"></iframe>
<% end %>
<%= render :partial => 'layouts/googleanalytics' if Rails.env.production? %>
</body>
</html>

View file

@ -18,7 +18,7 @@
<%= f.password_field :password_confirmation %></div>
<div><%= f.label "Access Code:", :class => "fieldText" %>
<%= f.text_field :joinedwithcode %></div>
<%= f.text_field :joinedwithcode, :value => params[:code] %></div>
<div><%= f.submit "Sign up!" %></div>

View file

@ -1,10 +0,0 @@
# app/workers/grab_map_screenshot_worker.rb
class GrabMapScreenshotWorker
include Sidekiq::Worker
def perform(map_id)
imgBase64 = `phantomjs ./script/phantomjs-save-screenshot.js #{map_id} #{Rails.env}`
map = Map.find(map_id)
map.decode_base64(imgBase64)
end
end

View file

@ -0,0 +1,2 @@
https://github.com/heroku/heroku-buildpack-ruby.git
https://github.com/stomita/heroku-buildpack-phantomjs.git

View file

@ -1,9 +0,0 @@
redis_url = Rails.env.development? ? 'redis://localhost:6379/0' : ENV['REDISTOGO_URL']
Sidekiq.configure_server do |config|
config.redis = { :url => redis_url, :namespace => 'metamaps' }
end
Sidekiq.configure_client do |config|
config.redis = { :url => redis_url, :namespace => 'metamaps' }
end

View file

@ -1,11 +1,6 @@
require 'sidekiq/web'
Metamaps::Application.routes.draw do
root to: 'main#home', via: :get
#To debug sidekiq and monitor processes, enable this route
#mount Sidekiq::Web, at: '/sidekiq'
match 'request', to: 'main#requestinvite', via: :get, as: :request

View file

@ -26,14 +26,14 @@
}
body {
background: #d8d9da url(shattered_@2X.png);
background: #d8d9da url(/assets/shattered_@2X.png);
font-family: 'din-regular', helvetica, sans-serif;
color: #424242;
text-align: justify;
font-size: 18px;
line-height: 18px;
}
.title a {
.dialog a {
color:#c04f4f;
}
.title{
@ -85,7 +85,7 @@
box-shadow: 0px 1px 1.5px rgba(0,0,0,0.12), 0 1px 1px rgba(0,0,0,0.24);
margin: 0 auto;
text-decoration: none;
color: #FFFFFF;
color: #FFFFFF !important;
cursor: pointer;
}