chris tags update

This commit is contained in:
Matthew K. Fu JuYuan committed 2013-04-26 11:26:10 +08:00
1 parent 2945e14385
commit d047a3d62a
102 files changed
+3111 -378

No files matched your search

@@ -36,7 +36,7 @@ class Panel::WebResource::BackEnd::WebLinksController < OrbitBackendController
#@web_links = (params[:sort] || @filter) ? get_sorted_and_filtered_web_links : WebLink.all.page(params[:page]).per(10)
@web_links = (params[:sort] || @filter) ? get_sorted_and_filtered("web_link",:web_link_category_id.in => @web_link_category_ids) : get_viewable("web_link",:web_link_category_id.in => @web_link_category_ids)
get_tags
@tags = get_tags
respond_to do |format|
format.html # index.html.erb
@@ -59,7 +59,7 @@ class Panel::WebResource::BackEnd::WebLinksController < OrbitBackendController
# GET /web_links/new.xml
def new
@web_link = WebLink.new
get_tags
@tags = get_tags
respond_to do |format|
format.html # new.html.erb
@@ -70,14 +70,14 @@ class Panel::WebResource::BackEnd::WebLinksController < OrbitBackendController
# GET /web_links/1/edit
def edit
@web_link = WebLink.find(params[:id])
get_tags
@tags = get_tags
end
# POST /web_links
# POST /web_links.xml
def create
@web_link = WebLink.new(params[:web_link])
get_tags
@tags = get_tags
@web_link.create_user_id = current_user.id
@web_link.update_user_id = current_user.id
@@ -160,9 +160,4 @@ class Panel::WebResource::BackEnd::WebLinksController < OrbitBackendController
# end
# end
def get_tags
module_app = ModuleApp.first(:conditions => {:key => 'web_resource'})
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}) rescue []
end
end
@@ -4,13 +4,15 @@ class WebLink
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes
include OrbitTag::Taggable
taggable
scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
field :title, localize: true
field :context, localize: true
has_and_belongs_to_many :tags, :class_name => "WebResourceTag"
#has_and_belongs_to_many :tags, :class_name => "WebResourceTag"
field :url, localize: true
field :create_user_id
@@ -39,7 +39,7 @@
<% @tags.each do |tag| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'web_link[tag_ids][]', tag.id, @web_link.tag_ids.include?(tag.id)%>
<%= tag[I18n.locale] %>
<%= tag.name %>
<%= hidden_field_tag 'web_link[tag_ids][]', '' %>
<% end %>
<% end %>
@@ -36,7 +36,7 @@
<div class="label-group">
<div class="label-td">
<% web_link.sorted_tags.each do |tag| %>
<span class="label label-tags"><%= tag[I18n.locale] %></span>
<span class="label label-tags"><%= tag.name %></span>
<% end %>
</div>
</div>
+1 -1
View File
@@ -57,7 +57,7 @@ module WebResource
:available_for => [:manager]
context_link 'tags',
:link_path=>"panel_web_resource_back_end_tags_path" ,
:link_path=>"admin_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'WebResource'}))" ,
:priority=>4,
# :active_for_action=>{:bulletin_categorys=>:index},
:available_for => [:manager]