Added icon to directly unfollow a tag to listing of followed tags.
This commit is contained in:
parent
aac72b12e7
commit
2a970145c8
8 changed files with 45 additions and 6 deletions
|
|
@ -22,11 +22,23 @@ class TagFollowingsController < ApplicationController
|
||||||
@tag = ActsAsTaggableOn::Tag.find_by_name(params[:name])
|
@tag = ActsAsTaggableOn::Tag.find_by_name(params[:name])
|
||||||
@tag_following = current_user.tag_followings.where(:tag_id => @tag.id).first
|
@tag_following = current_user.tag_followings.where(:tag_id => @tag.id).first
|
||||||
if @tag_following && @tag_following.destroy
|
if @tag_following && @tag_following.destroy
|
||||||
flash[:notice] = I18n.t('tag_followings.destroy.success', :name => params[:name])
|
@tag_unfollowed = true
|
||||||
else
|
else
|
||||||
flash[:error] = I18n.t('tag_followings.destroy.failure', :name => params[:name])
|
@tag_unfollowed = false
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to tag_path(:name => params[:name])
|
if params[:remote]
|
||||||
|
respond_to do |format|
|
||||||
|
format.all{}
|
||||||
|
format.js{ render 'tags/update' }
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if @tag_unfollowed
|
||||||
|
flash[:notice] = I18n.t('tag_followings.destroy.success', :name => params[:name])
|
||||||
|
else
|
||||||
|
flash[:error] = I18n.t('tag_followings.destroy.failure', :name => params[:name])
|
||||||
|
end
|
||||||
|
redirect_to tag_path(:name => params[:name])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
.section
|
.section
|
||||||
= render 'aspects/aspect_listings'
|
= render 'aspects/aspect_listings'
|
||||||
|
|
||||||
.section
|
.section#followed_tags_listing
|
||||||
= render 'tags/followed_tags_listings'
|
= render 'tags/followed_tags_listings'
|
||||||
|
|
||||||
.span-13.append-1
|
.span-13.append-1
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,9 @@
|
||||||
%ul.sub_nav
|
%ul.sub_nav
|
||||||
- if current_user.followed_tags.size > 0
|
- if current_user.followed_tags.size > 0
|
||||||
- for tg in current_user.followed_tags
|
- for tg in current_user.followed_tags
|
||||||
%li
|
%li.unfollow{:id => tg.name}
|
||||||
|
.unfollow_icon.hidden
|
||||||
|
= link_to image_tag("icons/monotone_close_exit_delete.png", :height => 12), tag_tag_followings_path(:name => tg.name, :remote => true), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :id => "unfollow_" + tg.name
|
||||||
=link_to "##{tg.name}", tag_path(:name => tg.name), :class => "tag_selector"
|
=link_to "##{tg.name}", tag_path(:name => tg.name), :class => "tag_selector"
|
||||||
- else
|
- else
|
||||||
%li
|
%li
|
||||||
|
|
|
||||||
1
app/views/tags/update.js.erb
Normal file
1
app/views/tags/update.js.erb
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
$("#followed_tags_listing").first().html("<%= escape_javascript(render('tags/followed_tags_listings')) =%>");
|
||||||
|
|
@ -70,6 +70,7 @@ javascripts:
|
||||||
- public/javascripts/publisher.js
|
- public/javascripts/publisher.js
|
||||||
- public/javascripts/aspect-filters.js
|
- public/javascripts/aspect-filters.js
|
||||||
- public/javascripts/aspect-edit-pane.js
|
- public/javascripts/aspect-edit-pane.js
|
||||||
|
- public/javascripts/tag-followings.js
|
||||||
- public/javascripts/fileuploader-custom.js
|
- public/javascripts/fileuploader-custom.js
|
||||||
people:
|
people:
|
||||||
- public/javascripts/vendor/jquery.autoSuggest.custom.js
|
- public/javascripts/vendor/jquery.autoSuggest.custom.js
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,7 @@ en:
|
||||||
your_aspects: "Your Aspects"
|
your_aspects: "Your Aspects"
|
||||||
tags_following: "Followed Tags"
|
tags_following: "Followed Tags"
|
||||||
no_tags: "+ Find a tag to follow"
|
no_tags: "+ Find a tag to follow"
|
||||||
|
unfollow_tag: "Stop following #%{tag}"
|
||||||
handle_explanation: "This is your diaspora id. Like an email address, you can give this to people to reach you."
|
handle_explanation: "This is your diaspora id. Like an email address, you can give this to people to reach you."
|
||||||
no_contacts: "No contacts"
|
no_contacts: "No contacts"
|
||||||
post_a_message: "post a message >>"
|
post_a_message: "post a message >>"
|
||||||
|
|
|
||||||
18
public/javascripts/tag-followings.js
Normal file
18
public/javascripts/tag-followings.js
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
/* Copyright (c) 2011, Diaspora Inc. This file is
|
||||||
|
* licensed under the Affero General Public License version 3 or later. See
|
||||||
|
* the COPYRIGHT file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var TagFollowings = {
|
||||||
|
initialize: function(){
|
||||||
|
$('.unfollow').live('mouseover', function(){
|
||||||
|
$(this).find('.unfollow_icon').removeClass('hidden');
|
||||||
|
}).live('mouseout', function(){
|
||||||
|
$(this).find('.unfollow_icon').addClass('hidden');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
TagFollowings.initialize();
|
||||||
|
});
|
||||||
|
|
@ -2902,9 +2902,13 @@ ul.left_nav
|
||||||
:color #666
|
:color #666
|
||||||
|
|
||||||
.contact_count,
|
.contact_count,
|
||||||
.edit
|
.edit,
|
||||||
|
.unfollow_icon
|
||||||
:float right
|
:float right
|
||||||
|
|
||||||
|
.unfollow_icon
|
||||||
|
:margin-top 4px
|
||||||
|
|
||||||
.edit
|
.edit
|
||||||
:margin-top 4px
|
:margin-top 4px
|
||||||
:display none
|
:display none
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue