update tag

This commit is contained in:
nccu 2014-11-11 10:55:21 +08:00
parent 527648da0a
commit 925001ca3f
7 changed files with 94 additions and 60 deletions

View File

@ -25,7 +25,7 @@ module PagesHelper
if wrap_elements.count > 0
htmls = widget_parsing_repeats_again(wrap_elements,d["#{data_name}"][i], level + 1)
htmls[0].each_with_index do |html,i|
element = element.gsub(html,htmls[1][i])
element = element.gsub(html,htmls[1][i])
end
end
item.each do |key,value|

View File

@ -29,14 +29,14 @@
<li class="i-category__item">
<a class="i-category__link" href="{{category-link}}">{{category-name}}</a>
</li>
</ul>
</ul>
</div>
<div class="i-tag-cloud">
<h3 class="i-tag-cloud__widget-title">{{tag-cloud-title}}</h3>
<div class="i-tag-cloud__list" data-level="0" data-list="tag-cloud">
<div class="i-tag-cloud">
<h3 class="i-tag-cloud__widget-title">{{tag-cloud-title}}</h3>
<div class="i-tag-cloud__list" data-level="0" data-list="tag-cloud">
<a href="{{tag-link}}" class="{{tag-class}}">{{tag-name}}</a>
</div>
</div>
</div>
<script type="text/javascript">

View File

@ -0,0 +1,22 @@
<!--
Announcement index-2
Fields: widget-title, date-head, title-head, postdate, title, pagination
-->
<div class="i-announcement annc-index-3 i-announcement--table">
<h3 class="i-announcement__widget-title">{{widget-title}}</h3>
<table class="i-announcement__table">
<tbody class="i-announcement__tbody" data-level="0" data-list="announcements">
<tr>
<td>
<a class="i-announcement__link i-announcement__td--link" href="{{link_to_show}}">{{title}}</a>
</td>
<td>
<span class="i-announcement__date i-announcement__td--postdate" date-format="%Y-%m-%d">{{postdate}}</span>
</td>
</tr>
</tbody>
</table>
</div>
{{pagination_goes_here}}
<div class="i-sidebar">
</div>

View File

