Merge branch 'feature/rspec-tests' of https://github.com/metamaps/metamaps_gen002 into feature/rspec-tests

This commit is contained in:
Devin Howard 2016-01-07 15:23:25 +08:00
commit 8550b68290
11 changed files with 55 additions and 53 deletions

View file

@ -614,14 +614,14 @@ Metamaps.GlobalUI.Search = {
self.hideLoader();
if (datum.rtype != "noresult") {
if (["topic", "map", "mapper"].indexOf(datum.rtype) !== -1) {
self.close(0, true);
var win;
if (dataset == "topics") {
if (datum.rtype == "topic") {
Metamaps.Router.topics(datum.id);
} else if (dataset == "maps") {
} else if (datum.rtype == "map") {
Metamaps.Router.maps(datum.id);
} else if (dataset == "mappers") {
} else if (datum.rtype == "mapper") {
Metamaps.Router.explore("mapper", datum.id);
}
}

View file

@ -928,8 +928,11 @@ Metamaps.TopicCard = {
setTimeout(function () {
var text = $(element).val();
if (event.type=="paste" || (event.type=="keyup" && event.which==13)){
if (text.slice(0, 4) !== 'http') {
text='http://'+text;
// TODO evaluate converting this to '//' no matter what (infer protocol)
if (text.slice(0, 7) !== 'http://' &&
text.slice(0, 8) !== 'https://' &&
text.slice(0, 2) !== '//') {
text='//'+text;
}
topic.save({
link: text
@ -1897,7 +1900,7 @@ Metamaps.Util = {
return (url.match(/\.(jpeg|jpg|gif|png)$/) != null);
},
checkURLisYoutubeVideo: function (url) {
return (url.match(/^http:\/\/(?:www\.)?youtube.com\/watch\?(?=[^?]*v=\w+)(?:[^\s?]+)?$/) != null);
return (url.match(/^https?:\/\/(?:www\.)?youtube.com\/watch\?(?=[^?]*v=\w+)(?:[^\s?]+)?$/) != null);
}
}; // end Metamaps.Util
@ -1907,9 +1910,9 @@ Metamaps.Util = {
*
*/
Metamaps.Realtime = {
stringForLocalhost: 'http://localhost:5001',
stringForMetamaps: 'http://metamaps.cc:5001',
stringForHeroku: 'http://gentle-savannah-1303.herokuapp.com',
stringForLocalhost: '//localhost:5001',
stringForMetamaps: 'https://realtime.metamaps.cc',
stringForHeroku: 'https://gentle-savannah-1303.herokuapp.com',
socket: null,
isOpen: false,
changing: false,
@ -2548,7 +2551,7 @@ Metamaps.Realtime = {
Metamaps.Topic.renderTopic(mapping, topic, false, false);
}
else if (!cancel) {
setTimeout(test, 10);
setTimeout(waitThenRenderTopic, 10);
}
}
@ -2646,7 +2649,7 @@ Metamaps.Realtime = {
Metamaps.Synapse.renderSynapse(mapping, synapse, node1, node2, false);
}
else if (!cancel) {
setTimeout(test, 10);
setTimeout(waitThenRenderSynapse, 10);
}
}

View file

@ -19,12 +19,6 @@
}
}
.explorePage .sidebarSearchField,
.explorePage .sidebarSearch .tt-hint {
width: 380px;
padding: 5px 10px 5px 10px;
}
.sidebarSearchIcon {
float: left;
width: 72px;

View file

@ -11,7 +11,13 @@ class ApplicationController < ActionController::Base
helper_method :admin?
def after_sign_in_path_for(resource)
sign_in_url = url_for(:action => 'new', :controller => 'sessions', :only_path => false, :protocol => 'http')
unsafe_uri = request.env["REQUEST_URI"]
if unsafe_uri.starts_with?('http') && !unsafe_uri.starts_with?('https')
protocol = 'http'
else
protocol = 'https'
end
sign_in_url = url_for(:action => 'new', :controller => 'sessions', :only_path => false, :protocol => protocol)
if request.referer == sign_in_url
super
@ -58,9 +64,9 @@ private
end
def get_invite_link
unsafe_uri = request.env["REQUEST_URI"] || 'http://metamaps.cc'
unsafe_uri = request.env["REQUEST_URI"] || 'https://metamaps.cc'
valid_url = /^https?:\/\/([\w\.-]+)(:\d{1,5})?\/?$/
safe_uri = (unsafe_uri.match(valid_url)) ? unsafe_uri : 'http://metamaps.cc/'
safe_uri = (unsafe_uri.match(valid_url)) ? unsafe_uri : '//metamaps.cc/'
@invite_link = "#{safe_uri}join" + (current_user ? "?code=#{current_user.code}" : "")
end
end

View file

@ -13,11 +13,4 @@ class Metacode < ActiveRecord::Base
return true if self.metacode_sets.include? metacode_set
return false
end
#output json with asset_paths merged in
def as_json(options)
json = super(options.merge!(methods: :asset_path_icon))
json["icon"] = json["asset_path_icon"]
json.except("asset_path_icon")
end
end

View file

@ -46,6 +46,7 @@
</a>
</li>
<li>
<% # TODO enable ssl on blog.metamaps.cc %>
<a id="lightbox_blog" href="http://blog.metamaps.cc" target="_blank">
<div class="lightboxAboutIcon"></div>
blog
@ -58,7 +59,8 @@
</a>
</li>
<li>
<a id="lightbox_term" data-bypass="true" href="http://metamaps.cc/maps/331" target="_blank">
<% # TODO switch to https:// once we're confident %>
<a id="lightbox_term" data-bypass="true" href="//metamaps.cc/maps/331" target="_blank">
<div class="lightboxAboutIcon"></div>
terms
</a>
@ -115,7 +117,7 @@
<li>Google Plus <a href="https://plus.google.com/communities/115060009262157699234" target="_blank">*</a></li>
<li>Hackpad <a href="http://metamaps.hackpad.com/" target="_blank">*</a></li>
<li>Loomio <a href="https://www.loomio.org/g/bu3L1tIW/topos-ffo" target="_blank">*</a></li>
<li>Twitter <a href="http://twitter.com/metamapps" target="_blank">*</a></li>
<li>Twitter <a href="https://twitter.com/metamapps" target="_blank">*</a></li>
<li>Hipchat</li>
<li>Google Hangouts</li>
<li>Vimeo </li>
@ -152,6 +154,7 @@
<a id="chromeIcon" href="https://www.google.com/chrome/browser/" target="_blank">Chrome</a>
<a id="fireFoxIcon" href="https://www.mozilla.org/en-US/firefox/new/" target="_blank">Firefox</a>
<a id="safariIcon" href="http://support.apple.com/downloads/#safari" target="_blank">Safari</a>
<% # TODO https for blog.metamaps.cc %>
<p id="noIEbody">While it's downloading, explore our <a href="http://blog.metamaps.cc/">blog</a>,<br> watch the <a href="http://vimeo.com/88334167">tutorials</a>, or visit our <a href="http://support.metamaps.cc/">knowledge base</a>!
</div>
@ -200,13 +203,14 @@
<p>Want to help with design, code, community building, or communications for Metamaps? We're an open value network, which for us means we want to invite and empower peers to participate in creating value together.
<% # TODO change this link to https once it works %>
<p>To be a <b>USER</b>, request an invite! We'll expect you to abide by our <a href="http://metamaps.cc/maps/331" target="_blank">terms of service</a>.</p>
<p>To be a <b>CONTRIBUTOR</b>, simply <a href="https://docs.google.com/document/d/1z8FsSmYkHbLRLOsXc8i8M5ubKky8_WB2E9bLBoXJapU" target="_blank">enter our spaces</a> and join the conversation! We'll expect you to follow some guidelines.</p>
<p><b>MEMBERS</b> are contributors who act as stewards and guardians of the collective and are responsible for maintaining our culture and purpose. We're working on a set of agreements to formalize what it means to be a member.</p>
<p>We welcome people of all skillsets to create value within our network. There's open possibilities for designers, researchers, academics, strategists, and facilitators to contribute. If you're a developer, help us advance the code and take a look around our <a href="http://github.com/metamaps/metamaps_gen002" target="_blank">Github</a>.</p>
<p>We welcome people of all skillsets to create value within our network. There's open possibilities for designers, researchers, academics, strategists, and facilitators to contribute. If you're a developer, help us advance the code and take a look around our <a href="https://github.com/metamaps/metamaps_gen002" target="_blank">Github</a>.</p>
<p>Thanks for your interest in helping out with Metamaps! Hopefully this gets you pointed in the right direction to get involved. The next step is to read the links on this page and then contribute! </p>

View file

@ -16,7 +16,7 @@
<%= javascript_include_tag "application" %>
<!-- typekit for vinyl font -->
<script type="text/javascript" src="//use.typekit.net/tki2nyo.js"></script>
<script type="text/javascript" src="https://use.typekit.net/tki2nyo.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
<!-- app code -->
@ -141,16 +141,12 @@
// set up uservoice with signed in user
<% if authenticated? && ENV['SSO_KEY'] %>
USERVOICE.load(Metamaps.Active.Mapper.name, Metamaps.Active.Mapper.id, "<%= user.email %>", "<%= current_sso_token %>");
USERVOICE.load(Metamaps.Active.Mapper.name, Metamaps.Active.Mapper.id, "<%= user.email %>", "<%= current_sso_token %>");
<% else %>
USERVOICE.load();
USERVOICE.load();
<% 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

@ -47,7 +47,7 @@
Metamaps.Maps.Active = <%= @maps.to_json.html_safe %>;
Metamaps.currentSection = "";
Metamaps.currentPage = "";
Metamaps.GlobalUI.Search.isOpen = true;
Metamaps.GlobalUI.Search.open();
Metamaps.GlobalUI.Search.lock();
</script>
<% end %>

View file

@ -1,4 +1,4 @@
defaults: &defaults
default: &default
min_messages: WARNING
adapter: postgresql
host: 127.0.0.1
@ -9,9 +9,13 @@ defaults: &defaults
password: "3112"
development:
<<: *defaults
<<: *default
database: metamap002_development
test:
<<: *defaults
<<: *default
database: metamap002_test
production:
<<: *default
database: metamap002_production

View file

@ -15,12 +15,13 @@ Metamaps::Application.configure do
# S3 file storage
config.paperclip_defaults = {
:storage => :s3,
:s3_credentials => {
:bucket => ENV['S3_BUCKET_NAME'],
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
storage: :s3,
s3_credentials: {
bucket: ENV['S3_BUCKET_NAME'],
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
},
s3_protocol: 'https'
}
config.action_mailer.delivery_method = :smtp

View file

@ -24,11 +24,12 @@ Metamaps::Application.configure do
# S3 file storage
config.paperclip_defaults = {
:storage => :s3,
:s3_credentials => {
:bucket => ENV['S3_BUCKET_NAME'],
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
s3_credentials: {
bucket: ENV['S3_BUCKET_NAME'],
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
},
s3_protocol: 'https'
}
config.action_mailer.delivery_method = :smtp