Sha256: b089a0be630b3ca26ffc1c37d397704f9c6b96d007aab03c48d32e203e361ba1

Contents?: true

Size: 507 Bytes

Versions: 9

Compression:

Stored size: 507 Bytes

Contents

module Admin
  module Posts
    class TagsController < Admin::ApplicationController

      def index
        @post = Admin::Post.find(params[:post_id])
        @tags = Admin::Tag.all
      end

      def toggle
        @post = Admin::Post.find(params[:post_id])
        @tag = Admin::Tag.find(params[:tag_id])
        if @post.tags.include? @tag
          @post.tags = @post.tags.where.not(id: @tag.id)
        else
          @post.tags << @tag
        end

        @post.save!
      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ecrire-0.28.3 lib/ecrire/app/controllers/admin/posts/tags_controller.rb
ecrire-0.28.2 lib/ecrire/app/controllers/admin/posts/tags_controller.rb
ecrire-0.28.1 lib/ecrire/app/controllers/admin/posts/tags_controller.rb
ecrire-0.28.0 lib/ecrire/app/controllers/admin/posts/tags_controller.rb
ecrire-0.27.0 lib/ecrire/app/controllers/admin/posts/tags_controller.rb
ecrire-0.26.3 lib/ecrire/app/controllers/admin/posts/tags_controller.rb
ecrire-0.26.2 lib/ecrire/app/controllers/admin/posts/tags_controller.rb
ecrire-0.26.1 lib/ecrire/app/controllers/admin/posts/tags_controller.rb
ecrire-0.26.0 lib/ecrire/app/controllers/admin/posts/tags_controller.rb