@@ -4,11 +4,11 @@ class MissionsController < ApplicationController |
||
4 | 4 |
# GET /missions |
5 | 5 |
# GET /missions.json |
6 | 6 |
def index |
7 |
- @featured_missions = Mission.where("status = ? OR status = ?", 1, 2).last |
|
8 |
- @open_missions = Mission.where("status = ? OR status = ?", 1, 2) |
|
9 |
- @open_missions.delete_if { |m| m == @featured_missions } |
|
10 |
- @finished_missions = Mission.where("status = ? OR status = ?", 3, 4) |
|
11 |
- @finished_missions.delete_if { |m| m == @featured_missions } |
|
7 |
+ #@featured_missions = Mission.where("status = ? OR status = ?", 1, 2).last |
|
8 |
+ #@open_missions = Mission.where("status = ? OR status = ?", 1, 2) |
|
9 |
+ #@open_missions.delete_if { |m| m == @featured_missions } |
|
10 |
+ #@finished_missions = Mission.where("status = ? OR status = ?", 3, 4) |
|
11 |
+ #@finished_missions.delete_if { |m| m == @featured_missions } |
|
12 | 12 |
end |
13 | 13 |
|
14 | 14 |
def mission_control |
@@ -58,7 +58,7 @@ class MissionsController < ApplicationController |
||
58 | 58 |
@mission.owner = current_user |
59 | 59 |
respond_to do |format| |
60 | 60 |
if @mission.save |
61 |
- format.html { redirect_to mission_editor_rewards_list(@mission), notice: 'Mission was successfully created.' } |
|
61 |
+ format.html { redirect_to rewards_path(@mission), notice: 'Mission was successfully created.' } |
|
62 | 62 |
format.json { render action: 'show', status: :created, location: @mission } |
63 | 63 |
else |
64 | 64 |
format.html { render action: 'new' } |
@@ -1,4 +1,4 @@ |
||
1 |
-<%= bootstrap_form_for(@reward, url: {action: 'update', mission: @mission.slug, id: @reward.id}) do |f| %> |
|
1 |
+<%= bootstrap_form_for(@reward, url: {action: form_action, mission: @mission.slug, id: @reward.id}) do |f| %> |
|
2 | 2 |
<%= f.alert_message "Please fix the errors below." %> |
3 | 3 |
<%= content_tag(:div, class: 'panel panel-default') do %> |
4 | 4 |
<%= content_tag(:div, class: 'panel-body white-bg') do %> |
@@ -1,6 +1,6 @@ |
||
1 | 1 |
|
2 | 2 |
|
3 |
-<% title "#{t 'mission_editor.edit_reward'} - #{@config.website_name}" %> |
|
3 |
+<% title "#{t 'mission_editor.rewards.edit'} - #{@config.website_name}" %> |
|
4 | 4 |
|
5 | 5 |
<%= render :partial => 'missions/mission_editor_tabs' %> |
6 | 6 |
|
@@ -12,7 +12,7 @@ |
||
12 | 12 |
<%= content_tag(:div, class: 'page-header page-header-type') do %> |
13 | 13 |
<%= content_tag(:small, @mission.title + ':') %> |
14 | 14 |
<%= content_tag(:h1) do %> |
15 |
- <%= t 'mission_editor.edit_reward' %> |
|
15 |
+ <%= t 'mission_editor.rewards.edit' %> |
|
16 | 16 |
<% end %> |
17 | 17 |
<% end %> |
18 | 18 |
|
@@ -21,7 +21,7 @@ |
||
21 | 21 |
<%= content_tag(:div, class: 'row') do %> |
22 | 22 |
<%= content_tag(:div, class: 'span8') do %> |
23 | 23 |
|
24 |
- <%= render 'form' %> |
|
24 |
+ <%= render :partial => 'form', locals: {form_action: 'update'} %> |
|
25 | 25 |
|
26 | 26 |
<% end %> |
27 | 27 |
<% # Sidebar %> |
@@ -1,4 +1,4 @@ |
||
1 |
-<% title "#{t 'mission_editor.add_reward'} - #{@config.website_name}" %> |
|
1 |
+<% title "#{t 'mission_editor.rewards.add'} - #{@config.website_name}" %> |
|
2 | 2 |
|
3 | 3 |
<%= render :partial => 'missions/mission_editor_tabs' %> |
4 | 4 |
|
@@ -10,7 +10,7 @@ |
||
10 | 10 |
<%= content_tag(:div, class: 'page-header page-header-type') do %> |
11 | 11 |
<%= content_tag(:small, @mission.title + ':') %> |
12 | 12 |
<%= content_tag(:h1) do %> |
13 |
- <%= t 'mission_editor.add_reward' %> |
|
13 |
+ <%= t 'mission_editor.rewards.add' %> |
|
14 | 14 |
<% end %> |
15 | 15 |
<% end %> |
16 | 16 |
|
@@ -19,7 +19,7 @@ |
||
19 | 19 |
<%= content_tag(:div, class: 'row') do %> |
20 | 20 |
<%= content_tag(:div, class: 'span8') do %> |
21 | 21 |
|
22 |
- <%= render 'form' %> |
|
22 |
+ <%= render :partial => 'form', locals: {form_action: 'create'} %> |
|
23 | 23 |
|
24 | 24 |
<% end %> |
25 | 25 |
<% # Sidebar %> |
@@ -8,32 +8,36 @@ |
||
8 | 8 |
<%= content_tag(:div, class: 'page-header') do %> |
9 | 9 |
<%= content_tag(:h1) do %> |
10 | 10 |
<%= t 'mission.missions' %> |
11 |
- <%= link_to 'New Mission', new_mission_path, class: 'btn btn-success' %> |
|
11 |
+ <% if @featured_missions != nil && @open_missions != nil && @finished_missions != nil %> |
|
12 |
+ <%= link_to (t'mission.new_mission'), new_mission_path, class: 'btn btn-success' %> |
|
13 |
+ <% end %> |
|
12 | 14 |
<% end %> |
13 | 15 |
<% end %> |
14 | 16 |
|
15 |
- <%= content_tag(:h2, (t 'mission.featured_missions'))%> |
|
17 |
+ <% if @featured_missions != nil %> |
|
18 |
+ <%= content_tag(:h2, (t 'mission.featured_missions'))%> |
|
16 | 19 |
|
17 |
- <%= content_tag(:div, class: 'row-fluid box ', id: "mission-#{@featured_missions.slug}") do %> |
|
18 |
- <%= content_tag(:div, class: 'span8') do %> |
|
19 |
- <%= link_to mission_path(@featured_missions) do %> |
|
20 |
- <%= @featured_missions.cover_img? ? (image_tag @featured_missions.cover_img.feature) : image_tag('http://placehold.it/1200x780') %> |
|
21 |
- <% end %> |
|
22 |
- <% end %> |
|
23 |
- <%= content_tag(:div, class: 'span4') do %> |
|
24 |
- <%= content_tag(:div, class: 'box-content') do%> |
|
25 |
- <%= content_tag(:h3, link_to(@featured_missions.title, @featured_missions)) %> |
|
26 |
- <%= content_tag(:p, @featured_missions.owner.full_name, class: 'mission-director-name') %> |
|
27 |
- <%= content_tag(:p, @featured_missions.objective, class: 'box-mission-description') %> |
|
28 |
- <% # Progress bar %> |
|
29 |
- <%= content_tag(:div, class: 'thumbnail-content mission-agent-percentage') do %> |
|
30 |
- <%= render :partial => 'missions/mission_percentage_bar', locals: { mission: @featured_missions, size: '' } %> |
|
20 |
+ <%= content_tag(:div, class: 'row-fluid box ', id: "mission-#{@featured_missions.slug}") do %> |
|
21 |
+ <%= content_tag(:div, class: 'span8') do %> |
|
22 |
+ <%= link_to mission_path(@featured_missions) do %> |
|
23 |
+ <%= @featured_missions.cover_img? ? (image_tag @featured_missions.cover_img.feature) : image_tag('http://placehold.it/1200x780') %> |
|
31 | 24 |
<% end %> |
32 |
- <%= content_tag(:div, class: 'feature-stats') do %> |
|
33 |
- <% mission_agent_counter(@featured_missions) %> |
|
34 |
- <%= status(@featured_missions.status) %> |
|
35 |
- <% mission_steps_counter(@featured_missions) %> |
|
36 |
- <%= mission_time_left(@featured_missions) %> |
|
25 |
+ <% end %> |
|
26 |
+ <%= content_tag(:div, class: 'span4') do %> |
|
27 |
+ <%= content_tag(:div, class: 'box-content') do%> |
|
28 |
+ <%= content_tag(:h3, link_to(@featured_missions.title, @featured_missions)) %> |
|
29 |
+ <%= content_tag(:p, @featured_missions.owner.full_name, class: 'mission-director-name') %> |
|
30 |
+ <%= content_tag(:p, @featured_missions.objective, class: 'box-mission-description') %> |
|
31 |
+ <% # Progress bar %> |
|
32 |
+ <%= content_tag(:div, class: 'thumbnail-content mission-agent-percentage') do %> |
|
33 |
+ <%= render :partial => 'missions/mission_percentage_bar', locals: { mission: @featured_missions, size: '' } %> |
|
34 |
+ <% end %> |
|
35 |
+ <%= content_tag(:div, class: 'feature-stats') do %> |
|
36 |
+ <% mission_agent_counter(@featured_missions) %> |
|
37 |
+ <%= status(@featured_missions.status) %> |
|
38 |
+ <% mission_steps_counter(@featured_missions) %> |
|
39 |
+ <%= mission_time_left(@featured_missions) %> |
|
40 |
+ <% end %> |
|
37 | 41 |
<% end %> |
38 | 42 |
<% end %> |
39 | 43 |
<% end %> |
@@ -41,20 +45,39 @@ |
||
41 | 45 |
|
42 | 46 |
|
43 | 47 |
|
48 |
+ <% if @open_missions != nil %> |
|
49 |
+ <%= content_tag(:h2, (t 'mission.open_missions'))%> |
|
44 | 50 |
|
45 |
- <%= content_tag(:h2, (t 'mission.open_missions'))%> |
|
46 |
- |
|
47 |
- <%= content_tag(:ul, class: 'thumbnails mission-list') do %> |
|
48 |
- <% @open_missions.each do |mission| %> |
|
49 |
- <%= render partial: "mission_box", locals: {mission: mission} %> |
|
51 |
+ <%= content_tag(:ul, class: 'thumbnails mission-list') do %> |
|
52 |
+ <% @open_missions.each do |mission| %> |
|
53 |
+ <%= render partial: "mission_box", locals: {mission: mission} %> |
|
54 |
+ <% end %> |
|
50 | 55 |
<% end %> |
51 | 56 |
<% end %> |
52 | 57 |
|
53 |
- <%= content_tag(:h2, (t 'mission.finished_missions'))%> |
|
58 |
+ <% if @finished_missions != nil %> |
|
59 |
+ <%= content_tag(:h2, (t 'mission.finished_missions'))%> |
|
54 | 60 |
|
55 |
- <%= content_tag(:ul, class: 'thumbnails mission-list') do %> |
|
56 |
- <% @finished_missions.each do |mission| %> |
|
57 |
- <%= render partial: "mission_box", locals: {mission: mission} %> |
|
61 |
+ <%= content_tag(:ul, class: 'thumbnails mission-list') do %> |
|
62 |
+ <% @finished_missions.each do |mission| %> |
|
63 |
+ <%= render partial: "mission_box", locals: {mission: mission} %> |
|
64 |
+ <% end %> |
|
65 |
+ <% end %> |
|
66 |
+ <% end %> |
|
67 |
+ |
|
68 |
+ <% # Empty Page %> |
|
69 |
+ |
|
70 |
+ <% if @featured_missions == nil && @open_missions == nil && @finished_missions == nil %> |
|
71 |
+ <%= content_tag(:div, class: 'row') do %> |
|
72 |
+ <%= content_tag(:ul, class: 'mission-editor-reward-list') do %> |
|
73 |
+ <%= content_tag(:li, class: 'span12' ) do %> |
|
74 |
+ <%= content_tag(:div, class: "editor-reward-new centered-editor-new") do %> |
|
75 |
+ <i class="icon-mission"></i><br> |
|
76 |
+ <%= content_tag(:p, (t 'mission.no_missions_yet')) %> |
|
77 |
+ <%= link_to (t'mission.new_mission'), new_mission_path, class: 'btn' %> |
|
78 |
+ <% end %> |
|
79 |
+ <% end %> |
|
80 |
+ <% end %> |
|
58 | 81 |
<% end %> |
59 | 82 |
<% end %> |
60 | 83 |
|
@@ -37,7 +37,7 @@ |
||
37 | 37 |
<%= content_tag(:div, class: 'thumbnail-content') do%> |
38 | 38 |
<%= content_tag(:h4, (t 'mission.rewards')) %> |
39 | 39 |
<%= content_tag(:div, class: 'reward-blank ') do %> |
40 |
- <%= content_tag(:p, content_tag(:small, (t 'mission.no_rewards'))) %> |
|
40 |
+ <%= content_tag(:p, content_tag(:small, (t 'mission.rewards.no_rewards'))) %> |
|
41 | 41 |
<% end %> |
42 | 42 |
<% end %> |
43 | 43 |
<% end %> |
@@ -4,6 +4,8 @@ en: |
||
4 | 4 |
missions: 'Missions' |
5 | 5 |
notification: 'Notification' |
6 | 6 |
step: 'Step' |
7 |
+ new_mission: 'New Mission' |
|
8 |
+ no_missions_yet: 'There are no missions yet. Create the first.' |
|
7 | 9 |
step: |
8 | 10 |
validated: 'Validated' |
9 | 11 |
step_validated: 'Step validated' |
@@ -31,6 +33,8 @@ en: |
||
31 | 33 |
page_title: 'Rewards' |
32 | 34 |
save_reward: 'Save Reward' |
33 | 35 |
add: 'Add Reward' |
36 |
+ edit: 'Edit Reward' |
|
37 |
+ no_rewards: 'No rewards' |
|
34 | 38 |
agents: |
35 | 39 |
page_title: 'Agents' |
36 | 40 |
add_agent: 'Add Agent' |
@@ -4,6 +4,8 @@ pt-BR: |
||
4 | 4 |
missions: 'Missões' |
5 | 5 |
notification: 'Notificação' |
6 | 6 |
step: 'Passo' |
7 |
+ new_mission: 'Nova Missão' |
|
8 |
+ no_missions_yet: 'Não existem missões ainda. Crie a primeira.' |
|
7 | 9 |
step: |
8 | 10 |
validated: 'Validado' |
9 | 11 |
step_validated: 'Passo validado' |
@@ -31,6 +33,8 @@ pt-BR: |
||
31 | 33 |
page_title: 'Recompensas' |
32 | 34 |
save_reward: 'Salvar Recompensa' |
33 | 35 |
add: 'Adicionar Recompensa' |
36 |
+ edit: 'Editar Recompensa' |
|
37 |
+ no_rewards: 'Nenhuma recompença' |
|
34 | 38 |
agents: |
35 | 39 |
page_title: 'Agentes' |
36 | 40 |
add_agent: 'Criar agente' |
@@ -0,0 +1,43 @@ |
||
1 |
+@mission_editor |
|
2 |
+Feature: Mission Editor |
|
3 |
+ In order to create a mission |
|
4 |
+ As an Mission Director |
|
5 |
+ I want to create and edit missions and agents |
|
6 |
+ |
|
7 |
+ Background: |
|
8 |
+ Given the website is configured |
|
9 |
+ And I am logged in as user |
|
10 |
+ |
|
11 |
+ Scenario: Create Mission |
|
12 |
+ Given I go to the missions page |
|
13 |
+ And I click in the link "New Mission" |
|
14 |
+ Then within "h1" I should see "Create Mission" |
|
15 |
+ And I fill in "Mission Title" with "Treaure Hunt" |
|
16 |
+ And I fill in "Mission Objective" with "Follow the steps to find the treasure." |
|
17 |
+ And I fill in "Mission Briefing" with "Hello, welcome to the Treasure Hunt Mission!" |
|
18 |
+ And I upload the file "cats_with_lasers.jpg" to the field "mission_cover_img" |
|
19 |
+ And I fill in "mission_duration_number" with "5" |
|
20 |
+ And I click in the button "Save & Continue" |
|
21 |
+ Then within "h1" I should see "Rewards" |
|
22 |
+ And I should see "No rewards" |
|
23 |
+ And I click in the link "Add Reward" |
|
24 |
+ Then within "h1" I should see "Add Reward" |
|
25 |
+ And I fill in "Reward Title" with "Chocolate Bar" |
|
26 |
+ And I fill in "Reward Description" with "A Delicious chocolate bar." |
|
27 |
+ And I upload the file "chocolate_bar.png" to the field "reward_img" |
|
28 |
+ And I click in the button "Save Reward" |
|
29 |
+ Then within "h1" I should see "Rewards" |
|
30 |
+ And I should see "Chocolate Bar" |
|
31 |
+ And I click in the link "Next" |
|
32 |
+ Then within "h1" I should see "Agents" |
|
33 |
+ And I should see "No agents" |
|
34 |
+ And I click in the link "Add Agent Role" |
|
35 |
+ Then within "h1" I should see "Add Agent" |
|
36 |
+ And I fill in "Agent Role" with "Treasure Hunter" |
|
37 |
+ And I fill in "Objective" with "Follow the step to find the treasure." |
|
38 |
+ And I fill in "Briefing" with "Follow each step carefully to get to the secret location where the treasure is hidden." |
|
39 |
+ And I fill in "Step Title" with "Start in front of Copan" |
|
40 |
+ And I fill in "Description" with "The initial position is in front of the building" |
|
41 |
+ And I click in the button "Save Agent" |
|
42 |
+ Then within "h1" I should see "Agents" |
|
43 |
+ And I should see "Treasure Hunter" |
@@ -28,11 +28,11 @@ FactoryGirl.define do |
||
28 | 28 |
end |
29 | 29 |
|
30 | 30 |
factory :info do |
31 |
- website_name 'Rails Website Template' |
|
31 |
+ website_name 'Avalanche' |
|
32 | 32 |
tagline 'A Ruby on Rails app template' |
33 | 33 |
default_language 'en' |
34 |
- contact_email 'admin@website.com' |
|
35 |
- server_email 'no-reply@website.com' |
|
34 |
+ contact_email 'contact@avalanche.network' |
|
35 |
+ server_email 'no-reply@avalanche.network' |
|
36 | 36 |
website_link 'http://localhost:3000' |
37 | 37 |
end |
38 | 38 |
|