- <%= p.analysis %> -
-- <%= p.title %> -
-+ <%= p.title %> +
++ <%= p.analysis %> +
+- Topic: <%= p.topic.title %> -
-+ Topic: <%= p.topic.title %> +
+diff --git a/app/views/services/_form.html.erb b/app/views/services/_form.html.erb index d21503aa..0fc45dd5 100644 --- a/app/views/services/_form.html.erb +++ b/app/views/services/_form.html.erb @@ -4,7 +4,7 @@
+ <%= link_to "Website", service_path(@service.url) %> + <% if @service.wikipedia? %> + <%= link_to "Wikipedia", service_path(@service.wikipedia) %> + <% else %> + Wikipedia + <% end %> +
- + <%= javascript_tag do %> document.getElementById('orderByPoint').addEventListener("click", (event) => { - let elems = document.querySelectorAll(".card-point"); - // convert nodelist to array - var array = []; - for (var i = elems.length >>> 0; i--;) { - array[i] = elems[i]; - } - // perform sort depending on classname - if(event.currentTarget.className=="btn btn-success"){ - array.sort(function(a, b) { - return a.dataset.rating - b.dataset.rating; - }); - event.currentTarget.classList.remove("btn-success"); - event.currentTarget.classList.add("btn-danger"); - } - else if(event.currentTarget.className== "btn btn-danger"){ - array.sort(function(a, b) { - return b.dataset.rating - a.dataset.rating; - }); - event.currentTarget.classList.remove("btn-danger"); - event.currentTarget.classList.add("btn-success"); - } - // join the array back into HTML - var output = ""; - for (var i = 0; i < array.length; i++) { - output += array[i].outerHTML; - } - // append output to div 'points-table-container' - document.getElementById('points-table-container').innerHTML = output; - }); - <% end %> + let elems = document.querySelectorAll(".card-point"); + // convert nodelist to array + var array = []; + for (var i = elems.length >>> 0; i--;) { + array[i] = elems[i]; + } + // perform sort depending on classname + if(event.currentTarget.className=="btn btn-success"){ + array.sort(function(a, b) { + return a.dataset.rating - b.dataset.rating; +}); +event.currentTarget.classList.remove("btn-success"); +event.currentTarget.classList.add("btn-danger"); +} +else if(event.currentTarget.className== "btn btn-danger"){ +array.sort(function(a, b) { +return b.dataset.rating - a.dataset.rating; +}); +event.currentTarget.classList.remove("btn-danger"); +event.currentTarget.classList.add("btn-success"); +} +// join the array back into HTML +var output = ""; +for (var i = 0; i < array.length; i++) { +output += array[i].outerHTML; +} +// append output to div 'points-table-container' +document.getElementById('points-table-container').innerHTML = output; +}); +<% end %> <% if current_user %> - <% if current_user.curator? %> - <%= link_to 'Edit Service', edit_service_path, class: 'btn btn-primary' %> - <%= link_to 'Delete Service', @service, method: :delete, class: 'btn btn-danger' %> - <% end %> +<% if current_user.curator? %> +<%= link_to 'Edit Service', edit_service_path, class: 'btn btn-primary' %> +<%= link_to 'Delete Service', @service, method: :delete, class: 'btn btn-danger' %> +<% end %> -
+- <%= p.analysis %> -
-+ <%= p.analysis %> +
+- Topic: <%= p.topic.title %> -
-+ Topic: <%= p.topic.title %> +
+