final touchups on oauth

This commit is contained in:
Connor Turland 2016-03-24 21:26:07 -07:00
parent 540b35c757
commit 415c9b8ac3
7 changed files with 160 additions and 247 deletions

View file

@ -1,12 +1,12 @@
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
include ApplicationHelper
include Pundit include Pundit
include PunditExtra include PunditExtra
rescue_from Pundit::NotAuthorizedError, with: :handle_unauthorized rescue_from Pundit::NotAuthorizedError, with: :handle_unauthorized
protect_from_forgery protect_from_forgery
before_action :get_invite_link
after_action :allow_embedding after_action :allow_embedding
def default_serializer_options def default_serializer_options
{ root: false } { root: false }
end end
@ -33,7 +33,7 @@ class ApplicationController < ActionController::Base
def handle_unauthorized def handle_unauthorized
head :forbidden # TODO make this better head :forbidden # TODO make this better
end end
private private
def require_no_user def require_no_user
@ -69,10 +69,6 @@ private
authenticated? && current_user.admin authenticated? && current_user.admin
end end
def get_invite_link
@invite_link = "#{request.base_url}/join" + (current_user ? "?code=#{current_user.code}" : "")
end
def allow_embedding def allow_embedding
#allow all #allow all
response.headers.except! 'X-Frame-Options' response.headers.except! 'X-Frame-Options'

View file

@ -1,12 +1,12 @@
module ApplicationHelper module ApplicationHelper
def get_metacodeset def get_metacodeset
@m = user.settings.metacodes @m = current_user.settings.metacodes
set = @m[0].include?("metacodeset") ? MetacodeSet.find(@m[0].sub("metacodeset-","").to_i) : false set = @m[0].include?("metacodeset") ? MetacodeSet.find(@m[0].sub("metacodeset-","").to_i) : false
return set return set
end end
def user_metacodes def user_metacodes
@m = user.settings.metacodes @m = current_user.settings.metacodes
set = get_metacodeset set = get_metacodeset
if set if set
@metacodes = set.metacodes.to_a @metacodes = set.metacodes.to_a
@ -15,4 +15,8 @@ module ApplicationHelper
end end
@metacodes.sort! {|m1,m2| m2.name.downcase <=> m1.name.downcase }.rotate!(-1) @metacodes.sort! {|m1,m2| m2.name.downcase <=> m1.name.downcase }.rotate!(-1)
end end
def determine_invite_link
"#{request.base_url}/join" + (current_user ? "?code=#{current_user.code}" : "")
end
end end

View file

@ -0,0 +1,32 @@
<%= render :partial => 'layouts/lightboxes' %>
<%= render :partial => 'layouts/templates' %>
<%= render :partial => 'shared/metacodeBgColors' %>
<script type="text/javascript" charset="utf-8">
<% if current_user %>
Metamaps.Active.Mapper = <%= current_user.to_json.html_safe %>
<% else %>
Metamaps.Active.Mapper = null;
<% end %>
Metamaps.Metacodes = <%= Metacode.all.to_json.html_safe %>;
Metamaps.Loading = {
loader: new CanvasLoader('loading'),
hide: function () {
$('#loading').hide();
},
show: function () {
$('#loading').show();
}
};
Metamaps.Loading.loader.setColor('#4fb5c0'); // default is '#000000'
Metamaps.Loading.loader.setDiameter(28); // default is 40
Metamaps.Loading.loader.setDensity(41); // default is 40
Metamaps.Loading.loader.setRange(0.9); // default is 1.3
Metamaps.Loading.loader.show(); // Hidden by default
USERVOICE.load();
</script>
<%= render :partial => 'layouts/googleanalytics' if Rails.env.production? %>
</body>
</html>

View file

