243 lines
4.7 KiB
JavaScript
243 lines
4.7 KiB
JavaScript
/*
|
|
|
|
|
|
|
|
*= require jquery_ujs
|
|
*=require jquery-reject
|
|
*=require tiny_mce/jquery.tinymce.js
|
|
*= require jquery-fileupload-ui
|
|
*=require jquery-activity-indicator
|
|
*=require jquery-fileupload
|
|
*= require_tree .
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function auto_load_divs() {
|
|
$('div[data-load]').live("resize",function () {
|
|
|
|
auto_load_div($(this));
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
function auto_load_div(div_to_load) {
|
|
|
|
|
|
url = div_to_load.attr("data-url");
|
|
|
|
|
|
load_block = div_to_load.children(".loading") ;
|
|
div_to_load.children(".ajax_load_content").hide();
|
|
load_block.show();
|
|
|
|
div_to_load.children(".ajax_load_content").load(url, function() {div_to_load.children(".loading").hide();$(this).show();block_js_initialize(); resize_page_slide();})
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
function update_auto_load_div(url, div_to_load)
|
|
{
|
|
|
|
div = $("#"+div_to_load);
|
|
|
|
div.attr("data-url", url);
|
|
auto_load_div(div);
|
|
|
|
|
|
}
|
|
|
|
function when_admin_load() {
|
|
|
|
$('.closeable').hide().fadeIn().delay(2000).fadeOut();
|
|
|
|
set_prescriptions_big_container_size();
|
|
|
|
|
|
$('#slides').sortable({
|
|
|
|
opacity:0.5,
|
|
update : function () {
|
|
var order = $(this).sortable('serialize');
|
|
|
|
$.ajax({url : "/admin/slides/reorder.js?"+order});
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
auto_load_divs();
|
|
resize_page_slide();
|
|
|
|
$(window).bind('resize', function(){
|
|
|
|
resize_page_slide();
|
|
});
|
|
|
|
$(".update_auto_load_div").live("click",function() {
|
|
|
|
|
|
update_auto_load_div($(this).attr("href"), $(this).attr("data_div_id"));
|
|
|
|
$(this).parent().children("a").removeClass("selected");
|
|
$(this).addClass("selected");
|
|
|
|
return false;
|
|
});
|
|
|
|
|
|
}
|
|
function flash_notice(text) {
|
|
$('#flash').html('');
|
|
$('#flash').html('<div id="flash_notice" class="notice message closeable" style="display:none;">'+text+'</div>');
|
|
|
|
$('#flash_notice').fadeIn();
|
|
$('#flash_notice').delay(2000).fadeOut();
|
|
|
|
|
|
|
|
}
|
|
|
|
function flash_alert(text) {
|
|
$('#flash').html('');
|
|
$('#flash').html('<div id="flash_alert" class="alert message closeable" style="display:none;">'+text+'</div>');
|
|
|
|
$('#flash_alert').fadeIn();
|
|
$('#flash_alert').delay(4000).fadeOut();
|
|
|
|
|
|
|
|
}
|
|
|
|
function resize_page_slide(){
|
|
|
|
$('.page_slide').css('width', $("#breadcrumb").outerWidth());
|
|
|
|
|
|
|
|
}
|
|
|
|
function auto_tiny_mce(div)
|
|
{
|
|
|
|
|
|
div.css("width", "100%");
|
|
div.css("height", "400px");
|
|
div.tinymce({
|
|
// Location of TinyMCE script
|
|
script_url : '/assets/tiny_mce/tiny_mce.js',
|
|
content_css : "/assets/admin/admin.css",
|
|
// General options
|
|
theme : "advanced",
|
|
skin: "cirkuit",
|
|
plugins : "pagebreak,style,contextmenu,paste,directionality,noneditable,visualchars,nonbreaking,xhtmlxtras",
|
|
|
|
// Theme options
|
|
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,fontsizeselect,|,cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,forecolor,backcolor,sub,sup,|,charmap,|,removeformat",
|
|
theme_advanced_buttons2 : "",
|
|
theme_advanced_buttons3 : "",
|
|
theme_advanced_toolbar_location : "top",
|
|
theme_advanced_toolbar_align : "left",
|
|
theme_advanced_statusbar_location : false,
|
|
theme_advanced_resizing : false,
|
|
theme_advanced_text_colors : "#D2232A,#40AF49,#00ADEF",
|
|
theme_advanced_background_colors : "#D2232A,#40AF49,#00ADEF",
|
|
|
|
// theme_advanced_toolbar_location : "external",
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
function common_tiny_mce(div)
|
|
{
|
|
|
|
|
|
div.css("width", "100%");
|
|
div.css("height", "400px");
|
|
div.tinymce({
|
|
// Location of TinyMCE script
|
|
script_url : '/assets/tiny_mce/tiny_mce.js',
|
|
content_css : "/assets/admin/admin.css",
|
|
// General options
|
|
theme : "advanced",
|
|
skin: "cirkuit",
|
|
plugins : "pagebreak,style,contextmenu,paste,directionality,noneditable,visualchars,nonbreaking,xhtmlxtras",
|
|
|
|
// Theme options
|
|
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,fontsizeselect,|,cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,forecolor,backcolor,sub,sup,|,charmap,|,removeformat",
|
|
theme_advanced_buttons2 : "",
|
|
theme_advanced_buttons3 : "",
|
|
// theme_advanced_toolbar_location : "top",
|
|
theme_advanced_toolbar_align : "left",
|
|
theme_advanced_statusbar_location : false,
|
|
theme_advanced_resizing : false,
|
|
theme_advanced_text_colors : "#D2232A,#40AF49,#00ADEF",
|
|
theme_advanced_background_colors : "#D2232A,#40AF49,#00ADEF",
|
|
|
|
theme_advanced_toolbar_location : "external",
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function set_prescriptions_big_container_size(){
|
|
|
|
|
|
$("#prescriptions_big_container").css("height",( $(window).height() - 36)+"px");
|
|
|
|
}
|
|
|
|
|
|
function set_busy(){
|
|
$('body').append('<div id="busy"></div>');
|
|
$('#busy').activity({segments: 8, steps: 5, opacity: 0.5, width: 10, space: 0, length: 10, color: '#212222', speed: 1.5});
|
|
}
|
|
function unset_busy(){
|
|
$('#busy').remove();
|
|
|
|
}
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
|
|
|
|
|
|
|
when_admin_load();
|
|
|
|
|
|
|
|
$(window).bind("resize", function() {
|
|
set_prescriptions_big_container_size();
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|