Copy changes into news after merge
This commit is contained in:
parent
15bc4d4268
commit
e9b337a385
|
@ -3,6 +3,7 @@
|
|||
<% if (bulletin.create_user_id == current_user.id) || is_manager? %>
|
||||
<%= check_box_tag 'to_delete[]', bulletin.id, false, :class => "checkbox_in_list" %>
|
||||
<% end -%>
|
||||
</td>
|
||||
<td>
|
||||
<div class="label-group">
|
||||
<div class="label-td">
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
class Panel::News::BackEnd::NewsApprovalsController < OrbitBackendController
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
include AdminHelper
|
||||
|
||||
def preview_and_approve
|
||||
@bulletin = NewsBulletin.find params[:bulletin_id]
|
||||
end
|
||||
|
||||
def approve
|
||||
|
||||
end
|
||||
|
||||
def setting
|
||||
@news_bulletin_categorys = NewsBulletinCategory.all
|
||||
if params.has_key?(:category_id)
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
class Panel::News::BackEnd::NewsBulletinCategorysController < OrbitBackendController
|
||||
|
||||
before_filter :for_app_manager,:except => [:index]
|
||||
|
||||
|
||||
def index
|
||||
@news_bulletin_categorys = NewsBulletinCategory.all
|
||||
@news_bulletin_category = NewsBulletinCategory.new(:display => 'List')
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
|
||||
# before_filter :for_admin_only,:only => [:]
|
||||
# before_filter :for_app_manager,:only => [:index,:show,]
|
||||
before_filter :for_app_sub_manager,:except => [:index,:show,:get_sorted_and_filtered_news_bulletins]
|
||||
|
||||
def index
|
||||
# @news_bulletins = NewsBulletin.all
|
||||
|
@ -39,6 +42,10 @@ 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) || news_bulletin.create_user_id!=current_user.id)
|
||||
}
|
||||
|
||||
@news_bulletin_file = NewsBulletinFile.new
|
||||
@file_url = panel_news_back_end_news_bulletins_path
|
||||
|
||||
|
@ -79,15 +86,17 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
|||
|
||||
# @news_bulletin.news_bulletin_files.build
|
||||
# @news_bulletin.news_bulletin_files.new
|
||||
|
||||
get_categorys
|
||||
if get_categorys.empty?
|
||||
flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
|
||||
redirect_to :action => :index
|
||||
else
|
||||
get_tags
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @news_bulletin }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# GET /news_bulletins/1/edit
|
||||
def edit
|
||||
|
@ -311,10 +320,11 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
|||
|
||||
def get_categorys(id = nil)
|
||||
@news_bulletin_categorys = []
|
||||
@unit_list_for_anc = UnitListForAnc.all
|
||||
if(is_manager? || is_admin?)
|
||||
@news_bulletin_categorys = (id ? NewsBulletinCategory.find(id).to_a : NewsBulletinCategory.excludes('disabled' => true))
|
||||
elsif is_sub_manager?
|
||||
@news_bulletin_categorys = NewsBulletinCategory.authed_for_user(current_user,'submit_new')
|
||||
@news_bulletin_categorys = NewsBulletinCategory.authed_for_user(current_user,'submit')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -24,10 +24,19 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
|
|||
end
|
||||
|
||||
def show
|
||||
@news_bulletin = NewsBulletin.can_display.where(_id: params[:id]).first
|
||||
if params[:preview] == "true"
|
||||
preview_content
|
||||
else
|
||||
@news_bulletins = NewsBulletin.can_display.where(_id: params[:id]).first
|
||||
get_categorys
|
||||
end
|
||||
end
|
||||
|
||||
def preview_content
|
||||
@news_bulletins = NewsBulletin.find params[:id]
|
||||
get_categorys
|
||||
render :show
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
|
|
14
vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletin_categorys_helper.rb
vendored
Normal file
14
vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletin_categorys_helper.rb
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
module Panel::News::BackEnd::NewsBulletinCategorysHelper
|
||||
include ActionView::Helpers::UrlHelper
|
||||
|
||||
|
||||
def show_submit_permission_link(news_bulletin_category)
|
||||
oa = news_bulletin_category.get_object_auth_by_title('submit')
|
||||
if oa.nil?
|
||||
news_bulletin_category.object_auths.new(title: 'submit' ).save
|
||||
oa = news_bulletin_category.get_object_auth_by_title('submit')
|
||||
end
|
||||
link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
|
||||
end
|
||||
|
||||
end
|
9
vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb
vendored
Normal file
9
vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
module Panel::News::BackEnd::NewsBulletinsHelper
|
||||
|
||||
def 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) or is_manager?
|
||||
by_news_bulletin and by_user
|
||||
end
|
||||
|
||||
end
|
|
@ -33,6 +33,7 @@ class NewsBulletin
|
|||
mount_uploader :image, ImageUploader
|
||||
|
||||
belongs_to :news_bulletin_category
|
||||
belongs_to :unit_list_for_anc
|
||||
|
||||
# embeds_many :news_bulletin_links, :cascade_callbacks => true
|
||||
# embeds_many :news_bulletin_files, :cascade_callbacks => true
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
<% if news_bulletin -%>
|
||||
|
||||
<div class="modal hide fade in banner-preview" id="news_bulletin-<%=news_bulletin.id%>">
|
||||
<div class="modal-header">
|
||||
<a class="close" data-dismiss="modal">×</a>
|
||||
<h3><%= t("modal.preview") %></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="news_bulletin_slideshow">
|
||||
<iframe src=<%= panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category.id ,:preview=>true) %> style="width:1024px;height:300px" >
|
||||
|
||||
</iframe>
|
||||
|
||||
<%# preview_block_ad_images_helper(news_bulletin).each do |ad_image| -%>
|
||||
<%#= image_tag ad_image.file,:alt => (ad_image.title[locale] || " "),:time_to_next => news_bulletin.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || news_bulletin.context || " ")) %>
|
||||
<%# end -%>
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
<%= form_for news_bulletin, :url => panel_news_back_end_news_bulletin_path(news_bulletin), :html => {:class => 'clear'} do |f| %>
|
||||
<%= f.label :approval_stat, t('announcement.bulletin.approval_stat') %>
|
||||
<%= content_tag :label,:class => "radio inline" do -%>
|
||||
<%= f.radio_button :is_checked, true , {:class => 'privacy'} %>
|
||||
<%= t('announcement.bulletin.approval_pass') %>
|
||||
<% end -%>
|
||||
<%= content_tag :label,:class => "radio inline" do -%>
|
||||
<%= f.radio_button :is_checked, false, (!@news_bulletin.is_checked ? {:checked => true, :class => 'privacy'} : {})%>
|
||||
<%= t('announcement.bulletin.approval_not_pass') %>
|
||||
<% end -%>
|
||||
|
||||
<%= label :is_checked_false, t('announcement.bulletin.approval_not_pass_reason') %>
|
||||
<%= f.text_field :not_checked_reason %>
|
||||
<%= f.submit t('announcement.bulletin.submit_approval'),:class=>"btn"%>
|
||||
<% end %>
|
||||
|
||||
<a href="#" class="btn" data-dismiss="modal"><%= t("modal.close") %></a>
|
||||
</div>
|
||||
<div>
|
||||
<script type="text/javascript" src="/static/kernel.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
// $("#news_bulletin-<%#=news_bulletin.title.dehumanize%>").on("show", function () {
|
||||
// $("#news_bulletin-<%#=news_bulletin.title.dehumanize%>").find(".news_bulletin_slideshow").cycle({delay: -1000, fx: "<%#= news_bulletin.ad_fx.nil?? "fade": news_bulletin.ad_fx %>", timeoutFn: getTimeout });
|
||||
// });
|
||||
$(".modal").on("hidden", function () {
|
||||
$("#show_preview").remove();
|
||||
});
|
||||
|
||||
$("iframe").load(function(){
|
||||
// Get the body element
|
||||
var frameBody = $("iframe").contents().find("body");
|
||||
|
||||
// Get all links inside the BODY tag
|
||||
$('a', frameBody).click(function(e){
|
||||
//Disable all default actions
|
||||
e.preventDefault();
|
||||
});
|
||||
$('input', frameBody).attr("disabled", true);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<% end -%>
|
|
@ -0,0 +1,5 @@
|
|||
$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_approve',:locals => {:news_bulletin => @news_bulletin})) %>");
|
||||
var start_modal_with_id = "news_bulletin-<%=@news_bulletin.id%>";
|
||||
$("#"+start_modal_with_id).css("width","1050px");
|
||||
$("#"+start_modal_with_id).css("height","768px");
|
||||
$("#"+start_modal_with_id).css("margin","-270px 0 0 -550px");
|
|
@ -4,8 +4,14 @@
|
|||
<%= news_bulletin_category.key %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<li><%= link_to t('news_bulletin_category.edit'), edit_panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :remote => true %></li>
|
||||
<li><%= link_to t('news_bulletin_category.delete'), panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :confirm => t('news.sure?'), :method => :delete, :remote => true %></li>
|
||||
<%if is_manager? || is_admin? %>
|
||||
<li><%= show_submit_permission_link(news_bulletin_category) %></li>
|
||||
<% end %>
|
||||
<% if is_admin?%>
|
||||
<li><%= link_to t('bulletin_category.edit'), edit_panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :remote => true %></li>
|
||||
<li><%= link_to t('bulletin_category.delete'), panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
<div id="form"><%= render :partial => "form" %></div>
|
||||
<div id="form"><%= render :partial => "form" if is_manager? %></div>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -105,28 +105,6 @@
|
|||
<a class="action"><i title="A" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||
</div>
|
||||
|
||||
<h3 class="widget-title"><i class="icons-link icons-white"></i>Audit</h3>
|
||||
<div class="widget-content">
|
||||
|
||||
<% if is_manager? || @news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) || current_user.admin? %>
|
||||
<div class="controls">
|
||||
<%= f.label :approval_stat, t('news.news_bulletin.approval_stat') %>
|
||||
<%= content_tag :label,:class => "radio inline" do -%>
|
||||
<%= f.radio_button :is_checked, true , {:class => 'privacy'} %>
|
||||
<%= t('news.news_bulletin.approval_pass') %>
|
||||
<% end -%>
|
||||
<%= content_tag :label,:class => "radio inline" do -%>
|
||||
<%= f.radio_button :is_checked, false, (!@news_bulletin.is_checked ? {:checked => true, :class => 'privacy'} : {})%>
|
||||
<%= t('news.news_bulletin.approval_not_pass') %>
|
||||
<% end -%>
|
||||
<div class="select-role">
|
||||
<%= label :is_checked_false, t('news.news_bulletin.approval_not_pass_reason') %>
|
||||
<%= f.text_field :not_checked_reason %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% elsif current_user.admin? %>
|
||||
<%= f.hidden_field :is_checked,:value => true%>
|
||||
|
@ -140,6 +118,9 @@
|
|||
<div id="post-body">
|
||||
<div id="post-body-content" class="clear">
|
||||
|
||||
<%= f.label :unit_list_for_anc%>
|
||||
<%= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
|
||||
|
||||
<%= f.label :category %>
|
||||
<%= f.select :news_bulletin_category_id, @news_bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<tr id="<%= dom_id news_bulletin %>" class="with_action">
|
||||
<td><%= check_box_tag 'to_delete[]', news_bulletin.id, false, :class => "checkbox_in_list" %></td>
|
||||
<td>
|
||||
<% if (news_bulletin.create_user_id == current_user.id) || is_manager? %>
|
||||
<%= check_box_tag 'to_delete[]', news_bulletin.id, false, :class => "checkbox_in_list" %>
|
||||
<% end -%>
|
||||
</td>
|
||||
<td>
|
||||
<div class="label-group">
|
||||
<div class="label-td">
|
||||
|
@ -27,8 +31,11 @@
|
|||
<td><%= news_bulletin.news_bulletin_category.i18n_variable[I18n.locale] %></td>
|
||||
<td>
|
||||
<%= link_to news_bulletin.title[I18n.locale], panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category.id) rescue ''%>
|
||||
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<% if (news_bulletin.create_user_id == current_user.id) || is_manager? %>
|
||||
|
||||
<% if current_user.admin? || (!news_bulletin.is_rejected? && !news_bulletin.is_checked?) %>
|
||||
<li><%= link_to t('news_bulletin.edit'), edit_panel_news_back_end_news_bulletin_path(news_bulletin) %></li>
|
||||
<li class="dropdown">
|
||||
|
@ -43,11 +50,14 @@
|
|||
</li>
|
||||
<%#= debugger %>
|
||||
<%#= a=1 %>
|
||||
<% if (news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) or is_manager?) and !news_bulletin.is_expired? %>
|
||||
<li><%= link_to t('news.news_bulletin.approval'), edit_panel_news_back_end_news_bulletin_path(news_bulletin) %></li><%#= #TODO add ancher so user can quick access into that part %>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
<li class="dropdown"><%= link_to t('news_bulletin.delete'), panel_news_back_end_news_bulletin_path(news_bulletin), :confirm => t('news.sure?'), :method => :delete, :remote => true %></li>
|
||||
<% end %>
|
||||
<% if show_approval_link(news_bulletin) %>
|
||||
<li><%= link_to t('news.news_bulletin.approval'), panel_news_back_end_news_bulletin_approval_preview_path(news_bulletin) %></li><%#= #TODO add ancher so user can quick access into that part %>
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -26,5 +26,7 @@
|
|||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "news_bulletin_form" %>
|
||||
<%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %>
|
||||
<%= javascript_include_tag "inc/modal-preview" %>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<div class="info1">
|
||||
<span class="date"><%= @news_bulletin.postdate %></span>
|
||||
|
|
||||
<a href="" class="unit"><%= User.find(@news_bulletin.create_user_id).name %></a>
|
||||
<a href="" class="unit"><%= @news_bulletin.unit_list_for_anc.title[I18n.locale] rescue '' %></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="news_image">
|
||||
|
|
|
@ -6,6 +6,8 @@ Rails.application.routes.draw do
|
|||
match 'update_setting' => "news_approvals#update_setting" ,:as => :news_approval_update_setting
|
||||
|
||||
resources :news_bulletins do
|
||||
match "approve/:news_bulletin_id" => "approvals#preview_and_approve",:as => :approval_preview,:via => :put
|
||||
match "approve/:news_bulletin_id" => "approvals#approve",:as => :approve,:via => :post
|
||||
match "link_quick_add/:news_bulletin_id" => "news_bulletins#link_quick_add" ,:as => :link_quick_add
|
||||
match "link_quick_edit/:news_bulletin_id" => "news_bulletins#link_quick_edit" ,:as => :link_quick_edit
|
||||
member do
|
||||
|
@ -31,7 +33,9 @@ Rails.application.routes.draw do
|
|||
resources :tags
|
||||
end
|
||||
namespace :front_end do
|
||||
resources :news_bulletins
|
||||
resources :news_bulletins # do
|
||||
# match "preview" => "news_bulletins#preview_content",:as => :get_preview_content
|
||||
# end
|
||||
end
|
||||
namespace :widget do
|
||||
match "news_bulletins" => "news_bulletins#index"
|
||||
|
|
Loading…
Reference in New Issue