Sha256: 52e4dfe56f8cece80dc35199b0a9c437725e2d54aaa402681ab7405074d6b590
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
require_dependency "clipster/application_controller" module Clipster class ClipsController < ApplicationController def index create render 'create' end def list # get all clips, with the newest clip first # TODO: look into pagination and any other info @clips = Clip.where(:private => false).order('created_at DESC') end def create @clip = Clip.new(params[:clip]) #only do validation if something was actually posted. if !params[:clip].nil? && @clip.valid? @clip.save redirect_to @clip return #early return so we don't have else statement end # Get all languages we have syntax for and remove debugging languages. @languages = CodeRay::Scanners.all_plugins @languages.delete(CodeRay::Scanners::Raydebug) @languages.delete(CodeRay::Scanners::Debug) end def show @clip = Clip.find(params[:id]) cr_scanner = CodeRay.scan(@clip.clip, @clip.language) # Only show line numbers if its greater than 1 @clip_div = cr_scanner.div @clip_div = cr_scanner.div(:line_numbers => :table) unless cr_scanner.loc <= 1 end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
clipster-0.1.2 | app/controllers/clipster/clips_controller.rb |
clipster-0.1.1 | app/controllers/clipster/clips_controller.rb |
clipster-0.1.0 | app/controllers/clipster/clips_controller.rb |