0
-Use this README file to introduce your application and point to useful places in the API for learning more.
0
-Run "rake appdoc" to generate API documentation for your models and controllers.
0
\ No newline at end of file
0
+=Integration With LoveByLess=
0
+LoveByLess is an opensource SNS framework. We can easily integrate Ankoder with it, make it more fun.
0
+==Download and Install LoveByLess=
0
+==Install Ankoder Plugin==
0
+script/generate model video name:string description:text public:boolean location:string profile_id:integer
0
+Modify app/model/profile.rb, add:
0
+has_many :videos, :order => 'created_at DESC'
0
+Modify app/model/video.rb:
0
+class Video < ActiveRecord::Base
0
+ has_many :comments, :as => :commentable, :dependent => :destroy, :order => 'created_at ASC'
0
+ validates_presence_of :name, :profile_id
0
+ feed_item = FeedItem.create(:item => self)
0
+ ([profile] + profile.friends + profile.followers).each{ |p| p.feed_items << feed_item }
0
+==Create Video Controller==
0
+script/generate controller videos
0
+Modify app/controller/videos_controller:
0
+class VideosController < ApplicationController
0
+ skip_filter :login_required
0
+ prepend_before_filter :get_profile
0
+ want.rss {render :layout => false}
0
+ redirect_to profile_videos_path(@profile)
0
+ @video = @p.videos.build params[:video]
0
+ flash[:notice] = 'Video successfully uploaded'
0
+ redirect_to profile_videos_path(@p)
0
+ flash.now[:error] = 'Video could not be uploaded'
0
+ render :action => :index
0
+ @profile = Profile[params[:profile_id] || params[:id]]
0
+ @videos = @profile.videos.paginate(:all, :page => @page, :per_page => @per_page)
0
+==Create HTML Views for Video Controller==
0
+Create app/views/videos/index.html.erb:
0
+<% content_for :head do -%>
0
+<%= auto_discovery_link_tag :rss, formatted_profile_videos_url(@profile, :rss), :title=>"#{@profile.f}'s Videos" %>
0
+<%= render :partial => 'videos/gallery' %>
0
+Create app/views/videos/index.rss.builder:
0
+xml.instruct! :xml, :version=>"1.0"
0
+xml.rss(:version=>"2.0") do
0
+ xml.title "#{@profile.f}'s Blog"
0
+ xml.description "#{@profile.f}'s Blog at #{SITE_NAME}"
0
+ @videos.each do |video|
0
+ xml.description "<a href=\"#{profile_video_url(@profile, video)}\" title=\"#{video.caption}\" alt=\"#{video.caption}\" class=\"thickbox\" rel=\"user_gallery\">#{image video, :small}</a>" + video.caption
0
+ xml.author "#{@profile.f}"
0
+ xml.pubDate @profile.created_at
0
+ xml.link profile_video_url(@profile, video)
0
+ xml.guid profile_video_url(@profile, video)
0
+Create app/views/videos/_gallery.html.erb:
0
+Create app/views/videos/_form.html.erb:
0
+<div id="upload_a_video">
0
+ <h2>Upload A Video</h2>
0
+ <% less_form_for [@p,@video], :html => {:multipart=>true} do |f| %>
0
+ <%= f.wrap(:image, :label => 'Video: '){file_column_field "video", "location", :size => 15} %>
0
+ <%= f.text_field :name %>
0
+ <%= f.text_area :description %>
0
+ <div class="row button">
0
+ <%= f.submit 'Upload Video', :class=>"button" %>
0
+ <div class="clear"></div>
0
+Create app/views/video/_video.html.erb:
0
+<div class="left image">
0
+ <a href="<%= profile_video_path(video.profile, video) %>" title="<%= video.name %>" alt="<%= video.name %>" class="thickbox" rel="user_gallery"><%= video.name %></a>
0
+ <%= link_to '(delete)', profile_video_path(video.profile, video), :method => :delete if me %>
0
+Modify app/views/profiles/_private.html.erb, add this line:
0
+<%= link_to 'Manage Videos', profile_videos_path(@p) %>
0
+Modify config/routes.rb, add :photos in profiles resource:
0
+ map.resources :profiles,
0
+ :member=>{:delete_icon=>:post}, :collection=>{:search=>:get},
0
+ :has_many=>[:friends, :blogs, :photos, :videos, :comments, :feed_items, :messages]
Comments
No one has commented yet.