Skip to content
Browse files

merge

  • Loading branch information...
2 parents a709d97 + 01c8e39 commit 99eeaa8c37f1306302999430d85a9842b3871351 Cykodcore committed Dec 15, 2011
View
7 app/controllers/video/page_feature.rb
@@ -51,6 +51,8 @@ def define_video_detail_tags(c)
c.h_tag('video:user') { |t| t.locals.video.end_user ? t.locals.video.end_user.name : ''}
c.define_tag('video:image') { |t| image_tag "http://img.youtube.com/vi/#{t.locals.video.provider_file_id}/0.jpg", t.attr }
c.h_tag('video:name') { |t| h t.locals.video.name }
+ c.h_tag('video:city') { |t| h t.locals.video.city}
+ c.h_tag('video:recipient') { |t| h t.locals.video.recipient}
c.define_tag('video:player') { |t|
width = t.attr['width'] || 425
height = t.attr['height'] || 350
@@ -104,7 +106,8 @@ def video_page_search_feature(data)
<cms:upload>
<cms:errors/>
<cms:name/>
- <cms:email/> <cms:zip/>
+ <cms:email/> <cms:zip placeholder='Zip'/>
+ <cms:recipient/> <cms:city placeholder='City'/>
<cms:file_id/>
<label><cms:terms/> I agree to the Terms and conditions of this site</label>
<label><cms:receive_updates/> I would like to receive email updates from "Friend a Nurse"</label>
@@ -123,6 +126,8 @@ def video_page_upload_feature(data)
c.form_for_tag('upload','video', :html => { :method => 'post', :enctype => 'multipart/form-data' }) { |t| data[:uploaded] ? nil : data[:video] }
c.form_error_tag('upload:errors')
c.field_tag('upload:name')
+ c.field_tag('upload:recipient')
+ c.field_tag('upload:city')
c.field_tag('upload:email')
c.field_tag('upload:zip')
c.field_tag('upload:file_id',:control => 'upload_document')
View
2 app/controllers/video/page_renderer.rb
@@ -56,7 +56,7 @@ def search
def upload
@video = VideoVideo.new(:receive_updates => true, :manual => true)
handle_file_upload(params[:video],:file_id) if params[:video]
- if request.post? && params[:video] && @video.update_attributes(params[:video].slice(:name,:email,:terms,:receive_updates,:zip,:file_id))
+ if request.post? && params[:video] && @video.update_attributes(params[:video].slice(:name,:email,:terms,:receive_updates,:zip,:file_id,:recipient,:city))
@video.run_worker(:handle_video_upload)
@uploaded = true
end
View
2 app/controllers/video/upload_controller.rb
@@ -9,6 +9,8 @@ def index
video = VideoVideo.create(:name => params[:name],
:email => params[:email],
+ :recipient => params[:recipient],
+ :city => params[:city],
:terms => true,
:file_id => params[:media])
View
7 app/models/video_video.rb
@@ -5,6 +5,9 @@ class VideoVideo < DomainModel
validates_presence_of :email
validates_presence_of :terms, :if => Proc.new {|v| v.manual }
+ validates_presence_of :city
+ validates_presence_of :recipient
+
before_create :generate_video_hash
after_create :save_end_user
@@ -26,6 +29,8 @@ class VideoVideo < DomainModel
validate_on_create :ensure_file
+ before_save :update_keywords
+
named_scope(:by_category, Proc.new { |cat|
{:conditions => { :category => cat } }
@@ -102,7 +107,7 @@ def upload_video
end
def content_node_body(language)
- ((self.attributes.slice('name','created_at','category','description')).values + [ self.tag_names ]).join(" ")
+ ((self.attributes.slice('name','created_at','category','description','recipient','city')).values + [ self.tag_names ]).join(" ")
end
def content_description(language)
View
11 db/20111215192240_nameandcity.rb
@@ -0,0 +1,11 @@
+class Nameandcity < ActiveRecord::Migration
+ def self.up
+ add_column :video_videos, :recipient, :string
+ add_column :video_videos, :city, :string
+ end
+
+ def self.down
+ remove_column :video_videos, :recipient
+ remove_column :video_videos, :city
+ end
+end

0 comments on commit 99eeaa8

Please sign in to comment.
Something went wrong with that request. Please try again.