
<% ws_count = 0 %>
<% tree_headings = [] %>
<% TreeArrangement.menu_query.each do |menu_item| %>
  <% ws_count += 1 %>
  <% unless tree_headings.include?(menu_item.label) %>
    <li role="presentation">
      <span>&nbsp; <%= menu_item.label %></span>
    </li>
    <% tree_headings << menu_item.label %>
  <% end %>

    <% 
      icon_check_class = 
        if session["workspace"].present? &&
           menu_item.workspace_id == session["workspace"]["id"]
            ""
        else
          "hidden"
        end
    %>
    <li role="presentation" style="padding-left: 1em;">
      <%= link_to("#{icon('cirle-o')} #{menu_item.workspace_title} #{fa_icon 'check', class: icon_check_class}".html_safe,
                  toggle_current_workspace_path(id: menu_item.workspace_id),
                  { remote: true,
                    method: "post",
                    title: 'Choose current workspace' }) %>
    </li>


<% end %>
<% if ws_count == 0 %>
  <li role="presentation">
    <span>&nbsp;&nbsp;[No&nbsp;workspaces&nbsp;-&nbsp;create&nbsp;one&nbsp;in&nbsp;the&nbsp;Tree&nbsp;Editor.]&nbsp;</span>
  </li>
<% end %>


<% ws_count = 0 %>
<% tree_headings = [] %>
<% TreeArrangement.menu_query.each do |menu_item| %>
  <% ws_count += 1 %>
  <% unless tree_headings.include?(menu_item.label) %>
    <li role="presentation">
      <span>&nbsp; <%= menu_item.label %></span>
    </li>
    <% tree_headings << menu_item.label %>
  <% end %>

    <% 
      icon_check_class = 
        if session["workspace"].present? &&
           menu_item.workspace_id == session["workspace"]["id"]
            ""
        else
          "hidden"
        end
    %>
    <li role="presentation" style="padding-left: 1em;">
      <%= link_to("#{icon('cirle-o')} #{menu_item.workspace_title} #{fa_icon 'check', class: icon_check_class}".html_safe,
                  toggle_current_workspace_path(id: menu_item.workspace_id),
                  { remote: true,
                    method: "post",
                    title: 'Choose current workspace' }) %>
    </li>


<% end %>
<% if ws_count == 0 %>
  <li role="presentation">
    <span>&nbsp;&nbsp;[No&nbsp;workspaces&nbsp;-&nbsp;create&nbsp;one&nbsp;in&nbsp;the&nbsp;<%= link_to "Tree&nbsp;Editor".html_safe, Rails.configuration.tree_editor_url, title:'link', class: 'blue' %>.]&nbsp;</span>
  </li>
<% end %>

Add link to tree editor on tree workspace menu.
Add link to tree editor on tree workspace menu.