@ -0,0 +1,71 @@
<!--
Do you want to learn more about web development using Ruby or Javascript?
Metamaps.cc is an open source project, and we are always looking for new
developers to help contribute to our codebase! To get involved, send an
email to team@metamaps.cc or find us on Github at
https://github.com/metamaps/metamaps_gen002.
-->
<!DOCTYPE html>
<html>
<head>
<title><%=h yield(:title) %></title>
<%= csrf_meta_tags %>
<meta name="viewport" content="width=device-width, user-scalable=no">
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<!-- typekit for vinyl font -->
<script type="text/javascript" src="https://use.typekit.net/tki2nyo.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
<!-- app code -->
<script type="text/javascript">
require.config({baseUrl: '<%= "#{ asset_path '/famous/main.js' }".chomp('main.js') %>'});
require(['main']);
</script>
<!--[if (IE)]>
<style type="text/css">
#lightbox_overlay {
display: block;
}
#lightbox_main {
top: 50%;
margin-top: -281px;
}
#lightbox_screen {
height: 100%;
opacity: 0.42;
}
.lightboxContent {
display: none;
}
#noIE {
display: block;
}
#lightbox_close {
display: none;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
$("#lightbox_screen").unbind().click(function(event){
event.preventDefault();
event.stopPropagation();
return false;
});
});
</script>
<![endif]-->
</head>

View file

