diff --git a/app/views/bookmarks/_bookmark_blurb.html.erb b/app/views/bookmarks/_bookmark_blurb.html.erb index 8a35ee3da2..597b827c5d 100644 --- a/app/views/bookmarks/_bookmark_blurb.html.erb +++ b/app/views/bookmarks/_bookmark_blurb.html.erb @@ -4,7 +4,7 @@
  • <% if bookmarkable.blank? %> -

    <%= ts("This has been deleted, sorry!") %>

    +

    <%= t(".deleted") %>

    <% # Bookmarks of deleted items need a div because they can still be edited. %>
    <% else %> @@ -25,9 +25,9 @@ <% if logged_in? && !is_author_of?(bookmark) %>
  • <% if (current_user_bookmark ||= bookmark_if_exists(bookmarkable)) %> - <%= link_to ts("Saved"), edit_bookmark_path(current_user_bookmark), id: "bookmark_form_trigger_for_#{bookmark_form_id}", remote: true %> + <%= link_to t(".saved"), edit_bookmark_path(current_user_bookmark), data: { path: edit_bookmark_path(current_user_bookmark) }, class: "bookmark_form_trigger_for_#{bookmark_form_id}", remote: true %> <% else %> - <%= link_to ts("Save"), get_new_bookmark_path(bookmarkable), id: "bookmark_form_trigger_for_#{bookmark_form_id}", remote: true %> + <%= link_to t(".save"), get_new_bookmark_path(bookmarkable), class: "bookmark_form_trigger_for_#{bookmark_form_id}", remote: true %> <% end %>
  • <% end %> diff --git a/app/views/bookmarks/_bookmark_owner_navigation.html.erb b/app/views/bookmarks/_bookmark_owner_navigation.html.erb index b3bf21ef81..b674b37bb2 100644 --- a/app/views/bookmarks/_bookmark_owner_navigation.html.erb +++ b/app/views/bookmarks/_bookmark_owner_navigation.html.erb @@ -1,12 +1,12 @@ <% # expects "bookmark" %> <% bookmark_form_id = (bookmark.bookmarkable.blank? ? "#{bookmark.id}" : "#{bookmark.bookmarkable.id}") %> diff --git a/app/views/bookmarks/_bookmarkable_blurb.html.erb b/app/views/bookmarks/_bookmarkable_blurb.html.erb index 672f57e087..806126adfc 100644 --- a/app/views/bookmarks/_bookmarkable_blurb.html.erb +++ b/app/views/bookmarks/_bookmarkable_blurb.html.erb @@ -16,15 +16,9 @@ diff --git a/app/views/bookmarks/bookmark_form_dynamic.js.erb b/app/views/bookmarks/bookmark_form_dynamic.js.erb index c969550460..da09bea436 100644 --- a/app/views/bookmarks/bookmark_form_dynamic.js.erb +++ b/app/views/bookmarks/bookmark_form_dynamic.js.erb @@ -2,21 +2,19 @@ <% bookmark_form_id = (@bookmarkable.blank? ? "#{@bookmark.id}" : "#{@bookmarkable.id}") %> var bookmark_div = $j('#bookmark_form_placement_for_<%= bookmark_form_id %>'); -var bookmark_close = $j('#bookmark_form_close_for_<%= bookmark_form_id %>'); -var bookmark_open = $j('#bookmark_form_trigger_for_<%= bookmark_form_id %>'); -bookmark_div.html("<%= escape_javascript(render "bookmarks/bookmark_form", :bookmarkable => @bookmarkable, :bookmark => @bookmark, :button_name => @button_name, :action => @action, :in_page => true, :dynamic => true) %>"); -bookmark_open.hide(); +if (!bookmark_div.children().length) { bookmark_div.html("<%= escape_javascript(render "bookmarks/bookmark_form", :bookmarkable => @bookmarkable, :bookmark => @bookmark, :button_name => @button_name, :action => @action, :in_page => true, :dynamic => true) %>"); } +$j('.bookmark_form_trigger_for_<%= bookmark_form_id %>').hide(); -$j('#bookmark_form_close_for_<%= bookmark_form_id %>').click(function(){ - bookmark_div.hide(); - bookmark_open.show(); +$j('#bookmark_form_close_for_<%= bookmark_form_id %>').click(function(){ + $j('#bookmark_form_placement_for_<%= bookmark_form_id %>').hide(); + $j('.bookmark_form_trigger_for_<%= bookmark_form_id %>').show(); + $j('.bookmark_form_trigger_for_<%= bookmark_form_id %>').attr('href', j('.bookmark_form_trigger_for_<%= bookmark_form_id %>').attr("data-path")); }); // if canceled we don't want to generate the form a second time, just reopen it -bookmark_open.attr('href', '#'); -$j("#bookmark_form_trigger_for_<%= bookmark_form_id %>").click(function(event){ - bookmark_div.show(); - bookmark_open.hide(); +$j(".bookmark_form_trigger_for_<%= bookmark_form_id %>").click(function(event){ + $j('#bookmark_form_placement_for_<%= bookmark_form_id %>').show(); + $j('.bookmark_form_trigger_for_<%= bookmark_form_id %>').hide(); event.preventDefault(); -}); +}); \ No newline at end of file diff --git a/app/views/bookmarks/index.html.erb b/app/views/bookmarks/index.html.erb index baeb832202..7293d1419f 100755 --- a/app/views/bookmarks/index.html.erb +++ b/app/views/bookmarks/index.html.erb @@ -14,23 +14,23 @@ <% if current_user.is_a?(User) || @tag || @facets.present? %>