@@ -25,7 +25,6 @@ html, body { |
||
25 | 25 |
.container-bg { |
26 | 26 |
background-color: @bg-ligh-gray; |
27 | 27 |
margin-top: 0px; |
28 |
- min-height: 500px; |
|
29 | 28 |
padding-bottom: 20px; |
30 | 29 |
} |
31 | 30 |
|
@@ -157,6 +156,18 @@ h4 { |
||
157 | 156 |
color: black; |
158 | 157 |
} |
159 | 158 |
|
159 |
+.thumbnail h2 { |
|
160 |
+ font-family: Avenir-HeavyOblique; |
|
161 |
+ font-size: 28px; |
|
162 |
+ color: #000000; |
|
163 |
+ line-height: 44px; |
|
164 |
+ margin-top: 0px; |
|
165 |
+} |
|
166 |
+ |
|
167 |
+.thumbnail h2 a, .box h2 a { |
|
168 |
+ color: black; |
|
169 |
+} |
|
170 |
+ |
|
160 | 171 |
.thumbnail-content h4 { |
161 | 172 |
font-family: Avenir-MediumOblique; |
162 | 173 |
font-size: 18px; |
@@ -180,7 +191,7 @@ h4 { |
||
180 | 191 |
} |
181 | 192 |
|
182 | 193 |
.thumbnail .thumbnail-content { |
183 |
- padding: 4px; |
|
194 |
+ padding: 8px; |
|
184 | 195 |
} |
185 | 196 |
|
186 | 197 |
.thumbnail-line-top { |
@@ -0,0 +1,89 @@ |
||
1 |
+// Dashboard Stylesheet |
|
2 |
+//------------------------------------ |
|
3 |
+ |
|
4 |
+@import "colors.less"; |
|
5 |
+ |
|
6 |
+.dashboard-stats { |
|
7 |
+ float: left; |
|
8 |
+ text-align: center; |
|
9 |
+ width: 18%; |
|
10 |
+ margin-right: 3%; |
|
11 |
+} |
|
12 |
+ |
|
13 |
+.dashboard-stats:nth-child(1) { |
|
14 |
+ margin-left:-4%; |
|
15 |
+ margin-right: 2%; |
|
16 |
+ |
|
17 |
+} |
|
18 |
+.dashboard-stats:nth-child(3) { |
|
19 |
+ margin-right: 4%; |
|
20 |
+} |
|
21 |
+ |
|
22 |
+.dashboard-stats:nth-child(5) { |
|
23 |
+ margin-left: 2%; |
|
24 |
+ margin-right: 0%; |
|
25 |
+} |
|
26 |
+ |
|
27 |
+.dashboard-stats p:nth-child(1) { |
|
28 |
+ font-family: Avenir-Black; |
|
29 |
+ font-size: 42.9px; |
|
30 |
+ color: #0F2105; |
|
31 |
+ line-height: 59px; |
|
32 |
+ margin-bottom: 0px; |
|
33 |
+} |
|
34 |
+ |
|
35 |
+.dashboard-stats p:nth-child(2) { |
|
36 |
+ font-family: Helvetica-LightOblique; |
|
37 |
+ font-size: 14px; |
|
38 |
+ color: #1D1D26; |
|
39 |
+ line-height: 17px; |
|
40 |
+} |
|
41 |
+ |
|
42 |
+.trust-stat .progress-bar { |
|
43 |
+ text-align: center; |
|
44 |
+ width: 100%; |
|
45 |
+ margin-left: auto; |
|
46 |
+ margin-right: auto; |
|
47 |
+ margin-top: 10px; |
|
48 |
+} |
|
49 |
+ |
|
50 |
+.trust-stat p { |
|
51 |
+ text-align: center; |
|
52 |
+ font-family: Helvetica-LightOblique; |
|
53 |
+ font-size: 14px; |
|
54 |
+ color: #1D1D26; |
|
55 |
+ line-height: 17px; |
|
56 |
+ margin-top: 14px; |
|
57 |
+} |
|
58 |
+ |
|
59 |
+.thumbnail-content .dashboard-role { |
|
60 |
+ font-family: Avenir-HeavyOblique; |
|
61 |
+ font-size: 18px; |
|
62 |
+ color: #000000; |
|
63 |
+ line-height: 25px; |
|
64 |
+ text-align: left; |
|
65 |
+ margin-bottom: 0px; |
|
66 |
+ font-weight: 200; |
|
67 |
+} |
|
68 |
+ |
|
69 |
+.mission-agent-percentage { |
|
70 |
+ text-align: center; |
|
71 |
+ font-family: Helvetica-LightOblique; |
|
72 |
+ font-size: 14px; |
|
73 |
+ color: #1D1D26; |
|
74 |
+ line-height: 17px; |
|
75 |
+ margin-top: 20px; |
|
76 |
+ margin-bottom: 12px; |
|
77 |
+} |
|
78 |
+ |
|
79 |
+.mission-agent-percentage .progress { |
|
80 |
+ background-color: @bg-ligh-gray; |
|
81 |
+} |
|
82 |
+ |
|
83 |
+.mission-status-timer { |
|
84 |
+ height: 32px; |
|
85 |
+} |
|
86 |
+ |
|
87 |
+.thumbnail-content .dashboard-role:nth-child(1){ |
|
88 |
+ margin-top: 2px; |
|
89 |
+} |
@@ -2,6 +2,10 @@ |
||
2 | 2 |
//------------------------------------ |
3 | 3 |
|
4 | 4 |
|
5 |
+.mission-detail-container { |
|
6 |
+ min-height: 500px; |
|
7 |
+} |
|
8 |
+ |
|
5 | 9 |
// Mission Status |
6 | 10 |
|
7 | 11 |
@import "colors.less"; |
@@ -290,3 +294,23 @@ p.agent-stats i { |
||
290 | 294 |
font-size: 30px; |
291 | 295 |
padding-right: 10px; |
292 | 296 |
} |
297 |
+ |
|
298 |
+// Mission time left |
|
299 |
+ |
|
300 |
+.mission-time-left div:nth-child(1) { |
|
301 |
+ font-family: Avenir-Black; |
|
302 |
+ font-size: 24px; |
|
303 |
+ color: #0F2105; |
|
304 |
+ line-height: 33px; |
|
305 |
+ float: left; |
|
306 |
+ margin-right: 5px; |
|
307 |
+} |
|
308 |
+ |
|
309 |
+.mission-time-left div:nth-child(2) { |
|
310 |
+ font-family: Avenir-Medium; |
|
311 |
+ font-size: 16px; |
|
312 |
+ color: #000000; |
|
313 |
+ line-height: 22px; |
|
314 |
+ float: left; |
|
315 |
+ margin-top: 5px; |
|
316 |
+} |
@@ -1,6 +1,7 @@ |
||
1 | 1 |
class AgentsController < ApplicationController |
2 | 2 |
|
3 | 3 |
def dashboard |
4 |
+ @agent_missions = current_user.mission_agents |
|
4 | 5 |
end |
5 | 6 |
|
6 | 7 |
def list |
@@ -8,6 +8,13 @@ class MissionsController < ApplicationController |
||
8 | 8 |
@open_missions = Mission.where("status = ? OR status = ?", 1, 2) |
9 | 9 |
@finished_missions = Mission.where("status = ? OR status = ?", 3, 4) |
10 | 10 |
end |
11 |
+ |
|
12 |
+ def mission_control |
|
13 |
+ @mission = Mission.find(params[:id]) |
|
14 |
+ if current_user != @mission.owner |
|
15 |
+ redirect_to missions_path, alert: (t 'mission.access_denied_error') |
|
16 |
+ end |
|
17 |
+ end |
|
11 | 18 |
|
12 | 19 |
# GET /missions/1 |
13 | 20 |
# GET /missions/1.json |
@@ -38,7 +45,7 @@ class MissionsController < ApplicationController |
||
38 | 45 |
|
39 | 46 |
respond_to do |format| |
40 | 47 |
if @mission.save |
41 |
- format.html { redirect_to @mission, notice: 'Mission was successfully created.' } |
|
48 |
+ format.html { redirect_to mission_control_path(@mission), notice: 'Mission was successfully created.' } |
|
42 | 49 |
format.json { render action: 'show', status: :created, location: @mission } |
43 | 50 |
else |
44 | 51 |
format.html { render action: 'new' } |
@@ -52,7 +59,7 @@ class MissionsController < ApplicationController |
||
52 | 59 |
def update |
53 | 60 |
respond_to do |format| |
54 | 61 |
if @mission.update(mission_params) |
55 |
- format.html { redirect_to @mission, notice: 'Mission was successfully updated.' } |
|
62 |
+ format.html { redirect_to mission_control_path(@mission), notice: 'Mission was successfully updated.' } |
|
56 | 63 |
format.json { head :no_content } |
57 | 64 |
else |
58 | 65 |
format.html { render action: 'edit' } |
@@ -31,4 +31,10 @@ module MissionsHelper |
||
31 | 31 |
end |
32 | 32 |
end |
33 | 33 |
|
34 |
+ def mission_time_left(mission, position = 'pull-left') |
|
35 |
+ content_tag(:div, class: 'mission-time-left '+ position) do |
|
36 |
+ content_tag(:div, '45 '.to_s) + content_tag(:div, (t 'mission.days_left')) |
|
37 |
+ end |
|
38 |
+ end |
|
39 |
+ |
|
34 | 40 |
end |
@@ -8,6 +8,7 @@ class User < ActiveRecord::Base |
||
8 | 8 |
validates :password, length: {minimum: 5, maximum: 120}, on: :update, allow_blank: true |
9 | 9 |
|
10 | 10 |
has_many :posts |
11 |
+ has_many :mission_agents |
|
11 | 12 |
|
12 | 13 |
mount_uploader :avatar, AvatarUploader |
13 | 14 |
process_in_background :avatar |
@@ -1,10 +1,141 @@ |
||
1 |
-<%= content_tag(:div, class: 'container top-container') do %> |
|
1 |
+<% # Header BG %> |
|
2 |
+<%= content_tag(:div, class: 'container-bg container-pre-tabs') do %> |
|
3 |
+ <%= content_tag(:div, class: 'container top-container container-bg') do %> |
|
4 |
+ <%= content_tag(:div, class: 'row') do %> |
|
5 |
+ <%= content_tag(:div, class: 'span12') do %> |
|
6 |
+ <%= content_tag(:div, class: 'page-header') do %> |
|
7 |
+ <%= content_tag(:h1, (t 'agent.dashboard')) %> |
|
8 |
+ <% end %> |
|
9 |
+ <% end %> |
|
10 |
+ <% end %> |
|
11 |
+ <%= content_tag(:div, class: 'row') do %> |
|
12 |
+ <%= content_tag(:div, class: 'span8') do %> |
|
13 |
+ <% # Mission Count %> |
|
14 |
+ <%= content_tag(:div, class: 'dashboard-stats') do %> |
|
15 |
+ <%= content_tag(:p) do %> |
|
16 |
+ <%= content_tag(:i, '', class: 'icon-mission') %> |
|
17 |
+ <%= content_tag(:span, '6') %> |
|
18 |
+ <% end %> |
|
19 |
+ <%= content_tag(:p, (t 'mission.missions')) %> |
|
20 |
+ <% end %> |
|
21 |
+ <% # Director Missions Count %> |
|
22 |
+ <%= content_tag(:div, class: 'dashboard-stats') do %> |
|
23 |
+ <%= content_tag(:p) do %> |
|
24 |
+ <%= content_tag(:i, '', class: 'icon-radar') %> |
|
25 |
+ <%= content_tag(:span, '2') %> |
|
26 |
+ <% end %> |
|
27 |
+ <%= content_tag(:p, (t 'mission.directing_missions')) %> |
|
28 |
+ <% end %> |
|
29 |
+ <% # Task Count %> |
|
30 |
+ <%= content_tag(:div, class: 'dashboard-stats') do %> |
|
31 |
+ <%= content_tag(:p) do %> |
|
32 |
+ <%= content_tag(:i, '', class: 'icon-task') %> |
|
33 |
+ <%= content_tag(:span, '21') %> |
|
34 |
+ <% end %> |
|
35 |
+ <%= content_tag(:p, (t 'agent.tasks')) %> |
|
36 |
+ <% end %> |
|
37 |
+ <% # Messsages Count %> |
|
38 |
+ <%= content_tag(:div, class: 'dashboard-stats') do %> |
|
39 |
+ <%= content_tag(:p) do %> |
|
40 |
+ <%= content_tag(:i, '', class: 'icon-chat') %> |
|
41 |
+ <%= content_tag(:span, '48') %> |
|
42 |
+ <% end %> |
|
43 |
+ <%= content_tag(:p, (t 'agent.messages')) %> |
|
44 |
+ <% end %> |
|
45 |
+ <% # Points %> |
|
46 |
+ <%= content_tag(:div, class: 'dashboard-stats') do %> |
|
47 |
+ <%= content_tag(:p) do %> |
|
48 |
+ <%= content_tag(:span, '150K') %> |
|
49 |
+ <% end %> |
|
50 |
+ <%= content_tag(:p, (t 'agent.points')) %> |
|
51 |
+ <% end %> |
|
52 |
+ <%= bootstrap_flash %> |
|
53 |
+ <% end %> |
|
54 |
+ <%= content_tag(:div, class: 'span4 trust-stat') do %> |
|
55 |
+ <div class="progress-bar"> |
|
56 |
+ <div class="progress progress-striped"> |
|
57 |
+ <div class="bar bar-success" style="width: 95%;"></div> |
|
58 |
+ </div> |
|
59 |
+ <div class="percentage">95%</div> |
|
60 |
+ </div> |
|
61 |
+ <%= content_tag(:p, (t 'agent.trust')) %> |
|
62 |
+ <% end %> |
|
63 |
+ <% end %> |
|
64 |
+ <% end %> |
|
65 |
+<% end %> |
|
66 |
+ |
|
67 |
+<% # Tabs %> |
|
68 |
+<%= content_tag(:div, class: 'container container-tabs') do %> |
|
69 |
+ <%= content_tag(:div, class: 'row') do %> |
|
70 |
+ <%= content_tag(:div, class: 'span12') do %> |
|
71 |
+ <%= content_tag(:ul, class: 'nav nav-tabs') do %> |
|
72 |
+ <%= content_tag(:li, (link_to (t 'mission.missions'), dashboard_path), class: 'active') %> |
|
73 |
+ <%= content_tag(:li, (link_to (t 'agent.tasks'), '#'), class: 'disabled') %> |
|
74 |
+ <%= content_tag(:li, (link_to (t 'agent.messages'), '#'), class: 'disabled') %> |
|
75 |
+ <% end %> |
|
76 |
+ <% end %> |
|
77 |
+ <% end %> |
|
78 |
+<% end %> |
|
79 |
+ |
|
80 |
+<% # Content%> |
|
81 |
+<%= content_tag(:div, class: 'container') do %> |
|
2 | 82 |
<%= content_tag(:div, class: 'row') do %> |
3 | 83 |
<%= content_tag(:div, class: 'span12') do %> |
4 |
- <% # Page Content %> |
|
5 |
- <%= bootstrap_flash %> |
|
6 |
- <%= content_tag(:div, class: 'page-header') do %> |
|
7 |
- <%= content_tag(:h1, (t 'agent.dashboard')) %> |
|
84 |
+ <%= content_tag(:ul, class: 'thumbnails mission-list') do %> |
|
85 |
+ <% @agent_missions.each do |agent| %> |
|
86 |
+ |
|
87 |
+ <%= content_tag(:li, class: 'span4') do %> |
|
88 |
+ <% content_tag(:div, class: 'thumbnail') do %> |
|
89 |
+ <%= content_tag(:div, class: 'thumbnail-content') do%> |
|
90 |
+ <%= content_tag(:h4, (t 'mission.mission')+':', class: 'dashboard-role') %> |
|
91 |
+ <%= content_tag(:h2, link_to(agent.mission.title, agent.mission)) %> |
|
92 |
+ <%= content_tag(:h4, (t 'agent.role')+':', class: 'dashboard-role') %> |
|
93 |
+ <%= content_tag(:p, agent.role ) %> |
|
94 |
+ <%= content_tag(:h4, (t 'agent.next_steps')+':', class: 'dashboard-role') %> |
|
95 |
+ |
|
96 |
+ <% end %> |
|
97 |
+ <% # Steps %> |
|
98 |
+ <% step_count = 0 %> |
|
99 |
+ <% has_shown_more_tasks = false %> |
|
100 |
+ <% agent.agent_steps.order('step ASC').each do |step| %> |
|
101 |
+ <% step_count = step_count + 1 %> |
|
102 |
+ <% if step_count <= 2 || agent.agent_steps.count <= 3 %> |
|
103 |
+ <%= content_tag(:div, class: 'thumbnail-task') do %> |
|
104 |
+ <%= content_tag(:p) do %> |
|
105 |
+ <%= content_tag(:span, step.step, class: 'task-number') %> |
|
106 |
+ <%= content_tag(:span, step.title, class: 'task-text') %> |
|
107 |
+ <%= content_tag(:span, '<i class="fa fa-picture-o"></i>'.html_safe, class: 'task-icon') %> |
|
108 |
+ <% end %> |
|
109 |
+ <% end %> |
|
110 |
+ <% else %> |
|
111 |
+ <% if has_shown_more_tasks == false %> |
|
112 |
+ <% has_shown_more_tasks = true %> |
|
113 |
+ <%= content_tag(:div, class: 'thumbnail-task') do %> |
|
114 |
+ <%= content_tag(:p, class: 'task-show-all') do %> |
|
115 |
+ <%= content_tag(:span, ('+ ' + (agent.agent_steps.count - step_count).to_s + ' ' + (t 'mission.steps')).html_safe) %> |
|
116 |
+ <% end %> |
|
117 |
+ <% end %> |
|
118 |
+ <% end %> |
|
119 |
+ <% end %> |
|
120 |
+ <% end %> |
|
121 |
+ <%= content_tag(:div, class: 'thumbnail-content mission-agent-percentage') do %> |
|
122 |
+ <div class="progress-bar"> |
|
123 |
+ <div class="progress progress-striped"> |
|
124 |
+ <div class="bar bar-success" style="width: 30%;"></div> |
|
125 |
+ </div> |
|
126 |
+ <div class="percentage">30%</div> |
|
127 |
+ </div> |
|
128 |
+ <% end %> |
|
129 |
+ <%= content_tag(:div, class: 'thumbnail-content mission-status-timer') do%> |
|
130 |
+ <%= content_tag(:div) do %> |
|
131 |
+ <%= mission_time_left(agent.mission) %> |
|
132 |
+ <%= status(agent.mission.status) %> |
|
133 |
+ <% end %> |
|
134 |
+ <% end %> |
|
135 |
+ <% end %> |
|
136 |
+ <% end %> |
|
137 |
+ |
|
138 |
+ <% end %> |
|
8 | 139 |
<% end %> |
9 | 140 |
<% end %> |
10 | 141 |
<% end %> |
@@ -1,5 +1,5 @@ |
||
1 | 1 |
<%= content_tag(:div, class: 'container-bg container-pre-tabs') do %> |
2 |
- <%= content_tag(:div, class: 'container top-container container-bg') do %> |
|
2 |
+ <%= content_tag(:div, class: 'container top-container container-bg mission-detail-container') do %> |
|
3 | 3 |
<%= content_tag(:div, class: 'row') do %> |
4 | 4 |
<%= content_tag(:div, class: 'span12') do %> |
5 | 5 |
|
@@ -1,5 +1,3 @@ |
||
1 |
-<h1>Editing mission</h1> |
|
2 |
- |
|
3 | 1 |
<%= content_tag(:div, class: 'container top-container container-last') do %> |
4 | 2 |
<%= content_tag(:div, class: 'row') do %> |
5 | 3 |
<%= content_tag(:div, class: 'span12') do %> |
@@ -8,7 +6,7 @@ |
||
8 | 6 |
<%= content_tag(:small, (t 'mission.edit_mission')+':') %> |
9 | 7 |
<%= content_tag(:h1) do %> |
10 | 8 |
<%= @mission.title %> |
11 |
- <%= link_to (t 'nav.back'), missions_path, class: 'btn btn-mini' %> |
|
9 |
+ <%= link_to (t 'nav.back'), mission_control_path(@mission), class: 'btn btn-mini' %> |
|
12 | 10 |
<%= status(@mission.status) %> |
13 | 11 |
<% end %> |
14 | 12 |
<% end %> |
@@ -0,0 +1,17 @@ |
||
1 |
+<%= content_tag(:div, class: 'container top-container container-last') do %> |
|
2 |
+ <%= content_tag(:div, class: 'row') do %> |
|
3 |
+ <%= content_tag(:div, class: 'span12') do %> |
|
4 |
+ |
|
5 |
+ <%= content_tag(:div, class: 'page-header page-header-type') do %> |
|
6 |
+ <%= content_tag(:small, (t 'mission.mission_control')+':') %> |
|
7 |
+ <%= content_tag(:h1) do %> |
|
8 |
+ <%= @mission.title %> |
|
9 |
+ <%= link_to (t 'nav.edit'), edit_mission_path(@mission), class: 'btn btn-mini' %> |
|
10 |
+ <%= link_to (t 'nav.back'), dashboard_path, class: 'btn btn-mini' %> |
|
11 |
+ <%= status(@mission.status) %> |
|
12 |
+ <% end %> |
|
13 |
+ <% end %> |
|
14 |
+ <%= bootstrap_flash %> |
|
15 |
+ <% end %> |
|
16 |
+ <% end %> |
|
17 |
+<% end %> |
@@ -24,6 +24,7 @@ Avalanche2::Application.routes.draw do |
||
24 | 24 |
|
25 | 25 |
# Missions |
26 | 26 |
resources :missions |
27 |
+ get 'mission_control/:id' => 'missions#mission_control', as: :mission_control |
|
27 | 28 |
get '/missions/:id/agents', to: 'missions#show_agents', as: :mission_agents_list |
28 | 29 |
get 'missions/:id/agents/:agent', to: 'missions#show_agent_details', as: :mission_agent_details |
29 | 30 |
get 'missions/:id/agents/:agent/take_agent_role', to: 'missions#take_agent_role', as: :take_agent_role |