@@ -162,7 +162,7 @@ class MissionsController < ApplicationController |
||
162 | 162 |
|
163 | 163 |
# Never trust parameters from the scary internet, only allow the white list through. |
164 | 164 |
def mission_params |
165 |
- params.require(:mission).permit(:mission_agents_id, :title, :objective, :briefing, :owner_id, :status, :launched, :language, :cover_img, :slug, :end_date, :duration_scale, :duration_number) |
|
165 |
+ params.require(:mission).permit(:mission_agents_id, :title, :objective, :briefing, :owner_id, :status, :launched, :language, :cover_img, :slug, :end_date, :duration_scale, :duration_number, :video) |
|
166 | 166 |
end |
167 | 167 |
|
168 | 168 |
def step_submission_params |
@@ -6,10 +6,11 @@ |
||
6 | 6 |
<%= content_tag(:div, class: "panel-text") do %> |
7 | 7 |
<%= content_tag(:div, class: "form-inputs") do %> |
8 | 8 |
<%= f.text_field :title, label: (t 'mission_editor.mission_details.mission_title'), class: 'input-block-level' %> |
9 |
- <%= f.text_field :objective, label: (t 'mission_editor.mission_details.mission_objective'), class: 'input-block-level' %> |
|
9 |
+ <% f.text_field :objective, label: (t 'mission_editor.mission_details.mission_objective'), class: 'input-block-level' %> |
|
10 | 10 |
<%= f.text_area :briefing, label: (t 'mission_editor.mission_details.mission_briefing'), class: 'input-block-level', rows: 10 %> |
11 | 11 |
<%= f.select :language, [[(t 'mission_editor.mission_details.en'), 'en'], [(t 'mission_editor.mission_details.pt-BR'), 'pt-BR']], { label: (t 'mission_editor.mission_details.language') }, { class: "selectpicker" } %> |
12 | 12 |
<%= render :partial => 'mission_image_uploader', locals: { mission: @mission, f: f } %> |
13 |
+ <%= f.text_field :video, label: (t 'mission_editor.mission_details.youtube_video_link'), class: 'input-block-level' %> |
|
13 | 14 |
<%= content_tag(:div, '', class: 'inline-form-line') do%> |
14 | 15 |
<%= f.select :duration_scale, [[(t 'time.days'), 'days'], [(t 'time.hours'), 'hours']], { label: (t 'mission_editor.mission_details.mission_duration') }, { class: "selectpicker", layout: :inline } %> |
15 | 16 |
<%= f.number_field :duration_number, hide_label: true, placeholder: (t 'mission_editor.mission_details.duration') %> |
@@ -18,12 +18,10 @@ |
||
18 | 18 |
<% end %> |
19 | 19 |
<%= content_tag(:div, class: 'row') do %> |
20 | 20 |
<%= content_tag(:div, class: 'span8') do %> |
21 |
- <% youtube_video = false %> |
|
22 |
- <% if youtube_video == true %> |
|
23 |
- <div class="videoWrapper"> |
|
24 |
- <!-- Copy & Pasted from YouTube --> |
|
25 |
- <iframe width="1280" height="720" src="https://www.youtube.com/embed/DvLYOcXUYgU?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe> |
|
26 |
- </div> |
|
21 |
+ <% if @mission.video != nil %> |
|
22 |
+ <%= content_tag(:div, class: "videoWrapper") do %> |
|
23 |
+ <iframe width="1280" height="720" src="https://www.youtube.com/embed/<%= @mission.video[/(?<=[?&]v=)[^&$]+/] %>?showinfo=0" frameborder="0" allowfullscreen></iframe> |
|
24 |
+ <% end %> |
|
27 | 25 |
<% else %> |
28 | 26 |
<%= mission.cover_img? ? (image_tag mission.cover_img.feature) : image_tag('http://placehold.it/1200x780') %> |
29 | 27 |
<% end %> |
@@ -0,0 +1,5 @@ |
||
1 |
+class AddVideoToMissions < ActiveRecord::Migration |
|
2 |
+ def change |
|
3 |
+ add_column :missions, :video, :string |
|
4 |
+ end |
|
5 |
+end |
@@ -11,7 +11,7 @@ |
||
11 | 11 |
# |
12 | 12 |
# It's strongly recommended that you check this file into your version control system. |
13 | 13 |
|
14 |
-ActiveRecord::Schema.define(version: 20150419044718) do |
|
14 |
+ActiveRecord::Schema.define(version: 20150420024128) do |
|
15 | 15 |
|
16 | 16 |
# These are extensions that must be enabled in order to support this database |
17 | 17 |
enable_extension "plpgsql" |
@@ -170,6 +170,7 @@ ActiveRecord::Schema.define(version: 20150419044718) do |
||
170 | 170 |
t.string "duration_scale" |
171 | 171 |
t.integer "duration_number" |
172 | 172 |
t.datetime "launch_date" |
173 |
+ t.string "video" |
|
173 | 174 |
end |
174 | 175 |
|
175 | 176 |
add_index "missions", ["mission_agents_id"], name: "index_missions_on_mission_agents_id", using: :btree |