@@ -195,6 +195,18 @@ |
||
195 | 195 |
line-height: 19px; |
196 | 196 |
} |
197 | 197 |
|
198 |
+.reward-subtext { |
|
199 |
+ font-family: Helvetica-LightOblique; |
|
200 |
+ font-size: 14px; |
|
201 |
+ color: #1D1D26; |
|
202 |
+ line-height: 17px; |
|
203 |
+ margin-top: 30px; |
|
204 |
+} |
|
205 |
+ |
|
206 |
+.rewards-details.reward-subtext { |
|
207 |
+ min-height: 20px; |
|
208 |
+} |
|
209 |
+ |
|
198 | 210 |
.reward-agent-role { |
199 | 211 |
/* Agentes: Designer de: */ |
200 | 212 |
font-family: Avenir-Light; |
@@ -1,6 +1,6 @@ |
||
1 | 1 |
class AgentsController < ApplicationController |
2 | 2 |
|
3 |
- before_action :set_agent_dashboard, only: [:dashboard, :rewards] |
|
3 |
+ before_action :set_agent_dashboard, only: [:dashboard, :rewards, :received_reward, :not_received_reward] |
|
4 | 4 |
|
5 | 5 |
def dashboard |
6 | 6 |
end |
@@ -14,6 +14,27 @@ class AgentsController < ApplicationController |
||
14 | 14 |
end |
15 | 15 |
|
16 | 16 |
def rewards |
17 |
+ if params[:view] == nil || params[:view] == 'recent' |
|
18 |
+ @current_rewards = UserReward.where(user: current_user).where(received: nil) |
|
19 |
+ elsif params[:view] == 'all' |
|
20 |
+ @current_rewards = UserReward.where(user: current_user) |
|
21 |
+ elsif params[:view] == 'received' |
|
22 |
+ @current_rewards = UserReward.where(user: current_user).where(received: true) |
|
23 |
+ elsif params[:view] == 'not_received' |
|
24 |
+ @current_rewards = UserReward.where(user: current_user).where(received: false) |
|
25 |
+ end |
|
26 |
+ end |
|
27 |
+ |
|
28 |
+ def received_reward |
|
29 |
+ user_reward = UserReward.find(params[:id]) |
|
30 |
+ user_reward.update(received: true, date_received: Time.now) |
|
31 |
+ redirect_to(user_rewards_path(view: 'received'), notice: (t 'reward.marked_as_received')) |
|
32 |
+ end |
|
33 |
+ |
|
34 |
+ def not_received_reward |
|
35 |
+ user_reward = UserReward.find(params[:id]) |
|
36 |
+ user_reward.update(received: false, date_received: Time.now) |
|
37 |
+ redirect_to(user_rewards_path(view: 'not_received'), notice: (t 'reward.marked_as_not_received')) |
|
17 | 38 |
end |
18 | 39 |
|
19 | 40 |
private |
@@ -47,7 +47,6 @@ |
||
47 | 47 |
<% end %> |
48 | 48 |
<%= content_tag(:p, (t 'agent.points')) %> |
49 | 49 |
<% end %> |
50 |
- <%= bootstrap_flash %> |
|
51 | 50 |
<% end %> |
52 | 51 |
<% content_tag(:div, class: 'span4 trust-stat') do %> |
53 | 52 |
<div class="progress-bar"> |
@@ -1,13 +1,23 @@ |
||
1 | 1 |
<% # Tabs %> |
2 | 2 |
<%= content_tag(:div, class: 'container container-tabs') do %> |
3 | 3 |
<%= content_tag(:div, class: 'row') do %> |
4 |
- <%= content_tag(:div, class: 'span12') do %> |
|
4 |
+ <%= content_tag(:div, class: 'span8') do %> |
|
5 | 5 |
<%= content_tag(:ul, class: 'nav nav-tabs') do %> |
6 | 6 |
<%= content_tag(:li, (link_to (t 'mission.missions'), dashboard_path), class: ('active' if params[:action] == 'dashboard' )) %> |
7 |
- <%= content_tag(:li, (link_to (t 'mission.rewards'), user_rewards_path), class: ('active' if params[:action] == 'rewards' )) %> |
|
7 |
+ <%= content_tag(:li, (link_to (t 'mission.rewards'), user_rewards_path(view: 'recent')), class: ('active' if params[:action] == 'rewards' )) %> |
|
8 | 8 |
<%= content_tag(:li, (link_to (t 'agent.tasks'), '#'), class: 'disabled') %> |
9 | 9 |
<%= content_tag(:li, (link_to (t 'agent.messages'), '#'), class: 'disabled') %> |
10 | 10 |
<% end %> |
11 | 11 |
<% end %> |
12 |
+ <% if params[:action] == 'rewards' %> |
|
13 |
+ <%= content_tag(:div, class: 'span4') do %> |
|
14 |
+ <%= content_tag(:ul, class: 'nav nav-pills pull-right') do %> |
|
15 |
+ <%= content_tag(:li, (link_to (t 'nav.recent'), user_rewards_path(view: 'recent')), class: ('active' if params[:view] == 'recent' )) %> |
|
16 |
+ <%= content_tag(:li, (link_to (t 'nav.all'), user_rewards_path(view: 'all')), class: ('active' if params[:view] == 'all' )) %> |
|
17 |
+ <%= content_tag(:li, (link_to (t 'rewards.received'), user_rewards_path(view: 'received')), class: ('active' if params[:view] == 'received' )) %> |
|
18 |
+ <%= content_tag(:li, (link_to (t 'rewards.not_received'), user_rewards_path(view: 'not_received')), class: ('active' if params[:view] == 'not_received' )) %> |
|
19 |
+ <% end %> |
|
20 |
+ <% end %> |
|
21 |
+ <% end %> |
|
12 | 22 |
<% end %> |
13 | 23 |
<% end %> |
@@ -20,6 +20,7 @@ |
||
20 | 20 |
<%= content_tag(:div, class: 'container') do %> |
21 | 21 |
<%= content_tag(:div, class: 'row') do %> |
22 | 22 |
<%= content_tag(:div, class: 'span12') do %> |
23 |
+ <%= bootstrap_flash %> |
|
23 | 24 |
<%= content_tag(:ul, class: 'thumbnails mission-list') do %> |
24 | 25 |
<% @agent_missions.each do |agent| %> |
25 | 26 |
|
@@ -10,6 +10,7 @@ |
||
10 | 10 |
<% end %> |
11 | 11 |
<% # User Stats %> |
12 | 12 |
<%= render :partial => 'dashboard_stats', locals: {agent_missions: @agent_missions, rewards: @rewards} %> |
13 |
+ <%= bootstrap_flash %> |
|
13 | 14 |
<% end %> |
14 | 15 |
<% end %> |
15 | 16 |
|
@@ -17,11 +18,14 @@ |
||
17 | 18 |
|
18 | 19 |
<% # Content%> |
19 | 20 |
<%= content_tag(:div, class: 'container') do %> |
20 |
- <% content_tag(:div, class: 'row') do %> |
|
21 |
+ |
|
22 |
+ <%= content_tag(:div, class: 'row') do %> |
|
21 | 23 |
<%= content_tag(:ul, class: 'rewards thumbnails mission-list') do %> |
22 |
- <% @rewards.each do |user_reward| %> |
|
23 |
- <%= content_tag(:div, class: 'span4') do %> |
|
24 |
- <%= render :partial => 'missions/reward', locals: {reward: user_reward.reward, dashboard: true } %> |
|
24 |
+ <% if @current_rewards != nil %> |
|
25 |
+ <% @current_rewards.each do |user_reward| %> |
|
26 |
+ <%= content_tag(:div, class: 'span4') do %> |
|
27 |
+ <%= render :partial => 'missions/reward', locals: {reward: user_reward.reward, dashboard: true, user_reward: user_reward } %> |
|
28 |
+ <% end %> |
|
25 | 29 |
<% end %> |
26 | 30 |
<% end %> |
27 | 31 |
<% end %> |
@@ -18,9 +18,16 @@ |
||
18 | 18 |
<% end %> |
19 | 19 |
<% end %> |
20 | 20 |
<% else %> |
21 |
- <%= content_tag(:p, class: 'rewards-details centered') do %> |
|
22 |
- <%= link_to (t 'reward.received'), '#', class: 'btn btn-success' %> |
|
23 |
- <%= link_to (t 'reward.not_receveid'), '#', class: 'btn btn-danger' %> |
|
21 |
+ <% if user_reward.received == nil %> |
|
22 |
+ <%= content_tag(:p, class: 'rewards-details centered') do %> |
|
23 |
+ <%= link_to (t 'reward.received'), received_reward_path(id: user_reward.id), class: 'btn btn-success' %> |
|
24 |
+ <%= link_to (t 'reward.not_received'), not_received_reward_path(id: user_reward.id), class: 'btn btn-danger' %> |
|
25 |
+ <% end %> |
|
26 |
+ <% else %> |
|
27 |
+ <%= content_tag(:p, class: 'rewards-details reward-subtext') do %> |
|
28 |
+ <%= content_tag(:span, ((t 'reward.marked_as_received') + ' - ' + distance_of_time_in_words(Time.now, user_reward.date_received)), class: 'pull-left')%> |
|
29 |
+ |
|
30 |
+ <% end %> |
|
24 | 31 |
<% end %> |
25 | 32 |
<% end %> |
26 | 33 |
<% end %> |
@@ -36,10 +36,14 @@ Avalanche2::Application.routes.draw do |
||
36 | 36 |
|
37 | 37 |
# Agents |
38 | 38 |
get 'dashboard' => 'agents#dashboard', as: :dashboard |
39 |
- get 'dashboard/rewards' => 'agents#rewards', as: :user_rewards |
|
40 | 39 |
get 'agents' => 'agents#list', as: :agent_list |
41 | 40 |
get 'agent/:id' => 'agents#show', as: :show_agent |
42 | 41 |
|
42 |
+ # Rewards |
|
43 |
+ get 'dashboard/rewards' => 'agents#rewards', as: :user_rewards |
|
44 |
+ get 'dashboard/rewards/:id/received' => 'agents#received_reward', as: :received_reward |
|
45 |
+ get 'dashboard/rewards/:id/not_received' => 'agents#not_received_reward', as: :not_received_reward |
|
46 |
+ |
|
43 | 47 |
# Steps |
44 | 48 |
post 'missions/:id/agents/:agent/steps/:step/step_submission' => 'missions#step_submission', as: :step_submission |
45 | 49 |
|