@ -6,7 +6,7 @@
<div id="lightbox_main"> <div id="lightbox_main">
<a id="lightbox_close" href="#"></a> <a id="lightbox_close" href="#"></a>
<div id="lightbox_content"> <div id="lightbox_content">
<div class="lightboxContent" id="about"> <div class="lightboxContent" id="about">
<h3>About Metamaps.cc</h3> <h3>About Metamaps.cc</h3>
<div id="aboutParms"> <div id="aboutParms">
@ -14,24 +14,24 @@
<p>STATUS: </p> <p>STATUS: </p>
<p>VERSION:</p> <p>VERSION:</p>
<p>LAST UPDATE:</p> <p>LAST UPDATE:</p>
</div> </div>
<div id="rightAboutParms"> <div id="rightAboutParms">
<p>PRIVATE BETA</p> <p>PRIVATE BETA</p>
<p>2.8</p> <p>2.8</p>
<p>Nov 29, 2014</p> <p>Nov 29, 2014</p>
</div> </div>
<div class="clearfloat"> <div class="clearfloat">
</div> </div>
</div> </div>
<p>Metamaps.cc is a free and open source web platform that supports real-time sense-making and distributed collaboration between individuals, communities and organizations.</p> <p>Metamaps.cc is a free and open source web platform that supports real-time sense-making and distributed collaboration between individuals, communities and organizations.</p>
<p>Using an intuitive graph-based interface, Metamaps.cc helps map out networks of people, ideas, resources, stories, experiences, conversations and much more. The platform is evolving for a range of applications amidst a growing network of designers, developers, facilitators, practitioners, entrepreneurs, and artists.</p> <p>Using an intuitive graph-based interface, Metamaps.cc helps map out networks of people, ideas, resources, stories, experiences, conversations and much more. The platform is evolving for a range of applications amidst a growing network of designers, developers, facilitators, practitioners, entrepreneurs, and artists.</p>
<p>Metamaps.cc is created and maintained by a distributed community of contributors passionate about the evolution of collaboration, alternative forms of value creation and increase of collective intelligence through the lens of the open culture and the peer-to-peer revolution.</p> <p>Metamaps.cc is created and maintained by a distributed community of contributors passionate about the evolution of collaboration, alternative forms of value creation and increase of collective intelligence through the lens of the open culture and the peer-to-peer revolution.</p>
<ul class="lightbox_links"> <ul class="lightbox_links">
<li> <li>
<a id="lightbox_metamapps" href="https://twitter.com/metamapps" target="_blank"> <a id="lightbox_metamapps" href="https://twitter.com/metamapps" target="_blank">
@ -69,7 +69,7 @@
<div class="lightboxContent" id="colophon"> <div class="lightboxContent" id="colophon">
<h3 id="colophoneHeader">Colophon</h3> <h3 id="colophoneHeader">Colophon</h3>
<p>Metamaps.cc is an initiative of affiliates of the Metamaps Open Value Network, an evolving network of peers working together to create shared value. Metamaps continues to be a constantly developing experiment in progress.</p> <p>Metamaps.cc is an initiative of affiliates of the Metamaps Open Value Network, an evolving network of peers working together to create shared value. Metamaps continues to be a constantly developing experiment in progress.</p>
<p>The peers behind Metamaps have their own respective backgrounds as artists, designers, engineers, advocates, activitists, filmmakers and systems thinkers and share a deep commitment to the creative culture they support.</p> <p>The peers behind Metamaps have their own respective backgrounds as artists, designers, engineers, advocates, activitists, filmmakers and systems thinkers and share a deep commitment to the creative culture they support.</p>
@ -141,7 +141,7 @@
<br> <br>
<h4 id="colophonSection">Support</h4> <h4 id="colophonSection">Support</h4>
<ul><li>Uservoice <a href="http://metamapscc.uservoice.com/" target="_blank">*</a></li></ul> <ul><li>Uservoice <a href="http://metamapscc.uservoice.com/" target="_blank">*</a></li></ul>
</div> </div>
<div class="clearfloat"></div> <div class="clearfloat"></div>
</div> </div>
@ -158,8 +158,8 @@
<div class="lightboxContent" id="donate"> <div class="lightboxContent" id="donate">
<h3>Donate!</h3> <h3>Donate!</h3>
<div class="leaveSpace"></div> <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> <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>
<p>We will continue to bootstrap this project and experiment with alternative business models that are aligned with our values and mission and do not involve exploitation of our users, exclusivity or privatization of the technology. </p> <p>We will continue to bootstrap this project and experiment with alternative business models that are aligned with our values and mission and do not involve exploitation of our users, exclusivity or privatization of the technology. </p>
@ -196,14 +196,14 @@
<div class="lightboxContent" id="getInvolved"> <div class="lightboxContent" id="getInvolved">
<h3>GET INVOLVED!</h3> <h3>GET INVOLVED!</h3>
<div class="leaveSpace"></div> <div class="leaveSpace"></div>
<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. <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.
<p>To be a <b>USER</b>, request an invite! We'll expect you to abide by our <a href="https://metamaps.cc/maps/331" target="_blank">terms of service</a>.</p> <p>To be a <b>USER</b>, request an invite! We'll expect you to abide by our <a href="https://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>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><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="https://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>
@ -212,37 +212,37 @@
<div class="clearfloat"></div> <div class="clearfloat"></div>
</div> </div>
<div class="lightboxContent" id="tutorial"> <div class="lightboxContent" id="tutorial">
<h3>Tutorial</h3> <h3>Tutorial</h3>
<iframe src="//player.vimeo.com/video/88334167?title=0&amp;byline=0&amp;portrait=0" width="510" height="319" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> <iframe src="//player.vimeo.com/video/88334167?title=0&amp;byline=0&amp;portrait=0" width="510" height="319" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div> </div>
<div class="lightboxContent" id="cheatsheet"> <div class="lightboxContent" id="cheatsheet">
<%= render :partial => 'shared/cheatsheet' %> <%= render :partial => 'shared/cheatsheet' %>
</div> </div>
<% if current_user %> <% if current_user %>
<div class="lightboxContent" id="invite"> <div class="lightboxContent" id="invite">
<h3>SHARE INVITE</h3> <h3>SHARE INVITE</h3>
<div class="leaveSpace"></div> <div class="leaveSpace"></div>
<p>The Metamaps platform is currently in an invite-only beta with the express purpose of creating a high value knowledge ecosystem, a diverse community of contributors and a culture of collaboration and curiosity.</p> <p>The Metamaps platform is currently in an invite-only beta with the express purpose of creating a high value knowledge ecosystem, a diverse community of contributors and a culture of collaboration and curiosity.</p>
<p>As a valued beta tester, you have the ability to invite your peers, colleagues and collaborators onto the platform.</p> <p>As a valued beta tester, you have the ability to invite your peers, colleagues and collaborators onto the platform.</p>
<p>Below is a personal invite link containing your unique access code, which can be used multiple times.</p> <p>Below is a personal invite link containing your unique access code, which can be used multiple times.</p>
<div id="joinCodesBox"> <div id="joinCodesBox">
<p class="joinCodes"><%= @invite_link %> <p class="joinCodes"><%= determine_invite_link %>
<button class="button" onclick="Metamaps.GlobalUI.shareInvite('<%= @invite_link %>');">COPY INVITE LINK!</button> <button class="button" onclick="Metamaps.GlobalUI.shareInvite('<%= @invite_link %>');">COPY INVITE LINK!</button>
</div> </div>
</div> </div>
<% # this is the create new map form %> <% # this is the create new map form %>
<div class="lightboxContent" id="newmap"> <div class="lightboxContent" id="newmap">
<%= render :partial => 'layouts/newmap' %> <%= render :partial => 'layouts/newmap' %>
</div> </div>
<div class="lightboxContent" id="forkmap"> <div class="lightboxContent" id="forkmap">
<%= render :partial => 'shared/forkmap' %> <%= render :partial => 'shared/forkmap' %>
</div> </div>
@ -250,9 +250,8 @@
<%= render :partial => 'shared/switchmetacodes' %> <%= render :partial => 'shared/switchmetacodes' %>
</div> </div>
<% end %> <% end %>
</div> </div>
</div> </div>
<div id="lightbox_screen" style="height: 100%;"></div> <div id="lightbox_screen" style="height: 100%;"></div>
</div> </div>

