diff --git a/app/assets/javascripts/application/learning_objects.coffee b/app/assets/javascripts/application/learning_objects.coffee deleted file mode 100644 index 88903b52b03bd531978b5ec6244f164c4f0459f5..0000000000000000000000000000000000000000 --- a/app/assets/javascripts/application/learning_objects.coffee +++ /dev/null @@ -1,49 +0,0 @@ -$ -> - $('.default_btn').toggleClass 'active_btn' - $(document).on 'click', '*[data-poload]', -> - e = $(this) - e.popover({content: "Carregando..."}).popover('show') - all = undefined - objects = undefined - url = $(this).data('poload') - loid = $(this).data('loid') - $.get '/collections.json', (d) -> - all = d - $.get url, (d) -> - object = d - - # generate a lookup table for object's collections id - lookup = {} - i = 0 - len = object.length - while i < len - lookup[object[i].id] = object[i] - i++ - - # mark checked objects - i = 0 - len = all.length - html = '' - while i < len - name = 'collection_' + all[i].id.split(':').slice(-1)[0] - html += '<input type="checkbox" class="collection-element" data-cid="' + all[i].id + '" data-loid="' + loid + '" id="' + name + '" value="' + all[i].id + '"' - if lookup[all[i].id] != undefined - html += " checked" - html += '>' - html += '<label for="' + name + '">' + all[i].name + '</label><br/>' - ++i - - $('.popover-content').html(html) - return - return - return - -$ -> - $(document).on 'click', '.add_to_collection', (e) -> - $('.add_to_collection').removeClass 'active' - $('.add_to_collection').not(this).popover 'hide' - return -$ -> - $(document).on 'ajax:success', 'a.vote', (status, data, xhr) -> - $('.votes-count[data-id=\'' + data.id + '\']').text data.count - return diff --git a/app/assets/javascripts/application/learning_objects.coffee.erb b/app/assets/javascripts/application/learning_objects.coffee.erb index 20f241eb01d6f2286d00cbeb2112df8db2015044..994fc38c0e720f378f018e2847e96b883c1f362f 100644 --- a/app/assets/javascripts/application/learning_objects.coffee.erb +++ b/app/assets/javascripts/application/learning_objects.coffee.erb @@ -49,7 +49,8 @@ $ -> if $('.vote img').attr('alt') == 'Descurtir' $('.vote img').attr('src',"<%= image_path('icons/Curtir_01.png') %>") $('.vote img').attr('alt', 'Curtir') - else + else if $('.vote img').attr('alt') == 'Curtir' $('.vote img').attr('src',"<%= image_path('icons/Curtir_02.png') %>") $('.vote img').attr('alt', 'Descurtir') return + return diff --git a/app/views/learning_objects/show.html.erb b/app/views/learning_objects/show.html.erb index 07cf7741a65dd978dfccffbf7c136c8c89ff32bb..ecda9162d0e72d5a352ec5926c32e851f46303cd 100644 --- a/app/views/learning_objects/show.html.erb +++ b/app/views/learning_objects/show.html.erb @@ -22,7 +22,9 @@ like_learning_object_path(@learning_object.id_dspace), method: :post, remote: true %> <% end %> --> - +<% content_for(:body_attributes) do %> + data-no-turbolink="true" +<% end %> <div class="row learning-object"> <div class="col-md-7"> <div class="view">