diff --git a/app/views/grids/_notes.html.erb b/app/views/grids/_notes.html.erb index d2f1134083..f0bea36e06 100644 --- a/app/views/grids/_notes.html.erb +++ b/app/views/grids/_notes.html.erb @@ -65,9 +65,15 @@ <% if type == "questions" || tagname.include?('question:') %> -

Ask a question  or help answer future questions

+

Ask a question  or help answer future questions

+ <% elsif type == "activity" || tagname.include?('activity:') %> -

Add an activity  or request an activity

+

Add an activity  or request an activity

Activities should include a materials list, costs and a step-by-step guide to construction with photos. Learn what makes a good activity here.

<% end %> @@ -95,6 +101,22 @@ }); //setupGridSorters(".<%= className %>-<%= randomSeed %>"); Should order the items by time. Commented out because it reorders the items each time show more/less is clicked })() + +function gridLinkModal(selector, href) { + var current_user = $('ul.nav.navbar-nav.navbar-right').children('li:nth-of-type(2)').text().trim() !== "Login" + if(!current_user) { + + var anchor = $(selector).find('a[href="' + href + '"]'); + anchor.attr({ + 'href': '', + 'data-toggle': 'modal', + 'data-target': '#loginModal' + }); + anchor.on('click', function() { + $.getJSON(href); + }); + } +}