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:
parent
96fd89cca3
commit
3c283d1a7a
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
|
@ -3,6 +3,7 @@
|
|||
class ImageUploader < CarrierWave::Uploader::Base
|
||||
|
||||
require 'mime/types'
|
||||
include Sprockets::Helpers::RailsHelper
|
||||
|
||||
process :set_content_type
|
||||
|
||||
|
@ -30,6 +31,9 @@ class ImageUploader < CarrierWave::Uploader::Base
|
|||
# def default_url
|
||||
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
||||
# end
|
||||
def default_url
|
||||
"news_alt.jpg"
|
||||
end
|
||||
|
||||
# Process files as they are uploaded:
|
||||
# process :scale => [200, 300]
|
||||
|
|
|
@ -30,7 +30,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
|||
date_now = Time.now
|
||||
if !params[:category_id].blank? && !params[:tag_id].blank?
|
||||
@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)
|
||||
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
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
|
||||
elsif !params[:tag_id].blank?
|
||||
@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)
|
||||
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)
|
||||
|
|
|
@ -31,7 +31,7 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
|
|||
date_now = Time.now
|
||||
if !params[:category_id].blank? && !params[:tag_id].blank?
|
||||
@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)
|
||||
@current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
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
|
||||
elsif !params[:tag_id].blank?
|
||||
@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)
|
||||
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)
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</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%>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
|
@ -71,6 +71,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</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 id="<%= dom_id news_bulletin, :edit %>" class="qe-block hide" />
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
<tr>
|
||||
<th class="span1"></th>
|
||||
<th class="span1-2"></th>
|
||||
<th class="span1-2"></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-3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
|
@ -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]),
|
||||
['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'],
|
||||
['start_date', 'postdate', 'span1-2', 'news_bulletin.start_date'],
|
||||
['end_date', 'deadline', 'span1-2', 'news_bulletin.end_date'],
|
||||
['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 %>
|
|
@ -22,7 +22,7 @@
|
|||
</tr>
|
||||
<% @news_bulletins.each do |post| %>
|
||||
<tr>
|
||||
<td class="img"><%= image_tag post.image rescue nil %></td>
|
||||
<td class="img"><%= image_tag post.image.url %></td>
|
||||
<td>
|
||||
<%= link_to post.title, panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %>
|
||||
<%= post.subtitle.html_safe rescue '' %>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% 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" %>
|
||||
<div class="btn-group topic_note">
|
||||
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
|
@ -19,7 +19,7 @@
|
|||
<ul id="topic_list">
|
||||
<% @news_bulletins.each do |post| %>
|
||||
<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>
|
||||
<p class="news_wrap"><%= post.subtitle.html_safe rescue '' %></p>
|
||||
</li>
|
||||
|
|
|
@ -83,6 +83,7 @@ en:
|
|||
approval_pass: 'Pass'
|
||||
approval_setting_window_title: 'Unit'
|
||||
update_success: Successfully Updated
|
||||
unit_name: Unit name
|
||||
# admin:
|
||||
# action: Action
|
||||
# add_language: Add language
|
||||
|
|
Reference in New Issue