@ -15,6 +15,14 @@
"en" : "2. Text without image (widget-title, postdate, title)"
},
"thumbnail" : "thumbnail-block-list.png"
},
{
"filename" : "annc_index3",
"name" : {
"zh_tw" : "3. 純文字無圖片(沒有sidebar) ( 模組標題, 日期, 標題 )",
"en" : "3. Text without image and no sidebar (widget-title, postdate, title)"
},
"thumbnail" : "thumbnail-block-list.png"
}
],
"widgets" : [

View File

@ -25,7 +25,7 @@ en:
zh_tw: Chinese
zh_tw_: Traditional Chinese
zh_cn: Simplified Chinese
_locale: English
_locale: English
access:
denied:
ajax_401_error: "User session has been expired,please login again."
@ -60,7 +60,7 @@ en:
transition_sec: Transition time
update_banner: Update Banner
upload_pictures: Upload pictures
widget_info_for_ad_image_size: "Best size with: %{best_size}"
widget_info_for_ad_image_size: "Uploading image ratio is 2:1 (image width:height), ex %{best_size}"
event_calendar: Event Calendar
add_attribute_field: Add attribute field
add_image: Add image
@ -120,7 +120,7 @@ en:
add_to_block_list: Add to block List
add_to_privilege_list: Add to privilege List
all_member: All Member
auth_by: Authorized by
auth_by: Authorized by
by_role: By Role
by_sub_role: By SubRole
author: Author
@ -159,7 +159,7 @@ en:
date:
calendar: Calendar Era
format: 格式
minguo_calendar:
minguo_calendar:
after: 民國
before: 民前
first_year: 民國元年
@ -180,27 +180,27 @@ en:
default_css: Default CSS
default_widget:
caption:
typeA:
typeB_style2:
typeB_style3:
typeB_style4:
typeC:
typeA:
typeB_style2:
typeB_style3:
typeB_style4:
typeC:
data_source:
category:
tag:
category:
tag:
default_widget: Default Widget
field_is_link:
fields_:
fields_order:
fields_style:
name:
no_support_setting:
no_value:
select_module_app:
select_widget_ext_option:
select_widget_path:
select_widget_style:
widget_data_count:
field_is_link:
fields_:
fields_order:
fields_style:
name:
no_support_setting:
no_value:
select_module_app:
select_widget_ext_option:
select_widget_path:
select_widget_style:
widget_data_count:
delete:
file: Delete file
success:
@ -229,7 +229,7 @@ en:
errors:
at_least_one: must at least have one value
field: Fields
file:
file:
size: File size
type: File type
upload: File upload
@ -241,10 +241,10 @@ en:
frequency: Frequency
front_page:
name_field_helper: Please enter a number or English, can not use a spacing
select_app_url:
is_published:
menu_enable_lang:
link_enable_lang:
select_app_url:
is_published:
menu_enable_lang:
link_enable_lang:
frontend_data_count: Frontend data count
gallery: Gallery
gallery:
@ -339,7 +339,7 @@ en:
select_announcement_categories: Select Announcement Categories
select_image: Select Image
select_orbit_bar_color: Select Orbit Bar Color
mobile_settings: Mobile Setting
mobile_settings: Mobile Setting
module: Module
modules: Modules
module_authorization: Module Authorization
@ -437,7 +437,7 @@ en:
rejected: Rejected
is_rejected: Rejected
rejected_reason: 'Reason:'
rejected_reason_empty: "Approval rejected, no referencable information"
rejected_reason_empty: "Approval rejected, no referencable information"
related_links: Related Links
role: Role
role_field: Role Field
@ -447,8 +447,8 @@ en:
rulingcom:
errors:
init:
app_page_noname:
module_app_noname:
app_page_noname:
module_app_noname:
save_and_close: Save and close
more: "More"
search:
@ -477,7 +477,7 @@ en:
sent_date: Sent Date
settings: Site Setting
site:
backend_openness_on: Backend Openness
backend_openness_on: Backend Openness
mobile_api_openness_on: Mobile API Openness
default_image: Site default image
description: Site description
@ -512,7 +512,7 @@ en:
system_preference: System Preference
system_preference_:
tab_backups: Backups
tab_commits: Commits
tab_commits: Commits
tab_summary: Summary
tab_logs: Logs
tab_send_reminders_log: Send reminders log
@ -522,7 +522,7 @@ en:
no_data: No Data
version: Version
weekness_report: Weekness Report
terms_of_use: Terms of Use
terms_of_use: Terms of Use
terms_of_use_content: Terms of Use Content
terms_display_in_footer: Display in footer
title: Site Title
@ -597,7 +597,7 @@ en:
update_at: Update at
update_manager: Update Manager
update_manager_:
available_updates: Available Updates
available_updates: Available Updates
check_update: Check Update
checking_update: Checking for Updates
system_update: Install Updates
@ -634,7 +634,7 @@ en:
category_auth: Category Authorization
authorization: Authorization
module_authorization: Module Authorization
users:
admin_change_password: You cannot change your own password here!
avatar: Profile Picture
@ -651,7 +651,7 @@ en:
new_password_note: At least 6 characters
new_password_confirmation: Confirm new password
female: Female
unknown: Information Not Available
unknown: Information Not Available
office_tel: Office Tel No.
office_tel_note: Public available
sid: ID No.
@ -660,16 +660,16 @@ en:
gender: Gender
user_id: User Account
user_id_note: Should be more than 3 characters and less than 50 characters
user_id_not_null: User account cannot be null
user_id_length: User account should be more than 3 characters
user_id_error: Someone already use that user account
user_id_not_null: User account cannot be null
user_id_length: User account should be more than 3 characters
user_id_error: Someone already use that user account
user_basic_id_form: Account Info.
user_basic_data: Personal Profile
address: Address
personal_website: Personal Website
autobiography: Autobiography
birthday: Birthday
version: Version
vertical: Vertical
view: View

View File

@ -39,7 +39,7 @@ zh_tw:
transition_sec: 轉場單位時間
update_banner: 更新輪播
upload_pictures: 上傳圖片
widget_info_for_ad_image_size: "此區塊圖片尺寸使用: %{best_size}"
widget_info_for_ad_image_size: "此區塊圖片尺寸使用比例為 2:1( 圖片寬:高 ),例如 %{best_size}"
ad_banner: 廣告輪播
ad_banner:
add: 新增
@ -98,7 +98,7 @@ zh_tw:
stat: 審核狀態
user_list: 使用者列表
approval_: 審核
approval_setting: 審核設定
approval_setting: 審核設定
asset: 資產
attributes: 屬性
auth:

View File

@ -10,29 +10,33 @@ module OrbitTag
module ClassMethods
def with_tags(tags=[])
tags = [tags].flatten.uniq
result = []
# result = []
if tags.blank?
self.all
else
self.all.each do |taggable|
result << taggable if (taggable.taggings.map{|t| t.tag.id.to_s } & tags).size > 0
end
self.where(:id.in=>result.map{|taggable| taggable.id})
# self.all.each do |taggable|
# result << taggable if (taggable.taggings.map{|t| t.tag.id.to_s } & tags).size > 0
# end
# self.where(:id.in=>result.map{|taggable| taggable.id})
taggings = Tagging.where(:tag_id.in=>tags).map{|item| item.taggable_id}
self.where(:id.in=>taggings)
end
end
def filter_by_tags(tags=[])
tags = OrbitHelper.page_tags if tags.blank?
tags = [tags].flatten.uniq
result = []
# result = []
if tags.blank? or (tags.include?("all") rescue false)
self.all
else
self.all.each do |taggable|
result << taggable if (taggable.taggings.map{|t| t.tag.id.to_s } & tags).size > 0
end
self.where(:id.in=>result.map{|taggable| taggable.id})
# self.all.each do |taggable|
# result << taggable if (taggable.taggings.map{|t| t.tag.id.to_s } & tags).size > 0
# end
# self.where(:id.in=>result.map{|taggable| taggable.id})
taggings = Tagging.where(:tag_id.in=>tags).map{|item| item.taggable_id}
self.where(:id.in=>taggings)
end
end