Set default picture

Fix tags where not in params for index fronted (news and announcement)
Change backend index for news
Home banner link for images and main title
This commit is contained in:
chris 2012-08-16 17:24:12 +08:00
parent 96fd89cca3
commit 3c283d1a7a
10 changed files with 18 additions and 12 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -3,6 +3,7 @@
class ImageUploader < CarrierWave::Uploader::Base class ImageUploader < CarrierWave::Uploader::Base
require 'mime/types' require 'mime/types'
include Sprockets::Helpers::RailsHelper
process :set_content_type process :set_content_type
@ -30,6 +31,9 @@ class ImageUploader < CarrierWave::Uploader::Base
# def default_url # def default_url
# "/images/fallback/" + [version_name, "default.png"].compact.join('_') # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
# end # end
def default_url
"news_alt.jpg"
end
# Process files as they are uploaded: # Process files as they are uploaded:
# process :scale => [200, 300] # process :scale => [200, 300]

View File

@ -30,7 +30,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
date_now = Time.now date_now = Time.now
if !params[:category_id].blank? && !params[:tag_id].blank? if !params[:category_id].blank? && !params[:tag_id].blank?
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil @tag = AnnouncementTag.find(params[:tag_id]) rescue nil
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag @tag = AnnouncementTag.where(id: params[:tag_id])[0] unless @tag
@bulletins = @tag.bulletins.available_for_lang(I18n.locale).can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(15) @bulletins = @tag.bulletins.available_for_lang(I18n.locale).can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(15)
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
elsif !params[:category_id].blank? elsif !params[:category_id].blank?
@ -38,7 +38,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
elsif !params[:tag_id].blank? elsif !params[:tag_id].blank?
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil @tag = AnnouncementTag.find(params[:tag_id]) rescue nil
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag @tag = AnnouncementTag.where(id: params[:tag_id])[0] unless @tag
@bulletins = @tag.bulletins.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(15) @bulletins = @tag.bulletins.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(15)
else else
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(15) @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(15)

View File

@ -31,7 +31,7 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
date_now = Time.now date_now = Time.now
if !params[:category_id].blank? && !params[:tag_id].blank? if !params[:category_id].blank? && !params[:tag_id].blank?
@tag = NewsTag.find(params[:tag_id]) rescue nil @tag = NewsTag.find(params[:tag_id]) rescue nil
@tag = NewsTag.where(key: params[:tag_id])[0] unless @tag @tag = NewsTag.where(id: params[:tag_id])[0] unless @tag
@news_bulletins = @tag.news_bulletins.available_for_lang(I18n.locale).can_display.where(:news_bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(15) @news_bulletins = @tag.news_bulletins.available_for_lang(I18n.locale).can_display.where(:news_bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(15)
@current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil @current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil
elsif !params[:category_id].blank? elsif !params[:category_id].blank?
@ -39,7 +39,7 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
@current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil @current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil
elsif !params[:tag_id].blank? elsif !params[:tag_id].blank?
@tag = NewsTag.find(params[:tag_id]) rescue nil @tag = NewsTag.find(params[:tag_id]) rescue nil
@tag = NewsTag.where(key: params[:tag_id])[0] unless @tag @tag = NewsTag.where(id: params[:tag_id])[0] unless @tag
@news_bulletins = @tag.news_bulletins.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(15) @news_bulletins = @tag.news_bulletins.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(15)
else else
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(15) @news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(15)

View File

@ -28,7 +28,7 @@
</div> </div>
</div> </div>
</td> </td>
<td><%= news_bulletin.news_bulletin_category.title rescue nil %></td> <!-- <td><%= news_bulletin.news_bulletin_category.title rescue nil %></td> -->
<td> <%= show_news_bulletin_title_at_index news_bulletin%> <td> <%= show_news_bulletin_title_at_index news_bulletin%>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills hide"> <ul class="nav nav-pills hide">
@ -71,6 +71,7 @@
</div> </div>
</div> </div>
</td> </td>
<td><%= User.from_id(news_bulletin.update_user_id).name rescue ''%></td> <td><%= news_bulletin.view_count rescue nil %></td>
<td><%= news_bulletin.unit_list_for_anc.title rescue nil %> </td>
</tr> </tr>
<tr id="<%= dom_id news_bulletin, :edit %>" class="qe-block hide" /> <tr id="<%= dom_id news_bulletin, :edit %>" class="qe-block hide" />

View File

@ -2,11 +2,11 @@
<tr> <tr>
<th class="span1"></th> <th class="span1"></th>
<th class="span1-2"></th> <th class="span1-2"></th>
<th class="span1-2"></th>
<th class="span7"></th> <th class="span7"></th>
<th class="span1-2"></th> <th class="span1-2"></th>
<th class="span1-2"></th> <th class="span1-2"></th>
<th class="span1-2"></th> <th class="span1-2"></th>
<th class="span1-2"></th>
<th class="span1-3"></th> <th class="span1-3"></th>
</tr> </tr>
</thead> </thead>

View File

@ -1,8 +1,8 @@
<%= render_sort_bar(true, delete_panel_news_back_end_news_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]), <%= render_sort_bar(true, delete_panel_news_back_end_news_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]),
['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1-2', 'news_bulletin.status'], ['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1-2', 'news_bulletin.status'],
['category', 'news_bulletin_category', 'span1-2', 'news_bulletin.category'],
['title', 'title','span7', 'news_bulletin.title'], ['title', 'title','span7', 'news_bulletin.title'],
['start_date', 'postdate', 'span1-2', 'news_bulletin.start_date'], ['start_date', 'postdate', 'span1-2', 'news_bulletin.start_date'],
['end_date', 'deadline', 'span1-2', 'news_bulletin.end_date'], ['end_date', 'deadline', 'span1-2', 'news_bulletin.end_date'],
['tags', 'tags', 'span1-2', 'news_bulletin.tags'], ['tags', 'tags', 'span1-2', 'news_bulletin.tags'],
['last_modified', 'update_user_id','span1-3', 'news_bulletin.last_modified']).html_safe %> ['view_count', 'view_count','span1-2', 'view_count'],
['unit_list_for_anc', 'unit_list_for_anc','span1-3', 'news.news_bulletin.unit_name']).html_safe %>

