Skip to content

Commit

Permalink
Makes the user profile page simpler by dropping the "display xxx on y…
Browse files Browse the repository at this point in the history
…our site" option. We consider that if the user fills information in his profile, he actually wants to display them.

Issue publify#232.
  • Loading branch information
Frédéric de Villamil committed Sep 10, 2013
1 parent 506b397 commit e905d2c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 70 deletions.
11 changes: 5 additions & 6 deletions app/helpers/authors_helper.rb
@@ -1,11 +1,10 @@
module AuthorsHelper

def display_profile_item(item, show_item, item_desc)
if show_item
item = link_to(item, item) if is_url?(item)
content_tag :li do
"#{item_desc} #{item.html_safe}".html_safe
end
def display_profile_item(item, item_desc)
return unless item.present?
item = link_to(item, item) if is_url?(item)
content_tag :li do
"#{item_desc} #{item.html_safe}".html_safe
end
end

Expand Down
6 changes: 0 additions & 6 deletions app/models/user.rb
Expand Up @@ -33,12 +33,6 @@ class User < ActiveRecord::Base
setting :yahoo, :string, ''
setting :twitter, :string, ''
setting :jabber, :string, ''
setting :show_url, :boolean, false
setting :show_msn, :boolean, false
setting :show_aim, :boolean, false
setting :show_yahoo, :boolean, false
setting :show_twitter, :boolean, false
setting :show_jabber, :boolean, false
setting :admin_theme, :string, 'blue'
setting :twitter_account, :string, ''
setting :twitter_oauth_token, :string, ''
Expand Down
27 changes: 2 additions & 25 deletions app/views/admin/users/_form.html.erb
Expand Up @@ -149,64 +149,41 @@

<fieldset class='form-horizontal'>
<legend><%= _("Contact options")%></legend>
<div class='alert alert-info'><%= _("These information will be displayed on your %s", link_to(_("author page"), :controller => '/authors', :action => 'show', :id => current_user.login)) %></div>
<div class='control-group'>
<label class='control-label' for="user_url"><%= _("Your site")%></label>
<div class='controls'>
<%= text_field('user', 'url', {:class => 'span5'}) %>
<label class='checkbox' for='user_show_url'>
<%= check_box 'user', 'show_url' %>
<%= _("display URL on public profile") %>
</label>
</div>
</div>
</div>
<div class='control-group'>
<label class='control-label' for="user_msn"><%= _("Your MSN")%></label>
<div class='controls'>
<%= text_field('user', 'msn', {:class => 'span5'}) %>
<label class='checkbox' for='user_show_msn'>
<%= check_box 'user', 'show_msn' %>
<%= _("display MSN ID on public profile") %>
</label>
</div>
</div>
<div class='control-group'>
<label class='control-label' for="user_yahoo"><%= _("Your Yahoo ID")%></label>
<div class='controls'>
<%= text_field('user', 'yahoo', {:class => 'span5'}) %>
<label class='checkbox' for='user_show_yahoo'>
<%= _("display Yahoo! ID on public profile") %>
<%= check_box 'user', 'show_yahoo' %>
</label>
</div>
</div>
<div class='control-group'>
<label class='control-label' for="user_jabber"><%= _("Your Jabber ID")%></label>
<div class='controls'>
<%= text_field('user', 'jabber', {:class => 'span5'}) %>
<label class='checkbox' for='user_show_jabber'>
<%= check_box 'user', 'show_jabber' %>
<%= _("display Jabber ID on public profile") %>
</label>
</div>
</div>
<div class='control-group'>
<label class='control-label' for="user_aim"><%= _("Your AIM id")%></label>
<div class='controls'>
<%= text_field('user', 'aim', {:class => 'span5'}) %>
<label class='checkbox' for='user_show_aim'>
<%= check_box 'user', 'show_aim' %>
<%= _("display AIM ID on public profile") %>
</label>
</div>
</div>
<div class='control-group'>
<label class='control-label' for="user_twitter"><%= _("Your Twitter username")%></label>
<div class='controls'>
<%= text_field('user', 'twitter', {:class => 'span5'}) %>
<label class='checkbox' for='user_show_twitter'>
<%= check_box 'user', 'show_twitter' %>
<%= _("display Twitter on public profile") %>
</label>
</div>
</div>
<div class='control-group'>
Expand Down
12 changes: 6 additions & 6 deletions app/views/authors/show.html.erb
@@ -1,12 +1,12 @@
<div class="post">
<h2><%= @author.name %></h2>
<ul>
<%= display_profile_item @author.url, @author.show_url, _("Web site:") %>
<%= display_profile_item @author.msn, @author.show_msn, _("MSN:") %>
<%= display_profile_item @author.yahoo, @author.show_yahoo, _("Yahoo:") %>
<%= display_profile_item @author.jabber, @author.show_jabber, _("Jabber:") %>
<%= display_profile_item @author.aim, @author.show_aim, _("AIM:") %>
<%= display_profile_item @author.twitter, @author.show_twitter, _("Twitter:") %>
<%= display_profile_item @author.url, _("Web site:") %>
<%= display_profile_item @author.msn, _("MSN:") %>
<%= display_profile_item @author.yahoo, _("Yahoo:") %>
<%= display_profile_item @author.jabber, _("Jabber:") %>
<%= display_profile_item @author.aim, _("AIM:") %>
<%= display_profile_item @author.twitter, _("Twitter:") %>
</ul>

<h3><%= _("About %s", @author.name)%></h3>
Expand Down
24 changes: 0 additions & 24 deletions spec/models/configuration_spec.rb
Expand Up @@ -313,30 +313,6 @@
it 'Jabber is empty' do
@user.jabber.should == ''
end

it 'URL display in user profile is not enabled' do
@user.should_not be_show_url
end

it 'MSN display in user profile is not enabled' do
@user.should_not be_show_msn
end

it 'AIM display in user profile is not enabled' do
@user.should_not be_show_aim
end

it 'Yahoo ID display in user profile is not enabled' do
@user.should_not be_show_yahoo
end

it 'Twitter display in user profile is not enabled' do
@user.should_not be_show_twitter
end

it 'Jabber display in user profile is not enabled' do
@user.should_not be_show_jabber
end

it 'Admin theme should be blue' do
@user.admin_theme.should == 'blue'
Expand Down
6 changes: 3 additions & 3 deletions themes/bootstrap/views/articles/read.html.erb
Expand Up @@ -5,10 +5,10 @@
<%= render 'articles/meta', article: @article %>
<% if @article.user.twitter and @article.user.show_twitter %>
<h2 id='twitter'>
<% if @article.user.twitter %>
<div class='well'>
<%= _("If you liked this article you can %s", link_to(_("add me to Twitter"), "http://twitter.com/#{@article.user.twitter}"))%>
</h2>
</div>
<% end %>
<% if @article.allow_comments? or @article.published_comments.size > 0 -%>
Expand Down

0 comments on commit e905d2c

Please sign in to comment.