diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb
index db22e501..b69def3b 100644
--- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb
@@ -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 -%>
+
@@ -35,26 +36,26 @@
<% if (bulletin.create_user_id == current_user.id) || is_manager? %>
- <% if current_user.admin? || (!bulletin.is_rejected? && !bulletin.is_checked?) %>
- - <%= link_to t('bulletin.edit'), edit_panel_announcement_back_end_bulletin_path(bulletin) %>
- -
- <%= t(:quick_edit) %>
-
-
- <%#= debugger %>
- <%#= a=1 %>
-
- <% end %>
- - <%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(bulletin), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %>
+ <% if current_user.admin? || (!bulletin.is_rejected? && !bulletin.is_checked?) %>
+ - <%= link_to t('bulletin.edit'), edit_panel_announcement_back_end_bulletin_path(bulletin) %>
+ -
+ <%= t(:quick_edit) %>
+
+
+ <%#= debugger %>
+ <%#= a=1 %>
+
+ <% end %>
+ - <%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(bulletin), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %>
<% end -%>
<% if show_approval_link(bulletin) %>
- - <%= link_to t('announcement.bulletin.approval'), panel_announcement_back_end_bulletin_approval_preview_path(bulletin),:class => 'preview_trigger' %>
<%#= #TODO add ancher so user can quick access into that part %>
+ - <%= link_to t('announcement.bulletin.approval'), panel_announcement_back_end_bulletin_approval_preview_path(bulletin),:class => 'preview_trigger' %>
<%#= #TODO add ancher so user can quick access into that part %>
<% end %>
diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_approvals_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_approvals_controller.rb
index c6cb33ea..c6eda9d0 100644
--- a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_approvals_controller.rb
+++ b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_approvals_controller.rb
@@ -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)
diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletin_categorys_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletin_categorys_controller.rb
index 83ca09f8..956e98dc 100644
--- a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletin_categorys_controller.rb
+++ b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletin_categorys_controller.rb
@@ -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')
diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb
index f5c2b5e6..a2a1a881 100644
--- a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb
+++ b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb
@@ -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
@@ -75,17 +82,19 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
def new
@news_bulletin = NewsBulletin.new
- @link_url = panel_news_back_end_news_bulletins_path
+ @link_url = panel_news_back_end_news_bulletins_path
# @news_bulletin.news_bulletin_files.build
# @news_bulletin.news_bulletin_files.new
-
- get_categorys
- get_tags
-
- respond_to do |format|
- format.html # new.html.erb
- format.xml { render :xml => @news_bulletin }
+ 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
@@ -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
diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb
index 12d0cac6..5c870604 100644
--- a/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb
+++ b/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb
@@ -24,10 +24,19 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
end
def show
- @news_bulletin = NewsBulletin.can_display.where(_id: params[:id]).first
- get_categorys
+ 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
diff --git a/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletin_categorys_helper.rb b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletin_categorys_helper.rb
new file mode 100644
index 00000000..8ad75108
--- /dev/null
+++ b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletin_categorys_helper.rb
@@ -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
\ No newline at end of file
diff --git a/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb
new file mode 100644
index 00000000..35a3afee
--- /dev/null
+++ b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb
@@ -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
\ No newline at end of file
diff --git a/vendor/built_in_modules/news/app/models/news_bulletin.rb b/vendor/built_in_modules/news/app/models/news_bulletin.rb
index 101ed5d2..538180dc 100644
--- a/vendor/built_in_modules/news/app/models/news_bulletin.rb
+++ b/vendor/built_in_modules/news/app/models/news_bulletin.rb
@@ -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
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/_modal_approve.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/_modal_approve.html.erb
new file mode 100644
index 00000000..83a7b38f
--- /dev/null
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/_modal_approve.html.erb
@@ -0,0 +1,69 @@
+ <% if news_bulletin -%>
+
+
+
+
+
+
+
+ <%# 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 -%>
+
+
+
+
+
+
+
+
+
+
+
+<% end -%>
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/preview_and_approve.js.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/preview_and_approve.js.erb
new file mode 100644
index 00000000..4191ae04
--- /dev/null
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/preview_and_approve.js.erb
@@ -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");
\ No newline at end of file
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb
index 01d58f98..377091bd 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb
@@ -4,8 +4,14 @@
<%= news_bulletin_category.key %>
- - <%= link_to t('news_bulletin_category.edit'), edit_panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :remote => true %>
- - <%= 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 %>
+ <%if is_manager? || is_admin? %>
+ - <%= show_submit_permission_link(news_bulletin_category) %>
+ <% end %>
+ <% if is_admin?%>
+ - <%= link_to t('bulletin_category.edit'), edit_panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :remote => true %>
+ - <%= 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 %>
+ <% end %>
+
|
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/index.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/index.html.erb
index caa4981f..c876b6c8 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/index.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/index.html.erb
@@ -17,7 +17,7 @@
-<%= render :partial => "form" %>
+<%= render :partial => "form" if is_manager? %>
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb
index c7dfd155..ce00b63f 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb
@@ -105,28 +105,6 @@
-
-
-
- <% if is_manager? || @news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) || current_user.admin? %>
-
- <%= 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 -%>
-
- <%= label :is_checked_false, t('news.news_bulletin.approval_not_pass_reason') %>
- <%= f.text_field :not_checked_reason %>
-
-
-
- <% end %>
-
<% elsif current_user.admin? %>
<%= f.hidden_field :is_checked,:value => true%>
@@ -139,7 +117,10 @@
-
+
+ <%= 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" %>
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb
index c800bf18..976cab00 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb
@@ -1,5 +1,9 @@
- <%= check_box_tag 'to_delete[]', news_bulletin.id, false, :class => "checkbox_in_list" %> |
+
+ <% 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 -%>
+ |
@@ -27,27 +31,33 @@
<%= news_bulletin.news_bulletin_category.i18n_variable[I18n.locale] %> |
<%= 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 ''%>
+
- <% if current_user.admin? || (!news_bulletin.is_rejected? && !news_bulletin.is_checked?) %>
- - <%= link_to t('news_bulletin.edit'), edit_panel_news_back_end_news_bulletin_path(news_bulletin) %>
- -
- <%= t(:quick_edit) %>
-
-
- <%#= debugger %>
- <%#= a=1 %>
- <% if (news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) or is_manager?) and !news_bulletin.is_expired? %>
- - <%= link_to t('news.news_bulletin.approval'), edit_panel_news_back_end_news_bulletin_path(news_bulletin) %>
<%#= #TODO add ancher so user can quick access into that part %>
- <% end %>
+ <% if (news_bulletin.create_user_id == current_user.id) || is_manager? %>
+
+ <% if current_user.admin? || (!news_bulletin.is_rejected? && !news_bulletin.is_checked?) %>
+ - <%= link_to t('news_bulletin.edit'), edit_panel_news_back_end_news_bulletin_path(news_bulletin) %>
+ -
+ <%= t(:quick_edit) %>
+
+
+ <%#= debugger %>
+ <%#= a=1 %>
+
+ <% end %>
+ - <%= link_to t('news_bulletin.delete'), panel_news_back_end_news_bulletin_path(news_bulletin), :confirm => t('news.sure?'), :method => :delete, :remote => true %>
<% end %>
- - <%= link_to t('news_bulletin.delete'), panel_news_back_end_news_bulletin_path(news_bulletin), :confirm => t('news.sure?'), :method => :delete, :remote => true %>
+ <% if show_approval_link(news_bulletin) %>
+ - <%= link_to t('news.news_bulletin.approval'), panel_news_back_end_news_bulletin_approval_preview_path(news_bulletin) %>
<%#= #TODO add ancher so user can quick access into that part %>
+ <% end %>
+
|
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/index.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/index.html.erb
index 123b1a91..742293fe 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/index.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/index.html.erb
@@ -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 %>
diff --git a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb
index 37e3e1f3..67bfb396 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb
@@ -4,7 +4,7 @@
diff --git a/vendor/built_in_modules/news/config/routes.rb b/vendor/built_in_modules/news/config/routes.rb
index aaf68801..b7882d2d 100644
--- a/vendor/built_in_modules/news/config/routes.rb
+++ b/vendor/built_in_modules/news/config/routes.rb
@@ -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"
|