diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index e45a792f3..cf2758b78 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -94,7 +94,6 @@ var initialize_modules = function() { App.LegislationAnnotatable.initialize(); App.WatchFormChanges.initialize(); App.TreeNavigator.initialize(); - App.Followable.initialize(); }; $(function(){ diff --git a/app/assets/javascripts/followable.js.coffee b/app/assets/javascripts/followable.js.coffee index 69ea61bac..762dfc041 100644 --- a/app/assets/javascripts/followable.js.coffee +++ b/app/assets/javascripts/followable.js.coffee @@ -1,9 +1,5 @@ App.Followable = - initialize: -> - $('.followable-content a[data-toggle]').on 'click', (event) -> - event.preventDefault() - update: (followable_id, button) -> $("#" + followable_id + " .js-follow").html(button) # Temporary line. Waiting for issue resolution: https://github.com/consul/consul/issues/1736 diff --git a/app/helpers/followables_helper.rb b/app/helpers/followables_helper.rb index 974270b0a..b1e1e83d3 100644 --- a/app/helpers/followables_helper.rb +++ b/app/helpers/followables_helper.rb @@ -8,17 +8,8 @@ module FollowablesHelper current_user && followed?(followable) end - def entity_title(title) - t("activerecord.models.#{title.underscore}.other") - end - - def followable_full_name(followable) - followable.class.name.parameterize - end - - def followable_title(followable) - entity = followable.class.name.underscore - t('shared.followable_title', entity: t("activerecord.models.#{entity}.one").downcase) + def followable_type_title(followable_type) + t("activerecord.models.#{followable_type.underscore}.other") end def followable_icon(followable) diff --git a/app/helpers/follows_helper.rb b/app/helpers/follows_helper.rb index c10fba678..b3426df12 100644 --- a/app/helpers/follows_helper.rb +++ b/app/helpers/follows_helper.rb @@ -10,32 +10,4 @@ module FollowsHelper t('shared.unfollow_entity', entity: t("activerecord.models.#{entity}.one").downcase) end - def follow_link_wrapper_id(followable) - "follow-expand-#{followable_full_name(followable)}-#{followable.id}" - end - - def unfollow_link_wrapper_id(followable) - "unfollow-expand-#{followable_full_name(followable)}-#{followable.id}" - end - - def follow_link_id(followable) - "follow-#{followable_full_name(followable)}-#{followable.id}" - end - - def unfollow_link_id(followable) - "unfollow-#{followable_full_name(followable)}-#{followable.id}" - end - - def follow_drop_id(followable) - "follow-drop-#{followable_full_name(followable)}-#{followable.id}" - end - - def unfollow_drop_id(followable) - "unfollow-drop-#{followable_full_name(followable)}-#{followable.id}" - end - - def entity_title(title) - t("activerecord.models.#{title.underscore}.other") - end - end diff --git a/app/views/follows/_followable_button.html.erb b/app/views/follows/_followable_button.html.erb index 7fc7a6ead..e96f1e179 100644 --- a/app/views/follows/_followable_button.html.erb +++ b/app/views/follows/_followable_button.html.erb @@ -3,41 +3,23 @@ <% if show_follow_action? followable %> - <%= link_to "##{follow_link_wrapper_id(followable)}", - id: follow_link_wrapper_id(followable), + <%= link_to t('shared.follow'), + follows_path(followable_id: followable.id, + followable_type: followable.class.name), + method: :post, remote: true, title: follow_text(followable), - data: { toggle: follow_drop_id(followable) }, - class: 'button hollow' do %> - <%= t('shared.follow') %> - <% end %> -