Merge branch 'new' of https://github.com/Rulingcom/orbit into new
This commit is contained in:
commit
97d2380406
486 files changed
+12368
-8935
No files matched your search
+4
-4
@@ -13,9 +13,9 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
|
||||
@bulletin.proc_check(params[:bulletin][:is_checked],params[:bulletin][:not_checked_reason])
|
||||
@bulletin.de_pending
|
||||
if @bulletin.save
|
||||
notice = t('bulletin.approve_bulletin_success')
|
||||
notice = t('announcement.approve_bulletin_success')
|
||||
else
|
||||
notice = t('bulletin.approve_bulletin_fail')
|
||||
notice = t('announcement.approve_bulletin_fail')
|
||||
end
|
||||
redirect_to(panel_announcement_back_end_bulletins_url,:notice => notice)
|
||||
end
|
||||
@@ -40,9 +40,9 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
|
||||
def update_setting
|
||||
object_auth = update_setting_by_params
|
||||
if object_auth.save!
|
||||
flash[:notice] = t("admin.object_auth.update_done")
|
||||
flash[:notice] = t('update.success_')
|
||||
else
|
||||
flash[:notice] = t("admin.object_auth.update_failed")
|
||||
flash[:notice] = t('update.fail')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+5
-5
@@ -92,8 +92,8 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendCo
|
||||
|
||||
respond_to do |format|
|
||||
if @bulletin_category.update_attributes(params[:bulletin_category])
|
||||
# format.html { redirect_to(panel_announcement_back_end_bulletin_category_url(@bulletin_category), :notice => t('bulletin_category.update_bulletin_category_success')) }
|
||||
# format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url, :notice => t('bulletin_category.update_bulletin_category_success')) }
|
||||
# format.html { redirect_to(panel_announcement_back_end_bulletin_category_url(@bulletin_category), :notice => t('announcement.update_bulletin_category_success')) }
|
||||
# format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url, :notice => t('announcement.update_bulletin_category_success')) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
else
|
||||
@@ -112,14 +112,14 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendCo
|
||||
|
||||
if @bulletin_category.save!
|
||||
respond_to do |format|
|
||||
flash[:notice] = t("bulletin_category.update_success")
|
||||
# flash[:error] += @bulletin_category.disable ? t("bulletin_category.disable_change_to_true") : t("bulletin_category.disable_change_to_false")
|
||||
flash[:notice] = t("update.success_")
|
||||
# flash[:error] += @bulletin_category.disable ? t(:enable) : t(disable)
|
||||
format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
end
|
||||
else
|
||||
flash[:error] = t("bulletin_category.update_failed")
|
||||
flash[:error] = t("update.fail")
|
||||
format.html { render :action => "index" }
|
||||
end
|
||||
end
|
||||
|
||||
+44
-6
@@ -2,15 +2,25 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
include AdminHelper
|
||||
include OrbitControllerLib::DivisionForDisable
|
||||
|
||||
before_filter :clean_values, :only => [:create, :update]
|
||||
|
||||
# before_filter :for_admin_only,:only => [:]
|
||||
# before_filter :for_app_manager,:only => [:index,:show,]
|
||||
before_filter :force_order_for_visitor,:only=>[:index,:show,:get_sorted_and_filtered_bulletins]
|
||||
before_filter :force_order_for_user,:except => [:index,:show,:get_sorted_and_filtered_bulletins]
|
||||
before_filter :for_app_sub_manager,:except => [:index,:show,:get_sorted_and_filtered_bulletins]
|
||||
|
||||
before_filter :only => [ :new,:create,:edit,:update,:create] do |controller|
|
||||
controller.get_categorys('BulletinCategory')
|
||||
end
|
||||
|
||||
def preview
|
||||
#@preview_obj = Preview.create(:object=>params[:news_bulletin],:expired_at=>DateTime.now+30.minutes,:preview_at_link=>"panel_news_front_end_news_bulletin_path",:object_class_type=>"NewsBulletin")
|
||||
bulletin = Bulletin.new params
|
||||
@preview_obj = bulletin.to_preview
|
||||
@preview_obj.save
|
||||
render '/shared/preview/preview.html.erb',:layout=>false
|
||||
end
|
||||
|
||||
def index
|
||||
# @bulletins = Bulletin.all
|
||||
@@ -68,8 +78,13 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
# GET /bulletins/new
|
||||
# GET /bulletins/new.xml
|
||||
def new
|
||||
@bulletin = Bulletin.new(:postdate => DateTime.now)
|
||||
|
||||
if(session[:in_validate_object].blank?)
|
||||
@bulletin = Bulletin.new(:postdate => DateTime.now)
|
||||
else
|
||||
@bulletin = session[:in_validate_object]
|
||||
session[:in_validate_object] = {}
|
||||
end
|
||||
|
||||
@link_url = panel_announcement_back_end_bulletins_path
|
||||
get_tags
|
||||
respond_to do |format|
|
||||
@@ -124,18 +139,30 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
@bulletin.create_user_id = current_user.id
|
||||
@bulletin.update_user_id = current_user.id
|
||||
if(is_manager? || is_admin?)
|
||||
@bulletin.de_pending
|
||||
@bulletin.is_checked = true
|
||||
@bulletin.is_rejected = false
|
||||
@bulletin.de_pending
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @bulletin.save
|
||||
|
||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.create_bulletin_success')) }
|
||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('announcement.create_bulletin_success')) }
|
||||
format.xml { render :xml => @bulletin, :status => :created, :location => @bulletin }
|
||||
format.js
|
||||
# format.js
|
||||
format.js {
|
||||
@info = {"success"=>"true","redirect_url"=>panel_announcement_back_end_bulletins_url}
|
||||
flash[:notice] = t('bulletin.create_bulletin_success')
|
||||
render "/shared/preview/after_create.js.erb"
|
||||
}
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity }
|
||||
format.js {
|
||||
@info = {"success"=>"false","redirect_url"=>new_panel_announcement_back_end_bulletin_url(:bulletin => @bulletin)}
|
||||
session[:in_validate_object] = @bulletin
|
||||
render "/shared/preview/after_create.js.erb"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -337,7 +364,18 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||
|
||||
def get_tags
|
||||
module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
|
||||
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
|
||||
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc) rescue []
|
||||
end
|
||||
|
||||
def clean_values
|
||||
if params[:bulletin]
|
||||
params[:bulletin][:bulletin_links_attributes].each_with_index do |link, index|
|
||||
params[:bulletin][:bulletin_links_attributes].delete(index.to_s) if link[1]['url'].blank? and link[1]['title'].blank?
|
||||
end rescue nil
|
||||
params[:bulletin][:bulletin_files_attributes].each_with_index do |link, index|
|
||||
params[:bulletin][:bulletin_files_attributes].delete(index.to_s) if link[1]['file'].blank? and link[1]['title'].blank?
|
||||
end rescue nil
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
+3
-2
@@ -30,7 +30,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
||||
@search = Bulletin.solr_search do
|
||||
fulltext params[:search_query]
|
||||
with(:frontend_search,true)
|
||||
#order_by(:average_rating)
|
||||
with(:available_lang).any_of([I18n.locale.to_s])
|
||||
end
|
||||
search_result = @search.results.collect{|result| result.id}
|
||||
|
||||
@@ -78,7 +78,8 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
||||
end
|
||||
|
||||
def preview_content
|
||||
@bulletin = Bulletin.find params[:id]
|
||||
@bulletin = Bulletin.find params[:id] rescue nil
|
||||
@bulletin = Preview.find(params[:id]).get_virtual_object if @bulletin.nil?
|
||||
get_categorys
|
||||
end
|
||||
|
||||
|
||||
+2
-2
@@ -9,8 +9,8 @@ include ActionView::Helpers::UrlHelper
|
||||
bulletin_category.object_auths.new(title: type ).save
|
||||
oa = bulletin_category.get_object_auth_by_title(type)
|
||||
end
|
||||
# link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
|
||||
link_to t('announcement.bulletin.cate_auth'),admin_object_auth_ob_auth_path(oa)
|
||||
# link_to t(:category_auth), edit_admin_object_auth_path(oa)
|
||||
link_to t(:category_auth),admin_object_auth_ob_auth_path(oa)
|
||||
end
|
||||
|
||||
end
|
||||
Vendored
+1
-1
@@ -49,4 +49,4 @@ module Panel::Announcement::BackEnd::BulletinsHelper
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
+35
-10
@@ -9,11 +9,7 @@ class Bulletin
|
||||
|
||||
BelongsToCategory = :bulletin_category
|
||||
include OrbitCoreLib::BelongsToCategoryMayDisable
|
||||
|
||||
# include NccuSearch
|
||||
|
||||
#scope :searchable,where(:is_checked=>true,:is_hidden=>false,:is_pending=>false)
|
||||
|
||||
include OrbitCoreLib::Preview
|
||||
is_impressionable :counter_cache => { :column_name => :view_count }
|
||||
|
||||
field :title, localize: true
|
||||
@@ -36,7 +32,6 @@ class Bulletin
|
||||
field :is_checked, :type => Boolean, :default => false
|
||||
field :is_pending, :type => Boolean, :default => true
|
||||
field :is_rejected, :type => Boolean, :default => false
|
||||
|
||||
field :view_count, :type => Integer, :default => 0
|
||||
|
||||
field :not_checked_reason
|
||||
@@ -62,11 +57,10 @@ class Bulletin
|
||||
|
||||
validates :title, :at_least_one => true
|
||||
|
||||
before_save :check_deadline, :update_avliable_language, :clean_tags
|
||||
before_save :check_deadline, :update_avliable_language, :clean_values
|
||||
before_create :update_avliable_language
|
||||
|
||||
before_save :fetch_dept
|
||||
after_save :save_bulletin_links
|
||||
after_save :save_bulletin_files
|
||||
|
||||
searchable do
|
||||
text :titles do
|
||||
@@ -75,6 +69,11 @@ class Bulletin
|
||||
text :texts do
|
||||
text_translations.to_a.collect{|t| Nokogiri::HTML(t[1]).text}
|
||||
end
|
||||
|
||||
string :available_lang , :multiple => true do
|
||||
VALID_LOCALES.collect{|t| enabled_for_lang(t.to_sym) ? t : nil}.delete_if{|t| t.nil?}
|
||||
end
|
||||
|
||||
# text :text do
|
||||
# a = (title_translations["zh_tw"] + title_translations["en"])
|
||||
# a
|
||||
@@ -86,6 +85,10 @@ class Bulletin
|
||||
integer :view_count
|
||||
string :bulletin_category_id
|
||||
end
|
||||
|
||||
def share_item
|
||||
Item.first(conditions:{name: 'announcement'})
|
||||
end
|
||||
|
||||
def proc_check(check,not_pass_info = "")
|
||||
self.is_checked = true
|
||||
@@ -202,6 +205,24 @@ class Bulletin
|
||||
tags.order_by(I18n.locale, :asc)
|
||||
end
|
||||
|
||||
|
||||
def to_preview
|
||||
preview_object = Preview.new(:expired_at=>DateTime.now+30.minutes,:preview_at_link=>"panel_announcement_front_end_bulletin_path",:object_class_type=>"Bulletin")
|
||||
|
||||
self.bulletin["bulletin_files_attributes"].each_with_index do |atr,idx|
|
||||
preview_object.preview_files.build(:file=>self.bulletin["bulletin_files_attributes"][idx.to_s],:field_name_for_rebuild=>'bulletin_files',:file_in_array=>true)
|
||||
end unless self.bulletin["bulletin_files_attributes"].nil?
|
||||
|
||||
self.bulletin["bulletin_links_attributes"].each_with_index do |atr,idx|
|
||||
preview_object.preview_associations.build(:object=>self.bulletin["bulletin_links_attributes"][idx.to_s],:field_name_for_rebuild=>'bulletin_links',:object_in_array=>true)
|
||||
end unless self.bulletin["bulletin_links_attributes"].nil?
|
||||
|
||||
|
||||
preview_object.object = self.bulletin.except("bulletin_files_attributes","bulletin_links_attributes")
|
||||
preview_object
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
||||
def check_deadline
|
||||
@@ -224,8 +245,12 @@ class Bulletin
|
||||
self.cache_dept = (User.find(self.create_user_id).cache_dept rescue nil) if self.new_record?
|
||||
end
|
||||
|
||||
def clean_tags
|
||||
def clean_values
|
||||
self.bulletin_links.each do |link|
|
||||
link.delete if link.url.blank? && link.title.blank?
|
||||
end
|
||||
self.tag_ids.delete('')
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<ul class="list">
|
||||
<li><%= link_to t('bulletin.announcement_list'), panel_announcement_back_end_bulletins_path if is_manager?%></li>
|
||||
<li><%= link_to t('bulletin.new_announcement_class'), panel_announcement_back_end_bulletin_categorys_path if is_manager?%></li>
|
||||
<li><%= link_to t('bulletin.fact_check_for_manager'), panel_announcement_back_end_fact_checks_path if is_manager?%></li>
|
||||
|
||||
<li><%= link_to t('bulletin.my_announcement'), panel_announcement_back_end_list_mine_path if is_sub_manager? %></li>
|
||||
<li><%= link_to t('bulletin.new_announcement'), new_panel_announcement_back_end_bulletin_path if is_sub_manager? %></li>
|
||||
|
||||
</ul>
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
<h1><%= bulletin_category.key %></h1>
|
||||
<table>
|
||||
<tr>
|
||||
<th><%= t('bulletin.status') %></th>
|
||||
<th><%= t('bulletin.category') %></th>
|
||||
<th><%= t('bulletin.title') %></th>
|
||||
<th><%= t('bulletin.postdate') %></th>
|
||||
<th><%= t('bulletin.deadline') %></th>
|
||||
<th><%= t('bulletin.action') %></th>
|
||||
</tr>
|
||||
|
||||
<% bulletin_category.bulletins.each do |post| %>
|
||||
<%= render :partial => 'panel/announcement/back_end/bulletins/bulletins', :locals => {:post => post,:fact_check_allow=>false} %>
|
||||
<% end %>
|
||||
</table>
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
<% content_for :secondary do %>
|
||||
<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %>
|
||||
<% end -%>
|
||||
|
||||
<%= flash_messages %>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<%= render :partial => "list_table", :collection => @bulletin_categorys ,:as => :bulletin_category%>
|
||||
+5
-5
@@ -19,19 +19,19 @@
|
||||
<div class="modal-footer">
|
||||
|
||||
<%= form_for bulletin, :url => panel_announcement_back_end_bulletin_approve_path(bulletin),:method => :post, :html => {:class => 'clear'} do |f| %>
|
||||
<%= f.label :approval_stat, t('announcement.bulletin.approval_stat') %>
|
||||
<%= f.label :approval_stat, t('approval_stat') %>
|
||||
<%= content_tag :label,:class => "radio inline" do -%>
|
||||
<%= f.radio_button :is_checked, true , {:class => 'privacy'} %>
|
||||
<%= t('announcement.bulletin.approval_pass') %>
|
||||
<%= t('approval.pass') %>
|
||||
<% end -%>
|
||||
<%= content_tag :label,:class => "radio inline" do -%>
|
||||
<%= f.radio_button :is_checked, false, (!@bulletin.is_checked ? {:checked => true, :class => 'privacy'} : {})%>
|
||||
<%= t('announcement.bulletin.approval_not_pass') %>
|
||||
<%= t('approval.not_pass') %>
|
||||
<% end -%>
|
||||
|
||||
<%= label :is_checked_false, t('announcement.bulletin.approval_not_pass_reason') %>
|
||||
<%= label :is_checked_false, t('approval.not_pass_reason') %>
|
||||
<%= f.text_field :not_checked_reason %>
|
||||
<%= f.submit t('announcement.bulletin.submit_approval'),:class=>"btn"%>
|
||||
<%= f.submit t(:submit_approval),:class=>"btn"%>
|
||||
<% end %>
|
||||
|
||||
<a href="#" class="btn" data-dismiss="modal"><%= t("modal.close") %></a>
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
<div class="modal hide fade in" id="bulletin_category-<%=bulletin_category.id%>">
|
||||
<div class="modal-header">
|
||||
<a class="close" data-dismiss="modal">×</a>
|
||||
<h3><%= t("announcement.bulletin.approval_user_list") %></h3>
|
||||
<h3><%= t("approval.user_list") %></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="clear">
|
||||
|
||||
+4
-5
@@ -6,27 +6,26 @@
|
||||
<%= javascript_include_tag "inc/search" %>
|
||||
<%= javascript_include_tag "inc/modal-preview" %>
|
||||
<% end %>
|
||||
<%#= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %>
|
||||
<%= form_tag('', :remote => true,:class => "prevent_enter_submit_form") %>
|
||||
<div class="subnav clear">
|
||||
<ul class="nav nav-pills filter pull-left">
|
||||
<li class="accordion-group">
|
||||
<div class="form-search" style="margin: 5px 10px;">
|
||||
<%= label_tag :category, t("announcement.bulletin.category") %>
|
||||
<%= label_tag :category, t(:category) %>
|
||||
<%= select "category",'id',@options_from_collection_for_select_bulletin_categorys %>
|
||||
<%= search_field_tag 'user_filter' %>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<%= link_to t("announcement.bulletin.approval_user_list"), panel_announcement_back_end_approval_user_list_path , :class=>'preview_trigger btn btn-success pull-right'%>
|
||||
<%= link_to t("approval.user_list"), panel_announcement_back_end_approval_user_list_path , :class=>'preview_trigger btn btn-success pull-right'%>
|
||||
</div>
|
||||
<%#= label_tag :role, t("admin.roles") %>
|
||||
<%#= label_tag :role, t(:roles) %>
|
||||
<div class="clear">
|
||||
<%= content_tag :div do -%>
|
||||
<% form_tag panel_announcement_back_end_approval_setting_path do %>
|
||||
<%= render :partial => "layouts/users_checkbox_ary" %>
|
||||
<div class="form-actions form-fixed pagination-right">
|
||||
<%= submit_tag "Update", :class => 'btn btn-primary' %>
|
||||
<%= submit_tag t(:update_), :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
<div class="modal hide fade in" id="bulletin_category-<%=bulletin_category.id%>">
|
||||
<div class="modal-header">
|
||||
<a class="close" data-dismiss="modal">×</a>
|
||||
<h3><%= t("announcement.bulletin.submit_user_list") %></h3>
|
||||
<h3><%= t(:submit_user_list) %></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="clear">
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<% if is_admin?%>
|
||||
<li><%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %></li>
|
||||
<li><%= link_to show_toggle_archive_btn(bulletin_category) , panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true,:class=> "archive_toggle" %></li>
|
||||
<li><%= link_to t(:edit), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %></li>
|
||||
<li><%= link_to show_toggle_archive_btn(bulletin_category) , panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t(:sure?), :method => :delete, :remote => true,:class=> "archive_toggle" %></li>
|
||||
<% end %>
|
||||
<%if is_manager? || is_admin? %>
|
||||
<li><%= show_anc_cate_permission_link(bulletin_category) %></li>
|
||||
|
||||
+3
-3
@@ -2,10 +2,10 @@
|
||||
|
||||
<%= form_for(@bulletin_category, :remote => true, :url => @url) do |f| %>
|
||||
|
||||
<h2><%= (@bulletin_category.new_record? ? 'Add' : 'Edit') %></h2>
|
||||
<h2><%= @bulletin_category.new_record? ? t(:add) : t(:edit) %></h2>
|
||||
|
||||
<div id="widget-title">
|
||||
<%= f.label :key %>
|
||||
<%= f.label :key, t(:key) %>
|
||||
<%= f.text_field :key %>
|
||||
</div>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<%= label_tag "name-#{locale}", "#{t(:name)}-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :class => 'input-xxlarge', :value => (@bulletin_category.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<h1><%= t('announcement.editing_announcement_class') %></h1>
|
||||
<h1><%= t('announcement.editing_announcement_category') %></h1>
|
||||
|
||||
<%= form_for @bulletin_category, :url => panel_announcement_back_end_bulletin_category_path(@bulletin_category) do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span2"><%= t('bulletin_category.key') %></th>
|
||||
<th class="span2"><%= t(:key) %></th>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<th class="span2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
|
||||
<% end %>
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<h1><%= t('bulletin_category.new_announcement_class') %></h1>
|
||||
<h1><%= t('announcement.new_bulletin_category') %></h1>
|
||||
<%= form_for @bulletin_category, :url => panel_announcement_back_end_bulletin_categorys_path do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
|
||||
+5
-6
@@ -34,9 +34,8 @@
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<% if (bulletin.create_user_id == current_or_guest_user.id) || is_manager? %>
|
||||
|
||||
<% if current_or_guest_user.admin? || (!bulletin.is_rejected? && !bulletin.is_checked?) %>
|
||||
<li><%= link_to t('bulletin.edit'), edit_panel_announcement_back_end_bulletin_path(bulletin) %></li>
|
||||
<li><%= link_to t(:edit), edit_panel_announcement_back_end_bulletin_path(bulletin) %></li>
|
||||
<li class="dropdown">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle"><%= t(:quick_edit) %><b class="caret"></b></a>
|
||||
<ul class="dropdown-menu" id="menu1">
|
||||
@@ -44,17 +43,17 @@
|
||||
<li><%#= link_to t(:picture), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'picture'), :remote => true %></li>
|
||||
<li><%= link_to t(:tags), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'tags'), :remote => true %></li>
|
||||
<li><%= link_to t(:link), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'links'), :remote => true %></li>
|
||||
<li><%#= link_to t(:file), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'files'), :remote => true %></li>
|
||||
<li><%#= link_to t(:file_), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'files'), :remote => true %></li>
|
||||
</ul>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<% end -%>
|
||||
<% if show_delete_link(bulletin) %>
|
||||
<li class="dropdown"><%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(bulletin), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
|
||||
<li class="dropdown"><%= link_to t(:delete), panel_announcement_back_end_bulletin_path(bulletin), :confirm => t(:sure?), :method => :delete, :remote => true %></li>
|
||||
<% end %>
|
||||
<% if show_approval_link(bulletin) %>
|
||||
<li><%= link_to t('announcement.bulletin.approval'), panel_announcement_back_end_bulletin_approval_preview_path(bulletin),:class => 'preview_trigger' %></li><%#= #TODO add ancher so user can quick access into that part %>
|
||||
<li><%= link_to t(:approval_), panel_announcement_back_end_bulletin_approval_preview_path(bulletin),:class => 'preview_trigger' %></li><%#= #TODO add ancher so user can quick access into that part %>
|
||||
<% end %>
|
||||
<% if show_reject_reason(bulletin)%>
|
||||
<li><%= link_to t('rejected_reason')+truncate(bulletin.not_checked_reason, :length => 10),'#',:rel=>"tooltip" ,'data-original-title'=> (wrap_string_with(bulletin.not_checked_reason, :line_width => 24)),:class=>'reject_info' %></li>
|
||||
@@ -63,7 +62,7 @@
|
||||
</div>
|
||||
</td>
|
||||
<td><%= display_date_time(bulletin.postdate) %></td>
|
||||
<td><%= (bulletin.deadline) ? display_date_time(bulletin.deadline ): t('bulletin.no_deadline') %></td>
|
||||
<td><%= (bulletin.deadline) ? display_date_time(bulletin.deadline ): t(:no_deadline) %></td>
|
||||
<td>
|
||||
<div class="label-group">
|
||||
<div class="label-td">
|
||||
|
||||
+26
-28
@@ -1,35 +1,33 @@
|
||||
<div id='filter' class="subnav">
|
||||
<div id="accordion">
|
||||
<ul class="nav nav-pills filter">
|
||||
<li>
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-status" data-toggle="collapse" data-parent="#accordion" class="accordion-toggle"><%= t("announcement.status") %> <b class="web-symbol"></b></a>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-category" data-toggle="collapse" data-parent="#accordion" class="accordion-toggle"><%= t("announcement.categories") %> <b class="web-symbol"></b></a>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-tags" data-toggle="collapse" data-parent="#accordion" class="accordion-toggle"><%= t("announcement.tags") %> <b class="web-symbol"></b></a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="accordion-group filters">
|
||||
<div class="accordion-body collapse" id="collapse-status">
|
||||
<%= render 'filter_status' %>
|
||||
<ul class="nav nav-pills filter">
|
||||
<li class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-status" data-toggle="collapse" data-parent=".filters" class="accordion-toggle"><%= t(:status) %> <b class="web-symbol"></b></a>
|
||||
</div>
|
||||
<div class="accordion-body collapse" id="collapse-category">
|
||||
<%= render 'filter_categories' %>
|
||||
</li>
|
||||
<li class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-category" data-toggle="collapse" data-parent=".filters" class="accordion-toggle"><%= t(:categories) %> <b class="web-symbol"></b></a>
|
||||
</div>
|
||||
<div class="accordion-body collapse" id="collapse-tags">
|
||||
<%= render 'filter_tags' %>
|
||||
</div>
|
||||
<div id="sort_headers" class="table-label">
|
||||
<%= render 'sort_headers' %>
|
||||
</li>
|
||||
<li class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-tags" data-toggle="collapse" data-parent=".filters" class="accordion-toggle"><%= t(:tags) %> <b class="web-symbol"></b></a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="filters">
|
||||
<div class="accordion-body collapse" id="collapse-status">
|
||||
<%= render 'filter_status' %>
|
||||
</div>
|
||||
<div class="accordion-body collapse" id="collapse-category">
|
||||
<%= render 'filter_categories' %>
|
||||
</div>
|
||||
<div class="accordion-body collapse" id="collapse-tags">
|
||||
<%= render 'filter_tags' %>
|
||||
</div>
|
||||
<div id="sort_headers" class="table-label">
|
||||
<%= render 'sort_headers' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Vendored
+21
-18
@@ -1,5 +1,7 @@
|
||||
<% # encoding: utf-8 %>
|
||||
|
||||
<% content_for :page_specific_javascript do -%>
|
||||
<%= javascript_include_tag "inc/modal-preview" %>
|
||||
<% end -%>
|
||||
<!--Widget start-->
|
||||
<%= f.error_messages %>
|
||||
|
||||
@@ -9,16 +11,16 @@
|
||||
<div class="widget-action clear">
|
||||
<a href="#" class="action"><i title="Set the announcement to start and end dates" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||
</div>
|
||||
<h3 class="widget-title"><i class="icons-calendar icons-white"></i> Date</h3>
|
||||
<h3 class="widget-title"><i class="icons-calendar icons-white"></i><%= t('nccu.date') %></h3>
|
||||
<div class="widget-content clear">
|
||||
<div class="control-group">
|
||||
<label class="control-label">Start</label>
|
||||
<label class="control-label"><%= t(:start) %></label>
|
||||
<div class="controls">
|
||||
<%= f.datetime_select :postdate, {:use_month_numbers => true, :order => [:day, :month, :year] }, {:class => 'span1'} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label">End</label>
|
||||
<label class="control-label"><%= t(:end) %></label>
|
||||
<div class="controls">
|
||||
<%= f.datetime_select :deadline, {:use_month_numbers => true, :prompt => { :month => 'Month', :day => 'Day', :year => 'Year'}, :order => [:day, :month, :year] }, {:class => 'span1'} %>
|
||||
</div>
|
||||
@@ -31,7 +33,7 @@
|
||||
<div class="widget-action clear">
|
||||
<a class="action"><i title="Setting the announcement state" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||
</div>
|
||||
<h3 class="widget-title"><i class="icons-star-thin icons-white"></i>Status</h3>
|
||||
<h3 class="widget-title"><i class="icons-star-thin icons-white"></i><%= t(:status) %></h3>
|
||||
<div class="widget-content clear">
|
||||
<div class="controls">
|
||||
<%= content_tag :label,:class => "checkbox inline" do -%>
|
||||
@@ -55,7 +57,7 @@
|
||||
<div class="widget-action clear">
|
||||
<a class="action"><i title="Rejected Report" class="icon-cog icon-white tip"></i></a>
|
||||
</div>
|
||||
<h3 class="widget-title"><i class="icons-tag icons-white"></i>Approval Status</h3>
|
||||
<h3 class="widget-title"><i class="icons-tag icons-white"></i><%= t('approval.stat') %></h3>
|
||||
<div class="widget-content clear form-horizontal">
|
||||
<%= @bulletin.not_checked_reason rescue t("rejected_reason_empty") %>
|
||||
</div>
|
||||
@@ -65,7 +67,7 @@
|
||||
<div class="widget-action clear">
|
||||
<a class="action"><i title="Setting" class="icon-cog icon-white tip"></i></a>
|
||||
</div>
|
||||
<h3 class="widget-title"><i class="icons-tag icons-white"></i>Tags</h3>
|
||||
<h3 class="widget-title"><i class="icons-tag icons-white"></i><%= t('nccu.tags') %></h3>
|
||||
<div class="widget-content clear form-horizontal">
|
||||
<p>
|
||||
<% @tags.each do |tag| %>
|
||||
@@ -100,7 +102,7 @@
|
||||
<%#= f.label :unit_list_for_anc%>
|
||||
<%#= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title, t.id ]}, {}, :class => "input-medium" %>
|
||||
|
||||
<%= f.label :category,t('announcement.bulletin.category')%>
|
||||
<%= 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">
|
||||
@@ -118,7 +120,7 @@
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :title ,t('announcement.bulletin.title')%>
|
||||
<%= f.label :title ,t(:title)%>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'post-title', :value => (@bulletin.title_translations[locale] rescue nil) %>
|
||||
@@ -127,7 +129,7 @@
|
||||
|
||||
|
||||
<div class="editor">
|
||||
<%= f.label :text ,t('announcement.bulletin.text')%>
|
||||
<%= f.label :text ,t(:text)%>
|
||||
<%= f.fields_for :text_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea', :value => (@bulletin.text_translations[locale] rescue nil) %>
|
||||
@@ -145,7 +147,7 @@
|
||||
<div class="widget-action clear">
|
||||
<a class="action"><i title="Add a reference link" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||
</div>
|
||||
<h3 class="widget-title"><i class="icons-link icons-white"></i>Link</h3>
|
||||
<h3 class="widget-title"><i class="icons-link icons-white"></i><%= t(:link) %></h3>
|
||||
<div class="widget-content">
|
||||
|
||||
<div id='bulletin_links' class="bulletin_links_block">
|
||||
@@ -153,8 +155,8 @@
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>URL</th>
|
||||
<th>Name</th>
|
||||
<th><%= t('nccu.url') %></th>
|
||||
<th><%= t('nccu.link_name') %></th>
|
||||
<th class="span1"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -189,7 +191,7 @@
|
||||
<div class="widget-action clear">
|
||||
<a class="action"><i title="Added to the file" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||
</div>
|
||||
<h3 class="widget-title"><i class="icons-paperclip icons-white"></i>File</h3>
|
||||
<h3 class="widget-title"><i class="icons-paperclip icons-white"></i><%= t('nccu.file') %></h3>
|
||||
<div class="widget-content">
|
||||
|
||||
<div id='bulletin_files' class="bulletin_files_block">
|
||||
@@ -197,9 +199,9 @@
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>File</th>
|
||||
<th>Name</th>
|
||||
<th><%= t('description') %></th>
|
||||
<th><%= t('nccu.selected_file') %></th>
|
||||
<th><%= t('nccu.file_name') %></th>
|
||||
<th><%= t('nccu.file_description') %></th>
|
||||
<th class="span1"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -277,7 +279,8 @@
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
||||
<%= button_tag t("preview"), :id=>"button_for_preview", :name=>"commit",:class=>'btn post_preview two_btn',:type=>:button,:url=>preview_panel_announcement_back_end_bulletins_path %>
|
||||
<%= f.submit t('submit'), :class=>'btn btn-primary two_btn' %>
|
||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||
</div>
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag "title-#{locale}", "Title-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<%= label_tag "title-#{locale}", "#{t(:title)}-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :class => 'input-xxlarge', :value => (bulletin.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
<br>
|
||||
<% if bulletin.image.file %>
|
||||
<%= f.check_box :remove_image %>
|
||||
<%= t('announcement.刪除已上傳檔案') %>
|
||||
<%= t(:delete_file) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+7
-7
@@ -1,8 +1,8 @@
|
||||
<%= render_sort_bar(true, delete_panel_announcement_back_end_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]),
|
||||
['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1-2', 'bulletin.status'],
|
||||
['category', 'bulletin_category', 'span1-2', 'bulletin.category'],
|
||||
['title', 'title','span7', 'bulletin.title'],
|
||||
['start_date', 'postdate', 'span1-2', 'bulletin.start_date'],
|
||||
['end_date', 'deadline', 'span1-2', 'bulletin.end_date'],
|
||||
['tags', 'tags', 'span1-2', 'bulletin.tags'],
|
||||
['last_modified', 'update_user_id','span1-3', 'bulletin.last_modified']).html_safe %>
|
||||
['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],
|
||||
['start_date', 'postdate', 'span1-2', :start_date],
|
||||
['end_date', 'deadline', 'span1-2', :end_date],
|
||||
['tags', 'tags', 'span1-2', :tags],
|
||||
['last_modified', 'update_user_id','span1-3', 'last_modified']).html_safe %>
|
||||
Vendored
+3
-3
@@ -1,10 +1,10 @@
|
||||
<ul class="breadcrumb">
|
||||
<!-- <ul class="breadcrumb">
|
||||
<li><span>Home</span><span class="divider">/</span></li>
|
||||
<li><span>Library</span><span class="divider">/</span></li>
|
||||
<li class="text-blue"><%= t('announcement.editing_announcement') %></li>
|
||||
</ul>
|
||||
</ul> -->
|
||||
<div id="poststuff">
|
||||
<%= form_for @bulletin, :url => panel_announcement_back_end_bulletin_path(@bulletin), :html => {:class => 'clear'} do |f| %>
|
||||
<%= form_for @bulletin, :url => panel_announcement_back_end_bulletin_path(@bulletin), :html => {:class => 'clear nccu_ajax_form'} do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
</table>
|
||||
|
||||
<div class="form-actions form-fixed pagination-right">
|
||||
<%= link_to(content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary pull-right' )if (is_manager? rescue nil)%>
|
||||
<%= link_to(content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:add), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary pull-right' )if (is_manager? rescue nil)%>
|
||||
<div id="bulletin_pagination" class="paginationFixed">
|
||||
<%= paginate @bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]} %>
|
||||
</div>
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
<div id="poststuff">
|
||||
<%= form_for @bulletin, :url => panel_announcement_back_end_bulletins_path do |f| %>
|
||||
<%= form_for @bulletin, :url => panel_announcement_back_end_bulletins_path,:html=>{ :class=>"nccu_ajax_form"} do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
</div>
|
||||
Vendored
+9
-9
@@ -1,14 +1,14 @@
|
||||
<ul>
|
||||
<li>
|
||||
<b><%= t('announcement.category') %></b>
|
||||
<b><%= t(:category) %></b>
|
||||
<%= @bulletin.bulletin_category.title rescue nil %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('announcement.postdate') %></b>
|
||||
<b><%= t(:postdate) %></b>
|
||||
<%= display_date_time(@bulletin.postdate) %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('announcement.title') %></b>
|
||||
<b><%= t(:title) %></b>
|
||||
<%= @bulletin.title %>
|
||||
</li>
|
||||
<li>
|
||||
@@ -16,32 +16,32 @@
|
||||
<%= link_to image_tag(@bulletin.image.url, :size => "320x240"), @bulletin.image.url, {:target => '_blank', :title => @bulletin.image_identifier} if @bulletin.image.file %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('announcement.subtitle') %></b>
|
||||
<b><%= t(:subtitle) %></b>
|
||||
<%= @bulletin.subtitle.html_safe rescue '' %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('announcement.text') %></b>
|
||||
<b><%= t(:text) %></b>
|
||||
<%= @bulletin.text.html_safe rescue '' %>
|
||||
</li>
|
||||
<li>
|
||||
<li>
|
||||
<b><%= t('announcement.link') %></b>
|
||||
<b><%= t(:link) %></b>
|
||||
<% @bulletin.bulletin_links.each do | blink | %>
|
||||
<%= link_to blink.title, blink.url, :target => '_blank' %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('announcement.file') %></b>
|
||||
<b><%= t(:file) %></b>
|
||||
<% @bulletin.bulletin_files.each do | bfile | %>
|
||||
<%= link_to bfile.title, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('announcement.張貼者') %></b>
|
||||
<b><%= t(:posted_by) %></b>
|
||||
<%= User.find(@bulletin.create_user_id).name %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('announcement.最後修改時間') %></b>
|
||||
<b><%= t(:last_modified) %></b>
|
||||
<%= display_date(@bulletin.updated_at) %>
|
||||
</li>
|
||||
|
||||
|
||||
vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb
Vendored
+3
-3
@@ -228,10 +228,10 @@
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<%= content_tag (:th) do %>
|
||||
<%= t('announcement.bulletin.category') %>
|
||||
<%= t(:category) %>
|
||||
<% end if (!params[:search_query].blank? or params[:category_id].blank?)-%>
|
||||
<th><%= t('announcement.bulletin.title') %></th>
|
||||
<th><%= t('announcement.bulletin.postdate') %></th>
|
||||
<th><%= t(:title) %></th>
|
||||
<th><%= t(:postdate) %></th>
|
||||
</tr>
|
||||
<% if !params[:name].blank?%>
|
||||
<%= t("search.unit_get",:unit_name => params[:name],:item_num=>@bulletins.count) %>
|
||||
|
||||
+4
-3
@@ -6,14 +6,15 @@ xml.rss :version => "2.0" do
|
||||
else
|
||||
xml.title t('announcement.announcement')
|
||||
end
|
||||
xml.link panel_announcement_front_end_bulletins_path(:rss)
|
||||
xml.link url_for(:action=>"index", :controller=>"panel/announcement/front_end/bulletins",:format=> :rss,:only_path=>false,:inner=>true)
|
||||
|
||||
for bulletin in @bulletins
|
||||
xml.item do
|
||||
xml.title bulletin.title_translations[I18n.locale.to_s]
|
||||
xml.pubDate bulletin.postdate.to_s(:rfc822)
|
||||
xml.link panel_announcement_front_end_bulletin_path(bulletin, :rss)
|
||||
xml.guid panel_announcement_front_end_bulletin_path(bulletin, :rss)
|
||||
xml.link url_for(:action=>"show", :controller=>"panel/announcement/front_end/bulletins", :id=>bulletin ,:only_path=>false)
|
||||
xml.guid url_for(:action=>"show", :controller=>"panel/announcement/front_end/bulletins", :id=>bulletin ,:only_path=>false)
|
||||
xml.fb_share generate_fb_url(bulletin, "announcement")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+3
-4
@@ -6,14 +6,13 @@ xml.rss :version => "2.0" do
|
||||
else
|
||||
xml.title t('announcement.announcement')
|
||||
end
|
||||
xml.link panel_announcement_front_end_bulletins_path(:rss)
|
||||
|
||||
xml.link url_for(:action=>"index", :controller=>"panel/announcement/front_end/bulletins",:format=> :rss,:only_path=>false,:inner=>true)
|
||||
xml.item do
|
||||
xml.title @bulletin.title
|
||||
xml.description @bulletin.text
|
||||
xml.pubDate @bulletin.postdate.to_s(:rfc822)
|
||||
xml.link panel_announcement_front_end_bulletin_path(@bulletin, :rss)
|
||||
xml.guid panel_announcement_front_end_bulletin_path(@bulletin, :rss)
|
||||
xml.link url_for(:action=>"show", :controller=>"panel/announcement/front_end/bulletins", :id=>@bulletin ,:format=> :rss,:only_path=>false,:inner=>true)
|
||||
xml.guid url_for(:action=>"show", :controller=>"panel/announcement/front_end/bulletins", :id=>@bulletin ,:only_path=>false)
|
||||
end
|
||||
# end
|
||||
end
|
||||
|
||||
+53
-1
@@ -1 +1,53 @@
|
||||
Hello~ I am your plugin profile
|
||||
<%
|
||||
if @user
|
||||
@bulletins = Bulletin.where(:create_user_id => @user.id).page(params[:page]).per(10)
|
||||
else
|
||||
@bulletins = Bulletin.all.page(params[:page]).per(10)
|
||||
end
|
||||
|
||||
%>
|
||||
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span1"><%= t('bulletin.category') %></th>
|
||||
<th class="span3"><%= t('bulletin.title') %></th>
|
||||
<th class="span1"><%= t('bulletin.start_date') %></th>
|
||||
<th class="span1"><%= t('bulletin.end_date') %></th>
|
||||
<th class="span1"><%= t('bulletin.tags') %></th>
|
||||
<% if not @user%>
|
||||
<th class="span1"><%= t('bulletin.last_modified') %></th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_bulletin" class="sort-holder">
|
||||
<% @bulletins.each do |bulletin| %>
|
||||
<tr id="<%= dom_id bulletin%>" class="with_action">
|
||||
<td><%= bulletin.bulletin_category.title%></td>
|
||||
<td>
|
||||
<% if bulletin.is_checked? %>
|
||||
<%= link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue ''%>
|
||||
<% else %>
|
||||
<%= bulletin.title%>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= display_date_time(bulletin.postdate) %></td>
|
||||
<% if not bulletin.deadline.nil?%>
|
||||
<td><%= display_date_time(bulletin.deadline) %></td>
|
||||
<%else%>
|
||||
<td><%= t('bulletin.no_deadline') %></td>
|
||||
<% end %>
|
||||
<td>
|
||||
<div class="label-group">
|
||||
<% bulletin.sorted_tags.each do |tag| %>
|
||||
<span class="label label-tags"><%= tag[I18n.locale] %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
<% if not @user%>
|
||||
<td><%= User.find(bulletin.create_user_id).name %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
</div>
|
||||
|
||||
<div class="links_block">
|
||||
<h3 class="links_title"><%= t("announcement.related_links") %></h3>
|
||||
<h3 class="links_title"><%= t(:related_links) %></h3>
|
||||
<ul id='bulletins_web_links_web_links' class="links_list">
|
||||
<%= render 'web_links' if @web_links %>
|
||||
</ul>
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
<%= hidden_field_tag :category_id, params[:category_id] %>
|
||||
<%= hidden_field_tag :tag_id, params[:tag_id] %>
|
||||
<p>
|
||||
<%= text_field_tag :search_query, params[:search_query],{:value => (params[:search_query].blank?? '' : params[:search_query]),:placeholder=>t("announcement.search") }%>
|
||||
<%= text_field_tag :search_query, params[:search_query],{:value => (params[:search_query].blank?? '' : params[:search_query]),:placeholder => t("announcement.search") }%>
|
||||
<%= submit_tag "Search", name: nil %>
|
||||
</p>
|
||||
<% end %>
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
<!-- <div class="search"> <input type="text" onfocus="this.value='';this.searchClickFlag=true;" onblur="if(this.value==''){this.value='公告搜尋';this.searchClickFlag=false;}" value="公告搜尋" id="q" class="search_key" name="q"/> <input type="submit" name="sa" id="sa" class="sa" value="." /> </div> -->
|
||||
<div class="category_list">
|
||||
<h3 class="h3"><%= t('announcement.categories') %></h3>
|
||||
<h3 class="h3"><%= t(:categories) %></h3>
|
||||
<ul class="list">
|
||||
<% @bulletin_categorys.each do |category| %>
|
||||
<li class="<%= category.id.to_s.eql?(params[:category_id]) ? 'active' : nil %>">
|
||||
@@ -10,7 +10,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tag_cloud">
|
||||
<h3 class="h3"><%= t('announcement.tag_cloud') %></h3>
|
||||
<h3 class="h3"><%= t(:tag_cloud) %></h3>
|
||||
<div class="cloud">
|
||||
<% @tags_and_class.each do |tag| %>
|
||||
<%= link_to tag[0][I18n.locale], panel_announcement_front_end_bulletins_path(:tag_id => tag[0].id, :category_id => params[:category_id]), :class => "#{tag[1]} #{(tag[0].id.to_s.eql?(params[:tag_id]) || tag[0].key.eql?(params[:tag_id])) ? 'active' : nil} " %>
|
||||
|
||||
+12
-195
@@ -1,200 +1,17 @@
|
||||
# Sample localization file for English. Add more files in this directory for other locales.
|
||||
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
||||
|
||||
en:
|
||||
|
||||
_locale: English
|
||||
|
||||
basic: Basic
|
||||
picture: Piture
|
||||
tags: Tag
|
||||
link: Link
|
||||
file: File
|
||||
|
||||
add: Add
|
||||
back: Back
|
||||
create: Create
|
||||
delete: Delete
|
||||
disable: Disable
|
||||
downloaded: Downloaded
|
||||
download: Download
|
||||
edit: Edit
|
||||
enable: Enable
|
||||
hide: Hide
|
||||
homepage: Homepage
|
||||
no_: "No"
|
||||
nothing: Nothing
|
||||
show: Show
|
||||
sure?: Are you sure?
|
||||
update: Update
|
||||
yes_: "Yes"
|
||||
|
||||
hot: Hot
|
||||
top: Top
|
||||
hidden: Hidden
|
||||
passed: Passed
|
||||
pending: Pending
|
||||
rejected: Rejected
|
||||
rejected_reason: 'Reason:'
|
||||
rejected_reason_empty: "Approval rejected,no referencable information"
|
||||
|
||||
clear: Clear
|
||||
|
||||
hot: Hot
|
||||
top: Top
|
||||
hidden: Hidden
|
||||
passed: Approved
|
||||
pending: Pending
|
||||
rejected: Rejected
|
||||
clear: Clear
|
||||
|
||||
|
||||
hot: Hot
|
||||
top: Top
|
||||
hidden: Hidden
|
||||
passed: Approved
|
||||
pending: Pending
|
||||
rejected: Rejected
|
||||
clear: Clear
|
||||
|
||||
|
||||
announcement:
|
||||
all_articles: List
|
||||
add_new: Add
|
||||
announcement: Announcement
|
||||
categories: Categories
|
||||
error:
|
||||
no_avilb_cate_for_posting: You need a category to submit your post,please contact admin
|
||||
search: Search in announcement
|
||||
sure?: Sure?
|
||||
campus_news: Campus News
|
||||
more: more+
|
||||
approve_bulletin_fail: Announcement approval failed
|
||||
approve_bulletin_success: Announcement was successfully approved
|
||||
bulletins: Bulletins
|
||||
related_links: Related Links
|
||||
bulletin:
|
||||
submit_user_list: Submit User
|
||||
category: Category
|
||||
list_lower: " list"
|
||||
title: Title
|
||||
postdate: Postdate
|
||||
approval: Approval
|
||||
approval_setting: Approval Setting
|
||||
approval_stat: Fact Check Status
|
||||
approval_not_pass: 'Not Pass'
|
||||
approval_not_pass_reason: 'Reason'
|
||||
approval_pending: 'Pending'
|
||||
approval_pass: 'Pass'
|
||||
approval_setting_window_title: 'Unit'
|
||||
approval_user_list: 'Approval Users'
|
||||
cate_auth: Category Authorization
|
||||
submit_approval: Submit approval
|
||||
tag_cloud: Tag cloud
|
||||
|
||||
bulletin_category:
|
||||
edit: Edit
|
||||
delete: Delete
|
||||
update_success: Bulletin Category Updated
|
||||
update_failed: Bulletin Category Failed
|
||||
disable_change_to_false: Toggle to archive
|
||||
disable_change_to_true: Put back from archive
|
||||
# admin:
|
||||
# action: Action
|
||||
# add_language: Add language
|
||||
# admin: Admin
|
||||
# action: Action
|
||||
# announcement: Announcement
|
||||
# asset: Asset
|
||||
# attributes: Attributes
|
||||
# cant_delete_self: You can not delete yourself.
|
||||
# cant_revoke_self_admin: You can not revoke your admin role yourself.
|
||||
# class: Class
|
||||
# content: Content
|
||||
# create_error_link: Error when creating link.
|
||||
# create_error_page: Error when creating page.
|
||||
# create_success_home: Homepage was successfully created.
|
||||
# create_success_layout: Layout was successfully created.
|
||||
# create_success_link: Link was successfully created.
|
||||
# create_success_page: Page was successfully created.
|
||||
# create_success_snippet: Snippet was successfully created.
|
||||
# create_success_user: User was successfully created.
|
||||
# data: Data
|
||||
# delete_language: Delete language
|
||||
# description: Description
|
||||
# design: Design
|
||||
# disable_language: Disable language
|
||||
# editing_home: Editing homepage
|
||||
# editing_layout: Editing layout
|
||||
# editing_link: Editing link
|
||||
# editing_page: Editing page
|
||||
# editing_snippet: Editing snippet
|
||||
# editing_user_info: Editing user information
|
||||
# editing_user_role: Editing user role
|
||||
# email: Email
|
||||
# enable_language: Enable language
|
||||
# file_name: Filename
|
||||
# file_size: File size
|
||||
# format: Format
|
||||
# home: Home
|
||||
# id: ID
|
||||
# info: Information
|
||||
# is_published: Is published
|
||||
# item: Item
|
||||
# key: Key
|
||||
# language: Language
|
||||
# layout: Layout
|
||||
# layout_name: Layout name
|
||||
# list_assets: Assets list
|
||||
# list_designs: Designs list
|
||||
# list_items: Items list
|
||||
# list_puchases: Purchases list
|
||||
# list_snippets: Snippets list
|
||||
# list_users: Users list
|
||||
# list_user_infos: User information list
|
||||
# list_user_roles: User roles list
|
||||
# member: Member
|
||||
# move_down: Move down
|
||||
# move_up: Move up
|
||||
# multilingual: Multilingual
|
||||
# my_avatar: My Avatar
|
||||
# no_home_page: You don't have a homepage
|
||||
# no_layout: You don't have a layout
|
||||
# name: Name
|
||||
# new_asset: New asset
|
||||
# new_component: New component
|
||||
# new_home: New homepage
|
||||
# new_layout: New layout
|
||||
# new_link: New link
|
||||
# new_page: New page
|
||||
# new_snippet: New snippet
|
||||
# new_user: New user
|
||||
# new_user_info: New user information
|
||||
# new_user_role: New user role
|
||||
# non_multilingual: Non multilingual
|
||||
# options: Options
|
||||
# orig_upload_file: Original filename
|
||||
# position: Position
|
||||
# published?: Published?
|
||||
# purchase: Purchase
|
||||
# registered: Registered
|
||||
# role: Role
|
||||
# roles: Roles
|
||||
# title: Title
|
||||
# translation: Translation
|
||||
# type: Type
|
||||
# up_to_date: Up-to-date
|
||||
# update_error_link: Error when updating link.
|
||||
# update_error_page: Error when updating page.
|
||||
# update_success_content: Content was successfully updated.
|
||||
# update_success_home: Homepage was successfully updated.
|
||||
# update_success_layout: Layout was successfully updated.
|
||||
# update_success_link: Link was successfully updated.
|
||||
# update_success_page: Page was successfully updated.
|
||||
# update_success_snippet: Snippet was successfully updated.
|
||||
# update_success_user: User was successfully updated.
|
||||
# url: URL
|
||||
# user: User
|
||||
# user_info: User information
|
||||
# user_panel: User panel
|
||||
# user_role: User role
|
||||
|
||||
panel:
|
||||
create_bulletin_success: Announcement was successfully created
|
||||
create_bulletin_category_success: Announcement category successfully created
|
||||
editing_announcement: Editing announcememt
|
||||
editing_announcement_category: Editing announcememt category
|
||||
error:
|
||||
no_avilb_cate_for_posting: You need a category to submit your post,please contact admin
|
||||
new_bulletin_category: New announcememt category
|
||||
search: Search for Announcement
|
||||
update_bulletin_success: Announcement was successfully updated
|
||||
update_bulletin_category_success: Announcement category was successfully updated
|
||||
+12
-396
@@ -1,401 +1,17 @@
|
||||
zh_tw:
|
||||
|
||||
_locale: 中文
|
||||
|
||||
basic: 基礎資訊
|
||||
picture: 圖片
|
||||
tags: 標籤
|
||||
link: 連結
|
||||
file: 檔案
|
||||
|
||||
add: 新增
|
||||
back: 回去
|
||||
create: 創造
|
||||
delete: 刪除
|
||||
disable: 禁用
|
||||
edit: 編輯
|
||||
enable: 啟用
|
||||
hide: 隱藏
|
||||
homepage: 首頁
|
||||
no_: "No"
|
||||
nothing: 無
|
||||
show: 顯示
|
||||
sure?: 您肯定嗎?
|
||||
update: 更新
|
||||
yes_: "Yes"
|
||||
|
||||
hot: 熱門
|
||||
top: 置頂
|
||||
hidden: 隱藏
|
||||
passed: 審核通過
|
||||
pending: 待審查
|
||||
rejected: 不通過
|
||||
rejected_reason_empty: 審核沒有通過,沒有相關訊息
|
||||
rejected_reason: '原因:'
|
||||
clear: 清除
|
||||
|
||||
quick_edit: 快速編輯
|
||||
|
||||
announcement:
|
||||
add_new: 新增
|
||||
all_articles: 列表
|
||||
announcement: 公告
|
||||
error:
|
||||
no_avilb_cate_for_posting: 您目前沒有分類可以刊登公告,請聯絡系統管理員為您開通分類
|
||||
tags: 標籤
|
||||
categories: 分類
|
||||
search: 搜尋公告
|
||||
status: 狀態
|
||||
sure?: 確定嗎?
|
||||
campus_news: 校園新聞
|
||||
more: 更多+
|
||||
approve_bulletin_fail: 公告審核失敗
|
||||
approve_bulletin_success: 公告成功通過審核
|
||||
bulletins: 公告訊息
|
||||
related_links: 相關連結
|
||||
bulletin:
|
||||
text: 內文
|
||||
category: 分類
|
||||
submit_user_list: 張貼人
|
||||
list_lower: 列表
|
||||
title: 標題
|
||||
postdate: 張貼日期
|
||||
approval: 公告審核
|
||||
approval_setting: 審核設定
|
||||
approval_stat: 審核狀況
|
||||
approval_pending: 待審核
|
||||
approval_not_pass: '不通過'
|
||||
approval_pass: '通過'
|
||||
approval_not_pass_reason: '不通過原因'
|
||||
approval_setting_window_title: '單位'
|
||||
approval_user_list: '審核者'
|
||||
cate_auth: '分類授權'
|
||||
submit_approval: '提交審核'
|
||||
tag_cloud: 標籤雲
|
||||
|
||||
bulletin:
|
||||
last_modified: 最後修改於
|
||||
tags: 標籤
|
||||
end_date: 下架時間
|
||||
start_date: 上架時間
|
||||
category: 分類
|
||||
status: 狀態
|
||||
title: 標題
|
||||
fact_check: 公告審核
|
||||
delete: 刪除
|
||||
edit: 編輯
|
||||
update_bulletin_success: 成功更新公告
|
||||
create_bulletin_success: 成功新增公告
|
||||
approve_bulletin_success: 成功審核公告
|
||||
approve_bulletin_fail: 審核公告失敗
|
||||
# action: 行動
|
||||
# add_language: 新增語言
|
||||
# admin: 管理
|
||||
# action: 行動
|
||||
# announcement: 公告
|
||||
# asset: 資產
|
||||
# attributes: 屬性
|
||||
# cant_delete_self: 您不可以刪除自己。
|
||||
# cant_revoke_self_admin: 您不可以撤銷自己的管理作用。
|
||||
# class: 階級
|
||||
# content: 內容
|
||||
# create_error_link: 創建連接時出錯。
|
||||
# create_error_page: 創建頁面時出錯。
|
||||
# create_success_home: 首頁已成功創建。
|
||||
# create_success_layout: 樣板已成功創建。
|
||||
# create_success_link: 連結已成功創建。
|
||||
# create_success_page: 頁面已成功創建。
|
||||
# create_success_snippet: 片段已成功創建
|
||||
# create_success_user: 用戶已成功創建。。
|
||||
# data: 數據
|
||||
# delete_language: 刪除語言
|
||||
# description: 描述
|
||||
# disable_language: 禁用語言
|
||||
# editing_home: 編輯首頁
|
||||
# editing_layout: 編輯樣板
|
||||
# editing_link: 編輯連結
|
||||
# editing_page: 編輯頁面
|
||||
# editing_snippet: 編輯片段
|
||||
# editing_user_info: 編輯用戶資料
|
||||
# editing_user_role: 編輯用戶角色
|
||||
# email: Email
|
||||
# enable_language: 啟用語言
|
||||
# file_name: 檔名
|
||||
# file_size: 檔案大小
|
||||
# format: 格式
|
||||
# home: 首頁
|
||||
# id: ID
|
||||
# info: 資料
|
||||
# is_published: 被出版
|
||||
# item: 項目
|
||||
# key: 關鍵
|
||||
# language: 語言
|
||||
# layout: 佈局
|
||||
# layout_name: 佈局名字
|
||||
# list_assets: 資產清單
|
||||
# list_items: 項目清單
|
||||
# list_layouts: 佈局清單
|
||||
# list_snippets: 斷片清單
|
||||
# list_users: 使用清單
|
||||
# list_user_infos: 用戶資料清單
|
||||
# list_user_roles: 用戶角色清單
|
||||
# member: 會員
|
||||
# move_down: 往下移
|
||||
# move_up: 往上移
|
||||
# multilingual: 多種語言
|
||||
# my_avatar: 我的頭像
|
||||
# no_home_page: 您沒有首頁
|
||||
# no_layout: 您沒有佈局
|
||||
# name: 名稱
|
||||
# new_asset: 新增資產
|
||||
# new_component: 新增元件
|
||||
# new_home: 新增首頁
|
||||
# new_layout: 新增樣板
|
||||
# new_link: 新增連結
|
||||
# new_page: 新增頁面
|
||||
# new_snippet: 新增片段
|
||||
# new_user: 新增使用
|
||||
# new_user_info: 新增用戶資料
|
||||
# new_user_role: 新增用戶角色
|
||||
# non_multilingual: 非多種語言
|
||||
# options: 選項
|
||||
# orig_upload_file: 原上傳檔名
|
||||
# position: 位置
|
||||
# published?: 發布?
|
||||
# role: 角色
|
||||
# roles: 角色。
|
||||
# title: 標題
|
||||
# translation: 翻譯
|
||||
# type: 類型
|
||||
# update_error_link: 更新鏈接時出現錯誤。
|
||||
# update_error_page: 更新頁面時出現錯誤。
|
||||
# update_success_content: 內容已成功更新。
|
||||
# update_success_home: 首頁已成功更新。
|
||||
# update_success_layout: 樣板已成功更新。
|
||||
# update_success_link: 連結已成功更新。
|
||||
# update_success_page: 頁面已成功更新。
|
||||
# update_success_snippet: 片段已成功更新。
|
||||
# update_success_user: 用戶已成功更新
|
||||
# url: URL
|
||||
# user: 用戶
|
||||
# user_info: 用戶資料
|
||||
# user_panel: 用戶面板
|
||||
# user_role: 用戶角色
|
||||
|
||||
panel:
|
||||
|
||||
bulletin_category:
|
||||
edit: 修改
|
||||
delete: 刪除
|
||||
update_success: 分類更新成功
|
||||
update_failed: 分類更新失敗
|
||||
|
||||
# Chinese (Taiwan) translations for Ruby on Rails
|
||||
# by tsechingho (http://github.com/tsechingho)
|
||||
date:
|
||||
formats:
|
||||
default: "%Y-%m-%d"
|
||||
short: "%b%d日"
|
||||
long: "%Y年%b%d日"
|
||||
day_names: [星期日, 星期一, 星期二, 星期三, 星期四, 星期五, 星期六]
|
||||
abbr_day_names: [日, 一, 二, 三, 四, 五, 六]
|
||||
month_names: [~, 一月, 二月, 三月, 四月, 五月, 六月, 七月, 八月, 九月, 十月, 十一月, 十二月]
|
||||
abbr_month_names: [~, 1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月]
|
||||
order: [ :year, :month, :day ]
|
||||
|
||||
time:
|
||||
formats:
|
||||
default: "%Y年%b%d日 %A %H:%M:%S %Z"
|
||||
short: "%b%d日 %H:%M"
|
||||
long: "%Y年%b%d日 %H:%M"
|
||||
am: "上午"
|
||||
pm: "下午"
|
||||
|
||||
datetime:
|
||||
distance_in_words:
|
||||
half_a_minute: "半分鐘"
|
||||
less_than_x_seconds:
|
||||
one: "不到一秒"
|
||||
other: "不到 %{count} 秒"
|
||||
x_seconds:
|
||||
one: "一秒"
|
||||
other: "%{count} 秒"
|
||||
less_than_x_minutes:
|
||||
one: "不到一分鐘"
|
||||
other: "不到 %{count} 分鐘"
|
||||
x_minutes:
|
||||
one: "一分鐘"
|
||||
other: "%{count} 分鐘"
|
||||
about_x_hours:
|
||||
one: "大約一小時"
|
||||
other: "大約 %{count} 小時"
|
||||
x_days:
|
||||
one: "一天"
|
||||
other: "%{count} 天"
|
||||
about_x_months:
|
||||
one: "大約一個月"
|
||||
other: "大約 %{count} 個月"
|
||||
x_months:
|
||||
one: "一個月"
|
||||
other: "%{count} 個月"
|
||||
about_x_years:
|
||||
one: "大約一年"
|
||||
other: "大約 %{count} 年"
|
||||
over_x_years:
|
||||
one: "一年多"
|
||||
other: "%{count} 年多"
|
||||
almost_x_years:
|
||||
one: "接近一年"
|
||||
other: "接近 %{count} 年"
|
||||
prompts:
|
||||
year: "年"
|
||||
month: "月"
|
||||
day: "日"
|
||||
hour: "時"
|
||||
minute: "分"
|
||||
second: "秒"
|
||||
|
||||
number:
|
||||
format:
|
||||
separator: "."
|
||||
delimiter: ","
|
||||
precision: 3
|
||||
significant: false
|
||||
strip_insignificant_zeros: false
|
||||
currency:
|
||||
format:
|
||||
format: "%u %n"
|
||||
unit: "NT$"
|
||||
separator: "."
|
||||
delimiter: ","
|
||||
precision: 2
|
||||
significant: false
|
||||
strip_insignificant_zeros: false
|
||||
percentage:
|
||||
format:
|
||||
delimiter: ""
|
||||
precision:
|
||||
format:
|
||||
delimiter: ""
|
||||
human:
|
||||
format:
|
||||
delimiter: ""
|
||||
precision: 1
|
||||
significant: false
|
||||
strip_insignificant_zeros: false
|
||||
storage_units:
|
||||
format: "%n %u"
|
||||
units:
|
||||
byte:
|
||||
one: "Byte"
|
||||
other: "Bytes"
|
||||
kb: "KB"
|
||||
mb: "MB"
|
||||
gb: "GB"
|
||||
tb: "TB"
|
||||
decimal_units:
|
||||
format: "%n %u"
|
||||
units:
|
||||
# 10^-21 zepto, 10^-24 yocto
|
||||
atto: "渺" # 10^-18
|
||||
femto: "飛" # 10^-15 毫微微
|
||||
pico: "漠" # 10^-12 微微
|
||||
nano: "奈" # 10^-9 毫微
|
||||
micro: "微" # 10^-6
|
||||
mili: "毫" # 10^-3 milli
|
||||
centi: "厘" # 10^-2
|
||||
deci: "分" # 10^-1
|
||||
unit: ""
|
||||
ten:
|
||||
one: "十"
|
||||
other: "十" # 10^1
|
||||
hundred: "百" # 10^2
|
||||
thousand: "千" # 10^3 kilo
|
||||
million: "百萬" # 10^6 mega
|
||||
billion: "十億" # 10^9 giga
|
||||
trillion: "兆" # 10^12 tera
|
||||
quadrillion: "千兆" # 10^15 peta
|
||||
# 10^18 exa, 10^21 zetta, 10^24 yotta
|
||||
|
||||
support:
|
||||
array:
|
||||
words_connector: ", "
|
||||
two_words_connector: " 和 "
|
||||
last_word_connector: ", 和 "
|
||||
select:
|
||||
prompt: "請選擇"
|
||||
|
||||
activerecord:
|
||||
errors:
|
||||
template: # ~ 2.3.5 backward compatible
|
||||
header:
|
||||
one: "有 1 個錯誤發生使得「%{model}」無法被儲存。"
|
||||
other: "有 %{count} 個錯誤發生使得「%{model}」無法被儲存。"
|
||||
body: "以下欄位發生問題:"
|
||||
full_messages:
|
||||
format: "%{attribute} %{message}"
|
||||
messages:
|
||||
inclusion: "沒有包含在列表中"
|
||||
exclusion: "是被保留的關鍵字"
|
||||
invalid: "是無效的"
|
||||
confirmation: "不符合確認值"
|
||||
accepted: "必須是可被接受的"
|
||||
empty: "不能留空"
|
||||
blank: "不能是空白字元"
|
||||
too_long: "過長(最長是 %{count} 個字)"
|
||||
too_short: "過短(最短是 %{count} 個字)"
|
||||
wrong_length: "字數錯誤(必須是 %{count} 個字)"
|
||||
not_a_number: "不是數字"
|
||||
not_an_integer: "必須是整數"
|
||||
greater_than: "必須大於 %{count}"
|
||||
greater_than_or_equal_to: "必須大於或等於 %{count}"
|
||||
equal_to: "必須等於 %{count}"
|
||||
less_than: "必須小於 %{count}"
|
||||
less_than_or_equal_to: "必須小於或等於 %{count}"
|
||||
odd: "必須是奇數"
|
||||
even: "必須是偶數"
|
||||
taken: "已經被使用"
|
||||
record_invalid: "校驗失敗: %{errors}"
|
||||
|
||||
activemodel:
|
||||
errors:
|
||||
template:
|
||||
header:
|
||||
one: "有 1 個錯誤發生使得「%{model}」無法被儲存。"
|
||||
other: "有 %{count} 個錯誤發生使得「%{model}」無法被儲存。"
|
||||
body: "以下欄位發生問題:"
|
||||
|
||||
errors:
|
||||
format: "%{attribute} %{message}"
|
||||
messages:
|
||||
inclusion: "沒有包含在列表中"
|
||||
exclusion: "是被保留的關鍵字"
|
||||
invalid: "是無效的"
|
||||
confirmation: "不符合確認值"
|
||||
accepted: "必須是可被接受的"
|
||||
empty: "不能留空"
|
||||
blank: "不能是空白字元"
|
||||
too_long: "過長(最長是 %{count} 個字)"
|
||||
too_short: "過短(最短是 %{count} 個字)"
|
||||
wrong_length: "字數錯誤(必須是 %{count} 個字)"
|
||||
not_a_number: "不是數字"
|
||||
not_an_integer: "必須是整數"
|
||||
greater_than: "必須大於 %{count}"
|
||||
greater_than_or_equal_to: "必須大於或等於 %{count}"
|
||||
equal_to: "必須等於 %{count}"
|
||||
less_than: "必須小於 %{count}"
|
||||
less_than_or_equal_to: "必須小於或等於 %{count}"
|
||||
odd: "必須是奇數"
|
||||
even: "必須是偶數"
|
||||
template:
|
||||
header:
|
||||
one: "有 1 個錯誤發生使得「%{model}」無法被儲存。"
|
||||
other: "有 %{count} 個錯誤發生使得「%{model}」無法被儲存。"
|
||||
body: "以下欄位發生問題:"
|
||||
|
||||
helpers:
|
||||
select:
|
||||
prompt: "請選擇"
|
||||
submit:
|
||||
create: "新增%{model}"
|
||||
update: "更新%{model}"
|
||||
submit: "儲存%{model}"
|
||||
|
||||
create_bulletin_success: 公告已成功建立
|
||||
create_bulletin_category_success: 公告類別已成功建立
|
||||
editing_announcement: 編輯公告
|
||||
editing_announcement_category: 編輯公告類別
|
||||
error:
|
||||
no_avilb_cate_for_posting: 公告必需有一個類別才能發送,請與管理員聯絡
|
||||
new_bulletin_category: 新增公告類別
|
||||
search: 搜尋公告
|
||||
update_bulletin_success: 公告已成功更新
|
||||
update_bulletin_category_success: 公告類別已成功更新
|
||||
@@ -15,6 +15,8 @@ Rails.application.routes.draw do
|
||||
get 'load_quick_edit'
|
||||
end
|
||||
collection do
|
||||
post "preview"
|
||||
put "preview"
|
||||
get 'delete'
|
||||
end
|
||||
match "file_quick_add/:bulletin_id" => "bulletins#file_quick_add" ,:as => :file_quick_add
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
+32
@@ -10,6 +10,38 @@ namespace :nccu_data do
|
||||
new_unit.build_title :en => row[4], :zh_tw => row[3]
|
||||
new_unit.save
|
||||
end
|
||||
end
|
||||
|
||||
task :setup_0918_announcement => :environment do
|
||||
def null_or_val(str)
|
||||
if str == "NULL"
|
||||
return nil
|
||||
else
|
||||
if str.class == "String"
|
||||
return str.force_encoding("utf-8")
|
||||
else
|
||||
return str
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
require 'csv'
|
||||
Bulletin.destroy_all
|
||||
to_this_category = BulletinCategory.first({conditions:{key: 'Announcement'}})
|
||||
counter = 0
|
||||
CSV.foreach("vendor/built_in_modules/announcement/lib/nccu_ann20120918.csv") do |row|
|
||||
#bul_h1,bul_content,bul_ENh1,bul_ENcontent,bul_date,bul_deadline
|
||||
data = {:title_translations=>{:zh_tw=>(null_or_val(row[0]) rescue nil),:en=>(null_or_val(row[2]) rescue nil)},
|
||||
:text_translations=>{:zh_tw=>(null_or_val(row[1]) rescue nil),:en=>(null_or_val(row[3]) rescue nil)},
|
||||
:postdate=>(Date.parse(row[4]) rescue nil),
|
||||
:deadline=>(Date.parse(row[5]) rescue nil),
|
||||
:bulletin_category_id=>to_this_category.id }
|
||||
if counter >=1
|
||||
Bulletin.create!(data.merge({:is_checked=> true,:is_pending=>false}))
|
||||
end
|
||||
counter+=1
|
||||
end
|
||||
Bulletin.all.each{|t| t.save}
|
||||
end
|
||||
end
|
||||
-1
@@ -37,7 +37,6 @@ class Panel::Archive::BackEnd::ArchiveFileCategorysController < OrbitBackendCont
|
||||
# GET /archive_files/1/edit
|
||||
def edit
|
||||
@archive_file_category = ArchiveFileCategory.find(params[:id])
|
||||
@i18n_variable = @archive_file_category.i18n_variable
|
||||
|
||||
@url = panel_archive_back_end_archive_file_category_path(@archive_file_category)
|
||||
|
||||
|
||||
Vendored
+2
-1
@@ -55,7 +55,6 @@ class Panel::Archive::BackEnd::ArchiveFilesController < OrbitBackendController
|
||||
# POST /archive_files.xml
|
||||
def create
|
||||
@archive_file = ArchiveFile.new(params[:archive_file])
|
||||
|
||||
@archive_file.create_user_id = current_user.id
|
||||
@archive_file.update_user_id = current_user.id
|
||||
|
||||
@@ -64,6 +63,8 @@ class Panel::Archive::BackEnd::ArchiveFilesController < OrbitBackendController
|
||||
format.html { redirect_to(panel_archive_back_end_archive_files_url) }
|
||||
format.xml { render :xml => @archive_file, :status => :created, :location => @archive_file }
|
||||
else
|
||||
get_categorys
|
||||
get_tags
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @archive_file.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
|
||||
Vendored
+3
-3
@@ -9,7 +9,7 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController
|
||||
|
||||
@item = Page.find(params[:page_id])
|
||||
|
||||
@title = @item.i18n_variable[I18n.locale]
|
||||
@title = @item.title
|
||||
|
||||
if @item.frontend_data_count
|
||||
@page_num = @item.frontend_data_count
|
||||
@@ -41,7 +41,7 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController
|
||||
|
||||
@item = Page.find(params[:page_id])
|
||||
|
||||
@title = @item.i18n_variable[I18n.locale]
|
||||
@title = @item.title
|
||||
|
||||
@archive_file = ArchiveFile.find(params[:id])
|
||||
|
||||
@@ -55,7 +55,7 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController
|
||||
|
||||
@item = Page.find(params[:page_id])
|
||||
|
||||
@title = @item.i18n_variable[I18n.locale]
|
||||
@title = @item.title
|
||||
|
||||
if @item.frontend_data_count
|
||||
@page_num = @item.frontend_data_count
|
||||
|
||||
@@ -26,7 +26,7 @@ class ArchiveFile
|
||||
|
||||
accepts_nested_attributes_for :archive_file_multiples, :allow_destroy => true
|
||||
|
||||
validates_presence_of :title
|
||||
validates :title, :at_least_one => true
|
||||
|
||||
after_save :save_archive_file_multiples
|
||||
|
||||
|
||||
@@ -7,8 +7,10 @@ class ArchiveFileCategory
|
||||
|
||||
field :key
|
||||
|
||||
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
field :title, localize: true
|
||||
|
||||
has_many :archive_files
|
||||
|
||||
validates :title, :at_least_one => true
|
||||
|
||||
end
|
||||
@@ -9,8 +9,6 @@ class ArchiveFileMultiple
|
||||
# field :description
|
||||
field :choose_lang, :type => Array, :default => nil
|
||||
|
||||
# has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
|
||||
field :should_destroy, :type => Boolean
|
||||
|
||||
def choose_lang_display(lang)
|
||||
|
||||
+1
-1
@@ -11,6 +11,6 @@
|
||||
</div>
|
||||
</td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= archive_file_category.i18n_variable[locale] rescue nil %></td>
|
||||
<td><%= archive_file_category.title_translations[locale] rescue nil %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
+2
-2
@@ -10,12 +10,12 @@
|
||||
</div>
|
||||
|
||||
<div id="widget-title">
|
||||
<%= f.fields_for :i18n_variable, (@archive_file_category.new_record? ? @archive_file_category.build_i18n_variable : @archive_file_category.i18n_variable) do |f| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :class => 'input-xxlarge' %>
|
||||
<%= f.text_field locale, :class =>' input-xxlarge', :value => (@archive_file_category.title[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= post.archive_file_category.i18n_variable[I18n.locale] %></td>
|
||||
<td><%= post.archive_file_category.title %></td>
|
||||
<td>
|
||||
<%= link_to post.title, panel_archive_front_end_archive_file_path(post) %>
|
||||
</td>
|
||||
|
||||
Vendored
+3
-3
@@ -43,12 +43,12 @@
|
||||
<div id="post-body-content" class="clear">
|
||||
|
||||
<%= f.label :category %>
|
||||
<%= f.select :archive_file_category_id, @archive_file_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]} %>
|
||||
<%= f.select :archive_file_category_id, @archive_file_categorys.collect {|t| [ t.title, t.id ]} %>
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
<%# site_valid_locales_default_head.each_with_index do |locale, i| %>
|
||||
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||
<li <%= ( i == 0 ) ? "class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
|
||||
<div>
|
||||
|
||||
<div id='archive_file_multiples' class="archive_file_multiples_block">
|
||||
<div class="archive_file_multiples_block">
|
||||
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
|
||||
-219
@@ -1,219 +0,0 @@
|
||||
/*
|
||||
* jQuery File Upload File Processing Plugin 1.0
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2012, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint nomen: true, unparam: true, regexp: true */
|
||||
/*global define, window, document */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery',
|
||||
'load-image',
|
||||
'canvas-to-blob',
|
||||
'./jquery.fileupload'
|
||||
], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.jQuery,
|
||||
window.loadImage
|
||||
);
|
||||
}
|
||||
}(function ($, loadImage) {
|
||||
'use strict';
|
||||
|
||||
// The File Upload IP version extends the basic fileupload widget
|
||||
// with file processing functionality:
|
||||
$.widget('blueimpFP.fileupload', $.blueimp.fileupload, {
|
||||
|
||||
options: {
|
||||
// The list of file processing actions:
|
||||
process: [
|
||||
/*
|
||||
{
|
||||
action: 'load',
|
||||
fileTypes: /^image\/(gif|jpeg|png)$/,
|
||||
maxFileSize: 20000000 // 20MB
|
||||
},
|
||||
{
|
||||
action: 'resize',
|
||||
maxWidth: 1920,
|
||||
maxHeight: 1200,
|
||||
minWidth: 800,
|
||||
minHeight: 600
|
||||
},
|
||||
{
|
||||
action: 'save'
|
||||
}
|
||||
*/
|
||||
],
|
||||
|
||||
// The add callback is invoked as soon as files are added to the
|
||||
// fileupload widget (via file input selection, drag & drop or add
|
||||
// API call). See the basic file upload widget for more information:
|
||||
add: function (e, data) {
|
||||
$(this).fileupload('process', data).done(function () {
|
||||
data.submit();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
processActions: {
|
||||
// Loads the image given via data.files and data.index
|
||||
// as canvas element.
|
||||
// Accepts the options fileTypes (regular expression)
|
||||
// and maxFileSize (integer) to limit the files to load:
|
||||
load: function (data, options) {
|
||||
var that = this,
|
||||
file = data.files[data.index],
|
||||
dfd = $.Deferred();
|
||||
if (window.HTMLCanvasElement &&
|
||||
window.HTMLCanvasElement.prototype.toBlob &&
|
||||
($.type(options.maxFileSize) !== 'number' ||
|
||||
file.size < options.maxFileSize) &&
|
||||
(!options.fileTypes ||
|
||||
options.fileTypes.test(file.type))) {
|
||||
loadImage(
|
||||
file,
|
||||
function (canvas) {
|
||||
data.canvas = canvas;
|
||||
dfd.resolveWith(that, [data]);
|
||||
},
|
||||
{canvas: true}
|
||||
);
|
||||
} else {
|
||||
dfd.rejectWith(that, [data]);
|
||||
}
|
||||
return dfd.promise();
|
||||
},
|
||||
// Resizes the image given as data.canvas and updates
|
||||
// data.canvas with the resized image.
|
||||
// Accepts the options maxWidth, maxHeight, minWidth and
|
||||
// minHeight to scale the given image:
|
||||
resize: function (data, options) {
|
||||
if (data.canvas) {
|
||||
var canvas = loadImage.scale(data.canvas, options);
|
||||
if (canvas.width !== data.canvas.width ||
|
||||
canvas.height !== data.canvas.height) {
|
||||
data.canvas = canvas;
|
||||
data.processed = true;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
},
|
||||
// Saves the processed image given as data.canvas
|
||||
// inplace at data.index of data.files:
|
||||
save: function (data, options) {
|
||||
// Do nothing if no processing has happened:
|
||||
if (!data.canvas || !data.processed) {
|
||||
return data;
|
||||
}
|
||||
var that = this,
|
||||
file = data.files[data.index],
|
||||
name = file.name,
|
||||
dfd = $.Deferred(),
|
||||
callback = function (blob) {
|
||||
if (!blob.name) {
|
||||
if (file.type === blob.type) {
|
||||
blob.name = file.name;
|
||||
} else if (file.name) {
|
||||
blob.name = file.name.replace(
|
||||
/\..+$/,
|
||||
'.' + blob.type.substr(6)
|
||||
);
|
||||
}
|
||||
}
|
||||
// Store the created blob at the position
|
||||
// of the original file in the files list:
|
||||
data.files[data.index] = blob;
|
||||
dfd.resolveWith(that, [data]);
|
||||
};
|
||||
// Use canvas.mozGetAsFile directly, to retain the filename, as
|
||||
// Gecko doesn't support the filename option for FormData.append:
|
||||
if (data.canvas.mozGetAsFile) {
|
||||
callback(data.canvas.mozGetAsFile(
|
||||
(/^image\/(jpeg|png)$/.test(file.type) && name) ||
|
||||
((name && name.replace(/\..+$/, '')) ||
|
||||
'blob') + '.png',
|
||||
file.type
|
||||
));
|
||||
} else {
|
||||
data.canvas.toBlob(callback, file.type);
|
||||
}
|
||||
return dfd.promise();
|
||||
}
|
||||
},
|
||||
|
||||
// Resizes the file at the given index and stores the created blob at
|
||||
// the original position of the files list, returns a Promise object:
|
||||
_processFile: function (files, index, options) {
|
||||
var that = this,
|
||||
dfd = $.Deferred().resolveWith(that, [{
|
||||
files: files,
|
||||
index: index
|
||||
}]),
|
||||
chain = dfd.promise();
|
||||
that._processing += 1;
|
||||
$.each(options.process, function (i, settings) {
|
||||
chain = chain.pipe(function (data) {
|
||||
return that.processActions[settings.action]
|
||||
.call(this, data, settings);
|
||||
});
|
||||
});
|
||||
chain.always(function () {
|
||||
that._processing -= 1;
|
||||
if (that._processing === 0) {
|
||||
that.element
|
||||
.removeClass('fileupload-processing');
|
||||
}
|
||||
});
|
||||
if (that._processing === 1) {
|
||||
that.element.addClass('fileupload-processing');
|
||||
}
|
||||
return chain;
|
||||
},
|
||||
|
||||
// Processes the files given as files property of the data parameter,
|
||||
// returns a Promise object that allows to bind a done handler, which
|
||||
// will be invoked after processing all files (inplace) is done:
|
||||
process: function (data) {
|
||||
var that = this,
|
||||
options = $.extend({}, this.options, data);
|
||||
if (options.process && options.process.length &&
|
||||
this._isXHRUpload(options)) {
|
||||
$.each(data.files, function (index, file) {
|
||||
that._processingQueue = that._processingQueue.pipe(
|
||||
function () {
|
||||
var dfd = $.Deferred();
|
||||
that._processFile(data.files, index, options)
|
||||
.always(function () {
|
||||
dfd.resolveWith(that);
|
||||
});
|
||||
return dfd.promise();
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
return this._processingQueue;
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
$.blueimp.fileupload.prototype._create.call(this);
|
||||
this._processing = 0;
|
||||
this._processingQueue = $.Deferred().resolveWith(this)
|
||||
.promise();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
-736
@@ -1,736 +0,0 @@
|
||||
/*
|
||||
* jQuery File Upload User Interface Plugin 6.9.4
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint nomen: true, unparam: true, regexp: true */
|
||||
/*global define, window, document, URL, webkitURL, FileReader */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery',
|
||||
'tmpl',
|
||||
'load-image',
|
||||
'./jquery.fileupload-fp'
|
||||
], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.jQuery,
|
||||
window.tmpl,
|
||||
window.loadImage
|
||||
);
|
||||
}
|
||||
}(function ($, tmpl, loadImage) {
|
||||
'use strict';
|
||||
|
||||
// The UI version extends the FP (file processing) version or the basic
|
||||
// file upload widget and adds complete user interface interaction:
|
||||
var parentWidget = ($.blueimpFP || $.blueimp).fileupload;
|
||||
$.widget('blueimpUI.fileupload', parentWidget, {
|
||||
|
||||
options: {
|
||||
// By default, files added to the widget are uploaded as soon
|
||||
// as the user clicks on the start buttons. To enable automatic
|
||||
// uploads, set the following option to true:
|
||||
autoUpload: false,
|
||||
// The following option limits the number of files that are
|
||||
// allowed to be uploaded using this widget:
|
||||
maxNumberOfFiles: undefined,
|
||||
// The maximum allowed file size:
|
||||
maxFileSize: undefined,
|
||||
// The minimum allowed file size:
|
||||
minFileSize: undefined,
|
||||
// The regular expression for allowed file types, matches
|
||||
// against either file type or file name:
|
||||
acceptFileTypes: /.+$/i,
|
||||
// The regular expression to define for which files a preview
|
||||
// image is shown, matched against the file type:
|
||||
previewSourceFileTypes: /^image\/(gif|jpeg|png)$/,
|
||||
// The maximum file size of images that are to be displayed as preview:
|
||||
previewSourceMaxFileSize: 5000000, // 5MB
|
||||
// The maximum width of the preview images:
|
||||
previewMaxWidth: 80,
|
||||
// The maximum height of the preview images:
|
||||
previewMaxHeight: 80,
|
||||
// By default, preview images are displayed as canvas elements
|
||||
// if supported by the browser. Set the following option to false
|
||||
// to always display preview images as img elements:
|
||||
previewAsCanvas: true,
|
||||
// The ID of the upload template:
|
||||
uploadTemplateId: 'template-upload',
|
||||
// The ID of the download template:
|
||||
downloadTemplateId: 'template-download',
|
||||
// The container for the list of files. If undefined, it is set to
|
||||
// an element with class "files" inside of the widget element:
|
||||
filesContainer: undefined,
|
||||
// By default, files are appended to the files container.
|
||||
// Set the following option to true, to prepend files instead:
|
||||
prependFiles: false,
|
||||
// The expected data type of the upload response, sets the dataType
|
||||
// option of the $.ajax upload requests:
|
||||
dataType: 'json',
|
||||
|
||||
// The add callback is invoked as soon as files are added to the fileupload
|
||||
// widget (via file input selection, drag & drop or add API call).
|
||||
// See the basic file upload widget for more information:
|
||||
add: function (e, data) {
|
||||
var that = $(this).data('fileupload'),
|
||||
options = that.options,
|
||||
files = data.files;
|
||||
$(this).fileupload('process', data).done(function () {
|
||||
that._adjustMaxNumberOfFiles(-files.length);
|
||||
data.maxNumberOfFilesAdjusted = true;
|
||||
data.files.valid = data.isValidated = that._validate(files);
|
||||
data.context = that._renderUpload(files).data('data', data);
|
||||
options.filesContainer[
|
||||
options.prependFiles ? 'prepend' : 'append'
|
||||
](data.context);
|
||||
that._renderPreviews(files, data.context);
|
||||
that._forceReflow(data.context);
|
||||
that._transition(data.context).done(
|
||||
function () {
|
||||
if ((that._trigger('added', e, data) !== false) &&
|
||||
(options.autoUpload || data.autoUpload) &&
|
||||
data.autoUpload !== false && data.isValidated) {
|
||||
data.submit();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
},
|
||||
// Callback for the start of each file upload request:
|
||||
send: function (e, data) {
|
||||
var that = $(this).data('fileupload');
|
||||
if (!data.isValidated) {
|
||||
if (!data.maxNumberOfFilesAdjusted) {
|
||||
that._adjustMaxNumberOfFiles(-data.files.length);
|
||||
data.maxNumberOfFilesAdjusted = true;
|
||||
}
|
||||
if (!that._validate(data.files)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (data.context && data.dataType &&
|
||||
data.dataType.substr(0, 6) === 'iframe') {
|
||||
// Iframe Transport does not support progress events.
|
||||
// In lack of an indeterminate progress bar, we set
|
||||
// the progress to 100%, showing the full animated bar:
|
||||
data.context
|
||||
.find('.progress').addClass(
|
||||
!$.support.transition && 'progress-animated'
|
||||
)
|
||||
.attr('aria-valuenow', 100)
|
||||
.find('.bar').css(
|
||||
'width',
|
||||
'100%'
|
||||
);
|
||||
}
|
||||
return that._trigger('sent', e, data);
|
||||
},
|
||||
// Callback for successful uploads:
|
||||
done: function (e, data) {
|
||||
var that = $(this).data('fileupload'),
|
||||
template;
|
||||
if (data.context) {
|
||||
data.context.each(function (index) {
|
||||
var file = ($.isArray(data.result) &&
|
||||
data.result[index]) || {error: 'emptyResult'};
|
||||
if (file.error) {
|
||||
that._adjustMaxNumberOfFiles(1);
|
||||
}
|
||||
that._transition($(this)).done(
|
||||
function () {
|
||||
var node = $(this);
|
||||
template = that._renderDownload([file])
|
||||
.replaceAll(node);
|
||||
that._forceReflow(template);
|
||||
that._transition(template).done(
|
||||
function () {
|
||||
data.context = $(this);
|
||||
that._trigger('completed', e, data);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
} else {
|
||||
if ($.isArray(data.result)) {
|
||||
$.each(data.result, function (index, file) {
|
||||
if (data.maxNumberOfFilesAdjusted && file.error) {
|
||||
that._adjustMaxNumberOfFiles(1);
|
||||
} else if (!data.maxNumberOfFilesAdjusted &&
|
||||
!file.error) {
|
||||
that._adjustMaxNumberOfFiles(-1);
|
||||
}
|
||||
});
|
||||
data.maxNumberOfFilesAdjusted = true;
|
||||
}
|
||||
template = that._renderDownload(data.result)
|
||||
.appendTo(that.options.filesContainer);
|
||||
that._forceReflow(template);
|
||||
that._transition(template).done(
|
||||
function () {
|
||||
data.context = $(this);
|
||||
that._trigger('completed', e, data);
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
// Callback for failed (abort or error) uploads:
|
||||
fail: function (e, data) {
|
||||
var that = $(this).data('fileupload'),
|
||||
template;
|
||||
if (data.maxNumberOfFilesAdjusted) {
|
||||
that._adjustMaxNumberOfFiles(data.files.length);
|
||||
}
|
||||
if (data.context) {
|
||||
data.context.each(function (index) {
|
||||
if (data.errorThrown !== 'abort') {
|
||||
var file = data.files[index];
|
||||
file.error = file.error || data.errorThrown ||
|
||||
true;
|
||||
that._transition($(this)).done(
|
||||
function () {
|
||||
var node = $(this);
|
||||
template = that._renderDownload([file])
|
||||
.replaceAll(node);
|
||||
that._forceReflow(template);
|
||||
that._transition(template).done(
|
||||
function () {
|
||||
data.context = $(this);
|
||||
that._trigger('failed', e, data);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
that._transition($(this)).done(
|
||||
function () {
|
||||
$(this).remove();
|
||||
that._trigger('failed', e, data);
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
} else if (data.errorThrown !== 'abort') {
|
||||
data.context = that._renderUpload(data.files)
|
||||
.appendTo(that.options.filesContainer)
|
||||
.data('data', data);
|
||||
that._forceReflow(data.context);
|
||||
that._transition(data.context).done(
|
||||
function () {
|
||||
data.context = $(this);
|
||||
that._trigger('failed', e, data);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
that._trigger('failed', e, data);
|
||||
}
|
||||
},
|
||||
// Callback for upload progress events:
|
||||
progress: function (e, data) {
|
||||
if (data.context) {
|
||||
var progress = parseInt(data.loaded / data.total * 100, 10);
|
||||
data.context.find('.progress')
|
||||
.attr('aria-valuenow', progress)
|
||||
.find('.bar').css(
|
||||
'width',
|
||||
progress + '%'
|
||||
);
|
||||
}
|
||||
},
|
||||
// Callback for global upload progress events:
|
||||
progressall: function (e, data) {
|
||||
var $this = $(this),
|
||||
progress = parseInt(data.loaded / data.total * 100, 10),
|
||||
globalProgressNode = $this.find('.fileupload-progress'),
|
||||
extendedProgressNode = globalProgressNode
|
||||
.find('.progress-extended');
|
||||
if (extendedProgressNode.length) {
|
||||
extendedProgressNode.html(
|
||||
$this.data('fileupload')._renderExtendedProgress(data)
|
||||
);
|
||||
}
|
||||
globalProgressNode
|
||||
.find('.progress')
|
||||
.attr('aria-valuenow', progress)
|
||||
.find('.bar').css(
|
||||
'width',
|
||||
progress + '%'
|
||||
);
|
||||
},
|
||||
// Callback for uploads start, equivalent to the global ajaxStart event:
|
||||
start: function (e) {
|
||||
var that = $(this).data('fileupload');
|
||||
that._transition($(this).find('.fileupload-progress')).done(
|
||||
function () {
|
||||
that._trigger('started', e);
|
||||
}
|
||||
);
|
||||
},
|
||||
// Callback for uploads stop, equivalent to the global ajaxStop event:
|
||||
stop: function (e) {
|
||||
var that = $(this).data('fileupload');
|
||||
that._transition($(this).find('.fileupload-progress')).done(
|
||||
function () {
|
||||
$(this).find('.progress')
|
||||
.attr('aria-valuenow', '0')
|
||||
.find('.bar').css('width', '0%');
|
||||
$(this).find('.progress-extended').html(' ');
|
||||
that._trigger('stopped', e);
|
||||
}
|
||||
);
|
||||
},
|
||||
// Callback for file deletion:
|
||||
destroy: function (e, data) {
|
||||
var that = $(this).data('fileupload');
|
||||
if (data.url) {
|
||||
$.ajax(data);
|
||||
that._adjustMaxNumberOfFiles(1);
|
||||
}
|
||||
that._transition(data.context).done(
|
||||
function () {
|
||||
$(this).remove();
|
||||
that._trigger('destroyed', e, data);
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
// Link handler, that allows to download files
|
||||
// by drag & drop of the links to the desktop:
|
||||
_enableDragToDesktop: function () {
|
||||
var link = $(this),
|
||||
url = link.prop('href'),
|
||||
name = link.prop('download'),
|
||||
type = 'application/octet-stream';
|
||||
link.bind('dragstart', function (e) {
|
||||
try {
|
||||
e.originalEvent.dataTransfer.setData(
|
||||
'DownloadURL',
|
||||
[type, name, url].join(':')
|
||||
);
|
||||
} catch (err) {}
|
||||
});
|
||||
},
|
||||
|
||||
_adjustMaxNumberOfFiles: function (operand) {
|
||||
if (typeof this.options.maxNumberOfFiles === 'number') {
|
||||
this.options.maxNumberOfFiles += operand;
|
||||
if (this.options.maxNumberOfFiles < 1) {
|
||||
this._disableFileInputButton();
|
||||
} else {
|
||||
this._enableFileInputButton();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_formatFileSize: function (bytes) {
|
||||
if (typeof bytes !== 'number') {
|
||||
return '';
|
||||
}
|
||||
if (bytes >= 1000000000) {
|
||||
return (bytes / 1000000000).toFixed(2) + ' GB';
|
||||
}
|
||||
if (bytes >= 1000000) {
|
||||
return (bytes / 1000000).toFixed(2) + ' MB';
|
||||
}
|
||||
return (bytes / 1000).toFixed(2) + ' KB';
|
||||
},
|
||||
|
||||
_formatBitrate: function (bits) {
|
||||
if (typeof bits !== 'number') {
|
||||
return '';
|
||||
}
|
||||
if (bits >= 1000000000) {
|
||||
return (bits / 1000000000).toFixed(2) + ' Gbit/s';
|
||||
}
|
||||
if (bits >= 1000000) {
|
||||
return (bits / 1000000).toFixed(2) + ' Mbit/s';
|
||||
}
|
||||
if (bits >= 1000) {
|
||||
return (bits / 1000).toFixed(2) + ' kbit/s';
|
||||
}
|
||||
return bits + ' bit/s';
|
||||
},
|
||||
|
||||
_formatTime: function (seconds) {
|
||||
var date = new Date(seconds * 1000),
|
||||
days = parseInt(seconds / 86400, 10);
|
||||
days = days ? days + 'd ' : '';
|
||||
return days +
|
||||
('0' + date.getUTCHours()).slice(-2) + ':' +
|
||||
('0' + date.getUTCMinutes()).slice(-2) + ':' +
|
||||
('0' + date.getUTCSeconds()).slice(-2);
|
||||
},
|
||||
|
||||
_formatPercentage: function (floatValue) {
|
||||
return (floatValue * 100).toFixed(2) + ' %';
|
||||
},
|
||||
|
||||
_renderExtendedProgress: function (data) {
|
||||
return this._formatBitrate(data.bitrate) + ' | ' +
|
||||
this._formatTime(
|
||||
(data.total - data.loaded) * 8 / data.bitrate
|
||||
) + ' | ' +
|
||||
this._formatPercentage(
|
||||
data.loaded / data.total
|
||||
) + ' | ' +
|
||||
this._formatFileSize(data.loaded) + ' / ' +
|
||||
this._formatFileSize(data.total);
|
||||
},
|
||||
|
||||
_hasError: function (file) {
|
||||
if (file.error) {
|
||||
return file.error;
|
||||
}
|
||||
// The number of added files is subtracted from
|
||||
// maxNumberOfFiles before validation, so we check if
|
||||
// maxNumberOfFiles is below 0 (instead of below 1):
|
||||
if (this.options.maxNumberOfFiles < 0) {
|
||||
return 'maxNumberOfFiles';
|
||||
}
|
||||
// Files are accepted if either the file type or the file name
|
||||
// matches against the acceptFileTypes regular expression, as
|
||||
// only browsers with support for the File API report the type:
|
||||
if (!(this.options.acceptFileTypes.test(file.type) ||
|
||||
this.options.acceptFileTypes.test(file.name))) {
|
||||
return 'acceptFileTypes';
|
||||
}
|
||||
if (this.options.maxFileSize &&
|
||||
file.size > this.options.maxFileSize) {
|
||||
return 'maxFileSize';
|
||||
}
|
||||
if (typeof file.size === 'number' &&
|
||||
file.size < this.options.minFileSize) {
|
||||
return 'minFileSize';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
_validate: function (files) {
|
||||
var that = this,
|
||||
valid = !!files.length;
|
||||
$.each(files, function (index, file) {
|
||||
file.error = that._hasError(file);
|
||||
if (file.error) {
|
||||
valid = false;
|
||||
}
|
||||
});
|
||||
return valid;
|
||||
},
|
||||
|
||||
_renderTemplate: function (func, files) {
|
||||
if (!func) {
|
||||
return $();
|
||||
}
|
||||
var result = func({
|
||||
files: files,
|
||||
formatFileSize: this._formatFileSize,
|
||||
options: this.options
|
||||
});
|
||||
if (result instanceof $) {
|
||||
return result;
|
||||
}
|
||||
return $(this.options.templatesContainer).html(result).children();
|
||||
},
|
||||
|
||||
_renderPreview: function (file, node) {
|
||||
var that = this,
|
||||
options = this.options,
|
||||
dfd = $.Deferred();
|
||||
return ((loadImage && loadImage(
|
||||
file,
|
||||
function (img) {
|
||||
node.append(img);
|
||||
that._forceReflow(node);
|
||||
that._transition(node).done(function () {
|
||||
dfd.resolveWith(node);
|
||||
});
|
||||
if (!$.contains(document.body, node[0])) {
|
||||
// If the element is not part of the DOM,
|
||||
// transition events are not triggered,
|
||||
// so we have to resolve manually:
|
||||
dfd.resolveWith(node);
|
||||
}
|
||||
},
|
||||
{
|
||||
maxWidth: options.previewMaxWidth,
|
||||
maxHeight: options.previewMaxHeight,
|
||||
canvas: options.previewAsCanvas
|
||||
}
|
||||
)) || dfd.resolveWith(node)) && dfd;
|
||||
},
|
||||
|
||||
_renderPreviews: function (files, nodes) {
|
||||
var that = this,
|
||||
options = this.options;
|
||||
nodes.find('.preview span').each(function (index, element) {
|
||||
var file = files[index];
|
||||
if (options.previewSourceFileTypes.test(file.type) &&
|
||||
($.type(options.previewSourceMaxFileSize) !== 'number' ||
|
||||
file.size < options.previewSourceMaxFileSize)) {
|
||||
that._processingQueue = that._processingQueue.pipe(function () {
|
||||
var dfd = $.Deferred();
|
||||
that._renderPreview(file, $(element)).done(
|
||||
function () {
|
||||
dfd.resolveWith(that);
|
||||
}
|
||||
);
|
||||
return dfd.promise();
|
||||
});
|
||||
}
|
||||
});
|
||||
return this._processingQueue;
|
||||
},
|
||||
|
||||
_renderUpload: function (files) {
|
||||
return this._renderTemplate(
|
||||
this.options.uploadTemplate,
|
||||
files
|
||||
);
|
||||
},
|
||||
|
||||
_renderDownload: function (files) {
|
||||
return this._renderTemplate(
|
||||
this.options.downloadTemplate,
|
||||
files
|
||||
).find('a[download]').each(this._enableDragToDesktop).end();
|
||||
},
|
||||
|
||||
_startHandler: function (e) {
|
||||
e.preventDefault();
|
||||
var button = $(this),
|
||||
template = button.closest('.template-upload'),
|
||||
data = template.data('data');
|
||||
if (data && data.submit && !data.jqXHR && data.submit()) {
|
||||
button.prop('disabled', true);
|
||||
}
|
||||
},
|
||||
|
||||
_cancelHandler: function (e) {
|
||||
e.preventDefault();
|
||||
var template = $(this).closest('.template-upload'),
|
||||
data = template.data('data') || {};
|
||||
if (!data.jqXHR) {
|
||||
data.errorThrown = 'abort';
|
||||
e.data.fileupload._trigger('fail', e, data);
|
||||
} else {
|
||||
data.jqXHR.abort();
|
||||
}
|
||||
},
|
||||
|
||||
_deleteHandler: function (e) {
|
||||
e.preventDefault();
|
||||
var button = $(this);
|
||||
e.data.fileupload._trigger('destroy', e, {
|
||||
context: button.closest('.template-download'),
|
||||
url: button.attr('data-url'),
|
||||
type: button.attr('data-type') || 'DELETE',
|
||||
dataType: e.data.fileupload.options.dataType
|
||||
});
|
||||
},
|
||||
|
||||
_forceReflow: function (node) {
|
||||
return $.support.transition && node.length &&
|
||||
node[0].offsetWidth;
|
||||
},
|
||||
|
||||
_transition: function (node) {
|
||||
var dfd = $.Deferred();
|
||||
if ($.support.transition && node.hasClass('fade')) {
|
||||
node.bind(
|
||||
$.support.transition.end,
|
||||
function (e) {
|
||||
// Make sure we don't respond to other transitions events
|
||||
// in the container element, e.g. from button elements:
|
||||
if (e.target === node[0]) {
|
||||
node.unbind($.support.transition.end);
|
||||
dfd.resolveWith(node);
|
||||
}
|
||||
}
|
||||
).toggleClass('in');
|
||||
} else {
|
||||
node.toggleClass('in');
|
||||
dfd.resolveWith(node);
|
||||
}
|
||||
return dfd;
|
||||
},
|
||||
|
||||
_initButtonBarEventHandlers: function () {
|
||||
var fileUploadButtonBar = this.element.find('.fileupload-buttonbar'),
|
||||
filesList = this.options.filesContainer,
|
||||
ns = this.options.namespace;
|
||||
fileUploadButtonBar.find('.start')
|
||||
.bind('click.' + ns, function (e) {
|
||||
e.preventDefault();
|
||||
filesList.find('.start button').click();
|
||||
});
|
||||
fileUploadButtonBar.find('.cancel')
|
||||
.bind('click.' + ns, function (e) {
|
||||
e.preventDefault();
|
||||
filesList.find('.cancel button').click();
|
||||
});
|
||||
fileUploadButtonBar.find('.delete')
|
||||
.bind('click.' + ns, function (e) {
|
||||
e.preventDefault();
|
||||
filesList.find('.delete input:checked')
|
||||
.siblings('button').click();
|
||||
fileUploadButtonBar.find('.toggle')
|
||||
.prop('checked', false);
|
||||
});
|
||||
fileUploadButtonBar.find('.toggle')
|
||||
.bind('change.' + ns, function (e) {
|
||||
filesList.find('.delete input').prop(
|
||||
'checked',
|
||||
$(this).is(':checked')
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
_destroyButtonBarEventHandlers: function () {
|
||||
this.element.find('.fileupload-buttonbar button')
|
||||
.unbind('click.' + this.options.namespace);
|
||||
this.element.find('.fileupload-buttonbar .toggle')
|
||||
.unbind('change.' + this.options.namespace);
|
||||
},
|
||||
|
||||
_initEventHandlers: function () {
|
||||
parentWidget.prototype._initEventHandlers.call(this);
|
||||
var eventData = {fileupload: this};
|
||||
this.options.filesContainer
|
||||
.delegate(
|
||||
'.start button',
|
||||
'click.' + this.options.namespace,
|
||||
eventData,
|
||||
this._startHandler
|
||||
)
|
||||
.delegate(
|
||||
'.cancel button',
|
||||
'click.' + this.options.namespace,
|
||||
eventData,
|
||||
this._cancelHandler
|
||||
)
|
||||
.delegate(
|
||||
'.delete button',
|
||||
'click.' + this.options.namespace,
|
||||
eventData,
|
||||
this._deleteHandler
|
||||
);
|
||||
this._initButtonBarEventHandlers();
|
||||
},
|
||||
|
||||
_destroyEventHandlers: function () {
|
||||
var options = this.options;
|
||||
this._destroyButtonBarEventHandlers();
|
||||
options.filesContainer
|
||||
.undelegate('.start button', 'click.' + options.namespace)
|
||||
.undelegate('.cancel button', 'click.' + options.namespace)
|
||||
.undelegate('.delete button', 'click.' + options.namespace);
|
||||
parentWidget.prototype._destroyEventHandlers.call(this);
|
||||
},
|
||||
|
||||
_enableFileInputButton: function () {
|
||||
this.element.find('.fileinput-button input')
|
||||
.prop('disabled', false)
|
||||
.parent().removeClass('disabled');
|
||||
},
|
||||
|
||||
_disableFileInputButton: function () {
|
||||
this.element.find('.fileinput-button input')
|
||||
.prop('disabled', true)
|
||||
.parent().addClass('disabled');
|
||||
},
|
||||
|
||||
_initTemplates: function () {
|
||||
var options = this.options;
|
||||
options.templatesContainer = document.createElement(
|
||||
options.filesContainer.prop('nodeName')
|
||||
);
|
||||
if (tmpl) {
|
||||
if (options.uploadTemplateId) {
|
||||
options.uploadTemplate = tmpl(options.uploadTemplateId);
|
||||
}
|
||||
if (options.downloadTemplateId) {
|
||||
options.downloadTemplate = tmpl(options.downloadTemplateId);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_initFilesContainer: function () {
|
||||
var options = this.options;
|
||||
if (options.filesContainer === undefined) {
|
||||
options.filesContainer = this.element.find('.files');
|
||||
} else if (!(options.filesContainer instanceof $)) {
|
||||
options.filesContainer = $(options.filesContainer);
|
||||
}
|
||||
},
|
||||
|
||||
_stringToRegExp: function (str) {
|
||||
var parts = str.split('/'),
|
||||
modifiers = parts.pop();
|
||||
parts.shift();
|
||||
return new RegExp(parts.join('/'), modifiers);
|
||||
},
|
||||
|
||||
_initRegExpOptions: function () {
|
||||
var options = this.options;
|
||||
if ($.type(options.acceptFileTypes) === 'string') {
|
||||
options.acceptFileTypes = this._stringToRegExp(
|
||||
options.acceptFileTypes
|
||||
);
|
||||
}
|
||||
if ($.type(options.previewSourceFileTypes) === 'string') {
|
||||
options.previewSourceFileTypes = this._stringToRegExp(
|
||||
options.previewSourceFileTypes
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
_initSpecialOptions: function () {
|
||||
parentWidget.prototype._initSpecialOptions.call(this);
|
||||
this._initFilesContainer();
|
||||
this._initTemplates();
|
||||
this._initRegExpOptions();
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
parentWidget.prototype._create.call(this);
|
||||
this._refreshOptionsList.push(
|
||||
'filesContainer',
|
||||
'uploadTemplateId',
|
||||
'downloadTemplateId'
|
||||
);
|
||||
if (!$.blueimpFP) {
|
||||
this._processingQueue = $.Deferred().resolveWith(this).promise();
|
||||
this.process = function () {
|
||||
return this._processingQueue;
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
enable: function () {
|
||||
parentWidget.prototype.enable.call(this);
|
||||
this.element.find('input, button').prop('disabled', false);
|
||||
this._enableFileInputButton();
|
||||
},
|
||||
|
||||
disable: function () {
|
||||
this.element.find('input, button').prop('disabled', true);
|
||||
this._disableFileInputButton();
|
||||
parentWidget.prototype.disable.call(this);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
-975
@@ -1,975 +0,0 @@
|
||||
/*
|
||||
* jQuery File Upload Plugin 5.14
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint nomen: true, unparam: true, regexp: true */
|
||||
/*global define, window, document, Blob, FormData, location */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery',
|
||||
'jquery.ui.widget'
|
||||
], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
// The FileReader API is not actually used, but works as feature detection,
|
||||
// as e.g. Safari supports XHR file uploads via the FormData API,
|
||||
// but not non-multipart XHR file uploads:
|
||||
$.support.xhrFileUpload = !!(window.XMLHttpRequestUpload && window.FileReader);
|
||||
$.support.xhrFormDataFileUpload = !!window.FormData;
|
||||
|
||||
// The fileupload widget listens for change events on file input fields defined
|
||||
// via fileInput setting and paste or drop events of the given dropZone.
|
||||
// In addition to the default jQuery Widget methods, the fileupload widget
|
||||
// exposes the "add" and "send" methods, to add or directly send files using
|
||||
// the fileupload API.
|
||||
// By default, files added via file input selection, paste, drag & drop or
|
||||
// "add" method are uploaded immediately, but it is possible to override
|
||||
// the "add" callback option to queue file uploads.
|
||||
$.widget('blueimp.fileupload', {
|
||||
|
||||
options: {
|
||||
// The namespace used for event handler binding on the dropZone and
|
||||
// fileInput collections.
|
||||
// If not set, the name of the widget ("fileupload") is used.
|
||||
namespace: undefined,
|
||||
// The drop target collection, by the default the complete document.
|
||||
// Set to null or an empty collection to disable drag & drop support:
|
||||
dropZone: $(document),
|
||||
// The file input field collection, that is listened for change events.
|
||||
// If undefined, it is set to the file input fields inside
|
||||
// of the widget element on plugin initialization.
|
||||
// Set to null or an empty collection to disable the change listener.
|
||||
fileInput: undefined,
|
||||
// By default, the file input field is replaced with a clone after
|
||||
// each input field change event. This is required for iframe transport
|
||||
// queues and allows change events to be fired for the same file
|
||||
// selection, but can be disabled by setting the following option to false:
|
||||
replaceFileInput: true,
|
||||
// The parameter name for the file form data (the request argument name).
|
||||
// If undefined or empty, the name property of the file input field is
|
||||
// used, or "files[]" if the file input name property is also empty,
|
||||
// can be a string or an array of strings:
|
||||
paramName: undefined,
|
||||
// By default, each file of a selection is uploaded using an individual
|
||||
// request for XHR type uploads. Set to false to upload file
|
||||
// selections in one request each:
|
||||
singleFileUploads: true,
|
||||
// To limit the number of files uploaded with one XHR request,
|
||||
// set the following option to an integer greater than 0:
|
||||
limitMultiFileUploads: undefined,
|
||||
// Set the following option to true to issue all file upload requests
|
||||
// in a sequential order:
|
||||
sequentialUploads: false,
|
||||
// To limit the number of concurrent uploads,
|
||||
// set the following option to an integer greater than 0:
|
||||
limitConcurrentUploads: undefined,
|
||||
// Set the following option to true to force iframe transport uploads:
|
||||
forceIframeTransport: false,
|
||||
// Set the following option to the location of a redirect url on the
|
||||
// origin server, for cross-domain iframe transport uploads:
|
||||
redirect: undefined,
|
||||
// The parameter name for the redirect url, sent as part of the form
|
||||
// data and set to 'redirect' if this option is empty:
|
||||
redirectParamName: undefined,
|
||||
// Set the following option to the location of a postMessage window,
|
||||
// to enable postMessage transport uploads:
|
||||
postMessage: undefined,
|
||||
// By default, XHR file uploads are sent as multipart/form-data.
|
||||
// The iframe transport is always using multipart/form-data.
|
||||
// Set to false to enable non-multipart XHR uploads:
|
||||
multipart: true,
|
||||
// To upload large files in smaller chunks, set the following option
|
||||
// to a preferred maximum chunk size. If set to 0, null or undefined,
|
||||
// or the browser does not support the required Blob API, files will
|
||||
// be uploaded as a whole.
|
||||
maxChunkSize: undefined,
|
||||
// When a non-multipart upload or a chunked multipart upload has been
|
||||
// aborted, this option can be used to resume the upload by setting
|
||||
// it to the size of the already uploaded bytes. This option is most
|
||||
// useful when modifying the options object inside of the "add" or
|
||||
// "send" callbacks, as the options are cloned for each file upload.
|
||||
uploadedBytes: undefined,
|
||||
// By default, failed (abort or error) file uploads are removed from the
|
||||
// global progress calculation. Set the following option to false to
|
||||
// prevent recalculating the global progress data:
|
||||
recalculateProgress: true,
|
||||
// Interval in milliseconds to calculate and trigger progress events:
|
||||
progressInterval: 100,
|
||||
// Interval in milliseconds to calculate progress bitrate:
|
||||
bitrateInterval: 500,
|
||||
|
||||
// Additional form data to be sent along with the file uploads can be set
|
||||
// using this option, which accepts an array of objects with name and
|
||||
// value properties, a function returning such an array, a FormData
|
||||
// object (for XHR file uploads), or a simple object.
|
||||
// The form of the first fileInput is given as parameter to the function:
|
||||
formData: function (form) {
|
||||
return form.serializeArray();
|
||||
},
|
||||
|
||||
// The add callback is invoked as soon as files are added to the fileupload
|
||||
// widget (via file input selection, drag & drop, paste or add API call).
|
||||
// If the singleFileUploads option is enabled, this callback will be
|
||||
// called once for each file in the selection for XHR file uplaods, else
|
||||
// once for each file selection.
|
||||
// The upload starts when the submit method is invoked on the data parameter.
|
||||
// The data object contains a files property holding the added files
|
||||
// and allows to override plugin options as well as define ajax settings.
|
||||
// Listeners for this callback can also be bound the following way:
|
||||
// .bind('fileuploadadd', func);
|
||||
// data.submit() returns a Promise object and allows to attach additional
|
||||
// handlers using jQuery's Deferred callbacks:
|
||||
// data.submit().done(func).fail(func).always(func);
|
||||
add: function (e, data) {
|
||||
data.submit();
|
||||
},
|
||||
|
||||
// Other callbacks:
|
||||
// Callback for the submit event of each file upload:
|
||||
// submit: function (e, data) {}, // .bind('fileuploadsubmit', func);
|
||||
// Callback for the start of each file upload request:
|
||||
// send: function (e, data) {}, // .bind('fileuploadsend', func);
|
||||
// Callback for successful uploads:
|
||||
// done: function (e, data) {}, // .bind('fileuploaddone', func);
|
||||
// Callback for failed (abort or error) uploads:
|
||||
// fail: function (e, data) {}, // .bind('fileuploadfail', func);
|
||||
// Callback for completed (success, abort or error) requests:
|
||||
// always: function (e, data) {}, // .bind('fileuploadalways', func);
|
||||
// Callback for upload progress events:
|
||||
// progress: function (e, data) {}, // .bind('fileuploadprogress', func);
|
||||
// Callback for global upload progress events:
|
||||
// progressall: function (e, data) {}, // .bind('fileuploadprogressall', func);
|
||||
// Callback for uploads start, equivalent to the global ajaxStart event:
|
||||
// start: function (e) {}, // .bind('fileuploadstart', func);
|
||||
// Callback for uploads stop, equivalent to the global ajaxStop event:
|
||||
// stop: function (e) {}, // .bind('fileuploadstop', func);
|
||||
// Callback for change events of the fileInput collection:
|
||||
// change: function (e, data) {}, // .bind('fileuploadchange', func);
|
||||
// Callback for paste events to the dropZone collection:
|
||||
// paste: function (e, data) {}, // .bind('fileuploadpaste', func);
|
||||
// Callback for drop events of the dropZone collection:
|
||||
// drop: function (e, data) {}, // .bind('fileuploaddrop', func);
|
||||
// Callback for dragover events of the dropZone collection:
|
||||
// dragover: function (e) {}, // .bind('fileuploaddragover', func);
|
||||
|
||||
// The plugin options are used as settings object for the ajax calls.
|
||||
// The following are jQuery ajax settings required for the file uploads:
|
||||
processData: false,
|
||||
contentType: false,
|
||||
cache: false
|
||||
},
|
||||
|
||||
// A list of options that require a refresh after assigning a new value:
|
||||
_refreshOptionsList: [
|
||||
'namespace',
|
||||
'dropZone',
|
||||
'fileInput',
|
||||
'multipart',
|
||||
'forceIframeTransport'
|
||||
],
|
||||
|
||||
_BitrateTimer: function () {
|
||||
this.timestamp = +(new Date());
|
||||
this.loaded = 0;
|
||||
this.bitrate = 0;
|
||||
this.getBitrate = function (now, loaded, interval) {
|
||||
var timeDiff = now - this.timestamp;
|
||||
if (!this.bitrate || !interval || timeDiff > interval) {
|
||||
this.bitrate = (loaded - this.loaded) * (1000 / timeDiff) * 8;
|
||||
this.loaded = loaded;
|
||||
this.timestamp = now;
|
||||
}
|
||||
return this.bitrate;
|
||||
};
|
||||
},
|
||||
|
||||
_isXHRUpload: function (options) {
|
||||
return !options.forceIframeTransport &&
|
||||
((!options.multipart && $.support.xhrFileUpload) ||
|
||||
$.support.xhrFormDataFileUpload);
|
||||
},
|
||||
|
||||
_getFormData: function (options) {
|
||||
var formData;
|
||||
if (typeof options.formData === 'function') {
|
||||
return options.formData(options.form);
|
||||
}
|
||||
if ($.isArray(options.formData)) {
|
||||
return options.formData;
|
||||
}
|
||||
if (options.formData) {
|
||||
formData = [];
|
||||
$.each(options.formData, function (name, value) {
|
||||
formData.push({name: name, value: value});
|
||||
});
|
||||
return formData;
|
||||
}
|
||||
return [];
|
||||
},
|
||||
|
||||
_getTotal: function (files) {
|
||||
var total = 0;
|
||||
$.each(files, function (index, file) {
|
||||
total += file.size || 1;
|
||||
});
|
||||
return total;
|
||||
},
|
||||
|
||||
_onProgress: function (e, data) {
|
||||
if (e.lengthComputable) {
|
||||
var now = +(new Date()),
|
||||
total,
|
||||
loaded;
|
||||
if (data._time && data.progressInterval &&
|
||||
(now - data._time < data.progressInterval) &&
|
||||
e.loaded !== e.total) {
|
||||
return;
|
||||
}
|
||||
data._time = now;
|
||||
total = data.total || this._getTotal(data.files);
|
||||
loaded = parseInt(
|
||||
e.loaded / e.total * (data.chunkSize || total),
|
||||
10
|
||||
) + (data.uploadedBytes || 0);
|
||||
this._loaded += loaded - (data.loaded || data.uploadedBytes || 0);
|
||||
data.lengthComputable = true;
|
||||
data.loaded = loaded;
|
||||
data.total = total;
|
||||
data.bitrate = data._bitrateTimer.getBitrate(
|
||||
now,
|
||||
loaded,
|
||||
data.bitrateInterval
|
||||
);
|
||||
// Trigger a custom progress event with a total data property set
|
||||
// to the file size(s) of the current upload and a loaded data
|
||||
// property calculated accordingly:
|
||||
this._trigger('progress', e, data);
|
||||
// Trigger a global progress event for all current file uploads,
|
||||
// including ajax calls queued for sequential file uploads:
|
||||
this._trigger('progressall', e, {
|
||||
lengthComputable: true,
|
||||
loaded: this._loaded,
|
||||
total: this._total,
|
||||
bitrate: this._bitrateTimer.getBitrate(
|
||||
now,
|
||||
this._loaded,
|
||||
data.bitrateInterval
|
||||
)
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_initProgressListener: function (options) {
|
||||
var that = this,
|
||||
xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();
|
||||
// Accesss to the native XHR object is required to add event listeners
|
||||
// for the upload progress event:
|
||||
if (xhr.upload) {
|
||||
$(xhr.upload).bind('progress', function (e) {
|
||||
var oe = e.originalEvent;
|
||||
// Make sure the progress event properties get copied over:
|
||||
e.lengthComputable = oe.lengthComputable;
|
||||
e.loaded = oe.loaded;
|
||||
e.total = oe.total;
|
||||
that._onProgress(e, options);
|
||||
});
|
||||
options.xhr = function () {
|
||||
return xhr;
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
_initXHRData: function (options) {
|
||||
var formData,
|
||||
file = options.files[0],
|
||||
// Ignore non-multipart setting if not supported:
|
||||
multipart = options.multipart || !$.support.xhrFileUpload,
|
||||
paramName = options.paramName[0];
|
||||
if (!multipart || options.blob) {
|
||||
// For non-multipart uploads and chunked uploads,
|
||||
// file meta data is not part of the request body,
|
||||
// so we transmit this data as part of the HTTP headers.
|
||||
// For cross domain requests, these headers must be allowed
|
||||
// via Access-Control-Allow-Headers or removed using
|
||||
// the beforeSend callback:
|
||||
options.headers = $.extend(options.headers, {
|
||||
'X-File-Name': file.name,
|
||||
'X-File-Type': file.type,
|
||||
'X-File-Size': file.size
|
||||
});
|
||||
if (!options.blob) {
|
||||
// Non-chunked non-multipart upload:
|
||||
options.contentType = file.type;
|
||||
options.data = file;
|
||||
} else if (!multipart) {
|
||||
// Chunked non-multipart upload:
|
||||
options.contentType = 'application/octet-stream';
|
||||
options.data = options.blob;
|
||||
}
|
||||
}
|
||||
if (multipart && $.support.xhrFormDataFileUpload) {
|
||||
if (options.postMessage) {
|
||||
// window.postMessage does not allow sending FormData
|
||||
// objects, so we just add the File/Blob objects to
|
||||
// the formData array and let the postMessage window
|
||||
// create the FormData object out of this array:
|
||||
formData = this._getFormData(options);
|
||||
if (options.blob) {
|
||||
formData.push({
|
||||
name: paramName,
|
||||
value: options.blob
|
||||
});
|
||||
} else {
|
||||
$.each(options.files, function (index, file) {
|
||||
formData.push({
|
||||
name: options.paramName[index] || paramName,
|
||||
value: file
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (options.formData instanceof FormData) {
|
||||
formData = options.formData;
|
||||
} else {
|
||||
formData = new FormData();
|
||||
$.each(this._getFormData(options), function (index, field) {
|
||||
formData.append(field.name, field.value);
|
||||
});
|
||||
}
|
||||
if (options.blob) {
|
||||
formData.append(paramName, options.blob, file.name);
|
||||
} else {
|
||||
$.each(options.files, function (index, file) {
|
||||
// File objects are also Blob instances.
|
||||
// This check allows the tests to run with
|
||||
// dummy objects:
|
||||
if (file instanceof Blob) {
|
||||
formData.append(
|
||||
options.paramName[index] || paramName,
|
||||
file,
|
||||
file.name
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
options.data = formData;
|
||||
}
|
||||
// Blob reference is not needed anymore, free memory:
|
||||
options.blob = null;
|
||||
},
|
||||
|
||||
_initIframeSettings: function (options) {
|
||||
// Setting the dataType to iframe enables the iframe transport:
|
||||
options.dataType = 'iframe ' + (options.dataType || '');
|
||||
// The iframe transport accepts a serialized array as form data:
|
||||
options.formData = this._getFormData(options);
|
||||
// Add redirect url to form data on cross-domain uploads:
|
||||
if (options.redirect && $('<a></a>').prop('href', options.url)
|
||||
.prop('host') !== location.host) {
|
||||
options.formData.push({
|
||||
name: options.redirectParamName || 'redirect',
|
||||
value: options.redirect
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_initDataSettings: function (options) {
|
||||
if (this._isXHRUpload(options)) {
|
||||
if (!this._chunkedUpload(options, true)) {
|
||||
if (!options.data) {
|
||||
this._initXHRData(options);
|
||||
}
|
||||
this._initProgressListener(options);
|
||||
}
|
||||
if (options.postMessage) {
|
||||
// Setting the dataType to postmessage enables the
|
||||
// postMessage transport:
|
||||
options.dataType = 'postmessage ' + (options.dataType || '');
|
||||
}
|
||||
} else {
|
||||
this._initIframeSettings(options, 'iframe');
|
||||
}
|
||||
},
|
||||
|
||||
_getParamName: function (options) {
|
||||
var fileInput = $(options.fileInput),
|
||||
paramName = options.paramName;
|
||||
if (!paramName) {
|
||||
paramName = [];
|
||||
fileInput.each(function () {
|
||||
var input = $(this),
|
||||
name = input.prop('name') || 'files[]',
|
||||
i = (input.prop('files') || [1]).length;
|
||||
while (i) {
|
||||
paramName.push(name);
|
||||
i -= 1;
|
||||
}
|
||||
});
|
||||
if (!paramName.length) {
|
||||
paramName = [fileInput.prop('name') || 'files[]'];
|
||||
}
|
||||
} else if (!$.isArray(paramName)) {
|
||||
paramName = [paramName];
|
||||
}
|
||||
return paramName;
|
||||
},
|
||||
|
||||
_initFormSettings: function (options) {
|
||||
// Retrieve missing options from the input field and the
|
||||
// associated form, if available:
|
||||
if (!options.form || !options.form.length) {
|
||||
options.form = $(options.fileInput.prop('form'));
|
||||
}
|
||||
options.paramName = this._getParamName(options);
|
||||
if (!options.url) {
|
||||
options.url = options.form.prop('action') || location.href;
|
||||
}
|
||||
// The HTTP request method must be "POST" or "PUT":
|
||||
options.type = (options.type || options.form.prop('method') || '')
|
||||
.toUpperCase();
|
||||
if (options.type !== 'POST' && options.type !== 'PUT') {
|
||||
options.type = 'POST';
|
||||
}
|
||||
if (!options.formAcceptCharset) {
|
||||
options.formAcceptCharset = options.form.attr('accept-charset');
|
||||
}
|
||||
},
|
||||
|
||||
_getAJAXSettings: function (data) {
|
||||
var options = $.extend({}, this.options, data);
|
||||
this._initFormSettings(options);
|
||||
this._initDataSettings(options);
|
||||
return options;
|
||||
},
|
||||
|
||||
// Maps jqXHR callbacks to the equivalent
|
||||
// methods of the given Promise object:
|
||||
_enhancePromise: function (promise) {
|
||||
promise.success = promise.done;
|
||||
promise.error = promise.fail;
|
||||
promise.complete = promise.always;
|
||||
return promise;
|
||||
},
|
||||
|
||||
// Creates and returns a Promise object enhanced with
|
||||
// the jqXHR methods abort, success, error and complete:
|
||||
_getXHRPromise: function (resolveOrReject, context, args) {
|
||||
var dfd = $.Deferred(),
|
||||
promise = dfd.promise();
|
||||
context = context || this.options.context || promise;
|
||||
if (resolveOrReject === true) {
|
||||
dfd.resolveWith(context, args);
|
||||
} else if (resolveOrReject === false) {
|
||||
dfd.rejectWith(context, args);
|
||||
}
|
||||
promise.abort = dfd.promise;
|
||||
return this._enhancePromise(promise);
|
||||
},
|
||||
|
||||
// Uploads a file in multiple, sequential requests
|
||||
// by splitting the file up in multiple blob chunks.
|
||||
// If the second parameter is true, only tests if the file
|
||||
// should be uploaded in chunks, but does not invoke any
|
||||
// upload requests:
|
||||
_chunkedUpload: function (options, testOnly) {
|
||||
var that = this,
|
||||
file = options.files[0],
|
||||
fs = file.size,
|
||||
ub = options.uploadedBytes = options.uploadedBytes || 0,
|
||||
mcs = options.maxChunkSize || fs,
|
||||
// Use the Blob methods with the slice implementation
|
||||
// according to the W3C Blob API specification:
|
||||
slice = file.webkitSlice || file.mozSlice || file.slice,
|
||||
upload,
|
||||
n,
|
||||
jqXHR,
|
||||
pipe;
|
||||
if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) ||
|
||||
options.data) {
|
||||
return false;
|
||||
}
|
||||
if (testOnly) {
|
||||
return true;
|
||||
}
|
||||
if (ub >= fs) {
|
||||
file.error = 'uploadedBytes';
|
||||
return this._getXHRPromise(
|
||||
false,
|
||||
options.context,
|
||||
[null, 'error', file.error]
|
||||
);
|
||||
}
|
||||
// n is the number of blobs to upload,
|
||||
// calculated via filesize, uploaded bytes and max chunk size:
|
||||
n = Math.ceil((fs - ub) / mcs);
|
||||
// The chunk upload method accepting the chunk number as parameter:
|
||||
upload = function (i) {
|
||||
if (!i) {
|
||||
return that._getXHRPromise(true, options.context);
|
||||
}
|
||||
// Upload the blobs in sequential order:
|
||||
return upload(i -= 1).pipe(function () {
|
||||
// Clone the options object for each chunk upload:
|
||||
var o = $.extend({}, options);
|
||||
o.blob = slice.call(
|
||||
file,
|
||||
ub + i * mcs,
|
||||
ub + (i + 1) * mcs
|
||||
);
|
||||
// Expose the chunk index:
|
||||
o.chunkIndex = i;
|
||||
// Expose the number of chunks:
|
||||
o.chunksNumber = n;
|
||||
// Store the current chunk size, as the blob itself
|
||||
// will be dereferenced after data processing:
|
||||
o.chunkSize = o.blob.size;
|
||||
// Process the upload data (the blob and potential form data):
|
||||
that._initXHRData(o);
|
||||
// Add progress listeners for this chunk upload:
|
||||
that._initProgressListener(o);
|
||||
jqXHR = ($.ajax(o) || that._getXHRPromise(false, o.context))
|
||||
.done(function () {
|
||||
// Create a progress event if upload is done and
|
||||
// no progress event has been invoked for this chunk:
|
||||
if (!o.loaded) {
|
||||
that._onProgress($.Event('progress', {
|
||||
lengthComputable: true,
|
||||
loaded: o.chunkSize,
|
||||
total: o.chunkSize
|
||||
}), o);
|
||||
}
|
||||
options.uploadedBytes = o.uploadedBytes +=
|
||||
o.chunkSize;
|
||||
});
|
||||
return jqXHR;
|
||||
});
|
||||
};
|
||||
// Return the piped Promise object, enhanced with an abort method,
|
||||
// which is delegated to the jqXHR object of the current upload,
|
||||
// and jqXHR callbacks mapped to the equivalent Promise methods:
|
||||
pipe = upload(n);
|
||||
pipe.abort = function () {
|
||||
return jqXHR.abort();
|
||||
};
|
||||
return this._enhancePromise(pipe);
|
||||
},
|
||||
|
||||
_beforeSend: function (e, data) {
|
||||
if (this._active === 0) {
|
||||
// the start callback is triggered when an upload starts
|
||||
// and no other uploads are currently running,
|
||||
// equivalent to the global ajaxStart event:
|
||||
this._trigger('start');
|
||||
// Set timer for global bitrate progress calculation:
|
||||
this._bitrateTimer = new this._BitrateTimer();
|
||||
}
|
||||
this._active += 1;
|
||||
// Initialize the global progress values:
|
||||
this._loaded += data.uploadedBytes || 0;
|
||||
this._total += this._getTotal(data.files);
|
||||
},
|
||||
|
||||
_onDone: function (result, textStatus, jqXHR, options) {
|
||||
if (!this._isXHRUpload(options)) {
|
||||
// Create a progress event for each iframe load:
|
||||
this._onProgress($.Event('progress', {
|
||||
lengthComputable: true,
|
||||
loaded: 1,
|
||||
total: 1
|
||||
}), options);
|
||||
}
|
||||
options.result = result;
|
||||
options.textStatus = textStatus;
|
||||
options.jqXHR = jqXHR;
|
||||
this._trigger('done', null, options);
|
||||
},
|
||||
|
||||
_onFail: function (jqXHR, textStatus, errorThrown, options) {
|
||||
options.jqXHR = jqXHR;
|
||||
options.textStatus = textStatus;
|
||||
options.errorThrown = errorThrown;
|
||||
this._trigger('fail', null, options);
|
||||
if (options.recalculateProgress) {
|
||||
// Remove the failed (error or abort) file upload from
|
||||
// the global progress calculation:
|
||||
this._loaded -= options.loaded || options.uploadedBytes || 0;
|
||||
this._total -= options.total || this._getTotal(options.files);
|
||||
}
|
||||
},
|
||||
|
||||
_onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) {
|
||||
this._active -= 1;
|
||||
options.textStatus = textStatus;
|
||||
if (jqXHRorError && jqXHRorError.always) {
|
||||
options.jqXHR = jqXHRorError;
|
||||
options.result = jqXHRorResult;
|
||||
} else {
|
||||
options.jqXHR = jqXHRorResult;
|
||||
options.errorThrown = jqXHRorError;
|
||||
}
|
||||
this._trigger('always', null, options);
|
||||
if (this._active === 0) {
|
||||
// The stop callback is triggered when all uploads have
|
||||
// been completed, equivalent to the global ajaxStop event:
|
||||
this._trigger('stop');
|
||||
// Reset the global progress values:
|
||||
this._loaded = this._total = 0;
|
||||
this._bitrateTimer = null;
|
||||
}
|
||||
},
|
||||
|
||||
_onSend: function (e, data) {
|
||||
var that = this,
|
||||
jqXHR,
|
||||
slot,
|
||||
pipe,
|
||||
options = that._getAJAXSettings(data),
|
||||
send = function (resolve, args) {
|
||||
that._sending += 1;
|
||||
// Set timer for bitrate progress calculation:
|
||||
options._bitrateTimer = new that._BitrateTimer();
|
||||
jqXHR = jqXHR || (
|
||||
(resolve !== false &&
|
||||
that._trigger('send', e, options) !== false &&
|
||||
(that._chunkedUpload(options) || $.ajax(options))) ||
|
||||
that._getXHRPromise(false, options.context, args)
|
||||
).done(function (result, textStatus, jqXHR) {
|
||||
that._onDone(result, textStatus, jqXHR, options);
|
||||
}).fail(function (jqXHR, textStatus, errorThrown) {
|
||||
that._onFail(jqXHR, textStatus, errorThrown, options);
|
||||
}).always(function (jqXHRorResult, textStatus, jqXHRorError) {
|
||||
that._sending -= 1;
|
||||
that._onAlways(
|
||||
jqXHRorResult,
|
||||
textStatus,
|
||||
jqXHRorError,
|
||||
options
|
||||
);
|
||||
if (options.limitConcurrentUploads &&
|
||||
options.limitConcurrentUploads > that._sending) {
|
||||
// Start the next queued upload,
|
||||
// that has not been aborted:
|
||||
var nextSlot = that._slots.shift();
|
||||
while (nextSlot) {
|
||||
if (!nextSlot.isRejected()) {
|
||||
nextSlot.resolve();
|
||||
break;
|
||||
}
|
||||
nextSlot = that._slots.shift();
|
||||
}
|
||||
}
|
||||
});
|
||||
return jqXHR;
|
||||
};
|
||||
this._beforeSend(e, options);
|
||||
if (this.options.sequentialUploads ||
|
||||
(this.options.limitConcurrentUploads &&
|
||||
this.options.limitConcurrentUploads <= this._sending)) {
|
||||
if (this.options.limitConcurrentUploads > 1) {
|
||||
slot = $.Deferred();
|
||||
this._slots.push(slot);
|
||||
pipe = slot.pipe(send);
|
||||
} else {
|
||||
pipe = (this._sequence = this._sequence.pipe(send, send));
|
||||
}
|
||||
// Return the piped Promise object, enhanced with an abort method,
|
||||
// which is delegated to the jqXHR object of the current upload,
|
||||
// and jqXHR callbacks mapped to the equivalent Promise methods:
|
||||
pipe.abort = function () {
|
||||
var args = [undefined, 'abort', 'abort'];
|
||||
if (!jqXHR) {
|
||||
if (slot) {
|
||||
slot.rejectWith(args);
|
||||
}
|
||||
return send(false, args);
|
||||
}
|
||||
return jqXHR.abort();
|
||||
};
|
||||
return this._enhancePromise(pipe);
|
||||
}
|
||||
return send();
|
||||
},
|
||||
|
||||
_onAdd: function (e, data) {
|
||||
var that = this,
|
||||
result = true,
|
||||
options = $.extend({}, this.options, data),
|
||||
limit = options.limitMultiFileUploads,
|
||||
paramName = this._getParamName(options),
|
||||
paramNameSet,
|
||||
paramNameSlice,
|
||||
fileSet,
|
||||
i;
|
||||
if (!(options.singleFileUploads || limit) ||
|
||||
!this._isXHRUpload(options)) {
|
||||
fileSet = [data.files];
|
||||
paramNameSet = [paramName];
|
||||
} else if (!options.singleFileUploads && limit) {
|
||||
fileSet = [];
|
||||
paramNameSet = [];
|
||||
for (i = 0; i < data.files.length; i += limit) {
|
||||
fileSet.push(data.files.slice(i, i + limit));
|
||||
paramNameSlice = paramName.slice(i, i + limit);
|
||||
if (!paramNameSlice.length) {
|
||||
paramNameSlice = paramName;
|
||||
}
|
||||
paramNameSet.push(paramNameSlice);
|
||||
}
|
||||
} else {
|
||||
paramNameSet = paramName;
|
||||
}
|
||||
data.originalFiles = data.files;
|
||||
$.each(fileSet || data.files, function (index, element) {
|
||||
var newData = $.extend({}, data);
|
||||
newData.files = fileSet ? element : [element];
|
||||
newData.paramName = paramNameSet[index];
|
||||
newData.submit = function () {
|
||||
newData.jqXHR = this.jqXHR =
|
||||
(that._trigger('submit', e, this) !== false) &&
|
||||
that._onSend(e, this);
|
||||
return this.jqXHR;
|
||||
};
|
||||
return (result = that._trigger('add', e, newData));
|
||||
});
|
||||
return result;
|
||||
},
|
||||
|
||||
// File Normalization for Gecko 1.9.1 (Firefox 3.5) support:
|
||||
_normalizeFile: function (index, file) {
|
||||
if (file.name === undefined && file.size === undefined) {
|
||||
file.name = file.fileName;
|
||||
file.size = file.fileSize;
|
||||
}
|
||||
},
|
||||
|
||||
_replaceFileInput: function (input) {
|
||||
var inputClone = input.clone(true);
|
||||
$('<form></form>').append(inputClone)[0].reset();
|
||||
// Detaching allows to insert the fileInput on another form
|
||||
// without loosing the file input value:
|
||||
input.after(inputClone).detach();
|
||||
// Avoid memory leaks with the detached file input:
|
||||
$.cleanData(input.unbind('remove'));
|
||||
// Replace the original file input element in the fileInput
|
||||
// collection with the clone, which has been copied including
|
||||
// event handlers:
|
||||
this.options.fileInput = this.options.fileInput.map(function (i, el) {
|
||||
if (el === input[0]) {
|
||||
return inputClone[0];
|
||||
}
|
||||
return el;
|
||||
});
|
||||
// If the widget has been initialized on the file input itself,
|
||||
// override this.element with the file input clone:
|
||||
if (input[0] === this.element[0]) {
|
||||
this.element = inputClone;
|
||||
}
|
||||
},
|
||||
|
||||
_getFileInputFiles: function (fileInput) {
|
||||
fileInput = $(fileInput);
|
||||
var files = $.each($.makeArray(fileInput.prop('files')), this._normalizeFile),
|
||||
value;
|
||||
if (!files.length) {
|
||||
value = fileInput.prop('value');
|
||||
if (!value) {
|
||||
return [];
|
||||
}
|
||||
// If the files property is not available, the browser does not
|
||||
// support the File API and we add a pseudo File object with
|
||||
// the input value as name with path information removed:
|
||||
files = [{name: value.replace(/^.*\\/, '')}];
|
||||
}
|
||||
return files;
|
||||
},
|
||||
|
||||
_onChange: function (e) {
|
||||
var that = e.data.fileupload,
|
||||
data = {
|
||||
fileInput: $(e.target),
|
||||
form: $(e.target.form)
|
||||
};
|
||||
data.files = that._getFileInputFiles(data.fileInput);
|
||||
if (that.options.replaceFileInput) {
|
||||
that._replaceFileInput(data.fileInput);
|
||||
}
|
||||
if (that._trigger('change', e, data) === false ||
|
||||
that._onAdd(e, data) === false) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
_onPaste: function (e) {
|
||||
var that = e.data.fileupload,
|
||||
cbd = e.originalEvent.clipboardData,
|
||||
items = (cbd && cbd.items) || [],
|
||||
data = {files: []};
|
||||
$.each(items, function (index, item) {
|
||||
var file = item.getAsFile && item.getAsFile();
|
||||
if (file) {
|
||||
data.files.push(file);
|
||||
}
|
||||
});
|
||||
if (that._trigger('paste', e, data) === false ||
|
||||
that._onAdd(e, data) === false) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
_onDrop: function (e) {
|
||||
var that = e.data.fileupload,
|
||||
dataTransfer = e.dataTransfer = e.originalEvent.dataTransfer,
|
||||
data = {
|
||||
files: $.each(
|
||||
$.makeArray(dataTransfer && dataTransfer.files),
|
||||
that._normalizeFile
|
||||
)
|
||||
};
|
||||
if (that._trigger('drop', e, data) === false ||
|
||||
that._onAdd(e, data) === false) {
|
||||
return false;
|
||||
}
|
||||
e.preventDefault();
|
||||
},
|
||||
|
||||
_onDragOver: function (e) {
|
||||
var that = e.data.fileupload,
|
||||
dataTransfer = e.dataTransfer = e.originalEvent.dataTransfer;
|
||||
if (that._trigger('dragover', e) === false) {
|
||||
return false;
|
||||
}
|
||||
if (dataTransfer) {
|
||||
dataTransfer.dropEffect = 'copy';
|
||||
}
|
||||
e.preventDefault();
|
||||
},
|
||||
|
||||
_initEventHandlers: function () {
|
||||
var ns = this.options.namespace;
|
||||
if (this._isXHRUpload(this.options)) {
|
||||
this.options.dropZone
|
||||
.bind('dragover.' + ns, {fileupload: this}, this._onDragOver)
|
||||
.bind('drop.' + ns, {fileupload: this}, this._onDrop)
|
||||
.bind('paste.' + ns, {fileupload: this}, this._onPaste);
|
||||
}
|
||||
this.options.fileInput
|
||||
.bind('change.' + ns, {fileupload: this}, this._onChange);
|
||||
},
|
||||
|
||||
_destroyEventHandlers: function () {
|
||||
var ns = this.options.namespace;
|
||||
this.options.dropZone
|
||||
.unbind('dragover.' + ns, this._onDragOver)
|
||||
.unbind('drop.' + ns, this._onDrop)
|
||||
.unbind('paste.' + ns, this._onPaste);
|
||||
this.options.fileInput
|
||||
.unbind('change.' + ns, this._onChange);
|
||||
},
|
||||
|
||||
_setOption: function (key, value) {
|
||||
var refresh = $.inArray(key, this._refreshOptionsList) !== -1;
|
||||
if (refresh) {
|
||||
this._destroyEventHandlers();
|
||||
}
|
||||
$.Widget.prototype._setOption.call(this, key, value);
|
||||
if (refresh) {
|
||||
this._initSpecialOptions();
|
||||
this._initEventHandlers();
|
||||
}
|
||||
},
|
||||
|
||||
_initSpecialOptions: function () {
|
||||
var options = this.options;
|
||||
if (options.fileInput === undefined) {
|
||||
options.fileInput = this.element.is('input:file') ?
|
||||
this.element : this.element.find('input:file');
|
||||
} else if (!(options.fileInput instanceof $)) {
|
||||
options.fileInput = $(options.fileInput);
|
||||
}
|
||||
if (!(options.dropZone instanceof $)) {
|
||||
options.dropZone = $(options.dropZone);
|
||||
}
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
var options = this.options;
|
||||
// Initialize options set via HTML5 data-attributes:
|
||||
$.extend(options, $(this.element[0].cloneNode(false)).data());
|
||||
options.namespace = options.namespace || this.widgetName;
|
||||
this._initSpecialOptions();
|
||||
this._slots = [];
|
||||
this._sequence = this._getXHRPromise(true);
|
||||
this._sending = this._active = this._loaded = this._total = 0;
|
||||
this._initEventHandlers();
|
||||
},
|
||||
|
||||
destroy: function () {
|
||||
this._destroyEventHandlers();
|
||||
$.Widget.prototype.destroy.call(this);
|
||||
},
|
||||
|
||||
enable: function () {
|
||||
$.Widget.prototype.enable.call(this);
|
||||
this._initEventHandlers();
|
||||
},
|
||||
|
||||
disable: function () {
|
||||
this._destroyEventHandlers();
|
||||
$.Widget.prototype.disable.call(this);
|
||||
},
|
||||
|
||||
// This method is exposed to the widget API and allows adding files
|
||||
// using the fileupload API. The data parameter accepts an object which
|
||||
// must have a files property and can contain additional options:
|
||||
// .fileupload('add', {files: filesList});
|
||||
add: function (data) {
|
||||
if (!data || this.options.disabled) {
|
||||
return;
|
||||
}
|
||||
if (data.fileInput && !data.files) {
|
||||
data.files = this._getFileInputFiles(data.fileInput);
|
||||
} else {
|
||||
data.files = $.each($.makeArray(data.files), this._normalizeFile);
|
||||
}
|
||||
this._onAdd(null, data);
|
||||
},
|
||||
|
||||
// This method is exposed to the widget API and allows sending files
|
||||
// using the fileupload API. The data parameter accepts an object which
|
||||
// must have a files property and can contain additional options:
|
||||
// .fileupload('send', {files: filesList});
|
||||
// The method returns a Promise object for the file upload call.
|
||||
send: function (data) {
|
||||
if (data && !this.options.disabled) {
|
||||
if (data.fileInput && !data.files) {
|
||||
data.files = this._getFileInputFiles(data.fileInput);
|
||||
} else {
|
||||
data.files = $.each($.makeArray(data.files), this._normalizeFile);
|
||||
}
|
||||
if (data.files.length) {
|
||||
return this._onSend(null, data);
|
||||
}
|
||||
}
|
||||
return this._getXHRPromise(false, data && data.context);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
-172
@@ -1,172 +0,0 @@
|
||||
/*
|
||||
* jQuery Iframe Transport Plugin 1.5
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint unparam: true, nomen: true */
|
||||
/*global define, window, document */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(['jquery'], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
// Helper variable to create unique names for the transport iframes:
|
||||
var counter = 0;
|
||||
|
||||
// The iframe transport accepts three additional options:
|
||||
// options.fileInput: a jQuery collection of file input fields
|
||||
// options.paramName: the parameter name for the file form data,
|
||||
// overrides the name property of the file input field(s),
|
||||
// can be a string or an array of strings.
|
||||
// options.formData: an array of objects with name and value properties,
|
||||
// equivalent to the return data of .serializeArray(), e.g.:
|
||||
// [{name: 'a', value: 1}, {name: 'b', value: 2}]
|
||||
$.ajaxTransport('iframe', function (options) {
|
||||
if (options.async && (options.type === 'POST' || options.type === 'GET')) {
|
||||
var form,
|
||||
iframe;
|
||||
return {
|
||||
send: function (_, completeCallback) {
|
||||
form = $('<form style="display:none;"></form>');
|
||||
form.attr('accept-charset', options.formAcceptCharset);
|
||||
// javascript:false as initial iframe src
|
||||
// prevents warning popups on HTTPS in IE6.
|
||||
// IE versions below IE8 cannot set the name property of
|
||||
// elements that have already been added to the DOM,
|
||||
// so we set the name along with the iframe HTML markup:
|
||||
iframe = $(
|
||||
'<iframe src="javascript:false;" name="iframe-transport-' +
|
||||
(counter += 1) + '"></iframe>'
|
||||
).bind('load', function () {
|
||||
var fileInputClones,
|
||||
paramNames = $.isArray(options.paramName) ?
|
||||
options.paramName : [options.paramName];
|
||||
iframe
|
||||
.unbind('load')
|
||||
.bind('load', function () {
|
||||
var response;
|
||||
// Wrap in a try/catch block to catch exceptions thrown
|
||||
// when trying to access cross-domain iframe contents:
|
||||
try {
|
||||
response = iframe.contents();
|
||||
// Google Chrome and Firefox do not throw an
|
||||
// exception when calling iframe.contents() on
|
||||
// cross-domain requests, so we unify the response:
|
||||
if (!response.length || !response[0].firstChild) {
|
||||
throw new Error();
|
||||
}
|
||||
} catch (e) {
|
||||
response = undefined;
|
||||
}
|
||||
// The complete callback returns the
|
||||
// iframe content document as response object:
|
||||
completeCallback(
|
||||
200,
|
||||
'success',
|
||||
{'iframe': response}
|
||||
);
|
||||
// Fix for IE endless progress bar activity bug
|
||||
// (happens on form submits to iframe targets):
|
||||
$('<iframe src="javascript:false;"></iframe>')
|
||||
.appendTo(form);
|
||||
form.remove();
|
||||
});
|
||||
form
|
||||
.prop('target', iframe.prop('name'))
|
||||
.prop('action', options.url)
|
||||
.prop('method', options.type);
|
||||
if (options.formData) {
|
||||
$.each(options.formData, function (index, field) {
|
||||
$('<input type="hidden"/>')
|
||||
.prop('name', field.name)
|
||||
.val(field.value)
|
||||
.appendTo(form);
|
||||
});
|
||||
}
|
||||
if (options.fileInput && options.fileInput.length &&
|
||||
options.type === 'POST') {
|
||||
fileInputClones = options.fileInput.clone();
|
||||
// Insert a clone for each file input field:
|
||||
options.fileInput.after(function (index) {
|
||||
return fileInputClones[index];
|
||||
});
|
||||
if (options.paramName) {
|
||||
options.fileInput.each(function (index) {
|
||||
$(this).prop(
|
||||
'name',
|
||||
paramNames[index] || options.paramName
|
||||
);
|
||||
});
|
||||
}
|
||||
// Appending the file input fields to the hidden form
|
||||
// removes them from their original location:
|
||||
form
|
||||
.append(options.fileInput)
|
||||
.prop('enctype', 'multipart/form-data')
|
||||
// enctype must be set as encoding for IE:
|
||||
.prop('encoding', 'multipart/form-data');
|
||||
}
|
||||
form.submit();
|
||||
// Insert the file input fields at their original location
|
||||
// by replacing the clones with the originals:
|
||||
if (fileInputClones && fileInputClones.length) {
|
||||
options.fileInput.each(function (index, input) {
|
||||
var clone = $(fileInputClones[index]);
|
||||
$(input).prop('name', clone.prop('name'));
|
||||
clone.replaceWith(input);
|
||||
});
|
||||
}
|
||||
});
|
||||
form.append(iframe).appendTo(document.body);
|
||||
},
|
||||
abort: function () {
|
||||
if (iframe) {
|
||||
// javascript:false as iframe src aborts the request
|
||||
// and prevents warning popups on HTTPS in IE6.
|
||||
// concat is used to avoid the "Script URL" JSLint error:
|
||||
iframe
|
||||
.unbind('load')
|
||||
.prop('src', 'javascript'.concat(':false;'));
|
||||
}
|
||||
if (form) {
|
||||
form.remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// The iframe transport returns the iframe content document as response.
|
||||
// The following adds converters from iframe to text, json, html, and script:
|
||||
$.ajaxSetup({
|
||||
converters: {
|
||||
'iframe text': function (iframe) {
|
||||
return $(iframe[0].body).text();
|
||||
},
|
||||
'iframe json': function (iframe) {
|
||||
return $.parseJSON($(iframe[0].body).text());
|
||||
},
|
||||
'iframe html': function (iframe) {
|
||||
return $(iframe[0].body).html();
|
||||
},
|
||||
'iframe script': function (iframe) {
|
||||
return $.globalEval($(iframe[0].body).text());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}));
|
||||
Vendored
-29
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* jQuery File Upload Plugin Localization Example 6.5.1
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2012, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*global window */
|
||||
|
||||
window.locale = {
|
||||
"fileupload": {
|
||||
"errors": {
|
||||
"maxFileSize": "File is too big",
|
||||
"minFileSize": "File is too small",
|
||||
"acceptFileTypes": "Filetype not allowed",
|
||||
"maxNumberOfFiles": "Max number of files exceeded",
|
||||
"uploadedBytes": "Uploaded bytes exceed file size",
|
||||
"emptyResult": "Empty file upload result"
|
||||
},
|
||||
"error": "Error",
|
||||
"start": "Start",
|
||||
"cancel": "Cancel",
|
||||
"destroy": "Delete"
|
||||
}
|
||||
};
|
||||
-78
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* jQuery File Upload Plugin JS Example 6.7
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint nomen: true, unparam: true, regexp: true */
|
||||
/*global $, window, document */
|
||||
|
||||
$(function () {
|
||||
'use strict';
|
||||
|
||||
// Initialize the jQuery File Upload widget:
|
||||
$('#fileupload').fileupload();
|
||||
|
||||
// Enable iframe cross-domain access via redirect option:
|
||||
$('#fileupload').fileupload(
|
||||
'option',
|
||||
'redirect',
|
||||
window.location.href.replace(
|
||||
/\/[^\/]*$/,
|
||||
'/cors/result.html?%s'
|
||||
)
|
||||
);
|
||||
|
||||
if (window.location.hostname === 'blueimp.github.com') {
|
||||
// Demo settings:
|
||||
$('#fileupload').fileupload('option', {
|
||||
url: '//jquery-file-upload.appspot.com/',
|
||||
maxFileSize: 5000000,
|
||||
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
|
||||
process: [
|
||||
{
|
||||
action: 'load',
|
||||
fileTypes: /^image\/(gif|jpeg|png)$/,
|
||||
maxFileSize: 20000000 // 20MB
|
||||
},
|
||||
{
|
||||
action: 'resize',
|
||||
maxWidth: 1440,
|
||||
maxHeight: 900
|
||||
},
|
||||
{
|
||||
action: 'save'
|
||||
}
|
||||
]
|
||||
});
|
||||
// Upload server status check for browsers with CORS support:
|
||||
if ($.support.cors) {
|
||||
$.ajax({
|
||||
url: '//jquery-file-upload.appspot.com/',
|
||||
type: 'HEAD'
|
||||
}).fail(function () {
|
||||
$('<span class="alert alert-error"/>')
|
||||
.text('Upload server currently unavailable - ' +
|
||||
new Date())
|
||||
.appendTo('#fileupload');
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Load existing files:
|
||||
$('#fileupload').each(function () {
|
||||
var that = this;
|
||||
$.getJSON(this.action, function (result) {
|
||||
if (result && result.length) {
|
||||
$(that).fileupload('option', 'done')
|
||||
.call(that, null, {result: result});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
Vendored
+1
-1
@@ -9,7 +9,7 @@
|
||||
<ul>
|
||||
<li>
|
||||
<b><%= t('announcement.category') %></b>
|
||||
<%= @bulletin.bulletin_category.i18n_variable[I18n.locale] %>
|
||||
<%= @bulletin.bulletin_category.title %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('announcement.postdate') %></b>
|
||||
|
||||
Vendored
+2
-2
@@ -10,11 +10,11 @@
|
||||
|
||||
<ul class="subm">
|
||||
<% @archive_file_categorys.each do |afcpost| %>
|
||||
<li><%= link_to afcpost.i18n_variable[I18n.locale], panel_archive_front_end_archive_files_path(:category_id => afcpost.id) %></li>
|
||||
<li><%= link_to afcpost.title, panel_archive_front_end_archive_files_path(:category_id => afcpost.id) %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<h3><%= @archive_files.first.archive_file_category.i18n_variable[I18n.locale] rescue nil %></h3>
|
||||
<h3><%= @archive_files.first.archive_file_category.title rescue nil %></h3>
|
||||
|
||||
<% @archive_files.each do |post| %>
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
<h1 class="h1"><%= @title %></h1>
|
||||
<% end %>
|
||||
|
||||
<h3><%= @archive_file.archive_file_category.i18n_variable[I18n.locale] rescue nil %></h3>
|
||||
<h3><%= @archive_file.archive_file_category.title rescue nil %></h3>
|
||||
|
||||
<%= @archive_file.title %>
|
||||
|
||||
|
||||
+424
-27
@@ -6,8 +6,7 @@ Date.prototype.getWeek = function (dowOffset) {
|
||||
var newYear = new Date(this.getFullYear(),0,1);
|
||||
var day = newYear.getDay() - dowOffset; //the day of week the year begins on
|
||||
day = (day >= 0 ? day : day + 7);
|
||||
var daynum = Math.floor((this.getTime() - newYear.getTime() -
|
||||
(this.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000) + 1;
|
||||
var daynum = Math.floor((this.getTime() - newYear.getTime() - (this.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000) + 1;
|
||||
var weeknum;
|
||||
//if the year starts before the middle of a week
|
||||
if(day < 4) {
|
||||
@@ -27,6 +26,13 @@ Date.prototype.getWeek = function (dowOffset) {
|
||||
return weeknum;
|
||||
};
|
||||
|
||||
Date.prototype.daysInMonth = function(){
|
||||
var daysArray = [31,28,31,30,31,30,31,31,30,31,30,31];
|
||||
if(this.getFullYear()%4 == 0)
|
||||
daysArray[1] = 29;
|
||||
|
||||
return daysArray[this.getMonth()];
|
||||
}
|
||||
|
||||
var calendarAPI = function(){
|
||||
c = this;
|
||||
@@ -36,31 +42,79 @@ var calendarAPI = function(){
|
||||
this.cur_month = c.today.getMonth()+1;
|
||||
this.cur_year = c.today.getFullYear();
|
||||
this.cur_week = c.today.getWeek();
|
||||
this.cur_date = c.today.getDate();
|
||||
this.view = null;
|
||||
this.calendars = new Array();
|
||||
this.monthlist = ["","January","February","March","April","May","June","July","August","September","October","November","December"];
|
||||
this.initialize = function(){
|
||||
$(window).load(function(){
|
||||
// c.loadMonthView(c.cur_month,c.cur_year);
|
||||
c.loadWeekView(c.cur_week,c.cur_year);
|
||||
// c.loadWeekView(c.cur_week,c.cur_year);
|
||||
// c.loadDayView(c.cur_date,c.cur_month,c.cur_year);
|
||||
c.loadAgendaView();
|
||||
$(".calendar-filter-btn").each(function(){
|
||||
c.calendars.push($(this).attr("href"));
|
||||
})
|
||||
bindHandlers();
|
||||
})
|
||||
var bindHandlers = function(){
|
||||
$(".event").live("click",function(){
|
||||
c.displayEvent($(this));
|
||||
$(".event").live("click",function(e){
|
||||
var pos = {"x":e.clientX,"y":e.clientY};
|
||||
c.displayEvent($(this),pos);
|
||||
})
|
||||
|
||||
$("#create_event_btn").click(function(){
|
||||
if(!$(this).hasClass("active")){
|
||||
c.newEvent($(this).attr("href"),$(this).attr("ref"),c.today.getDate(),c.today.getMonth()+1,c.today.getFullYear());
|
||||
c.newEvent($(this).attr("href"),$(this).attr("ref"),c.today.getDate(),c.today.getMonth()+1,c.today.getFullYear(),10.5,"AM");
|
||||
}else{
|
||||
c.event_create_div.hide().empty();
|
||||
}
|
||||
$(this).toggleClass("active");
|
||||
return false;
|
||||
})
|
||||
$("td.click_event").live("click",function(){
|
||||
c.newEvent($(this).attr("link"),$(this).attr("ref"),$(this).attr("date"),c.cur_month,c.cur_year);
|
||||
$(".click_event").live("click",function(e){
|
||||
var dt = $(this).attr("date");
|
||||
if(!dt){
|
||||
var w = $("td.week_day_body").width();
|
||||
var parentOffset = $("table.cell_map").offset();
|
||||
var relX = e.pageX - parentOffset.left;
|
||||
var t = 60;
|
||||
for (var i = 0; i <= 6; i++) {
|
||||
if(relX > t && relX < (t + w)){
|
||||
console.log(i);
|
||||
dt = $("td.week_day_body").eq(i).attr("date");
|
||||
break;
|
||||
}
|
||||
t = t + w;
|
||||
};
|
||||
}
|
||||
var time = $(this).attr("time");
|
||||
var ses = $(this).attr("ses");
|
||||
if (!time)
|
||||
time = 10.5;
|
||||
if(!ses)
|
||||
ses = "AM";
|
||||
|
||||
c.newEvent($(this).attr("link"),$(this).attr("ref"),dt,c.cur_month,c.cur_year,time,ses);
|
||||
$("#create_event_btn").toggleClass("active");
|
||||
e.stopPropagation();
|
||||
})
|
||||
$(".calendar-filter-btn").click(function(){
|
||||
$(this).toggleClass("active");
|
||||
c.calendars = [];
|
||||
$(".calendar-filter-btn").each(function(){
|
||||
if($(this).hasClass("active"))
|
||||
c.calendars.push($(this).attr("href"));
|
||||
})
|
||||
c.refresh();
|
||||
})
|
||||
|
||||
$("#edit_event_btn").live("ajax:success",function(evt,form){
|
||||
c.event_quick_view_div.empty().hide();
|
||||
c.updateEvent(form);
|
||||
})
|
||||
$("#refresh_btn").click(function(){
|
||||
c.refresh();
|
||||
})
|
||||
|
||||
$('.mode_switch').click(function(){
|
||||
@@ -73,7 +127,7 @@ var calendarAPI = function(){
|
||||
c.loadWeekView(c.cur_week,c.cur_year);
|
||||
break;
|
||||
case 'day':
|
||||
c.loadDayView();
|
||||
c.loadDayView(c.cur_date,c.cur_month,c.cur_year);
|
||||
break;
|
||||
case 'agenda':
|
||||
c.loadAgendaView();
|
||||
@@ -104,6 +158,22 @@ var calendarAPI = function(){
|
||||
}
|
||||
c.loadWeekView(w,y);
|
||||
break;
|
||||
case "day":
|
||||
var d,w,y;
|
||||
d = c.cur_date - 1;
|
||||
m = c.cur_month;
|
||||
y = c.cur_year;
|
||||
if(d == 0){
|
||||
var dx = new Date(c.cur_year,c.cur_month-2);
|
||||
d = dx.daysInMonth();
|
||||
m--;
|
||||
}
|
||||
if(m == 0){
|
||||
m = 12;
|
||||
y = y - 1;
|
||||
}
|
||||
c.loadDayView(d,m,y);
|
||||
break;
|
||||
}
|
||||
|
||||
})
|
||||
@@ -132,14 +202,48 @@ var calendarAPI = function(){
|
||||
}
|
||||
c.loadWeekView(w,y);
|
||||
break;
|
||||
case "day":
|
||||
var d,w,y;
|
||||
var dx = new Date(c.cur_year,c.cur_month-1);
|
||||
if(c.cur_date == dx.daysInMonth()){
|
||||
d = 1;
|
||||
m = c.cur_month + 1;
|
||||
}else{
|
||||
d = c.cur_date + 1;
|
||||
m = c.cur_month;
|
||||
}
|
||||
|
||||
if(m == 13){
|
||||
m = 1;
|
||||
y = c.cur_year + 1;
|
||||
}else{
|
||||
y = c.cur_year;
|
||||
}
|
||||
|
||||
c.loadDayView(d,m,y);
|
||||
break;
|
||||
}
|
||||
})
|
||||
$("button#today_btn").click(function(){
|
||||
c.loadMonthView();
|
||||
switch (c.view){
|
||||
case "week":
|
||||
c.loadWeekView();
|
||||
break;
|
||||
case "month":
|
||||
c.loadMonthView();
|
||||
break;
|
||||
case "day":
|
||||
c.loadDayView();
|
||||
break;
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
this.loadMonthView = function(month,year){
|
||||
$("#range_selection").hide();
|
||||
$("#navigation").show();
|
||||
$("#sec1").removeClass("span8").addClass("span3");
|
||||
$("#sec2").show();
|
||||
c.view = "month";
|
||||
if(!month){
|
||||
var dt = new Date();
|
||||
@@ -156,7 +260,7 @@ var calendarAPI = function(){
|
||||
if($('#calendar_month').length > 0){
|
||||
var $c_table = $('#calendar_month');
|
||||
var sum_h = 0;
|
||||
var context_h = $('#main-sidebar').outerHeight();
|
||||
var context_h = $(window).height() - $('#orbit-bar').height();
|
||||
$('#main-wrap > *').not('#orbit_calendar, .modal').each(function(){
|
||||
sum_h += $(this).outerHeight();
|
||||
});
|
||||
@@ -180,7 +284,7 @@ var calendarAPI = function(){
|
||||
|
||||
|
||||
this.getEventsForMonth = function(month,year){
|
||||
$.getJSON("cals/getMonthEvents",{"month":month,"year":year},function(events){
|
||||
$.getJSON("cals/getMonthEvents",{"month":month,"year":year,"calendars":c.calendars},function(events){
|
||||
makerow(events);
|
||||
})
|
||||
var doneEventArray = new Array();
|
||||
@@ -206,7 +310,7 @@ var calendarAPI = function(){
|
||||
curparent.append($eventrow);
|
||||
}
|
||||
$eventrow = null;
|
||||
$eventrow = $("<tr class='event_row'></tr>");
|
||||
$eventrow = $("<tr class='event_row destroy'></tr>");
|
||||
allow = true;
|
||||
}else if(evnt.start_date > curdate){
|
||||
allow = true;
|
||||
@@ -215,6 +319,8 @@ var calendarAPI = function(){
|
||||
var recordcurdate = true;
|
||||
|
||||
if(allow){
|
||||
if(evnt.title=="Navratri")
|
||||
//console.log(pos);
|
||||
if(pos == 1){
|
||||
var colspan = 0;
|
||||
if(evnt.total_days>7){
|
||||
@@ -231,13 +337,13 @@ var calendarAPI = function(){
|
||||
$eventrow.html('<td colspan="'+colspan+'" class="main_td" pos="'+pos+'"><div class="event" link="'+evnt.show_link+'" style="background-color: '+evnt.color+';">'+evnt.title+'</div></td>');
|
||||
}else{
|
||||
if($eventrow.html()==""){
|
||||
$eventrow.append('<td colspan="'+(pos-1)+'">');
|
||||
$eventrow.append('<td colspan="'+(pos-1)+'"></td>');
|
||||
}else{
|
||||
if((lastno+1)!=thisno){
|
||||
var inposition = parseInt($eventrow.find("td.main_td:last").attr("pos"));
|
||||
var curcolspan = $eventrow.find("td.main_td:last").attr("colspan");
|
||||
var colspan = pos - (inposition+parseInt(curcolspan));
|
||||
$eventrow.append('<td colspan="'+colspan+'">');
|
||||
$eventrow.append('<td colspan="'+colspan+'"></td>');
|
||||
}
|
||||
}
|
||||
var colspan = 0;
|
||||
@@ -280,6 +386,10 @@ var calendarAPI = function(){
|
||||
}
|
||||
|
||||
this.loadWeekView = function(week,year){
|
||||
$("#range_selection").hide();
|
||||
$("#navigation").show();
|
||||
$("#sec1").removeClass("span8").addClass("span3");
|
||||
$("#sec2").show();
|
||||
c.view = "week";
|
||||
if(!week){
|
||||
var dt = new Date();
|
||||
@@ -296,21 +406,216 @@ var calendarAPI = function(){
|
||||
})
|
||||
}
|
||||
this.getEventsForWeek = function(week,year){
|
||||
$.getJSON("cals/getWeekEvents",{"week":week,"year":year},function(events){
|
||||
|
||||
$.getJSON("cals/getWeekEvents",{"week":week,"year":year,"calendars":c.calendars},function(events){
|
||||
var height = 15;
|
||||
var full_day_count = 0;
|
||||
var rowcount = 7;
|
||||
var tr = $("<tr class='destroy'></tr>");
|
||||
var pre = true;
|
||||
$.each(events,function(i,evnt){
|
||||
// console.log("rowcount: "+rowcount);
|
||||
// console.log("start:"+evnt.start);
|
||||
if(rowcount >= (7 - evnt.total_days)){
|
||||
if(tr.html()!=""){
|
||||
if(rowcount != 7){
|
||||
tr.append("<td colspan='"+(7-rowcount)+"'></td>");
|
||||
}
|
||||
$("table.all_day_event_holder").append(tr);
|
||||
}
|
||||
tr = null;
|
||||
tr = $('<tr class="destroy"></tr>');
|
||||
pre = true;
|
||||
}
|
||||
|
||||
if(evnt.all_day){
|
||||
full_day_count++;
|
||||
|
||||
var precountspan = 7 - evnt.total_days;
|
||||
if(pre){
|
||||
height+=20;
|
||||
$(".head_event_wrapper").height(height);
|
||||
$(".head_event_wrapper table").eq(0).height(height);
|
||||
tr.append('<td rowspan="1" style="width:60px;"> </td>');
|
||||
if(precountspan != 0){
|
||||
tr.append('<td colspan="'+precountspan+'"></td>');
|
||||
pre = false;
|
||||
}
|
||||
}
|
||||
var colcount = evnt.total_days;
|
||||
if(evnt.colcount != 0){
|
||||
colcount = evnt.colcount;
|
||||
}
|
||||
|
||||
rowcount = precountspan + colcount;
|
||||
|
||||
tr.append('<td colspan="'+colcount+'" class="all_day_event week_day" ><div class="event half" style="background-color: '+evnt.color+' ;color:#fff;" link="'+evnt.show_link+'"><dl><dt>'+evnt.title+'</dt><dd></dd></dl></div></td>');
|
||||
|
||||
// $(".week_day_header[date="+evnt.start_date+"]").append('<div class="event half" link="'+evnt.show_link+'" style="background-color: '+evnt.color+';color:#fff;"><dl><dt>'+evnt.title+'</dt><dd></dd></dl></div>');
|
||||
}else{
|
||||
|
||||
var starttime,endtime,displaystarttime,displayendtime;
|
||||
if(evnt.start_am_pm == "AM"){
|
||||
starttime = evnt.start_time;
|
||||
if(starttime == 12)
|
||||
starttime = 0;
|
||||
if(starttime == 12.5)
|
||||
starttime = 0.5;
|
||||
}else
|
||||
starttime = evnt.start_time + 12;
|
||||
|
||||
if(evnt.end_am_pm == "AM"){
|
||||
endtime = evnt.end_time;
|
||||
if(endtime == 12)
|
||||
endtime = 0;
|
||||
if(endtime == 12.5)
|
||||
endtime = 0.5;
|
||||
}else
|
||||
endtime = evnt.end_time + 12;
|
||||
|
||||
var temp = parseInt(evnt.start_time);
|
||||
|
||||
if (evnt.start_time > temp)
|
||||
displaystarttime = temp + ":30 " + evnt.start_am_pm;
|
||||
else
|
||||
displaystarttime = temp + ":00 " + evnt.start_am_pm;
|
||||
|
||||
temp = parseInt(evnt.end_time);
|
||||
|
||||
if (evnt.end_time > temp)
|
||||
displayendtime = temp + ":30 " + evnt.end_am_pm;
|
||||
else
|
||||
displayendtime = temp + ":00 " + evnt.end_am_pm;
|
||||
|
||||
var toppx = ((starttime * 2) * 20) + 1;
|
||||
var h = endtime - starttime;
|
||||
var halfhour = "";
|
||||
if(h == 0.5)
|
||||
halfhour = "half";
|
||||
h = 17 + 20 + (((h-1) * 2) * 20) + 1;
|
||||
var eventdom = $('<div class="event '+halfhour+' destroy" link="'+evnt.show_link+'" style="background-color: '+evnt.color+';color:#fff; top:'+toppx+'px; height:'+h+'px;"><dl><dt>'+displaystarttime+' - '+displayendtime+'</dt><dd>'+evnt.title+'</dd></dl></div>');
|
||||
$(".week_day_body[date="+evnt.start_date+"] .inner").append(eventdom);
|
||||
}
|
||||
if(full_day_count == 0){
|
||||
tr.append('<td rowspan="1" style="width:60px;">');
|
||||
$("table.all_day_event_holder").append(tr);
|
||||
}
|
||||
|
||||
})
|
||||
if(tr.html()!=""){
|
||||
if(rowcount != 7){
|
||||
tr.append("<td colspan='"+(7-rowcount)+"'></td>");
|
||||
}
|
||||
$("table.all_day_event_holder").append(tr);
|
||||
}
|
||||
})
|
||||
}
|
||||
this.loadDayView = function(){
|
||||
$('#view_holder').load("cals/day_view", function() {
|
||||
$('.current_day_title').text('September 2, 2012');
|
||||
this.loadDayView = function(day,month,year){
|
||||
$("#range_selection").hide();
|
||||
$("#navigation").show();
|
||||
$("#sec1").removeClass("span8").addClass("span3");
|
||||
$("#sec2").show();
|
||||
c.view = "day";
|
||||
if(!day){
|
||||
var dt = new Date();
|
||||
week = dt.getWeek();
|
||||
year = dt.getFullYear();
|
||||
day = dt.getDate();
|
||||
month = dt.getMonth()+1;
|
||||
}
|
||||
|
||||
c.cur_date = day;
|
||||
c.cur_month = month;
|
||||
c.cur_year = year;
|
||||
|
||||
$('#view_holder').load("cals/day_view?date="+day+"&month="+month+"&year="+year, function() {
|
||||
$('.current_day_title').text($("#day_header").text());
|
||||
c.getEventsForDay(day,month,year);
|
||||
})
|
||||
}
|
||||
this.loadAgendaView = function(){
|
||||
$('#view_holder').load("cals/week_view", function() {
|
||||
$('.current_day_title').text('September 2, 2012');
|
||||
this.getEventsForDay = function(day,month,year){
|
||||
$.getJSON("cals/getDayEvents",{"date":day,"month":month,"year":year,"calendars":c.calendars},function(events){
|
||||
$.each(events,function(i,evnt){
|
||||
if(evnt.all_day){
|
||||
$(".all_day_event").append('<div class="event destroy" link="'+evnt.show_link+'" style="background-color: '+evnt.color+';color:#fff;">'+evnt.title+'</div>')
|
||||
}else{
|
||||
var starttime,endtime,displaystarttime,displayendtime;
|
||||
if(evnt.start_am_pm == "AM"){
|
||||
starttime = evnt.start_time;
|
||||
if(starttime == 12)
|
||||
starttime = 0;
|
||||
if(starttime == 12.5)
|
||||
starttime = 0.5;
|
||||
}else
|
||||
starttime = evnt.start_time + 12;
|
||||
|
||||
if(evnt.end_am_pm == "AM"){
|
||||
endtime = evnt.end_time;
|
||||
if(endtime == 12)
|
||||
endtime = 0;
|
||||
if(endtime == 12.5)
|
||||
endtime = 0.5;
|
||||
}else
|
||||
endtime = evnt.end_time + 12;
|
||||
|
||||
var temp = parseInt(evnt.start_time);
|
||||
|
||||
if (evnt.start_time > temp)
|
||||
displaystarttime = temp + ":30 " + evnt.start_am_pm;
|
||||
else
|
||||
displaystarttime = temp + ":00 " + evnt.start_am_pm;
|
||||
|
||||
temp = parseInt(evnt.end_time);
|
||||
|
||||
if (evnt.end_time > temp)
|
||||
displayendtime = temp + ":30 " + evnt.end_am_pm;
|
||||
else
|
||||
displayendtime = temp + ":00 " + evnt.end_am_pm;
|
||||
|
||||
var toppx = ((starttime * 2) * 20) + 1;
|
||||
var h = endtime - starttime;
|
||||
var halfhour = "";
|
||||
if(h == 0.5)
|
||||
halfhour = "half";
|
||||
h = 17 + 20 + (((h-1) * 2) * 20) + 1;
|
||||
var eventdom = $('<div class="inner"><div class="event '+halfhour+' destroy" link="'+evnt.show_link+'" style="background-color: '+evnt.color+';color:#fff; top:'+toppx+'px; height:'+h+'px;"><dl><dt>'+displaystarttime+' - '+displayendtime+'</dt><dd>'+evnt.title+'</dd></dl></div></div>');
|
||||
$(".event_holder").append(eventdom);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
this.newEvent = function(url,ref,date,month,year){
|
||||
this.loadAgendaView = function(start_month,start_year,end_month,end_year){
|
||||
c.view = "agenda";
|
||||
var url = "cals/agenda_view";
|
||||
if(start_month && start_year && end_month && end_year)
|
||||
var url = "cals/agenda_view?s_month="+start_month+"&s_year="+start_year+"&e_month="+end_month+"&e_year="+end_year ;
|
||||
|
||||
$('#view_holder').load(url, function() {
|
||||
$("#navigation").hide();
|
||||
$("#range_selection").html($("#agenda_date_range").html()).show();
|
||||
$("#sec1").removeClass("span3").addClass("span8");
|
||||
$("#sec2").hide();
|
||||
bindHandlers();
|
||||
})
|
||||
var bindHandlers = function(){
|
||||
$("select[name=start_year]").change(function(){
|
||||
var x = parseInt($(this).val()) - parseInt($(this).find("option").eq(0).val());
|
||||
$("select[name=end_year] option").removeAttr("disabled");
|
||||
for(i=0;i<x;i++){
|
||||
$("select[name=end_year] option").eq(i).attr("disabled","disabled");
|
||||
}
|
||||
})
|
||||
$("#range_selection .bt-filter").click(function(){
|
||||
var start_month = $("select[name=start_month]").val();
|
||||
var start_year = $("select[name=start_year]").val();
|
||||
var end_year = $("select[name=end_year]").val();
|
||||
var end_month = $("select[name=end_month]").val();
|
||||
c.loadAgendaView(start_month,start_year,end_month,end_year);
|
||||
})
|
||||
}
|
||||
}
|
||||
this.newEvent = function(url,ref,date,month,year,time,ses){
|
||||
var bindHandlers = function(){
|
||||
c.event_create_div.find("button.btn-close").click(function(){
|
||||
c.event_create_div.hide().empty();
|
||||
@@ -322,14 +627,72 @@ var calendarAPI = function(){
|
||||
else
|
||||
c.event_create_div.find("#non_all_day").show()
|
||||
})
|
||||
$( "#dpfrom" ).datepicker({
|
||||
defaultDate: "+1w",
|
||||
changeMonth: true,
|
||||
numberOfMonths: 3,
|
||||
onSelect: function( selectedDate ) {
|
||||
$( "#dpto" ).datepicker( "option", "minDate", selectedDate );
|
||||
}
|
||||
});
|
||||
$( "#dpto" ).datepicker({
|
||||
defaultDate: "+1w",
|
||||
changeMonth: true,
|
||||
numberOfMonths: 3,
|
||||
onSelect: function( selectedDate ) {
|
||||
$( "#dpfrom" ).datepicker( "option", "maxDate", selectedDate );
|
||||
}
|
||||
});
|
||||
$('#open_tags_panel').click(function(){
|
||||
$('#tags_panel').toggle();
|
||||
$('.my_scroll').tinyscrollbar();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
c.event_create_div.load(url+"?ref="+ref+"&date="+date+"&month="+month+"&year="+year,function(){
|
||||
c.event_create_div.load(url+"?ref="+ref+"&date="+date+"&month="+month+"&year="+year+"&time="+time+"&ses="+ses,function(){
|
||||
c.event_create_div.show();
|
||||
bindHandlers();
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
this.updateEvent = function(form){
|
||||
var bindHandlers = function(){
|
||||
c.event_create_div.find("button.btn-close").click(function(){
|
||||
c.event_create_div.hide().empty();
|
||||
$("#create_event_btn").removeClass("active");
|
||||
$("#create_event_btn").show();
|
||||
})
|
||||
c.event_create_div.find("input[for=all_day][type=checkbox]").click(function(){
|
||||
if($(this).is(":checked"))
|
||||
c.event_create_div.find("#non_all_day").hide()
|
||||
else
|
||||
c.event_create_div.find("#non_all_day").show()
|
||||
})
|
||||
$( "#dpfrom" ).datepicker({
|
||||
defaultDate: "+1w",
|
||||
changeMonth: true,
|
||||
numberOfMonths: 3,
|
||||
onSelect: function( selectedDate ) {
|
||||
$( "#dpto" ).datepicker( "option", "minDate", selectedDate );
|
||||
}
|
||||
});
|
||||
$( "#dpto" ).datepicker({
|
||||
defaultDate: "+1w",
|
||||
changeMonth: true,
|
||||
numberOfMonths: 3,
|
||||
onSelect: function( selectedDate ) {
|
||||
$( "#dpfrom" ).datepicker( "option", "maxDate", selectedDate );
|
||||
}
|
||||
});
|
||||
}
|
||||
c.event_create_div.html(form);
|
||||
$("#create_event_btn").hide();
|
||||
c.event_create_div.show();
|
||||
bindHandlers();
|
||||
}
|
||||
|
||||
this.newCalendars = function(){
|
||||
if($('.color-picker').length > 0){
|
||||
$('.color-picker').miniColors(); // just in category view
|
||||
@@ -338,16 +701,50 @@ var calendarAPI = function(){
|
||||
var domfor = $(this).attr("data-content");
|
||||
$("tr[for="+domfor+"]").remove();
|
||||
})
|
||||
$(".btn-edit-a").live("ajax:success",function(evt,form){
|
||||
$("#edit_area_" + $(this).attr("for")).html(form).slideDown();
|
||||
$("#edit_area_" + $(this).attr("for")).find(".color-picker").miniColors();
|
||||
})
|
||||
$(".bt-cancel").live("click",function(){
|
||||
$("#edit_area_" + $(this).attr("for")).html("").slideUp();
|
||||
})
|
||||
}
|
||||
this.displayEvent = function(dom){
|
||||
this.displayEvent = function(dom,pos){
|
||||
var url = dom.attr("link");
|
||||
c.event_quick_view_div.load(url,function(){
|
||||
c.event_quick_view_div.show()
|
||||
var x = pos.x;
|
||||
var y = pos.y;
|
||||
var winheight = $(window).height()
|
||||
if((x+c.event_quick_view_div.width()) > $(window).width()){
|
||||
x = x - c.event_quick_view_div.width();
|
||||
}
|
||||
if((y+c.event_quick_view_div.height()) > winheight){
|
||||
y = y - c.event_quick_view_div.height();
|
||||
}
|
||||
c.event_quick_view_div.css({"left":x+"px","top":y+"px"}).show()
|
||||
c.event_quick_view_div.find(".event-close-btn").click(function(){
|
||||
c.event_quick_view_div.empty().hide();
|
||||
})
|
||||
c.event_quick_view_div.find(".bt-del").bind("ajax:success",function(){
|
||||
c.event_quick_view_div.empty().hide();
|
||||
dom.remove();
|
||||
})
|
||||
})
|
||||
}
|
||||
this.refresh = function(){
|
||||
$(".destroy").remove();
|
||||
switch (c.view){
|
||||
case "week":
|
||||
c.loadWeekView(c.cur_week,c.cur_year);
|
||||
break;
|
||||
case "month":
|
||||
c.loadMonthView(c.cur_month,c.cur_year);
|
||||
break;
|
||||
case "day":
|
||||
c.loadDayView(c.cur_date,c.cur_month,c.cur_year);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
c.initialize();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// This is a manifest file that'll be compiled into including all the files listed below.
|
||||
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
||||
// be included in the compiled file accessible from http://example.com/assets/application.js
|
||||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||
// the compiled file.
|
||||
//
|
||||
//= require jquery-ui
|
||||
//= require bootstrap
|
||||
//= require calendarAPI
|
||||
@@ -18,7 +18,6 @@
|
||||
line-height: 28px;
|
||||
}
|
||||
.calendar_mode {
|
||||
float: right;
|
||||
z-index: 2;
|
||||
}
|
||||
.mode_switch {
|
||||
@@ -32,22 +31,29 @@
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
padding: 1px 3px;
|
||||
font-weight: bold;
|
||||
box-shadow: inset 0 0 1px black;
|
||||
-webkit-box-shadow: inset 0 0 1px black;
|
||||
-moz-box-shadow: inset 0 0 1px black;
|
||||
}
|
||||
.modal-body {
|
||||
max-height: 450px;
|
||||
}
|
||||
.event_list_wrapper {
|
||||
position: relative;
|
||||
}
|
||||
.event_list .cell {
|
||||
height: 38px;
|
||||
height: 39px;
|
||||
border: solid 1px #ddd;
|
||||
border-top: 0;
|
||||
}
|
||||
.event_list .divide {
|
||||
height: 18px;
|
||||
height: 19px;
|
||||
margin-bottom: 18px;
|
||||
border-bottom: solid 1px #eee;
|
||||
}
|
||||
.event_list .day_time {
|
||||
height: 30px;
|
||||
height: 31px;
|
||||
border-bottom: solid 1px #ddd;
|
||||
border-left: solid 1px #ddd;
|
||||
text-align: right;
|
||||
@@ -67,7 +73,7 @@
|
||||
}
|
||||
#calendar_day .event_holder {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
/*height: 100%;*/
|
||||
position: absolute;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
@@ -160,19 +166,48 @@
|
||||
|
||||
/* agenda view */
|
||||
#calendar_agenda {
|
||||
border-bottom: solid 1px #ddd;
|
||||
margin-top: 20px;
|
||||
}
|
||||
#calendar_agenda .table {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
#calendar_agenda .tiny_calendar {
|
||||
border: solid 1px #eee;
|
||||
}
|
||||
#calendar_agenda .tiny_calendar .table th {
|
||||
border-top: 0;
|
||||
}
|
||||
#calendar_agenda .tiny_calendar .table td {
|
||||
text-align: center;
|
||||
}
|
||||
#calendar_agenda .event {
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
#calendar_agenda .row-fluid {
|
||||
margin-top: 20px;
|
||||
padding-top: 20px;
|
||||
border-top: dashed 1px #ddd;
|
||||
}
|
||||
#calendar_agenda .row-fluid:first-child {
|
||||
border-top: 0;
|
||||
padding-top: 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
#calendar_agenda .table.event_list .span2, #calendar_agenda .table.event_list thead th {
|
||||
min-height: 0 !important;
|
||||
height: 0 !important;
|
||||
line-height: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.event_time {
|
||||
font-family: Tahoma, sans-serif;
|
||||
}
|
||||
.has_event {
|
||||
background-color: #08c;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* day view */
|
||||
#calendar_day .header {
|
||||
@@ -189,7 +224,7 @@
|
||||
}
|
||||
#calendar_day .all_day_event {
|
||||
background: #eee;
|
||||
border: solid 1px #ddd
|
||||
border: solid 1px #ddd;
|
||||
}
|
||||
#calendar_day .event_list .table {
|
||||
border-top: solid 1px #ddd;
|
||||
@@ -223,14 +258,14 @@
|
||||
}
|
||||
#calendar_week .header td {
|
||||
border: solid 1px #ddd;
|
||||
background-color: #eee;
|
||||
/*background-color: #eee;*/
|
||||
}
|
||||
#calendar_week .week_day {
|
||||
padding: 0 2px;
|
||||
border: solid 1px #ddd;
|
||||
}
|
||||
#calendar_week .header .week_day {
|
||||
padding: 1px 2px 10px 2px;
|
||||
padding: 2px 4px 0px 2px;
|
||||
}
|
||||
#calendar_week .event_list .event {
|
||||
position: absolute;
|
||||
@@ -250,7 +285,18 @@
|
||||
#calendar_week .event_holder .inner {
|
||||
margin: 0 8px 0 0;
|
||||
}
|
||||
|
||||
#calendar_week .all_day_event_holder {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
table-layout: fixed;
|
||||
}
|
||||
#calendar_week .all_day_event_holder td {
|
||||
border: 0;
|
||||
background-color: transparent;
|
||||
}
|
||||
#calendar_week .all_day_event {
|
||||
background: #eee;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -290,4 +336,25 @@
|
||||
.miniColors-selector {
|
||||
float: none;
|
||||
margin: 4px 0 0 0;
|
||||
}
|
||||
|
||||
/* create / edit event panel */
|
||||
#tags_panel {
|
||||
top: auto;
|
||||
bottom: 34px;
|
||||
width: 258px;
|
||||
height: 170px;
|
||||
padding: 8px 0;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
clear: none;
|
||||
}
|
||||
#tags_panel .viewport {
|
||||
height: 170px;
|
||||
}
|
||||
#tags_panel .scrollbar {
|
||||
top: 8px;
|
||||
}
|
||||
#tags_list {
|
||||
padding: 8px;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
*This is a manifest file that'll automatically include all the stylesheets available in this directory
|
||||
*and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
||||
*the top of the compiled file, but it's generally better to create a new file per style scope.
|
||||
*= font-awesome
|
||||
*= calendar
|
||||
*= bootstrap-responsive
|
||||
*/
|
||||
Vendored
+306
-35
@@ -1,9 +1,9 @@
|
||||
class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
|
||||
include AdminHelper
|
||||
include Panel::Calendar::BackEnd::CalsHelper
|
||||
|
||||
before_filter :force_order_for_user
|
||||
def index
|
||||
|
||||
@calendars = Cal.all
|
||||
end
|
||||
|
||||
def new
|
||||
@@ -11,6 +11,19 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
|
||||
@calendars = Cal.all
|
||||
end
|
||||
|
||||
def edit
|
||||
@calendar = Cal.find(params[:id])
|
||||
render :layout=>false
|
||||
end
|
||||
|
||||
def update
|
||||
@calendar = Cal.find(params[:id])
|
||||
@calendar.update_attributes(params[:cal])
|
||||
respond_to do |h|
|
||||
h.js
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@calendar = Cal.new(params[:cal])
|
||||
@calendar.save!
|
||||
@@ -26,14 +39,30 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
|
||||
end
|
||||
|
||||
def day_view
|
||||
render :layout => false
|
||||
@date = params[:date].to_i
|
||||
month = params[:month].to_i
|
||||
year = params[:year].to_i
|
||||
@cur_day = getDayName(@date,month,year) + " " + month.to_s + "/" + @date.to_s + " - " + year.to_s
|
||||
@hours = getHours(12)
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
def week_view
|
||||
week = params[:week]
|
||||
year = params[:year]
|
||||
week = params[:week].to_i
|
||||
year = params[:year].to_i
|
||||
@dates = week_dates(week,year)
|
||||
@range = week_range(week,year)
|
||||
@d = getWeekDataSet(week,year)
|
||||
t = Time.now
|
||||
dt = Date.new(t.year,t.month,t.day)
|
||||
today_cur_week = dt.strftime("%U").to_i
|
||||
|
||||
if week == today_cur_week && t.year == year
|
||||
@today = @d.index(t.day.to_s)
|
||||
else
|
||||
@today = 20
|
||||
end
|
||||
@hours = getHours(12)
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
@@ -50,57 +79,299 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
|
||||
end
|
||||
cur_month_days = getMonthDays(year)
|
||||
@post_disabled_days = @pre_disabled_days + cur_month_days[month]
|
||||
@dateset = getDateSet(month,year)
|
||||
@dateset = getDateSet(month,year,true)
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
def agenda_view
|
||||
@start_year = params[:s_year].to_i
|
||||
@start_month = params[:s_month].to_i
|
||||
@end_year = params[:e_year].to_i
|
||||
@end_month = params[:e_month].to_i
|
||||
t = Time.now
|
||||
if !params[:s_year]
|
||||
@start_year = t.year
|
||||
end
|
||||
if !params[:s_month]
|
||||
@start_month = t.month
|
||||
@end_month = t.month + 3
|
||||
if @end_month > 12
|
||||
@end_month = @end_month - 12
|
||||
@end_year = @start_year + 1
|
||||
end
|
||||
end
|
||||
|
||||
startdt = Date.new(@start_year,@start_month,1)
|
||||
temp = getMonthDays(@end_year)
|
||||
enddt = Date.new(@end_year,@end_month,temp[@end_month])
|
||||
diff = enddt - startdt
|
||||
diff = diff.to_i / 30
|
||||
|
||||
|
||||
@d_s_year = @start_year - 5
|
||||
@datesets = Array.new
|
||||
@calendartitle = Array.new
|
||||
@events = Array.new
|
||||
events = Event.all.asc(:start_date).desc(:total_days)
|
||||
@calevents = Array.new
|
||||
y = @start_year
|
||||
m = @start_month
|
||||
for i in 0..diff-1
|
||||
if m == 13
|
||||
m = 1
|
||||
y = y + 1
|
||||
end
|
||||
@calendartitle << [m,y]
|
||||
@datesets << getDateSet(m,y,false)
|
||||
e = Array.new
|
||||
h = Array.new
|
||||
events.each_with_index do |event,i|
|
||||
# @temp = Array.new
|
||||
startdt = Date.new(event.start_year,event.start_month)
|
||||
enddt = Date.new(event.end_year,event.end_month)
|
||||
range = startdt..enddt
|
||||
dt = Date.new(y,m)
|
||||
if range === dt
|
||||
no_of_days = event.total_days
|
||||
start_date = event.start_date
|
||||
|
||||
if event.start_year < y
|
||||
no_of_days = temp[m] - event.start_date
|
||||
no_of_days += 1
|
||||
temp = m + 12
|
||||
if event.start_month < temp
|
||||
start_date = 1
|
||||
end
|
||||
end
|
||||
if event.end_year > y
|
||||
no_of_days = temp[m] - event.start_date
|
||||
no_of_days += 1
|
||||
temp = m + 12
|
||||
end
|
||||
if event.end_month > m
|
||||
no_of_days = temp[m] - event.start_date
|
||||
no_of_days += 1
|
||||
elsif event.end_month == m
|
||||
no_of_days = event.end_date
|
||||
end
|
||||
|
||||
if event.start_month == m && event.end_month == m
|
||||
no_of_days = event.total_days
|
||||
no_of_days += 1
|
||||
end
|
||||
|
||||
if event.start_month < m
|
||||
start_date = 1
|
||||
end
|
||||
|
||||
if event.start_date == event.end_date
|
||||
display_date = getDayName(event.start_date,event.start_month,event.start_year) + ", " + Date::ABBR_MONTHNAMES[event.start_month] + " " + event.start_date.to_s
|
||||
else
|
||||
display_date = getDayName(event.start_date,event.start_month,event.start_year) + ", " + Date::ABBR_MONTHNAMES[event.start_month].to_s + " " + event.start_date.to_s + " - " + getDayName(event.end_date,event.end_month,event.end_year) + ", " + Date::ABBR_MONTHNAMES[event.end_month] + " " + event.end_date.to_s
|
||||
end
|
||||
if event.all_day
|
||||
display_time = "All Day"
|
||||
else
|
||||
x = event.start_time.to_i
|
||||
if event.start_time > x
|
||||
est = x.to_s + ":30"
|
||||
else
|
||||
est = x.to_s
|
||||
end
|
||||
x = event.end_time.to_i
|
||||
if event.end_time > x
|
||||
eet = x.to_s + ":30"
|
||||
else
|
||||
eet = x.to_s
|
||||
end
|
||||
display_time = est + " " + event.start_am_pm + " - " + eet + " " + event.end_am_pm
|
||||
end
|
||||
for c in start_date..(start_date + no_of_days)
|
||||
if h.index(c) == nil
|
||||
h << c
|
||||
end
|
||||
end
|
||||
color = Cal.find(event.cal_id).color
|
||||
e << {"display_date"=>display_date,"show_link"=>panel_calendar_back_end_event_path(event), "display_time"=>display_time, "start_date"=>start_date,"end_date"=>event.end_date,"start_month"=>event.start_month,"end_month"=>event.end_month,"title" => event.title,"color"=>color}
|
||||
end
|
||||
end
|
||||
@events << e
|
||||
@calevents << h
|
||||
m = m + 1
|
||||
end
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
def get_month_events
|
||||
month = params[:month]
|
||||
year = params[:year]
|
||||
month = month.to_i
|
||||
year = year.to_i
|
||||
events = Event.where(:start_month.lt => month).and(:start_year => year).and(:end_month.gte => month).asc(:start_date).desc(:total_days)
|
||||
month = params[:month].to_i
|
||||
year = params[:year].to_i
|
||||
fromcalendars = params[:calendars]
|
||||
|
||||
# events = Event.where(:start_month.lt => month).and(:start_year => year).and(:end_month.gte => month).asc(:start_date).desc(:total_days)
|
||||
@events = Array.new
|
||||
no_of_days_in_month = getMonthDays(year)
|
||||
events.each_with_index do |event,i|
|
||||
no_of_days = event.total_days
|
||||
# events.each_with_index do |event,i|
|
||||
# no_of_days = event.total_days
|
||||
|
||||
if event.end_month > month
|
||||
no_of_days = no_of_days_in_month[month]
|
||||
elsif event.end_month == month
|
||||
no_of_days = event.end_date
|
||||
end
|
||||
# if event.end_month > month
|
||||
# no_of_days = no_of_days_in_month[month]
|
||||
# elsif event.end_month == month
|
||||
# no_of_days = event.end_date
|
||||
# end
|
||||
|
||||
no_of_days = no_of_days.to_i
|
||||
# no_of_days = no_of_days.to_i
|
||||
|
||||
color = Cal.find(event.cal_id).color
|
||||
@events << {"id"=>event.id,"index"=>i,"start_date"=>"1", "total_days" => no_of_days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event)}
|
||||
end
|
||||
events = Event.where(:start_month => month).and(:start_year => year).asc(:start_date).desc(:total_days)
|
||||
# color = Cal.find(event.cal_id).color
|
||||
# @events << {"id"=>event.id,"index"=>i,"start_date"=>"1", "total_days" => no_of_days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event)}
|
||||
# end
|
||||
# events = Event.where(:start_month => month).and(:start_year => year).asc(:start_date).desc(:total_days)
|
||||
# events.each_with_index do |event,i|
|
||||
# # @temp = Array.new
|
||||
# no_of_days = event.total_days
|
||||
# if event.end_month > month
|
||||
# no_of_days = no_of_days_in_month[month] - event.start_date
|
||||
# end
|
||||
# no_of_days = no_of_days.to_i
|
||||
# no_of_days += 1
|
||||
|
||||
# color = Cal.find(event.cal_id).color
|
||||
# @events << {"id"=>event.id,"index"=>i,"start_date"=>event.start_date, "total_days" => no_of_days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event)}
|
||||
# end
|
||||
events = Event.where(:cal_id.in=>fromcalendars).asc(:start_date).desc(:total_days)
|
||||
events.each_with_index do |event,i|
|
||||
# @temp = Array.new
|
||||
no_of_days = event.total_days
|
||||
if event.end_month > month
|
||||
no_of_days = no_of_days_in_month[month] - event.start_date
|
||||
end
|
||||
no_of_days = no_of_days.to_i
|
||||
no_of_days += 1
|
||||
color = Cal.find(event.cal_id).color
|
||||
@events << {"id"=>event.id,"index"=>i,"start_date"=>event.start_date, "total_days" => no_of_days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event)}
|
||||
startdt = Date.new(event.start_year,event.start_month)
|
||||
enddt = Date.new(event.end_year,event.end_month)
|
||||
range = startdt..enddt
|
||||
|
||||
dt = Date.new(year,month)
|
||||
if range === dt
|
||||
no_of_days = event.total_days
|
||||
start_date = event.start_date
|
||||
|
||||
if event.start_year < year
|
||||
no_of_days = no_of_days_in_month[month] - event.start_date
|
||||
no_of_days += 1
|
||||
temp = month + 12
|
||||
if event.start_month < temp
|
||||
start_date = 1
|
||||
end
|
||||
end
|
||||
if event.end_year > year
|
||||
no_of_days = no_of_days_in_month[month] - event.start_date
|
||||
no_of_days += 1
|
||||
temp = month + 12
|
||||
end
|
||||
if event.end_month > month
|
||||
no_of_days = no_of_days_in_month[month] - event.start_date
|
||||
no_of_days += 1
|
||||
elsif event.end_month == month
|
||||
no_of_days = event.end_date
|
||||
end
|
||||
|
||||
if event.start_month == month && event.end_month == month
|
||||
no_of_days = event.total_days
|
||||
no_of_days += 1
|
||||
end
|
||||
|
||||
if event.start_month < month
|
||||
start_date = 1
|
||||
end
|
||||
|
||||
color = Cal.find(event.cal_id).color
|
||||
@events << {"start_year"=>event.start_year, "id"=>event.id,"index"=>i,"start_date"=>start_date, "total_days" => no_of_days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event)}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
render :json => @events.to_json
|
||||
end
|
||||
|
||||
def get_week_events
|
||||
week = params[:week]
|
||||
year = params[:year]
|
||||
events = Event.where(:start_week => week).and(:start_year => year)
|
||||
render :json => events.to_json
|
||||
week = params[:week].to_i
|
||||
year = params[:year].to_i
|
||||
fromcalendars = params[:calendars]
|
||||
@d = getWeekDataSet(week,year)
|
||||
events = Event.where(:cal_id.in=>fromcalendars).and(:start_week.lte => week).and(:start_year => year).and(:end_week.gte => week).and(:start_year => year).asc(:start_week).asc(:start_date)
|
||||
@events = Array.new
|
||||
events.each_with_index do |event,i|
|
||||
# @temp = Array.new
|
||||
days = event.total_days.to_i + 1
|
||||
colcount = 0
|
||||
startdt = event.start_date
|
||||
|
||||
all_day = event.all_day
|
||||
|
||||
if days > 1
|
||||
all_day = true
|
||||
end
|
||||
|
||||
if event.end_week > week && event.start_week < week
|
||||
days = 7
|
||||
end
|
||||
|
||||
if event.end_week == week
|
||||
days = @d.index(event.end_date.to_s).to_i
|
||||
end
|
||||
|
||||
if event.start_week == week
|
||||
days = 7 - @d.index(event.start_date.to_s).to_i
|
||||
end
|
||||
|
||||
|
||||
if event.start_week == week && event.end_week == week
|
||||
x = @d.index(event.end_date.to_s).to_i
|
||||
y = @d.index(event.start_date.to_s).to_i
|
||||
colcount = x - y
|
||||
colcount+=1
|
||||
|
||||
end
|
||||
|
||||
if event.start_week < week
|
||||
startdt = @d[0].to_i
|
||||
event.all_day = true
|
||||
if event.end_week == week
|
||||
colcount = 7 - @d.index(event.end_date.to_s).to_i
|
||||
days = 7;
|
||||
startdt = event.start_date
|
||||
end
|
||||
end
|
||||
|
||||
color = Cal.find(event.cal_id).color
|
||||
@events << {"id"=>event.id,"index"=>i,"start_date"=>startdt,"end_date"=>event.end_date ,"all_day"=>all_day, "start_week" => event.start_week, "end_week" => event.end_week, "total_days" => days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event),"start_time"=>event.start_time,"end_time"=>event.end_time,"start_am_pm"=>event.start_am_pm,"end_am_pm"=>event.end_am_pm,"colcount"=>colcount}
|
||||
end
|
||||
render :json => @events.to_json
|
||||
end
|
||||
|
||||
def get_day_events
|
||||
day = params[:date].to_i
|
||||
month = params[:month].to_i
|
||||
year = params[:year].to_i
|
||||
fromcalendars = params[:calendars]
|
||||
dt = Date.new(year,month,day)
|
||||
week = dt.strftime("%U")
|
||||
events = Event.where(:start_month.lte => month).and(:start_year => year).and(:end_month.gte => month)
|
||||
@events = Array.new
|
||||
events.each_with_index do |event,i|
|
||||
days = event.total_days.to_i + 1
|
||||
colcount = 0
|
||||
|
||||
all_day = event.all_day
|
||||
|
||||
if days > 1
|
||||
all_day = true
|
||||
end
|
||||
startdt = Date.new(event.start_year,event.start_month,event.start_date)
|
||||
enddt = Date.new(event.end_year,event.end_month,event.end_date)
|
||||
|
||||
range = startdt..enddt
|
||||
|
||||
if range === dt
|
||||
color = Cal.find(event.cal_id).color
|
||||
@events << {"id"=>event.id,"index"=>i,"start_date"=>event.start_date,"end_date"=>event.end_date ,"all_day"=>all_day, "start_week" => event.start_week, "end_week" => event.end_week, "total_days" => days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event),"start_time"=>event.start_time,"end_time"=>event.end_time,"start_am_pm"=>event.start_am_pm,"end_am_pm"=>event.end_am_pm}
|
||||
end
|
||||
end
|
||||
render :json => @events.to_json
|
||||
end
|
||||
|
||||
def week_number_test
|
||||
|
||||
Vendored
+129
-6
@@ -8,10 +8,47 @@ class Panel::Calendar::BackEnd::EventsController < OrbitBackendController
|
||||
else
|
||||
@all_day_disabled = false
|
||||
end
|
||||
@placeholder = params[:date]+"/"+params[:month]+"/"+params[:year]
|
||||
@hours = getHoursForForm
|
||||
if params[:time]
|
||||
|
||||
@hours.each_with_index do |h,i|
|
||||
if h['val'].to_s == params[:time].to_s
|
||||
@sindex = i
|
||||
@eindex = i + 2
|
||||
break
|
||||
end
|
||||
end
|
||||
else
|
||||
@sindex = 16
|
||||
@eindex = 18
|
||||
end
|
||||
@ampm = Array.new
|
||||
@ampm << "AM"
|
||||
@ampm << "PM"
|
||||
if params[:ses]
|
||||
@sampm = params[:ses]
|
||||
@eampm = params[:ses]
|
||||
if @eindex >= 22
|
||||
@eampm = "PM"
|
||||
end
|
||||
end
|
||||
@placeholder = params[:month]+"/"+params[:date]+"/"+params[:year]
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
def edit
|
||||
@calendars = Cal.all
|
||||
@event = Event.find(params[:id])
|
||||
if @event.all_day
|
||||
@all_day_disabled = true
|
||||
else
|
||||
@all_day_disabled = false
|
||||
end
|
||||
@hours = getHoursForForm
|
||||
@ampm = Array.new
|
||||
@ampm << "AM"
|
||||
@ampm << "PM"
|
||||
render :layout => false
|
||||
end
|
||||
def create
|
||||
title = params[:event][:title]
|
||||
note = params[:event][:note]
|
||||
@@ -21,14 +58,14 @@ class Panel::Calendar::BackEnd::EventsController < OrbitBackendController
|
||||
$endtime = params[:end_time]
|
||||
|
||||
temp = $start.split("/")
|
||||
start_date = temp[0]
|
||||
start_month = temp[1]
|
||||
start_month = temp[0]
|
||||
start_date = temp[1]
|
||||
start_year = temp[2]
|
||||
@m = start_month
|
||||
@y = start_year
|
||||
temp = $end.split("/")
|
||||
end_date = temp[0]
|
||||
end_month = temp[1]
|
||||
end_month = temp[0]
|
||||
end_date = temp[1]
|
||||
end_year = temp[2]
|
||||
|
||||
start_am_pm = params[:start_am_pm]
|
||||
@@ -42,6 +79,13 @@ class Panel::Calendar::BackEnd::EventsController < OrbitBackendController
|
||||
# if end_am_pm == "PM"
|
||||
# temp_end_time = $endtime + 12
|
||||
# end
|
||||
if params[:all_day]
|
||||
all_day = true
|
||||
$starttime = 0
|
||||
$endtime = 0
|
||||
else
|
||||
all_day = false
|
||||
end
|
||||
|
||||
final_start_time = Date.new(start_year.to_i,start_month.to_i,start_date.to_i)
|
||||
final_end_time = Date.new(end_year.to_i,end_month.to_i,end_date.to_i)
|
||||
@@ -67,12 +111,85 @@ class Panel::Calendar::BackEnd::EventsController < OrbitBackendController
|
||||
@event.total_days = total_days
|
||||
@event.start_week = start_week
|
||||
@event.end_week = end_week
|
||||
@event.all_day = all_day
|
||||
@event.save!
|
||||
|
||||
respond_to do |h|
|
||||
h.js
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
title = params[:event][:title]
|
||||
note = params[:event][:note]
|
||||
$start = params[:start_date]
|
||||
$end = params[:end_date]
|
||||
$starttime = params[:start_time]
|
||||
$endtime = params[:end_time]
|
||||
|
||||
temp = $start.split("/")
|
||||
start_month = temp[0]
|
||||
start_date = temp[1]
|
||||
start_year = temp[2]
|
||||
@m = start_month
|
||||
@y = start_year
|
||||
temp = $end.split("/")
|
||||
end_month = temp[0]
|
||||
end_date = temp[1]
|
||||
end_year = temp[2]
|
||||
|
||||
start_am_pm = params[:start_am_pm]
|
||||
end_am_pm = params[:end_am_pm]
|
||||
|
||||
cal_id = params[:event][:cal_id]
|
||||
|
||||
# if start_am_pm == "PM"
|
||||
# temp_start_time = $starttime + 12
|
||||
# end
|
||||
# if end_am_pm == "PM"
|
||||
# temp_end_time = $endtime + 12
|
||||
# end
|
||||
if params[:all_day]
|
||||
all_day = true
|
||||
$starttime = 0
|
||||
$endtime = 0
|
||||
else
|
||||
all_day = false
|
||||
end
|
||||
|
||||
final_start_time = Date.new(start_year.to_i,start_month.to_i,start_date.to_i)
|
||||
final_end_time = Date.new(end_year.to_i,end_month.to_i,end_date.to_i)
|
||||
start_week = final_start_time.strftime("%U")
|
||||
end_week = final_end_time.strftime("%U")
|
||||
total_days = final_end_time - final_start_time
|
||||
@event = Event.find(params[:id])
|
||||
@event.title = title
|
||||
@event.note = note
|
||||
@event.start_year = start_year
|
||||
@event.end_year = end_year
|
||||
@event.start_month = start_month
|
||||
@event.end_month = end_month
|
||||
@event.start_date = start_date
|
||||
@event.end_date = end_date
|
||||
@event.start_time = $starttime
|
||||
@event.start_am_pm = start_am_pm
|
||||
@event.end_time = $endtime
|
||||
@event.end_am_pm = end_am_pm
|
||||
@event.cal_id = cal_id
|
||||
@event.final_start_time = final_start_time
|
||||
@event.final_end_time = final_end_time
|
||||
@event.total_days = total_days
|
||||
@event.start_week = start_week
|
||||
@event.end_week = end_week
|
||||
@event.all_day = all_day
|
||||
@event.save!
|
||||
|
||||
respond_to do |h|
|
||||
h.js
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@event = Event.find(params[:id])
|
||||
@start_month_name = Date::ABBR_MONTHNAMES[@event.start_month]
|
||||
@@ -81,6 +198,12 @@ class Panel::Calendar::BackEnd::EventsController < OrbitBackendController
|
||||
@end_day_name = getDayName(@event.end_date,@event.end_month,@event.end_year)
|
||||
render :layout=>false
|
||||
end
|
||||
|
||||
def destroy
|
||||
event = Event.find(params[:id])
|
||||
event.delete
|
||||
render :json => {"success"=>"true"}.to_json
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
class Panel::Calendar::BackEnd::TagsController < Admin::TagsController
|
||||
def initialize
|
||||
super
|
||||
@app_title = 'calendar'
|
||||
end
|
||||
end
|
||||
+76
-4
@@ -6,7 +6,7 @@ module Panel::Calendar::BackEnd::CalsHelper
|
||||
return startday
|
||||
end
|
||||
|
||||
def getDateSet(month,year)
|
||||
def getDateSet(month,year,prepost)
|
||||
dateset = Array.new
|
||||
startday = monthStartDay(month,year)
|
||||
monthsdays = getMonthDays(year)
|
||||
@@ -20,7 +20,11 @@ module Panel::Calendar::BackEnd::CalsHelper
|
||||
i = prev_month_days_to_add
|
||||
while i > 0 do
|
||||
i -= 1
|
||||
dateset << prev_month_days - i
|
||||
if prepost
|
||||
dateset << prev_month_days - i
|
||||
else
|
||||
dateset << "NaN"
|
||||
end
|
||||
end
|
||||
|
||||
i = 0
|
||||
@@ -29,11 +33,21 @@ module Panel::Calendar::BackEnd::CalsHelper
|
||||
i += 1
|
||||
end
|
||||
|
||||
next_month_days_to_add = 42 - (prev_month_days_to_add + cur_month_days)
|
||||
total_days = 42
|
||||
if !prepost
|
||||
if (prev_month_days_to_add + cur_month_days) < 35
|
||||
total_days = 35
|
||||
end
|
||||
end
|
||||
next_month_days_to_add = total_days - (prev_month_days_to_add + cur_month_days)
|
||||
|
||||
i = 0
|
||||
while i < next_month_days_to_add do
|
||||
dateset << i + 1
|
||||
if prepost
|
||||
dateset << i + 1
|
||||
else
|
||||
dateset << "NaN"
|
||||
end
|
||||
i += 1
|
||||
end
|
||||
|
||||
@@ -131,6 +145,64 @@ module Panel::Calendar::BackEnd::CalsHelper
|
||||
end
|
||||
range
|
||||
end
|
||||
|
||||
def getWeekDataSet(week_num,year)
|
||||
year = year.to_i
|
||||
week_num = week_num.to_i
|
||||
dates = Array.new
|
||||
|
||||
if week_num == 1
|
||||
weekstartday = monthStartDay(1,year)
|
||||
d = 31
|
||||
x = 0
|
||||
for i in d - (weekstartday - 2)..d
|
||||
dates << i.to_s
|
||||
x = x + 1
|
||||
end
|
||||
for i in 1..8 - weekstartday
|
||||
dates << i.to_s
|
||||
x = x + 1
|
||||
end
|
||||
else
|
||||
week_start = Date.commercial(year, week_num-1, 7)
|
||||
month = week_start.strftime("%m")
|
||||
month_days = getMonthDays(year)
|
||||
date = week_start.strftime("%d")
|
||||
x = date.to_i
|
||||
for i in 0..6
|
||||
d = x + i
|
||||
if d > month_days[month.to_i]
|
||||
d = d - month_days[month.to_i]
|
||||
end
|
||||
dates << d.to_s
|
||||
end
|
||||
end
|
||||
dates
|
||||
end
|
||||
|
||||
def getHours(format)
|
||||
hours = Array.new
|
||||
if format == 12
|
||||
hours << 12
|
||||
for i in 1..11
|
||||
hours << i
|
||||
end
|
||||
elsif format == 24
|
||||
for i in 0..23
|
||||
hours << i
|
||||
end
|
||||
end
|
||||
hours
|
||||
end
|
||||
|
||||
def getHoursForForm
|
||||
hours = Array.new
|
||||
for i in 1..12
|
||||
hours << {"val"=>i,"title"=>i.to_s+":00"}
|
||||
hours << {"val"=>i+0.5,"title"=>i.to_s+":30"}
|
||||
end
|
||||
hours
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ class Event
|
||||
field :final_start_time, type: Date
|
||||
field :final_end_time, type: Date
|
||||
field :total_days, type: Integer
|
||||
field :all_day, type: Boolean
|
||||
|
||||
belongs_to :cal
|
||||
|
||||
|
||||
+4
-2
@@ -1,10 +1,12 @@
|
||||
<tr class="with_action" for="<%= calendar.id.to_s %>">
|
||||
<td>
|
||||
<span class="calendars_color_tag" style="background-color: <%= calendar.color %>"></span>
|
||||
<div id="edit_area_<%= calendar.id %>" style="display:hidden;"></div>
|
||||
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<li><a href="">Edit</a></li>
|
||||
<li><%= link_to t("calendar.delete"), panel_calendar_back_end_cal_path(calendar), :method => "delete",:remote => true, :confirm => t("gallery.sure?"),:class=>"btn-del-a", "data-content"=>calendar.id.to_s %></li>
|
||||
<li><%= link_to t("calendar.edit"), edit_panel_calendar_back_end_cal_path(calendar), :remote => true, :class=>"btn-edit-a", :for => calendar.id %></li>
|
||||
<li><%= link_to t("calendar.delete"), panel_calendar_back_end_cal_path(calendar), :method => "delete",:remote => true, :confirm => t("calendar.sure?"),:class=>"btn-del-a", "data-content"=>calendar.id.to_s %></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
Vendored
+108
-46
@@ -1,48 +1,110 @@
|
||||
<div id="agenda_date_range" style="display:none;">
|
||||
<label>From</label> <select name="start_month" class='input-small'>
|
||||
<% for i in 1..12 %>
|
||||
<% if i == @start_month %>
|
||||
<option value="<%= i %>" selected="selected"><%= Date::MONTHNAMES[i] %></option>
|
||||
<% else %>
|
||||
<option value="<%= i %>"><%= Date::MONTHNAMES[i] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
<select name="start_year" class='input-small'>
|
||||
<% for i in 1..10 %>
|
||||
<% if (@d_s_year + i) == @start_year %>
|
||||
<option value="<%= @d_s_year + i %>" selected="selected"><%= @d_s_year + i %></option>
|
||||
<% else %>
|
||||
<option value="<%= @d_s_year + i %>"><%= @d_s_year + i %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
<label>To</label> <select name="end_month" class='input-small'>
|
||||
<% for i in 1..12 %>
|
||||
<% if i == @end_month %>
|
||||
<option value="<%= i %>" selected="selected"><%= Date::MONTHNAMES[i] %></option>
|
||||
<% else %>
|
||||
<option value="<%= i %>"><%= Date::MONTHNAMES[i] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
<select name="end_year" class='input-small'>
|
||||
<% for i in 1..10 %>
|
||||
<% if (@d_s_year + i) == @end_year %>
|
||||
<option value="<%= @d_s_year + i %>" selected="selected"><%= @d_s_year + i %></option>
|
||||
<% elsif (@d_s_year + i) <= @start_year %>
|
||||
<option value="<%= @d_s_year + i %>" disabled='disabled'><%= @d_s_year + i %></option>
|
||||
<% else %>
|
||||
<option value="<%= @d_s_year + i %>"><%= @d_s_year + i %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
<button class="btn bt-filter">Show Events</button>
|
||||
</div>
|
||||
<div id="calendar_agenda">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span2"></th>
|
||||
<th class="span2"></th>
|
||||
<th class=""></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="today">Thu, Sep 6</th>
|
||||
<td class="event_time">9:00am - 9:30am</td>
|
||||
<td>
|
||||
<div class="event" style="color: #ffcc00;">Commuting time, from home to RD</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td class="event_time">9:30am - 12:00am</td>
|
||||
<td>
|
||||
<div class="event" style="color: #ffcc00;">Work on Thu project, and ask ika for help if possible</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td class="event_time">13:30pm - 18:00pm</td>
|
||||
<td>
|
||||
<div class="event" style="color: #ffcc00;">Template design, at least finish 2 template</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Fri, Sep 7</th>
|
||||
<td class="event_time">9:00am - 18:00pm</td>
|
||||
<td>
|
||||
<div class="event" style="color: #ddee00;">Take a day off</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Sat, Sep 8</th>
|
||||
<td class="event_time">7:00am - 7:50pm</td>
|
||||
<td>
|
||||
<div class="event" style="color: #00ddee;">Work out with Joseph</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<% @datesets.each_with_index do |dateset,i| %>
|
||||
<div class="row-fluid">
|
||||
<div class="span3">
|
||||
<h4><%= Date::MONTHNAMES[@calendartitle[i][0]] + " - " + @calendartitle[i][1].to_s %></h4>
|
||||
<div class="tiny_calendar">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th class="week_title">Sun</th>
|
||||
<th class="week_title">Mon</th>
|
||||
<th class="week_title">Tue</th>
|
||||
<th class="week_title">Wed</th>
|
||||
<th class="week_title">Thu</th>
|
||||
<th class="week_title">Fri</th>
|
||||
<th class="week_title">Sat</th>
|
||||
</tr>
|
||||
<% x = 0 %>
|
||||
<% dateset.each do |date| %>
|
||||
<% x = x + 1 %>
|
||||
<% if x == 1 %>
|
||||
<tr>
|
||||
<% end %>
|
||||
<td <%= (@calevents[i].index(date.to_i) != nil ? "class=has_event" : "") %> ><%= (date=="NaN"? "" : date ) %></td>
|
||||
<% if x == 7 %>
|
||||
<% x = 0 %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!-- <td class="has_event">13</td> -->
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="span9">
|
||||
<table class="table event_list">
|
||||
<thead>
|
||||
<tr height="0">
|
||||
<th class="span3"></th>
|
||||
<th class="span2"></th>
|
||||
<th class=""></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% lastday = "" %>
|
||||
<% if @events[i].count > 0 %>
|
||||
<% @events[i].each do |event| %>
|
||||
<tr>
|
||||
<th>
|
||||
<% if event['display_date'] != lastday %>
|
||||
<%= event['display_date'] %>
|
||||
<% end %>
|
||||
</th>
|
||||
<td class="event_time"><%= event['display_time'] %></td>
|
||||
<td>
|
||||
<div class="event" link="<%= event['show_link'] %>" style="color: <%= event['color'] %>;"><%= event['title'] %></div>
|
||||
</td>
|
||||
</tr>
|
||||
<% lastday = event['display_date'] %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<tr>
|
||||
<td colspan='3'>No events for this month.</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
+52
-130
@@ -3,14 +3,14 @@
|
||||
<tr>
|
||||
<th class="span1"></th>
|
||||
<th>
|
||||
<h2>Sunday 9/2</h2>
|
||||
<h2 id="day_header" style="display:none;"><%= @cur_day %></h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="all_day_event">
|
||||
<div class="event" style="background-color: #ffcc00;">event1</div>
|
||||
<div class="event" style="background-color: #ffcc00;">event2</div>
|
||||
<!-- <div class="event" style="background-color: #ffcc00;">event1</div>
|
||||
<div cla ss="event" style="background-color: #ffcc00;">event2</div> -->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -18,136 +18,58 @@
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td style="width: 60px;">
|
||||
<div class="day_time">12am</div>
|
||||
<div class="day_time">1am</div>
|
||||
<div class="day_time">2am</div>
|
||||
<div class="day_time">3am</div>
|
||||
<div class="day_time">4am</div>
|
||||
<div class="day_time">5am</div>
|
||||
<div class="day_time">6am</div>
|
||||
<div class="day_time">7am</div>
|
||||
<div class="day_time">8am</div>
|
||||
<div class="day_time">9am</div>
|
||||
<div class="day_time">10am</div>
|
||||
<div class="day_time">11am</div>
|
||||
<div class="day_time">12am</div>
|
||||
<div class="day_time">1pm</div>
|
||||
<div class="day_time">2pm</div>
|
||||
<div class="day_time">3pm</div>
|
||||
<div class="day_time">4pm</div>
|
||||
<div class="day_time">5pm</div>
|
||||
<div class="day_time">6pm</div>
|
||||
<div class="day_time">7pm</div>
|
||||
<div class="day_time">8pm</div>
|
||||
<div class="day_time">9pm</div>
|
||||
<div class="day_time">10pm</div>
|
||||
<div class="day_time">11pm</div>
|
||||
<% @hours.each do |hour| %>
|
||||
<div class="day_time"><%= hour %>am</div>
|
||||
<% end %>
|
||||
<% @hours.each do |hour| %>
|
||||
<div class="day_time"><%= hour %>pm</div>
|
||||
<% end %>
|
||||
</td>
|
||||
<td style="position: relative;">
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="event_holder">
|
||||
<div class="inner">
|
||||
<div class="event" style="background-color: #66cc00; top: 0;">
|
||||
<dl>
|
||||
<dt>10:30am - 11:00am</dt>
|
||||
<dd>template</dd>
|
||||
</dl>
|
||||
<td>
|
||||
<div class="event_list_wrapper">
|
||||
<% @hours.each do |hour| %>
|
||||
<div class="cell click_event" time="<%= hour.to_s+".5" %>" ref="add-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @date.to_s %>" ses="AM">
|
||||
<div class="divide click_event" time="<%= hour %>" ref="add-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @date.to_s %>" ses="AM"></div>
|
||||
</div>
|
||||
<div class="event" style="background-color: #00aacc; top: 39px;">
|
||||
<dl>
|
||||
<dt>10:30am - 11:00am</dt>
|
||||
<dd>template</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="event half" style="background-color: #ccffee; top: 117px;">
|
||||
<dl>
|
||||
<dt>10:30am - template</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="event" style="background-color: #00ffee; top: 195px; width: 85%;">
|
||||
<dl>
|
||||
<dt>10:30am - 11:00am</dt>
|
||||
<dd>template</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="event over" style="background-color: #00ccee; top: 214px; left: 50%; width: 50%;">
|
||||
<dl>
|
||||
<dt>10:30am - 11:00am</dt>
|
||||
<dd>template</dd>
|
||||
</dl>
|
||||
<% end %>
|
||||
<% @hours.each do |hour| %>
|
||||
<div class="cell click_event" time="<%= hour.to_s+".5" %>" ref="add-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @date.to_s %>" ses="PM">
|
||||
<div class="divide click_event" time="<%= hour %>" ref="add-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @date.to_s %>" ses="PM"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="event_holder">
|
||||
<!-- <div class="inner">
|
||||
<div class="event" style="background-color: #66cc00; top: 0;">
|
||||
<dl>
|
||||
<dt>10:30am - 11:00am</dt>
|
||||
<dd>template</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="event" style="background-color: #00aacc; top: 39px;">
|
||||
<dl>
|
||||
<dt>10:30am - 11:00am</dt>
|
||||
<dd>template</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="event half" style="background-color: #ccffee; top: 117px;">
|
||||
<dl>
|
||||
<dt>10:30am - template</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="event" style="background-color: #00ffee; top: 195px; width: 85%;">
|
||||
<dl>
|
||||
<dt>10:30am - 11:00am</dt>
|
||||
<dd>template</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="event over" style="background-color: #00ccee; top: 214px; left: 50%; width: 50%;">
|
||||
<dl>
|
||||
<dt>10:30am - 11:00am</dt>
|
||||
<dd>template</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
<%= form_for @calendar, :url => panel_calendar_back_end_cal_path(@calendar), :remote => true do |f| %>
|
||||
<h4>Edit</h4>
|
||||
<div class="row-fluid">
|
||||
<div class="span2">
|
||||
<%= label_tag("color", t("calendar.color")) %>
|
||||
<%= f.text_field :color, :class => "color-picker miniColors", :size => "5", :maxlength => "5", :autocomplete=>"off",:value=>@calendar.color %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= f.fields_for :name_translations do |name| %>
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag(locale, t("calendar.name")+"-"+I18nVariable.from_locale(locale)) %>
|
||||
<div class="controls">
|
||||
<%= name.text_field locale, :class => "input-xxlarge", :size=>"30", :value=>@calendar.name_translations[locale] %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="">
|
||||
<%= f.submit t("calendar.save"), :class=>"btn btn-primary" %>
|
||||
<button class="btn btn-primary bt-cancel" for="<%= @calendar.id %>">Cancel</button>
|
||||
</div>
|
||||
<% end %>
|
||||
+24
-19
@@ -1,10 +1,8 @@
|
||||
<%= stylesheet_link_tag "font-awesome" %>
|
||||
<%= stylesheet_link_tag "calendar" %>
|
||||
<%= stylesheet_link_tag "bootstrap-responsive" %>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "calendarAPI" %>
|
||||
<% end %>
|
||||
|
||||
<%= stylesheet_link_tag "calendar" %>
|
||||
<%= javascript_include_tag "cals" %>
|
||||
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.9.0/themes/cupertino/jquery-ui.css">
|
||||
<div id="filter" class="subnav">
|
||||
<ul class="nav nav-pills filter">
|
||||
<li class="accordion-group">
|
||||
@@ -16,9 +14,9 @@
|
||||
<div class="filters">
|
||||
<div class="accordion-body collapse" id="collapse-categories">
|
||||
<div class="accordion-inner filter_btns cats" data-toggle="buttons-checkbox">
|
||||
<a href="" class="btn" onclick="return false;"><span class="calendar_color_tag" style="background-color: #ffcc00;"></span>Calendar1</a>
|
||||
<a href="" class="btn" onclick="return false;"><span class="calendar_color_tag" style="background-color: #ff6600;"></span>Calendar2</a>
|
||||
<a href="" class="btn" onclick="return false;"><span class="calendar_color_tag" style="background-color: #ff4400;"></span>Calendar3</a>
|
||||
<% @calendars.each do |calendar| %>
|
||||
<a href="<%= calendar.id.to_s %>" class="btn active calendar-filter-btn" onclick="return false;"><span class="calendar_color_tag" style="background-color: <%= calendar.color %>;" ></span><%= calendar.name %></a>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="filter-clear">
|
||||
<a href="" class="btn" onclick="return false;" for="cats"><i class="icons-brush-large"></i>Clear</a>
|
||||
@@ -27,9 +25,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="orbit_calendar" class="month_view">
|
||||
<div class="row-fluid">
|
||||
<div class="span3">
|
||||
<div class="btn-toolbar" style="margin:0;">
|
||||
<div class="row-fluid cal-fn">
|
||||
<div class="span3" id='sec1'>
|
||||
<div class="btn-toolbar" id="navigation" style="margin:0;">
|
||||
<div class="btn-group">
|
||||
<button class="btn" id="today_btn">Today</button>
|
||||
</div>
|
||||
@@ -38,16 +36,23 @@
|
||||
<button class="btn" id="next_month_btn"><span class="icon-chevron-right"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-inline" id="range_selection" style="display:none;margin:0;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="span5">
|
||||
<div class="span5" id='sec2'>
|
||||
<h4 class="current_day_title"></h4>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<div class="btn-group calendar_mode" data-toggle="buttons-radio">
|
||||
<button class="btn mode_switch">day</button>
|
||||
<button class="btn mode_switch">week</button>
|
||||
<button class="btn active mode_switch">month</button>
|
||||
<button class="btn mode_switch">agenda</button>
|
||||
<div class="span4" id='sec3'>
|
||||
<div class="btn-toolbar" style="margin:0; text-align:right;">
|
||||
<div class="btn-group calendar_mode" data-toggle="buttons-radio">
|
||||
<button class="btn mode_switch">day</button>
|
||||
<button class="btn mode_switch">week</button>
|
||||
<button class="btn active mode_switch">month</button>
|
||||
<button class="btn mode_switch">agenda</button>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button id="refresh_btn" class="btn icon-refresh"></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -64,7 +69,7 @@
|
||||
</div>
|
||||
<div id="event_create" class="modal" style="right: 8px; bottom: 50px; left: auto; top: auto; width: 380px; margin: 0;display:none;"></div>
|
||||
|
||||
<div id="event_quick_view" class="modal" style="width: 300px; top: 60%;display:none"></div>
|
||||
<div id="event_quick_view" class="modal" style="width: 300px; display:none; margin:0 0 0 0;"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var calendar = new calendarAPI();
|
||||
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
var tr = $("<%= j render :partial=>'calendar', :object=>@calendar %>");
|
||||
$("#calendar_list tr[for=<%= @calendar.id %>]").empty().html(tr.html());
|
||||
+67
-93
@@ -3,120 +3,87 @@
|
||||
<table class="table header">
|
||||
<tr>
|
||||
<th style="width: 44px;"></th>
|
||||
<% @dates.each do |day| %>
|
||||
<th><%= day %></th>
|
||||
<% @dates.each_with_index do |day,i| %>
|
||||
<% if @today == i %>
|
||||
<th class='today'><%= day %></th>
|
||||
<% else %>
|
||||
<th><%= day %></th>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 0; background: none;"></td>
|
||||
<td class="all_day_event week_day">
|
||||
<td colspan="8" style="border:0;">
|
||||
<div class="event_list_wrapper head_event_wrapper" style="height:50px;">
|
||||
<table style="position: absolute; width: 100%; height: 50px; top: 0;">
|
||||
<tr>
|
||||
<td style="border: 0; background: none; width: 60px;"></td>
|
||||
<% @d.each_with_index do |dt,i| %>
|
||||
<% if @today == i %>
|
||||
<td class="all_day_event week_day week_day_header today" date='<%= dt %>'></td>
|
||||
<% else %>
|
||||
<td class="all_day_event week_day week_day_header" date='<%= dt %>'></td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="all_day_event_holder">
|
||||
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
<!-- <div class="event half" style="background-color: #ccffee;">
|
||||
<dl>
|
||||
<dt>10:30am - template</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
</div> -->
|
||||
</td>
|
||||
<td class="all_day_event week_day">
|
||||
<!-- <td class="all_day_event week_day">
|
||||
</td>
|
||||
<td class="all_day_event week_day"></td>
|
||||
<td class="all_day_event week_day">
|
||||
<!-- <div class="event half" style="background-color: #ccffee;">
|
||||
<div class="event half" style="background-color: #ccffee;">
|
||||
<dl>
|
||||
<dt>10:30am - template</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
</div> -->
|
||||
</div>
|
||||
</td>
|
||||
<td class="all_day_event week_day"></td>
|
||||
<td class="all_day_event week_day"></td>
|
||||
<td class="all_day_event week_day"></td>
|
||||
<td class="all_day_event week_day"></td> -->
|
||||
</tr>
|
||||
</table>
|
||||
<div class="event_list">
|
||||
<table class="table cell_map">
|
||||
<tr height="1">
|
||||
<tr height="0">
|
||||
<td style="width: 60px;"></td>
|
||||
<td colspan="7" style="position: relative;">
|
||||
<div class="cell_wrapper">
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
<td colspan="7">
|
||||
<div class="event_list_wrapper">
|
||||
<div class="cell_wrapper">
|
||||
<% @hours.each do |hour| %>
|
||||
<div class="cell click_event" time="<%= hour.to_s+".5" %>" ref="add-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @date.to_s %>" ses="AM">
|
||||
<div class="divide click_event" time="<%= hour %>" ref="add-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @date.to_s %>" ses="AM"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% @hours.each do |hour| %>
|
||||
<div class="cell click_event" time="<%= hour.to_s+".5" %>" ref="add-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @date.to_s %>" ses="PM">
|
||||
<div class="divide click_event" time="<%= hour %>" ref="add-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @date.to_s %>" ses="PM"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="day_time">12am</div>
|
||||
<% @hours.each do |hour| %>
|
||||
<div class="day_time"><%= hour %>am</div>
|
||||
<% end %>
|
||||
<% @hours.each do |hour| %>
|
||||
<div class="day_time"><%= hour %>pm</div>
|
||||
<% end %>
|
||||
<!-- <div class="day_time">12am</div>
|
||||
<div class="day_time">1am</div>
|
||||
<div class="day_time">2am</div>
|
||||
<div class="day_time">3am</div>
|
||||
@@ -128,7 +95,7 @@
|
||||
<div class="day_time">9am</div>
|
||||
<div class="day_time">10am</div>
|
||||
<div class="day_time">11am</div>
|
||||
<div class="day_time">12am</div>
|
||||
<div class="day_time">12pm</div>
|
||||
<div class="day_time">1pm</div>
|
||||
<div class="day_time">2pm</div>
|
||||
<div class="day_time">3pm</div>
|
||||
@@ -139,15 +106,22 @@
|
||||
<div class="day_time">8pm</div>
|
||||
<div class="day_time">9pm</div>
|
||||
<div class="day_time">10pm</div>
|
||||
<div class="day_time">11pm</div>
|
||||
<div class="day_time">11pm</div> -->
|
||||
</td>
|
||||
<td class="week_day">
|
||||
<div class="event_holder">
|
||||
<div class="inner">
|
||||
<% @d.each_with_index do |dt,i| %>
|
||||
<% if i == @today %>
|
||||
<td class="week_day today week_day_body" date='<%= dt %>'>
|
||||
<% else %>
|
||||
<td class="week_day week_day_body" date='<%= dt %>'>
|
||||
<% end %>
|
||||
<div class="event_holder">
|
||||
<div class="inner">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="week_day">
|
||||
</td>
|
||||
<% end %>
|
||||
<!-- <td class="week_day">
|
||||
<div class="event_holder">
|
||||
<div class="inner">
|
||||
</div>
|
||||
@@ -188,7 +162,7 @@
|
||||
<div class="inner">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</td> -->
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
+12
-2
@@ -1,4 +1,14 @@
|
||||
$("#event_create").empty().hide();
|
||||
$("#create_event_btn").removeClass("active");
|
||||
$("#calendar_month tr.event_row").remove();
|
||||
calendar.getEventsForMonth(<%= @m %>,<%= @y %>);
|
||||
$(".destroy").remove();
|
||||
switch (c.view){
|
||||
case "week":
|
||||
c.loadWeekView(c.cur_week,c.cur_year);
|
||||
break;
|
||||
case "month":
|
||||
c.loadMonthView(c.cur_month,c.cur_year);
|
||||
break;
|
||||
case "day":
|
||||
c.loadDayView(c.cur_date,c.cur_month,c.cur_year);
|
||||
break;
|
||||
}
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
<div class="modal-body">
|
||||
<div class="event_controller">
|
||||
<!-- <form class="form-horizontal"> -->
|
||||
<%= form_for @event, :url =>panel_calendar_back_end_event_path(@event), :class=>"form-horizontal", :remote => true do |f| %>
|
||||
<div class="row-fluid">
|
||||
<button type="button" class="close btn-close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<%= f.text_field :title, :class=>"span12", :placeholder => "Event Name",:value=>@event.title %>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<label class="checkbox inline">
|
||||
<input type="checkbox" name="all_day" for="all_day" <%= @event.all_day == true ? "checked='checked'" : "" %> > All day
|
||||
</label>
|
||||
<label class="checkbox inline">
|
||||
<input type="checkbox"> Repeat
|
||||
</label>
|
||||
</div>
|
||||
<% if !@event.all_day %>
|
||||
<div id="non_all_day">
|
||||
<div class="row-fluid">
|
||||
<label class="control-label span3">From</label>
|
||||
<div class="row-fluid span9">
|
||||
<input class="span5" id="dpfrom" type="text" value="<%= @event.start_month.to_s + "/" + @event.start_date.to_s + "/" + @event.start_year.to_s %>" name="start_date">
|
||||
<select name="start_time" class="span4">
|
||||
<% @hours.each_with_index do |hour,i| %>
|
||||
<% if hour['val'] == @event.start_time %>
|
||||
<option value="<%= hour['val'] %>" selected="selected"><%= hour['title'] %></option>
|
||||
<% else %>
|
||||
<option value="<%= hour['val'] %>" ><%= hour['title'] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
<select name="start_am_pm" class="span3">
|
||||
<% @ampm.each do |a| %>
|
||||
<% if @event.start_am_pm == a %>
|
||||
<option value="<%= a %>" selected="selected"><%= a %></option>
|
||||
<% else %>
|
||||
<option value="<%= a %>"><%= a %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<label class="control-label span3">To</label>
|
||||
<div class="row-fluid span9">
|
||||
<input class="span5" id="dpto" type="text" value="<%= @event.end_month.to_s + "/" + @event.end_date.to_s + "/" + @event.end_year.to_s %>" name="end_date">
|
||||
<select name="end_time" class="span4">
|
||||
<% @hours.each_with_index do |hour,i| %>
|
||||
<% if hour['val'] == @event.end_time %>
|
||||
<option value="<%= hour['val'] %>" selected="selected"><%= hour['title'] %></option>
|
||||
<% else %>
|
||||
<option value="<%= hour['val'] %>" ><%= hour['title'] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
<select name="end_am_pm" class="span3">
|
||||
<% @ampm.each do |a| %>
|
||||
<% if @event.end_am_pm == a %>
|
||||
<option value="<%= a %>" selected="selected"><%= a %></option>
|
||||
<% else %>
|
||||
<option value="<%= a %>"><%= a %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div id="non_all_day" style="display:none;">
|
||||
<div class="row-fluid">
|
||||
<label class="control-label span3">From</label>
|
||||
<div class="row-fluid span9">
|
||||
<input class="span5" id="dpfrom" type="text" value="" name="start_date">
|
||||
<select name="start_time" class="span4">
|
||||
<% @hours.each_with_index do |hour,i| %>
|
||||
<% if i == 16 %>
|
||||
<option value="<%= hour['val'] %>" selected="selected"><%= hour['title'] %></option>
|
||||
<% else %>
|
||||
<option value="<%= hour['val'] %>" ><%= hour['title'] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
<select name="start_am_pm" class="span3">
|
||||
<option value="AM">AM</option>
|
||||
<option value="PM">PM</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<label class="control-label span3">To</label>
|
||||
<div class="row-fluid span9">
|
||||
<input class="span5" id="dpto" type="text" name="end_date" value="<%= @placeholder %>" placeholder="<%= @placeholder %>">
|
||||
<select name="start_time" class="span4">
|
||||
<% @hours.each_with_index do |hour,i| %>
|
||||
<% if i == 18 %>
|
||||
<option value="<%= hour['val'] %>" selected="selected"><%= hour['title'] %></option>
|
||||
<% else %>
|
||||
<option value="<%= hour['val'] %>" ><%= hour['title'] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
<select name="end_am_pm" class="span3">
|
||||
<option value="AM">AM</option>
|
||||
<option value="PM">PM</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row-fluid">
|
||||
<label for="" class="control-label span3">Calendars</label>
|
||||
<div class="row-fluid span9">
|
||||
<%= f.select(:cal_id, Cal.all.collect {|p| [ p.name, p.id ] },{:prompt => t("calendar.select_calendar")},:class => "validate", :selected => @event.cal_id) %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<label for="" class="control-label span3">Note</label>
|
||||
<div class="row-fluid span9">
|
||||
<%= f.text_area :note, :class=>"span12", :cols=>"30", :rows=>"3", :value => @event.note %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span9 offset3">
|
||||
<button class="btn btn-close">Cancel</button>
|
||||
<%= f.submit t("calendar.save"), :class=>"btn" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- </form> -->
|
||||
</div>
|
||||
</div>
|
||||
+60
-55
@@ -11,7 +11,7 @@
|
||||
<div class="row-fluid">
|
||||
<% if !@all_day_disabled %>
|
||||
<label class="checkbox inline">
|
||||
<input type="checkbox" for="all_day"> All day
|
||||
<input type="checkbox" name="all_day" for="all_day"> All day
|
||||
</label>
|
||||
<% end %>
|
||||
<label class="checkbox inline">
|
||||
@@ -22,72 +22,48 @@
|
||||
<div class="row-fluid">
|
||||
<label class="control-label span3">From</label>
|
||||
<div class="row-fluid span9">
|
||||
<input class="span5" type="text" value="<%= @placeholder %>" name="start_date" placeholder="<%= @placeholder %>">
|
||||
<input class="span5" id="dpfrom" type="text" value="<%= @placeholder %>" name="start_date" placeholder="<%= @placeholder %>">
|
||||
<select name="start_time" class="span4">
|
||||
<option value="1.00">1:00</option>
|
||||
<option value="1.30">1:30</option>
|
||||
<option value="2.00">2:00</option>
|
||||
<option value="2.30">2:30</option>
|
||||
<option value="3.00">3:00</option>
|
||||
<option value="3.30">3:30</option>
|
||||
<option value="4.00">4:00</option>
|
||||
<option value="4.30">4:30</option>
|
||||
<option value="5.00">5:00</option>
|
||||
<option value="5.30">5:30</option>
|
||||
<option value="6.00">6:00</option>
|
||||
<option value="6.30">6:30</option>
|
||||
<option value="7.00">7:00</option>
|
||||
<option value="7.30">7:30</option>
|
||||
<option value="8.00">8:00</option>
|
||||
<option value="8.30">8:30</option>
|
||||
<option value="9.00">9:00</option>
|
||||
<option value="9.30">9:30</option>
|
||||
<option value="10.00">10:00</option>
|
||||
<option value="10.30">10:30</option>
|
||||
<option value="11.00">11:00</option>
|
||||
<option value="11.30">11:30</option>
|
||||
<option value="12.00">12:00</option>
|
||||
<option value="12.30">12:30</option>
|
||||
<% @hours.each_with_index do |hour,i| %>
|
||||
<% if i == @sindex %>
|
||||
<option value="<%= hour['val'] %>" selected="selected"><%= hour['title'] %></option>
|
||||
<% else %>
|
||||
<option value="<%= hour['val'] %>" ><%= hour['title'] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
<select name="start_am_pm" class="span3">
|
||||
<option value="AM">AM</option>
|
||||
<option value="PM">PM</option>
|
||||
<% @ampm.each do |a| %>
|
||||
<% if @sampm == a %>
|
||||
<option value="<%= a %>" selected="selected"><%= a %></option>
|
||||
<% else %>
|
||||
<option value="<%= a %>"><%= a %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<label class="control-label span3">To</label>
|
||||
<div class="row-fluid span9">
|
||||
<input class="span5" type="text" name="end_date" value="<%= @placeholder %>" placeholder="<%= @placeholder %>">
|
||||
<input class="span5" id="dpto" type="text" name="end_date" value="<%= @placeholder %>" placeholder="<%= @placeholder %>">
|
||||
<select name="end_time" class="span4">
|
||||
<option value="1.00">1:00</option>
|
||||
<option value="1.30">1:30</option>
|
||||
<option value="2.00">2:00</option>
|
||||
<option value="2.30">2:30</option>
|
||||
<option value="3.00">3:00</option>
|
||||
<option value="3.30">3:30</option>
|
||||
<option value="4.00">4:00</option>
|
||||
<option value="4.30">4:30</option>
|
||||
<option value="5.00">5:00</option>
|
||||
<option value="5.30">5:30</option>
|
||||
<option value="6.00">6:00</option>
|
||||
<option value="6.30">6:30</option>
|
||||
<option value="7.00">7:00</option>
|
||||
<option value="7.30">7:30</option>
|
||||
<option value="8.00">8:00</option>
|
||||
<option value="8.30">8:30</option>
|
||||
<option value="9.00">9:00</option>
|
||||
<option value="9.30">9:30</option>
|
||||
<option value="10.00">10:00</option>
|
||||
<option value="10.30">10:30</option>
|
||||
<option value="11.00">11:00</option>
|
||||
<option value="11.30">11:30</option>
|
||||
<option value="12.00">12:00</option>
|
||||
<option value="12.30">12:30</option>
|
||||
<% @hours.each_with_index do |hour,i| %>
|
||||
<% if i == @eindex %>
|
||||
<option value="<%= hour['val'] %>" selected="selected"><%= hour['title'] %></option>
|
||||
<% else %>
|
||||
<option value="<%= hour['val'] %>" ><%= hour['title'] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
<select name="end_am_pm" class="span3">
|
||||
<option value="AM">AM</option>
|
||||
<option value="PM">PM</option>
|
||||
<% @ampm.each do |a| %>
|
||||
<% if @eampm == a %>
|
||||
<option value="<%= a %>" selected="selected"><%= a %></option>
|
||||
<% else %>
|
||||
<option value="<%= a %>"><%= a %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -98,6 +74,35 @@
|
||||
<%= f.select(:cal_id, Cal.all.collect {|p| [ p.name, p.id ] },{:prompt => t("calendar.select_calendar")},:class => "validate") %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<label for="" class="control-label span3">Tags</label>
|
||||
<div class="row-fluid span9 dropdown">
|
||||
<button id="open_tags_panel" class="btn">Choose Tags</button>
|
||||
<div id="tags_panel" class="dropdown-menu my_scroll">
|
||||
<div class="scrollbar">
|
||||
<div class="track">
|
||||
<div class="thumb">
|
||||
<div class="end"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="viewport">
|
||||
<div class="overview">
|
||||
<ul id="tags_list" class="unstyled">
|
||||
<li><label for="" class="checkbox"><input type="checkbox"> tag1</label></li>
|
||||
<li><label for="" class="checkbox"><input type="checkbox"> tag2</label></li>
|
||||
<li><label for="" class="checkbox"><input type="checkbox"> tag3</label></li>
|
||||
<li><label for="" class="checkbox"><input type="checkbox"> tag4</label></li>
|
||||
<li><label for="" class="checkbox"><input type="checkbox"> tag5</label></li>
|
||||
<li><label for="" class="checkbox"><input type="checkbox"> tag6</label></li>
|
||||
<li><label for="" class="checkbox"><input type="checkbox"> tag7</label></li>
|
||||
<li><label for="" class="checkbox"><input type="checkbox"> tag8</label></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<label for="" class="control-label span3">Note</label>
|
||||
<div class="row-fluid span9">
|
||||
|
||||
+2
-2
@@ -13,6 +13,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn">Delete</a>
|
||||
<a href="#" class="btn btn-primary">Edit</a>
|
||||
<%= link_to t("calendar.delete"), panel_calendar_back_end_event_path(@event),:class => "btn bt-del", :method => :delete, :remote => true %>
|
||||
<%= link_to t("calendar.edit"), edit_panel_calendar_back_end_event_path(@event),:class => "btn btn-primary",:id=>"edit_event_btn" ,:remote => true %>
|
||||
</div>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
$("#event_create").empty().hide();
|
||||
$("#create_event_btn").removeClass("active");
|
||||
$(".destroy").remove();
|
||||
$("#create_event_btn").show();
|
||||
switch (c.view){
|
||||
case "week":
|
||||
c.loadWeekView(c.cur_week,c.cur_year);
|
||||
break;
|
||||
case "month":
|
||||
c.loadMonthView(c.cur_month,c.cur_year);
|
||||
break;
|
||||
case "day":
|
||||
c.loadDayView(c.cur_date,c.cur_month,c.cur_year);
|
||||
break;
|
||||
}
|
||||
+3
-1
@@ -6,4 +6,6 @@ en:
|
||||
save: Save
|
||||
delete: Delete
|
||||
select_calendar: "Select Calendar"
|
||||
create: Create
|
||||
create: Create
|
||||
sure?: "Are you sure?"
|
||||
edit: Edit
|
||||
@@ -1,4 +1,11 @@
|
||||
zh_tw:
|
||||
calendar:
|
||||
calendars: Calendars
|
||||
create: Create
|
||||
calendars: Calendars
|
||||
color: Color
|
||||
name: Name
|
||||
save: Save
|
||||
delete: Delete
|
||||
select_calendar: "Select Calendar"
|
||||
create: Create
|
||||
sure?: "Are you sure?"
|
||||
edit: Edit
|
||||
+2
-1
@@ -9,10 +9,11 @@ Rails.application.routes.draw do
|
||||
match 'cals/week_view' => 'cals#week_view', :via => :get
|
||||
match 'cals/getMonthEvents' => 'cals#get_month_events', :via => :get
|
||||
match 'cals/getWeekEvents' => 'cals#get_week_events', :via => :get
|
||||
match 'cals/getDayEvents' => 'cals#get_day_events', :via => :get
|
||||
|
||||
resources :cals
|
||||
resources :events
|
||||
|
||||
resources :tags
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 1.6 KiB |
@@ -55,7 +55,7 @@ var galleryAPI = function(){
|
||||
}
|
||||
this.makeNewAlbum = function(path){
|
||||
$.get(path,function(html){
|
||||
rcom.modalWindow({loadHtml:html,width:400,height:320,"closeBtn":false},function(dom){
|
||||
rcom.modalWindow({loadHtml:html,width:320,height:320,"closeBtn":false},function(dom){
|
||||
$("form#new_gallery_album").submit(function(){
|
||||
var validated = true;
|
||||
$(this).find(".error").removeClass("error");
|
||||
|
||||
@@ -270,8 +270,8 @@
|
||||
.slidelist a {
|
||||
border: solid 2px #fff;
|
||||
display: block;
|
||||
width: 120px;
|
||||
height: 90px;
|
||||
width: 150px;
|
||||
height: 120px;
|
||||
position: relative;
|
||||
|
||||
box-shadow: 0 0 6px rgba(0,0,0,0.7);
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
</ul>
|
||||
<ul class="nav nav-tabs">
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||
<li <%= ( i == 0 ) ? "class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<!-- <form id="edit_album" action="update_album" method="post"> -->
|
||||
|
||||
+4
-4
@@ -4,10 +4,10 @@
|
||||
</div>
|
||||
<%= form_for @album, :url => {:action => "create"}, :remote => true do |f| %>
|
||||
<div class="modal-body add-album">
|
||||
<div> <%= f.select(:gallery_category_id, GalleryCategory.all.collect {|p| [ p.name, p.id ] },{:prompt => t("gallery.select_category")},:class => "validate") %> </div>
|
||||
<div> <%= f.select(:gallery_category_id, GalleryCategory.all.collect {|p| [ p.name, p.id ] },{:prompt => t("gallery.select_category")},:class => "validate input-xlarge") %> </div>
|
||||
<ul class="nav nav-tabs">
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||
<li class=<%= ( i == 0 ) ? "active" : "" %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="tab_content form-horizontal">
|
||||
@@ -20,7 +20,7 @@
|
||||
<% end %>
|
||||
<p class="control-group">
|
||||
<%= label_tag(locale, t("gallery.album_name")) %>
|
||||
<%= name.text_field locale, :class => "validate" %>
|
||||
<%= name.text_field locale, :class => "validate input-xlarge" %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -34,7 +34,7 @@
|
||||
<% end %>
|
||||
<p class="control-group">
|
||||
<%= label_tag(locale, t("gallery.album_desc")) %>
|
||||
<%= desc.text_field locale %>
|
||||
<%= desc.text_field locale, :class => "input-xlarge" %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
Vendored
+1
-3
@@ -1,8 +1,7 @@
|
||||
<div id="tags" class="clear">
|
||||
<%= render :partial => 'category', :collection => @categorylist %>
|
||||
</div>
|
||||
<div class="form-actions form-fixed pagination-right">
|
||||
<div style="margin:0;padding:0;display:inline">
|
||||
<div class="form-actions form-fixed form-inline pagination-right">
|
||||
<%= form_for @new_category, :url => {:action => "create"}, :remote => true do |f| %>
|
||||
<%= f.fields_for :name_translations do |name| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
@@ -12,7 +11,6 @@
|
||||
<% end %>
|
||||
<%= f.submit t("gallery.save"), :class=> "btn btn-primary" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var deleteCategory = function(a){
|
||||
|
||||
vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/orbit_galleries/add_album.html.erb
Vendored
+1
-1
@@ -11,7 +11,7 @@
|
||||
</select>
|
||||
<ul class="nav nav-tabs">
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||
<li <%= ( i == 0 ) ? "class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="tab_content form-horizontal">
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
</ul>
|
||||
<ul class="nav nav-tabs">
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||
<li <%= ( i == 0 ) ? "class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<form id="edit_album" action="update_album" method="post">
|
||||
|
||||
@@ -30,3 +30,5 @@ zh_tw:
|
||||
search_tags: 搜尋標籤
|
||||
cover: 封面
|
||||
set_cover: 設為封面
|
||||
sure?: "你確定嗎?"
|
||||
no_description: 沒有描述
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
|
||||
<!-- <form class="form-horizontal"> -->
|
||||
<%= form_for @newlocation, :url=>{:action => "create"}, :remote => true, :class=>"form-horizontal" do |f| %>
|
||||
<div class="control-group">
|
||||
|
||||
Vendored
+4
-4
@@ -13,9 +13,9 @@ class Panel::News::BackEnd::NewsApprovalsController < OrbitBackendController
|
||||
@news_bulletin.proc_check(params[:news_bulletin][:is_checked],params[:news_bulletin][:not_checked_reason])
|
||||
@news_bulletin.de_pending
|
||||
if @news_bulletin.save
|
||||
notice = t('news_bulletin.approve_bulletin_success')
|
||||
notice = t('approval.pass')
|
||||
else
|
||||
notice = t('news_bulletin.approve_bulletin_fail')
|
||||
notice = t('approval.not_pass')
|
||||
end
|
||||
redirect_to(panel_news_back_end_news_bulletins_url,:notice => notice)
|
||||
end
|
||||
@@ -40,9 +40,9 @@ class Panel::News::BackEnd::NewsApprovalsController < OrbitBackendController
|
||||
def update_setting
|
||||
object_auth = update_setting_by_params
|
||||
if object_auth.save!
|
||||
flash[:notice] = t("admin.object_auth.update_done")
|
||||
flash[:notice] = t('update.success_')
|
||||
else
|
||||
flash[:notice] = t("admin.object_auth.update_failed")
|
||||
flash[:notice] = t('update.fail')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+4
-4
@@ -77,7 +77,7 @@ class Panel::News::BackEnd::NewsBulletinCategorysController < OrbitBackendContro
|
||||
respond_to do |format|
|
||||
if @news_bulletin_category.save
|
||||
# format.html { redirect_to @news_bulletin_category, notice: 'Entry was successfully created.' }
|
||||
format.html { redirect_to(panel_news_back_end_news_bulletin_categorys_url, :notice => t('news.create_news_bulletin_category_success')) }
|
||||
format.html { redirect_to(panel_news_back_end_news_bulletin_categorys_url, :notice => t('news_bulletin.create_news_bulletin_category_success')) }
|
||||
# format.xml { render :xml => @news_bulletin_category, :status => :created, :location => @news_bulletin_category }
|
||||
format.js
|
||||
else
|
||||
@@ -118,14 +118,14 @@ class Panel::News::BackEnd::NewsBulletinCategorysController < OrbitBackendContro
|
||||
if @news_bulletin_category.save!
|
||||
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
||||
respond_to do |format|
|
||||
flash[:notice] = t("bulletin_category.update_success")
|
||||
# flash[:error] += @bulletin_category.disable ? t("bulletin_category.disable_change_to_true") : t("bulletin_category.disable_change_to_false")
|
||||
flash[:notice] = t("update.success_")
|
||||
# flash[:error] += @bulletin_category.disable ? t(enable) : t(disable)
|
||||
format.html { redirect_to(panel_announcement_back_end_news_bulletin_categorys_url) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
end
|
||||
else
|
||||
flash[:error] = t("bulletin_category.update_failed")
|
||||
flash[:error] = t("update.fail")
|
||||
format.html { render :action => "index" }
|
||||
|
||||
end
|
||||
|
||||
Vendored
+34
-9
@@ -10,8 +10,16 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
controller.get_categorys('NewsBulletinCategory')
|
||||
controller.get_unit_list
|
||||
end
|
||||
before_filter :clean_values, :only => [:create, :update]
|
||||
|
||||
def preview
|
||||
#@preview_obj = Preview.create(:object=>params[:news_bulletin],:expired_at=>DateTime.now+30.minutes,:preview_at_link=>"panel_news_front_end_news_bulletin_path",:object_class_type=>"NewsBulletin")
|
||||
news_bulletin = NewsBulletin.new params
|
||||
@preview_obj = news_bulletin.to_preview
|
||||
@preview_obj.save
|
||||
render '/shared/preview/preview.html.erb', :layout=>false
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
# @news_bulletins = NewsBulletin.all
|
||||
# @news_bulletins = NewsBulletin.desc("postdate desc")
|
||||
@@ -86,9 +94,12 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
# GET /news_bulletins/new
|
||||
# GET /news_bulletins/new.xml
|
||||
def new
|
||||
|
||||
@news_bulletin = NewsBulletin.new
|
||||
|
||||
if(session[:in_validate_object].blank?)
|
||||
@news_bulletin = NewsBulletin.new
|
||||
else
|
||||
@news_bulletin = session[:in_validate_object]
|
||||
session[:in_validate_object] = {}
|
||||
end
|
||||
@link_url = panel_news_back_end_news_bulletins_path
|
||||
|
||||
# @news_bulletin.news_bulletin_files.build
|
||||
@@ -150,7 +161,9 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
@news_bulletin.update_user_id = current_user.id
|
||||
|
||||
if(is_manager? || is_admin?)
|
||||
@news_bulletin.de_pending
|
||||
@news_bulletin.is_checked = true
|
||||
@news_bulletin.is_rejected = false
|
||||
@news_bulletin.de_pending
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
@@ -158,7 +171,8 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
||||
format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('news_bulletin.create_news_bulletin_success')) }
|
||||
format.xml { render :xml => @news_bulletin, :status => :created, :location => @news_bulletin }
|
||||
format.js
|
||||
format.js
|
||||
#format.json {render :json => {"success"=>"true","redirect_url"=>panel_news_back_end_news_bulletins_url,"notice" => t('news_bulletin.create_news_bulletin_success')}}
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @news_bulletin.errors, :status => :unprocessable_entity }
|
||||
@@ -278,7 +292,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
end
|
||||
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
||||
# format.html { redirect_to(panel_news_back_end_news_bulletin_url(@news_bulletin), :notice => t('news_bulletin.update_news_bulletin_success')) }
|
||||
format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('news.news_bulletin.update_success')) }
|
||||
format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('update.success_')) }
|
||||
format.js { render 'toggle_enable' }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
@@ -366,7 +380,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
# @news_bulletin_categorys = NewsBulletinCategory.all.authed_for_user(current_user,'submit')
|
||||
# end
|
||||
# if @news_bulletin_categorys.empty? && params[:action] != "index"
|
||||
# flash[:alert] = t("news.error.no_avilb_cate_for_posting")
|
||||
# flash[:alert] = t("news_bulletin.error.no_avilb_cate_for_posting")
|
||||
# redirect_to :action => :index
|
||||
# end
|
||||
# end
|
||||
@@ -376,7 +390,18 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
|
||||
def get_tags
|
||||
module_app = ModuleApp.first(:conditions => {:key => 'news'})
|
||||
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
|
||||
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc) rescue []
|
||||
end
|
||||
|
||||
def clean_values
|
||||
if params[:news_bulletin]
|
||||
params[:news_bulletin][:news_bulletin_links_attributes].each_with_index do |link, index|
|
||||
params[:news_bulletin][:news_bulletin_links_attributes].delete(index.to_s) if link[1]['url'].blank? and link[1]['title'].blank?
|
||||
end rescue nil
|
||||
params[:news_bulletin][:news_bulletin_files_attributes].each_with_index do |link, index|
|
||||
params[:news_bulletin][:news_bulletin_files_attributes].delete(index.to_s) if link[1]['file'].blank? and link[1]['title'].blank?
|
||||
end rescue nil
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Vendored
+5
-4
@@ -19,14 +19,14 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
|
||||
if !params[:search_query].blank?
|
||||
# search_cond = {:is_checked=>true,:is_hidden=>false,:is_pending=>false,:is_pending=>false}
|
||||
# search_cond.merge!({:news_bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank?
|
||||
|
||||
@search = NewsBulletin.solr_search do
|
||||
fulltext params[:search_query]
|
||||
with(:frontend_search,true)
|
||||
#order_by(:average_rating)
|
||||
with(:available_lang).any_of([I18n.locale.to_s])
|
||||
end
|
||||
|
||||
search_result = @search.results.collect{|result| result.id}
|
||||
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).page( params[:page_main]).per(10)
|
||||
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).desc(:postdate).page( params[:page_main]).per(10)
|
||||
else
|
||||
date_now = Time.now
|
||||
if !params[:category_id].blank? && !params[:tag_id].blank?
|
||||
@@ -69,7 +69,8 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
|
||||
end
|
||||
|
||||
def preview_content
|
||||
@news_bulletin = NewsBulletin.find params[:id]
|
||||
@news_bulletin = NewsBulletin.find params[:id] rescue nil
|
||||
@news_bulletin = Preview.find(params[:id]).get_virtual_object if @news_bulletin.nil?
|
||||
get_categorys
|
||||
end
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -9,8 +9,8 @@ include ActionView::Helpers::UrlHelper
|
||||
news_bulletin_category.object_auths.new(title: type ).save
|
||||
oa = news_bulletin_category.get_object_auth_by_title(type)
|
||||
end
|
||||
# link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
|
||||
link_to t('announcement.bulletin.cate_auth'),admin_object_auth_ob_auth_path(oa)
|
||||
# link_to t(:category_auth), edit_admin_object_auth_path(oa)
|
||||
link_to t(:category_auth),admin_object_auth_ob_auth_path(oa)
|
||||
|
||||
end
|
||||
|
||||
|
||||
+31
-3
@@ -9,12 +9,14 @@ class NewsBulletin
|
||||
|
||||
BelongsToCategory = :news_bulletin_category
|
||||
include OrbitCoreLib::BelongsToCategoryMayDisable
|
||||
include OrbitCoreLib::Preview
|
||||
# include Tire::Model::Search
|
||||
# include Tire::Model::Callbacks
|
||||
# include Redis::Objects
|
||||
|
||||
|
||||
|
||||
|
||||
#scope :searchable,where(:is_checked=>true,:is_hidden=>false,:is_pending=>false)
|
||||
|
||||
is_impressionable :counter_cache => { :column_name => :view_count }
|
||||
@@ -36,7 +38,6 @@ class NewsBulletin
|
||||
field :is_checked, :type => Boolean, :default => false
|
||||
field :is_pending, :type => Boolean, :default => true
|
||||
field :is_rejected, :type => Boolean, :default => false
|
||||
|
||||
field :view_count, :type => Integer, :default => 0
|
||||
|
||||
field :not_checked_reason
|
||||
@@ -101,6 +102,10 @@ class NewsBulletin
|
||||
end
|
||||
integer :view_count
|
||||
|
||||
string :available_lang , :multiple => true do
|
||||
VALID_LOCALES.collect{|t| enabled_for_lang(t.to_sym) ? t : nil}.delete_if{|t| t.nil?}
|
||||
end
|
||||
|
||||
boolean :frontend_search do
|
||||
( !is_hidden && !is_pending && is_checked && !is_rejected )
|
||||
end
|
||||
@@ -108,6 +113,7 @@ class NewsBulletin
|
||||
|
||||
string :news_bulletin_category_id
|
||||
end
|
||||
|
||||
# redis_search_index(:title_field => :s_title,
|
||||
# :alias_field => :s_title_en,
|
||||
# :score_field => :view_count,
|
||||
@@ -140,6 +146,9 @@ class NewsBulletin
|
||||
# def s_text_zh_tw
|
||||
# Nokogiri::HTML(self.text.zh_tw).text
|
||||
# end
|
||||
def share_item
|
||||
Item.first(conditions:{name: 'news'})
|
||||
end
|
||||
|
||||
def self.widget_datas( category_id = nil )
|
||||
|
||||
@@ -150,9 +159,9 @@ class NewsBulletin
|
||||
# any_of({ :title => "test" },{:deadline => nil, :title => "123"})
|
||||
|
||||
if category_id.to_s.size > 0
|
||||
find(:all, :conditions => {news_bulletin_category_id: category_id}).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate)
|
||||
find(:all, :conditions => {news_bulletin_category_id: category_id}).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).any_of(is_hot: true, is_top: true).desc(:postdate)
|
||||
else
|
||||
any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate)
|
||||
any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).any_of(is_hot: true, is_top: true).desc(:postdate)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -237,6 +246,23 @@ class NewsBulletin
|
||||
def sorted_tags
|
||||
tags.order_by(I18n.locale, :asc)
|
||||
end
|
||||
|
||||
def to_preview
|
||||
preview_object = Preview.new(:expired_at=>DateTime.now+30.minutes,:preview_at_link=>"panel_news_front_end_news_bulletin_path",:object_class_type=>"NewsBulletin")
|
||||
preview_object.preview_files.build(:file=>self.news_bulletin["image"],:field_name_for_rebuild=>'image')
|
||||
|
||||
|
||||
self.news_bulletin["news_bulletin_files_attributes"].each_with_index do |atr,idx|
|
||||
preview_object.preview_files.build(:file=>self.news_bulletin["news_bulletin_files_attributes"][idx.to_s],:field_name_for_rebuild=>'news_bulletin_files',:file_in_array=>true)
|
||||
end unless self.news_bulletin["news_bulletin_files_attributes"].nil?
|
||||
|
||||
self.news_bulletin["news_bulletin_links_attributes"].each_with_index do |atr,idx|
|
||||
preview_object.preview_associations.build(:object=>self.news_bulletin["news_bulletin_links_attributes"][idx.to_s],:field_name_for_rebuild=>'news_bulletin_links',:object_in_array=>true)
|
||||
end unless self.news_bulletin["news_bulletin_links_attributes"].nil?
|
||||
|
||||
preview_object.object = self.news_bulletin.except("news_bulletin_files_attributes","image","news_bulletin_links_attributes")
|
||||
preview_object
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
@@ -260,4 +286,6 @@ class NewsBulletin
|
||||
self.tag_ids.delete('')
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
Loaded 100 of 486 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user