Compare commits

..
16 changed files with 42 additions and 67 deletions

No files matched your search

+2 -7
View File
@@ -15,13 +15,8 @@ class ObjectAuth < PrototypeAuth
end
def check_user_has_can_access_app
if auth_obj["_type"] == "PageContext"
module_app = ModuleApp.where(:key=>'page_content').first
sub_managing_users = module_app.sub_managing_users rescue []
else
sub_managing_users = auth_obj.module_app.sub_managing_users rescue []
module_app = auth_obj.module_app
end
sub_managing_users = auth_obj.module_app.sub_managing_users rescue []
module_app = auth_obj.module_app
self.auth_users.each do |auth_user|
if !sub_managing_users.include? auth_user && !auth_user.admin?
module_app.assign_sub_manager(auth_user,User.current)
-10
View File
@@ -55,16 +55,6 @@ class PrototypeAuth
if (self.send item).include? obj.id
(self.send item).delete obj.id
self.save!
if auth_obj["_type"] == "PageContext"
module_app = ModuleApp.where(:key=>'page_content').first
else
module_app = auth_obj.module_app
end
module_app.remove_sub_manager(obj)
module_app.save
else
false #should put error message for user not existed in list
end
@@ -44,8 +44,15 @@
<% end %>
</div>
<% unless @bulletin.user_ids.blank? %>
<div class="promoter">
<div>
<p><%= t(:promoter) %>:</p>
<span><%= @bulletin.get_users.map{|u| "<span>#{u.name}</span>"}.join(', ').html_safe %></span>
</div>
</div>
<% end %>
<%= share_links(@bulletin, 'announcement') %>
<% unless @bulletin.user_ids.blank? %>
<%= render partial: 'admin/member_selects/promoter_front', locals: {users: @bulletin.get_users} %>
<% end %>
<%= render partial: 'admin/member_selects/promoter_front', locals: {users: @bulletin.get_users} %>
@@ -55,7 +55,6 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController
else
@archive_files = ArchiveFile.default_sort(params[:sort]).all.can_display.merge(ArchiveFileCategory.excludes('disable' => true)).desc( :is_top).page( params[:page_main] ).per(@page_num)
end
get_categorys
@@ -27,6 +27,9 @@ class Panel::Archive::Widget::ArchiveFilesController < OrbitWidgetController
@category_id = @part.category
date_now = Time.now
# binding.pry
if !params[:category_id].blank? && !params[:tag_id].blank?
@archive_files = ArchiveFile.default_sort(params[:sort]).all.can_display.where(:tagged_ids.in => params[:tag_id]).any_in(:archive_file_category_id => params[:category_id]).merge(ArchiveFileCategory.excludes('disable' => true)).desc( :is_top ).page( params[:page_main] ).per(@page_num)
@archive_file_categorys = ArchiveFileCategory.any_in(:_id => params[:category_id]).excludes('disable' => true)
+1 -1
View File
@@ -42,10 +42,10 @@ class ArchiveFile
# text :titles do
# title_translations.to_a.collect{|t| t[1]}
# end
# boolean :frontend_search do
# !is_hidden
# end
# end
def self.search( category_id = nil )
+1 -2
View File
@@ -1,8 +1,7 @@
class ArchiveTag < Tag
has_and_belongs_to_many :archive_files
def get_visible_links(sort = :name)
self.archive_files.where(:is_hidden => false).desc(:is_top, sort)
end
@@ -8,15 +8,15 @@
<tr>
<th class="column-ctrl col-title"><%= sortable(:title, t("archive.Title"))%></th>
<th class="column-ctrl col-file"><%= t("archive.Files")%></th>
<th class="column-ctrl col-promoter"><%= t(:promoter)%></th>
<th class="column-ctrl col-file"><%= t(:promoter)%></th>
</tr>
</thead>
<tbody>
<% @archive_files.each_with_index do |post,i| %>
<tr <% if ( (i + 1) % 2 ) == 0 %> class="even" <% end %>>
<td class="col-title"><div class="o-archives-title"><%= post.title %></div></td>
<td class="col-file">
<td><div class="o-archives-title"><%= post.title %></div></td>
<td>
<div class="o-archives-list-item">
<% if !post.archive_file_multiples.blank? %>
<ol>
@@ -32,7 +32,7 @@
<% end %>
</div>
</td>
<td class="col-promoter">
<td>
<% unless post.get_users.blank? %>
<div class="promoter-block">
<ul>
@@ -1,9 +1,6 @@
<script type="text/javascript">
var local_host = "<%= request.host %>";
if (local_host[0] == "g" && local_host[1] == "a") {
local_host = "www." + local_host;
}
function hide_current_host_name(localhost) {
$('input[type=checkbox]').each(function() {
@@ -83,22 +80,21 @@ $(document).ready(function() {
<tr>
<td colspan="5" class="dept_options">
<div class="dept_options">
<!-- Example <%= check_box("school", "depts", {:multiple => true}, 'ntu_ga_test_p.tp.rulingcom.com', nil) %><%= label_tag("ntu_ga_test_p.tp.rulingcom.com", "測試站總務處 (ntu_ga_test_p)") %>
<%= check_box("school", "depts", {:multiple => true}, 'ntu_ga_test.tp.rulingcom.com', nil) %><%= label_tag("ntu_ga_test.tp.rulingcom.com", "測試站總務處經管組 (ntu_ga_test)") %> -->
<%= check_box("school", "depts", {:multiple => true}, 'ntu_ga_test_p.tp.rulingcom.com', nil) %><%= label_tag("ntu_ga_test_p.tp.rulingcom.com", "測試站總務處 (ntu_ga_test_p)") %>
<%= check_box("school", "depts", {:multiple => true}, 'ntu_ga_test.tp.rulingcom.com', nil) %><%= label_tag("ntu_ga_test.tp.rulingcom.com", "測試站總務處經管組 (ntu_ga_test)") %>
<!-- <%= check_box("school", "depts", {:multiple => true}, (request.host + ":3000"), nil) %><%= label_tag((request.host + ":3000"), "測試站3000") %>
<%= check_box("school", "depts", {:multiple => true}, (request.host + ":4000"), nil) %><%= label_tag((request.host + ":4000"), "測試站4000") %> -->
<%= check_box("school", "depts", {:multiple => true}, "www.ga.ntu.edu.tw", nil) %><%= label_tag("www.ga.ntu.edu.tw", "總務處") %>
<%= check_box("school", "depts", {:multiple => true}, "sec.ga.ntu.edu.tw", nil) %><%= label_tag("sec.ga.ntu.edu.tw", "總務長室暨總務處秘書室") %>
<%= check_box("school", "depts", {:multiple => true}, "doc.ga.ntu.edu.tw", nil) %><%= label_tag("doc.ga.ntu.edu.tw", "文書組") %>
<%= check_box("school", "depts", {:multiple => true}, "general.ga.ntu.edu.tw", nil) %><%= label_tag("general.ga.ntu.edu.tw", "事務組") %>
<%= check_box("school", "depts", {:multiple => true}, "property.ga.ntu.edu.tw", nil) %><%= label_tag("property.ga.ntu.edu.tw", "保管組") %>
<%= check_box("school", "depts", {:multiple => true}, "construction.ga.ntu.edu.tw", nil) %><%= label_tag("construction.ga.ntu.edu.tw", "營繕組") %>
<%= check_box("school", "depts", {:multiple => true}, "cashier.ga.ntu.edu.tw", nil) %><%= label_tag("cashier.ga.ntu.edu.tw", "出納組") %>
<%= check_box("school", "depts", {:multiple => true}, "procurement.ga.ntu.edu.tw", nil) %><%= label_tag("procurement.ga.ntu.edu.tw", "採購組") %>
<%= check_box("school", "depts", {:multiple => true}, "fss.ga.ntu.edu.tw", nil) %><%= label_tag("fss.ga.ntu.edu.tw", "經營管理組") %>
<%= check_box("school", "depts", {:multiple => true}, "police.ga.ntu.edu.tw", nil) %><%= label_tag("police.ga.ntu.edu.tw", "駐警隊") %>
<%= check_box("school", "depts", {:multiple => true}, "social.ga.ntu.edu.tw", nil) %><%= label_tag("social.ga.ntu.edu.tw", "社科院總務分處") %>
<%= check_box("school", "depts", {:multiple => true}, "medicine.ga.ntu.edu.tw", nil) %><%= label_tag("medicine.ga.ntu.edu.tw", "醫學院總務分處") %>
<%= check_box("school", "depts", {:multiple => true}, "", nil) %><%= label_tag(:dep1, "總務長室暨總務處秘書室") %>
<%= check_box("school", "depts", {:multiple => true}, "文書組", nil) %><%= label_tag(:dep2, "文書組") %>
<%= check_box("school", "depts", {:multiple => true}, "事務組", nil) %><%= label_tag(:dep3, "事務組") %>
<%= check_box("school", "depts", {:multiple => true}, "保管組", nil) %><%= label_tag(:dep4, "保管組") %>
<%= check_box("school", "depts", {:multiple => true}, "營繕組", nil) %><%= label_tag(:dep5, "營繕組") %>
<%= check_box("school", "depts", {:multiple => true}, "出納組", nil) %><%= label_tag(:dep6, "出納組") %>
<%= check_box("school", "depts", {:multiple => true}, "採購組", nil) %><%= label_tag(:dep7, "採購組") %>
<%= check_box("school", "depts", {:multiple => true}, "經營管理組", nil) %><%= label_tag(:dep8, "經營管理組") %>
<%= check_box("school", "depts", {:multiple => true}, "駐警隊", nil) %><%= label_tag(:dep9, "駐警隊") %>
<%= check_box("school", "depts", {:multiple => true}, "社科院總務分處", nil) %><%= label_tag(:dep10, "社科院總務分處") %>
<%= check_box("school", "depts", {:multiple => true}, "醫學院總務分處", nil) %><%= label_tag(:dep11, "醫學院總務分處") %>
</div>
</td>
</tr>
@@ -85,9 +85,7 @@ $(document).ready(function(){
</div>
</div>
<div class="control-group">
<%= f.label t('ask.validate_code'), class: 'control-label required' %>
<div class="controls">
<label><%= t('ask.validate_code_note') %></label>
<%= gotcha_error %>
<%= gotcha%>
</div>
-2
View File
@@ -18,8 +18,6 @@ en:
admin: Administrator
new_question: New question
pending: Pending
validate_code: Verification code
validate_code_note: Please answer the following verification questions.
mongoid:
attributes:
ask_question:
@@ -23,8 +23,6 @@ zh_tw:
admin: 管理者
new_question: 新的發問
pending: 待處理
validate_code: 驗證碼
validate_code_note: 請回答下列驗證問句。
mongoid:
attributes:
ask_question:
@@ -2,7 +2,7 @@ class Panel::PageContent::BackEnd::PageContextsController < OrbitBackendControll
before_filter :force_order_for_visitor,:only=>[:index]
before_filter :force_order_for_user,:except => [:index]
# before_filter :for_app_manager,:except => [:index]
before_filter :for_app_manager,:except => [:index]
before_filter :for_app_sub_manager,:except => [:index]
#before_filter :is_admin?
@@ -4,7 +4,7 @@
<%= page_context.page.title %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<%if is_manager? || is_admin? || page_context.authed_users("Edit").include?(current_user)%>
<%if is_manager? || is_admin? || page_context.authed_users(:edit).include?(current_user)%>
<li><%= link_to t(:edit), edit_panel_page_content_back_end_page_context_path(page_context, page: params[:page], sort: params[:sort], direction: params[:direction], sort_options: params[:sort_options]) %></li>
<%if (is_manager? || is_admin?) %>
<li><%=show_page_context_edit_auth_link page_context%></li>
@@ -232,9 +232,7 @@ class Panel::Survey::BackEnd::SurveysController < OrbitBackendController
@survey = ::Survey.find(params[:id])
@chart_data, @survey_questions, @survey_answers = @survey.generate_chart_data
head = 'EF BB BF'.split(' ').map{|a|a.hex.chr}.join()
csv = CSV.generate(csv = head) do |csv|
csv = CSV.generate do |csv|
row = []
@survey_questions.each do |question|
row << question.title
@@ -279,7 +277,7 @@ class Panel::Survey::BackEnd::SurveysController < OrbitBackendController
@survey_questions.each do |question|
if question.type == ::SurveyQuestion::Radiogroup
options = Hash[question.survey_question_options.collect{|o| [ o.id.to_s, o.name ] }]
row << Hash[answer[question.id.to_s].map {|o, g| [options[o], g]}] if !answer[question.id.to_s].blank?
row << Hash[answer[question.id.to_s].map {|o, g| [options[o], g]}]
else
row << answer[question.id.to_s]
end
@@ -291,16 +289,11 @@ class Panel::Survey::BackEnd::SurveysController < OrbitBackendController
end
respond_to do |format|
format.html
format.csv { send_data csv }
format.csv do
response.headers["Content-Type"] = "text/csv; charset=big5"
render :text => csv.encode('Big5')
end
end
# respond_to do |format|
# format.csv do
# response.headers["Content-Type"] = "text/csv; charset=big5"
# render :text => csv.encode('Big5')
# end
# end
end
def set_answers
-1
View File
@@ -20,7 +20,6 @@ module Faq
widgets do
default_widget do
sorting 'desc(:postdate)'
enable ["typeA"]
query 'Survey.any_of( {:postdate.lte => Time.now} )'
# link_field :title, {:method => 'panel_survey_front_end_survey_path',:args=>:self}