Class: ComicController
- Inherits:
-
CartoonistController
- Object
- CartoonistController
- ComicController
- Defined in:
- app/controllers/comic_controller.rb
Instance Method Summary collapse
Instance Method Details
#feed ⇒ Object
45 46 47 |
# File 'app/controllers/comic_controller.rb', line 45 def feed respond_to_feed "feed" end |
#index ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 |
# File 'app/controllers/comic_controller.rb', line 2 def index @comic = Comic.current @disabled_prev = true if @comic.oldest? @disabled_next = true @title = Setting[:site_name] cache_page_as "comic.#{cache_type}.tmp.html" do render :show cache_page_as ".#{cache_type}.tmp.html" if Cartoonist::RootPath.current_key == :comics end end |
#mfeed ⇒ Object
49 50 51 |
# File 'app/controllers/comic_controller.rb', line 49 def mfeed respond_to_feed "mfeed" end |
#random ⇒ Object
14 15 16 |
# File 'app/controllers/comic_controller.rb', line 14 def random redirect_to "/comic/#{rand(max_comic) + 1}" end |
#show ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/comic_controller.rb', line 18 def show respond_to do |format| format.html do begin return redirect_to "/comic/1" if params[:id].to_i < 1 @comic = Comic.from_number params[:id], true @disabled_prev = true if @comic.oldest? @disabled_next = @comic.maybe_newest? cache_page_as show_page_cache_path do render end rescue redirect_to "/comic" end end format.png do comic = Comic.from_number params[:id], true cache_page_as "static/comic/#{comic.number}.png" do send_data comic.database_file.content, :filename => "comic_#{comic.number}.png", :type => "image/png", :disposition => "inline" end end end end |