|
|
|
@ -1,23 +1,32 @@
|
|
|
|
|
class AsciicastsController < ApplicationController
|
|
|
|
|
PER_PAGE = 20
|
|
|
|
|
|
|
|
|
|
before_filter :load_resource, :only => [:edit, :update, :destroy]
|
|
|
|
|
before_filter :load_resource, :only => [:show, :edit, :update, :destroy]
|
|
|
|
|
before_filter :ensure_authenticated!, :only => [:edit, :update, :destroy]
|
|
|
|
|
before_filter :ensure_owner!, :only => [:edit, :update, :destroy]
|
|
|
|
|
|
|
|
|
|
respond_to :html, :json
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
|
@asciicasts = Asciicast.
|
|
|
|
|
order("created_at DESC").
|
|
|
|
|
page(params[:page]).
|
|
|
|
|
per(PER_PAGE)
|
|
|
|
|
collection = Asciicast.
|
|
|
|
|
order("created_at DESC").
|
|
|
|
|
page(params[:page]).
|
|
|
|
|
per(PER_PAGE)
|
|
|
|
|
|
|
|
|
|
@asciicasts = AsciicastDecorator.decorate(collection)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def show
|
|
|
|
|
@asciicast = AsciicastDecorator.find(params[:id])
|
|
|
|
|
@title = @asciicast.smart_title
|
|
|
|
|
respond_with @asciicast.model
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.html do
|
|
|
|
|
@asciicast = AsciicastDecorator.new(@asciicast)
|
|
|
|
|
@title = @asciicast.smart_title
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
format.json do
|
|
|
|
|
respond_with @asciicast
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def edit
|
|
|
|
|