set up for using secret css/js

This commit is contained in:
Connor Turland 2017-02-05 04:43:09 +00:00
parent 00ecb0f6bb
commit 7a70ad4a73
4 changed files with 47 additions and 2 deletions

View file

@ -23,6 +23,23 @@ class MapsController < ApplicationController
format.ttl { redirect_to action: :export, format: :ttl }
end
end
# GET maps/:id/conversation
def conversation
respond_to do |format|
format.html do
UserMap.where(map: @map, user: current_user).map(&:mark_invite_notifications_as_read)
@allmappers = @map.contributors
@allcollaborators = @map.editors
@alltopics = policy_scope(@map.topics)
@allsynapses = policy_scope(@map.synapses)
@allmappings = policy_scope(@map.mappings)
@allmessages = @map.messages.sort_by(&:created_at)
@allstars = @map.stars
@allrequests = @map.access_requests
end
end
end
# GET maps/new
def new

View file

@ -29,8 +29,13 @@
<meta name="twitter:url" content="<%= request.original_url %>" />
<% end %>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<% if controller_name == "maps" && action_name == "conversation" %>
<%= stylesheet_link_tag "application_secret", :media => "all" %>
<%= javascript_include_tag "application_secret" %>
<% else %>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<% end %>
<!-- typekit for vinyl font -->
<script type="text/javascript" src="https://use.typekit.net/tki2nyo.js"></script>

View file

@ -0,0 +1,22 @@
<%#
# @file
# Code to display a map
# /maps/:id
#%>
<% content_for :title, @map.name + " | Metamaps" %>
<% content_for :mobile_title, @map.name %>
<script>
Metamaps.currentSection = "map";
Metamaps.currentPage = <%= @map.id.to_s %>;
Metamaps.ServerData = Metamaps.ServerData || {}
Metamaps.ServerData.ActiveMap = <%= @map.to_json.html_safe %>;
Metamaps.ServerData.Mappers = <%= @allmappers.to_json.html_safe %>;
Metamaps.ServerData.Collaborators = <%= @allcollaborators.to_json.html_safe %>;
Metamaps.ServerData.Topics = <%= @alltopics.to_json(user: current_user).html_safe %>;
Metamaps.ServerData.Synapses = <%= @allsynapses.to_json.html_safe %>;
Metamaps.ServerData.Mappings = <%= @allmappings.to_json.html_safe %>;
Metamaps.ServerData.Messages = <%= @allmessages.to_json.html_safe %>;
Metamaps.ServerData.Stars = <%= @allstars.to_json.html_safe %>;
Metamaps.ServerData.VisualizeType = "ForceDirected";
</script>

View file

@ -18,6 +18,7 @@ Metamaps::Application.routes.draw do
resources :maps, except: [:index, :edit] do
member do
get :conversation
get :export
post 'events/:event', action: :events
get :contains