diff --git a/app/assets/javascripts/ajax_form.js b/app/assets/javascripts/ajax_form.js
deleted file mode 100644
index 35834c96..00000000
--- a/app/assets/javascripts/ajax_form.js
+++ /dev/null
@@ -1,75 +0,0 @@
-$(document).on('click', '#ajax_form_submit', function(){
- // $('#ajaxForm').ajaxSubmit({
- // beforeSubmit: function(a,f,o) {
- // o.dataType = 'script';
- // if (o.dataType == 'script') {
- // o.url = o.url.split('?'); // split on GET params
- // if (o.url[0].substr(-3) != '.js') o.url[0] += '.js'; // force rails to respond to respond to the request with :format = js
- // o.url = o.url.join('?'); // join on GET params
- // }
- // },
- // success: function(response,status,xhr){
- // alert(response);
- // alert(status);
- // alert(xhr);
- // },
- // error:function(){
- // alert("error");
- // }
- // });
-
-
- var o = {
- // dataType: 'script',
- dataType: 'html',
- url:$("#ajaxForm").attr("action"),
- success: function(response,status,xhr){
- if(typeof tinyMCEPopup != "undefined"){
- var x = response.split("#");
- var returnurl = x[0],
- returntitle = x[1],
- returndescription = x[2];
- var win = tinyMCEPopup.getWindowArg("window");
- win.document.getElementById(tinyMCEPopup.getWindowArg("input")).value = returnurl;
- win.document.getElementById(tinyMCEPopup.getWindowArg("alt")).value = returndescription;
- win.document.getElementById(tinyMCEPopup.getWindowArg("title")).value = returntitle;
- if (typeof(win.ImageDialog) != "undefined") {
- // we are, so update image dimensions...
- if (win.ImageDialog.getImageData)
- win.ImageDialog.getImageData();
-
- // ... and preview if necessary
- if (win.ImageDialog.showPreviewImage)
- win.ImageDialog.showPreviewImage(returnurl);
- }
- tinyMCEPopup.close();
- }else{
- //incase if we want to do something for quick edit file upload
- // $("#modal-file").modal('hide');
- // var r = "";
- // if(rcom.getInternetExplorerVersion() > -1){
- // r = "
" + response + " ";
- // r = r.replace("
+$(document).on('click', '#ajax_form_submit', function(){
+ // $('#ajaxForm').ajaxSubmit({
+ // beforeSubmit: function(a,f,o) {
+ // o.dataType = 'script';
+ // if (o.dataType == 'script') {
+ // o.url = o.url.split('?'); // split on GET params
+ // if (o.url[0].substr(-3) != '.js') o.url[0] += '.js'; // force rails to respond to respond to the request with :format = js
+ // o.url = o.url.join('?'); // join on GET params
+ // }
+ // },
+ // success: function(response,status,xhr){
+ // alert(response);
+ // alert(status);
+ // alert(xhr);
+ // },
+ // error:function(){
+ // alert("error");
+ // }
+ // });
+
+
+ var o = {
+ // dataType: 'script',
+ dataType: 'html',
+ url:$("#ajaxForm").attr("action"),
+ beforeSubmit: function(){
+ var sub = true;
+ $("span.error").remove();
+ $("#dyn_error").empty();
+ $("#ajaxForm input").each(function(){
+ if($(this).val() == ""){
+ $(" * ").insertAfter($(this));
+ sub = false;
+ }
+ })
+ if(!sub){
+ $("#dyn_error").text("Cannot be empty.");
+ $("#dyn_error").text("<%= I18n.t('cant_empty_star') %>");
+ return false;
+ }
+ },
+ success: function(response,status,xhr){
+ if(typeof tinyMCEPopup != "undefined"){
+ var x = response.split("#");
+ var returnurl = x[0],
+ returntitle = x[1],
+ returndescription = x[2];
+ var win = tinyMCEPopup.getWindowArg("window");
+ win.document.getElementById(tinyMCEPopup.getWindowArg("input")).value = returnurl;
+ win.document.getElementById(tinyMCEPopup.getWindowArg("alt")).value = returndescription;
+ win.document.getElementById(tinyMCEPopup.getWindowArg("title")).value = returntitle;
+ if (typeof(win.ImageDialog) != "undefined") {
+ // we are, so update image dimensions...
+ if (win.ImageDialog.getImageData)
+ win.ImageDialog.getImageData();
+
+ // ... and preview if necessary
+ if (win.ImageDialog.showPreviewImage)
+ win.ImageDialog.showPreviewImage(returnurl);
+ }
+ tinyMCEPopup.close();
+ }else{
+ //incase if we want to do something for quick edit file upload
+ // var modalvalues = "";
+ // var r = "";
+ // if(rcom.getInternetExplorerVersion() > -1){
+ // r = "" + response + " ";
+ // r = r.replace("**"," ");
+ // r = r.replace("**"," ");
+ // r = $(r);
+ // modalvalues = r.find("span").attr("data-content").split("#");
+ // r.attr("id",r.find("span").attr("for"));
+ // var table=document.getElementById(modalvalues[0]);
+ // //var tbody = table.getElementsByTagName("tbody");
+ // var row = table.insertRow(table.rows.length-1);
+ // var c1 = row.insertCell(0),
+ // c2 = row.insertCell(1),
+ // c3 = row.insertCell(2);
+ // c1.innerHTML = r.find("td").eq(0).html();
+ // c2.innerHTML = r.find("td").eq(1).html();
+ // c3.innerHTML = r.find("td").eq(2).html();
+ // var trow = $("#bulletin_files tfoot").find("tr").eq(0);
+ // $("#bulletin_files tbody").append(trow);
+ // }else{
+
+ // response = response.replace("**","");
+ // response = response.replace("**","");
+ // r = $(response);
+ // modalvalues = r.find("span").attr("data-content").split("#");
+ // $('#' + modalvalues[0]+ ' tbody').append(r);
+ // }
+ // console.log(modalvalues[1]);
+ // $("#"+modalvalues[1]).modal('hide');
+ //$('#bulletin_files tbody').append(r);
+ //$(response).fadeIn();
+ }
+ },
+ error:function(){
+ alert("error");
+ }
+ }
+
+ if (o.dataType == 'script') {
+ o.url = o.url.split('?'); // split on GET params
+ if (o.url[0].substr(-3) != '.js') o.url[0] += '.js'; // force rails to respond to respond to the request with :format = js
+ o.url = o.url.join('?'); // join on GET params
+ }
+ $('#ajaxForm').ajaxSubmit(o);
+
+});
\ No newline at end of file
diff --git a/app/assets/javascripts/lib/jquery.preload-min.js b/app/assets/javascripts/lib/jquery.preload-min.js
new file mode 100755
index 00000000..cf3a0f1f
--- /dev/null
+++ b/app/assets/javascripts/lib/jquery.preload-min.js
@@ -0,0 +1,9 @@
+/**
+ * jQuery.Preload - Multifunctional preloader
+ * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com
+ * Dual licensed under MIT and GPL.
+ * Date: 3/25/2009
+ * @author Ariel Flesler
+ * @version 1.0.8
+ */
+;(function($){var h=$.preload=function(c,d){if(c.split)c=$(c);d=$.extend({},h.defaults,d);var f=$.map(c,function(a){if(!a)return;if(a.split)return d.base+a+d.ext;var b=a.src||a.href;if(typeof d.placeholder=='string'&&a.src)a.src=d.placeholder;if(b&&d.find)b=b.replace(d.find,d.replace);return b||null}),data={loaded:0,failed:0,next:0,done:0,total:f.length};if(!data.total)return finish();var g=$(Array(d.threshold+1).join(' ')).load(handler).error(handler).bind('abort',handler).each(fetch);function handler(e){data.element=this;data.found=e.type=='load';data.image=this.src;data.index=this.index;var a=data.original=c[this.index];data[data.found?'loaded':'failed']++;data.done++;if(d.enforceCache)h.cache.push($(' ').attr('src',data.image)[0]);if(d.placeholder&&a.src)a.src=data.found?data.image:d.notFound||a.src;if(d.onComplete)d.onComplete(data);if(data.done -1){
+ $.getScript(url + '&' + a.join('&'));
+ }else{
+ $.getScript(url + '?' + a.join('&'));
+ }
});
$(document).on('click', '#check_all', function(){
diff --git a/app/assets/stylesheets/message.css b/app/assets/stylesheets/message.css
index 7206bd72..ffa954f1 100644
--- a/app/assets/stylesheets/message.css
+++ b/app/assets/stylesheets/message.css
@@ -11,3 +11,7 @@
.warning{
color:orange;
}
+label#dyn_error {
+
+ margin-left: 50%;
+}
\ No newline at end of file
diff --git a/app/controllers/admin/assets_controller.rb b/app/controllers/admin/assets_controller.rb
index 092cb971..6a847a12 100644
--- a/app/controllers/admin/assets_controller.rb
+++ b/app/controllers/admin/assets_controller.rb
@@ -87,8 +87,8 @@ class Admin::AssetsController < OrbitBackendController
end
def delete
- if params[:to_delete]
- asset = Asset.any_in(:_id => params[:to_delete]).delete_all
+ if params[:ids]
+ asset = Asset.any_in(:_id => params[:ids]).delete_all
end
redirect_to assets_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
diff --git a/app/controllers/admin/designs_controller.rb b/app/controllers/admin/designs_controller.rb
index 84f2b770..9d434ff8 100644
--- a/app/controllers/admin/designs_controller.rb
+++ b/app/controllers/admin/designs_controller.rb
@@ -86,8 +86,8 @@ class Admin::DesignsController < OrbitBackendController
end
def delete
- if params[:to_delete]
- designs = Design.any_in(:_id => params[:to_delete]).delete_all
+ if params[:ids]
+ designs = Design.any_in(:_id => params[:ids]).delete_all
end
redirect_to admin_designs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index a7ea211f..6d5b896f 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -160,6 +160,7 @@ module ApplicationHelper
javascripts << "\n"
javascripts << "\n"
end
+ javascripts << "\n"
javascripts << "\n"
javascripts << "\n"
# javascripts << "\n"
diff --git a/app/helpers/orbit_backend_helper.rb b/app/helpers/orbit_backend_helper.rb
index e2865b9f..3bc4d31b 100644
--- a/app/helpers/orbit_backend_helper.rb
+++ b/app/helpers/orbit_backend_helper.rb
@@ -20,13 +20,13 @@ module OrbitBackendHelper
' active' if (@filter[type].include?(id.to_s) rescue nil)
end
- def render_sort_bar(delete_all, *titles)
+ def render_sort_bar(delete_all, url, *titles)
content_tag :table, :class => "table main-list" do
content_tag :thead do
content_tag :tr, :class => "sort-header" do
concat (content_tag :th, :class => "span1 strong" do
concat check_box_tag :check_all
- concat link_to content_tag(:i, nil, :class => "icon-trash"), '#', :class => "list-remove"
+ concat link_to content_tag(:i, nil, :class => "icon-trash"), '#', :class => "list-remove", :rel => url
end) if (delete_all && (is_admin? || (is_manager? rescue nil)))
titles.each do |title|
concat render_title(title[0], title[1], title[2], title[3])
diff --git a/app/views/admin/assets/_sort_headers.html.erb b/app/views/admin/assets/_sort_headers.html.erb
index 43cb5927..d266a086 100644
--- a/app/views/admin/assets/_sort_headers.html.erb
+++ b/app/views/admin/assets/_sort_headers.html.erb
@@ -1,4 +1,5 @@
-<%= render_sort_bar(true, ['title', 'title','span4', 'admin.title'],
+<%= render_sort_bar(true, delete_admin_assets_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]),
+ ['title', 'title','span4', 'admin.title'],
['description', 'description', 'span1-2', 'admin.data'],
['intro', 'intro', 'span1-2', 'admin.file_type'],
['intro', 'intro', 'span1-2', 'admin.file_length'],
diff --git a/app/views/admin/assets/file_upload.html.erb b/app/views/admin/assets/file_upload.html.erb
index f1313eeb..5e19a1ad 100644
--- a/app/views/admin/assets/file_upload.html.erb
+++ b/app/views/admin/assets/file_upload.html.erb
@@ -9,6 +9,7 @@
+
<%= t 'admin.title' %>
diff --git a/app/views/admin/assets/index.html.erb b/app/views/admin/assets/index.html.erb
index 394e18e8..38ec6b5e 100644
--- a/app/views/admin/assets/index.html.erb
+++ b/app/views/admin/assets/index.html.erb
@@ -1,22 +1,20 @@
-<%= form_for :assets, :url => delete_admin_assets_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]), :html => {:id => 'delete_all'}, :remote => true do %>
- <%= render 'filter' %>
-
-
-
-
-
-
-
-
-
-
-
-
-
- <%= render :partial => 'asset', :collection => @assets %>
-
-
-<% end %>
+<%= render 'filter' %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%= render :partial => 'asset', :collection => @assets %>
+
+