View File

@ -22,7 +22,7 @@
</tr> </tr>
<% @news_bulletins.each do |post| %> <% @news_bulletins.each do |post| %>
<tr> <tr>
<td class="img"><%= image_tag post.image rescue nil %></td> <td class="img"><%= image_tag post.image.url %></td>
<td> <td>
<%= link_to post.title, panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %> <%= link_to post.title, panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %>
<%= post.subtitle.html_safe rescue '' %> <%= post.subtitle.html_safe rescue '' %>

View File

@ -1,5 +1,5 @@
<% if @news_bulletins and !@news_bulletins.nil? %> <% if @news_bulletins and !@news_bulletins.nil? %>
<h2 class="topic_title"><%= t('news.campus_news')%></h2> <h2 class="topic_title"><%= link_to t('news.campus_news'), panel_news_front_end_news_bulletins_path %></h2>
<%#= link_to t('news.more'),panel_news_front_end_news_bulletins_path(), :class => "topic_note" %> <%#= link_to t('news.more'),panel_news_front_end_news_bulletins_path(), :class => "topic_note" %>
<div class="btn-group topic_note"> <div class="btn-group topic_note">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
@ -19,7 +19,7 @@
<ul id="topic_list"> <ul id="topic_list">
<% @news_bulletins.each do |post| %> <% @news_bulletins.each do |post| %>
<li> <li>
<div class="news_img"><%= image_tag(post.image.url, :size => "290x130") if post.image.file %></div> <div class="news_img"><%= link_to image_tag(post.image.url, :size => "290x130"), panel_news_front_end_news_bulletin_path(post, :category_id => post.news_bulletin_category_id) %></div>
<h3 class="h3 news_title"><%= link_to post.title, panel_news_front_end_news_bulletin_path(post, :category_id => post.news_bulletin_category_id) %></h3> <h3 class="h3 news_title"><%= link_to post.title, panel_news_front_end_news_bulletin_path(post, :category_id => post.news_bulletin_category_id) %></h3>
<p class="news_wrap"><%= post.subtitle.html_safe rescue '' %></p> <p class="news_wrap"><%= post.subtitle.html_safe rescue '' %></p>
</li> </li>

View File

@ -83,6 +83,7 @@ en:
approval_pass: 'Pass' approval_pass: 'Pass'
approval_setting_window_title: 'Unit' approval_setting_window_title: 'Unit'
update_success: Successfully Updated update_success: Successfully Updated
unit_name: Unit name
# admin: # admin:
# action: Action # action: Action
# add_language: Add language # add_language: Add language