From 9c644afa2ce1895960063671f64506a21b0b570f Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sun, 5 Feb 2017 06:55:38 +0000 Subject: [PATCH] add stuff --- app/views/layouts/_head.html.erb | 2 +- app/views/layouts/_lightboxes.html.erb | 6 +- app/views/layouts/application.html.erb | 6 +- app/views/maps/_newtopicsecret.html.erb | 37 ++++++ .../shared/_switchmetacodessecret.html.erb | 119 ++++++++++++++++++ config/initializers/assets.rb | 2 +- 6 files changed, 168 insertions(+), 4 deletions(-) create mode 100644 app/views/maps/_newtopicsecret.html.erb create mode 100644 app/views/shared/_switchmetacodessecret.html.erb diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index 1b146cab..45a50341 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -29,7 +29,7 @@ <% 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" %> diff --git a/app/views/layouts/_lightboxes.html.erb b/app/views/layouts/_lightboxes.html.erb index d464b733..2ca08179 100644 --- a/app/views/layouts/_lightboxes.html.erb +++ b/app/views/layouts/_lightboxes.html.erb @@ -106,7 +106,11 @@
- <%= render :partial => 'shared/switchmetacodes' %> + <% if controller_name == 'maps' && action_name == "conversation" %> + <%= render :partial => 'shared/switchmetacodessecret' %> + <% else %> + <%= render :partial => 'shared/switchmetacodes' %> + <% end %>
<% end %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 36934885..91d4ac73 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -39,7 +39,11 @@
<% 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' %> diff --git a/app/views/maps/_newtopicsecret.html.erb b/app/views/maps/_newtopicsecret.html.erb new file mode 100644 index 00000000..603a0fb2 --- /dev/null +++ b/app/views/maps/_newtopicsecret.html.erb @@ -0,0 +1,37 @@ +<%= form_for Topic.new, url: topics_url, remote: true do |form| %> +
+
Switch Metacodes
+
+ +
+ <% @metacodes = user_metacodes() + puts user_metacode() + @metacodes.each do |m| %> + <%= m.name %> + <% end %> +
+
+ + <%= @metacodes[0].name %> +
+
+ <%= form.text_field :name, :maxlength => 140, :placeholder => "what are you thinking..." %> +
+
+
+ +<% end %> \ No newline at end of file diff --git a/app/views/shared/_switchmetacodessecret.html.erb b/app/views/shared/_switchmetacodessecret.html.erb new file mode 100644 index 00000000..b5607065 --- /dev/null +++ b/app/views/shared/_switchmetacodessecret.html.erb @@ -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 %> +

Switch Metacode Set

+ +

Use metacode sets to enter different modes of mapping.

+ +
+ + <% recent = user_recent_metacodes() %> +
+ <% @list = '' %> + <% recent.each_with_index do |m, index| %> + <% @list += '
  • ' + m.name + '

    ' + m.name.downcase + '

  • ' %> + <% end %> +
    +

    The 5 Metacodes you've used most recently.

    +
    +
      + <%= @list.html_safe %> +
    +
    +
    +
    + +
    + <% most_used = user_most_used_metacodes() %> +
    + <% @list = '' %> + <% most_used.each_with_index do |m, index| %> + <% @list += '
  • ' + m.name + '

    ' + m.name.downcase + '

  • ' %> + <% end %> +
    +

    The 5 Metacodes you've used the most.

    +
    +
      + <%= @list.html_safe %> +
    +
    +
    +
    + +
    + <% allMetacodeSets.each_with_index do |m, localindex| %> +
    + <% @list = '' %> + <% m.metacodes.sort{|x,y| x.name <=> y.name }.each_with_index do |m, index| %> + <% @list += '
  • ' + m.name + '

    ' + m.name.downcase + '

  • ' %> + <% end %> +
    +

    <%= m.desc %>

    +
    +
      + <%= @list.html_safe %> +
    +
    +
    +
    + +
    + <% end %> +
    +

    Choose Your Metacodes

    + <% @list = '' %> + <% metacodesInUse = user_metacodes() %> + <% Metacode.order("name").all.each_with_index do |m, index| %> + <% mClass = metacodesInUse.index(m) == nil ? "toggledOff" : "" %> + <% @list += '
  • ' + m.name + '

    ' + m.name.downcase + '

  • ' %> + <% end %> + +
    +
      + <%= @list.html_safe %> +
    +
    +
    + +
    +
    + +
    + + \ No newline at end of file diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 1fa641df..cef16ba0 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -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