@@ -14,6 +14,12 @@ |
||
14 | 14 |
} |
15 | 15 |
.btn.btn-danger:hover { background-color: fade(@red, 25%); } |
16 | 16 |
|
17 |
+.btn.btn-primary { |
|
18 |
+ color: @blue; |
|
19 |
+ border-color: @blue; |
|
20 |
+} |
|
21 |
+.btn.btn-primary:hover { background-color: fade(@blue, 25%); } |
|
22 |
+ |
|
17 | 23 |
.btn { |
18 | 24 |
display: inline-block; |
19 | 25 |
padding: 4px 12px; |
@@ -90,6 +90,20 @@ class MissionsController < ApplicationController |
||
90 | 90 |
end |
91 | 91 |
end |
92 | 92 |
|
93 |
+ def launch |
|
94 |
+ mission = Mission.friendly.find(params[:id]) |
|
95 |
+ if user_signed_in? |
|
96 |
+ if current_user == mission.owner |
|
97 |
+ mission.update(status: 2) |
|
98 |
+ redirect_to mission_control_path(mission) |
|
99 |
+ else |
|
100 |
+ redirect_to mission_path(mission), alert: (t 'mission.insuficient_privileges') |
|
101 |
+ end |
|
102 |
+ else |
|
103 |
+ redirect_to new_user_session_path, notice: (t 'registration.please_log_in_first') |
|
104 |
+ end |
|
105 |
+ end |
|
106 |
+ |
|
93 | 107 |
def take_agent_role |
94 | 108 |
mission = Mission.friendly.find(params[:id]) |
95 | 109 |
agent = mission.mission_agents.friendly.find(params[:agent]) |
@@ -62,6 +62,7 @@ |
||
62 | 62 |
<% end %> |
63 | 63 |
<% end %> |
64 | 64 |
<%= content_tag(:div, '', class: 'clearfix') %> |
65 |
+ <% # Join/Launch Buttons %> |
|
65 | 66 |
<% if !@mission.is_agent(current_user) && current_user != @mission.owner %> |
66 | 67 |
<%= content_tag(:div, class: 'mission-call-to-action') do %> |
67 | 68 |
<% if user_signed_in? %> |
@@ -70,6 +71,10 @@ |
||
70 | 71 |
<%= link_to (t 'mission.join'), new_user_session_path, class: 'btn btn-large' %> |
71 | 72 |
<% end %> |
72 | 73 |
<% end %> |
74 |
+ <% elsif current_user == @mission.owner && @mission.status == 1 %> |
|
75 |
+ <%= content_tag(:div, class: 'mission-call-to-action') do %> |
|
76 |
+ <%= link_to (t 'mission.launch'), mission_launch_path(@mission), class: 'btn btn-large btn-primary' %> |
|
77 |
+ <% end %> |
|
73 | 78 |
<% end %> |
74 | 79 |
<%= content_tag(:div, '', class: 'clearfix', id: 'mission-tab') %> |
75 | 80 |
<% end %> |
@@ -25,6 +25,7 @@ Avalanche2::Application.routes.draw do |
||
25 | 25 |
# Missions |
26 | 26 |
resources :missions |
27 | 27 |
get 'missions/:id/agents', to: 'missions#show_agents', as: :mission_agents_list |
28 |
+ get 'missions/:id/launch', to: 'missions#launch', as: :mission_launch |
|
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 |
30 | 31 |
|
@@ -73,14 +73,6 @@ rails g model step_validation agent_step:reference step_verifications:references |
||
73 | 73 |
# Step Verifications |
74 | 74 |
rails g model step_verification step_validation:references validated:boolean validated_by:references content:string |
75 | 75 |
|
76 |
-``` |
|
77 |
- |
|
78 |
-## Undone Commands |
|
79 |
- |
|
80 |
-```shell |
|
81 |
-# Reward Model |
|
82 |
-rails g model agent_reward mission_agent:references category:string title:string description:text img:string |
|
83 |
- |
|
84 | 76 |
# Validation Scaffolding |
85 | 77 |
rails destroy model step_validation |
86 | 78 |
rails destroy model step_verification |
@@ -103,6 +95,18 @@ rails g model submission_text submission_content:references content accepted:boo |
||
103 | 95 |
|
104 | 96 |
``` |
105 | 97 |
|
98 |
+## Undone Commands |
|
99 |
+ |
|
100 |
+```shell |
|
101 |
+# Reward Model |
|
102 |
+rails g model reward mission:references mission_agents:references title:string description:text img:string |
|
103 |
+ |
|
104 |
+rails g model user_reward reward:references received:boolean date_received:datetime |
|
105 |
+ |
|
106 |
+rails g model |
|
107 |
+ |
|
108 |
+``` |
|
109 |
+ |
|
106 | 110 |
## To dos |
107 | 111 |
|
108 | 112 |
* mission controller |