announcemenet & web_resource widget
This commit is contained in:
1 parent
e61aa6b210
commit
5da75161c4
12 files changed
+114
-26
No files matched your search
+5
-5
@@ -12,7 +12,7 @@ class Panel::WebResource::BackEnd::WebLinksController < ApplicationController
|
||||
|
||||
@web_links = WebLink.search(params[:category_id])
|
||||
|
||||
get_tags()
|
||||
get_tags
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
@@ -37,9 +37,9 @@ class Panel::WebResource::BackEnd::WebLinksController < ApplicationController
|
||||
def new
|
||||
@web_link = WebLink.new
|
||||
|
||||
get_tags()
|
||||
|
||||
get_categorys
|
||||
|
||||
get_tags
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
@@ -51,7 +51,7 @@ class Panel::WebResource::BackEnd::WebLinksController < ApplicationController
|
||||
def edit
|
||||
@web_link = WebLink.find(params[:id])
|
||||
get_categorys
|
||||
get_tags()
|
||||
get_tags
|
||||
end
|
||||
|
||||
# POST /web_links
|
||||
@@ -113,7 +113,7 @@ class Panel::WebResource::BackEnd::WebLinksController < ApplicationController
|
||||
@web_link_categorys = (id ? WebLinkCategory.find(id).to_a : WebLinkCategory.excludes('disabled' => true))
|
||||
end
|
||||
|
||||
def get_tags()
|
||||
def get_tags
|
||||
module_app = ModuleApp.first(:conditions => {:key => 'web_resource'})
|
||||
@tags = Tag.all(:conditions => {:module_app_id => module_app.id})
|
||||
end
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
class Panel::WebResource::Widget::WebLinksController < ObitWidgetController
|
||||
|
||||
def initialize
|
||||
super
|
||||
@app_title = NewBlog::MOUDLEAPP_TITLE
|
||||
end
|
||||
|
||||
# GET /web_links
|
||||
# GET /web_links.xml
|
||||
|
||||
def index
|
||||
|
||||
# deadline
|
||||
|
||||
@web_link = WebLink.where( :is_hidden => false ).desc(:is_top, :name).first
|
||||
|
||||
@web_links = WebLink.widget_datas
|
||||
|
||||
get_categorys
|
||||
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
||||
def get_categorys
|
||||
@web_link_categorys = WebLinkCategory.excludes('disabled' => true)
|
||||
end
|
||||
|
||||
def get_tags
|
||||
module_app = ModuleApp.first(:conditions => {:key => 'web_resource'})
|
||||
@tags = Tag.all(:conditions => {:module_app_id => module_app.id})
|
||||
end
|
||||
|
||||
end
|
||||
@@ -42,13 +42,7 @@ class WebLink
|
||||
|
||||
def self.widget_datas
|
||||
|
||||
date_now = Time.now
|
||||
|
||||
# find(:all, :conditions => {:postdate => {"$lte" => Date.today}, deadline: nil} ).desc( :is_top, :name)
|
||||
where( :is_hidden => false ).desc(:is_top, :name)
|
||||
# any_of({ :name => "test" },{:deadline => nil, :name => "123"})
|
||||
# any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :name)
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
<% # encoding: utf-8 %>
|
||||
|
||||
<% if @web_links and !@web_links.nil? %>
|
||||
|
||||
<div class="links_block">
|
||||
<h3 class="links_title"><%= t('相關連結')%></h3>
|
||||
<ul class="links_list">
|
||||
<% @web_links.each do |post| %>
|
||||
<li><%= link_to post.name[I18n.locale], post.url, {:target => '_blank', :title => post.name[I18n.locale]} %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
+1
-1
@@ -15,7 +15,7 @@ Rails.application.routes.draw do
|
||||
resources :web_links
|
||||
end
|
||||
namespace :widget do
|
||||
root :to => "web_links#index"
|
||||
match "web_links" => "web_links#index"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,5 +7,6 @@
|
||||
"update_info": "Some info",
|
||||
"create_date": "11-11-2011",
|
||||
"app_pages": ["web_links"],
|
||||
"widgets": ["web_links"],
|
||||
"enable_frontend": true
|
||||
}
|
||||
Reference in new issue
Block a user