add stuff

This commit is contained in:
Connor Turland 2017-02-05 06:55:38 +00:00
parent 2eb38edd6e
commit 9c644afa2c
6 changed files with 168 additions and 4 deletions

View file

@ -29,7 +29,7 @@
<meta name="twitter:url" content="<%= request.original_url %>" />
<% end %>
<% if controller.class.name == 'MapsController' && action_name == "conversation" %>
<% if controller_name == 'maps' && action_name == "conversation" %>
<%= stylesheet_link_tag "precompiled-convo", :media => "all" %>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "precompiled-convo" %>

View file

@ -106,7 +106,11 @@
</div>
<div class="lightboxContent" id="switchMetacodes">
<%= render :partial => 'shared/switchmetacodes' %>
<% if controller_name == 'maps' && action_name == "conversation" %>
<%= render :partial => 'shared/switchmetacodessecret' %>
<% else %>
<%= render :partial => 'shared/switchmetacodes' %>
<% end %>
</div>
<% end %>

View file

@ -39,7 +39,11 @@
<div class="showcard mapElement mapElementHidden" id="showcard"></div> <!-- the topic card -->
<% if authenticated? %>
<% # for creating and pulling in topics and synapses %>
<%= render :partial => 'maps/newtopic' %>
<% if controller_name == 'maps' && action_name == "conversation" %>
<%= render :partial => 'maps/newtopicsecret' %>
<% else %>
<%= render :partial => 'maps/newtopic' %>
<% end %>
<%= render :partial => 'maps/newsynapse' %>
<% # for populating the change metacode list on the topic card %>
<%= render :partial => 'shared/metacodeoptions' %>

View file

@ -0,0 +1,37 @@
<%= form_for Topic.new, url: topics_url, remote: true do |form| %>
<div class="openMetacodeSwitcher openLightbox" data-open="switchMetacodes">
<div class="tooltipsAbove">Switch Metacodes</div>
</div>
<div id="metacodeImg">
<% @metacodes = user_metacodes()
puts user_metacode()
@metacodes.each do |m| %>
<img class="cloudcarousel" width="40" height="40" src="<%= asset_path m.icon %>" alt="<%= m.name %>" title="<%= m.name %>" data-id="<%= m.id %>" />
<% end %>
</div>
<div class="selectedMetacode">
<img src="<%= asset_path @metacodes[0].icon %>" />
<span><%= @metacodes[0].name %></span>
<div class="downArrow"></div>
</div>
<%= form.text_field :name, :maxlength => 140, :placeholder => "what are you thinking..." %>
<div class="clearfloat"></div>
<div id="metacodeSelector"></div>
<div class="clearfloat"></div>
<script>
<% @metacodes.each do |m| %>
Metamaps.Create.selectedMetacodes.push("<%= m.id %>");
Metamaps.Create.newSelectedMetacodes.push("<%= m.id %>");
Metamaps.Create.selectedMetacodeNames.push("<%= m.name %>");
Metamaps.Create.newSelectedMetacodeNames.push("<%= m.name %>");
<% end %>
Metamaps.Create.newTopic.metacode = <%= @metacodes[0].id %>
<% current_user.recent_metacodes.each do |id| %>
Metamaps.Create.recentMetacodes.push(<%= id %>);
<% end %>
<% current_user.most_used_metacodes.each do |id| %>
Metamaps.Create.mostUsedMetacodes.push(<%= id %>);
<% end %>
</script>
<% end %>

View file

