orbit-basic/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb

58 lines
1.8 KiB
Ruby

module Panel::Announcement::BackEnd::BulletinsHelper
def show_reject_reason(bulletin)
by_bulletin = bulletin.is_rejected
by_user = (((bulletin.create_user_id == current_user.id) rescue nil) or is_manager? or is_admin?)
by_bulletin && by_user
end
def show_form_status_field(bulletin)
#by_bulletin = (!bulletin.is_expired? and bulletin.is_pending?)
by_user = ((bulletin.bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?)
by_user
end
def show_approval_link(bulletin)
by_bulletin = (!bulletin.is_expired? and bulletin.is_pending?)
by_user = ((bulletin.bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?)
by_bulletin and by_user
end
def show_delete_link(bulletin)
if !current_user.nil?
by_bulletin = (bulletin.create_user_id == current_user.id )
by_user = (is_manager? or is_admin?)
by_bulletin or by_user
else
false
end
end
def show_bulletin_title_at_index (bulletin)
if bulletin.is_checked?
link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue ''
else
bulletin.title
end
end
def file_picture_preview_setting(file_path)
res= ""
ext = File.extname(file_path)
unless file_path.nil?
case ext
when ".jpg",".jpeg",".png",".gif"
#res = '<div class="for_preview" style="display:none;">'
#res << image_tag(file_path, {:title => t(:view)})
#res << '</div>'
#res.html_safe
{"data-content" => "#{image_tag file_path}" }
else
{"data-content" => t("sys.not_previewable") }
end
end
end
end