From 2f4fa7e64e8bcd5c11aa65dac897e2582e3a320d Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sun, 5 Feb 2017 08:22:35 +0000 Subject: [PATCH] realized this change is just good all around --- app/views/layouts/_lightboxes.html.erb | 6 +- app/views/shared/_switchmetacodes.html.erb | 9 +- .../shared/_switchmetacodessecret.html.erb | 119 ------------------ 3 files changed, 4 insertions(+), 130 deletions(-) delete mode 100644 app/views/shared/_switchmetacodessecret.html.erb diff --git a/app/views/layouts/_lightboxes.html.erb b/app/views/layouts/_lightboxes.html.erb index 2ca08179..d464b733 100644 --- a/app/views/layouts/_lightboxes.html.erb +++ b/app/views/layouts/_lightboxes.html.erb @@ -106,11 +106,7 @@
- <% if controller_name == 'maps' && action_name == "conversation" %> - <%= render :partial => 'shared/switchmetacodessecret' %> - <% else %> - <%= render :partial => 'shared/switchmetacodes' %> - <% end %> + <%= render :partial => 'shared/switchmetacodes' %>
<% end %> diff --git a/app/views/shared/_switchmetacodes.html.erb b/app/views/shared/_switchmetacodes.html.erb index 4c56dd41..b5607065 100644 --- a/app/views/shared/_switchmetacodes.html.erb +++ b/app/views/shared/_switchmetacodes.html.erb @@ -93,12 +93,9 @@

Choose Your Metacodes

<% @list = '' %> + <% metacodesInUse = user_metacodes() %> <% Metacode.order("name").all.each_with_index do |m, index| %> - <% if selectedSet == "custom" %> - <% mClass = metacodes.index(m.id.to_s) == nil ? "toggledOff" : "" %> - <% else %> - <% mClass = "toggledOff" %> - <% end %> + <% mClass = metacodesInUse.index(m) == nil ? "toggledOff" : "" %> <% @list += '
  • ' + m.name + '

    ' + m.name.downcase + '

  • ' %> <% end %> @@ -119,4 +116,4 @@ + \ No newline at end of file diff --git a/app/views/shared/_switchmetacodessecret.html.erb b/app/views/shared/_switchmetacodessecret.html.erb deleted file mode 100644 index b5607065..00000000 --- a/app/views/shared/_switchmetacodessecret.html.erb +++ /dev/null @@ -1,119 +0,0 @@ -<%# - # @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