Skip to content

Commit

Permalink
Home
Browse files Browse the repository at this point in the history
  • Loading branch information
atd committed Oct 4, 2010
1 parent aa0f8ae commit e91290f
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 2 deletions.
3 changes: 3 additions & 0 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class HomeController < ApplicationController
before_filter :authenticate_user!
end
4 changes: 2 additions & 2 deletions app/views/activities/_activity_options.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<span class="post_time_ago"><%= t('time.ago', :time => time_ago_in_words(activity.created_at)) %></span>

<ul class="activity_options">
<li><div class="verb_comment"><%= link_to t('activity.tocomment'), "", :class => "to_comment" %> </div></li>
<li><div class="verb_comment"><%= link_to t('activity.to_comment'), "", :class => "to_comment" %> </div></li>
<li><div class="verb_like" id="like_<%= dom_id(activity) %>"> <%= like_activity(activity)%></div></li>
<li><div class="verb_delete"><%= link_to t('activity.delete'), activity.direct_object , :confirm => t('activity.confirm'), :method => :delete, :remote => true %> </div></li>
<li><div class="verb_delete"><%= link_to t('activity.delete'), activity.direct_object , :confirm => t('activity.confirm_delete'), :method => :delete, :remote => true %> </div></li>
</ul>
</div>
51 changes: 51 additions & 0 deletions app/views/activities/_jquery.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//javascript for main activities input
$("#activities_share_btn").hide();
title = "<%= t('activity.input') %>";
$("#input_activities").click(function(){
if(this.value == title){
this.value="";
$("#activities_share_btn").show();
}
});
$("#input_activities").blur(function(){
if(this.value == ""){
this.value= title;
$("#activities_share_btn").hide();
}
});

//javascript for comments
$(".input_new_comments").val("<%= t('comment.input') %>");
$(".activities_comment_btn").hide();
$(".input_new_comments").livequery("click",function(){
if(this.value == "<%= t('comment.input') %>"){
$(this).val("");
}
$(".activities_comment_btn").hide();
$(this).parent(".new_comment").children(".activities_comment_btn").show();
});
$(".input_new_comments").livequery("blur",function(){
if(this.value == ""){
$(".activities_comment_btn").hide();
}
});
$(".comment").click(function(){
if(this.value == "<%= t('comment.input') %>"){
$(this).val("");
}
$(".activities_comment_btn").hide();
$(this).parent(".new_comment").children(".activities_comment_btn").show();
});


//javascript for tocomment option
$(".tocomment").livequery("click", function(){
// $(this).parents(".content_post").children(".content_sub_post").children(".coment_field").children(".new_comment").children(".input_new_comments").click();
$(this).parents(".content_post").find(".input_new_comments").click();
return false;
});
$(".tocomment").livequery("blur", function(){
//$(this).parents(".content_post").children(".content_sub_post").children(".coment_field").children(".new_comment").children(".input_new_comments").blur();
$(this).parents(".content_post").find(".input_new_comments").blur();
return false;
});
13 changes: 13 additions & 0 deletions app/views/activities/_new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div id="activities_header" class="content_size">
<%= form_for Post.new(:text => t('activity.input'),
:_activity_tie_id => current_tie.id),
:remote => true do |f| %>
<%= f.hidden_field :_activity_tie_id %>
<%= f.text_field :text, :id => "input_activities", :size => 85 %>
<div id="activities_share_btn">
<%= image_submit_tag "buttons/btn_security.png" %>
<%= image_submit_tag "buttons/btn_share.png" %>
</div>
<% end -%>
</div>

19 changes: 19 additions & 0 deletions app/views/home/_activities.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<%= content_for :head, stylesheet_link_tag("activities", :media => "screen, projection") %>
<%= content_for :javascript do %>
<%= render :partial => 'activities/jquery' %>
<% end -%>

<div id="wrapper_activities">
<div id="wrapper_activities_header">
<div id="activities_title" class="content_size">
<%= image_tag("buttons/btn_activities.png") %> <%=t('activity.other')%>
</div>

<%= render :partial => 'activities/new' %>
</div>
<div id="wall">
<% if current_user.wall.any? %>
<%= render current_user.wall %>
<% end %>
</div>
</div>
3 changes: 3 additions & 0 deletions app/views/home/_location.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div id="map_location" class="content_size">
<%= t('location.message', :location => "#{ image_tag('buttons/btn_home.png' , :class => 'btn_config') } #{ t('home.one') }: <span class=\"name_group\">#{ sanitize current_user.name }</span>").html_safe %>
</div>
4 changes: 4 additions & 0 deletions app/views/home/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<%= render :partial => 'home/location' %>
<%= render :partial => "home/activities" %>

17 changes: 17 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
en:
activity:
one: "Activity"
other: "Activities"
input: "What do you do?"
confirm_delete: "Delete activity?"
delete: "Delete"
to_comment: "Comment"
comment:
input: "Write a comment..."
home:
one: "Home"
location:
message: "You are here > %{location}"
time:
ago: "%{time} ago"

0 comments on commit e91290f

Please sign in to comment.