@ -0,0 +1,119 @@
<%#
# @file
# The inner HTML for switching your metacode set
#%>
<% metacodes = current_user.settings.metacodes %>
<% selectedSet = metacodes[0].include?("metacodeset") ? metacodes[0].sub("metacodeset-","") : "custom" %>
<% allMetacodeSets = MetacodeSet.order("name").all.to_a %>
<% if selectedSet == "custom"
index = allMetacodeSets.length + 2
elsif selectedSet == 'Recent'
index = 0
elsif selectedSet == 'Most'
index = 1
else
set = MetacodeSet.find(selectedSet.to_i)
index = allMetacodeSets.index(set) + 2
end %>
<h3>Switch Metacode Set</h3>
<p>Use metacode sets to enter different modes of mapping.</p>
<div id="metacodeSwitchTabs">
<ul>
<li><a href="#metacodeSwitchTabsRecent" data-set-id="recent" id="metacodeSetRecent">RECENTLY USED</a></li>
<li><a href="#metacodeSwitchTabsMost" data-set-id="most" id="metacodeSetMost">MOST USED</a></li>
<% allMetacodeSets.each do |m| %>
<li><a href="#metacodeSwitchTabs<%= m.id %>" data-set-id="<%= m.id %>"><%= m.name %></a></li>
<% end %>
<li><a href="#metacodeSwitchTabsCustom" data-set-id="custom" id="metacodeSetCustom">CUSTOM SELECTION</a></li>
</ul>
<% recent = user_recent_metacodes() %>
<div id="metacodeSwitchTabsRecent"
data-metacodes="<%= recent.map(&:id).join(',') %>">
<% @list = '' %>
<% recent.each_with_index do |m, index| %>
<% @list += '<li><img src="' + asset_path(m.icon) + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div class="clearfloat"></div></li>' %>
<% end %>
<div class="metacodeSwitchTab">
<p class="setDesc">The 5 Metacodes you've used most recently.</p>
<div class="metacodeSetList">
<ul>
<%= @list.html_safe %>
</ul>
<div class="clearfloat"></div>
</div>
</div>
<button class="button" onclick="Metamaps.Create.updateMetacodeSet('Recent', 0, false);">
Switch Set
</button>
</div>
<% most_used = user_most_used_metacodes() %>
<div id="metacodeSwitchTabsMost"
data-metacodes="<%= most_used.map(&:id).join(',') %>">
<% @list = '' %>
<% most_used.each_with_index do |m, index| %>
<% @list += '<li><img src="' + asset_path(m.icon) + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div class="clearfloat"></div></li>' %>
<% end %>
<div class="metacodeSwitchTab">
<p class="setDesc">The 5 Metacodes you've used the most.</p>
<div class="metacodeSetList">
<ul>
<%= @list.html_safe %>
</ul>
<div class="clearfloat"></div>
</div>
</div>
<button class="button" onclick="Metamaps.Create.updateMetacodeSet('Most', 1, false);">
Switch Set
</button>
</div>
<% allMetacodeSets.each_with_index do |m, localindex| %>
<div id="metacodeSwitchTabs<%= m.id %>"
data-metacodes="<%= m.metacodes.map(&:id).join(',') %>">
<% @list = '' %>
<% m.metacodes.sort{|x,y| x.name <=> y.name }.each_with_index do |m, index| %>
<% @list += '<li><img src="' + asset_path(m.icon) + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div class="clearfloat"></div></li>' %>
<% end %>
<div class="metacodeSwitchTab">
<p class="setDesc"><%= m.desc %></p>
<div class="metacodeSetList">
<ul>
<%= @list.html_safe %>
</ul>
<div class="clearfloat"></div>
</div>
</div>
<button class="button" onclick="Metamaps.Create.updateMetacodeSet(<%= m.id %>, <%= localindex + 2 %>, false);">
Switch Set
</button>
</div>
<% end %>
<div id="metacodeSwitchTabsCustom">
<p class="setDesc">Choose Your Metacodes</p>
<% @list = '' %>
<% metacodesInUse = user_metacodes() %>
<% Metacode.order("name").all.each_with_index do |m, index| %>
<% mClass = metacodesInUse.index(m) == nil ? "toggledOff" : "" %>
<% @list += '<li id="' + m.id.to_s + '" data-name="' + m.name + '" class="' + mClass + '"><img src="' + asset_path(m.icon) + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div class="clearfloat"></div></li>' %>
<% end %>
<div class="customMetacodeList">
<ul>
<%= @list.html_safe %>
</ul>
<div class="clearfloat"></div>
</div>
<button class="button" onclick="Metamaps.Create.updateMetacodeSet('custom', <%= allMetacodeSets.length + 2 %>, true);">
Switch to Custom Set
</button>
</div>
</div>
<div class="clearfloat"></div>
<script>
Metamaps.Create.selectedMetacodeSet = "metacodeset-<%= selectedSet %>"
Metamaps.Create.selectedMetacodeSetIndex = <%= index %>
</script>

View file

@ -9,5 +9,5 @@ Rails.application.configure do
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
config.assets.precompile += %w(precompiled-convo.css precompiled-convo.js webpacked/metamaps.bundle.js)
config.assets.precompile += %w( precompiled-convo.css precompiled-convo.js webpacked/metamaps.bundle.js )
end