Skip to content

Commit

Permalink
11-5-12 yani fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ilankasan committed Nov 5, 2012
1 parent b79b3f9 commit 1ea4eda
Show file tree
Hide file tree
Showing 13 changed files with 96 additions and 54 deletions.
14 changes: 8 additions & 6 deletions app/controllers/activities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def validate_access
if(current_account == nil)
return
end

@activity = Activity.find_by_id(params[:id])
if(@activity == nil || !validate_user_access_to_activity(@activity,current_account.user))
render 'shared/access_denied'
Expand Down Expand Up @@ -465,11 +465,7 @@ def propose_date
@activity.update_tivit_user_propose_date(current_account.user,params["comment"], proposed_date)
@lastcomment = log_action_as_comment(@activity,params["comment"],"Proposed",current_account.user)

if(current_account.user != @activity.get_invited_by)
puts "--------------------------- sending email -----------------------------------"
EMAIL_QUEUE << {:email_type => "tivit_propose_new_date_email", :assigner => @activity.get_invited_by , :assignee => current_account.user,:comment =>params["comment"], :tivit =>@activity}

end

end

#redirect_to @activity.get_parent
Expand All @@ -478,6 +474,12 @@ def propose_date
format.js {}
puts "--------[change status to propose_date activities controller]------->> after responding to Ajax"
end

if(current_account.user != @activity.get_invited_by && params["propose_date"] != nil )
puts "--------------------------- sending email -----------------------------------"
EMAIL_QUEUE << {:email_type => "tivit_propose_new_date_email", :assigner => @activity.get_invited_by , :assignee => current_account.user,:comment =>params["comment"], :tivit =>@activity}
end
#redirect_to :back
end


Expand Down
19 changes: 18 additions & 1 deletion app/helpers/activities_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
module ActivitiesHelper


def get_tooltip_text (identifier)

tooltip = ""
case identifier
when "on-it button"
tooltip="Add this task to your task list and let the requestor know you can help.";
when "sorry button"
tooltip="Let the requestor know you cannot help and if you think someone else can do it let him know."
when "date icon"
tooltip="Edit date"
when "comment icon"
tooltip="see/hide comments"
end

return tooltip

end
# [07/08/2012] Yaniv: Return the task status line sting for the specific user
def get_task_status_line (task, user)

Expand Down Expand Up @@ -86,7 +103,7 @@ def get_task_status_line (task, user)
end


elsif ( TivitStatus.is_proposed_id?(owner_tivit_status) )
elsif ( TivitStatus.is_proposed?(owner_tivit_status) )
proposed_date = "no data was set"
if (task.get_owner_proposed_date == nil || task.get_owner_proposed_date == "")
proposed_date = "[no data was set]"
Expand Down
8 changes: 7 additions & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ def logo

# Return a title on a per-page basis.
def title
base_title = "tivity"
base_title = "tiviti"
if @title.nil?
base_title
else
"#{base_title} | #{@title}"
end
end

def get_number_of_new_requests

@new_tivit_requests = get_new_tivit_requests(current_account.user.get_id.to_s)
return @new_tivit_requests.size
end

# Check the client version used to access the application. No versioning distinction yet as it's really not needed at this point.
def client_browser_name

Expand Down
13 changes: 7 additions & 6 deletions app/models/activity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,9 @@ def update_tivit_user_status_i_am_done(user,comment)
end

def update_tivit_user_propose_date(user,comment,date)
puts "--->>> in update_tivit_user_propose_date id = "+self.id.to_s
change_user_status(user,TivitStatus.get_proposed_id,comment,date,Time.now().utc,nil)
self.change_status_id_to_in_progress if self.isCompleted?
# self.change_status_id_to_in_progress if self.isCompleted?
end

