Changes for NTU General Affairs

This commit is contained in:
chris committed 2013-09-13 15:10:27 +08:00
1 parent d766eea9f4
commit 7c398ce4fe
73 files changed
+45400 -93

No files matched your search

@@ -95,6 +95,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# GET /bulletins/1/edit
def edit
@bulletin = Bulletin.find(params[:id])
@users = @bulletin.get_users
if !current_user.admin? && (@bulletin.is_rejected? || @bulletin.is_checked?)
redirect_to :action => :index
else
@@ -28,6 +28,7 @@ class Bulletin
field :create_user_id
field :update_user_id, :class_name => "User"
field :user_ids
field :is_top, :type => Boolean, :default => false
field :is_hot, :type => Boolean, :default => false
@@ -216,6 +217,10 @@ class Bulletin
preview_object
end
def get_users
User.find(self.user_ids) rescue []
end
protected
@@ -116,6 +116,17 @@
<% elsif current_user.admin? %>
<%= f.hidden_field :is_checked,:value => true%>
<% end %>
<div id="widget-member" class="widget-box widget-size-300">
<div class="widget-action clear tip" title="Rejected Report">
<a class="action"><i class="icon-cog icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag"></i><%= t(:promoter) %></h3>
<div class="widget-content clear form-horizontal">
<%= render partial: 'admin/member_selects/selection_box', locals: {field: 'bulletin[user_ids][]', users: @users} %>
</div>
</div>
</div>
@@ -130,7 +141,7 @@
<%= f.label :category,t(:category)%>
<%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.title, t.id ]}, {}, :class => "input-medium" %>
<ul class="nav nav-tabs">
<%# @site_valid_locales.each_with_index do |locale, i| %>
<% @site_valid_locales.each_with_index do |locale, i| %>
@@ -15,6 +15,7 @@
<div class="news_paragraph">
<%= @bulletin.text.html_safe rescue '' %>
</div>
<div class="linkAndFile">
<% if @bulletin.bulletin_links.size > 0 %>
<div>
@@ -43,4 +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') %>
<%= render partial: 'admin/member_selects/promoter_front', locals: {users: @bulletin.get_users} %>
@@ -133,4 +133,28 @@ border-radius: 3px;
}
.o-archives.layout-table .o-archives-category {
font-weight: normal;
}
.o-archives.layout-table table {
width: 100%;
}
.o-archives.layout-table tbody tr td {
border-top: none;
padding: 0;
}
.o-archives.layout-table tbody tr:nth-child(odd) td {
border-bottom: none;
padding: 10px 0 0;
}
.o-archives.layout-table tbody tr:nth-child(even) td .o-archives-category {
margin-bottom: 5px;
}
.o-archives.layout-table tbody .o-archives-list-item ol {
margin: 0;
padding: 0;
}
.o-archives.layout-table tbody .promoter-block {
margin: 0 0 10px;
padding: 0;
background-color: transparent;
border: none;
}
@@ -70,6 +70,7 @@ class Panel::Archive::BackEnd::ArchiveFilesController < OrbitBackendController
# GET /archive_files/1/edit
def edit
@archive_file = ArchiveFile.find(params[:id])
@users = @archive_file.get_users
@tags = get_tags
end
@@ -60,6 +60,12 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController
get_categorys
end
def download
file = ArchiveFileMultiple.find(params[:id])
file.update_attribute(:download_count, file.download_count + 1)
render text: 'OK'
end
protected
def reload_archive_files
+10 -5
View File
@@ -20,11 +20,12 @@ class ArchiveFile
field :create_user_id
field :update_user_id
field :is_top, :type => Boolean, :default => false
field :is_hot, :type => Boolean, :default => false
field :is_hidden, :type => Boolean, :default => false
field :user_ids
field :is_top, :type => Boolean, :default => false
field :is_hot, :type => Boolean, :default => false
field :is_hidden, :type => Boolean, :default => false
scope :can_display,where(is_hidden: false)
# belongs_to :archive_file_category
@@ -85,4 +86,8 @@ class ArchiveFile
end
end
def get_users
User.find(self.user_ids) rescue []
end
end
@@ -9,7 +9,7 @@ class ArchiveFileMultiple
field :file_title, localize: true
# field :description
field :choose_lang, :type => Array, :default => nil
field :download_count, type: Integer, default: 0
field :should_destroy, :type => Boolean
default_scope asc(:sort_number)
@@ -31,8 +31,18 @@
<%= tag.name %>
<% end %>
</div>
</div>
</div>
<div id="widget-member" class="widget-box widget-size-300">
<div class="widget-action clear tip" title="Rejected Report">
<a class="action"><i class="icon-cog icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag"></i><%= t(:promoter) %></h3>
<div class="widget-content clear form-horizontal">
<%= render partial: 'admin/member_selects/selection_box', locals: {field: 'archive_file[user_ids][]', users: @users} %>
</div>
</div>
</div>
@@ -86,12 +96,13 @@
<th>File</th>
<th>File Name</th>
<th class="span2"><%= t('呈現語系')%></th>
<th class="span2"><%= t('archive.download_count')%></th>
<th class="span1"></th>
</tr>
</thead>
<tfoot>
<tr>
<td style="text-align:center" colspan="4">
<td style="text-align:center" colspan="6">
<div id='add_archive_file_multiple' class="info_input archive_file_multiples_block">
<%= hidden_field_tag 'archive_file_multiple_field_count', @archive_file.archive_file_multiples.count %>
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i> ADD/新增</span></a>
@@ -4,7 +4,7 @@
<td>
<div class="control-group">
<div class="controls">
<%= f.text_field :sort_number %>
<%= f.text_field :sort_number, class: 'input-mini' %>
</div>
</div>
</td>
@@ -47,18 +47,19 @@
<% end %>
<%= hidden_field_tag 'archive_file[archive_file_multiples_attributes][0][choose_lang][]', '' %>
</td>
<td>
<span class="action">
<% if form_file.new_record? %>
<a class="delete"><i class="icon-remove"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
</span>
<%= form_file.download_count %>
</td>
<td>
<span class="action">
<% if form_file.new_record? %>
<a class="delete"><i class="icon-remove"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
</span>
</td>
</tr>
@@ -8,7 +8,7 @@
<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-category"><%= sortable(:archive_file_category, t("archive.Category"))%></th>
<th class="column-ctrl col-file"><%= t(:promoter)%></th>
</tr>
</thead>
<tbody>
@@ -23,7 +23,7 @@
<% post.archive_file_multiples.asc(:_id).each do | afile | %>
<% if afile.file.file and afile.choose_lang_display(I18n.locale.to_s) %>
<li>
<%= link_to afile.file_title, afile.file.url, {:target => '_blank', :title => afile.file_title, :class => "o-archives-file"} %>
<%= link_to afile.file_title, afile.file.url, {:target => '_blank', :title => afile.file_title, :class => "o-archives-file download_count", rel: download_panel_archive_front_end_archive_file_path(afile, inner: true)} %>
<%= post.get_file_icon(afile.file.url) %>
</li>
<% end %>
@@ -32,9 +32,21 @@
<% end %>
</div>
</td>
<td><div class="o-archives-category">
<%= post.archive_file_category.title %>
</div></td>
<td>
<% unless post.get_users.blank? %>
<div class="promoter-block">
<ul>
<% post.get_users.each do |user| %>
<li class="promoter">
<p>
<%= link_to user.name, "mailto:#{user.email}", class: "promoter-name" %> / <span class="promoter-phone"><%= user.office_tel %></span>
</p>
</li>
<% end %>
</ul>
</div>
<% end %>
</td>
</tr>
<% end %>
@@ -44,13 +56,10 @@
<%= paginate @archive_files, :param_name => :page_main, :params => {:inner => 'false'} %>
<%= stylesheet_link_tag "archive/archives" %>
<script>
$(document).ready(function(){
$('.download_count').on('click', function(){
$.getScript($(this).attr('rel'));
});
});
</script>
@@ -7,12 +7,3 @@
</div>
<%= stylesheet_link_tag "archive/archives" %>
@@ -27,4 +27,6 @@
</div>
</div>
<%= render partial: 'admin/member_selects/promoter_front', locals: {users: @archive_file.get_users} %>
<%= stylesheet_link_tag "archive/archives" %>
+1
View File
@@ -2,6 +2,7 @@ en:
archive:
archive: Archive
download_count: Download count
Title: Title
Files: Files
Category: Category
@@ -2,6 +2,7 @@ zh_tw:
archive:
archive: 檔案室
download_count: 下載次數
Title: 標題
Files: 檔案
Category: 類別
+5 -1
View File
@@ -12,7 +12,11 @@ Rails.application.routes.draw do
end
namespace :front_end do
match "archive_files" => "archive_files#index"
resources :archive_files
resources :archive_files do
member do
get 'download'
end
end
end
namespace :widget do
match "index" => "archive_files#index"
@@ -2,6 +2,8 @@ class Panel::Ask::BackEnd::AskAcknowledgementsController < OrbitBackendControlle
include AdminHelper
include OrbitControllerLib::DivisionForDisable
before_filter :for_app_manager
def initialize
super
@app_title = 'ask_acknowledgement'
@@ -3,6 +3,8 @@ class Panel::Ask::BackEnd::AskAdminsController < OrbitBackendController
include AdminHelper
include OrbitControllerLib::DivisionForDisable
before_filter :for_app_manager
def initialize
super
@app_title = 'ask_admins'
@@ -3,6 +3,8 @@ class Panel::Ask::BackEnd::AskCategoriesController < OrbitBackendController
include AdminHelper
include OrbitControllerLib::DivisionForDisable
before_filter :for_app_manager
def initialize
super
@app_title = 'ask_categories'
@@ -5,9 +5,11 @@ class Panel::Ask::BackEnd::AskQuestionsController < OrbitBackendController
include AdminHelper
include OrbitControllerLib::DivisionForDisable
before_filter :for_app_manager
def initialize
super
@app_title = 'ask_questions'
@app_title = 'ask'
end
def index
@@ -3,6 +3,8 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController
include AdminHelper
include OrbitControllerLib::DivisionForDisable
before_filter :for_app_manager
def initialize
super
@app_title = 'ask_replies'
+2 -1
View File
@@ -2,7 +2,8 @@ class AskCategory
include Mongoid::Document
include Mongoid::Timestamps
include OrbitCoreLib::ObjectDisable
include OrbitCoreLib::ObjectAuthable
field :name, localize: true
field :key
+5 -5
View File
@@ -23,26 +23,26 @@ module Ask
side_bar do
head_label_i18n 'ask.ask', icon_class: 'icons-light-bulb'
available_for [:admin,:manager,:sub_manager]
available_for [:admin]
active_for_controllers({ private: ['ask_questions'] })
head_link_path "panel_ask_back_end_ask_questions_path"
context_link 'categories', link_path: 'panel_ask_back_end_ask_categories_path',
priority: 1,
active_for_action: {:ask_categories=>:index},
available_for: [:all]
available_for: [:manager]
context_link 'ask.acknowledgement', link_path: 'panel_ask_back_end_ask_acknowledgements_path',
priority: 1,
available_for: [:all]
available_for: [:manager]
context_link 'ask.admin', link_path: 'panel_ask_back_end_ask_admins_path',
priority: 1,
available_for: [:all]
available_for: [:manager]
context_link 'ask.export', link_path: 'export_panel_ask_back_end_ask_questions_path',
priority: 1,
available_for: [:all]
available_for: [:manager]
end
end
@@ -71,6 +71,7 @@ class Panel::Faq::BackEnd::QasController < OrbitBackendController
# GET /qas/1/edit
def edit
@qa = Qa.find(params[:id])
@users = @qa.get_users
@tags = get_tags
end
+5
View File
@@ -17,6 +17,7 @@ class Qa
field :create_user_id
field :update_user_id
field :user_ids
field :is_top, :type => Boolean, :default => false
field :is_hot, :type => Boolean, :default => false
@@ -72,6 +73,10 @@ class Qa
end
end
def get_users
User.find(self.user_ids) rescue []
end
protected
def qa_category_with_title
@@ -45,6 +45,16 @@
<% end %>
</div>
</div>
<div id="widget-member" class="widget-box widget-size-300">
<div class="widget-action clear tip" title="Rejected Report">
<a class="action"><i class="icon-cog icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag"></i><%= t(:promoter) %></h3>
<div class="widget-content clear form-horizontal">
<%= render partial: 'admin/member_selects/selection_box', locals: {field: 'qa[user_ids][]', users: @users} %>
</div>
</div>
</div>
@@ -8,25 +8,30 @@
<div class="news_paragraph">
<%= @qa.answer.html_safe rescue '' %>
</div>
<div class="linkAndFile">
<% if @qa.qa_links.size > 0 %>
<div>
<i class="icons-link"></i>
<div class="showLink">
<% @qa.qa_links.each do | blink | %>
<%= link_to blink.title, blink.url, :target => '_blank' %>
<% end %>
</div>
</div>
<% end %>
<% if @qa.qa_files.size > 0 %>
<div>
<i class="icons-paperclip"></i>
<div class="showFile">
<% @qa.qa_files.each do | bfile | %>
<%= link_to bfile.title, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
<% if @qa.qa_links.size > 0 || @qa.qa_files.size > 0 %>
<div class="linkAndFile">
<% if @qa.qa_links.size > 0 %>
<div>
<i class="icons-link"></i>
<div class="showLink">
<% @qa.qa_links.each do | blink | %>
<%= link_to blink.title, blink.url, :target => '_blank' %>
<% end %>
</div>
</div>
</div>
<% end %>
</div>
<% end %>
<% if @qa.qa_files.size > 0 %>
<div>
<i class="icons-paperclip"></i>
<div class="showFile">
<% @qa.qa_files.each do | bfile | %>
<%= link_to bfile.title, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
<% end %>
</div>
</div>
<% end %>
</div>
<% end %>
<%= render partial: 'admin/member_selects/promoter_front', locals: {users: @qa.get_users} %>
@@ -53,6 +53,7 @@ class Panel::PageContent::BackEnd::PageContextsController < OrbitBackendControll
# GET /page_contexts/1/edit
def edit
@page_context = PageContext.find(params[:id])
@users = @page_context.get_users
end
# POST /page_contexts
@@ -18,6 +18,7 @@ class PageContext
field :archived, :type => Boolean, :default => false
# field :current, :type => Boolean, :default => false
field :user_ids
belongs_to :page
@@ -32,5 +33,9 @@ class PageContext
def is_top?
self.is_top
end
def get_users
User.find(self.user_ids) rescue []
end
end
@@ -2,6 +2,22 @@
<%= f.error_messages %>
<div id="sub-wiget">
<div id="widget-member" class="widget-box widget-size-300">
<div class="widget-action clear tip" title="Rejected Report">
<a class="action"><i class="icon-cog icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag"></i><%= t(:promoter) %></h3>
<div class="widget-content clear form-horizontal">
<%= render partial: 'admin/member_selects/selection_box', locals: {field: 'page_context[user_ids][]', users: @users} %>
</div>
</div>
</div>
<div id="post-body">
<div id="post-body-content">
<div class="title">
@@ -9,3 +9,4 @@
<div class="page_content"><%= @page_context.context.html_safe rescue '' %></div>
<%= render partial: 'admin/member_selects/promoter_front', locals: {users: @page_context.get_users} %>