class SystemMessagesController < ApplicationController # before_filter :message_author, :only => [:show] # # def message_author # if(!User.current.logged? && !token.nil?) # # User.current =try_to_autologin1 # end # if @system_messages # render_403 :message => :notice_not_authorized_message # else # deny_access # end # end def index @system_messages = SystemMessage.all end # def show # @system_messages = SystemMessage.find(params[:id]) # end # GET /products/new # def new # @product = Product.new # end # GET /products/1/edit # def edit # end # POST /products # POST /products.json def create unless User.current.admin? render_403 return end @system_messages = SystemMessage.new @system_messages.description = params[:system_message][:description] @system_messages.user_id = User.current.id respond_to do |format| if @system_messages.save format.html {redirect_to user_message_path(User.current, :type => "system_messages")} flash[:notice] = l(:notice_successful_message) else if params[:system_messages][:description].empty? flash[:error] = l(:label_content_blank_fail) else flash[:error] = l(:label_admin_message_fail) end format.html {redirect_to admin_messages_path} end end end # PATCH/PUT /products/1 # PATCH/PUT /products/1.json # def update # respond_to do |format| # if @product.update(product_params) # format.html { redirect_to @product, notice: 'Product was successfully updated.' } # format.json { render :show, status: :ok, location: @product } # else # format.html { render :edit } # format.json { render json: @product.errors, status: :unprocessable_entity } # end # end # end # DELETE /products/1 # DELETE /products/1.json # def destroy # @system_messages.destroy # respond_to do |format| # format.html { redirect_to products_url, notice: 'Product was successfully destroyed.' } # format.json { head :no_content } # end # end # private # # Use callbacks to share common setup or constraints between actions. # def set_product # @product = Product.find(params[:id]) # end # # # Never trust parameters from the scary internet, only allow the white list through. # def message_params # params.require(:admin_system_messages).permit(:content) # end end