in the getting started featured tags are now followable

This commit is contained in:
Ilya Zhitomirskiy 2011-09-23 17:06:21 -07:00
parent 494ab8b13b
commit 461cb22109
8 changed files with 55 additions and 25 deletions

View file

@ -16,6 +16,7 @@ class ApplicationController < ActionController::Base
inflection_method :grammatical_gender => :gender
helper_method :all_aspects, :all_contacts_count, :my_contacts_count, :only_sharing_count
helper_method :tags, :tag_followings
def ensure_http_referer_is_set
request.env['HTTP_REFERER'] ||= '/aspects'
@ -117,4 +118,18 @@ class ApplicationController < ActionController::Base
def after_sign_in_path_for(resource)
stored_location_for(:user) || (current_user.getting_started? ? getting_started_path : aspects_path)
end
def tag_followings
if current_user
if @tag_followings == nil
@tag_followings = current_user.tag_followings
end
@tag_followings
end
end
def tags
@tags ||= current_user.followed_tags
end
end

View file

@ -12,7 +12,6 @@ class AspectsController < ApplicationController
respond_to :html, :js
respond_to :json, :only => [:show, :create]
helper_method :tags, :tag_followings
helper_method :selected_people
def index
@ -138,19 +137,6 @@ class AspectsController < ApplicationController
params[:max_time] ||= Time.now + 1
end
def tag_followings
if current_user
if @tag_followings == nil
@tag_followings = current_user.tag_followings
end
@tag_followings
end
end
def tags
@tags ||= current_user.followed_tags
end
private
def save_sort_order
if params[:sort_order].present?

View file

@ -19,7 +19,7 @@ class TagFollowingsController < ApplicationController
flash[:error] = I18n.t('tag_followings.create.failure', :name => params[:name])
end
redirect_to tag_path(:name => params[:name])
redirect_to :back
end
# DELETE /tag_followings/1

View file

@ -48,4 +48,16 @@ module GettingStartedHelper
t('users.getting_started.welcome')
end
end
def tag_link(tag_name)
if tag_followed?(tag_name)
link_to "##{tag_name}", tag_followings_path(tag_name), :method => :delete, :class => "featured_tag followed"
else
link_to "##{tag_name}", tag_tag_followings_path(tag_name), :method => :post, :class => "featured_tag"
end
end
def tag_followed?(tag_name)
tags.detect{|t| t.name == tag_name}
end
end

View file

@ -9,8 +9,8 @@
= t('aspects.index.tags_following')
%ul.sub_nav
- if current_user.followed_tags.size > 0
- for tg in current_user.followed_tags
- if tags.size > 0
- for tg in tags
%li.unfollow{:id => tg.name}
.unfollow_icon.hidden
= link_to image_tag("icons/monotone_close_exit_delete.png", :height => 16, :title => t('aspects.index.unfollow_tag', :tag => tg.name)), tag_tag_followings_path(:name => tg.name, :remote => true), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :id => "unfollow_" + tg.name

View file

@ -139,13 +139,9 @@
%h4{:style => "margin-top:7px;"}
= t('.featured_tags')
%p
= link_to "#diaspora", tag_path('diaspora'), :target => "_blank"
- ["diaspora", "art", "gif", "french"].each do |tag_name|
= tag_link(tag_name)
%br
= link_to "#art", tag_path('art'), :target => "_blank"
%br
= link_to "#gif", tag_path('gif'), :target => "_blank"
%br
= link_to "#french", tag_path('french'), :target => "_blank"
.clearfix
%br
%br

View file

@ -871,7 +871,7 @@ en:
connect_to: "Connect to"
find_friends_from_facebook: "find friends from Facebook"
featured_tags: "Featured tags"
featured_tags: "Follow featured tags"
find_friends: "Find friends"
see_all_featured_users: "See all featured users"
get_updates_from_core: "Get updates about the project from the core team."

View file

@ -3296,6 +3296,27 @@ ul#getting_started
:background
:image url('/images/icons/check_yes_ok.png') !important
.featured_tag
:background
//:image url('/images/icons/check_yes_ok.png')
:position center left
:repeat no-repeat
:display none
:padding
:left 20px
&.followed
:background
:image url('/images/icons/check_yes_ok.png')
&:hover,
:background
:image url('/images/icons/check_yes_ok_lighter.png')
#featured_users_pane
:padding 10px 0