Add list widgets for announcement, news and links with categories and tags
This commit is contained in:
1 parent
9a6b66c57d
commit
13587306bc
21 files changed
+199
-180
No files matched your search
+16
@@ -8,7 +8,23 @@ class Panel::WebResource::Widget::WebLinksController < OrbitWidgetController
|
||||
# GET /web_links
|
||||
# GET /web_links.xml
|
||||
|
||||
|
||||
def index
|
||||
if !params[:category_id].blank?
|
||||
@web_links = WebLink.where(:web_link_category => params[:category_id]).desc( :is_top, :postdate).page( params[:page]).per(10)
|
||||
@current_category = WebLinkCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@tag = WebResourceTag.find(params[:tag_id]) rescue nil
|
||||
@tag = WebResourceTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@web_links = @tag.web_links.desc( :is_top, :postdate).page( params[:page]).per(10)
|
||||
else
|
||||
@web_links = WebLink.all.desc( :is_top, :postdate).page( params[:page]).per(10)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
def home_list
|
||||
|
||||
# deadline
|
||||
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<h3 class="link_title"><%= t("announcement.related_links") %></h3>
|
||||
|
||||
<div id='web_links_links'>
|
||||
<%= render 'web_links' %>
|
||||
</div>
|
||||
Vendored
+25
-4
@@ -1,5 +1,26 @@
|
||||
<h3 class="link_title"><%= t("announcement.related_links") %></h3>
|
||||
<% if @current_category %>
|
||||
<h1 class="h1"><%= @current_category.i18n_variable[I18n.locale] + " " + t('web_resource.list_lower') %></h1>
|
||||
<% elsif @tag %>
|
||||
<h1 class="h1"><%= @tag[I18n.locale] + " " + t('web_resource.list_lower') %></h1>
|
||||
<% else %>
|
||||
<h1 class="h1"><%= t('web_resource.list_link') %></h1>
|
||||
<% end %>
|
||||
|
||||
<div id='web_links_links'>
|
||||
<%= render 'web_links' %>
|
||||
</div>
|
||||
<table class="table table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><%= t('web_resource.category') %></th>
|
||||
<th><%= t('web_resource.name') %></th>
|
||||
</tr>
|
||||
<% @web_links.each do |post| %>
|
||||
<tr>
|
||||
<td><%= post.web_link_category.i18n_variable[I18n.locale] %></td>
|
||||
<td>
|
||||
<%= link_to post.name[I18n.locale], post.url, {:target => '_blank', :title => post.name[I18n.locale]} %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= paginate @web_links, :params => {:inner => 'false'} %>
|
||||
@@ -25,6 +25,12 @@ en:
|
||||
|
||||
announcement:
|
||||
sure?: Sure?
|
||||
|
||||
|
||||
web_resource:
|
||||
list_lower: list
|
||||
list_link: Links list
|
||||
|
||||
|
||||
# admin:
|
||||
# action: Action
|
||||
|
||||
@@ -18,102 +18,9 @@ zh_tw:
|
||||
update: 更新
|
||||
yes_: "Yes"
|
||||
|
||||
admin:
|
||||
action: 行動
|
||||
add_language: 新增語言
|
||||
admin: 管理
|
||||
action: 行動
|
||||
announcement: 公告
|
||||
asset: 資產
|
||||
attributes: 屬性
|
||||
cant_delete_self: 您不可以刪除自己。
|
||||
cant_revoke_self_admin: 您不可以撤銷自己的管理作用。
|
||||
class: 階級
|
||||
content: 內容
|
||||
create_error_link: 創建連接時出錯。
|
||||
create_error_page: 創建頁面時出錯。
|
||||
create_success_home: 首頁已成功創建。
|
||||
create_success_layout: 樣板已成功創建。
|
||||
create_success_link: 連結已成功創建。
|
||||
create_success_page: 頁面已成功創建。
|
||||
create_success_snippet: 片段已成功創建
|
||||
create_success_user: 用戶已成功創建。。
|
||||
data: 數據
|
||||
delete_language: 刪除語言
|
||||
description: 描述
|
||||
disable_language: 禁用語言
|
||||
editing_home: 編輯首頁
|
||||
editing_layout: 編輯樣板
|
||||
editing_link: 編輯連結
|
||||
editing_page: 編輯頁面
|
||||
editing_snippet: 編輯片段
|
||||
editing_user_info: 編輯用戶資料
|
||||
editing_user_role: 編輯用戶角色
|
||||
email: Email
|
||||
enable_language: 啟用語言
|
||||
file_name: 檔名
|
||||
file_size: 檔案大小
|
||||
format: 格式
|
||||
home: 首頁
|
||||
id: ID
|
||||
info: 資料
|
||||
is_published: 被出版
|
||||
item: 項目
|
||||
key: 關鍵
|
||||
language: 語言
|
||||
layout: 佈局
|
||||
layout_name: 佈局名字
|
||||
list_assets: 資產清單
|
||||
list_items: 項目清單
|
||||
list_layouts: 佈局清單
|
||||
list_snippets: 斷片清單
|
||||
list_users: 使用清單
|
||||
list_user_infos: 用戶資料清單
|
||||
list_user_roles: 用戶角色清單
|
||||
member: 會員
|
||||
move_down: 往下移
|
||||
move_up: 往上移
|
||||
multilingual: 多種語言
|
||||
my_avatar: 我的頭像
|
||||
no_home_page: 您沒有首頁
|
||||
no_layout: 您沒有佈局
|
||||
name: 名稱
|
||||
new_asset: 新增資產
|
||||
new_component: 新增元件
|
||||
new_home: 新增首頁
|
||||
new_layout: 新增樣板
|
||||
new_link: 新增連結
|
||||
new_page: 新增頁面
|
||||
new_snippet: 新增片段
|
||||
new_user: 新增使用
|
||||
new_user_info: 新增用戶資料
|
||||
new_user_role: 新增用戶角色
|
||||
non_multilingual: 非多種語言
|
||||
options: 選項
|
||||
orig_upload_file: 原上傳檔名
|
||||
position: 位置
|
||||
published?: 發布?
|
||||
role: 角色
|
||||
roles: 角色。
|
||||
title: 標題
|
||||
translation: 翻譯
|
||||
type: 類型
|
||||
update_error_link: 更新鏈接時出現錯誤。
|
||||
update_error_page: 更新頁面時出現錯誤。
|
||||
update_success_content: 內容已成功更新。
|
||||
update_success_home: 首頁已成功更新。
|
||||
update_success_layout: 樣板已成功更新。
|
||||
update_success_link: 連結已成功更新。
|
||||
update_success_page: 頁面已成功更新。
|
||||
update_success_snippet: 片段已成功更新。
|
||||
update_success_user: 用戶已成功更新
|
||||
url: URL
|
||||
user: 用戶
|
||||
user_info: 用戶資料
|
||||
user_panel: 用戶面板
|
||||
user_role: 用戶角色
|
||||
|
||||
panel:
|
||||
web_resource:
|
||||
list_lower: 列表
|
||||
list_link: 鏈接列表
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ Rails.application.routes.draw do
|
||||
end
|
||||
namespace :widget do
|
||||
match "web_links" => "web_links#index"
|
||||
match "home_list" => "web_links#home_list"
|
||||
match "reload_web_links" => "web_links#reload_web_links"
|
||||
end
|
||||
end
|
||||
|
||||
+1
-1
@@ -7,6 +7,6 @@
|
||||
"update_info": "Some info",
|
||||
"create_date": "11-11-2011",
|
||||
"app_pages": ["web_links"],
|
||||
"widgets": ["web_links"],
|
||||
"widgets": ["web_links", "home_list"],
|
||||
"enable_frontend": true
|
||||
}
|
||||
Reference in new issue
Block a user