View file

@ -5,77 +5,7 @@
# displayed within, based on URL # displayed within, based on URL
#%> #%>
<!-- <%= render :partial => 'layouts/head' %>
Do you want to learn more about web development using Ruby or Javascript?
Metamaps.cc is an open source project, and we are always looking for new
developers to help contribute to our codebase! To get involved, send an
email to team@metamaps.cc or find us on Github at
https://github.com/metamaps/metamaps_gen002.
-->
<!DOCTYPE html>
<html>
<head>
<title><%=h yield(:title) %></title>
<%= csrf_meta_tags %>
<meta name="viewport" content="width=device-width, user-scalable=no">
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<!-- typekit for vinyl font -->
<script type="text/javascript" src="https://use.typekit.net/tki2nyo.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
<!-- app code -->
<script type="text/javascript">
require.config({baseUrl: '<%= "#{ asset_path '/famous/main.js' }".chomp('main.js') %>'});
require(['main']);
</script>
<!--[if (IE)]>
<style type="text/css">
#lightbox_overlay {
display: block;
}
#lightbox_main {
top: 50%;
margin-top: -281px;
}
#lightbox_screen {
height: 100%;
opacity: 0.42;
}
.lightboxContent {
display: none;
}
#noIE {
display: block;
}
#lightbox_close {
display: none;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
$("#lightbox_screen").unbind().click(function(event){
event.preventDefault();
event.stopPropagation();
return false;
});
});
</script>
<![endif]-->
</head>
<body class="<%= authenticated? ? "authenticated" : "unauthenticated" %>"> <body class="<%= authenticated? ? "authenticated" : "unauthenticated" %>">
@ -90,7 +20,7 @@
<% classes = action_name == "home" ? "homePage" : "" <% classes = action_name == "home" ? "homePage" : ""
classes += action_name == "home" && authenticated? ? " explorePage" : "" classes += action_name == "home" && authenticated? ? " explorePage" : ""
classes += controller_name == "maps" && action_name == "index" ? " explorePage" : "" classes += controller_name == "maps" && action_name == "index" ? " explorePage" : ""
if controller_name == "maps" && action_name == "show" if controller_name == "maps" && action_name == "show"
classes += " mapPage" classes += " mapPage"
if policy(@map).update? if policy(@map).update?
classes += " canEditMap" classes += " canEditMap"
@ -103,7 +33,7 @@
%> %>
<div class="wrapper <%= classes %>" id="wrapper"> <div class="wrapper <%= classes %>" id="wrapper">
<%= render :partial => 'layouts/upperelements', :locals => { :appsPage => false } %> <%= render :partial => 'layouts/upperelements', :locals => { :appsPage => false } %>
<%= yield %> <%= yield %>
@ -124,40 +54,4 @@
<% end %> <% end %>
<%= render :partial => 'layouts/lightboxes' %> <%= render :partial => 'layouts/foot' %>
<%= render :partial => 'layouts/templates' %>
<%= render :partial => 'shared/metacodeBgColors' %>
<script type="text/javascript" charset="utf-8">
<% if authenticated? %>
Metamaps.Active.Mapper = <%= user.to_json.html_safe %>
<% else %>
Metamaps.Active.Mapper = null;
<% end %>
Metamaps.Metacodes = <%= Metacode.all.to_json.html_safe %>;
Metamaps.Loading = {
loader: new CanvasLoader('loading'),
hide: function () {
$('#loading').hide();
},
show: function () {
$('#loading').show();
}
};
Metamaps.Loading.loader.setColor('#4fb5c0'); // default is '#000000'
Metamaps.Loading.loader.setDiameter(28); // default is 40
Metamaps.Loading.loader.setDensity(41); // default is 40
Metamaps.Loading.loader.setRange(0.9); // default is 1.3
Metamaps.Loading.loader.show(); // Hidden by default
// 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 %>");
<% else %>
USERVOICE.load();
<% end %>
</script>
<%= render :partial => 'layouts/googleanalytics' if Rails.env.production? %>
</body>
</html>

