Compare commits
6 Commits
master
...
lukas/pick
Author | SHA1 | Date |
---|---|---|
iCross | 11e9f5d7cd | |
iCross | 2eaa44c279 | |
iCross | fe7393b9e2 | |
iCross | f12e5b8768 | |
iCross | 57e1ef7bae | |
iCross | 642d0ed239 |
2
Gemfile
2
Gemfile
|
@ -64,6 +64,8 @@ gem 'rmmseg-cpp-huacnlee', '0.2.9'
|
|||
gem 'redis-namespace'
|
||||
gem 'redis-search'
|
||||
gem 'syslog-logger'
|
||||
gem "recaptcha", :require => "recaptcha/rails"
|
||||
gem 'mongoid-versioning'
|
||||
|
||||
# Gems used only for assets and not required
|
||||
# in production environments by default.
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
class Panel::Announcement::BackEnd::BulletinVersionsController < OrbitBackendController
|
||||
include OrbitControllerLib::DivisionForDisable
|
||||
|
||||
def index
|
||||
@bulletin = Bulletin.find(params[:bulletin_id])
|
||||
end
|
||||
|
||||
def show
|
||||
@bulletin = Bulletin.find(params[:bulletin_id])
|
||||
@version = @bulletin.versions.where(version: params[:id]).first
|
||||
end
|
||||
end
|
|
@ -6,6 +6,7 @@ class Bulletin
|
|||
include Mongoid::MultiParameterAttributes
|
||||
include Sunspot::Mongo
|
||||
include Impressionist::Impressionable
|
||||
include Mongoid::Versioning
|
||||
|
||||
BelongsToCategory = :bulletin_category
|
||||
include OrbitCoreLib::BelongsToCategoryMayDisable
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span7 select"><%= t(:name) %></th>
|
||||
<th class="span1-2"><%= t(:version) %></th>
|
||||
<th class="span1-2"><%= t(:update_at) %></th>
|
||||
<th class="span1-2"><%= t(:last_modified) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @bulletin.versions.reverse.each do |version| %>
|
||||
<tr class="with_action">
|
||||
<td>
|
||||
<%= version.title %>
|
||||
<div class="quick-edit">
|
||||
<%= link_to '顯示', panel_announcement_back_end_bulletin_bulletin_version_path(@bulletin, version.version) %>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= version.version %></td>
|
||||
<td><%= display_date(version.updated_at) %></td>
|
||||
<td><%= User.from_id(version.update_user_id).name rescue ''%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
|
@ -0,0 +1,33 @@
|
|||
<ul>
|
||||
<li>
|
||||
<b><%= t(:name) %></b>
|
||||
<%= @version.title %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t(:subtitle) %></b>
|
||||
<%= @version.subtitle %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t(:text) %></b>
|
||||
<%= simple_format @version.text %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t(:deadline) %></b>
|
||||
<%= display_date(@version.deadline) if @version.deadline %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t(:postdate) %></b>
|
||||
<%= display_date(@version.postdate) if @version.postdate %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t(:posted_by) %></b>
|
||||
<%= User.find(@version.create_user_id).name %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t(:last_modified) %></b>
|
||||
<%= display_date(@version.updated_at) %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<%= link_back %>
|
|
@ -61,6 +61,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= link_to bulletin.version, panel_announcement_back_end_bulletin_bulletin_versions_path(bulletin) %></td>
|
||||
<td><%= display_date_time(bulletin.postdate) %></td>
|
||||
<td><%= (bulletin.deadline) ? display_date_time(bulletin.deadline ): t(:no_deadline) %></td>
|
||||
<td>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<th class="span1-2"></th>
|
||||
<th class="span1-2"></th>
|
||||
<th class="span1-2"></th>
|
||||
<th class="span1-2"></th>
|
||||
<th class="span1-3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1-2', :status],
|
||||
['category', 'bulletin_category', 'span1-2', :category],
|
||||
['title', 'title','span7', :title],
|
||||
['version', 'version', 'span1-2', :version],
|
||||
['start_date', 'postdate', 'span1-2', :start_date],
|
||||
['end_date', 'deadline', 'span1-2', :end_date],
|
||||
['tags', 'tags', 'span1-2', :tags],
|
||||
|
|
|
@ -23,6 +23,8 @@ Rails.application.routes.draw do
|
|||
end
|
||||
match "file_quick_add/:bulletin_id" => "bulletins#file_quick_add" ,:as => :file_quick_add
|
||||
match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit
|
||||
|
||||
resources :bulletin_versions
|
||||
end
|
||||
|
||||
resources :bulletin_categorys do
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController
|
||||
include AdminHelper
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
@ -30,27 +31,26 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController
|
|||
@archive_file_categorys = ArchiveFileCategory.all
|
||||
# @archive_files = ArchiveFile.where( :is_hidden => false ).desc(:is_top).page(params[:page]).per(@page_num)
|
||||
|
||||
if params[:search_query]
|
||||
get_search_result
|
||||
@archive_files = ArchiveFile.can_display.where(:archive_file_category_id.in => @archive_file_categorys.collect{|t| t.id}).desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num)
|
||||
if !params[:category_id].blank? && !params[:tag_id].blank?
|
||||
@archive_files = @archive_files.default_sort(params[:sort]).can_display.where(:archive_file_category_id.in => params[:category_id], :tagged_ids.in => params[:tag_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num)
|
||||
|
||||
@current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil
|
||||
|
||||
elsif !params[:category_id].blank?
|
||||
@archive_files = ArchiveFile.default_sort(params[:sort]).can_display.where(:archive_file_category_id.in => params[:category_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num)
|
||||
@current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@archive_files = ArchiveFile.default_sort(params[:sort]).can_display.where(:tagged_ids.in => params[:tag_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num)
|
||||
else
|
||||
if !params[:category_id].blank? && !params[:tag_id].blank?
|
||||
@archive_files = @archive_files.can_display.where(:archive_file_category_id.in => params[:category_id], :tagged_ids.in => params[:tag_id]).desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num)
|
||||
|
||||
@current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil
|
||||
|
||||
elsif !params[:category_id].blank?
|
||||
@archive_files = ArchiveFile.can_display.where(:archive_file_category_id.in => params[:category_id]).desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num)
|
||||
@current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@archive_files = ArchiveFile.can_display.where(:tagged_ids.in => params[:tag_id]).desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num)
|
||||
else
|
||||
@archive_files = ArchiveFile.can_display.desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num)
|
||||
end
|
||||
@archive_files = ArchiveFile.default_sort(params[:sort]).can_display.desc( :is_top ).page( params[:page_main] ).per(@page_num)
|
||||
end
|
||||
|
||||
|
||||
get_categorys
|
||||
|
||||
if params[:sort]
|
||||
@archive_files = get_sorted_and_filtered('archive_file', nil, @archive_files)
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
56
vendor/built_in_modules/archive/app/views/panel/archive/front_end/archive_files/_index.html.erb
vendored
Normal file
56
vendor/built_in_modules/archive/app/views/panel/archive/front_end/archive_files/_index.html.erb
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
<% # encoding: utf-8 %>
|
||||
|
||||
|
||||
<div class="o-archives layout-table">
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<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>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<% @archive_files.each_with_index do |post,i| %>
|
||||
<tr <% if ( (i + 1) % 2 ) == 0 %> class="even" <% end %>>
|
||||
<td><div class="o-archives-title"><%= post.title %></div></td>
|
||||
<td>
|
||||
<div class="o-archives-list-item">
|
||||
<% if !post.archive_file_multiples.blank? %>
|
||||
<ol>
|
||||
<% 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"} %>
|
||||
<%= post.get_file_icon(afile.file.url) %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ol>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
<td><div class="o-archives-category">
|
||||
<%= post.archive_file_category.title %>
|
||||
</div></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<%= paginate @archive_files, :param_name => :page_main, :params => {:inner => 'false'} %>
|
||||
|
||||
<%= stylesheet_link_tag "archive/archives" %>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,57 +1,9 @@
|
|||
<% # encoding: utf-8 %>
|
||||
<%= stylesheet_link_tag "default_widget" %>
|
||||
<script type='text/javascript' src='/assets/jquery.mu.image.resize.js'></script>
|
||||
<script type='text/javascript' src='/assets/jquery.mu.image.resize.degsin.js'></script>
|
||||
|
||||
<%= render :partial => 'shared/search_header',:locals=>{:items=>@archive_files} %>
|
||||
|
||||
<div class="o-archives layout-table">
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="column-ctrl col-title"><%= t("archive.Title")%></th>
|
||||
<th class="column-ctrl col-file"><%= t("archive.Files")%></th>
|
||||
<th class="column-ctrl col-category"><%= t("archive.Category")%></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<% @archive_files.each_with_index do |post,i| %>
|
||||
<tr <% if i.even?%> class="even" <% end %>>
|
||||
<td><div class="o-archives-title"><%= post.title %></div></td>
|
||||
<td>
|
||||
<div class="o-archives-list-item">
|
||||
<% if !post.archive_file_multiples.blank? %>
|
||||
<ol>
|
||||
<% 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"} %>
|
||||
<%= post.get_file_icon(afile.file.url) %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ol>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
<td><div class="o-archives-category">
|
||||
<%= post.archive_file_category.title %>
|
||||
</div></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<%= paginate @archive_files, :param_name => :page_main, :params => {:inner => 'false'} %>
|
||||
<div id="archive_file_widget">
|
||||
<%= render 'index' %>
|
||||
</div>
|
||||
|
||||
<%= stylesheet_link_tag "archive/archives" %>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
1
vendor/built_in_modules/archive/app/views/panel/archive/front_end/archive_files/index.js.erb
vendored
Normal file
1
vendor/built_in_modules/archive/app/views/panel/archive/front_end/archive_files/index.js.erb
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
$('#archive_file_widget').html("<%= j render 'index' %>")
|
|
@ -16,6 +16,8 @@ class SurveyQuestion
|
|||
|
||||
# allow custom answer option
|
||||
field :custom_option, :type => Boolean
|
||||
|
||||
field :sequence, :type => Integer, :default => 0
|
||||
|
||||
belongs_to :survey
|
||||
embeds_many :survey_question_options
|
||||
|
@ -24,6 +26,8 @@ class SurveyQuestion
|
|||
accepts_nested_attributes_for :survey_question_options, :allow_destroy => true
|
||||
accepts_nested_attributes_for :survey_question_radiogroups, :allow_destroy => true
|
||||
|
||||
default_scope asc(:sequence)
|
||||
|
||||
def jumpable?
|
||||
case type
|
||||
when SurveyQuestion::Radio, SurveyQuestion::Select
|
||||
|
|
|
@ -103,7 +103,31 @@
|
|||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "survey_form" %>
|
||||
<script>
|
||||
var refresh_sequence_input = function() {
|
||||
var sequence = 0;
|
||||
$('.sequence input').each(function(){
|
||||
sequence += 1;
|
||||
$(this).val(sequence);
|
||||
});
|
||||
}
|
||||
$(document).ready(function() {
|
||||
$('.sequence .move-up').bind('click', function(){
|
||||
$survey_question_item = $(this).parents('.survey_question_item')
|
||||
$prev = $survey_question_item.prev();
|
||||
$survey_question_item.insertBefore($prev);
|
||||
refresh_sequence_input();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.sequence .move-down').bind('click', function(){
|
||||
$survey_question_item = $(this).parents('.survey_question_item')
|
||||
$next = $survey_question_item.next();
|
||||
$survey_question_item.insertAfter($next);
|
||||
refresh_sequence_input();
|
||||
return false;
|
||||
});
|
||||
|
||||
refresh_sequence_input();
|
||||
|
||||
$('#add_survey_question a.add').live('click', function(){
|
||||
var new_id = $(this).prev().attr('value');
|
||||
|
|
1
vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/_answer_error.erb
vendored
Normal file
1
vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/_answer_error.erb
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
alert("<%= @survey_answer_error %>");
|
2
vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/_answer_success.erb
vendored
Normal file
2
vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/_answer_success.erb
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
alert("<%= t('survey.answer_success')%>");
|
||||
window.location.href = "<%= root_path %>";
|
1
vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/answer_error.js.erb
vendored
Normal file
1
vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/answer_error.js.erb
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
<%= render 'answer_error' %>
|
|
@ -0,0 +1 @@
|
|||
<%= render 'answer_success' %>
|
|
@ -53,6 +53,7 @@ en:
|
|||
survey_question:
|
||||
title: Question
|
||||
description: Description
|
||||
sequence: Sequence
|
||||
type: Type
|
||||
is_required: Is Required
|
||||
required: Required
|
||||
|
@ -74,3 +75,5 @@ en:
|
|||
|
||||
move_up: Move up
|
||||
move_down: Move down
|
||||
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ zh_tw:
|
|||
survey_question:
|
||||
title: 題目
|
||||
description: 說明
|
||||
sequence: 順序
|
||||
type: 作答方式
|
||||
is_required: 設為必填
|
||||
required: 必填
|
||||
|
@ -75,4 +76,4 @@ zh_tw:
|
|||
have_not_chart: 此種類型問題不含結果圖表
|
||||
|
||||
move_up: 上移
|
||||
move_down: 下移
|
||||
move_down: 下移
|
Loading…
Reference in New Issue