diff --git a/app/views/admin/designs/new.html.erb b/app/views/admin/designs/new.html.erb
index 2b67b2e9..61c6868a 100644
--- a/app/views/admin/designs/new.html.erb
+++ b/app/views/admin/designs/new.html.erb
@@ -1,3 +1,7 @@
+<% content_for :side_bar do %>
+ <%= render 'admin/sites/side_bar' %>
+<% end %>
+
<%= t('admin.new_design') %>
<%= form_for :design, :url => admin_designs_path, :html => {:multipart => true} do |f| %>
diff --git a/app/views/admin/designs/upload_package.html.erb b/app/views/admin/designs/upload_package.html.erb
index 0c07de1e..9dc0efa9 100644
--- a/app/views/admin/designs/upload_package.html.erb
+++ b/app/views/admin/designs/upload_package.html.erb
@@ -1,3 +1,7 @@
+<% content_for :side_bar do %>
+ <%= render 'admin/sites/side_bar' %>
+<% end %>
+
<%= form_tag '',:multipart => true,:action=>"post" do |f| %>
diff --git a/app/views/admin/items/_site_map_left_bar.html.erb b/app/views/admin/items/_site_map_left_bar.html.erb
index 8d32365f..6307e5aa 100644
--- a/app/views/admin/items/_site_map_left_bar.html.erb
+++ b/app/views/admin/items/_site_map_left_bar.html.erb
@@ -1 +1,6 @@
-<%= render_node_and_children(Item.first(:conditions => {:parent_id => nil})) %>
+
+ <%= render_node_and_children(Item.first(:conditions => {:parent_id => nil})) %>
+
+
\ No newline at end of file
diff --git a/app/views/admin/items/index.js.erb b/app/views/admin/items/index.js.erb
index 8dc86088..1ff6abb5 100644
--- a/app/views/admin/items/index.js.erb
+++ b/app/views/admin/items/index.js.erb
@@ -1,9 +1,7 @@
$('#back_main').empty();
-switch ("<%= escape_javascript(@item._type)%>") {
- case 'Link':
- $('#back_main').append("<%= escape_javascript(render(:partial => 'admin/links/show')) %>");
- break;
- case 'Page':
+<% case @item._type %>
+ <% when 'Page' %>
$('#back_main').append("<%= escape_javascript(render(:partial => 'admin/pages/show')) %>");
- break;
-};
\ No newline at end of file
+ <% when 'Link' %>
+ $('#back_main').append("<%= escape_javascript(render(:partial => 'admin/links/show')) %>");
+<% end %>
\ No newline at end of file
diff --git a/app/views/admin/links/delete.js.erb b/app/views/admin/links/delete.js.erb
index b1739526..8ea2a642 100644
--- a/app/views/admin/links/delete.js.erb
+++ b/app/views/admin/links/delete.js.erb
@@ -1 +1,3 @@
-$('#back_sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>");
\ No newline at end of file
+$('#back_sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>");
+$('#back_main').html("<%= escape_javascript(render(:partial => 'admin/pages/show')) %>");
+history.pushState(null, document.title, "<%= escape_javascript(admin_items_url) %>");
\ No newline at end of file
diff --git a/app/views/admin/pages/_new.html.erb b/app/views/admin/pages/_new.html.erb
index ecbda3de..bba5ad50 100644
--- a/app/views/admin/pages/_new.html.erb
+++ b/app/views/admin/pages/_new.html.erb
@@ -4,7 +4,7 @@
<%= form_for @item, :url => admin_pages_path, :html => { :class => 'form-horizontal edit_page' } do |f| %>
<%= render :partial => "form", :locals => { :f => f } %>
- <%= f.submit t('update'), :class => 'btn btn-primary' %>
+ <%= f.submit t('create'), :class => 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
<% end %>
diff --git a/app/views/admin/pages/delete.js.erb b/app/views/admin/pages/delete.js.erb
index b1739526..8ea2a642 100644
--- a/app/views/admin/pages/delete.js.erb
+++ b/app/views/admin/pages/delete.js.erb
@@ -1 +1,3 @@
-$('#back_sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>");
\ No newline at end of file
+$('#back_sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>");
+$('#back_main').html("<%= escape_javascript(render(:partial => 'admin/pages/show')) %>");
+history.pushState(null, document.title, "<%= escape_javascript(admin_items_url) %>");
\ No newline at end of file
diff --git a/app/views/admin/sites/_side_bar.html.erb b/app/views/admin/sites/_side_bar.html.erb
index 1ad8ae43..1b6b8ba4 100644
--- a/app/views/admin/sites/_side_bar.html.erb
+++ b/app/views/admin/sites/_side_bar.html.erb
@@ -10,3 +10,7 @@
<% end -%>
<% end -%>
+
+<%= content_tag :li, :class => active_for_controllers('designs') do -%>
+ <%= link_to content_tag(:i, nil, :class => 'icons-window-block') + t('admin.design'), admin_designs_path %>
+<% end -%>
diff --git a/app/views/kaminari/_gap.html.erb b/app/views/kaminari/_gap.html.erb
index 8807aafe..c680799d 100644
--- a/app/views/kaminari/_gap.html.erb
+++ b/app/views/kaminari/_gap.html.erb
@@ -5,4 +5,4 @@
per_page: number of items to fetch per page
remote: data-remote
-%>
-
<%= raw(t 'views.pagination.truncate') %>
+
diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb
index ab5981a8..c5719fce 100644
--- a/app/views/layouts/_side_bar.html.erb
+++ b/app/views/layouts/_side_bar.html.erb
@@ -26,7 +26,7 @@
<%= content_tag :li, link_to(t('announcement.add_new'), new_panel_news_back_end_news_bulletin_path), :class => active_for_action('news_bulletins', 'new') %>
<%= content_tag :li, link_to(t('announcement.categories'), panel_news_back_end_news_bulletin_categorys_path), :class => active_for_action('news_bulletin_categorys', 'index') || active_for_ob_auths_object("NewsBulletinCategory") %>
<%= content_tag :li, link_to(t('announcement.tags'), panel_news_back_end_tags_path), :class => active_for_action('/panel/news/back_end/tags', 'index') %>
- <%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_news_back_end_news_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue nil) %>
+ <%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_news_back_end_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue nil) %>
<%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "news"}))), :class => active_for_app_auth('news') if (is_admin? rescue nil) %>
<% end -%>
@@ -45,10 +45,6 @@
<% end -%>
-<%= content_tag :li, :class => active_for_controllers('designs') do -%>
- <%= link_to content_tag(:i, nil, :class => 'icons-window-block') + t('admin.design'), admin_designs_path %>
-<% end -%>
-
<%= content_tag :li, :class => active_for_controllers('ad_banners', 'ad_images') ||active_for_ob_auths_object("AdBanner") ||active_for_app_auth('ad_banners') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.ad_banner'), admin_ad_banners_path %>
diff --git a/app/views/layouts/site_editor.html.erb b/app/views/layouts/site_editor.html.erb
index da6efd26..1f66aecc 100644
--- a/app/views/layouts/site_editor.html.erb
+++ b/app/views/layouts/site_editor.html.erb
@@ -23,9 +23,7 @@
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 15598a8e..cb638475 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -91,6 +91,7 @@ en:
ab_fx: FX
all_banners: AdBanner list
banner_best_size: Banner Best Size
+ best_size: Best size
new_banner: New banner
new_image: New image
showing: Showing
@@ -216,6 +217,10 @@ en:
options: Options
orig_upload_file: Original filename
page: Page
+ page_context:
+ edit: Edit
+ ob_auth:
+ edit: Category authorization
page_part_kinds:
text: Text Area
public_r_tag: System Widget
diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml
index b7030e16..1fbb8d48 100644
--- a/config/locales/zh_tw.yml
+++ b/config/locales/zh_tw.yml
@@ -88,6 +88,7 @@ zh_tw:
ab_fx: 轉場特效
all_banners: 輪播清單
banner_best_size: Banner 尺寸
+ best_size: 最佳尺寸
cate_auth: 分類授權
delete_banner: 刪除整組輪播
new_banner: 新增輪播
diff --git a/config/mongoid.yml b/config/mongoid.yml
index 16405831..f333e2e6 100644
--- a/config/mongoid.yml
+++ b/config/mongoid.yml
@@ -8,7 +8,7 @@ defaults: &defaults
development:
<<: *defaults
- database: prototype_r4_ldap0229
+ database: prototype_r4_development
test:
<<: *defaults
@@ -22,4 +22,4 @@ production:
# password: <%= ENV['MONGOID_PASSWORD'] %>
# database: <%= ENV['MONGOID_DATABASE'] %>
<<: *defaults
- database: prototype_r4_ldap0229
+ database: prototype_r4_development
diff --git a/lib/orbit_core_lib.rb b/lib/orbit_core_lib.rb
index ad4f6756..f3cd2cd5 100644
--- a/lib/orbit_core_lib.rb
+++ b/lib/orbit_core_lib.rb
@@ -32,7 +32,11 @@ module OrbitCoreLib
end
def get_object_auth_by_title(title)
- self.object_auths.where({title: title }).first
+ oa = self.object_auths.where({title: title }).first
+ if oa.nil? && (self.class::ObjectAuthTitlesOptions.include? title)
+ oa = self.object_auths.create title: title
+ end
+ oa
end
def authed_users(title=nil)
diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb
index e5c92023..22c3a6dd 100644
--- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb
+++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb
@@ -20,8 +20,8 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
else
@bulletin_category = @bulletin_categorys.first
end
- preload_object_auth = @bulletin_category.object_auths.where(title: 'fact_check').empty?? (@bulletin_category.object_auths.create! :title=> 'fact_check') : @bulletin_category.object_auths.where(title: 'fact_check')
- @users_array = preload_object_auth.first.privilege_users rescue []
+ preload_object_auth = @bulletin_category.get_object_auth_by_title('fact_check')
+ @users_array = preload_object_auth.privilege_users rescue []
respond_to do |format|
format.html
format.js
@@ -31,9 +31,9 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
def update_setting
object_auth = update_setting_by_params
if object_auth.save!
- flash[:notice] = "Update Done"
+ flash[:notice] = t("admin.object_auth.update_done")
else
- flash[:notice] = "Update Failed"
+ flash[:notice] = t("admin.object_auth.update_failed")
end
end
diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb
index 15721324..420b0143 100644
--- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb
+++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb
@@ -36,7 +36,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# @bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered_bulletins : Bulletin.all.page(params[:page]).per(10)
- @bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered("bulletin") : Bulletin.all.page(params[:page]).per(10)
+ @bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered("bulletin") : get_viewable("bulletin")
@bulletin_categories = BulletinCategory.all
@bulletin_link = BulletinLink.new
@@ -44,12 +44,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
@bulletin_file = BulletinFile.new
@file_url = panel_announcement_back_end_bulletins_path
-
- if(!is_admin? || !is_manager?)
- @bulletins.delete_if{ |bulletin|
- bulletin.is_pending == true && ((!bulletin.bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) || bulletin.create_user_id!=current_user.id)
- }
- end
respond_to do |format|
format.html # index.html.erb
diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb
index f21c1a38..9fd97b9b 100644
--- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb
+++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb
@@ -38,7 +38,6 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
def preview_content
@bulletin = Bulletin.find params[:id]
get_categorys
- render :show
end
protected
diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb
index 0bf7de64..589da320 100644
--- a/vendor/built_in_modules/announcement/app/models/bulletin.rb
+++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb
@@ -160,13 +160,13 @@ class Bulletin
protected
def set_key
- if title.new_record?
+ if title && title.new_record?
title.key = 'title'
end
- if subtitle.new_record?
+ if subtitle && subtitle.new_record?
subtitle.key = 'subtitle'
end
- if text.new_record?
+ if text && text.new_record?
text.key = 'text'
end
end
diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_file.rb b/vendor/built_in_modules/announcement/app/models/bulletin_file.rb
index c4d60b9b..a30ec131 100644
--- a/vendor/built_in_modules/announcement/app/models/bulletin_file.rb
+++ b/vendor/built_in_modules/announcement/app/models/bulletin_file.rb
@@ -29,10 +29,10 @@ class BulletinFile
protected
def set_key
- if filetitle.new_record?
+ if filetitle && filetitle.new_record?
filetitle.key = 'filetitle'
end
- if description.new_record?
+ if description && description.new_record?
description.key = 'description'
end
end
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/setting.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/setting.html.erb
index 9e6c7225..57d3105b 100644
--- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/setting.html.erb
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/setting.html.erb
@@ -16,11 +16,9 @@
<%= select "category",'id',@options_from_collection_for_select_bulletin_categorys %>
<%= search_field_tag 'user_filter' %>
-
<%= link_to t("announcement.bulletin.approval_user_list"), panel_announcement_back_end_approval_user_list_path , :class=>'preview_trigger btn btn-success pull-right'%>
-
<%#= label_tag :role, t("admin.roles") %>
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb
index 423e35ba..8f879e79 100644
--- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb
@@ -60,8 +60,8 @@
- <%= bulletin.postdate %> |
- <%= (bulletin.deadline) ? bulletin.deadline : t('bulletin.no_deadline') %> |
+ <%= display_date_time(bulletin.postdate) %> |
+ <%= (bulletin.deadline) ? display_date_time(bulletin.deadline ): t('bulletin.no_deadline') %> |
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb
index 68634b9a..d8921677 100644
--- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb
@@ -5,7 +5,7 @@
<%= t('announcement.postdate') %>
- <%= @bulletin.postdate %>
+ <%= display_date_time(@bulletin.postdate) %>
<%= t('announcement.title') %>
@@ -42,7 +42,7 @@
<%= t('announcement.最後修改時間') %>
- <%= @bulletin.updated_at %>
+ <%= display_date(@bulletin.updated_at) %>
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb
index 6937a6c3..4ba18b51 100644
--- a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb
@@ -22,7 +22,7 @@
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
<%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %>
|
- <%= post.postdate %> |
+ <%= display_date_time(post.postdate) %> |
<% end %>
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb
index 37373ae9..2ece4b02 100644
--- a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb
@@ -2,10 +2,11 @@
<%= @bulletin.title[I18n.locale] %>
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb
index daadc367..450e7617 100644
--- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb
@@ -15,7 +15,7 @@
<%= post.bulletin_category.i18n_variable[I18n.locale] rescue nil %> |
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
|
- <%= post.postdate %> |
+ <%= display_date_time(post.postdate) %> |
<% end %>
diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_approvals_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_approvals_controller.rb
index 829daecc..3eb3e9c0 100644
--- a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_approvals_controller.rb
+++ b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_approvals_controller.rb
@@ -4,7 +4,7 @@ class Panel::News::BackEnd::NewsApprovalsController < OrbitBackendController
include AdminHelper
def preview_and_approve
- @news_bulletin = NewsBulletin.find params[:news_bulletin_id]
+ @news_bulletin = NewsBulletin.find params[:news_category][:id]
end
def approve
@@ -14,20 +14,14 @@ class Panel::News::BackEnd::NewsApprovalsController < OrbitBackendController
def setting
@sys_users = User.all(conditions: {admin: false})
@news_bulletin_categorys = NewsBulletinCategory.all
- if params.has_key?(:category_id)
- first_category = NewsBulletinCategory.find params[:category_id]
- if params[:commit] == 'Update'
- privilege_users = params[:users].collect{|key,value| User.find key } rescue []
- preload_object_auth_ary = first_category.object_auths.where(title: 'fact_check') || (first_category.object_auths.create :title=> 'fact_check')
- preload_object_auth = preload_object_auth_ary.first
- preload_object_auth.privilege_users = privilege_users
- preload_object_auth.save!
- end
+ @options_from_collection_for_select_news_bulletin_categorys = @news_bulletin_categorys.collect{|bc| [bc.i18n_variable[I18n.locale],bc.id] }
+ if params.has_key? :news_category
+ @news_bulletin_categorys = NewsBulletinCategory.find params[:news_category][:id]
else
- first_category = @news_bulletin_categorys.first
+ @news_bulletin_categorys = @news_bulletin_categorys.first
end
- preload_object_auth = first_category.object_auths.where(title: 'fact_check').empty?? (first_category.object_auths.create! :title=> 'fact_check') : first_category.object_auths.where(title: 'fact_check')
- @users_array = preload_object_auth.first.privilege_users rescue []
+ preload_object_auth = @news_bulletin_categorys.get_object_auth_by_title('fact_check')
+ @users_array = preload_object_auth.privilege_users rescue []
respond_to do |format|
format.html
format.js
@@ -35,10 +29,27 @@ class Panel::News::BackEnd::NewsApprovalsController < OrbitBackendController
end
def update_setting
-
+ object_auth = update_setting_by_params
+ if object_auth.save!
+ flash[:notice] = t("admin.object_auth.update_done")
+ else
+ flash[:notice] = t("admin.object_auth.update_failed")
+ end
+ end
+
+ def user_list
+ @news_bulletin_category = NewsBulletinCategory.find params[:news_category][:id]
end
protected
+ def update_setting_by_params
+ category = NewsBulletinCategory.find params[:news_category][:id]
+ privilege_users = params[:users].collect{|key,value| User.find key } rescue []
+ object_auth_ary = category.object_auths.where(title: 'fact_check') || (category.object_auths.create :title=> 'fact_check')
+ object_auth = object_auth_ary.first
+ object_auth.privilege_users = privilege_users
+ object_auth
+ end
def get_categorys(id = nil)
@news_bulletin_categorys = []
diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb
index 706e7663..46bd2f02 100644
--- a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb
+++ b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb
@@ -41,10 +41,6 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
@news_bulletin_link = NewsBulletinLink.new
@link_url = panel_news_back_end_news_bulletins_path
-
- @news_bulletins.delete_if{ |news_bulletin|
- news_bulletin.is_pending == true && ((!news_bulletin.bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) || news_bulletin.create_user_id!=current_user.id)
- }
@news_bulletin_file = NewsBulletinFile.new
@file_url = panel_news_back_end_news_bulletins_path
diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb
index 50b9c266..b4f5fc82 100644
--- a/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb
+++ b/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb
@@ -36,9 +36,8 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
end
def preview_content
- @news_bulletins = NewsBulletin.find params[:id]
+ @news_bulletin = NewsBulletin.find params[:id]
get_categorys
- render :show
end
protected
diff --git a/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb
index aebc8145..8bf47a3d 100644
--- a/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb
+++ b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb
@@ -2,7 +2,7 @@ module Panel::News::BackEnd::NewsBulletinsHelper
def news_show_approval_link(news_bulletin)
by_news_bulletin = (!news_bulletin.is_expired? and !news_bulletin.is_checked?)
- by_user = (news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager?
+ by_user = (news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) or is_manager? or is_admin?)
by_news_bulletin and by_user
end
diff --git a/vendor/built_in_modules/news/app/models/news_bulletin.rb b/vendor/built_in_modules/news/app/models/news_bulletin.rb
index 83bb784b..f9d2ca0e 100644
--- a/vendor/built_in_modules/news/app/models/news_bulletin.rb
+++ b/vendor/built_in_modules/news/app/models/news_bulletin.rb
@@ -160,13 +160,13 @@ class NewsBulletin
protected
def set_key
- if title.new_record?
+ if title && title.new_record?
title.key = 'title'
end
- if subtitle.new_record?
+ if subtitle && subtitle.new_record?
subtitle.key = 'subtitle'
end
- if text.new_record?
+ if text && text.new_record?
text.key = 'text'
end
end
diff --git a/vendor/built_in_modules/news/app/models/news_bulletin_file.rb b/vendor/built_in_modules/news/app/models/news_bulletin_file.rb
index a75dc01f..40495cb4 100644
--- a/vendor/built_in_modules/news/app/models/news_bulletin_file.rb
+++ b/vendor/built_in_modules/news/app/models/news_bulletin_file.rb
@@ -29,10 +29,10 @@ class NewsBulletinFile
protected
def set_key
- if filetitle.new_record?
+ if filetitle && filetitle.new_record?
filetitle.key = 'filetitle'
end
- if description.new_record?
+ if description && description.new_record?
description.key = 'description'
end
end
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/_modal_list.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/_modal_list.html.erb
new file mode 100644
index 00000000..9c999830
--- /dev/null
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/_modal_list.html.erb
@@ -0,0 +1,44 @@
+<% if news_bulletin_category -%>
+
+
+
+
+
+ <% news_bulletin_category.get_object_auth_by_title('fact_check').auth_users.each do |user| %>
+
+
+ <% if user.avatar? %>
+ <%= image_tag(user.avatar.thumb.url,:class => "member-img") %>
+ <% else %>
+ <%= image_tag "person.png",:class => "member-img" %>
+ <% end %>
+
+ <%= label_tag "lab-user-#{user.id}", (user.name rescue ''),:class=>"member-name",:id=>nil -%>
+
+ <% end -%>
+
+
+
+
+
+
+
+
+
+
+
+<% end -%>
\ No newline at end of file
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/_privilege_user.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/_privilege_user.html.erb
index d48bb850..60c5a782 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/_privilege_user.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/_privilege_user.html.erb
@@ -6,7 +6,7 @@
<% user.sub_roles.each do |sr| %>
<%= sr.key %>
<% end %>
- <%= content_tag :div,:data=>{'original-title'=>t('news.news_bulletin.approval_setting_window_title'),:content => "#{user.sub_roles.collect{|sr| sr.key}.join(',')}"},:class=>"checkbox clear" do %>
+ <%= content_tag :div,:data=>{'original-title'=>t('news.news_bulletin.approval_setting_window_title'),:content => "#{user.sub_roles.collect{|sr| sr.i18n_variable[I18n.locale]}.join(',')}"},:class=>"checkbox clear" do %>
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/setting.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/setting.html.erb
index aca35fd0..298e21eb 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/setting.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/setting.html.erb
@@ -4,27 +4,29 @@
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "inc/permission-checkbox" %>
<%= javascript_include_tag "inc/search" %>
+ <%= javascript_include_tag "inc/modal-preview" %>
<% end %>
<%#= label_tag :fact_check_setting, t("news.news_bulletin.fact_check_setting") %>
-<%= form_tag('', :remote => true) %>
-
-
+<%= form_tag('', :remote => true,:class => "prevent_enter_submit_form") %>
+
+
-
<%= label_tag :category, t("news.news_bulletin.category") %>
- <%= select_tag "category_id", options_from_collection_for_select(@news_bulletin_categorys, "id", "key") %>
+ <%= select "news_category",'id', @options_from_collection_for_select_news_bulletin_categorys %>
<%= search_field_tag 'user_filter' %>
+ <%= link_to t("announcement.bulletin.approval_user_list"), panel_news_back_end_approval_user_list_path , :class=>'preview_trigger btn btn-success pull-right'%>
<%#= label_tag :role, t("admin.roles") %>
<%= content_tag :div do -%>
- <% form_tag :action => "update_setting" do %>
+ <% form_tag panel_news_back_end_approval_setting_path do %>
<%= render :partial => "privilege_user", :locals => {:users => @users_array} %>
-
|
- <%= news_bulletin.postdate %> |
- <%= (news_bulletin.deadline) ? news_bulletin.deadline : t('news_bulletin.no_deadline') %> |
+ <%= display_date(news_bulletin.postdate) %> |
+ <%= (news_bulletin.deadline) ? display_date(news_bulletin.deadline) : t('news_bulletin.no_deadline') %> |
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/show.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/show.html.erb
index 1868c8fb..ce64e41f 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/show.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/show.html.erb
@@ -5,7 +5,7 @@
<%= t('news.postdate') %>
- <%= @news_bulletin.postdate %>
+ <%= display_date(@news_bulletin.postdate) %>
<%= t('news.title') %>
@@ -42,7 +42,7 @@
<%= t('news.最後修改時間') %>
- <%= @news_bulletin.updated_at %>
+ <%= display_date(@news_bulletin.updated_at) %>
diff --git a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb
index 4c2292a6..6968a482 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb
@@ -17,12 +17,12 @@
<% @news_bulletins.each do |post| %>
- <%= image_tag post.image %> |
+ <%= image_tag post.image rescue nil %> |
<%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %>
<%= post.subtitle[I18n.locale].html_safe %>
|
- <%= post.postdate %> |
+ <%= display_date(post.postdate) %> |
<% end %>
diff --git a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb
index e1c07e3b..df391c54 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb
@@ -3,9 +3,10 @@
diff --git a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_index.html.erb b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_index.html.erb
index d345f037..4eab719a 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_index.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_index.html.erb
@@ -18,7 +18,7 @@
<%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %>
<%= post.subtitle[I18n.locale].html_safe %>
|
- <%= post.postdate %> |
+ <%= display_date(post.postdate) %> |
<% end %>
diff --git a/vendor/built_in_modules/news/config/routes.rb b/vendor/built_in_modules/news/config/routes.rb
index 52b3d379..244b1d03 100644
--- a/vendor/built_in_modules/news/config/routes.rb
+++ b/vendor/built_in_modules/news/config/routes.rb
@@ -2,9 +2,10 @@ Rails.application.routes.draw do
namespace :panel do
namespace :news do
namespace :back_end do
- match 'news_approval_setting' => "news_approvals#setting" ,:as => :news_approval_setting
- match 'update_setting' => "news_approvals#update_setting" ,:as => :news_approval_update_setting
-
+ match 'public' => "news#public",:as => :public
+ match 'approval_setting' => "news_approvals#setting" ,:as => :approval_setting,:via => :get
+ match 'approval_setting' => "news_approvals#update_setting" ,:as => :approval_setting,:via => :post
+ match 'approval_setting' => "news_approvals#user_list" ,:as => :approval_user_list,:via => :put
resources :news_bulletins do
match "approve/:news_bulletin_id" => "news_approvals#preview_and_approve",:as => :approval_preview,:via => :put
match "approve/:news_bulletin_id" => "news_approvals#approve",:as => :approve,:via => :post
diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_page_context.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_page_context.html.erb
index 036cb6e0..7e056432 100644
--- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_page_context.html.erb
+++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_page_context.html.erb
@@ -18,6 +18,6 @@
<%= link_to page_context.version, panel_page_content_back_end_view_path(page_context.page_id) %>
<%end -%>
- <%= page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %> |
+ <%= display_date_time(page_context.updated_at) %> |
<%= User.find(page_context.create_user_id).name %> |
\ No newline at end of file
diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_view_page_context.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_view_page_context.html.erb
index 7035a700..38d83b29 100644
--- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_view_page_context.html.erb
+++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_view_page_context.html.erb
@@ -10,6 +10,6 @@
<%= view_page_context.version %> |
- <%= view_page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %> |
+ <%= display_date(view_page_context.updated_at) %> |
<%= User.find(view_page_context.create_user_id).name %> |
\ No newline at end of file
diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/show.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/show.html.erb
index a75bcc8c..0c681faf 100644
--- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/show.html.erb
+++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/show.html.erb
@@ -21,7 +21,7 @@
<%= t('page_content.最後修改時間') %>
- <%= @page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %>
+ <%= display_date(@page_context.updated_at) %>
diff --git a/vendor/built_in_modules/web_resource/app/models/web_link.rb b/vendor/built_in_modules/web_resource/app/models/web_link.rb
index 9bd06f05..4143c38b 100644
--- a/vendor/built_in_modules/web_resource/app/models/web_link.rb
+++ b/vendor/built_in_modules/web_resource/app/models/web_link.rb
@@ -69,10 +69,10 @@ class WebLink
protected
def set_key
- if name.new_record?
+ if name && name.new_record?
name.key = 'name'
end
- if context.new_record?
+ if context && context.new_record?
context.key = 'context'
end
end
diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/show.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/show.html.erb
index e3734616..1eba0646 100644
--- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/show.html.erb
+++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/show.html.erb
@@ -13,7 +13,7 @@
<%= t('announcement.postdate') %>
- <%= @bulletin.postdate %>
+ <%= display_date(@bulletin.postdate) %>
<%= t('announcement.title') %>
@@ -50,7 +50,7 @@
<%= t('announcement.最後修改時間') %>
- <%= @bulletin.updated_at %>
+ <%= display_date(@bulletin.updated_at) %>
diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/show.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/show.html.erb
index a3381e5c..7e7f2c95 100644
--- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/show.html.erb
+++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/show.html.erb
@@ -13,7 +13,7 @@
<%= t('announcement.postdate') %>
- <%= @bulletin.postdate %>
+ <%= display_date(@bulletin.postdate) %>
<%= t('announcement.title') %>
@@ -50,7 +50,7 @@
<%= t('announcement.最後修改時間') %>
- <%= @bulletin.updated_at.strftime("%Y-%m-%d %H:%I:%S") %>
+ <%= display_date_time(@bulletin.updated_at) %>
diff --git a/vendor/impressionist/app/models/impressionist/impressionable.rb b/vendor/impressionist/app/models/impressionist/impressionable.rb
index f5cbd3b0..1df2f1c3 100644
--- a/vendor/impressionist/app/models/impressionist/impressionable.rb
+++ b/vendor/impressionist/app/models/impressionist/impressionable.rb
@@ -38,10 +38,13 @@ module Impressionist
end
def update_impressionist_counter_cache
+ # cache_options = self.class.impressionist_counter_cache_options
+ # column_name = cache_options[:column_name].to_sym
+ # count = cache_options[:unique] ? impressionist_count(:filter => :ip_address) : impressionist_count
+ # update_attribute(column_name, count)
cache_options = self.class.impressionist_counter_cache_options
column_name = cache_options[:column_name].to_sym
- count = cache_options[:unique] ? impressionist_count(:filter => :ip_address) : impressionist_count
- update_attribute(column_name, count)
+ update_attribute(column_name, self.send(cache_options[:column_name]) + 1)
end
# OLD METHODS - DEPRECATE IN V0.5
diff --git a/vendor/impressionist/lib/impressionist/models/mongoid/impression.rb b/vendor/impressionist/lib/impressionist/models/mongoid/impression.rb
index 5edc2edd..9a2d958c 100644
--- a/vendor/impressionist/lib/impressionist/models/mongoid/impression.rb
+++ b/vendor/impressionist/lib/impressionist/models/mongoid/impression.rb
@@ -27,11 +27,13 @@ class Impression
private
def update_impressions_counter_cache
- impressionable_class = self.impressionable_type.constantize
+ if self.referrer
+ impressionable_class = self.impressionable_type.constantize
- if impressionable_class.impressionist_counter_cache_options
- resouce = impressionable_class.find(self.impressionable_id)
- resouce.try(:update_impressionist_counter_cache)
+ if impressionable_class.impressionist_counter_cache_options
+ resouce = impressionable_class.find(self.impressionable_id)
+ resouce.try(:update_impressionist_counter_cache)
+ end
end
end
end