def is_not_started?
Expand Down Expand Up @@ -949,15 +950,15 @@ def change_user_status(user, status,comment, proposed_date, last_reviewed, assig
puts "changing status for "+user.get_name+" to "+status.to_s
tivit_user_status = self.tivit_user_statuses.find_by_user_id(user.id)
if(tivit_user_status == nil)
tivit_user_status = create_status(user,status)
tivit_user_status = create_status(user,status)
end

if(proposed_date != nil)
tivit_user_status.proposed_date = proposed_date
tivit_user_status.proposed_date = proposed_date
end

if(last_reviewed != nil)
tivit_user_status.last_reviewed = last_reviewed
if(last_reviewed != nil)
tivit_user_status.last_reviewed = last_reviewed
end

if(assigned_to != nil)
Expand All @@ -969,7 +970,7 @@ def change_user_status(user, status,comment, proposed_date, last_reviewed, assig
#tivit_user_status.comment = clean_comment(comment)
tivit_user_status.last_status_change = Time.now.utc
tivit_user_status.save()
return tivit_user_status.status_id
return tivit_user_status.status_id
end

def change_status(user, status,comment)
Expand Down
2 changes: 1 addition & 1 deletion app/models/tivit_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def self.get_proposed_id
return @proposed
end

def self.is_proposed_id?(id)
def self.is_proposed?(id)
return (id==@proposed)
end

Expand Down
27 changes: 21 additions & 6 deletions app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,25 @@

<ul class="nav-item">

<% if @title == "Dashboard" %>
<li><%= link_to "Dashboard", root_path, :class => "current" %></li>
<% new_request_count = get_number_of_new_requests %>
<% if @title == "Dashboard" %>

<li>
<%= link_to "Dashboard", root_path, :class => "current" %>
<% if (new_request_count > 0) %>
<i id="header_new_request_count"><%= new_request_count %></i>
<% end %>
</li>

<% else %>
<li><%= link_to "Dashboard", root_path %></li>
<li>
<%= link_to "Dashboard", root_path %>
<% if new_request_count > 0 %>
<i id="header_new_request_count"><%= new_request_count %></i>
<% end %>
</li>

<% end %>

<!-- <li><%= link_to "Activities", about_path %></li> -->
Expand All @@ -29,10 +44,10 @@
<% end %>
<% if @title == "How It Works" %>
<li><%= link_to "How It Works", help_path, :class => "current" %></li>
<% if @title == "How Does It Work" %>
<li><%= link_to "How Does It Work", help_path, :class => "current" %></li>
<% else %>
<li><%= link_to "How It Works", help_path %></li>
<li><%= link_to "How Does It Work", help_path %></li>
<% end %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/shared/_new_tivit_requests_db.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
-->
<div class="text">
<div class="activity">
<div class="on-it"></div>
<div class="on-it" title="<%= get_tooltip_text ( "on-it button" )%>"></div>
<!-- <a href="#" class="details-link">details &gt;</a>-->
<span class="btn-sorry">sorry...</span>
<span class="btn-sorry" title="<%= get_tooltip_text ( "sorry button" )%>">sorry...</span>

<%= link_to "details >", new_tivit_request, :action => "show",
:method => "get",
Expand Down
7 changes: 3 additions & 4 deletions app/views/shared/_task_db.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,17 @@

<% elsif ( (newRequest == "yes") && (taskContext == 'ADP') && (!my_task.is_completed?) ) %>

<div class="on-it"></div>
<span class="btn-sorry">sorry...</span>
<div class="on-it" title="<%= get_tooltip_text ( "on-it button" )%>"></div>
<span class="btn-sorry" title="<%= get_tooltip_text ( "sorry button" )%>">sorry...</span>

<% end %>
<% unread_comments = my_task.get_number_of_unread_comments(current_account.user)%>

<!-- Comments icon -->

</div>

<div class="comments">
<div class="comments" title="<%= get_tooltip_text ( "comment icon" )%>">
<% if unread_comments > 0 %>
<i><%=unread_comments%></i>
<% end %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/shared/_tivit_adp.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<li class="record complete tivit-name-line-through">
<% respondbutton = "I'm done!" %>
<% elsif TivitStatus.is_proposed_id?(owner_tivit_status)%>
<% elsif TivitStatus.is_proposed?(owner_tivit_status)%>

<li class="record attention">
<% respondbutton = "new date?" %>
Expand Down Expand Up @@ -317,7 +317,7 @@

<span class="grey">

<% if TivitStatus.is_proposed_id?(owner_tivit_status) %>
<% if TivitStatus.is_proposed?(owner_tivit_status) %>
<%= tivit_owner_name %>
<font color="red"><%= status_line_middle %></font>
<!-- only tivit creator and activity owner can accept new time proposed. The only exception is when activity owner request a new time for a tivit s/he got assigned -->
Expand Down
14 changes: 7 additions & 7 deletions app/views/shared/_tivit_date.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,38 @@
<%# if owner_tivit_status != TivitStatus.get_completed_id %>
<% if tivit.due != nil && tivit.isCompleted? %>
<div class="calendar past" style="<%= datestyle %>">
<div class="calendar past" style="<%= datestyle %>" title="<%= get_tooltip_text ( "date icon" )%>">
<div class="week"><%= tivit.due.localtime.strftime ("%^b") %></div>
<div class="text"><%= tivit.due.localtime.strftime ("%-d") %></div>
<% elsif tivit.due == nil %>
<!-- no date specified -->
<!-- the datestyle variable comes from the partial call as local variable since the date need to float on the right for activites tab on dashboard -->
<div class="calendar" style="<%= datestyle %>">
<div class="calendar" style="<%= datestyle %>" title="<%= get_tooltip_text ( "date icon" )%>">
<% elsif due_time_window == "overdue" %>
<!-- activity is overdue -->
<div class="calendar new" style="<%= datestyle %>">
<div class="calendar new" style="<%= datestyle %>" title="<%= get_tooltip_text ( "date icon" )%>">
<div class="week"><%= ((Time.now.end_of_day - tivit.due.localtime.end_of_day)/(3600*24)).to_i %></div>
<div class="text">days ago</div>

<% elsif due_time_window == "today" %>
<!-- activity due today -->
<div class="calendar today" style="<%= datestyle %>">
<div class="calendar today" style="<%= datestyle %>" title="<%= get_tooltip_text ( "date icon" )%>">
<div class="text">Today</div>

<% elsif due_time_window == "tomorrow" %>
<!-- activity due tomorrow -->
<div class="calendar tomorrow" style="<%= datestyle %>">
<div class="calendar tomorrow" style="<%= datestyle %>" title="<%= get_tooltip_text ( "date icon" )%>">
<div class="text">Tomorrow</div>

<% elsif due_time_window == "withinaweek" %>
<!-- activity due within a week -->
<div class="calendar past" style="<%= datestyle %>">
<div class="calendar past" style="<%= datestyle %>" title="<%= get_tooltip_text ( "date icon" )%>">
<div class="week"><%= (tivit.due.localtime.strftime ("%a")).upcase %></div>
<div class="text"><%= tivit.due.localtime.strftime ("%-d") %></div>

<% else %>
<!-- activity due within more than a week -->
<div class="calendar past" style="<%= datestyle %>">
<div class="calendar past" style="<%= datestyle %>" title="<%= get_tooltip_text ( "date icon" )%>">
<div class="week"><%= tivit.due.localtime.strftime ("%^b") %></div>
<div class="text"><%= tivit.due.localtime.strftime ("%-d") %></div>
<%end%>
Expand Down
4 changes: 2 additions & 2 deletions app/views/shared/_tivit_db.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<% status_line_middle = " finished this " + (time_ago_in_words (tivit.completed_at)) + " ago." %>
<% status_line_window = "" %>
<% elsif TivitStatus.is_proposed_id?(owner_tivit_status) %>
<% elsif TivitStatus.is_proposed?(owner_tivit_status) %>

<li class="record attention">
<% proposed_date = "no data was set"%>
Expand Down Expand Up @@ -239,7 +239,7 @@
<!-- all gray status lines -->
<span class="grey">

<% if TivitStatus.is_proposed_id?(owner_tivit_status)%>
<% if TivitStatus.is_proposed?(owner_tivit_status)%>
<%= tivit_owner_name %>
<font color="red"><%= status_line_middle %></font>

Expand Down
15 changes: 0 additions & 15 deletions public/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,5 @@ function changeBackground() {
{
myLayer.style.background="red";
}


}

$(document).ready(function(){
var $tabs = $("#tivit-container").tabs({ select: function(event, ui) {
$("#test-items").empty();
$("#completed-items").empty();
if($.data(ui.tab, 'load.tabs')) {
$(ui.panel).html("Loading...");
}

}
});
});


19 changes: 18 additions & 1 deletion public/stylesheets/tiviti-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@ html, body {
/*min-width: 0;
width: auto; */
}

.nav-item i {
position:absolute;
background:red;
padding:0 4px;
border:1px solid #c0c0c0;
border-radius:9px;
color:#fff;
font-size:8px;
text-align:center;
font-weight:bold;
font-style:normal;
line-height:12px;
top: 5px;
margin-left: 0px;
}

body {
font-family: Arial, 'Liberation Sans', FreeSans, sans-serif; /*Arial, Helvetica, Verdana, Sans-serif;*/
font-size: 12px;
Expand Down Expand Up @@ -209,7 +226,7 @@ a:visited {
}
/* Drop Down Menu **************************************************/
/* 1. Menu Button */
ul, li{margin:0; border:0; padding-left:0px; list-style:none;}
ul, li {margin:2; border:0; padding-left:2px; list-style:none;}

#user-nav{
color: white;
Expand Down

0 comments on commit 1ea4eda

Please sign in to comment.