Announcement modifications and tags

This commit is contained in:
Christophe Vilayphiou committed 2012-02-15 00:34:22 +08:00
1 parent f57e9f19f7
commit 3e70634add
38 files changed
+615 -143

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
class Admin::TagsController < ApplicationController
layout 'new_admin'
before_filter :authenticate_user!
before_filter :is_admin?
before_filter :set_module_app
def index
get_tags
@module_app_id = @module_app.id rescue nil
end
def new
end
def edit
@tag = Tag.find(params[:id])
end
def create
@tag = Tag.create(params[:tag])
end
def update
@tag = Tag.find(params[:id])
@tag.update_attributes(params[:tag])
end
def destroy
@tag = Tag.find(params[:id])
@tag.destroy
respond_to do |format|
format.js { render 'js/remove_element', :locals => {:id => "#{dom_id @tag}"} }
end
end
protected
def set_module_app
@module_app ||= ModuleApp.first(:conditions => {:key => @app_title.underscore}) rescue nil
end
def get_tags
@tags = (@module_app ? @module_app.tags : Tag.all)
end
end