View file

@ -5,77 +5,7 @@
# displayed within, based on URL # displayed within, based on URL
#%> #%>
<!-- <%= render :partial => 'layouts/head' %>
Do you want to learn more about web development using Ruby or Javascript?
Metamaps.cc is an open source project, and we are always looking for new
developers to help contribute to our codebase! To get involved, send an
email to team@metamaps.cc or find us on Github at
https://github.com/metamaps/metamaps_gen002.
-->
<!DOCTYPE html>
<html>
<head>
<title><%=h yield(:title) %></title>
<%= csrf_meta_tags %>
<meta name="viewport" content="width=device-width, user-scalable=no">
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<!-- typekit for vinyl font -->
<script type="text/javascript" src="https://use.typekit.net/tki2nyo.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
<!-- app code -->
<script type="text/javascript">
require.config({baseUrl: '<%= "#{ asset_path '/famous/main.js' }".chomp('main.js') %>'});
require(['main']);
</script>
<!--[if (IE)]>
<style type="text/css">
#lightbox_overlay {
display: block;
}
#lightbox_main {
top: 50%;
margin-top: -281px;
}
#lightbox_screen {
height: 100%;
opacity: 0.42;
}
.lightboxContent {
display: none;
}
#noIE {
display: block;
}
#lightbox_close {
display: none;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
$("#lightbox_screen").unbind().click(function(event){
event.preventDefault();
event.stopPropagation();
return false;
});
});
</script>
<![endif]-->
</head>
<body class="<%= current_user ? 'authenticated' : 'unauthenticated' %>"> <body class="<%= current_user ? 'authenticated' : 'unauthenticated' %>">
@ -88,38 +18,25 @@
<%= content_tag :div, class: "main" do %> <%= content_tag :div, class: "main" do %>
<div class="wrapper" id="wrapper"> <div class="wrapper" id="wrapper">
<%= render :partial => 'layouts/upperelements', :locals => {:appsPage => true } %> <%= render :partial => 'layouts/upperelements', :locals => {:appsPage => true } %>
<%= yield %> <%= yield %>
<div class="showcard mapElement mapElementHidden" id="showcard"></div> <!-- the topic card -->
<% if current_user %>
<% # for creating and pulling in topics and synapses %>
<%= render :partial => 'maps/newtopic' %>
<%= render :partial => 'maps/newsynapse' %>
<% # for populating the change metacode list on the topic card %>
<%= render :partial => 'shared/metacodeoptions' %>
<% end %>
<%= render :partial => 'layouts/lowermapelements' %>
<div id="famousOverlay"></div> <div id="famousOverlay"></div>
<div id="loading"></div> <div id="loading"></div>
</div> </div>
<% end %> <% end %>
<%= render :partial => 'layouts/lightboxes' %> <%= render :partial => 'layouts/foot' %>
<%= render :partial => 'layouts/templates' %>
<%= render :partial => 'shared/metacodeBgColors' %>
<script type="text/javascript" charset="utf-8">
Metamaps.Loading = {
loader: new CanvasLoader('loading'),
hide: function () {
$('#loading').hide();
},
show: function () {
$('#loading').show();
}
};
Metamaps.Loading.loader.setColor('#4fb5c0'); // default is '#000000'
Metamaps.Loading.loader.setDiameter(28); // default is 40
Metamaps.Loading.loader.setDensity(41); // default is 40
Metamaps.Loading.loader.setRange(0.9); // default is 1.3
Metamaps.Loading.loader.show(); // Hidden by default
</script>
<%= render :partial => 'layouts/googleanalytics' if Rails.env.production? %>
</body>
</html>