class Admin::TextMarqueesController < OrbitAdminController def index @tags = @module_app.tags uac = @module_app.categories.enabled.authorized(current_user) if @user_authorized_categories.nil? categories = @module_app.categories.enabled @filter_fields = filter_fields(categories, @tags) @categories = uac.collect{|c|[c.title, c.id]} @table_fields = [:title, :category] @marquees = Marquee.where(:title.ne => "") .order_by(sort) .with_categories(filters("category")) .with_tags(filters("tag")) @marquees = @marquees.page(params[:page]).per(10) if request.xhr? render :partial => "index" end end def create marquee = Marquee.new(marquee_variables) marquee.save end def update marquee = Marquee.find(params[:id]) marquee.update_attributes(marquee_variables) marquee.save end def show @table_fields = [:title, :link] @marquee = Marquee.find(params[:id]) end def destroy marquee = Marquee.find(params[:id]) marquee.destroy redirect_to admin_text_marquees_path end def newtext @marquee = Marquee.find(params[:text_marquee_id]) @marquee_text = MarqueeText.new end def edittext @marquee_text = MarqueeText.find(params[:text_marquee_id]) @marquee = @marquee_text.marquee end def deletetext marquee_text = MarqueeText.find(params[:text_marquee_id]) marquee = marquee_text.marquee marquee_text.destroy redirect_to admin_text_marquee_path(marquee) end def createtext @marquee = Marquee.find(params[:text_marquee_id]) marquee_text = MarqueeText.new(marquee_text_variables) marquee_text.marquee = @marquee.id marquee_text.save redirect_to admin_text_marquee_path(@marquee) end def updatetext marquee_text = MarqueeText.find(params[:text_marquee_id]) marquee_text.update_attributes(marquee_text_variables) marquee_text.save redirect_to admin_text_marquee_path(marquee_text.marquee) end private def marquee_variables params.require(:marquee).permit! end def marquee_text_variables params.require(:marquee_text).permit! end end