app/controllers/stachio/templates_controller.rb in stachio-0.0.2 vs app/controllers/stachio/templates_controller.rb in stachio-0.0.3
- old
+ new
@@ -1,9 +1,13 @@
require_dependency "stachio/application_controller"
module Stachio
class TemplatesController < ApplicationController
+
+ before_filter :permission
+ skip_before_filter :permission, :only => [:index, :show]
+
# GET /templates
# GET /templates.json
def index
@templates = Template.all
@@ -80,8 +84,16 @@
respond_to do |format|
format.html { redirect_to templates_url }
format.json { head :no_content }
end
+ end
+
+ private
+
+ def permission
+ return true unless readonly
+ flash[:notice] = "Templates are readonly"
+ redirect_to :action => :index
end
end
end