fix error
This commit is contained in:
parent
9aa88aa080
commit
1f6fbb0619
|
@ -6,7 +6,7 @@ class ActivesController < ApplicationController
|
||||||
begin
|
begin
|
||||||
time_now = Time.now
|
time_now = Time.now
|
||||||
OrbitHelper.render_css_in_head(["active_front"])
|
OrbitHelper.render_css_in_head(["active_front"])
|
||||||
actives = Act.filter_by_categories.desc(:sign_start_date).page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
actives = Act.filter_by_categories.can_display_on_front.page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
||||||
|
|
||||||
acts = actives.collect do |a|
|
acts = actives.collect do |a|
|
||||||
link_to_show = OrbitHelper.url_to_show(a.to_param) + '?method=show_data'
|
link_to_show = OrbitHelper.url_to_show(a.to_param) + '?method=show_data'
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Admin::ActivesController < OrbitAdminController
|
||||||
def index
|
def index
|
||||||
@categories = @module_app.categories.enabled
|
@categories = @module_app.categories.enabled
|
||||||
@filter_fields = filter_fields(@categories)
|
@filter_fields = filter_fields(@categories)
|
||||||
@table_fields = [:category, 'act.title', 'act.sign_up_time_range', 'act.act_time_range', 'act.sign_up_count', 'act.export']
|
@table_fields = [:category, 'act.title', 'act.sign_up_time_range', 'act.act_time_range', 'act.postdate', 'act.end_date', 'act.sign_up_count', 'act.export']
|
||||||
|
|
||||||
if !params[:sort].blank?
|
if !params[:sort].blank?
|
||||||
if params[:sort] == 'act_time_range'
|
if params[:sort] == 'act_time_range'
|
||||||
|
|
|
@ -74,6 +74,7 @@ class Act
|
||||||
accepts_nested_attributes_for :act_signups, :allow_destroy => true
|
accepts_nested_attributes_for :act_signups, :allow_destroy => true
|
||||||
|
|
||||||
scope :can_display, ->{any_of({:sign_start_date.lt=>Time.now, :sign_end_date.gt=>Time.now},{:sign_start_date.lt=>Time.now, :sign_end_date=>nil}).order_by([:is_top, :desc])}
|
scope :can_display, ->{any_of({:sign_start_date.lt=>Time.now, :sign_end_date.gt=>Time.now},{:sign_start_date.lt=>Time.now, :sign_end_date=>nil}).order_by([:is_top, :desc])}
|
||||||
|
scope :can_display_on_front, ->{any_of({:postdate.lt=>Time.now, :end_date.gt=>Time.now},{:postdate.lt=>Time.now, :end_date=>nil}).order_by(:is_top.desc, :postdate.desc, :sign_start_date.desc)}
|
||||||
|
|
||||||
def update_user
|
def update_user
|
||||||
User.find(update_user_id) rescue nil
|
User.find(update_user_id) rescue nil
|
||||||
|
@ -84,7 +85,7 @@ class Act
|
||||||
end
|
end
|
||||||
|
|
||||||
def expired?
|
def expired?
|
||||||
(self.sign_end_date < Time.now) rescue false
|
(self.end_date < Time.now) rescue false
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.time_range(date1 = null, date2 = null)
|
def self.time_range(date1 = null, date2 = null)
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
<script>
|
<script>
|
||||||
if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
|
if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
|
||||||
</script>
|
</script>
|
||||||
|
<style type="text/css">
|
||||||
|
.expired{
|
||||||
|
color: #BE2E2E;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<table class="table main-list">
|
<table class="table main-list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="sort-header">
|
<tr class="sort-header">
|
||||||
|
@ -17,8 +21,13 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @acts.each do |act| %>
|
<% @acts.each do |act| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= act.category.title %></td>
|
|
||||||
<td>
|
<td>
|
||||||
|
<%= act.category.title %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<% if act.expired? %>
|
||||||
|
<span class='label'><%= t(:expired) %></span>
|
||||||
|
<% end %>
|
||||||
<a href="<%= page_for_act(act) %>?method=show_data" target="_blank"><%= act.title %></a>
|
<a href="<%= page_for_act(act) %>?method=show_data" target="_blank"><%= act.title %></a>
|
||||||
<div class="quick-edit">
|
<div class="quick-edit">
|
||||||
<ul class="nav nav-pills">
|
<ul class="nav nav-pills">
|
||||||
|
@ -31,6 +40,8 @@
|
||||||
</td>
|
</td>
|
||||||
<td><%= Act.time_range(act.sign_start_date, act.sign_end_date) %></td>
|
<td><%= Act.time_range(act.sign_start_date, act.sign_end_date) %></td>
|
||||||
<td><%= Act.time_range(act.act_start_date, act.act_end_date) %></td>
|
<td><%= Act.time_range(act.act_start_date, act.act_end_date) %></td>
|
||||||
|
<td><%= format_value(act.postdate,'yyyy-MM-dd') %></td>
|
||||||
|
<td class="<%= act.expired? ? "expired" : "" %>"><%= format_value(act.end_date,'yyyy-MM-dd') %></td>
|
||||||
<td><a href="/admin/actives/<%=act.id.to_s%>/act_signup"><%= act.act_signups.count %></a></td>
|
<td><a href="/admin/actives/<%=act.id.to_s%>/act_signup"><%= act.act_signups.count %></a></td>
|
||||||
<td><a href="/admin/actives/<%=act.id.to_s%>/export?format=xlsx" target="_blank"><%= t('act.export') %></a></td>
|
<td><a href="/admin/actives/<%=act.id.to_s%>/export?format=xlsx" target="_blank"><%= t('act.export') %></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in New Issue