Merge branch 'master' into various_bugs
Conflicts: config/locales/en.yml config/locales/zh_tw.yml vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_form.html.erb vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_form.html.erb
This commit is contained in:
commit
b40d4702d5
233 files changed
+3124
-5384
No files matched your search
Vendored
+1
-1
@@ -49,4 +49,4 @@ module Panel::Announcement::BackEnd::BulletinsHelper
|
||||
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
@@ -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
+2
-2
@@ -43,7 +43,7 @@
|
||||
<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| %>
|
||||
@@ -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 %>
|
||||
|
||||
|
||||
+178
-21
@@ -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) {
|
||||
@@ -45,12 +44,17 @@ var calendarAPI = function(){
|
||||
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.loadDayView(c.cur_date,c.cur_month,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(){
|
||||
@@ -61,16 +65,56 @@ var calendarAPI = function(){
|
||||
|
||||
$("#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(){
|
||||
@@ -196,6 +240,10 @@ var calendarAPI = function(){
|
||||
}
|
||||
}
|
||||
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();
|
||||
@@ -236,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();
|
||||
@@ -262,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;
|
||||
@@ -272,7 +320,7 @@ var calendarAPI = function(){
|
||||
|
||||
if(allow){
|
||||
if(evnt.title=="Navratri")
|
||||
console.log(pos);
|
||||
//console.log(pos);
|
||||
if(pos == 1){
|
||||
var colspan = 0;
|
||||
if(evnt.total_days>7){
|
||||
@@ -338,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();
|
||||
@@ -354,11 +406,11 @@ 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></tr>");
|
||||
var tr = $("<tr class='destroy'></tr>");
|
||||
var pre = true;
|
||||
$.each(events,function(i,evnt){
|
||||
// console.log("rowcount: "+rowcount);
|
||||
@@ -371,7 +423,7 @@ var calendarAPI = function(){
|
||||
$("table.all_day_event_holder").append(tr);
|
||||
}
|
||||
tr = null;
|
||||
tr = $('<tr></tr>');
|
||||
tr = $('<tr class="destroy"></tr>');
|
||||
pre = true;
|
||||
}
|
||||
|
||||
@@ -440,7 +492,7 @@ var calendarAPI = function(){
|
||||
if(h == 0.5)
|
||||
halfhour = "half";
|
||||
h = 17 + 20 + (((h-1) * 2) * 20) + 1;
|
||||
var eventdom = $('<div class="event '+halfhour+'" 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>');
|
||||
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){
|
||||
@@ -458,6 +510,10 @@ var calendarAPI = function(){
|
||||
})
|
||||
}
|
||||
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();
|
||||
@@ -477,10 +533,10 @@ var calendarAPI = function(){
|
||||
})
|
||||
}
|
||||
this.getEventsForDay = function(day,month,year){
|
||||
$.getJSON("cals/getDayEvents",{"date":day,"month":month,"year":year},function(events){
|
||||
$.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" link="'+evnt.show_link+'" style="background-color: '+evnt.color+';color:#fff;">'+evnt.title+'</div>')
|
||||
$(".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"){
|
||||
@@ -521,7 +577,7 @@ var calendarAPI = function(){
|
||||
if(h == 0.5)
|
||||
halfhour = "half";
|
||||
h = 17 + 20 + (((h-1) * 2) * 20) + 1;
|
||||
var eventdom = $('<div class="inner"><div class="event '+halfhour+'" 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>');
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -529,12 +585,37 @@ var calendarAPI = function(){
|
||||
|
||||
})
|
||||
}
|
||||
this.loadAgendaView = function(){
|
||||
$('#view_holder').load("cals/agenda_view", function() {
|
||||
$('.current_day_title').text('September 2, 2012');
|
||||
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){
|
||||
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();
|
||||
@@ -546,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
|
||||
@@ -586,8 +725,26 @@ var calendarAPI = function(){
|
||||
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 {
|
||||
@@ -37,6 +36,9 @@
|
||||
-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;
|
||||
}
|
||||
@@ -71,7 +73,7 @@
|
||||
}
|
||||
#calendar_day .event_holder {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
/*height: 100%;*/
|
||||
position: absolute;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
@@ -164,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 {
|
||||
@@ -305,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
+125
-7
@@ -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
|
||||
@@ -39,10 +39,10 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
|
||||
end
|
||||
|
||||
def day_view
|
||||
date = params[:date].to_i
|
||||
@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
|
||||
@cur_day = getDayName(@date,month,year) + " " + month.to_s + "/" + @date.to_s + " - " + year.to_s
|
||||
@hours = getHours(12)
|
||||
render :layout => false
|
||||
end
|
||||
@@ -79,17 +79,133 @@ 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].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
|
||||
@@ -121,7 +237,7 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
|
||||
# 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.all.asc(:start_date).desc(:total_days)
|
||||
events = Event.where(:cal_id.in=>fromcalendars).asc(:start_date).desc(:total_days)
|
||||
events.each_with_index do |event,i|
|
||||
# @temp = Array.new
|
||||
startdt = Date.new(event.start_year,event.start_month)
|
||||
@@ -174,8 +290,9 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
|
||||
def get_week_events
|
||||
week = params[:week].to_i
|
||||
year = params[:year].to_i
|
||||
fromcalendars = params[:calendars]
|
||||
@d = getWeekDataSet(week,year)
|
||||
events = Event.where(:start_week.lte => week).and(:start_year => year).and(:end_week.gte => week).and(:start_year => year).asc(:start_week).asc(:start_date)
|
||||
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
|
||||
@@ -230,6 +347,7 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
|
||||
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)
|
||||
|
||||
Vendored
+115
-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]
|
||||
@@ -81,6 +118,78 @@ class Panel::Calendar::BackEnd::EventsController < OrbitBackendController
|
||||
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]
|
||||
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
class Panel::Calendar::BackEnd::TagsController < Admin::TagsController
|
||||
def initialize
|
||||
super
|
||||
@app_title = 'calendar'
|
||||
end
|
||||
end
|
||||
+27
-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
|
||||
|
||||
@@ -180,6 +194,15 @@ module Panel::Calendar::BackEnd::CalsHelper
|
||||
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
|
||||
|
||||
|
||||
|
||||
Vendored
+106
-263
@@ -1,267 +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>
|
||||
</div>
|
||||
<!-- <div id="calendar_week">
|
||||
<table class="table header">
|
||||
<tr>
|
||||
<th style="width: 44px;"></th>
|
||||
<th>Sun 9/11</th>
|
||||
<th>Mon 9/12</th>
|
||||
<th class="today">Tue 9/13</th>
|
||||
<th>Wed 9/14</th>
|
||||
<th>Thu 9/15</th>
|
||||
<th>Fri 9/16</th>
|
||||
<th>Sat 9/17</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8" style="border:0;">
|
||||
<div class="event_list_wrapper" style="height:50px;">
|
||||
<table style="position: absolute; width: 100%; height: 50px; top: 0;">
|
||||
<% @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 style="border: 0; background: none; width: 60px;"></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>
|
||||
<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 colspan='3'>No events for this month.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="all_day_event_holder">
|
||||
<tr>
|
||||
<td rowspan="2" style="width:60px;"></td>
|
||||
<td colspan="7" class="all_day_event week_day">
|
||||
<div class="event half" style="background-color: #ccffee;">
|
||||
<dl>
|
||||
<dt>10:30am - template</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1"></td>
|
||||
<td colspan="2" class="all_day_event week_day">
|
||||
<div class="event half" style="background-color: #ccffee;">
|
||||
<dl>
|
||||
<dt>10:30am - template</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</td>
|
||||
<td colspan="4"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="event_list">
|
||||
<table class="table cell_map">
|
||||
<tr height="0">
|
||||
<td style="width: 60px;"></td>
|
||||
<td colspan="7">
|
||||
<div class="event_list_wrapper">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<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>
|
||||
</td>
|
||||
<td class="week_day">
|
||||
<div class="event_holder">
|
||||
<div class="inner">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="week_day">
|
||||
<div class="event_holder">
|
||||
<div class="inner">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="week_day today">
|
||||
<div class="event_holder">
|
||||
<div class="inner">
|
||||
<div class="event" style="background-color: #ccffee; top: 117px;">
|
||||
<dl>
|
||||
<dt>10:30am - 11:00am</dt>
|
||||
<dd>template</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="week_day">
|
||||
<div class="event_holder">
|
||||
<div class="inner">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="week_day">
|
||||
<div class="event_holder">
|
||||
<div class="inner">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="week_day">
|
||||
<div class="event_holder">
|
||||
<div class="inner">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="week_day">
|
||||
<div class="event_holder">
|
||||
<div class="inner">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
<% end %>
|
||||
</div>
|
||||
+6
-4
@@ -28,11 +28,13 @@
|
||||
<td>
|
||||
<div class="event_list_wrapper">
|
||||
<% @hours.each do |hour| %>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
<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="cell">
|
||||
<div class="divide"></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 class="event_holder">
|
||||
|
||||
+23
-18
@@ -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>
|
||||
|
||||
+9
-7
@@ -62,13 +62,15 @@
|
||||
<div class="event_list_wrapper">
|
||||
<div class="cell_wrapper">
|
||||
<% @hours.each do |hour| %>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<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>
|
||||
|
||||
+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>
|
||||
+59
-54
@@ -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.50">1:30</option>
|
||||
<option value="2.00">2:00</option>
|
||||
<option value="2.50">2:30</option>
|
||||
<option value="3.00">3:00</option>
|
||||
<option value="3.50">3:30</option>
|
||||
<option value="4.00">4:00</option>
|
||||
<option value="4.50">4:30</option>
|
||||
<option value="5.00">5:00</option>
|
||||
<option value="5.50">5:30</option>
|
||||
<option value="6.00">6:00</option>
|
||||
<option value="6.50">6:30</option>
|
||||
<option value="7.00">7:00</option>
|
||||
<option value="7.50">7:30</option>
|
||||
<option value="8.00">8:00</option>
|
||||
<option value="8.50">8:30</option>
|
||||
<option value="9.00">9:00</option>
|
||||
<option value="9.50">9:30</option>
|
||||
<option value="10.00">10:00</option>
|
||||
<option value="10.50">10:30</option>
|
||||
<option value="11.00">11:00</option>
|
||||
<option value="11.50">11:30</option>
|
||||
<option value="12.00">12:00</option>
|
||||
<option value="12.50">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.50">1:30</option>
|
||||
<option value="2.00">2:00</option>
|
||||
<option value="2.50">2:30</option>
|
||||
<option value="3.00">3:00</option>
|
||||
<option value="3.50">3:30</option>
|
||||
<option value="4.00">4:00</option>
|
||||
<option value="4.50">4:30</option>
|
||||
<option value="5.00">5:00</option>
|
||||
<option value="5.50">5:30</option>
|
||||
<option value="6.00">6:00</option>
|
||||
<option value="6.50">6:30</option>
|
||||
<option value="7.00">7:00</option>
|
||||
<option value="7.50">7:30</option>
|
||||
<option value="8.00">8:00</option>
|
||||
<option value="8.50">8:30</option>
|
||||
<option value="9.00">9:00</option>
|
||||
<option value="9.50">9:30</option>
|
||||
<option value="10.00">10:00</option>
|
||||
<option value="10.50">10:30</option>
|
||||
<option value="11.00">11:00</option>
|
||||
<option value="11.50">11:30</option>
|
||||
<option value="12.00">12:00</option>
|
||||
<option value="12.50">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">
|
||||
<%= link_to "Delete", panel_calendar_back_end_event_path(@event),:class => "btn", :method => :delete, :remote => true %>
|
||||
<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;
|
||||
}
|
||||
+1
-1
@@ -13,7 +13,7 @@ Rails.application.routes.draw do
|
||||
|
||||
resources :cals
|
||||
resources :events
|
||||
|
||||
resources :tags
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+14
-3
@@ -179,12 +179,23 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl
|
||||
|
||||
@writing_book = WritingBook.new(params[:writing_book])
|
||||
|
||||
@writing_book.create_user_id = current_user.id
|
||||
@writing_book.update_user_id = current_user.id
|
||||
if params[:writing_book][:user_id]
|
||||
@writing_book.create_user_id = params[:writing_book][:user_id]
|
||||
@writing_book.update_user_id = params[:writing_book][:user_id]
|
||||
else
|
||||
@writing_book.create_user_id = current_user.id
|
||||
@writing_book.update_user_id = current_user.id
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @writing_book.save
|
||||
format.html { redirect_to(panel_personal_book_back_end_writing_books_url) }
|
||||
|
||||
if params[:writing_book][:user_id]
|
||||
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:writing_book][:user_id],:show_plugin_profile=>'Book')) }
|
||||
else
|
||||
format.html { redirect_to(panel_personal_book_back_end_writing_books_url) }
|
||||
end
|
||||
|
||||
format.xml { render :xml => @writing_book, :status => :created, :location => @writing_book }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
|
||||
@@ -32,8 +32,8 @@ class WritingBook
|
||||
field :publication_date, :type => Date
|
||||
field :url
|
||||
field :note
|
||||
field :create_user_id
|
||||
field :update_user_id
|
||||
field :create_user_id, :type => BSON::ObjectId
|
||||
field :update_user_id, :type => BSON::ObjectId
|
||||
|
||||
# field :is_top, :type => Boolean, :default => false
|
||||
# field :is_hot, :type => Boolean, :default => false
|
||||
|
||||
+10
@@ -47,6 +47,15 @@
|
||||
|
||||
<div id="post-body">
|
||||
<div id="post-body-content" class="clear">
|
||||
|
||||
<% if !params[:user_id].blank? %>
|
||||
|
||||
<div class="span6">
|
||||
<%= t("著作人")%>
|
||||
<%= User.from_id(params[:user_id]).name rescue ''%>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :year ,t("personal_book.year")%>
|
||||
@@ -218,6 +227,7 @@
|
||||
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
|
||||
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||
</div>
|
||||
|
||||
Vendored
+3
@@ -50,6 +50,9 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_book_back_end_writing_book_path(:user_id => @user.id), :class => 'btn btn-primary pull-right' %>
|
||||
|
||||
|
||||
<div class="form-actions form-fixed pagination-right">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_book_plugin_writing_book_path, :class => 'btn btn-primary pull-right' %>
|
||||
<div id="writing_book_pagination" class="paginationFixed">
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ module PersonalBook
|
||||
OrbitApp.registration "Book",:type=> 'ModuleApp' do
|
||||
|
||||
base_url File.expand_path File.dirname(__FILE__)
|
||||
personal_plugin :enable => true,:path=>"panel/personal_book/plugin/profile"
|
||||
personal_plugin :enable => true,:path=>"panel/personal_book/plugin/profile",:i18n=>'admin.personal_book'
|
||||
|
||||
|
||||
end
|
||||
|
||||
+14
-3
@@ -83,12 +83,23 @@ class Panel::PersonalDiploma::BackEnd::DiplomasController < OrbitBackendControll
|
||||
|
||||
@diploma = Diploma.new(params[:diploma])
|
||||
|
||||
@diploma.create_user_id = current_user.id
|
||||
@diploma.update_user_id = current_user.id
|
||||
if params[:diploma][:user_id]
|
||||
@diploma.create_user_id = params[:diploma][:user_id]
|
||||
@diploma.update_user_id = params[:diploma][:user_id]
|
||||
else
|
||||
@diploma.create_user_id = current_user.id
|
||||
@diploma.update_user_id = current_user.id
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @diploma.save
|
||||
format.html { redirect_to(panel_personal_diploma_back_end_diplomas_url) }
|
||||
|
||||
if params[:diploma][:user_id]
|
||||
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:diploma][:user_id],:show_plugin_profile=>'Diploma')) }
|
||||
else
|
||||
format.html { redirect_to(panel_personal_diploma_back_end_diplomas_url) }
|
||||
end
|
||||
|
||||
format.xml { render :xml => @diploma, :status => :created, :location => @diploma }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
|
||||
@@ -24,8 +24,8 @@ class Diploma
|
||||
field :end_date , :type => Date
|
||||
field :url
|
||||
field :note
|
||||
field :create_user_id
|
||||
field :update_user_id
|
||||
field :create_user_id, :type => BSON::ObjectId
|
||||
field :update_user_id, :type => BSON::ObjectId
|
||||
|
||||
# field :is_top, :type => Boolean, :default => false
|
||||
# field :is_hot, :type => Boolean, :default => false
|
||||
|
||||
+10
@@ -30,6 +30,15 @@
|
||||
|
||||
<div id="post-body">
|
||||
<div id="post-body-content" class="clear">
|
||||
|
||||
<% if !params[:user_id].blank? %>
|
||||
|
||||
<div class="span6">
|
||||
<%= t("著作人")%>
|
||||
<%= User.from_id(params[:user_id]).name rescue ''%>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :start_date ,t("personal_diploma.start_date")%>
|
||||
@@ -121,6 +130,7 @@
|
||||
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
|
||||
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||
</div>
|
||||
Vendored
+3
@@ -50,6 +50,9 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_diploma_back_end_diploma_path(:user_id => @user.id), :class => 'btn btn-primary pull-right' %>
|
||||
|
||||
|
||||
<div class="form-actions form-fixed pagination-right">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_diploma_plugin_diploma_path, :class => 'btn btn-primary pull-right' %>
|
||||
<div id="diploma_pagination" class="paginationFixed">
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ module PersonalDiploma
|
||||
OrbitApp.registration "Diploma",:type=> 'ModuleApp' do
|
||||
|
||||
base_url File.expand_path File.dirname(__FILE__)
|
||||
personal_plugin :enable => true,:path=>"panel/personal_diploma/plugin/profile"
|
||||
personal_plugin :enable => true,:path=>"panel/personal_diploma/plugin/profile",:i18n=>'admin.personal_diploma'
|
||||
|
||||
|
||||
end
|
||||
|
||||
+14
-3
@@ -133,12 +133,23 @@ class Panel::PersonalExperience::BackEnd::ExperiencesController < OrbitBackendCo
|
||||
|
||||
@experience = Experience.new(params[:experience])
|
||||
|
||||
@experience.create_user_id = current_user.id
|
||||
@experience.update_user_id = current_user.id
|
||||
if params[:experience][:user_id]
|
||||
@experience.create_user_id = params[:experience][:user_id]
|
||||
@experience.update_user_id = params[:experience][:user_id]
|
||||
else
|
||||
@experience.create_user_id = current_user.id
|
||||
@experience.update_user_id = current_user.id
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @experience.save
|
||||
format.html { redirect_to(panel_personal_experience_back_end_experiences_url) }
|
||||
|
||||
if params[:experience][:user_id]
|
||||
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:experience][:user_id],:show_plugin_profile=>'Experience')) }
|
||||
else
|
||||
format.html { redirect_to(panel_personal_experience_back_end_experiences_url) }
|
||||
end
|
||||
|
||||
format.xml { render :xml => @experience, :status => :created, :location => @experience }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
|
||||
@@ -24,8 +24,8 @@ class Experience
|
||||
field :keywords
|
||||
field :url
|
||||
field :note
|
||||
field :create_user_id
|
||||
field :update_user_id
|
||||
field :create_user_id, :type => BSON::ObjectId
|
||||
field :update_user_id, :type => BSON::ObjectId
|
||||
|
||||
# field :is_top, :type => Boolean, :default => false
|
||||
# field :is_hot, :type => Boolean, :default => false
|
||||
|
||||
+10
@@ -31,6 +31,15 @@
|
||||
<div id="post-body">
|
||||
<div id="post-body-content" class="clear">
|
||||
|
||||
<% if !params[:user_id].blank? %>
|
||||
|
||||
<div class="span6">
|
||||
<%= t("著作人")%>
|
||||
<%= User.from_id(params[:user_id]).name rescue ''%>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :experience_category ,t("personal_experience.experience_category")%>
|
||||
<%= f.select :experience_category_id, @experience_categorys.collect {|t| [ t.title, t.id ]} %>
|
||||
@@ -118,6 +127,7 @@
|
||||
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
|
||||
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||
</div>
|
||||
+3
@@ -51,6 +51,9 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_experience_back_end_experience_path(:user_id => @user.id), :class => 'btn btn-primary pull-right' %>
|
||||
|
||||
|
||||
<div class="form-actions form-fixed pagination-right">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_experience_plugin_experience_path, :class => 'btn btn-primary pull-right' %>
|
||||
<div id="experience_pagination" class="paginationFixed">
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ module PersonalExperience
|
||||
OrbitApp.registration "Experience",:type=> 'ModuleApp' do
|
||||
|
||||
base_url File.expand_path File.dirname(__FILE__)
|
||||
personal_plugin :enable => true,:path=>"panel/personal_experience/plugin/profile"
|
||||
personal_plugin :enable => true,:path=>"panel/personal_experience/plugin/profile",:i18n=>'admin.personal_experience'
|
||||
|
||||
|
||||
end
|
||||
|
||||
+15
-1
@@ -135,10 +135,24 @@ class Panel::PersonalHonor::BackEnd::HonorsController < OrbitBackendController
|
||||
|
||||
@honor.create_user_id = current_user.id
|
||||
@honor.update_user_id = current_user.id
|
||||
|
||||
if params[:honor][:user_id]
|
||||
@honor.create_user_id = params[:honor][:user_id]
|
||||
@honor.update_user_id = params[:honor][:user_id]
|
||||
else
|
||||
@honor.create_user_id = current_user.id
|
||||
@honor.update_user_id = current_user.id
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @honor.save
|
||||
format.html { redirect_to(panel_personal_honor_back_end_honors_url) }
|
||||
|
||||
if params[:honor][:user_id]
|
||||
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:honor][:user_id],:show_plugin_profile=>'Honor')) }
|
||||
else
|
||||
format.html { redirect_to(panel_personal_honor_back_end_honors_url) }
|
||||
end
|
||||
|
||||
format.xml { render :xml => @honor, :status => :created, :location => @honor }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
|
||||
@@ -22,8 +22,8 @@ class Honor
|
||||
field :keywords
|
||||
field :url
|
||||
field :note
|
||||
field :create_user_id
|
||||
field :update_user_id
|
||||
field :create_user_id, :type => BSON::ObjectId
|
||||
field :update_user_id, :type => BSON::ObjectId
|
||||
|
||||
# field :is_top, :type => Boolean, :default => false
|
||||
# field :is_hot, :type => Boolean, :default => false
|
||||
|
||||
vendor/built_in_modules/personal_honor/app/views/panel/personal_honor/back_end/honors/_form.html.erb
Vendored
+10
@@ -30,6 +30,15 @@
|
||||
|
||||
<div id="post-body">
|
||||
<div id="post-body-content" class="clear">
|
||||
|
||||
<% if !params[:user_id].blank? %>
|
||||
|
||||
<div class="span6">
|
||||
<%= t("著作人")%>
|
||||
<%= User.from_id(params[:user_id]).name rescue ''%>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :year ,t("personal_honor.year")%>
|
||||
@@ -81,6 +90,7 @@
|
||||
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
|
||||
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||
</div>
|
||||
|
||||
Vendored
+3
@@ -51,6 +51,9 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_honor_back_end_honor_path(:user_id => @user.id), :class => 'btn btn-primary pull-right' %>
|
||||
|
||||
|
||||
<div class="form-actions form-fixed pagination-right">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_honor_plugin_honor_path, :class => 'btn btn-primary pull-right' %>
|
||||
<div id="honor_pagination" class="paginationFixed">
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ module PersonalHonor
|
||||
OrbitApp.registration "Honor",:type=> 'ModuleApp' do
|
||||
|
||||
base_url File.expand_path File.dirname(__FILE__)
|
||||
personal_plugin :enable => true,:path=>"panel/personal_honor/plugin/profile"
|
||||
personal_plugin :enable => true,:path=>"panel/personal_honor/plugin/profile",:i18n=>'admin.personal_honor'
|
||||
|
||||
|
||||
end
|
||||
|
||||
+17
-5
@@ -217,13 +217,25 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
|
||||
|
||||
@writing_journal = WritingJournal.new(params[:writing_journal])
|
||||
|
||||
@writing_journal.create_user_id = current_user.id
|
||||
@writing_journal.update_user_id = current_user.id
|
||||
|
||||
if params[:writing_journal][:user_id]
|
||||
@writing_journal.create_user_id = params[:writing_journal][:user_id]
|
||||
@writing_journal.update_user_id = params[:writing_journal][:user_id]
|
||||
else
|
||||
@writing_journal.create_user_id = current_user.id
|
||||
@writing_journal.update_user_id = current_user.id
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @writing_journal.save
|
||||
format.html { redirect_to(panel_personal_journal_back_end_writing_journals_url) }
|
||||
format.xml { render :xml => @writing_journal, :status => :created, :location => @writing_journal }
|
||||
|
||||
if params[:writing_journal][:user_id]
|
||||
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:writing_journal][:user_id],:show_plugin_profile=>Journal)) }
|
||||
else
|
||||
format.html { redirect_to(panel_personal_journal_back_end_writing_journals_url) }
|
||||
end
|
||||
|
||||
format.xml { render :xml => @writing_journal, :status => :created, :location => @writing_journal }
|
||||
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @writing_journal.errors, :status => :unprocessable_entity }
|
||||
|
||||
@@ -26,15 +26,16 @@ class WritingJournal
|
||||
field :isbn
|
||||
field :vol_no
|
||||
field :issue_no
|
||||
field :form_to
|
||||
field :form_to_start
|
||||
field :form_to_end
|
||||
field :total_pages
|
||||
field :keywords
|
||||
field :abstract
|
||||
field :publication_date, :type => Date
|
||||
field :url
|
||||
field :note
|
||||
field :create_user_id
|
||||
field :update_user_id
|
||||
field :create_user_id, :type => BSON::ObjectId
|
||||
field :update_user_id, :type => BSON::ObjectId
|
||||
|
||||
# field :is_top, :type => Boolean, :default => false
|
||||
# field :is_hot, :type => Boolean, :default => false
|
||||
|
||||
+129
-96
@@ -25,38 +25,6 @@
|
||||
<%= f.text_area :note, :size => "60x3" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="widget-tags" class="widget-box widget-size-300">
|
||||
<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><%= f.label :level_type ,t("personal_journal.level_type")%></h3>
|
||||
<div class="widget-content clear form-horizontal">
|
||||
<% @level_types.each do |level_type| %>
|
||||
<%= content_tag :label,:class => "checkbox inline" do -%>
|
||||
<%= check_box_tag 'writing_journal[journal_level_type_ids][]', level_type.id, @writing_journal.journal_level_type_ids.include?(level_type.id)%>
|
||||
<%= level_type.title %>
|
||||
<%= hidden_field_tag 'writing_journal[journal_level_type_ids][]', '' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="widget-tags" class="widget-box widget-size-300">
|
||||
<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><%= f.label :author_type ,t("personal_journal.author_type")%></h3>
|
||||
<div class="widget-content clear form-horizontal">
|
||||
<% @author_types.each do |author_type| %>
|
||||
<%= content_tag :label,:class => "checkbox inline" do -%>
|
||||
<%= check_box_tag 'writing_journal[journal_author_type_ids][]', author_type.id, @writing_journal.journal_author_type_ids.include?(author_type.id)%>
|
||||
<%= author_type.title %>
|
||||
<%= hidden_field_tag 'writing_journal[journal_author_type_ids][]', '' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="widget-tags" class="widget-box widget-size-300">
|
||||
@@ -83,15 +51,24 @@
|
||||
|
||||
<div id="post-body">
|
||||
<div id="post-body-content" class="clear">
|
||||
|
||||
|
||||
<% if !params[:user_id].blank? %>
|
||||
|
||||
<div class="span6">
|
||||
<%= t("著作人")%>
|
||||
<%= User.from_id(params[:user_id]).name rescue ''%>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<div class="span6">
|
||||
<%= f.label :year ,t("personal_journal.year")%>
|
||||
<%= select_year((@writing_journal.year ? @writing_journal.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_journal[year]'} ) %>
|
||||
<%= select_year((@writing_journal.year ? @writing_journal.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_journal[year]', :class => "span6"} ) %>
|
||||
</div>
|
||||
|
||||
<div class="span6">
|
||||
<%= f.label :language, t("personal_journal.language") %>
|
||||
<%= f.select :language, WritingJournal::LANGUAGE_TYPES, :prompt => 'Select' %>
|
||||
<%= f.select :language, WritingJournal::LANGUAGE_TYPES, :prompt => 'Select', :class => "span6" %>
|
||||
</div>
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
@@ -105,86 +82,141 @@
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
<div class="title">
|
||||
<%= f.label :paper_title ,t("personal_journal.paper_title")%>
|
||||
<%= f.fields_for :paper_title_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'post-title', :value => (@writing_journal.paper_title_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :journal_title ,t("personal_journal.journal_title")%>
|
||||
<%= f.fields_for :journal_title_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'post-title', :value => (@writing_journal.journal_title_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :authors,t("web_resource.authors") %>
|
||||
<%= f.fields_for :authors_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_area locale, :size => "60x3", :value => (@writing_journal.authors_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= f.label :paper_title ,t("personal_journal.paper_title")%>
|
||||
<%= f.fields_for :paper_title_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'span12', :value => (@writing_journal.paper_title_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
<br>
|
||||
|
||||
<%= f.label :journal_title ,t("personal_journal.journal_title")%>
|
||||
<%= f.fields_for :journal_title_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'span12', :value => (@writing_journal.journal_title_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
<br>
|
||||
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<%= f.label :level_type ,t("personal_journal.level_type")%>
|
||||
<div class="form-inline">
|
||||
<ul class="nav nav-pills">
|
||||
<% @level_types.each_with_index do |level_type, i| %>
|
||||
<li class="pull-left">
|
||||
<%= check_box_tag 'writing_journal[journal_level_type_ids][]', level_type.id, @writing_journal.journal_level_type_ids.include?(level_type.id), :id => "field-#{i}" %>
|
||||
<label for="field-<%= i %>"><%= level_type.title %></label>
|
||||
<%= hidden_field_tag 'writing_journal[journal_level_type_ids][]', '' %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="span3">
|
||||
<%= f.label :vol_no, t("personal_journal.vol_no") %>
|
||||
<%= f.text_field :vol_no %>
|
||||
</div>
|
||||
|
||||
<div class="span3">
|
||||
<%= f.label :issue_no, t("personal_journal.issue_no") %>
|
||||
<%= f.text_field :issue_no %>
|
||||
</div>
|
||||
|
||||
<div class="span3">
|
||||
<%= f.label :form_to, t("personal_journal.form_to") %>
|
||||
<%= f.text_field :form_to_start, :class=>'span1' %> ~ <%= f.text_field :form_to_end, :class=>'span1' %>
|
||||
</div>
|
||||
|
||||
<div class="span3">
|
||||
<%= f.label :total_pages, t("personal_journal.total_pages") %>
|
||||
<%= f.text_field :total_pages %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="span5">
|
||||
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :authors,t("web_resource.authors") %>
|
||||
<%= f.fields_for :authors_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'span5', :value => (@writing_journal.authors_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="span7">
|
||||
<label> </label>
|
||||
<input type="text" name="" id="" class="span7">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="span5">
|
||||
<%= f.label :author_type ,t("personal_journal.author_type")%>
|
||||
|
||||
<div class="form-inline">
|
||||
<ul class="nav nav-pills">
|
||||
<% @author_types.each_with_index do |author_type, i | %>
|
||||
<li class="pull-left">
|
||||
<%= check_box_tag 'writing_journal[journal_author_type_ids][]', author_type.id, @writing_journal.journal_author_type_ids.include?(author_type.id), :id => "field-#{i}" %>
|
||||
<label for="field-<%= i %>"><%= author_type.title %></label>
|
||||
<%= hidden_field_tag 'writing_journal[journal_author_type_ids][]', '' %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="span7">
|
||||
<%= f.label :paper_type ,t("personal_journal.paper_type")%>
|
||||
<%= f.select :journal_paper_type_id, @paper_types.collect {|t| [ t.title, t.id ]} %>
|
||||
<div class="span7">
|
||||
<%= f.label :paper_type ,t("personal_journal.paper_type")%>
|
||||
<%= f.select :journal_paper_type_id, @paper_types.collect {|t| [ t.title, t.id ]}, :class => "span7" %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<%= f.label :isbn, t("personal_journal.isbn") %>
|
||||
<%= f.text_field :isbn , :class => "span12" %>
|
||||
<br>
|
||||
|
||||
<%= f.label :keywords, t("personal_journal.keywords") %>
|
||||
<%= f.text_field :keywords , :class => "span12" %>
|
||||
<br>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :publication_date ,t("personal_journal.publication_date")%>
|
||||
<%= f.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 'span1'} %>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :isbn, t("personal_journal.isbn") %>
|
||||
<%= f.text_field :isbn %>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :vol_no, t("personal_journal.vol_no") %>
|
||||
<%= f.text_field :vol_no %>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :issue_no, t("personal_journal.issue_no") %>
|
||||
<%= f.text_field :issue_no %>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :form_to, t("personal_journal.form_to") %>
|
||||
<%= f.text_field :form_to %>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :total_pages, t("personal_journal.total_pages") %>
|
||||
<%= f.text_field :total_pages %>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :url, t("personal_journal.url") %>
|
||||
<%= f.text_field :url %>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :keywords, t("personal_journal.keywords") %>
|
||||
<%= f.text_field :keywords %>
|
||||
</div>
|
||||
<%= f.label :url, t("personal_journal.url") %>
|
||||
<%= f.text_field :url , :class => "span12" %>
|
||||
<br>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
|
||||
@@ -234,6 +266,7 @@
|
||||
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
|
||||
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||
</div>
|
||||
|
||||
Vendored
+9
@@ -29,6 +29,9 @@
|
||||
<tr>
|
||||
<th class="span1"><%= t('writing_journal.year') %></th>
|
||||
<th class="span3"><%= t('writing_journal.title') %></th>
|
||||
<% if not @user%>
|
||||
<th class="span3"><%= t('writing_journal.authors') %></th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_writing_journals" class="sort-holder">
|
||||
@@ -41,6 +44,9 @@
|
||||
<td>
|
||||
<%= link_to writing_journal.create_link, panel_personal_journal_front_end_writing_journal_path(writing_journal) %>
|
||||
</td>
|
||||
<% if not @user%>
|
||||
<td><%= writing_journal.authors %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
@@ -49,6 +55,9 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_journal_back_end_writing_journal_path(:user_id => @user.id), :class => 'btn btn-primary pull-right' %>
|
||||
|
||||
|
||||
<div class="form-actions form-fixed pagination-right">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_journal_plugin_writing_journal_path, :class => 'btn btn-primary pull-right' %>
|
||||
<div id="writing_journal_pagination" class="paginationFixed">
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ module PersonalJournal
|
||||
OrbitApp.registration "Journal",:type=> 'ModuleApp' do
|
||||
|
||||
base_url File.expand_path File.dirname(__FILE__)
|
||||
personal_plugin :enable => true,:path=>"panel/personal_journal/plugin/profile"
|
||||
personal_plugin :enable => true,:path=>"panel/personal_journal/plugin/profile",:i18n=>'admin.personal_journal'
|
||||
|
||||
|
||||
end
|
||||
|
||||
Vendored
+14
-4
@@ -89,13 +89,23 @@ class Panel::PersonalLab::BackEnd::LabsController < OrbitBackendController
|
||||
get_tags
|
||||
|
||||
@lab = Lab.new(params[:lab])
|
||||
|
||||
@lab.create_user_id = current_user.id
|
||||
@lab.update_user_id = current_user.id
|
||||
|
||||
if params[:lab][:user_id]
|
||||
@lab.create_user_id = params[:lab][:user_id]
|
||||
@lab.update_user_id = params[:lab][:user_id]
|
||||
else
|
||||
@lab.create_user_id = current_user.id
|
||||
@lab.update_user_id = current_user.id
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @lab.save
|
||||
format.html { redirect_to(panel_personal_lab_back_end_labs_url) }
|
||||
if params[:lab][:user_id]
|
||||
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:lab][:user_id],:show_plugin_profile=>'Lab')) }
|
||||
else
|
||||
format.html { redirect_to(panel_personal_lab_back_end_labs_url) }
|
||||
end
|
||||
|
||||
format.xml { render :xml => @lab, :status => :created, :location => @lab }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
|
||||
+2
-2
@@ -25,8 +25,8 @@ class Lab
|
||||
field :facility
|
||||
field :url
|
||||
field :note
|
||||
field :create_user_id
|
||||
field :update_user_id
|
||||
field :create_user_id, :type => BSON::ObjectId
|
||||
field :update_user_id, :type => BSON::ObjectId
|
||||
|
||||
# field :is_top, :type => Boolean, :default => false
|
||||
# field :is_hot, :type => Boolean, :default => false
|
||||
|
||||
Vendored
+10
@@ -30,6 +30,15 @@
|
||||
|
||||
<div id="post-body">
|
||||
<div id="post-body-content" class="clear">
|
||||
|
||||
<% if !params[:user_id].blank? %>
|
||||
|
||||
<div class="span6">
|
||||
<%= t("著作人")%>
|
||||
<%= User.from_id(params[:user_id]).name rescue ''%>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :year ,t("personal_lab.year")%>
|
||||
@@ -176,6 +185,7 @@
|
||||
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
|
||||
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||
</div>
|
||||
|
||||
+3
@@ -53,6 +53,9 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_lab_back_end_lab_path(:user_id => @user.id), :class => 'btn btn-primary pull-right' %>
|
||||
|
||||
|
||||
<div class="form-actions form-fixed pagination-right">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_lab_plugin_lab_path, :class => 'btn btn-primary pull-right' %>
|
||||
<div id="lab_pagination" class="paginationFixed">
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ module PersonalLab
|
||||
OrbitApp.registration "Lab",:type=> 'ModuleApp' do
|
||||
|
||||
base_url File.expand_path File.dirname(__FILE__)
|
||||
personal_plugin :enable => true,:path=>"panel/personal_lab/plugin/profile"
|
||||
personal_plugin :enable => true,:path=>"panel/personal_lab/plugin/profile",:i18n=>'admin.personal_lab'
|
||||
|
||||
|
||||
end
|
||||
|
||||
Whitespace-only changes.
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
Whitespace-only changes.
-23
@@ -1,23 +0,0 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
protect_from_forgery
|
||||
before_filter :set_locale
|
||||
|
||||
# Set I18n.locale
|
||||
def set_locale
|
||||
# update session if passed
|
||||
session[:locale] = params[:locale] if params[:locale]
|
||||
|
||||
# set locale based on session or default
|
||||
begin
|
||||
# check if locale is valid for non site pages
|
||||
if !VALID_LOCALES.include?(session[:locale])
|
||||
I18n.locale = I18n.default_locale
|
||||
else
|
||||
I18n.locale = session[:locale]
|
||||
end
|
||||
rescue
|
||||
I18n.locale = I18n.default_locale
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
class Panel::PersonalPatent::BackEnd::TagsController < Admin::TagsController
|
||||
|
||||
def initialize
|
||||
super
|
||||
@app_title = 'personal_patent'
|
||||
end
|
||||
|
||||
end
|
||||
-119
@@ -1,119 +0,0 @@
|
||||
class Panel::PersonalPatent::BackEnd::WritingPatentCategorysController < OrbitBackendController
|
||||
include OrbitControllerLib::DivisionForDisable
|
||||
|
||||
before_filter :force_order_for_visitor,:only=>[:index,:show]
|
||||
before_filter :force_order_for_user,:except => [:index,:show]
|
||||
before_filter :for_app_manager,:except => [:index]
|
||||
|
||||
def index
|
||||
|
||||
@writing_patent_categorys = WritingPatentCategory.all
|
||||
@writing_patent_category = WritingPatentCategory.new(:display => 'List')
|
||||
|
||||
@url = panel_personal_patent_back_end_writing_patent_categorys_path
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# GET /projects/1
|
||||
# GET /projects/1.xml
|
||||
def show
|
||||
|
||||
@writing_patent_category = WritingPatentCategory.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# GET /projects/new
|
||||
# GET /projects/new.xml
|
||||
def new
|
||||
|
||||
@writing_patent_category = WritingPatentCategory.new(:display => 'List')
|
||||
|
||||
@verb = :post
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# GET /projects/1/edit
|
||||
def edit
|
||||
|
||||
@writing_patent_category = WritingPatentCategory.find(params[:id])
|
||||
|
||||
@url = panel_personal_patent_back_end_writing_patent_category_path(@writing_patent_category)
|
||||
|
||||
@verb = :put
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# POST /projects
|
||||
# POST /projects.xml
|
||||
def create
|
||||
|
||||
@writing_patent_category = WritingPatentCategory.new(params[:writing_patent_category])
|
||||
|
||||
respond_to do |format|
|
||||
if @writing_patent_category.save
|
||||
format.html { redirect_to(panel_personal_patent_back_end_writing_patent_categorys_url, :notice => t('writing_patent_category.create_writing_patent_category_success')) }
|
||||
format.js
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.js { render action: "new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /projects/1
|
||||
# PUT /projects/1.xml
|
||||
def update
|
||||
|
||||
@writing_patent_category = WritingPatentCategory.find(params[:id])
|
||||
# debugger
|
||||
@url = panel_personal_patent_back_end_writing_patent_category_path(@writing_patent_category)
|
||||
|
||||
respond_to do |format|
|
||||
if @writing_patent_category.update_attributes(params[:writing_patent_category])
|
||||
format.html { redirect_to(panel_personal_patent_back_end_writing_patent_categorys_url, :notice => t('writing_patent_category.update_writing_patent_category_success')) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.js { render :action => "edit" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /projects/1
|
||||
# DELETE /projects/1.xml
|
||||
def destroy
|
||||
|
||||
@writing_patent_category = WritingPatentCategory.find(params[:id])
|
||||
@writing_patent_category.disable = @writing_patent_category.disable ? false : true
|
||||
|
||||
if @writing_patent_category.save!
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(panel_personal_patent_back_end_writing_patent_categorys_url) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
end
|
||||
else
|
||||
flash[:error] = t("writing_patent_category.update_failed")
|
||||
format.html { render :action => "index" }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
-244
@@ -1,244 +0,0 @@
|
||||
class Panel::PersonalPatent::BackEnd::WritingPatentsController < OrbitBackendController
|
||||
include AdminHelper
|
||||
include OrbitControllerLib::DivisionForDisable
|
||||
|
||||
before_filter :authenticate_user!
|
||||
before_filter :force_order_for_visitor,:only=>[:index,:show]
|
||||
before_filter :force_order_for_user,:except => [:index,:show]
|
||||
# before_filter :for_app_manager,:except => [:index,:show]
|
||||
before_filter :only => [ :new,:create,:edit,:update,:create] do |controller|
|
||||
controller.get_categorys('WritingPatentCategory')
|
||||
end
|
||||
|
||||
def index
|
||||
|
||||
get_categorys("WritingPatentCategory",params[:writing_patent_category_id])
|
||||
@filter = params[:filter]
|
||||
new_filter = params[:new_filter]
|
||||
|
||||
if @filter && params[:clear]
|
||||
@filter.delete(params[:type])
|
||||
elsif @filter && new_filter
|
||||
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
|
||||
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
|
||||
elsif @filter.has_key?(new_filter[:type])
|
||||
@filter[new_filter[:type]] << new_filter[:id].to_s
|
||||
else
|
||||
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
|
||||
end
|
||||
elsif new_filter
|
||||
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
|
||||
end
|
||||
|
||||
|
||||
@writing_patent_categorys = get_categories_for_index("WritingPatentCategory")
|
||||
@writing_patent_category_ids = @writing_patent_categorys.collect{|t| t.id.to_s} + [nil]
|
||||
|
||||
@writing_patents = (params[:sort] || @filter) ? get_sorted_and_filtered("writing_patent",:writing_patent_category_id.in => @writing_patent_category_ids) : get_viewable("writing_patent",:writing_patent_category_id.in => @writing_patent_category_ids)
|
||||
|
||||
get_tags
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @writing_patents }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def writing_patent_setting
|
||||
|
||||
@writing_patent_categorys = WritingPatentCategory.all
|
||||
|
||||
get_tags
|
||||
|
||||
@set_writing_patent_category = WritingPatentCategory.new(:display => 'List')
|
||||
@writing_patent_category_url = panel_personal_patent_back_end_writing_patents_path
|
||||
|
||||
|
||||
end
|
||||
|
||||
def writing_patent_category_quick_add
|
||||
@set_writing_patent_category = WritingPatentCategory.new(:display => 'List')
|
||||
@writing_patent_category_url = panel_personal_patent_back_end_writing_patents_path
|
||||
@set_writing_patent_category.id = params[:id]
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def writing_patent_category_quick_edit
|
||||
|
||||
@set_writing_patent_category = WritingPatentCategory.find(params[:writing_patent_id])
|
||||
@writing_patent_category_url = panel_personal_patent_back_end_writing_patent_path(@set_writing_patent_category)
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# GET /writing_patents/1
|
||||
# GET /writing_patents/1.xml
|
||||
def show
|
||||
@writing_patent = WritingPatent.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @writing_patent }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /writing_patents/new
|
||||
# GET /writing_patents/new.xml
|
||||
def new
|
||||
|
||||
@writing_patent = WritingPatent.new
|
||||
debugger
|
||||
@writing_patent_categorys = WritingPatentCategory.all
|
||||
|
||||
get_tags
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @writing_patent }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /writing_patents/1/edit
|
||||
def edit
|
||||
@writing_patent = WritingPatent.find(params[:id])
|
||||
|
||||
@writing_patent_categorys = WritingPatentCategory.all
|
||||
|
||||
get_tags
|
||||
end
|
||||
|
||||
# POST /writing_patents
|
||||
# POST /writing_patents.xml
|
||||
def create
|
||||
|
||||
if params[:writing_patent_category]
|
||||
|
||||
@writing_patent_category = WritingPatentCategory.new(params[:writing_patent_category])
|
||||
|
||||
respond_to do |format|
|
||||
if @writing_patent_category.save
|
||||
format.js { render 'create_writing_patent_setting' }
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
|
||||
@writing_patent_categorys = WritingPatentCategory.all
|
||||
get_tags
|
||||
|
||||
@writing_patent = WritingPatent.new(params[:writing_patent])
|
||||
|
||||
@writing_patent.create_user_id = current_user.id
|
||||
@writing_patent.update_user_id = current_user.id
|
||||
|
||||
respond_to do |format|
|
||||
if @writing_patent.save
|
||||
format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) }
|
||||
format.xml { render :xml => @writing_patent, :status => :created, :location => @writing_patent }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @writing_patent.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# PUT /writing_patents/1
|
||||
# PUT /writing_patents/1.xml
|
||||
def update
|
||||
|
||||
if params[:writing_patent_category]
|
||||
|
||||
@writing_patent_category = WritingPatentCategory.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
if @writing_patent_category.update_attributes(params[:writing_patent_category])
|
||||
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||
format.js { render 'update_writing_patent_setting' }
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
@writing_patent = WritingPatent.find(params[:id])
|
||||
|
||||
@writing_patent.update_user_id = current_user.id
|
||||
|
||||
params[:writing_patent][:tag_ids] ||=[]
|
||||
|
||||
respond_to do |format|
|
||||
if @writing_patent.update_attributes(params[:writing_patent])
|
||||
format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) }
|
||||
# format.js { render 'toggle_enable' }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @writing_patent.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# DELETE /writing_patents/1
|
||||
# DELETE /writing_patents/1.xml
|
||||
def destroy
|
||||
@writing_patent = WritingPatent.find(params[:id])
|
||||
@writing_patent.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def delete
|
||||
if params[:ids]
|
||||
writing_patents = WritingPatent.any_in(:_id => params[:ids]).delete_all
|
||||
end
|
||||
redirect_to panel_personal_patent_back_end_writing_patents_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
|
||||
# def get_index_categories(id = nil)
|
||||
# @bulletin_categorys = []
|
||||
# if(is_manager? || is_admin?)
|
||||
# @bulletin_categorys = (id ? BulletinCategory.admin_manager_all.find(id).to_a : BulletinCategory.admin_manager_all)
|
||||
# elsif is_sub_manager?
|
||||
# @bulletin_categorys = BulletinCategory.all
|
||||
# end
|
||||
# @bulletin_categorys
|
||||
# end
|
||||
|
||||
|
||||
# def get_categorys(id = nil)
|
||||
# @writing_patent_categorys = []
|
||||
# if(is_manager? || is_admin?)
|
||||
# @writing_patent_categorys = (id ? WritingPatent.admin_manager_all.find(id).to_a : WritingPatent.admin_manager_all))
|
||||
# elsif is_sub_manager?
|
||||
# @writing_patent_categorys = WritingPatent.all.authed_for_user(current_user,'edit')
|
||||
# end
|
||||
# if @writing_patent_categorys.empty? && params[:action] != "index"
|
||||
# flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
|
||||
# redirect_to :action => :index
|
||||
# end
|
||||
# end
|
||||
|
||||
def get_tags
|
||||
module_app = ModuleApp.first(:conditions => {:key => 'personal_patent'})
|
||||
@tags = Tag.all(:conditions => {:module_app_id => module_app.id})
|
||||
end
|
||||
|
||||
end
|
||||
-244
@@ -1,244 +0,0 @@
|
||||
class Panel::PersonalPatent::BackEnd::WritingPatentsController < OrbitBackendController
|
||||
include AdminHelper
|
||||
include OrbitControllerLib::DivisionForDisable
|
||||
|
||||
before_filter :authenticate_user!
|
||||
before_filter :force_order_for_visitor,:only=>[:index,:show]
|
||||
before_filter :force_order_for_user,:except => [:index,:show]
|
||||
# before_filter :for_app_manager,:except => [:index,:show]
|
||||
before_filter :only => [ :new,:create,:edit,:update,:create] do |controller|
|
||||
controller.get_categorys('WritingPatentCategory')
|
||||
end
|
||||
|
||||
def index
|
||||
|
||||
get_categorys("WritingPatentCategory",params[:writing_patent_writing_patent_category_id])
|
||||
@filter = params[:filter]
|
||||
new_filter = params[:new_filter]
|
||||
|
||||
if @filter && params[:clear]
|
||||
@filter.delete(params[:type])
|
||||
elsif @filter && new_filter
|
||||
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
|
||||
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
|
||||
elsif @filter.has_key?(new_filter[:type])
|
||||
@filter[new_filter[:type]] << new_filter[:id].to_s
|
||||
else
|
||||
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
|
||||
end
|
||||
elsif new_filter
|
||||
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
|
||||
end
|
||||
|
||||
|
||||
@writing_patent_categorys = get_categories_for_index("WritingPatentCategory")
|
||||
@writing_patent_category_ids = @writing_patent_categorys.collect{|t| t.id.to_s} + [nil]
|
||||
|
||||
@writing_patents = (params[:sort] || @filter) ? get_sorted_and_filtered("writing_patent",:writing_patent_category_id.in => @writing_patent_category_ids) : get_viewable("writing_patent",:writing_patent_category_id.in => @writing_patent_category_ids)
|
||||
|
||||
get_tags
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @writing_patents }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def writing_patent_setting
|
||||
|
||||
@writing_patent_categorys = WritingPatentCategory.all
|
||||
|
||||
get_tags
|
||||
|
||||
@set_writing_patent_category = WritingPatentCategory.new(:display => 'List')
|
||||
@writing_patent_category_url = panel_personal_patent_back_end_writing_patents_path
|
||||
|
||||
|
||||
end
|
||||
|
||||
def writing_patent_category_quick_add
|
||||
@set_writing_patent_category = WritingPatentCategory.new(:display => 'List')
|
||||
@writing_patent_category_url = panel_personal_patent_back_end_writing_patents_path
|
||||
@set_writing_patent_category.id = params[:id]
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def writing_patent_category_quick_edit
|
||||
|
||||
@set_writing_patent_category = WritingPatentCategory.find(params[:writing_patent_id])
|
||||
@writing_patent_category_url = panel_personal_patent_back_end_writing_patent_path(@set_writing_patent_category)
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# GET /writing_patents/1
|
||||
# GET /writing_patents/1.xml
|
||||
def show
|
||||
@writing_patent = Project.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @writing_patent }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /writing_patents/new
|
||||
# GET /writing_patents/new.xml
|
||||
def new
|
||||
|
||||
@writing_patent = Project.new
|
||||
|
||||
@writing_patent_categorys = WritingPatentCategory.all
|
||||
|
||||
get_tags
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @writing_patent }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /writing_patents/1/edit
|
||||
def edit
|
||||
@writing_patent = Project.find(params[:id])
|
||||
|
||||
@writing_patent_categorys = WritingPatentCategory.all
|
||||
|
||||
get_tags
|
||||
end
|
||||
|
||||
# POST /writing_patents
|
||||
# POST /writing_patents.xml
|
||||
def create
|
||||
|
||||
if params[:writing_patent_category]
|
||||
|
||||
@writing_patent_category = WritingPatentCategory.new(params[:writing_patent_category])
|
||||
|
||||
respond_to do |format|
|
||||
if @writing_patent_category.save
|
||||
format.js { render 'create_writing_patent_setting' }
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
|
||||
@writing_patent_categorys = WritingPatentCategory.all
|
||||
get_tags
|
||||
|
||||
@writing_patent = Project.new(params[:writing_patent])
|
||||
|
||||
@writing_patent.create_user_id = current_user.id
|
||||
@writing_patent.update_user_id = current_user.id
|
||||
|
||||
respond_to do |format|
|
||||
if @writing_patent.save
|
||||
format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) }
|
||||
format.xml { render :xml => @writing_patent, :status => :created, :location => @writing_patent }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @writing_patent.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# PUT /writing_patents/1
|
||||
# PUT /writing_patents/1.xml
|
||||
def update
|
||||
|
||||
if params[:writing_patent_category]
|
||||
|
||||
@writing_patent_category = WritingPatentCategory.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
if @writing_patent_category.update_attributes(params[:writing_patent_category])
|
||||
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||
format.js { render 'update_writing_patent_setting' }
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
@writing_patent = Project.find(params[:id])
|
||||
|
||||
@writing_patent.update_user_id = current_user.id
|
||||
|
||||
params[:writing_patent][:tag_ids] ||=[]
|
||||
|
||||
respond_to do |format|
|
||||
if @writing_patent.update_attributes(params[:writing_patent])
|
||||
format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) }
|
||||
# format.js { render 'toggle_enable' }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @writing_patent.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# DELETE /writing_patents/1
|
||||
# DELETE /writing_patents/1.xml
|
||||
def destroy
|
||||
@writing_patent = Project.find(params[:id])
|
||||
@writing_patent.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def delete
|
||||
if params[:ids]
|
||||
writing_patents = Project.any_in(:_id => params[:ids]).delete_all
|
||||
end
|
||||
redirect_to panel_personal_patent_back_end_writing_patents_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
|
||||
# def get_index_categories(id = nil)
|
||||
# @bulletin_categorys = []
|
||||
# if(is_manager? || is_admin?)
|
||||
# @bulletin_categorys = (id ? BulletinCategory.admin_manager_all.find(id).to_a : BulletinCategory.admin_manager_all)
|
||||
# elsif is_sub_manager?
|
||||
# @bulletin_categorys = BulletinCategory.all
|
||||
# end
|
||||
# @bulletin_categorys
|
||||
# end
|
||||
|
||||
|
||||
# def get_categorys(id = nil)
|
||||
# @writing_patent_categorys = []
|
||||
# if(is_manager? || is_admin?)
|
||||
# @writing_patent_categorys = (id ? Project.admin_manager_all.find(id).to_a : Project.admin_manager_all))
|
||||
# elsif is_sub_manager?
|
||||
# @writing_patent_categorys = Project.all.authed_for_user(current_user,'edit')
|
||||
# end
|
||||
# if @writing_patent_categorys.empty? && params[:action] != "index"
|
||||
# flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
|
||||
# redirect_to :action => :index
|
||||
# end
|
||||
# end
|
||||
|
||||
def get_tags
|
||||
module_app = ModuleApp.first(:conditions => {:key => 'personal_patent'})
|
||||
@tags = Tag.all(:conditions => {:module_app_id => module_app.id})
|
||||
end
|
||||
|
||||
end
|
||||
-181
@@ -1,181 +0,0 @@
|
||||
class Panel::PersonalPatent::Plugin::WritingPatentsController < OrbitBackendController
|
||||
include AdminHelper
|
||||
include OrbitControllerLib::DivisionForDisable
|
||||
|
||||
before_filter :authenticate_user!
|
||||
before_filter :force_order_for_visitor,:only=>[:index,:show]
|
||||
before_filter :force_order_for_user,:except => [:index,:show]
|
||||
# before_filter :for_app_manager,:except => [:index,:show]
|
||||
before_filter :only => [ :new,:create,:edit,:update,:create] do |controller|
|
||||
controller.get_categorys('WritingPatentCategory')
|
||||
end
|
||||
|
||||
def index
|
||||
|
||||
get_categorys("WritingPatentCategory",params[:writing_patent_writing_patent_category_id])
|
||||
@filter = params[:filter]
|
||||
new_filter = params[:new_filter]
|
||||
|
||||
if @filter && params[:clear]
|
||||
@filter.delete(params[:type])
|
||||
elsif @filter && new_filter
|
||||
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
|
||||
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
|
||||
elsif @filter.has_key?(new_filter[:type])
|
||||
@filter[new_filter[:type]] << new_filter[:id].to_s
|
||||
else
|
||||
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
|
||||
end
|
||||
elsif new_filter
|
||||
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
|
||||
end
|
||||
|
||||
|
||||
@writing_patent_categorys = get_categories_for_index("WritingPatentCategory")
|
||||
@writing_patent_category_ids = @writing_patent_categories.collect{|t| t.id.to_s} + [nil]
|
||||
|
||||
@writing_patents = (params[:sort] || @filter) ? get_sorted_and_filtered("writing_patent",:create_user_id => current_user.id) : get_viewable("writing_patent", :create_user_id => current_user.id)
|
||||
|
||||
get_tags
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @writing_patents }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# GET /writing_patents/1
|
||||
# GET /writing_patents/1.xml
|
||||
def show
|
||||
@writing_patent = Project.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @writing_patent }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /writing_patents/new
|
||||
# GET /writing_patents/new.xml
|
||||
def new
|
||||
|
||||
@writing_patent = Project.new
|
||||
|
||||
@writing_patent_categorys = WritingPatentCategory.all
|
||||
|
||||
get_tags
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @writing_patent }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /writing_patents/1/edit
|
||||
def edit
|
||||
@writing_patent = Project.find(params[:id])
|
||||
|
||||
@writing_patent_categorys = WritingPatentCategory.all
|
||||
|
||||
get_tags
|
||||
end
|
||||
|
||||
# POST /writing_patents
|
||||
# POST /writing_patents.xml
|
||||
def create
|
||||
|
||||
@writing_patent_categorys = WritingPatentCategory.all
|
||||
get_tags
|
||||
|
||||
@writing_patent = Project.new(params[:writing_patent])
|
||||
|
||||
@writing_patent.create_user_id = current_user.id
|
||||
@writing_patent.update_user_id = current_user.id
|
||||
|
||||
respond_to do |format|
|
||||
if @writing_patent.save
|
||||
format.html { redirect_to(panel_personal_writing_patent_plugin_writing_patents_url) }
|
||||
format.xml { render :xml => @writing_patent, :status => :created, :location => @writing_patent }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @writing_patent.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# PUT /writing_patents/1
|
||||
# PUT /writing_patents/1.xml
|
||||
def update
|
||||
|
||||
@writing_patent = Project.find(params[:id])
|
||||
|
||||
@writing_patent.update_user_id = current_user.id
|
||||
|
||||
params[:writing_patent][:tag_ids] ||=[]
|
||||
|
||||
respond_to do |format|
|
||||
if @writing_patent.update_attributes(params[:writing_patent])
|
||||
format.html { redirect_to(panel_personal_writing_patent_plugin_writing_patents_url) }
|
||||
# format.js { render 'toggle_enable' }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @writing_patent.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /writing_patents/1
|
||||
# DELETE /writing_patents/1.xml
|
||||
def destroy
|
||||
@writing_patent = Project.find(params[:id])
|
||||
@writing_patent.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(panel_personal_writing_patent_plugin_writing_patents_url) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def delete
|
||||
if params[:ids]
|
||||
writing_patents = Project.any_in(:_id => params[:ids]).delete_all
|
||||
end
|
||||
redirect_to panel_personal_writing_patent_plugin_writing_patents_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
|
||||
# def get_index_categories(id = nil)
|
||||
# @bulletin_categorys = []
|
||||
# if(is_manager? || is_admin?)
|
||||
# @bulletin_categorys = (id ? BulletinCategory.admin_manager_all.find(id).to_a : BulletinCategory.admin_manager_all)
|
||||
# elsif is_sub_manager?
|
||||
# @bulletin_categorys = BulletinCategory.all
|
||||
# end
|
||||
# @bulletin_categorys
|
||||
# end
|
||||
|
||||
|
||||
# def get_categorys(id = nil)
|
||||
# @writing_patent_categorys = []
|
||||
# if(is_manager? || is_admin?)
|
||||
# @writing_patent_categorys = (id ? Project.admin_manager_all.find(id).to_a : Project.admin_manager_all))
|
||||
# elsif is_sub_manager?
|
||||
# @writing_patent_categorys = Project.all.authed_for_user(current_user,'edit')
|
||||
# end
|
||||
# if @writing_patent_categorys.empty? && params[:action] != "index"
|
||||
# flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
|
||||
# redirect_to :action => :index
|
||||
# end
|
||||
# end
|
||||
|
||||
def get_tags
|
||||
module_app = ModuleApp.first(:conditions => {:key => 'personal_patent'})
|
||||
@tags = Tag.all(:conditions => {:module_app_id => module_app.id})
|
||||
end
|
||||
|
||||
end
|
||||
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
-9
@@ -1,9 +0,0 @@
|
||||
class PersonalPatentTag < Tag
|
||||
|
||||
has_and_belongs_to_many :writing_patents
|
||||
|
||||
def get_visible_links(sort = :title)
|
||||
self.writing_patents.where(:is_hidden => false).desc(:is_top, sort)
|
||||
end
|
||||
|
||||
end
|
||||
-108
@@ -1,108 +0,0 @@
|
||||
# encoding: utf-8
|
||||
|
||||
class WritingPatent
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
|
||||
# scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
|
||||
|
||||
LANGUAGE_TYPES = [ "English", "Chinese" ]
|
||||
|
||||
|
||||
field :patent_title, localize: true
|
||||
field :authors, localize: true
|
||||
|
||||
has_and_belongs_to_many :tags, :class_name => "PersonalPatentTag"
|
||||
|
||||
belongs_to :writing_patent_category
|
||||
|
||||
field :year
|
||||
field :language
|
||||
field :keywords
|
||||
field :patent_no
|
||||
field :patent_country
|
||||
field :publish_date , :type => Date
|
||||
field :url
|
||||
field :note
|
||||
field :create_user_id
|
||||
field :update_user_id
|
||||
|
||||
# field :is_top, :type => Boolean, :default => false
|
||||
# field :is_hot, :type => Boolean, :default => false
|
||||
# field :is_hidden, :type => Boolean, :default => false
|
||||
|
||||
has_many :writing_patent_files, :autosave => true, :dependent => :destroy
|
||||
|
||||
accepts_nested_attributes_for :writing_patent_files, :allow_destroy => true
|
||||
|
||||
# before_save :update_avliable_language, :clean_checkboxs
|
||||
|
||||
validates :writing_patent_title, :at_least_one => true
|
||||
|
||||
before_validation :add_http
|
||||
|
||||
after_save :save_writing_patent_files
|
||||
|
||||
validates :url, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix, :unless => Proc.new{self.url.blank?}
|
||||
|
||||
def self.search( category_id = nil )
|
||||
|
||||
if category_id.to_s.size > 0
|
||||
|
||||
find(:all, :conditions => {writing_patent_category_id: category_id}).desc( :is_top, :title )
|
||||
|
||||
else
|
||||
|
||||
find(:all).desc( :is_top, :title)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def self.widget_datas
|
||||
|
||||
where( :is_hidden => false ).desc(:is_top, :created_at)
|
||||
|
||||
end
|
||||
|
||||
def is_top?
|
||||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
tags.order_by(I18n.locale, :asc)
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
VALID_LOCALES.each do |locale|
|
||||
if (title_translations[locale].blank? rescue true)
|
||||
self["available_for_#{locale}".to_sym] = false
|
||||
else
|
||||
self["available_for_#{locale}".to_sym] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def save_writing_patent_files
|
||||
self.writing_patent_files.each do |t|
|
||||
if t.should_destroy
|
||||
t.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def add_http
|
||||
unless self.url.blank? || self.url[/^http:\/\//] || self.url[/^https:\/\//]
|
||||
self.url = 'http://' + self.url
|
||||
end
|
||||
end
|
||||
|
||||
def clean_checkboxs
|
||||
self.tag_ids.delete('')
|
||||
end
|
||||
|
||||
end
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
# encoding: utf-8
|
||||
|
||||
class WritingPatentCategory
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include OrbitCoreLib::ObjectAuthable
|
||||
include OrbitCoreLib::ObjectDisable
|
||||
# include Mongoid::MultiParameterAttributes
|
||||
AfterObjectAuthUrl = '/panel/personal_patent/back_end/writing_patent_categorys'
|
||||
APP_NAME = 'project'
|
||||
# ObjectAuthTitlesOptions = %W{edit}
|
||||
ObjectAuthTitlesOptions = %W{submit_new fact_check}
|
||||
|
||||
field :key
|
||||
|
||||
field :title, localize: true
|
||||
|
||||
has_many :writing_patents
|
||||
|
||||
def pp_object
|
||||
title
|
||||
end
|
||||
|
||||
def self.from_id(id)
|
||||
WritingPatentCategory.find(id) rescue nil
|
||||
end
|
||||
|
||||
end
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
class WritingPatentFile
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
mount_uploader :file, AssetUploader
|
||||
|
||||
# field :description, localize: true
|
||||
field :should_destroy, :type => Boolean
|
||||
field :title, localize: true
|
||||
|
||||
belongs_to :writing_patent
|
||||
|
||||
end
|
||||
Whitespace-only changes.
-30
@@ -1,30 +0,0 @@
|
||||
<% # encoding: utf-8 %>
|
||||
|
||||
<%= form_for(@writing_patent_category, :remote => true, :url => @url) do |f| %>
|
||||
|
||||
<h2><%= (@writing_patent_category.new_record? ? 'Add' : 'Edit') %></h2>
|
||||
|
||||
<div id="widget-title">
|
||||
<%= f.label :key %>
|
||||
<%= f.text_field :key %>
|
||||
</div>
|
||||
|
||||
<div id="widget-title">
|
||||
<%= 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', :value => (@web_link_category.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
|
||||
|
||||
<tr id="<%= dom_id writing_patent_category %>" class="with_action">
|
||||
<td>
|
||||
<%= writing_patent_category.key %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<li><%= link_to t('writing_patent_category.edit'), edit_panel_personal_patent_back_end_writing_patent_category_path(writing_patent_category), :remote => true %></li>
|
||||
<li><%= link_to t('writing_patent_category.delete'), panel_personal_patent_back_end_writing_patent_category_path(writing_patent_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= writing_patent_category.title_translations[locale] %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
$('<%= j render :partial => 'writing_patent_category', :collection => [@writing_patent_category] %>').appendTo('#writing_patent_categorys').hide().fadeIn();
|
||||
$("#new_writing_patent_category")[0].reset();
|
||||
-1
@@ -1 +0,0 @@
|
||||
$("#<%= dom_id @writing_patent_category %>").remove();
|
||||
-1
@@ -1 +0,0 @@
|
||||
$("#form > form").replaceWith("<%= j render "form" %>");
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
|
||||
|
||||
<%= flash_messages %>
|
||||
|
||||
<table id="writing_patent_categorys" class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span1-2"><%= t('writing_patent_category.key') %></th>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<th class="span1-2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<%= render :partial => 'writing_patent_category', :collection => @writing_patent_categorys %>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div id="form"><%= render :partial => "form" %></div>
|
||||
|
||||
|
||||
-1
@@ -1 +0,0 @@
|
||||
$("#form > form").replaceWith("<%= j render "form" %>");
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
$("#<%= dom_id @writing_patent_category %>").replaceWith("<%= j render :partial => 'link_category', :collection => [@writing_patent_category] %>");
|
||||
<% @writing_patent_category = ProjectCategory.new(:display => 'List') # reset for new form %>
|
||||
$(".edit_writing_patent_category").replaceWith("<%= j render "form" %>")
|
||||
$(".new_writing_patent_category")[0].reset();
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<div id="filter" class="subnav">
|
||||
<div class="filters">
|
||||
<div id="sort_headers" class="table-label">
|
||||
<%= render 'sort_headers' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "sort_header" %>
|
||||
<% end %>
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
<% # encoding: utf-8 %>
|
||||
|
||||
<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class='list_item'>
|
||||
<td>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<%= f.file_field :file %>
|
||||
<%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
<%#= f.fields_for :i18n_variable, (form_file.new_record? ? form_file.build_i18n_variable : form_file.i18n_variable ) do |f| %>
|
||||
<%= f.fields_for :file_title_translations do |f| %>
|
||||
<div class="control-group">
|
||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.from_locale(locale) %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :class=>'post-file_title', :value => (form_file.file_title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<span class="action">
|
||||
<% if form_file.new_record? %>
|
||||
<a class="delete"><i class="icon-remove"></i></a>
|
||||
<% else %>
|
||||
<%= f.hidden_field :id %>
|
||||
<a class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
<% end %>
|
||||
</span>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
<% # encoding: utf-8 %>
|
||||
|
||||
<tr id="<%= dom_id list_writing_patent_category %>">
|
||||
<td><%= list_writing_patent_category.title %></td>
|
||||
<td class="span2">
|
||||
|
||||
<a href="<%= panel_personal_patent_back_end_writing_patent_writing_patent_category_quick_edit_path(list_writing_patent_category) %>#myModal1" data-toggle="modal" data-remote="true" class="action"><%= t('edit')%></a>
|
||||
<%= link_to show_toggle_archive_btn(list_writing_patent_category),
|
||||
polymorphic_path([:panel, :personal_patent, :back_end, list_writing_patent_category]), :confirm => t('announcement.sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %>
|
||||
</td>
|
||||
</tr>
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
<%= render_sort_bar(true, delete_panel_personal_patent_back_end_writing_patents_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]),
|
||||
['publish_date', 'publish_date', 'span1', 'writing_patent.publish_date'],
|
||||
['patent_title', 'patent_title','span3', 'writing_patent.patent_title'],
|
||||
['patent_no', 'patent_no','span3', 'writing_patent.patent_no'],
|
||||
['patent_country', 'patent_country','span3', 'writing_patent.patent_country'],
|
||||
['authors', 'authors','span3', 'writing_patent.authors'],
|
||||
['url', 'url','span3', 'writing_patent.url'],
|
||||
['create_modified', 'create_user_id','span1-3', 'writing_patent.create_modified']).html_safe %>
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
<tr id="<%= dom_id writing_patent %>" class="with_action">
|
||||
<td>
|
||||
<% if (writing_patent.create_user_id == current_user.id) || is_manager? %>
|
||||
<%= check_box_tag 'to_delete[]', writing_patent.id, false, :class => "checkbox_in_list" %>
|
||||
<% end -%>
|
||||
</td>
|
||||
<td><%= writing_patent.publish_date.strftime("%Y.%m") %></td>
|
||||
<td>
|
||||
<%= link_to writing_patent.patent_title, panel_personal_patent_front_end_writing_patent_path(writing_patent) %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<%if at_least_module_manager || writing_patent.writing_patent_category.cur_user_is_sub_manager_of(:edit)%>
|
||||
<li><%= link_to t('edit'), edit_panel_personal_patent_back_end_writing_patent_path(writing_patent) %></li>
|
||||
<li><%= link_to t('delete'), panel_personal_patent_back_end_writing_patent_path(writing_patent), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
|
||||
<% end -%>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= writing_patent.patent_no %></td>
|
||||
<td><%= writing_patent.patent_country %></td>
|
||||
<td><%= writing_patent.authors %></td>
|
||||
<td><%= writing_patent.url %></td>
|
||||
<td><%= User.from_id(writing_patent.create_user_id).name rescue ''%></td>
|
||||
</tr>
|
||||
|
||||
Loaded 100 of 233 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user