Merge branch 'gallery_orbit' into desktop_devin
This commit is contained in:
commit
b1d808cb86
|
@ -8,9 +8,10 @@ uploads/**/*
|
||||||
public/panel/**/*
|
public/panel/**/*
|
||||||
public/index.html
|
public/index.html
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
solr/data/**/*
|
||||||
*.swp
|
*.swp
|
||||||
|
*.pid
|
||||||
|
*.lck
|
||||||
public/assets
|
public/assets
|
||||||
config/application.rb
|
config/application.rb
|
||||||
|
|
||||||
|
|
3
Gemfile
3
Gemfile
|
@ -23,6 +23,7 @@ gem 'mongoid-tree', :require => 'mongoid/tree'
|
||||||
gem "mongo_session_store-rails3"
|
gem "mongo_session_store-rails3"
|
||||||
gem 'mysql2'
|
gem 'mysql2'
|
||||||
gem 'nokogiri'
|
gem 'nokogiri'
|
||||||
|
|
||||||
gem 'radius'
|
gem 'radius'
|
||||||
gem 'rake'
|
gem 'rake'
|
||||||
# gem 'remotipart'
|
# gem 'remotipart'
|
||||||
|
@ -84,7 +85,7 @@ group :test, :development do
|
||||||
gem "simplecov"
|
gem "simplecov"
|
||||||
gem "delorean"
|
gem "delorean"
|
||||||
gem "watchr"
|
gem "watchr"
|
||||||
gem "spork"
|
gem "spork"
|
||||||
# gem "capybara"
|
# gem "capybara"
|
||||||
# gem 'yard'
|
# gem 'yard'
|
||||||
# gem "bluecloth"
|
# gem "bluecloth"
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
guard 'livereload' do
|
||||||
|
watch(%r{app/.+\.(erb|haml)})
|
||||||
|
watch(%r{app/helpers/.+\.rb})
|
||||||
|
watch(%r{public/.+\.(css|js|html)})
|
||||||
|
watch(%r{config/locales/.+\.yml})
|
||||||
|
end
|
||||||
|
|
||||||
|
guard 'rspec', :version => 2 do
|
||||||
|
watch(%r{^spec/.+_spec\.rb})
|
||||||
|
watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
||||||
|
watch('spec/spec_helper.rb') { "spec" }
|
||||||
|
|
||||||
|
# Rails example
|
||||||
|
watch('spec/spec_helper.rb') { "spec" }
|
||||||
|
watch('config/routes.rb') { "spec/routing" }
|
||||||
|
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
||||||
|
watch(%r{^spec/.+_spec\.rb})
|
||||||
|
watch(%r{^app/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
|
||||||
|
watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
||||||
|
watch(%r{^app/controllers/(.+)_(controller)\.rb}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] }
|
||||||
|
watch(%r{^app/views/(.+)/}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
||||||
|
end
|
|
@ -1,7 +1,7 @@
|
||||||
$('#ajaxForm').ajaxForm({
|
$('#ajaxForm').ajaxForm({
|
||||||
beforeSubmit: function(a,f,o) {
|
beforeSubmit: function(a,f,o) {
|
||||||
o.dataType = 'script';
|
o.dataType = 'script';
|
||||||
},
|
},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
}
|
}
|
||||||
});
|
});
|
|
@ -10,7 +10,7 @@ $('.bulletin_files_block a.delete').live('click', function(){
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.action a.remove_existing_record', function(){
|
$(document).on('click', '.action a.remove_existing_record', function(){
|
||||||
if(confirm("<%= I18n.t('announcement.sure?')%>")){
|
if(confirm("<%= I18n.t(:sure?)%>")){
|
||||||
$(this).next('.should_destroy').attr('value', 1);
|
$(this).next('.should_destroy').attr('value', 1);
|
||||||
$("tr#" + $(this).prev().attr('value')).hide();
|
$("tr#" + $(this).prev().attr('value')).hide();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
jQuery(document).ajaxStart(function(){
|
// jQuery(document).ajaxStart(function(){
|
||||||
$('<div class="modal-backdrop fade in" id="sys_modal"><img src="/assets/ajax-loader.gif" style="margin-top: 25%;margin-left: 50%;"></div>').appendTo('body');
|
// $('<div class="modal-backdrop fade in" id="sys_modal"><img src="/assets/ajax-loader.gif" style="margin-top: 25%;margin-left: 50%;"></div>').appendTo('body');
|
||||||
});
|
// });
|
||||||
|
|
||||||
jQuery(document).ajaxComplete(function(){
|
// jQuery(document).ajaxComplete(function(){
|
||||||
$("#sys_modal").hide().remove();
|
// $("#sys_modal").hide().remove();
|
||||||
});
|
// });
|
||||||
|
|
|
@ -3,6 +3,58 @@
|
||||||
// <%= link_to "NewPreview", realtime_preview_admin_ad_banner_path(ad_banner_tab) , :class=>'preview_trigger'%>
|
// <%= link_to "NewPreview", realtime_preview_admin_ad_banner_path(ad_banner_tab) , :class=>'preview_trigger'%>
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
// $(".post_preview").click(function(e){
|
||||||
|
// $("#main-wrap").after("<span id='show_preview'></span>");
|
||||||
|
// e.preventDefault();
|
||||||
|
// var form = $(this).parents("form").first()
|
||||||
|
// //var cont = form["content"].value;
|
||||||
|
// // $.ajax({
|
||||||
|
// // type: 'POST',
|
||||||
|
// // url: $(this).attr("href")+'?preview=true',
|
||||||
|
// // data: form.serialize(),
|
||||||
|
// // dataType: "script",
|
||||||
|
// // success: function (msg) {
|
||||||
|
// // $("#"+start_modal_with_id).modal('show'); },
|
||||||
|
// // error: function(){
|
||||||
|
// // alert("ERROR");
|
||||||
|
// // }
|
||||||
|
// // });
|
||||||
|
// url = "/panel/news/back_end/news_bulletins/preview?preview=true"
|
||||||
|
// // alert(url)
|
||||||
|
// form.attr("action",url);
|
||||||
|
// form.submit();
|
||||||
|
// //return false;
|
||||||
|
// });
|
||||||
|
$("button.post_preview").click(function(){
|
||||||
|
var btn = document.getElementById("button_for_preview");
|
||||||
|
var attrs = btn.attributes;
|
||||||
|
var url = attrs['url'];
|
||||||
|
// url = url.replace("url=","");
|
||||||
|
$("form.nccu_ajax_form").ajaxSubmit({
|
||||||
|
beforeSubmit: function(a,f,o){
|
||||||
|
$("#main-wrap").after("<span id='show_preview'></span>");
|
||||||
|
o.dataType = 'script';
|
||||||
|
o.url = url.nodeValue;
|
||||||
|
o.type = 'post';
|
||||||
|
},success: function(msg) { }
|
||||||
|
|
||||||
|
});
|
||||||
|
})
|
||||||
|
// $("form.nccu_ajax_form").ajaxForm({
|
||||||
|
// beforeSubmit: function(a,f,o) {
|
||||||
|
// // if(clicked_what.hasClass("post_preview")){
|
||||||
|
// // $("#main-wrap").after("<span id='show_preview'></span>");
|
||||||
|
// // o.dataType = 'script';
|
||||||
|
// // o.url = clicked_what.attr("url");
|
||||||
|
// // }
|
||||||
|
// },
|
||||||
|
// success: function(data) {
|
||||||
|
// // if(!clicked_what.hasClass("post_preview")){
|
||||||
|
// // window.location = data.redirect_url;
|
||||||
|
// // }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
$("a.preview_trigger").click(function(){
|
$("a.preview_trigger").click(function(){
|
||||||
$("#main-wrap").after("<span id='show_preview'></span>");
|
$("#main-wrap").after("<span id='show_preview'></span>");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
|
@ -4,33 +4,45 @@
|
||||||
|
|
||||||
//extended jquery to search fast.
|
//extended jquery to search fast.
|
||||||
$.extend($.expr[':'], {
|
$.extend($.expr[':'], {
|
||||||
'containsi': function (elem, i, match, array) {
|
'containsi': function (elem, i, match, array) {
|
||||||
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
|
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var interval,sval;
|
var interval,sval;
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$("#user_filter").keyup(function(e){
|
$("#user_filter").keyup(function(e){
|
||||||
if((e.which>96 && e.which<123) || (e.which>64 && e.which<92) || (e.which == 32) || (e.which == 8)){
|
if((e.which>96 && e.which<123) || (e.which>64 && e.which<92) || (e.which == 32) || (e.which == 8)){
|
||||||
sval = $(this).val();
|
sval = $(this).val();
|
||||||
$(".checkbox").popover("hide");
|
$(".checkbox").popover("hide");
|
||||||
$("div.checkblock").hide();
|
$("div.checkblock").hide();
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
interval = setInterval(waitForSearch,1000);
|
interval = setInterval(waitForSearch,1000);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
var waitForSearch = function(){
|
var waitForSearch = function(){
|
||||||
if(sval){
|
if(sval){
|
||||||
var totalfoundbyname = $("div#users_checkbox_ary label.member-name:containsi("+sval+")").length
|
var re1 = new RegExp("^[\u4E00-\uFA29]*$"); //Chinese character range
|
||||||
if(totalfoundbyname!=0){
|
var re2 = new RegExp("^[\uE7C7-\uE7F3]*$");
|
||||||
$("div#users_checkbox_ary label.member-name:containsi("+sval+")").parent().parent().show();
|
if ((re1.test(sval) && (re2.test(sval)))){
|
||||||
}else if(totalfoundbyname==0){
|
|
||||||
$("div#users_checkbox_ary div.for_unit:containsi("+sval+")").parent().show();
|
var totalfoundbyname = $("div#users_checkbox_ary label.member-name:contains("+sval+")").length
|
||||||
}
|
if(totalfoundbyname!=0){
|
||||||
}else{
|
$("div#users_checkbox_ary label.member-name:contains("+sval+")").parent().parent().show();
|
||||||
$(".checkbox").popover('hide');
|
}else if(totalfoundbyname==0){
|
||||||
$("div.checkblock").show();
|
$("div#users_checkbox_ary div.for_unit:contains("+sval+")").parent().show();
|
||||||
}
|
}
|
||||||
clearInterval(interval);
|
}else{
|
||||||
|
var totalfoundbyname = $("div#users_checkbox_ary label.member-name:containsi("+sval+")").length
|
||||||
|
if(totalfoundbyname!=0){
|
||||||
|
$("div#users_checkbox_ary label.member-name:containsi("+sval+")").parent().parent().show();
|
||||||
|
}else if(totalfoundbyname==0){
|
||||||
|
$("div#users_checkbox_ary div.for_unit:containsi("+sval+")").parent().show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$(".checkbox").popover('hide');
|
||||||
|
$("div.checkblock").show();
|
||||||
|
}
|
||||||
|
clearInterval(interval);
|
||||||
}
|
}
|
|
@ -40,11 +40,11 @@ $(".nav-tabs").find(".icons-pencil").click(function(){
|
||||||
data: { body: content_holder.html() },
|
data: { body: content_holder.html() },
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
$(selector).attr("contenteditable",false)
|
$(selector).attr("contenteditable",false)
|
||||||
alert("<%= I18n.t('admin.contenteditable.update_done') %>");
|
alert("<%= I18n.t('update.success_') %>");
|
||||||
//content_holder.effect('highlight', {'color': '#0f0'}, 3000);
|
//content_holder.effect('highlight', {'color': '#0f0'}, 3000);
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
alert("<%= I18n.t('admin.contenteditable.update_failed') %>");
|
alert("<%= I18n.t('update.fail') %>");
|
||||||
//content_holder.effect('highlight', {'color': '#f00'}, 3000);
|
//content_holder.effect('highlight', {'color': '#f00'}, 3000);
|
||||||
content_holder.html(content);
|
content_holder.html(content);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ $('.news_bulletin_files_block a.delete').live('click', function(){
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.action a.remove_existing_record', function(){
|
$(document).on('click', '.action a.remove_existing_record', function(){
|
||||||
if(confirm("<%= I18n.t('news.sure?')%>")){
|
if(confirm("<%= I18n.t(:sure?)%>")){
|
||||||
$(this).next('.should_destroy').attr('value', 1);
|
$(this).next('.should_destroy').attr('value', 1);
|
||||||
$("tr#" + $(this).prev().attr('value')).hide();
|
$("tr#" + $(this).prev().attr('value')).hide();
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ var orbitTimeline = function(dom){
|
||||||
this.constructTimeScale = function(callbackFn){
|
this.constructTimeScale = function(callbackFn){
|
||||||
var mon ="",year="",formname;
|
var mon ="",year="",formname;
|
||||||
var scale = $("<div id='scale_wrapper'></div>");
|
var scale = $("<div id='scale_wrapper'></div>");
|
||||||
$.getJSON("desktop_orbit/gettimelinespan",{"get":"papers"},function(years){
|
$.getJSON("/desktop_orbit/gettimelinespan",{"get":"papers"},function(years){
|
||||||
var $ul = $("<ul></ul>");
|
var $ul = $("<ul></ul>");
|
||||||
var startyear = years.startyear, endyear = years.endyear,year = years.startyear;
|
var startyear = years.startyear, endyear = years.endyear,year = years.startyear;
|
||||||
$ul.append('<li><a href="'+startyear+'" class="wh3 hh3 admbg active" onclick="return false;">'+startyear+'</a></li>');
|
$ul.append('<li><a href="'+startyear+'" class="wh3 hh3 admbg active" onclick="return false;">'+startyear+'</a></li>');
|
||||||
|
@ -69,7 +69,7 @@ var orbitTimeline = function(dom){
|
||||||
}
|
}
|
||||||
$("div#orbit div#year_navigation").html($ul);
|
$("div#orbit div#year_navigation").html($ul);
|
||||||
})
|
})
|
||||||
$.getJSON("desktop_orbit/eventajaxload",{"event":"papers","from":t.fromdate},function(papersArray){
|
$.getJSON("/desktop_orbit/eventajaxload",{"event":"papers","from":t.fromdate},function(papersArray){
|
||||||
$.each(papersArray,function(i,pa){
|
$.each(papersArray,function(i,pa){
|
||||||
$.each(pa.papers,function(i,paper){
|
$.each(pa.papers,function(i,paper){
|
||||||
var dt = new Date(paper.created_at);
|
var dt = new Date(paper.created_at);
|
||||||
|
@ -150,7 +150,7 @@ var orbitTimeline = function(dom){
|
||||||
var scale = $("#scale_wrapper");
|
var scale = $("#scale_wrapper");
|
||||||
|
|
||||||
t.ajaxload = false;
|
t.ajaxload = false;
|
||||||
$.getJSON("desktop_orbit/eventajaxload",{"from":t.fromdate},function(papersArray){
|
$.getJSON("/desktop_orbit/eventajaxload",{"from":t.fromdate},function(papersArray){
|
||||||
$.each(papersArray,function(i,pa){
|
$.each(papersArray,function(i,pa){
|
||||||
$.each(pa.papers,function(i,paper){
|
$.each(pa.papers,function(i,paper){
|
||||||
var dt = new Date(paper.created_at);
|
var dt = new Date(paper.created_at);
|
||||||
|
@ -235,7 +235,7 @@ var orbitTimeline = function(dom){
|
||||||
this.ajaxEventPull = function(){
|
this.ajaxEventPull = function(){
|
||||||
if(!t.update){
|
if(!t.update){
|
||||||
t.update = true;
|
t.update = true;
|
||||||
$.getJSON("desktop_orbit/ajaxeventpull",{"from":t.fromdate},function(){
|
$.getJSON("/desktop_orbit/ajaxeventpull",{"from":t.fromdate},function(){
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
// JavaScript Document
|
// JavaScript Document
|
||||||
//harry
|
//harry
|
||||||
//Inititialize function will initialize desktop
|
//Inititialize function will initialize desktop
|
||||||
|
|
||||||
|
|
||||||
$.extend($.expr[':'], {
|
$.extend($.expr[':'], {
|
||||||
'containsi': function (elem, i, match, array) {
|
'containsi': function (elem, i, match, array) {
|
||||||
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
|
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
|
||||||
|
@ -17,19 +19,22 @@ var sortDescending = function(a, b) {
|
||||||
};
|
};
|
||||||
var orbitDesktop = function(dom){
|
var orbitDesktop = function(dom){
|
||||||
orbitDesktopAPI.apply(this);
|
orbitDesktopAPI.apply(this);
|
||||||
o = this;
|
// o = this;
|
||||||
this.contentHolder = dom;
|
this.contentHolder = dom;
|
||||||
this.themesettings = "";
|
this.themesettings = "";
|
||||||
this.theme = "4f8d3f493b67fcd05f086359";
|
this.theme = "4f8d3f493b67fcd05f086359";
|
||||||
this.transitionTime = 500;
|
this.transitionTime = 500;
|
||||||
this.currenthtml = "desktop.html";
|
this.currenthtml = "desktop.html";
|
||||||
this.currentface = "home";
|
this.currentface = "home";
|
||||||
this.desktopData = {"home":"","settings":"","work":"","favorite":"","apps_manager":"","sections":"","journal_p":"","appstore":"","orbit":"","books":"","seminar_p":"","research_d":"","research_p":""};
|
this.desktopData = {};
|
||||||
this.tp = "";
|
this.tp = "";
|
||||||
this.sectionList;
|
this.sectionList;
|
||||||
|
this.data_method;
|
||||||
this.initialize = function(){
|
this.initialize = function(){
|
||||||
|
|
||||||
var theme = o.theme;
|
var theme = o.theme;
|
||||||
var custom = false;
|
var custom = false;
|
||||||
|
|
||||||
$.getJSON("/desktop/get_desktop_settings",{"get":"desktop","desktopid":o.desktopId},function(desktopSettings){
|
$.getJSON("/desktop/get_desktop_settings",{"get":"desktop","desktopid":o.desktopId},function(desktopSettings){
|
||||||
if(desktopSettings){
|
if(desktopSettings){
|
||||||
if(desktopSettings.theme!="custom"){
|
if(desktopSettings.theme!="custom"){
|
||||||
|
@ -50,7 +55,16 @@ var orbitDesktop = function(dom){
|
||||||
$("head").find("#dyn_css").remove();
|
$("head").find("#dyn_css").remove();
|
||||||
$("head").append(customtheme);
|
$("head").append(customtheme);
|
||||||
}
|
}
|
||||||
$(document).ready(function(){o.loadWallpaper(customwallpaper);o.bindDesktopEvents();o.loadIconCache();o.initializeDesktop();});
|
$(document).ready(function(){
|
||||||
|
o.loadWallpaper(customwallpaper);
|
||||||
|
o.bindDesktopEvents();
|
||||||
|
o.loadIconCache();
|
||||||
|
|
||||||
|
$(o.contentHolder).empty().load("desktop",function(){
|
||||||
|
o.desktopData["d_desktop"] = "";
|
||||||
|
o.initializeDesktop("d_desktop","",false);
|
||||||
|
})
|
||||||
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,105 +79,63 @@ var orbitDesktop = function(dom){
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
this.bindDesktopEvents = function(){ //this function will bind the global handlers to thd desktop, for example doc
|
this.bindDesktopEvents = function(){ //this function will bind the global handlers to thd desktop, for example doc
|
||||||
$("a#d_app_manager").click(function(){
|
$(".docklist a").click(function(){
|
||||||
var target = $(this).attr("href");
|
var target = $(this).attr("id");
|
||||||
|
var url = $(this).attr("href");
|
||||||
|
o.data_method = $(this).attr("data-method");
|
||||||
if(o.currenthtml!=target){
|
if(o.currenthtml!=target){
|
||||||
|
if(o.desktopData[o.currentface] == "undefined")
|
||||||
|
o.desktopData[o.currentface] = "";
|
||||||
o.desktopData[o.currentface] = $(o.contentHolder).html();
|
o.desktopData[o.currentface] = $(o.contentHolder).html();
|
||||||
$("#content").hide("drop",o.transitionTime,function(){
|
$("#content").hide("drop",o.transitionTime,function(){
|
||||||
o.initializeAppSearch(target);
|
o.currenthtml = target;
|
||||||
|
o.currentface = target;
|
||||||
|
var cache = false;
|
||||||
|
if(!o.desktopData[o.currentface]){
|
||||||
|
$(o.contentHolder).empty().load(url,function(){
|
||||||
|
if(typeof o.data_method != "undefined" || o.data_method != "")
|
||||||
|
window.o[o.data_method](target,url,cache);
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
$(o.contentHolder).html(o.desktopData[o.currentface]);
|
||||||
|
cache = true;
|
||||||
|
if(typeof o.data_method != "undefined" || o.data_method != "")
|
||||||
|
window.o[o.data_method](target,url,cache);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
return false;
|
||||||
$("a#d_desktop").click(function(){
|
})
|
||||||
var target = $(this).attr("href");
|
$('body').on({
|
||||||
if(o.currenthtml!=target){
|
click: function(){
|
||||||
o.desktopData[o.currentface] = $(o.contentHolder).html();
|
if(!$(this).hasClass('active')){
|
||||||
$("#content").hide("drop",o.transitionTime,function(){
|
var sub_data_method = $(this).attr('data-method');
|
||||||
o.initializeDesktop(target);
|
if(sub_data_method){
|
||||||
});
|
$("#panel_r").load($(this).attr("href"),function(){
|
||||||
|
// o.simple_drop_down();
|
||||||
|
|
||||||
|
// o.tinyscrollbar_ext({
|
||||||
|
// main: '.tinycanvas',
|
||||||
|
// fill: '.s_grid_con'
|
||||||
|
// })
|
||||||
|
window.o[o.data_method][sub_data_method]();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
$('.s_menu a').removeClass('thmc1 thmtxt active');
|
||||||
|
$(this).addClass('thmc1 thmtxt active');
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
mouseenter: function(){
|
||||||
|
if(!$(this).hasClass('active')){
|
||||||
|
$(this).switchClass('admtxt','thmc1 thmtxt',0);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mouseleave: function(){
|
||||||
|
var t = $(this).hasClass('active') ? '' : 'thmc1 thmtxt';
|
||||||
|
$(this).switchClass(t,'admtxt',0);
|
||||||
}
|
}
|
||||||
});
|
},'.s_menu a');
|
||||||
$("a#d_sections").click(function(){
|
|
||||||
var target = $(this).attr("href");
|
|
||||||
if(o.currenthtml!=target){
|
|
||||||
o.desktopData[o.currentface] = $(o.contentHolder).html();
|
|
||||||
$("#content").hide("drop",o.transitionTime,function(){
|
|
||||||
o.initializeSectionsManager(target);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$("#d_journal_p").click(function(){
|
|
||||||
var target = $(this).attr("href");
|
|
||||||
if(o.currenthtml!=target){
|
|
||||||
o.desktopData[o.currentface] = $(o.contentHolder).html();
|
|
||||||
$("#content").hide("drop",o.transitionTime,function(){
|
|
||||||
o.initializeJournalPapers(target);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$("a#d_settings").click(function(){
|
|
||||||
var target = $(this).attr("href");
|
|
||||||
if(o.currenthtml!=target){
|
|
||||||
o.desktopData[o.currentface] = $(o.contentHolder).html();
|
|
||||||
$("#content").hide("drop",o.transitionTime,function(){
|
|
||||||
o.initializeSettings(target);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$("a#d_appstore").click(function(){
|
|
||||||
var target = $(this).attr("href");
|
|
||||||
if(o.currenthtml!=target){
|
|
||||||
o.desktopData[o.currentface] = $(o.contentHolder).html();
|
|
||||||
$("#content").hide("drop",o.transitionTime,function(){
|
|
||||||
o.initializeAppstore(target);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$("a#d_orbit").click(function(){
|
|
||||||
var target = $(this).attr("href");
|
|
||||||
if(o.currenthtml!=target){
|
|
||||||
o.desktopData[o.currentface] = $(o.contentHolder).html();
|
|
||||||
$("#content").hide("drop",o.transitionTime,function(){
|
|
||||||
o.initializeOrbitTimeline(target);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$("a#d_books").click(function(){
|
|
||||||
var target = $(this).attr("href");
|
|
||||||
if(o.currenthtml!=target){
|
|
||||||
o.desktopData[o.currentface] = $(o.contentHolder).html();
|
|
||||||
$("#content").hide("drop",o.transitionTime,function(){
|
|
||||||
o.initializeBooks(target);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$("a#d_seminar_p").click(function(){
|
|
||||||
var target = $(this).attr("href");
|
|
||||||
if(o.currenthtml!=target){
|
|
||||||
o.desktopData[o.currentface] = $(o.contentHolder).html();
|
|
||||||
$("#content").hide("drop",o.transitionTime,function(){
|
|
||||||
o.initializeSeminar(target);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$("a#d_research_d").click(function(){
|
|
||||||
var target = $(this).attr("href");
|
|
||||||
if(o.currenthtml!=target){
|
|
||||||
o.desktopData[o.currentface] = $(o.contentHolder).html();
|
|
||||||
$("#content").hide("drop",o.transitionTime,function(){
|
|
||||||
o.initializeResearchDomain(target);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$("a#d_research_p").click(function(){
|
|
||||||
var target = $(this).attr("href");
|
|
||||||
if(o.currenthtml!=target){
|
|
||||||
o.desktopData[o.currentface] = $(o.contentHolder).html();
|
|
||||||
$("#content").hide("drop",o.transitionTime,function(){
|
|
||||||
o.initializeResearchProject(target);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$(window).resize(function(){
|
$(window).resize(function(){
|
||||||
var ww = $(window).width();
|
var ww = $(window).width();
|
||||||
$("img#thmbackground").attr({"width":ww});
|
$("img#thmbackground").attr({"width":ww});
|
||||||
|
@ -188,11 +160,8 @@ var orbitDesktop = function(dom){
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.initializeDesktop = function(target){ //this is for initializing main desktops that are sections and tiles
|
this.initializeDesktop = function(target,url,cache){ //this is for initializing main desktops that are sections and tiles
|
||||||
if(!target)target = "desktop";
|
if(!target)target = "desktop";
|
||||||
o.currenthtml = target;
|
|
||||||
o.currentface = "home";
|
|
||||||
|
|
||||||
var bindHandlers = function(){ // this function will bind all the handlers in the desktop
|
var bindHandlers = function(){ // this function will bind all the handlers in the desktop
|
||||||
var groupWrapperWidth = 0;
|
var groupWrapperWidth = 0;
|
||||||
$("div#desktop .group").each(function(){groupWrapperWidth+=$(this).outerWidth(true);});
|
$("div#desktop .group").each(function(){groupWrapperWidth+=$(this).outerWidth(true);});
|
||||||
|
@ -332,14 +301,14 @@ var orbitDesktop = function(dom){
|
||||||
if(j==0)$group.attr("id",tile.group_id);
|
if(j==0)$group.attr("id",tile.group_id);
|
||||||
|
|
||||||
if(tile.data_category == "app")
|
if(tile.data_category == "app")
|
||||||
$li = $('<li id="'+tile._id+'" class="element '+tile.shape+' hp vp" data-category="'+tile.data_category+'" data-content="'+tile.data_content+'"><span class="tile '+tilecolor+' '+op+'"></span><a href="'+tile.data_content+'" class="appicon" onclick="return false;"><img src="'+o.iconPath+tile.data_content+'.png" alt="" ></a><h1 class="appname thmtxt">'+tile.title+'</h1></li>');
|
$li = $('<li data-id="'+tile.id+'" class="element '+tile.shape+' hp vp" data-category="'+tile.data_category+'" data-content="'+tile.data_content+'" ><span class="tile '+tilecolor+' '+op+'"></span><a href="'+tile.data_content+'" class="appicon" onclick="return false;"><img src="'+o.iconPath+tile.data_content+'.png" alt="" ></a><h1 class="appname thmtxt">'+tile.title+'</h1></li>');
|
||||||
else
|
else
|
||||||
$li = $('<li id="'+tile.data_content+'" class="element '+tile.shape+' hp vp" data-category="'+tile.data_category+'" data-content="'+tile._id+'"><span class="tile '+tilecolor+' '+op+'"></span><h1 class="appname thmtxt">'+tile.title+'</h1><div class="appholder">Loading...</div></li>');
|
$li = $('<li data-id="'+tile.id+'" class="element '+tile.shape+' hp vp" data-category="'+tile.data_category+'" data-content="'+tile.data_content+'" js-link="'+tile.js[0].url+'" css-link="'+tile.css.url+'"><span class="tile '+tilecolor+' '+op+'"></span><h1 class="appname thmtxt">'+tile.title+'</h1><div class="appholder">Loading...</div></li>');
|
||||||
|
|
||||||
$group.find('.col'+colindex).append($li);
|
$group.find('.col'+colindex).append($li);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$("div#desktop div#group_wrapper").append($group);
|
$("div#desktop div#group_wrapper").append($group);
|
||||||
})
|
})
|
||||||
bindHandlers();
|
bindHandlers();
|
||||||
o.initializeWidgets();
|
o.initializeWidgets();
|
||||||
|
@ -368,27 +337,23 @@ var orbitDesktop = function(dom){
|
||||||
loadTiles(o.sectionId);
|
loadTiles(o.sectionId);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if(cache){
|
||||||
if(!o.desktopData[o.currentface]){
|
bindHandlers();
|
||||||
$(o.contentHolder).empty().load("/desktop/"+target,function(){
|
o.initializeWidgets();
|
||||||
loadTiles(o.sectionId);
|
bindSecondaryHandlers();
|
||||||
loadSectionList();
|
$("div#desktop ul#section_list").empty();
|
||||||
});
|
$.each(o.sectionList,function(i,section){
|
||||||
|
var tempstyle="";
|
||||||
|
if(section._id==o.sectionId){
|
||||||
|
tempstyle = "style='display:none;'";
|
||||||
|
$("div#desktop span#section_heading").text(section.name);
|
||||||
|
}
|
||||||
|
$("div#desktop ul#section_list").append($('<li class="section_name" '+tempstyle+'><a class="admtxt hp w2 hh2" onclick="return false;" href="'+section._id+'" >'+section.name+'</a></li>'));
|
||||||
|
})
|
||||||
|
bindSecondaryHandlers();
|
||||||
}else{
|
}else{
|
||||||
$(o.contentHolder).html(o.desktopData[o.currentface]);
|
loadTiles(o.sectionId);
|
||||||
bindHandlers();
|
loadSectionList();
|
||||||
o.initializeWidgets();
|
|
||||||
bindSecondaryHandlers();
|
|
||||||
$("div#desktop ul#section_list").empty();
|
|
||||||
$.each(o.sectionList,function(i,section){
|
|
||||||
var tempstyle="";
|
|
||||||
if(section._id==o.sectionId){
|
|
||||||
tempstyle = "style='display:none;'";
|
|
||||||
$("div#desktop span#section_heading").text(section.name);
|
|
||||||
}
|
|
||||||
$("div#desktop ul#section_list").append($('<li class="section_name" '+tempstyle+'><a class="admtxt hp w2 hh2" onclick="return false;" href="'+section._id+'" >'+section.name+'</a></li>'));
|
|
||||||
})
|
|
||||||
bindSecondaryHandlers();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -396,9 +361,8 @@ var orbitDesktop = function(dom){
|
||||||
$.post("desktop/twitter",function(){});
|
$.post("desktop/twitter",function(){});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.initializeAppSearch = function(target){ //this is application search ie is app manager initialization
|
this.initializeAppSearch = function(target,url,cache){ //this is application search ie is app manager initialization
|
||||||
o.currenthtml = target;
|
|
||||||
o.currentface = "apps_manager";
|
|
||||||
var searchArray,allApps;
|
var searchArray,allApps;
|
||||||
var bindHandlers = function(){ // bind handler for app manager page
|
var bindHandlers = function(){ // bind handler for app manager page
|
||||||
var gn = $('.g_col').length,
|
var gn = $('.g_col').length,
|
||||||
|
@ -474,18 +438,13 @@ var orbitDesktop = function(dom){
|
||||||
bindHandlers();
|
bindHandlers();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if(!o.desktopData[o.currentface]){
|
if(cache)
|
||||||
$(o.contentHolder).empty().load("/desktop/"+target,function(){
|
bindHandlers();
|
||||||
loadApps();
|
else
|
||||||
});
|
loadApps();
|
||||||
}else{
|
|
||||||
$(o.contentHolder).html(o.desktopData[o.currentface]);
|
|
||||||
bindHandlers();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
this.initializeSectionsManager = function(target){ // this is init function for section manager
|
this.initializeSectionsManager = function(target,url,cache){ // this is init function for section manager
|
||||||
o.currenthtml = target;
|
|
||||||
o.currentface = "sections";
|
|
||||||
var elementParent,element,slabel;
|
var elementParent,element,slabel;
|
||||||
var bindHandlers = function(){ // this is bind handler for section manager page
|
var bindHandlers = function(){ // this is bind handler for section manager page
|
||||||
var groupWrapperWidth = 0;
|
var groupWrapperWidth = 0;
|
||||||
|
@ -572,50 +531,15 @@ var orbitDesktop = function(dom){
|
||||||
bindHandlers();
|
bindHandlers();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if(!o.desktopData[o.currentface]){
|
if(cache)
|
||||||
$(o.contentHolder).empty().load("/desktop/"+target,function(){
|
|
||||||
loadApps();
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
$(o.contentHolder).html(o.desktopData[o.currentface]);
|
|
||||||
bindHandlers();
|
bindHandlers();
|
||||||
}
|
else
|
||||||
|
loadApps();
|
||||||
|
|
||||||
};
|
};
|
||||||
this.initializeSettings = function(target){ //this is to initialize setting page
|
this.initializeSettings = function(target,url,cache){ //this is to initialize setting page
|
||||||
o.currenthtml = target;
|
|
||||||
o.currentface = "settings";
|
|
||||||
var bindHandlers = function(){ // this is the bind handler function for setting page
|
|
||||||
$("div#settings ul#setting_left_nav li a").on({
|
|
||||||
click: function(){
|
|
||||||
if(!$(this).data("clicked")){
|
|
||||||
var tfunc = $(this).attr("href");
|
|
||||||
switch(tfunc){
|
|
||||||
case "themes":
|
|
||||||
themes();
|
|
||||||
break;
|
|
||||||
case "sections":
|
|
||||||
sections();
|
|
||||||
break;
|
|
||||||
case "connection":
|
|
||||||
connection();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$("div#settings ul#setting_left_nav li a").removeClass('thmc1 thmtxt').data('clicked',null);
|
|
||||||
$(this).addClass('thmc1 thmtxt').data('clicked',true);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mouseenter: function(){
|
|
||||||
$(this).removeClass('admtxt').addClass('thmc1 thmtxt');
|
|
||||||
},
|
|
||||||
mouseleave: function(){
|
|
||||||
var t = $(this).data('clicked') ? '' : 'thmc1 thmtxt';
|
|
||||||
$(this).removeClass(t).addClass('admtxt');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
this.initializeSettings.sections = function(){ // this load section page in setting page
|
||||||
var sections = function(){ // this load section page in setting page
|
|
||||||
var bindHandlers = function(){ // binding handlers in section page
|
var bindHandlers = function(){ // binding handlers in section page
|
||||||
$('.tinycanvas').each(function(){
|
$('.tinycanvas').each(function(){
|
||||||
var h = $(this).parent().height(),
|
var h = $(this).parent().height(),
|
||||||
|
@ -644,17 +568,17 @@ var orbitDesktop = function(dom){
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
$("div#settings div#panel_r").load("/desktop/settingsections",function(){
|
|
||||||
$.getJSON("/desktop/get_desktop_settings",{"get":"sectionnames","desktopid":o.desktopId},function(sectionnames){
|
$.getJSON("/desktop/get_desktop_settings",{"get":"sectionnames","desktopid":o.desktopId},function(sectionnames){
|
||||||
$("#desktop_names input").each(function(i){
|
$("#desktop_names input").each(function(i){
|
||||||
$(this).val(sectionnames[i]);
|
$(this).val(sectionnames[i]);
|
||||||
})
|
})
|
||||||
bindHandlers();
|
bindHandlers();
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
var themes = function(){ // this opens themes page in setting page
|
this.initializeSettings.themes = function(){ // this opens themes page in setting page
|
||||||
var bindHandlers = function(){ // binding handlers in themes page
|
var bindHandlers = function(){ // binding handlers in themes page
|
||||||
// live change theme
|
// live change theme
|
||||||
$(".theme_list > .ssl_item").click(function(){
|
$(".theme_list > .ssl_item").click(function(){
|
||||||
|
@ -760,7 +684,7 @@ var orbitDesktop = function(dom){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$("div#settings div#panel_r").load("/desktop/settingthemes",function(){
|
|
||||||
$.getJSON("/desktop/get_desktop_settings",{"get":"theme","desktopid":o.desktopId},function(theme){
|
$.getJSON("/desktop/get_desktop_settings",{"get":"theme","desktopid":o.desktopId},function(theme){
|
||||||
$('#st1 .theme_list [id='+theme+']')
|
$('#st1 .theme_list [id='+theme+']')
|
||||||
.addClass("thmc1 active", 300)
|
.addClass("thmc1 active", 300)
|
||||||
|
@ -770,10 +694,11 @@ var orbitDesktop = function(dom){
|
||||||
bindHandlers();
|
bindHandlers();
|
||||||
loadthmc();
|
loadthmc();
|
||||||
})
|
})
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var connection = function(){
|
this.initializeSettings.connection = function(){
|
||||||
|
|
||||||
var bindHandlers = function(){
|
var bindHandlers = function(){
|
||||||
$("#connection_setting ul a").click(function(){
|
$("#connection_setting ul a").click(function(){
|
||||||
var what = $(this).attr("for"),
|
var what = $(this).attr("for"),
|
||||||
|
@ -846,8 +771,8 @@ var orbitDesktop = function(dom){
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
$("div#settings div#panel_r").load("/desktop/settingconnection",function(){
|
|
||||||
$.getJSON("desktop/getaccounts",function(accounts){
|
$.getJSON("/otheraccounts/getaccounts",function(accounts){
|
||||||
$.each(accounts,function(i,account){
|
$.each(accounts,function(i,account){
|
||||||
$ul = $("#"+account.type+"_connection");
|
$ul = $("#"+account.type+"_connection");
|
||||||
$ul.find("input[type=text]").replaceWith("<div class='c_info usrnm'>"+account.email+"</div>")
|
$ul.find("input[type=text]").replaceWith("<div class='c_info usrnm'>"+account.email+"</div>")
|
||||||
|
@ -859,64 +784,18 @@ var orbitDesktop = function(dom){
|
||||||
bindHandlers();
|
bindHandlers();
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(o.contentHolder).empty().load("/desktop/"+target,function(){
|
|
||||||
bindHandlers();
|
|
||||||
themes();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
this.initializeOrbitTimeline = function(target){
|
|
||||||
o.currenthtml = target;
|
|
||||||
o.currentface = "orbit";
|
|
||||||
var bindHandlers = function(){
|
|
||||||
var timeline = new orbitTimeline("#timeline");
|
|
||||||
timeline.initialize();
|
|
||||||
}
|
|
||||||
if(!o.desktopData[o.currentface]){
|
|
||||||
$(o.contentHolder).empty().load("/desktop_orbit/"+target,function(){
|
|
||||||
bindHandlers();
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
$(o.contentHolder).html(o.desktopData[o.currentface]);
|
|
||||||
bindHandlers();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
this.initializeJournalPapers = function(target){ // this init journal papers
|
this.initializeOrbitTimeline = function(target,url,cache){
|
||||||
o.currenthtml = target;
|
|
||||||
o.currentface = "journal_p";
|
|
||||||
var bindHandlers = function(){ // bind handler for journal paper
|
|
||||||
$('.s_menu a').on({
|
|
||||||
click: function(){
|
|
||||||
if(!$(this).hasClass('active')){
|
|
||||||
var tfunc = $(this).attr('href');
|
|
||||||
switch(tfunc){
|
|
||||||
case 'list':
|
|
||||||
list();
|
|
||||||
break;
|
|
||||||
case 'addpaper':
|
|
||||||
addpaper();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$('.s_menu a').removeClass('thmc1 thmtxt active');
|
|
||||||
$(this).addClass('thmc1 thmtxt active');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mouseenter: function(){
|
|
||||||
if(!$(this).hasClass('active')){
|
|
||||||
$(this).switchClass('admtxt','thmc1 thmtxt',0);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mouseleave: function(){
|
|
||||||
var t = $(this).hasClass('active') ? '' : 'thmc1 thmtxt';
|
|
||||||
$(this).switchClass(t,'admtxt',0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var list = function(){ // to open list part in journal papers page
|
var timeline = new orbitTimeline("#timeline");
|
||||||
|
timeline.initialize();
|
||||||
|
|
||||||
|
};
|
||||||
|
this.initializeJournalPapers = function(target,url,cache){ // this init journal papers
|
||||||
|
|
||||||
|
this.initializeJournalPapers.list = function(){ // to open list part in journal papers page
|
||||||
var journalData;
|
var journalData;
|
||||||
var bindHandlers = function(){ // to bind handlers for list page
|
var bindHandlers = function(){ // to bind handlers for list page
|
||||||
o.simple_drop_down();
|
o.simple_drop_down();
|
||||||
|
@ -961,7 +840,7 @@ var orbitDesktop = function(dom){
|
||||||
$("#journal_p div#paper_list a").click(function(){
|
$("#journal_p div#paper_list a").click(function(){
|
||||||
if($(this).hasClass("icon-check-empty")){
|
if($(this).hasClass("icon-check-empty")){
|
||||||
$(this).switchClass("icon-check-empty","icon-check",0);
|
$(this).switchClass("icon-check-empty","icon-check",0);
|
||||||
} else if($(this).hasClass("icon-check")) {
|
} else if($(this) .hasClass("icon-check")) {
|
||||||
$(this).switchClass("icon-check","icon-check-empty",0);
|
$(this).switchClass("icon-check","icon-check-empty",0);
|
||||||
} else if($(this).hasClass("icon-star")){
|
} else if($(this).hasClass("icon-star")){
|
||||||
$(this).removeClass("icon-star").addClass("icon-star-empty");
|
$(this).removeClass("icon-star").addClass("icon-star-empty");
|
||||||
|
@ -1048,16 +927,14 @@ var orbitDesktop = function(dom){
|
||||||
bindSecondaryHandlers();
|
bindSecondaryHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
$("div#journal_p div#panel_r").load("/desktop/journal_p_list",function(){
|
$.getJSON("/desktop_publications/getjournals",function(journals){
|
||||||
$.getJSON("/desktop_publications/getjournals",function(journals){
|
journalData = eval(journals);
|
||||||
journalData = eval(journals);
|
journalview();
|
||||||
journalview();
|
bindHandlers();
|
||||||
bindHandlers();
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var addpaper = function(){ // to open add pages in journal papers page
|
this.initializeJournalPapers.addpaper = function(){ // to open add pages in journal papers page
|
||||||
var bindHandlers = function(){ // to bind handlers for add page
|
var bindHandlers = function(){ // to bind handlers for add page
|
||||||
o.simple_drop_down();
|
o.simple_drop_down();
|
||||||
|
|
||||||
|
@ -1066,54 +943,15 @@ var orbitDesktop = function(dom){
|
||||||
fill: '.s_grid_con'
|
fill: '.s_grid_con'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
$("div#journal_p div#panel_r").load("/desktop/journal_p_add",function(){
|
bindHandlers();
|
||||||
bindHandlers();
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!o.desktopData[o.currentface]){
|
|
||||||
$(o.contentHolder).empty().load("/desktop/"+target,function(){
|
|
||||||
bindHandlers();
|
|
||||||
list();
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
$(o.contentHolder).html(o.desktopData[o.currentface]);
|
|
||||||
bindHandlers();
|
|
||||||
list();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
this.initializeAppstore = function(target){
|
this.initializeAppstore = function(target,url,cache){
|
||||||
o.currenthtml = target;
|
|
||||||
o.currentface = "appstore";
|
|
||||||
var bindHandlers = function(){
|
this.initializeAppstore.widgets = function(){
|
||||||
$('.s_menu a').on({
|
|
||||||
click: function(){
|
|
||||||
if(!$(this).hasClass('active')){
|
|
||||||
var tfunc = $(this).attr('href');
|
|
||||||
switch(tfunc){
|
|
||||||
case 'widgets':
|
|
||||||
widgets();
|
|
||||||
break;
|
|
||||||
case 'onlinestore':
|
|
||||||
onlinestore();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$('.s_menu a').removeClass('thmc1 thmtxt active');
|
|
||||||
$(this).addClass('thmc1 thmtxt active');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mouseenter: function(){
|
|
||||||
if(!$(this).hasClass('active')){
|
|
||||||
$(this).switchClass('admtxt','thmc1 thmtxt',0);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mouseleave: function(){
|
|
||||||
var t = $(this).hasClass('active') ? '' : 'thmc1 thmtxt';
|
|
||||||
$(this).switchClass(t,'admtxt',0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var widgets = function(){
|
|
||||||
var bindHandlers = function(){
|
var bindHandlers = function(){
|
||||||
$("#widget_list a").click(function(){
|
$("#widget_list a").click(function(){
|
||||||
var sectionid = $(this).attr("for");
|
var sectionid = $(this).attr("for");
|
||||||
|
@ -1180,7 +1018,7 @@ var orbitDesktop = function(dom){
|
||||||
fill: '.list_t'
|
fill: '.list_t'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
$("div#apps_store div#panel_r").load("/desktop_appstore/widgets",function(){
|
|
||||||
|
|
||||||
$.getJSON("/desktop_appstore/getuserwidgets",function(userwidgets){
|
$.getJSON("/desktop_appstore/getuserwidgets",function(userwidgets){
|
||||||
var column = $('<div class="g_col list_t"><ul></ul></div>'),
|
var column = $('<div class="g_col list_t"><ul></ul></div>'),
|
||||||
|
@ -1230,62 +1068,25 @@ var orbitDesktop = function(dom){
|
||||||
counter++;
|
counter++;
|
||||||
})
|
})
|
||||||
$("#apps_store div#widget_list").append(column);
|
$("#apps_store div#widget_list").append(column);
|
||||||
bindHandlers();
|
|
||||||
})
|
})
|
||||||
})
|
|
||||||
}
|
}
|
||||||
var onlinestore = function(){
|
this.initializeAppstore.onlinestore = function(){
|
||||||
var bindHandlers = function(){
|
var bindHandlers = function(){
|
||||||
|
|
||||||
}
|
}
|
||||||
$("div#apps_store div#panel_r").load("/desktop_appstore/onlinestore",function(){
|
|
||||||
bindHandlers();
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if(!o.desktopData[o.currentface]){
|
|
||||||
$(o.contentHolder).empty().load("/desktop_appstore/"+target,function(){
|
|
||||||
onlinestore();
|
|
||||||
bindHandlers();
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
$(o.contentHolder).html(o.desktopData[o.currentface]);
|
|
||||||
onlinestore();
|
|
||||||
bindHandlers();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.initializeBooks = function(target){
|
|
||||||
o.currenthtml = target;
|
|
||||||
o.currentface = "books";
|
|
||||||
var bindHandlers = function(){
|
|
||||||
$('.s_menu a').on({
|
|
||||||
click: function(){
|
|
||||||
if(!$(this).hasClass('active')){
|
|
||||||
var tfunc = $(this).attr('href');
|
|
||||||
switch(tfunc){
|
|
||||||
case 'list':
|
|
||||||
list();
|
|
||||||
break;
|
|
||||||
case 'addbook':
|
|
||||||
addbook();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$('.s_menu a').removeClass('thmc1 thmtxt active');
|
|
||||||
$(this).addClass('thmc1 thmtxt active');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mouseenter: function(){
|
|
||||||
if(!$(this).hasClass('active')){
|
|
||||||
$(this).switchClass('admtxt','thmc1 thmtxt',0);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mouseleave: function(){
|
|
||||||
var t = $(this).hasClass('active') ? '' : 'thmc1 thmtxt';
|
|
||||||
$(this).switchClass(t,'admtxt',0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var list = function(){
|
bindHandlers();
|
||||||
|
|
||||||
|
}
|
||||||
|
this.initializeAppstore.onlinestore();
|
||||||
|
bindHandlers();
|
||||||
|
}
|
||||||
|
this.initializeBooks = function(target,url,cache){
|
||||||
|
|
||||||
|
|
||||||
|
this.initializeBooks.list = function(){
|
||||||
var bindHandlers = function(){
|
var bindHandlers = function(){
|
||||||
o.simple_drop_down();
|
o.simple_drop_down();
|
||||||
|
|
||||||
|
@ -1295,12 +1096,12 @@ var orbitDesktop = function(dom){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
$("div#books div#panel_r").load("/desktop/books_list",function(){
|
|
||||||
bindHandlers();
|
bindHandlers();
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var addbook = function(){
|
this.initializeBooks.addbook = function(){
|
||||||
var bindHandlers = function(){
|
var bindHandlers = function(){
|
||||||
o.simple_drop_down();
|
o.simple_drop_down();
|
||||||
|
|
||||||
|
@ -1311,54 +1112,16 @@ var orbitDesktop = function(dom){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$("div#books div#panel_r").load("/desktop/books_add",function(){
|
|
||||||
bindHandlers();
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if(!o.desktopData[o.currentface]){
|
|
||||||
$(o.contentHolder).empty().load("/desktop/"+target,function(){
|
|
||||||
list();
|
|
||||||
bindHandlers();
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
$(o.contentHolder).html(o.desktopData[o.currentface]);
|
|
||||||
list();
|
|
||||||
bindHandlers();
|
bindHandlers();
|
||||||
}
|
|
||||||
}
|
|
||||||
this.initializeSeminar = function(target){
|
|
||||||
o.currenthtml = target;
|
|
||||||
o.currentface = "seminar_p";
|
|
||||||
var bindHandlers = function(){
|
|
||||||
$('.s_menu a').on({
|
|
||||||
click: function(){
|
|
||||||
if(!$(this).hasClass('active')){
|
|
||||||
var tfunc = $(this).attr('href');
|
|
||||||
switch(tfunc){
|
|
||||||
case 'list':
|
|
||||||
list();
|
|
||||||
break;
|
|
||||||
case 'addseminar':
|
|
||||||
addseminar();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$('.s_menu a').removeClass('thmc1 thmtxt active');
|
|
||||||
$(this).addClass('thmc1 thmtxt active');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mouseenter: function(){
|
|
||||||
if(!$(this).hasClass('active')){
|
|
||||||
$(this).switchClass('admtxt','thmc1 thmtxt',0);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mouseleave: function(){
|
|
||||||
var t = $(this).hasClass('active') ? '' : 'thmc1 thmtxt';
|
|
||||||
$(this).switchClass(t,'admtxt',0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var list = function(){
|
}
|
||||||
|
this.initializeBooks.list();
|
||||||
|
|
||||||
|
}
|
||||||
|
this.initializeSeminar = function(target,url,cache){
|
||||||
|
|
||||||
|
|
||||||
|
this.initializeSeminar.list = function(){
|
||||||
var bindHandlers = function(){
|
var bindHandlers = function(){
|
||||||
o.tinyscrollbar_ext({
|
o.tinyscrollbar_ext({
|
||||||
main : ".tinycanvas",
|
main : ".tinycanvas",
|
||||||
|
@ -1366,12 +1129,12 @@ var orbitDesktop = function(dom){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
$("div#seminar_p div#panel_r").load("/desktop/seminar_p_list",function(){
|
|
||||||
bindHandlers();
|
bindHandlers();
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var addseminar = function(){
|
this.initializeSeminar.addseminar = function(){
|
||||||
var bindHandlers = function(){
|
var bindHandlers = function(){
|
||||||
o.simple_drop_down();
|
o.simple_drop_down();
|
||||||
|
|
||||||
|
@ -1381,53 +1144,15 @@ var orbitDesktop = function(dom){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
$("div#seminar_p div#panel_r").load("/desktop/seminar_p_add",function(){
|
|
||||||
bindHandlers();
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if(!o.desktopData[o.currentface]){
|
|
||||||
$(o.contentHolder).empty().load("/desktop/"+target,function(){
|
|
||||||
list();
|
|
||||||
bindHandlers();
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
$(o.contentHolder).html(o.desktopData[o.currentface]);
|
|
||||||
list();
|
|
||||||
bindHandlers();
|
bindHandlers();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
this.initializeSeminar.list();
|
||||||
|
|
||||||
}
|
}
|
||||||
this.initializeResearchDomain = function(target){
|
this.initializeResearchDomain = function(target,url,cache){
|
||||||
o.currenthtml = target;
|
|
||||||
o.currentface = "research_d";
|
this.initializeResearchDomain.list = function(){
|
||||||
var bindHandlers = function(){
|
|
||||||
$('.s_menu a').on({
|
|
||||||
click: function(){
|
|
||||||
if(!$(this).hasClass('active')){
|
|
||||||
var tfunc = $(this).attr('href');
|
|
||||||
switch(tfunc){
|
|
||||||
case 'list':
|
|
||||||
list();
|
|
||||||
break;
|
|
||||||
case 'add':
|
|
||||||
add_this();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$('.s_menu a').removeClass('thmc1 thmtxt active');
|
|
||||||
$(this).addClass('thmc1 thmtxt active');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mouseenter: function(){
|
|
||||||
if(!$(this).hasClass('active')){
|
|
||||||
$(this).switchClass('admtxt','thmc1 thmtxt',0);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mouseleave: function(){
|
|
||||||
var t = $(this).hasClass('active') ? '' : 'thmc1 thmtxt';
|
|
||||||
$(this).switchClass(t,'admtxt',0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var list = function(){
|
|
||||||
var bindHandlers = function(){
|
var bindHandlers = function(){
|
||||||
o.tinyscrollbar_ext({
|
o.tinyscrollbar_ext({
|
||||||
main : ".tinycanvas",
|
main : ".tinycanvas",
|
||||||
|
@ -1435,67 +1160,25 @@ var orbitDesktop = function(dom){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
$("div#research_d div#panel_r").load("/desktop/research_d_list",function(){
|
|
||||||
bindHandlers();
|
|
||||||
})
|
|
||||||
}
|
|
||||||
var add_this = function(){
|
|
||||||
var bindHandlers = function(){
|
|
||||||
o.simple_drop_down();
|
|
||||||
|
|
||||||
o.tinyscrollbar_ext({
|
bindHandlers();
|
||||||
main: '.tinycanvas',
|
|
||||||
fill: '.s_grid_con'
|
}
|
||||||
})
|
this.initializeResearchDomain.add_this = function(){
|
||||||
|
var bindHandlers = function(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$("div#research_d div#panel_r").load("/desktop/research_d_add",function(){
|
|
||||||
bindHandlers();
|
bindHandlers();
|
||||||
})
|
|
||||||
}
|
|
||||||
if(!o.desktopData[o.currentface]){
|
|
||||||
$(o.contentHolder).empty().load("/desktop/"+target,function(){
|
|
||||||
list();
|
|
||||||
bindHandlers();
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
$(o.contentHolder).html(o.desktopData[o.currentface]);
|
|
||||||
list();
|
|
||||||
bindHandlers();
|
|
||||||
}
|
}
|
||||||
|
this.initializeResearchDomain.list();
|
||||||
|
|
||||||
}
|
}
|
||||||
this.initializeResearchProject = function(target){
|
this.initializeResearchProject = function(target,url,cache){
|
||||||
o.currenthtml = target;
|
|
||||||
o.currentface = "research_p";
|
this.initializeResearchProject.list = function(){
|
||||||
var bindHandlers = function(){
|
|
||||||
$('.s_menu a').on({
|
|
||||||
click: function(){
|
|
||||||
if(!$(this).hasClass('active')){
|
|
||||||
var tfunc = $(this).attr('href');
|
|
||||||
switch(tfunc){
|
|
||||||
case 'list':
|
|
||||||
list();
|
|
||||||
break;
|
|
||||||
case 'add':
|
|
||||||
add_this();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$('.s_menu a').removeClass('thmc1 thmtxt active');
|
|
||||||
$(this).addClass('thmc1 thmtxt active');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mouseenter: function(){
|
|
||||||
if(!$(this).hasClass('active')){
|
|
||||||
$(this).switchClass('admtxt','thmc1 thmtxt',0);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mouseleave: function(){
|
|
||||||
var t = $(this).hasClass('active') ? '' : 'thmc1 thmtxt';
|
|
||||||
$(this).switchClass(t,'admtxt',0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var list = function(){
|
|
||||||
var bindHandlers = function(){
|
var bindHandlers = function(){
|
||||||
o.tinyscrollbar_ext({
|
o.tinyscrollbar_ext({
|
||||||
main : ".tinycanvas",
|
main : ".tinycanvas",
|
||||||
|
@ -1503,11 +1186,11 @@ var orbitDesktop = function(dom){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
$("div#research_p div#panel_r").load("/desktop/research_p_list",function(){
|
|
||||||
bindHandlers();
|
bindHandlers();
|
||||||
})
|
|
||||||
}
|
}
|
||||||
var add_this = function(){
|
this.initializeResearchProject.add_this = function(){
|
||||||
var bindHandlers = function(){
|
var bindHandlers = function(){
|
||||||
o.simple_drop_down();
|
o.simple_drop_down();
|
||||||
|
|
||||||
|
@ -1517,20 +1200,12 @@ var orbitDesktop = function(dom){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
$("div#research_p div#panel_r").load("/desktop/research_p_add",function(){
|
|
||||||
bindHandlers();
|
bindHandlers();
|
||||||
})
|
|
||||||
}
|
|
||||||
if(!o.desktopData[o.currentface]){
|
|
||||||
$(o.contentHolder).empty().load("/desktop/"+target,function(){
|
|
||||||
list();
|
|
||||||
bindHandlers();
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
$(o.contentHolder).html(o.desktopData[o.currentface]);
|
|
||||||
list();
|
|
||||||
bindHandlers();
|
|
||||||
}
|
}
|
||||||
|
this.initializeResearchProject.list();
|
||||||
|
|
||||||
}
|
}
|
||||||
this.loadWallpaper = function(wallpaper){ // this is to load new wallpaper
|
this.loadWallpaper = function(wallpaper){ // this is to load new wallpaper
|
||||||
if(!wallpaper)wallpapernm = o.themesettings.background;else wallpapernm = wallpaper
|
if(!wallpaper)wallpapernm = o.themesettings.background;else wallpapernm = wallpaper
|
||||||
|
@ -1557,16 +1232,16 @@ var orbitDesktop = function(dom){
|
||||||
var widget = $(this);
|
var widget = $(this);
|
||||||
if(widget.attr("data-category")=="widget"){
|
if(widget.attr("data-category")=="widget"){
|
||||||
var widgename = widget.attr("data-content");
|
var widgename = widget.attr("data-content");
|
||||||
$.getScript("/desktop_widgets/"+widgename+"/"+widgename+".js",function(){
|
$.getScript(widget.attr("js-link"),function(){
|
||||||
widget.find("div.appholder").load("/desktop_widgets/"+widgename+"/index.html.erb");
|
widget.find("div.appholder").load(widget.attr("data-content"));
|
||||||
});
|
});
|
||||||
// $(this).find("div.appholder").append( $('<link rel="stylesheet" id="dyn_css" type="text/css" />').attr('href', "/desktop_widgets/"+widgename+"/css/"+widgename+".css"));
|
$(this).find("div.appholder").append( '<link rel="stylesheet" id="dyn_css" href="'+widget.attr("css-link")+'" type="text/css" />')
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
this.saveWallpaper = function(wallpaper){ // this function saves wallpaper in db
|
this.saveWallpaper = function(wallpaper){ // this function saves wallpaper in db
|
||||||
$.post("desktop/save_desktop_settings",{"save":"wallpaper","wallpapernm":wallpaper,"desktopid":o.desktopId},function(result){
|
$.post("/desktop/save_desktop_settings",{"save":"wallpaper","wallpapernm":wallpaper,"desktopid":o.desktopId},function(result){
|
||||||
if(result[0].success=="true")
|
if(result[0].success=="true")
|
||||||
o.notify("Wallpaper saved!!","success",2);
|
o.notify("Wallpaper saved!!","success",2);
|
||||||
else
|
else
|
||||||
|
@ -1697,3 +1372,17 @@ orbitDesktop.prototype.currentUsername = "Harry";
|
||||||
var uselessfunction = function(){
|
var uselessfunction = function(){
|
||||||
$.post("/desktop/temp_func",{sectionid:"4f83e7bbbd98eb041600001d"});
|
$.post("/desktop/temp_func",{sectionid:"4f83e7bbbd98eb041600001d"});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
orbitDesktop.prototype.initCourses = function(){
|
||||||
|
o.notify("Hi there","","");
|
||||||
|
}
|
||||||
|
|
||||||
|
orbitDesktop.prototype.something = function(){
|
||||||
|
o.notify("something","","");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,17 +14,20 @@ function load_tinymce() {
|
||||||
theme_advanced_toolbar_align : "left",
|
theme_advanced_toolbar_align : "left",
|
||||||
theme_advanced_statusbar_location : "bottom",
|
theme_advanced_statusbar_location : "bottom",
|
||||||
theme_advanced_resizing : true,
|
theme_advanced_resizing : true,
|
||||||
|
relative_urls : false,
|
||||||
|
|
||||||
// Skin options
|
// Skin options
|
||||||
skin : "o2k7",
|
skin : "o2k7",
|
||||||
skin_variant : "silver",
|
skin_variant : "silver",
|
||||||
|
font_size_style_values : "xx-small,x-small,small,medium,large,x-large,xx-large",
|
||||||
// Drop lists for link/image/media/template dialogs
|
// Drop lists for link/image/media/template dialogs
|
||||||
template_external_list_url : "js/template_list.js",
|
template_external_list_url : "js/template_list.js",
|
||||||
// external_link_list_url : "js/link_list.js",
|
// external_link_list_url : "js/link_list.js",
|
||||||
// external_image_list_url : "js/image_list.js",
|
// external_image_list_url : "js/image_list.js",
|
||||||
// media_external_list_url : "js/media_list.js"
|
// media_external_list_url : "js/media_list.js"
|
||||||
|
|
||||||
|
content_css: "<%= asset_path('tinymce_orbit.css') %>",
|
||||||
|
|
||||||
// Style formats
|
// Style formats
|
||||||
style_formats : [
|
style_formats : [
|
||||||
{title : 'Bold text', inline : 'b'},
|
{title : 'Bold text', inline : 'b'},
|
||||||
|
@ -40,7 +43,15 @@ function load_tinymce() {
|
||||||
template_replace_values : {
|
template_replace_values : {
|
||||||
username : "Some User",
|
username : "Some User",
|
||||||
staffid : "991234"
|
staffid : "991234"
|
||||||
}
|
},
|
||||||
|
|
||||||
|
// Valide HTML elements
|
||||||
|
valid_elements : '*[*]',
|
||||||
|
valid_children : '*[*]',
|
||||||
|
|
||||||
|
// Height & width
|
||||||
|
height : '400',
|
||||||
|
width : '100%'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function myFileBrowser(field_name, url, type, win) {
|
function myFileBrowser(field_name, url, type, win) {
|
||||||
|
|
|
@ -99,7 +99,7 @@ textarea {
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: /*"Helvetica Neue", */Helvetica, Arial, sans-serif;
|
font-family: /*"Helvetica Neue", */Helvetica, Arial, sans-serif;
|
||||||
font-size: 13px;
|
font-size: 75%;
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
|
|
|
@ -287,36 +287,42 @@
|
||||||
padding: 0 20px 0 150px !important;
|
padding: 0 20px 0 150px !important;
|
||||||
margin: 20px 0 0;
|
margin: 20px 0 0;
|
||||||
}
|
}
|
||||||
.user-role .user-info {
|
.role-block .user-info {
|
||||||
top: 23px;
|
top: 23px;
|
||||||
margin-left: -135px;
|
margin-left: -135px;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
border-right: none;
|
border-right: none;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
.user-role .map-block h4 .gender {
|
.role-block .map-block h4 .gender {
|
||||||
top: -1px;
|
top: -1px;
|
||||||
bottom: auto;
|
bottom: auto;
|
||||||
left: -1px;
|
left: -1px;
|
||||||
right: auto;
|
right: auto;
|
||||||
border-radius: 4px 0 0 0;
|
border-radius: 4px 0 0 0;
|
||||||
}
|
}
|
||||||
.user-role .teacher h4 .gender {
|
.role-block .teacher h4 .gender {
|
||||||
border-color: #186AB6 transparent transparent #186AB6;
|
border-color: #186AB6 transparent transparent #186AB6;
|
||||||
}
|
}
|
||||||
.user-role .student h4 .gender {
|
.role-block .student h4 .gender {
|
||||||
border-color: #F38C08 transparent transparent #F38C08;
|
border-color: #F38C08 transparent transparent #F38C08;
|
||||||
}
|
}
|
||||||
.user-role .staff h4 .gender {
|
.role-block .staff h4 .gender {
|
||||||
border-color: #139E2F transparent transparent #139E2F;
|
border-color: #139E2F transparent transparent #139E2F;
|
||||||
}
|
}
|
||||||
.user-role .tab-content, .user-role .nav-pills {
|
.role-block .tab-content, .role-block .nav-pills {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
.user-role .nav-pills {
|
.role-block .nav-pills {
|
||||||
margin-left: 10px;
|
margin-bottom: 0;g
|
||||||
}
|
}
|
||||||
.plural .input-append input, .plural .input-append select, .plural .input-append .uneditable-input {
|
.role-block .nav-pills > li > a {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
/*.role-block .control-group .inline {
|
||||||
|
float:
|
||||||
|
}*/
|
||||||
|
.plural .input-append input, .plural .input-append select, .plural .input-append .uneditable-input, .unRadius input {
|
||||||
-webkit-border-radius: 3px;
|
-webkit-border-radius: 3px;
|
||||||
-moz-border-radius: 3px;
|
-moz-border-radius: 3px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
@ -339,3 +345,7 @@
|
||||||
-moz-border-radius: 0 3px 3px 0;
|
-moz-border-radius: 0 3px 3px 0;
|
||||||
border-radius: 0 3px 3px 0;
|
border-radius: 0 3px 3px 0;
|
||||||
}
|
}
|
||||||
|
.language-swich .tab-pane {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
|
@ -81,37 +81,60 @@
|
||||||
background-color: #5EB92B;
|
background-color: #5EB92B;
|
||||||
font-size: 9px;
|
font-size: 9px;
|
||||||
padding: 0px 10px;
|
padding: 0px 10px;
|
||||||
border-radius: 8px;
|
border-radius: 11px;
|
||||||
line-height: 16px;
|
line-height: 20px;
|
||||||
height: 15px;
|
height: 19px;
|
||||||
color: #FFF;
|
color: #FFF;
|
||||||
width: 38px;
|
width: 40px;
|
||||||
border: none;
|
border: none;
|
||||||
box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.5), 0 0 5px rgba(13, 75, 23, 0.5) inset;
|
box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.5), 0 0 5px rgba(13, 75, 23, 0.5) inset;
|
||||||
margin-top: 2px;
|
margin-top: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for mamber role */
|
/* for mamber role */
|
||||||
|
.role-block .form-horizontal {
|
||||||
.user-role .form-horizontal {
|
|
||||||
padding: 20px 10px 10px;
|
padding: 20px 10px 10px;
|
||||||
background-color: #FFF;
|
background-color: #FFF;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
border-radius: 0 0 4px 4px;
|
border-radius: 0 0 4px 4px;
|
||||||
}
|
}
|
||||||
.user-role .form-horizontal .control-label {
|
.role-block [class*="type"] {
|
||||||
|
background-color: #F1F1F1;
|
||||||
|
padding: 20px 0 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
margin: -25px 0 40px;
|
||||||
|
/*box-shadow: 0px 1px 3px rgba(100,100,100,.4)*/
|
||||||
|
}
|
||||||
|
.role-block .form-horizontal .control-label {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
}
|
}
|
||||||
.user-role .form-horizontal .controls {
|
.role-block .form-horizontal .controls {
|
||||||
margin-left: 120px;
|
margin-left: 120px;
|
||||||
}
|
}
|
||||||
.user-role .form-horizontal .controls>.input-append {
|
.role-block .form-horizontal .controls>.input-append {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
.user-role .map-block {
|
.role-block .form-horizontal legend .onoff {
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
.role-block .form-horizontal legend .btn-danger {
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
.role-block .form-horizontal legend>.clear {
|
||||||
|
margin-right: 150px;
|
||||||
|
min-width: 350px;
|
||||||
|
}
|
||||||
|
.role-block .map-block {
|
||||||
min-width: 440px;
|
min-width: 440px;
|
||||||
}
|
}
|
||||||
.user-role .map-block legend {
|
.role-block .map-block .form-actions {
|
||||||
|
margin: 0;
|
||||||
|
padding: 10px 20px;
|
||||||
|
}
|
||||||
|
.role-block .map-block legend {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
line-height: 25px;
|
line-height: 25px;
|
||||||
}
|
}
|
||||||
|
.role-block .map-block legend .nav {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
|
@ -476,6 +476,9 @@
|
||||||
.view-mode .btn {
|
.view-mode .btn {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
.view-mode .btn {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
.view-mode i {
|
.view-mode i {
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
line-height: 17px !important;
|
line-height: 17px !important;
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
body {
|
||||||
|
font-family: Arial, Helvetica, sans-serif !important;
|
||||||
|
font-size: 13px !important;
|
||||||
|
}
|
|
@ -41,7 +41,7 @@ class Admin::AdImagesController < OrbitBackendController
|
||||||
@ad_banner = AdBanner.find params[:ad_banner_id]
|
@ad_banner = AdBanner.find params[:ad_banner_id]
|
||||||
@ad_image = @ad_banner.ad_images.find params[:id]
|
@ad_image = @ad_banner.ad_images.find params[:id]
|
||||||
if @ad_image.destroy
|
if @ad_image.destroy
|
||||||
flash[:notice] = t('admin.success_destroy_ad_image')
|
flash[:notice] = t('ad.success_destroy_ad_image')
|
||||||
redirect_to admin_ad_banner_path @ad_banner
|
redirect_to admin_ad_banner_path @ad_banner
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,7 +25,7 @@ class Admin::AssetCategoriesController < OrbitBackendController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @asset_category.save
|
if @asset_category.save
|
||||||
format.html { redirect_to(admin_asset_categories_url, :notice => t('announcement.create_asset_category_success')) }
|
format.html { redirect_to(admin_asset_categories_url, :notice => t('create.success.asset_category')) }
|
||||||
format.js
|
format.js
|
||||||
else
|
else
|
||||||
format.html { render :action => "new" }
|
format.html { render :action => "new" }
|
||||||
|
@ -41,8 +41,8 @@ class Admin::AssetCategoriesController < OrbitBackendController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @asset_category.update_attributes(params[:asset_category])
|
if @asset_category.update_attributes(params[:asset_category])
|
||||||
# format.html { redirect_to(panel_announcement_back_end_asset_category_url(@asset_category), :notice => t('asset_category.update_asset_category_success')) }
|
# format.html { redirect_to(panel_announcement_back_end_asset_category_url(@asset_category), :notice => t('create.success')) }
|
||||||
# format.html { redirect_to(panel_announcement_back_end_asset_categories_url, :notice => t('asset_category.update_asset_category_success')) }
|
# format.html { redirect_to(panel_announcement_back_end_asset_categories_url, :notice => t('create.success')) }
|
||||||
# format.xml { head :ok }
|
# format.xml { head :ok }
|
||||||
format.js
|
format.js
|
||||||
else
|
else
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Admin::AssetsController < OrbitBackendController
|
||||||
# render :json=>{"url"=>@asset.data.url,"title"=>"xxx","desc"=>"sss"}.to_json
|
# render :json=>{"url"=>@asset.data.url,"title"=>"xxx","desc"=>"sss"}.to_json
|
||||||
render :layout=>false
|
render :layout=>false
|
||||||
else
|
else
|
||||||
flash[:error] = t(:create_fail)
|
flash[:error] = t('create.fail')
|
||||||
@asset_categories = AssetCategory.all
|
@asset_categories = AssetCategory.all
|
||||||
@tags = AssetTag.all
|
@tags = AssetTag.all
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@ -67,7 +67,7 @@ class Admin::AssetsController < OrbitBackendController
|
||||||
format.js { render 'js/remove_pop_up_and_reload_content', :locals => {:function => 'replaceWith', :id => "asset_#{@asset.id}", :value => @asset, :values => nil, :partial => 'admin/assets/asset', :locals => nil} }
|
format.js { render 'js/remove_pop_up_and_reload_content', :locals => {:function => 'replaceWith', :id => "asset_#{@asset.id}", :value => @asset, :values => nil, :partial => 'admin/assets/asset', :locals => nil} }
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
flash[:error] = t(:update_fail)
|
flash[:error] = t('update.fail')
|
||||||
@asset_categories = AssetCategory.all
|
@asset_categories = AssetCategory.all
|
||||||
@tags = AssetTag.all
|
@tags = AssetTag.all
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@ -105,4 +105,8 @@ class Admin::AssetsController < OrbitBackendController
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_permission
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
class Admin::InfosController < ApplicationController
|
class Admin::InfosController < ApplicationController
|
||||||
|
|
||||||
layout "admin"
|
layout "new_admin"
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
before_filter :is_admin?
|
before_filter :is_admin?
|
||||||
before_filter :set_attribute, :only => [:index, :show, :new, :edit]
|
before_filter :set_attribute, :only => [:index, :show, :new, :edit]
|
||||||
|
helper Admin::AttributeValuesViewHelper
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@attributes = Info.all.entries
|
@attributes = Info.all.entries
|
||||||
|
@ -32,8 +33,8 @@ class Admin::InfosController < ApplicationController
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@attribute = Info.find(params[:id])
|
@attribute = Info.find(params[:id])
|
||||||
# binding.pry
|
|
||||||
@attribute.update_attributes(params[:info])
|
@attribute.update_attributes(params[:info])
|
||||||
|
@attribute.attribute_fields.each{|t| t.destroy if t["to_delete"] == true}
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to :action => :index }
|
format.html { redirect_to :action => :index }
|
||||||
format.js { render 'admin/attributes/toggle_enable' }
|
format.js { render 'admin/attributes/toggle_enable' }
|
||||||
|
@ -47,10 +48,10 @@ class Admin::InfosController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_attribute_field
|
def add_attribute_field
|
||||||
@attribute = Info.find(params[:id]) rescue nil
|
attribute = Info.find(params[:info_id]) rescue nil
|
||||||
if !@attribute
|
@attribute_field_counter = attribute.attribute_fields.count
|
||||||
@attribute = Info.new
|
@attribute_field = attribute.attribute_fields.build
|
||||||
end
|
@attribute_field.save
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
|
@ -4,7 +4,6 @@ class Admin::ItemsController < ApplicationController
|
||||||
|
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
before_filter :find_parent_item
|
before_filter :find_parent_item
|
||||||
before_filter :find_snippets, :only => :index
|
|
||||||
before_filter :is_admin?
|
before_filter :is_admin?
|
||||||
before_filter :set_current_item
|
before_filter :set_current_item
|
||||||
|
|
||||||
|
@ -22,10 +21,4 @@ class Admin::ItemsController < ApplicationController
|
||||||
render :nothing => true
|
render :nothing => true
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
def find_snippets
|
|
||||||
@snippets = Snippet.where( { :parent_id => @parent_item.id } ) rescue nil
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Admin::LinksController < ApplicationController
|
||||||
@item = Link.new(params[:link])
|
@item = Link.new(params[:link])
|
||||||
|
|
||||||
if @item.save
|
if @item.save
|
||||||
flash.now[:notice] = t('admin.create_success_link')
|
flash.now[:notice] = t('create.success.link')
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
redirect_to admin_link_url(@item)
|
redirect_to admin_link_url(@item)
|
||||||
|
@ -31,7 +31,7 @@ class Admin::LinksController < ApplicationController
|
||||||
format.js {}
|
format.js {}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
flash.now[:error] = t('admin.create_error_link')
|
flash.now[:error] = t('create.error.link')
|
||||||
render :action => "new"
|
render :action => "new"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -40,7 +40,7 @@ class Admin::LinksController < ApplicationController
|
||||||
@item = Link.find(params[:id])
|
@item = Link.find(params[:id])
|
||||||
|
|
||||||
if @item.update_attributes(params[:link])
|
if @item.update_attributes(params[:link])
|
||||||
flash.now[:notice] = t('admin.update_success_link')
|
flash.now[:notice] = t('update.success.link')
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
redirect_to admin_link_url(@item)
|
redirect_to admin_link_url(@item)
|
||||||
|
@ -48,7 +48,7 @@ class Admin::LinksController < ApplicationController
|
||||||
format.js {}
|
format.js {}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
flash.now[:error] = t('admin.update_error_link')
|
flash.now[:error] = t('update.error.link')
|
||||||
render :action => "edit"
|
render :action => "edit"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -66,14 +66,14 @@ class Admin::ModuleAppsController < ApplicationController
|
||||||
def assign_sub_manager
|
def assign_sub_manager
|
||||||
unless @assign_to_user.nil? || @assign_to_user.admin?
|
unless @assign_to_user.nil? || @assign_to_user.admin?
|
||||||
if @module_app.assign_sub_manager(@assign_to_user,current_user)
|
if @module_app.assign_sub_manager(@assign_to_user,current_user)
|
||||||
flash[:notice] = t('admin.app_auth.assigning_manager.add_sub_manager_ok')
|
flash[:notice] = t('app_auth.assigning_manager.add_manager_ok')
|
||||||
else
|
else
|
||||||
flash[:notice] = t('admin.app_auth.assigning_manager.add_sub_manager_fail')
|
flash[:notice] = t('app_auth.assigning_manager.add_manager_fail')
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
flash[:notice] = t('admin.app_auth.assigning_manager.failed_no_user')
|
flash[:notice] = t('app_auth.failed_no_user')
|
||||||
end
|
end
|
||||||
flash[:notice] = t('admin.app_auth.can_not_add_this_user')
|
flash[:notice] = t('app_auth.can_not_add_this_user')
|
||||||
redirect_to :action => "edit"
|
redirect_to :action => "edit"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -81,14 +81,14 @@ class Admin::ModuleAppsController < ApplicationController
|
||||||
def assign_manager
|
def assign_manager
|
||||||
unless @assign_to_user.nil? || @assign_to_user.admin?
|
unless @assign_to_user.nil? || @assign_to_user.admin?
|
||||||
if @module_app.assign_manager(@assign_to_user,current_user)
|
if @module_app.assign_manager(@assign_to_user,current_user)
|
||||||
flash[:notice] = t('admin.app_auth.assigning_sub_manager.add_manager_ok')
|
flash[:notice] = t('app_auth.assigning_sub_manager.add_sub_manager_ok')
|
||||||
else
|
else
|
||||||
flash[:notice] = t('admin.app_auth.assigning_sub_manager.add_manager_fail')
|
flash[:notice] = t('app_auth.assigning_sub_manager.add_sub_manager_fail')
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
flash[:notice] = t('admin.app_auth.assigning_sub_manager.failed_no_user')
|
flash[:notice] = t('app_auth.failed_no_user')
|
||||||
end
|
end
|
||||||
flash[:notice] = t('admin.app_auth.can_not_add_this_user')
|
flash[:notice] = t('app_auth.can_not_add_this_user')
|
||||||
redirect_to :action => "edit"
|
redirect_to :action => "edit"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -96,9 +96,9 @@ class Admin::ModuleAppsController < ApplicationController
|
||||||
def remove_manager
|
def remove_manager
|
||||||
@app_manager = AppManager.find(params[:app_manager_id])
|
@app_manager = AppManager.find(params[:app_manager_id])
|
||||||
if @module_app.remove_manager(@app_manager.user)
|
if @module_app.remove_manager(@app_manager.user)
|
||||||
flash[:notice] = t('admin.app_auth.delete_manager.success')
|
flash[:notice] = t('app_auth.delete_manager.success')
|
||||||
else
|
else
|
||||||
flash[:notice] = t('admin.app_auth.delete_manager.fail')
|
flash[:notice] = t('app_auth.delete_manager.fail')
|
||||||
end
|
end
|
||||||
redirect_to :action => "edit"
|
redirect_to :action => "edit"
|
||||||
end
|
end
|
||||||
|
@ -107,9 +107,9 @@ class Admin::ModuleAppsController < ApplicationController
|
||||||
def remove_sub_manager
|
def remove_sub_manager
|
||||||
@app_sub_manager = AppManager.find(params[:app_sub_manager_id])
|
@app_sub_manager = AppManager.find(params[:app_sub_manager_id])
|
||||||
if @module_app.remove_sub_manager(@app_sub_manager.user)
|
if @module_app.remove_sub_manager(@app_sub_manager.user)
|
||||||
flash[:notice] = t('admin.app_auth.delete_sub_manager.success')
|
flash[:notice] = t('app_auth.delete_sub_manager.success')
|
||||||
else
|
else
|
||||||
flash[:notice] = t('admin.app_auth.delete_sub_manager.fail')
|
flash[:notice] = t('app_auth.delete_sub_manager.fail')
|
||||||
end
|
end
|
||||||
redirect_to :action => "edit"
|
redirect_to :action => "edit"
|
||||||
end
|
end
|
||||||
|
@ -123,7 +123,7 @@ class Admin::ModuleAppsController < ApplicationController
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
#user is not permited to do that
|
#user is not permited to do that
|
||||||
flash[:notice] = t('admin.app_auth.operation_not_permitted')
|
flash[:notice] = t('app_auth.operation_not_permitted')
|
||||||
render :nothing => true, :status => 403
|
render :nothing => true, :status => 403
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ class Admin::ModuleAppsController < ApplicationController
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
#user is not permited to do that
|
#user is not permited to do that
|
||||||
flash[:notice] = t('admin.app_auth.operation_not_permitted')
|
flash[:notice] = t('app_auth.operation_not_permitted')
|
||||||
render :nothing => true, :status => 403
|
render :nothing => true, :status => 403
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,9 @@ class Admin::ModuleAppsNewInterfaceController < OrbitBackendController
|
||||||
def update_setting
|
def update_setting
|
||||||
module_app = update_setting_by_params
|
module_app = update_setting_by_params
|
||||||
if module_app.save!
|
if module_app.save!
|
||||||
flash[:notice] = t("admin.object_auth.update_done")
|
flash[:notice] = t('update.success_')
|
||||||
else
|
else
|
||||||
flash[:notice] = t("admin.object_auth.update_failed")
|
flash[:notice] = t('update.fail')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Admin::ObjectAuthsController < ApplicationController
|
||||||
if @object_auth.save
|
if @object_auth.save
|
||||||
redirect_to edit_admin_object_auth_path(@object_auth)
|
redirect_to edit_admin_object_auth_path(@object_auth)
|
||||||
else
|
else
|
||||||
flash[:error] = t('admin.object.a_object_must_have_only_one_object_auth_profile_for_each_action')
|
flash[:error] = t('object.a_object_must_have_only_one_object_auth_profile_for_each_action')
|
||||||
redirect_to (:back)
|
redirect_to (:back)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -91,7 +91,8 @@ private
|
||||||
|
|
||||||
def check_if_user_can_do_object_auth
|
def check_if_user_can_do_object_auth
|
||||||
unless check_permission(:manager)
|
unless check_permission(:manager)
|
||||||
render :nothing => true, :status => 403
|
#render :nothing => true, :status => 403
|
||||||
|
redirect_to '/'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -7,7 +7,7 @@ class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController
|
||||||
|
|
||||||
@sys_users = User.all(conditions: {admin: false}).includes(:avatar)
|
@sys_users = User.all(conditions: {admin: false}).includes(:avatar)
|
||||||
@ob_auth = ObjectAuth.find params[:object_auth_id]
|
@ob_auth = ObjectAuth.find params[:object_auth_id]
|
||||||
@options_from_collection_for_select_ob_auth = [@ob_auth].collect{|oa| [oa.auth_obj.pp_object,oa.id] }
|
@options_from_collection_for_select_ob_auth = @ob_auth.siblings.collect{|oa| [oa.auth_obj.pp_object,oa.id] }
|
||||||
@users_array = @ob_auth.privilege_users rescue []
|
@users_array = @ob_auth.privilege_users rescue []
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@ -19,9 +19,9 @@ class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController
|
||||||
def update_setting
|
def update_setting
|
||||||
ob_auth = update_setting_by_params
|
ob_auth = update_setting_by_params
|
||||||
if ob_auth.save!
|
if ob_auth.save!
|
||||||
flash[:notice] = t("admin.object_auth.update_done")
|
flash[:notice] = t('update.success_')
|
||||||
else
|
else
|
||||||
flash[:notice] = t("admin.object_auth.update_failed")
|
flash[:notice] = t('update.fail')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -38,10 +38,12 @@ class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController
|
||||||
users_to_remove = oa.auth_users - user_sat
|
users_to_remove = oa.auth_users - user_sat
|
||||||
|
|
||||||
users_to_new.each do |new_user|
|
users_to_new.each do |new_user|
|
||||||
|
oa.privilege_users << new_user
|
||||||
oa.add_user_to_privilege_list(new_user)
|
oa.add_user_to_privilege_list(new_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
users_to_remove.each do |remove_user|
|
users_to_remove.each do |remove_user|
|
||||||
|
oa.privilege_users.delete_if{|user| user == remove_user}
|
||||||
oa.remove_user_from_privilege_list(remove_user)
|
oa.remove_user_from_privilege_list(remove_user)
|
||||||
end
|
end
|
||||||
oa
|
oa
|
||||||
|
@ -63,8 +65,26 @@ class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController
|
||||||
|
|
||||||
def check_if_user_can_do_object_auth
|
def check_if_user_can_do_object_auth
|
||||||
unless check_permission(:manager)
|
unless check_permission(:manager)
|
||||||
render :nothing => true, :status => 403
|
redirect_to '/'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_permission(var)
|
||||||
|
#app = ModuleApp.first({conditions:{key: params[:module_app_key]}})
|
||||||
|
# setup_vars
|
||||||
|
@module_app.is_manager?(current_user) || current_user.admin?
|
||||||
|
end
|
||||||
|
|
||||||
|
def setup_vars
|
||||||
|
if request.env['HTTP_REFERER'].split('/')[4] == "object_auths"
|
||||||
|
@app_key = params[:app_key]
|
||||||
|
else
|
||||||
|
@app_key = request.env['HTTP_REFERER'].split('/')[4]
|
||||||
|
end
|
||||||
|
|
||||||
|
#@app_key = request.fullpath.split('/')[1] if(@app_key == "back_end")
|
||||||
|
@app_key.gsub!(/[?].*/,'')
|
||||||
|
@module_app = ModuleApp.first(conditions: {:key => @app_key} )
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -61,7 +61,7 @@ class Admin::PagePartsController < ApplicationController
|
||||||
|
|
||||||
if @part.update_attributes(params[:page_part])
|
if @part.update_attributes(params[:page_part])
|
||||||
set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu')
|
set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu')
|
||||||
flash.now[:notice] = t('admin.update_success_content')
|
flash.now[:notice] = t('update.success.content')
|
||||||
|
|
||||||
if @part.page.name == 'home'
|
if @part.page.name == 'home'
|
||||||
expire_page '/'
|
expire_page '/'
|
||||||
|
|
|
@ -72,7 +72,7 @@ class Admin::PagesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
if @item.save
|
if @item.save
|
||||||
flash.now[:notice] = t('admin.create_success_page')
|
flash.now[:notice] = t('create.success.page')
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
redirect_to admin_page_url(@item)
|
redirect_to admin_page_url(@item)
|
||||||
|
@ -80,7 +80,7 @@ class Admin::PagesController < ApplicationController
|
||||||
format.js {}
|
format.js {}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
flash.now[:error] = t('admin.create_error_page')
|
flash.now[:error] = t('create.error.page')
|
||||||
@apps = ModuleApp.all
|
@apps = ModuleApp.all
|
||||||
@designs = Design.all.entries
|
@designs = Design.all.entries
|
||||||
@design = Design.first
|
@design = Design.first
|
||||||
|
@ -99,7 +99,7 @@ class Admin::PagesController < ApplicationController
|
||||||
params[:page][:frontend_field_type] = nil
|
params[:page][:frontend_field_type] = nil
|
||||||
|
|
||||||
if @item.update_attributes(params[:page])
|
if @item.update_attributes(params[:page])
|
||||||
flash[:notice] = t('admin.update_success_page')
|
flash[:notice] = t('update.success.page')
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
redirect_to admin_page_url(@item)
|
redirect_to admin_page_url(@item)
|
||||||
|
|
|
@ -1,81 +0,0 @@
|
||||||
class Admin::TranslationsController < ApplicationController
|
|
||||||
|
|
||||||
layout "admin"
|
|
||||||
before_filter :authenticate_user!
|
|
||||||
before_filter :is_admin?
|
|
||||||
|
|
||||||
def index
|
|
||||||
set_variables
|
|
||||||
end
|
|
||||||
|
|
||||||
def edit
|
|
||||||
set_variables
|
|
||||||
end
|
|
||||||
|
|
||||||
# Update either the i18n_variables or the languages
|
|
||||||
def update
|
|
||||||
begin
|
|
||||||
case params[:id]
|
|
||||||
# Update the i18n_variables
|
|
||||||
when 'all'
|
|
||||||
params[:i18n_variables].each do |id, var|
|
|
||||||
i18n_variable = I18nVariable.find(id)
|
|
||||||
i18n_variable.update_attributes(var)
|
|
||||||
end
|
|
||||||
# Add a language
|
|
||||||
when 'add'
|
|
||||||
site = Site.find(session[:site])
|
|
||||||
if !site.valid_locales.include?(params[:language])
|
|
||||||
site.valid_locales << params[:language]
|
|
||||||
site.save
|
|
||||||
I18nVariable.create({:key => params[:language], :document_class => 'language'})
|
|
||||||
end
|
|
||||||
# Enable a language
|
|
||||||
when 'enable'
|
|
||||||
site = Site.find(session[:site])
|
|
||||||
if !site.in_use_locales.include?(params[:enable_language])
|
|
||||||
site.in_use_locales << params[:enable_language]
|
|
||||||
site.save
|
|
||||||
end
|
|
||||||
# Disable a language
|
|
||||||
when 'disable'
|
|
||||||
site = Site.find(session[:site])
|
|
||||||
if site.in_use_locales.include?(params[:disable_language])
|
|
||||||
site.in_use_locales.delete(params[:disable_language])
|
|
||||||
site.save
|
|
||||||
end
|
|
||||||
# Delete a language and the corresponding i18n_variables
|
|
||||||
when 'delete'
|
|
||||||
site = Site.find(session[:site])
|
|
||||||
site.in_use_locales.delete(params[:delete_language])
|
|
||||||
site.valid_locales.delete(params[:delete_language])
|
|
||||||
site.save
|
|
||||||
I18nVariable.destroy_all(:conditions => {:document_class => 'language', :key => params[:delete_language]})
|
|
||||||
end
|
|
||||||
redirect_to admin_translations_url
|
|
||||||
rescue
|
|
||||||
set_variables
|
|
||||||
render :action => :edit
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
# Get the i18n_variables and languages
|
|
||||||
def set_variables
|
|
||||||
@i18n_variables = I18nVariable.all.entries
|
|
||||||
@language_i18n_variables = @i18n_variables.inject([]) do |result, var|
|
|
||||||
result << var if var.document_class.eql?('language')
|
|
||||||
result
|
|
||||||
end
|
|
||||||
@role_i18n_variables = @i18n_variables.inject([]) do |result, var|
|
|
||||||
result << var if var.document_class.eql?('Role')
|
|
||||||
result
|
|
||||||
end
|
|
||||||
@info_i18n_variables = @i18n_variables.inject([]) do |result, var|
|
|
||||||
result << var if var.document_class.eql?('UserInfoModel')
|
|
||||||
result
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -22,7 +22,7 @@ class Admin::UsersController < ApplicationController
|
||||||
puts params.to_yaml
|
puts params.to_yaml
|
||||||
@user = User.new(params[:user])
|
@user = User.new(params[:user])
|
||||||
if @user.save
|
if @user.save
|
||||||
flash[:notice] = t('admin.create_success_user')
|
flash[:notice] = t('create.success.user')
|
||||||
redirect_to :action => :index
|
redirect_to :action => :index
|
||||||
else
|
else
|
||||||
render :action => :new
|
render :action => :new
|
||||||
|
@ -42,10 +42,10 @@ class Admin::UsersController < ApplicationController
|
||||||
@user.avatar = params[:file] if params[:file]
|
@user.avatar = params[:file] if params[:file]
|
||||||
|
|
||||||
if @user.id.to_s.eql?(session['warden.user.user.key'][1].to_s) && @user.admin != params[:user][:admin].to_i.to_b
|
if @user.id.to_s.eql?(session['warden.user.user.key'][1].to_s) && @user.admin != params[:user][:admin].to_i.to_b
|
||||||
flash.now[:error] = t('admin.cant_revoke_self_admin')
|
flash.now[:error] = t(:cant_revoke_self_admin)
|
||||||
end
|
end
|
||||||
if !flash[:error] && @user.update_attributes(params[:user])
|
if !flash[:error] && @user.update_attributes(params[:user])
|
||||||
flash[:notice] = t('admin.update_success_user')
|
flash[:notice] = t('update.success.user')
|
||||||
redirect_to :action => :index
|
redirect_to :action => :index
|
||||||
else
|
else
|
||||||
get_info_and_roles
|
get_info_and_roles
|
||||||
|
@ -55,7 +55,7 @@ class Admin::UsersController < ApplicationController
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
if params[:id].eql?(session['warden.user.user.key'][1].to_s)
|
if params[:id].eql?(session['warden.user.user.key'][1].to_s)
|
||||||
flash[:error] = t('admin.cant_delete_self')
|
flash[:error] = t(:cant_delete_self)
|
||||||
else
|
else
|
||||||
@user = User.find(params[:id])
|
@user = User.find(params[:id])
|
||||||
@user.destroy
|
@user.destroy
|
||||||
|
|
|
@ -33,14 +33,10 @@ class Admin::UsersNewInterfaceController < ApplicationController
|
||||||
@student_data = []
|
@student_data = []
|
||||||
@staff_data = []
|
@staff_data = []
|
||||||
|
|
||||||
|
attribute_values = @user.attribute_values
|
||||||
attribute_values = @user.attribute_values.reject{|att_val|
|
|
||||||
# binding.pry if(att_val.id.to_s == '507fa1295789b52a540000e0')
|
|
||||||
!att_val.attribute_field.locale and (att_val.attribute_field.neutral_for != I18n.locale.to_s)
|
|
||||||
}
|
|
||||||
|
|
||||||
attribute_values.each{|att_val|
|
attribute_values.each{|att_val|
|
||||||
@profile_data.push({:name => att_val.attribute_field.title,:value =>att_val.get_value_by_locale(I18n.locale)}) if att_val.attribute_field.attribute.key=="profile" rescue false
|
binding.pry if att_val.id.to_s == '5052dab52b5c49ae9d000006'
|
||||||
|
@profile_data.push({:name => att_val.attribute_field.title,:value =>att_val.get_value_by_locale(I18n.locale.to_s)}) if att_val.attribute_field.attribute.key=="profile" rescue false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,7 +71,6 @@ class Admin::UsersNewInterfaceController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
binding.pry
|
|
||||||
puts params.to_yaml
|
puts params.to_yaml
|
||||||
# attribute_values_key = params[:user].has_key?('new_attribute_values') ? 'new_attribute_values' : 'attribute_values'
|
# attribute_values_key = params[:user].has_key?('new_attribute_values') ? 'new_attribute_values' : 'attribute_values'
|
||||||
# attribute_values = params[:user].delete(attribute_values_key)
|
# attribute_values = params[:user].delete(attribute_values_key)
|
||||||
|
@ -84,8 +79,9 @@ class Admin::UsersNewInterfaceController < ApplicationController
|
||||||
# @user.attribute_values.build(value)
|
# @user.attribute_values.build(value)
|
||||||
# }
|
# }
|
||||||
# @user.rebuild_sub_roles_from_attribute_values!(attribute_values)
|
# @user.rebuild_sub_roles_from_attribute_values!(attribute_values)
|
||||||
|
binding.pry
|
||||||
if @user.save
|
if @user.save
|
||||||
flash[:notice] = t('admin.create_success_user')
|
flash[:notice] = t('create.success.user')
|
||||||
redirect_to :action => :index
|
redirect_to :action => :index
|
||||||
else
|
else
|
||||||
@form_index = 0
|
@form_index = 0
|
||||||
|
@ -119,10 +115,10 @@ class Admin::UsersNewInterfaceController < ApplicationController
|
||||||
# @user.avatar = params[:file] if params[:file]
|
# @user.avatar = params[:file] if params[:file]
|
||||||
|
|
||||||
# if @user.id.to_s.eql?(session['warden.user.user.key'][1].to_s) && @user.admin != params[:user][:admin].to_i.to_b
|
# if @user.id.to_s.eql?(session['warden.user.user.key'][1].to_s) && @user.admin != params[:user][:admin].to_i.to_b
|
||||||
# flash.now[:error] = t('admin.cant_revoke_self_admin')
|
# flash.now[:error] = t(:cant_revoke_self_admin)
|
||||||
# end
|
# end
|
||||||
# if !flash[:error] && @user.update_attributes(params[:user])
|
# if !flash[:error] && @user.update_attributes(params[:user])
|
||||||
# flash[:notice] = t('admin.update_success_user')
|
# flash[:notice] = t('update.success.user')
|
||||||
# redirect_to :action => :index
|
# redirect_to :action => :index
|
||||||
# else
|
# else
|
||||||
# get_info_and_roles
|
# get_info_and_roles
|
||||||
|
@ -132,7 +128,7 @@ class Admin::UsersNewInterfaceController < ApplicationController
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
if params[:id].eql?(session['warden.user.user.key'][1].to_s)
|
if params[:id].eql?(session['warden.user.user.key'][1].to_s)
|
||||||
flash[:error] = t('admin.cant_delete_self')
|
flash[:error] = t(:cant_delete_self)
|
||||||
else
|
else
|
||||||
@user = User.find(params[:id])
|
@user = User.find(params[:id])
|
||||||
@user.destroy
|
@user.destroy
|
||||||
|
|
|
@ -76,7 +76,7 @@ class ApplicationController < ActionController::Base
|
||||||
if is_admin?
|
if is_admin?
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
flash[:error] = t("admin.access.denied.not_admin")
|
flash[:error] = t("access.denied.not_admin")
|
||||||
auth_failed_in_backend
|
auth_failed_in_backend
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -85,7 +85,7 @@ class ApplicationController < ActionController::Base
|
||||||
if is_manager?
|
if is_manager?
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
flash[:error] = t("admin.access.denied.app.not_manager")
|
flash[:error] = t("access.denied.app.not_manager")
|
||||||
auth_failed_in_backend
|
auth_failed_in_backend
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -94,7 +94,7 @@ class ApplicationController < ActionController::Base
|
||||||
if (@module_app.sub_managing_users.include?(current_or_guest_user) || is_manager?)
|
if (@module_app.sub_managing_users.include?(current_or_guest_user) || is_manager?)
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
flash[:error] = t("admin.access.denied.app.not_sub_manager")
|
flash[:error] = t("access.denied.app.not_sub_manager")
|
||||||
auth_failed_in_backend
|
auth_failed_in_backend
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -103,13 +103,13 @@ class ApplicationController < ActionController::Base
|
||||||
if (@module_app.app_auth.auth_users.include?(current_or_guest_user) || for_app_sub_manager )
|
if (@module_app.app_auth.auth_users.include?(current_or_guest_user) || for_app_sub_manager )
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
flash[:error] = t("admin.access.denied.app.not_authed_user")
|
flash[:error] = t("access.denied.app.not_authed_user")
|
||||||
auth_failed_in_backend
|
auth_failed_in_backend
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_object_premission(obj,title)
|
def check_object_premission(obj,title)
|
||||||
flash[:error] = t("admin.access.denied.object")
|
flash[:error] = t("access.denied.object")
|
||||||
auth_failed_in_backend unless (obj.get_object_auth_by_title(title).auth_users.include?(current_or_guest_user) || is_manager? || is_admin? )
|
auth_failed_in_backend unless (obj.get_object_auth_by_title(title).auth_users.include?(current_or_guest_user) || is_manager? || is_admin? )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -129,7 +129,9 @@ class ApplicationController < ActionController::Base
|
||||||
object_class = params[:model].classify.constantize
|
object_class = params[:model].classify.constantize
|
||||||
@object = object_class.find(params[:id])
|
@object = object_class.find(params[:id])
|
||||||
module_app = ModuleApp.first(:conditions => {:key => params[:key]})
|
module_app = ModuleApp.first(:conditions => {:key => params[:key]})
|
||||||
@item = Item.where(module_app_id: module_app.id).all_of("tag" => {"$in" => [nil,'']},"category" => { "$in" => [nil,'']}).first
|
@item = @object.share_item
|
||||||
|
#@item = Item.where(module_app_id: module_app.id).all_of("tag" => {"$in" => [nil,'']},"category" => { "$in" => [nil,'']}).first
|
||||||
|
#binding.pry
|
||||||
@orig_url = "http://#{request.host_with_port}/#{@item.path}?id=#{@object.id}"
|
@orig_url = "http://#{request.host_with_port}/#{@item.path}?id=#{@object.id}"
|
||||||
render 'shared/render_share', :layout => false
|
render 'shared/render_share', :layout => false
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,17 +27,17 @@ class DesktopController< ApplicationController
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
def settingthemes
|
def themes
|
||||||
@themes = DesktopTheme.all
|
@themes = DesktopTheme.all
|
||||||
# raise @themes.inspect
|
# raise @themes.inspect
|
||||||
render "desktop/settings/themes", :layout => false
|
render "desktop/settings/themes", :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
def settingsections
|
def sections
|
||||||
render "desktop/settings/sections", :layout => false
|
render "desktop/settings/sections", :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
def settingconnection
|
def connections
|
||||||
render "desktop/settings/connections", :layout => false
|
render "desktop/settings/connections", :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -103,11 +103,41 @@ class DesktopController< ApplicationController
|
||||||
def getgroups
|
def getgroups
|
||||||
@section = Section.find(params["sectionid"])
|
@section = Section.find(params["sectionid"])
|
||||||
@groups = @section.groups
|
@groups = @section.groups
|
||||||
a = Array.new
|
|
||||||
|
gr = Array.new
|
||||||
@groups.each do |group|
|
@groups.each do |group|
|
||||||
a << group.tiles
|
a = Array.new
|
||||||
|
t = group.tiles
|
||||||
|
t.each do |tile|
|
||||||
|
data_content = ""
|
||||||
|
jsfile = []
|
||||||
|
cssfile = ""
|
||||||
|
shape = "w1 h1"
|
||||||
|
if tile.data_category == "widget"
|
||||||
|
widge = DesktopWidget.find(tile.desktop_widget_id.to_s)
|
||||||
|
# data_content = widge.widget_layout.file
|
||||||
|
data_content = "/desktop/widget_layout?id="+tile.desktop_widget_id.to_s
|
||||||
|
jsfile = widge.javascripts.collect{|js| js.file}
|
||||||
|
cssfile = widge.css_default.file
|
||||||
|
shape = widge.shape
|
||||||
|
title = widge.name
|
||||||
|
else
|
||||||
|
data_content = tile.data_content
|
||||||
|
title = tile.title
|
||||||
|
end
|
||||||
|
a << {"id"=>tile.id,"data_category"=>tile.data_category,"data_content"=>data_content,"js"=>jsfile,"css"=>cssfile,"shape"=>shape,"position"=>tile.position,"title"=>title}
|
||||||
|
end
|
||||||
|
gr << a
|
||||||
end
|
end
|
||||||
render :json =>a.to_json
|
render :json =>gr.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
def widget_layout
|
||||||
|
widget = DesktopWidget.find(params[:id])
|
||||||
|
link = '<link href="'+widget.css_default.file.to_s+'" media="screen" rel="stylesheet" type="text/css" />'
|
||||||
|
content = widget.widget_layout.body
|
||||||
|
dhtml = link + content
|
||||||
|
render :text => dhtml.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
def getsectionlist
|
def getsectionlist
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
class DesktopWidgetsController < OrbitBackendController
|
||||||
|
require "net/http"
|
||||||
|
require "uri"
|
||||||
|
require 'zip/zip'
|
||||||
|
|
||||||
|
def index
|
||||||
|
end
|
||||||
|
|
||||||
|
def upload
|
||||||
|
if !params[:desktop_widget].nil?
|
||||||
|
temp_file = Tempfile.new("temp_file")
|
||||||
|
original_file = params[:desktop_widget][:package_file]
|
||||||
|
#if original_file.content_type == 'application/zip'
|
||||||
|
temp_file.write(original_file.read.force_encoding('UTF-8'))
|
||||||
|
temp_file.rewind
|
||||||
|
filename = File.basename(original_file.original_filename,".zip")
|
||||||
|
unzip_widget(temp_file, filename)
|
||||||
|
#else
|
||||||
|
# flash[:error] = "Upload file should be in zip format"
|
||||||
|
#end
|
||||||
|
temp_file.close
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def unzip_widget(file, zip_name)
|
||||||
|
Zip::ZipFile.open(file) { |zip_file|
|
||||||
|
dw = DesktopWidget.new.from_json(zip_file.read("#{zip_name}/settings.json"))
|
||||||
|
Dir.mktmpdir('f_path') { |dir|
|
||||||
|
javascripts_entries = []
|
||||||
|
images_entries = []
|
||||||
|
|
||||||
|
zip_file.entries.each do |entry|
|
||||||
|
case (path = entry.to_s)
|
||||||
|
when /\A(#{zip_name})\/(default\.css)\z/
|
||||||
|
#for default css
|
||||||
|
dw.build_css_default(:file => get_temp_file(zip_file, dir, entry))
|
||||||
|
when /\A(#{zip_name})\/(widget\.html)\z/ #for layout html
|
||||||
|
dw.build_widget_layout(:file => get_temp_file(zip_file, dir, entry))
|
||||||
|
when /\A(#{zip_name})\/(javascripts)\/.*(\.js)\z/ #for js
|
||||||
|
javascripts_entries << entry
|
||||||
|
when /\A(#{zip_name})\/(images)\/.*((\.jpg)|(\.png)|(\.gif))\z/ #for img
|
||||||
|
images_entries << entry
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
['javascripts', 'images'].each do |type|
|
||||||
|
eval("#{type}_entries").each do |entry|
|
||||||
|
eval("dw.#{type}").build(:file => get_temp_file(zip_file, dir, entry))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
||||||
|
dw.save
|
||||||
|
}
|
||||||
|
end
|
||||||
|
def get_temp_file(zip_file, dir, entry)
|
||||||
|
filename = File.basename(entry.to_s)
|
||||||
|
temp_file = File.new(dir + '/' + filename, 'w+')
|
||||||
|
temp_file.write (zip_file.read entry ).force_encoding('UTF-8')
|
||||||
|
temp_file
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -1,4 +1,4 @@
|
||||||
class OrbitBackendController< ApplicationController
|
class OrbitBackendController < ApplicationController
|
||||||
#before_filter :setup_vars
|
#before_filter :setup_vars
|
||||||
#before_filter :set_current_user
|
#before_filter :set_current_user
|
||||||
|
|
||||||
|
@ -11,17 +11,15 @@ class OrbitBackendController< ApplicationController
|
||||||
layout 'new_admin'
|
layout 'new_admin'
|
||||||
|
|
||||||
def setup_vars
|
def setup_vars
|
||||||
@app_title = request.fullpath.split('/')[2]
|
@app_title = controller_path.split('/')[1].singularize
|
||||||
@app_title = request.fullpath.split('/')[1] if(@app_title == "back_end")
|
@module_app ||= ModuleApp.first(conditions: {:key => @app_title} )
|
||||||
@app_title.gsub!(/[?].*/,'')
|
|
||||||
@module_app = ModuleApp.first(conditions: {:key => @app_title} )
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def force_order_for_visitor
|
def force_order_for_visitor
|
||||||
setup_vars
|
setup_vars
|
||||||
set_current_user
|
set_current_user
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class OtheraccountsController< ApplicationController
|
class Desktop::OtheraccountsController< ApplicationController
|
||||||
require 'open-uri'
|
require 'open-uri'
|
||||||
require 'rexml/document'
|
require 'rexml/document'
|
||||||
require 'net/http'
|
require 'net/http'
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
class SessionsController < Devise::SessionsController
|
|
||||||
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
|
|
||||||
include Devise::Controllers::InternalHelpers
|
|
||||||
|
|
||||||
# POST /resource/sign_in
|
|
||||||
def create
|
|
||||||
# login_password = params[:user][:password]
|
|
||||||
# login_uid = params[:user][:nccu_ldap_uid]
|
|
||||||
login_password = params[:user][:password]
|
|
||||||
login_email = params[:user][:email]
|
|
||||||
result = false
|
|
||||||
resource = User.first(conditions:{ email: login_email })
|
|
||||||
set_flash_message(:notice, :signed_in) if is_navigational_format?
|
|
||||||
if resource.nil?
|
|
||||||
logger.error "Can't find user #{login_email}"
|
|
||||||
flash[:notice] = t('devise.failure.invalid')
|
|
||||||
render :action => "new"
|
|
||||||
else
|
|
||||||
logger.info "=== passed"
|
|
||||||
resource_name = resource.class.to_s.downcase
|
|
||||||
sign_in(resource_name, resource)
|
|
||||||
respond_with resource, :location => redirect_location(resource_name, resource)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -22,8 +22,8 @@ module Admin::AdBannersHelper
|
||||||
ad_banner.object_auths.new(title: type ).save
|
ad_banner.object_auths.new(title: type ).save
|
||||||
oa = ad_banner.get_object_auth_by_title(type)
|
oa = ad_banner.get_object_auth_by_title(type)
|
||||||
end
|
end
|
||||||
# link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
|
# link_to t(:category_auth), edit_admin_object_auth_path(oa)
|
||||||
link_to t('admin.ad.cate_auth'),admin_object_auth_ob_auth_path(oa),:class => "btn btn-warning"
|
link_to t(:category_auth),admin_object_auth_ob_auth_path(oa),:class => "btn btn-warning"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
module Admin::AttributeValuesViewHelper
|
||||||
|
OPT = [
|
||||||
|
["YYYY / MM / DD hh : mm","format1"],
|
||||||
|
["YYYY / MM / DD","format2"],
|
||||||
|
["YYYY / MM","format3"],
|
||||||
|
["YYYY","format4"]
|
||||||
|
]
|
||||||
|
def show_type_panel(attribute_field,type)
|
||||||
|
markup = attribute_field.markup
|
||||||
|
LIST[:markups][markup]["panel"] == type ? type : [type,'hide'].join(" ")
|
||||||
|
end
|
||||||
|
|
||||||
|
def name_to_id(str)
|
||||||
|
str.gsub(/\]/,'').gsub(/\[/,"_")
|
||||||
|
end
|
||||||
|
end
|
|
@ -15,9 +15,9 @@ module Admin::ItemsHelper
|
||||||
ret << "<div class='with_action'><i class='icons-moves'></i>"
|
ret << "<div class='with_action'><i class='icons-moves'></i>"
|
||||||
ret << (link_to node.title, dest, :class => 'js_history')
|
ret << (link_to node.title, dest, :class => 'js_history')
|
||||||
ret << "<div class='quick-edit hide'>"
|
ret << "<div class='quick-edit hide'>"
|
||||||
ret << (link_to t('admin.edit'), eval("edit_admin_#{node.class.to_s.downcase}_path(node)"), :class => 'js_history') if node.class.to_s.eql?('Page')
|
ret << (link_to t(:edit), eval("edit_admin_#{node.class.to_s.downcase}_path(node)"), :class => 'js_history') if node.class.to_s.eql?('Page')
|
||||||
ret << (link_to t('admin.new_page'), new_admin_page_path(:parent_id => node.id), :class => 'new_page js_history') if node.class.to_s.eql?('Page')
|
ret << (link_to t('new.page'), new_admin_page_path(:parent_id => node.id), :class => 'new_page js_history') if node.class.to_s.eql?('Page')
|
||||||
ret << (link_to t('admin.new_link'), new_admin_link_path(:parent_id => node.id), :class => 'new_link js_history') if node.class.to_s.eql?('Page')
|
ret << (link_to t('new.link'), new_admin_link_path(:parent_id => node.id), :class => 'new_link js_history') if node.class.to_s.eql?('Page')
|
||||||
ret << (link_to t(:delete), eval("delete_admin_#{node.class.to_s.downcase}_path(node, :authenticity_token => form_authenticity_token)"), :confirm => t('sure?'), :class => 'delete js_history')
|
ret << (link_to t(:delete), eval("delete_admin_#{node.class.to_s.downcase}_path(node, :authenticity_token => form_authenticity_token)"), :confirm => t('sure?'), :class => 'delete js_history')
|
||||||
ret << "</div>"
|
ret << "</div>"
|
||||||
ret << "</div>"
|
ret << "</div>"
|
||||||
|
|
|
@ -15,6 +15,6 @@ module Admin::ModuleAppsHelper
|
||||||
|
|
||||||
def get_auth_by(manager_obj)
|
def get_auth_by(manager_obj)
|
||||||
showing_name = manager_obj.rule_creator==current_user ? t('me') : manager_obj.rule_creator.name
|
showing_name = manager_obj.rule_creator==current_user ? t('me') : manager_obj.rule_creator.name
|
||||||
t("admin.user_role.auth.auth_by",:user_display_name => showing_name)
|
t("auth.auth_by",:user_display_name => showing_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
module Admin::WebComponentHelper
|
||||||
|
include ActionView::Helpers::TagHelper
|
||||||
|
|
||||||
|
def alert_block_tag(title="",context="",*args)
|
||||||
|
content_tag(:div,:class=>"alert alert-block alert-error fade in") do
|
||||||
|
a = ActiveSupport::SafeBuffer.new
|
||||||
|
a << button_tag( 'x',:class=>"close",:data=>{:dismiss=>"alert"}) if (args.first[:close] rescue false)
|
||||||
|
a << content_tag(:h4,:class=>"alert-heading") do
|
||||||
|
title
|
||||||
|
end
|
||||||
|
a << content_tag(:p) do
|
||||||
|
context
|
||||||
|
end
|
||||||
|
# TODO : 可以提供更多功能
|
||||||
|
# a << content_tag(:p) do
|
||||||
|
# b = link_to("Take this action","",:class=>"btn btn-danger")
|
||||||
|
# b << link_to("Or do this","",:class=>"btn")
|
||||||
|
# b
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
|
@ -262,11 +262,15 @@ module ApplicationHelper
|
||||||
js << "<meta property='og:description' content='#{object.subtitle}' />\n" rescue ''
|
js << "<meta property='og:description' content='#{object.subtitle}' />\n" rescue ''
|
||||||
js << "<meta property='og:image' content='#{object.image.url}' />\n" rescue ''
|
js << "<meta property='og:image' content='#{object.image.url}' />\n" rescue ''
|
||||||
content_tag :div, :class => 'fb' do
|
content_tag :div, :class => 'fb' do
|
||||||
concat social_share_button_tag(object.title, :fb_url => "http://#{request.env['HTTP_HOST']}/share/#{object.class.to_s.underscore}/#{object.id}?key=#{key}", :image => "http://#{request.env['HTTP_HOST']}#{object.image.url}")
|
concat social_share_button_tag(object.title, :fb_url => generate_fb_url(object,key), :image => "http://#{request.env['HTTP_HOST']}#{object.image.url}")
|
||||||
# concat javascript_tag "$('head').append('#{j js}');"
|
# concat javascript_tag "$('head').append('#{j js}');"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def generate_fb_url(object,key)
|
||||||
|
"http://#{request.env['HTTP_HOST']}/share/#{object.class.to_s.underscore}/#{object.id}?key=#{key}"
|
||||||
|
end
|
||||||
|
|
||||||
def wrap_string_with(str,options={})
|
def wrap_string_with(str,options={})
|
||||||
line_width = options[:line_width] || 12
|
line_width = options[:line_width] || 12
|
||||||
wrap_mark = options[:wrap_mark] || "<br />"
|
wrap_mark = options[:wrap_mark] || "<br />"
|
||||||
|
|
|
@ -9,14 +9,18 @@ module AttributeFieldsHelper
|
||||||
include ActionView::Helpers::RenderingHelper
|
include ActionView::Helpers::RenderingHelper
|
||||||
|
|
||||||
def block_helper(user,index,disable = false)
|
def block_helper(user,index,disable = false)
|
||||||
@index = index
|
unless self.disabled
|
||||||
@markup_options = markup_options.merge(:disabled=>disable)
|
@index = index
|
||||||
@user = user
|
@markup_options = markup_options.merge(:disabled=>disable,:func=>"input_unit")
|
||||||
@attribute_value = @user.get_value_from_field_id(id)
|
@user = user
|
||||||
@new_attribute = @attribute_value.nil?
|
@attribute_value = @user.get_value_from_field_id(id)
|
||||||
@attribute_value = @attribute_value || @user.attribute_values.build(attribute_field_id: id)
|
@new_attribute = @attribute_value.nil?
|
||||||
@prefiled_value = @attribute_value.get_values
|
@attribute_value = @attribute_value || @user.attribute_values.build( attribute_field_id: id )
|
||||||
return instance_eval("render_#{markup}") #rescue ""
|
@prefiled_value = @attribute_value.value
|
||||||
|
@panel_setting = self.get_data
|
||||||
|
return instance_eval("render_#{markup}") #rescue ""
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def lang_tab(str,lang)
|
def lang_tab(str,lang)
|
||||||
|
@ -24,6 +28,7 @@ module AttributeFieldsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_address
|
def render_address
|
||||||
|
#NP
|
||||||
control_group_wrapper do |key,value|
|
control_group_wrapper do |key,value|
|
||||||
result = '<div class="input-append">'.html_safe
|
result = '<div class="input-append">'.html_safe
|
||||||
|
|
||||||
|
@ -44,17 +49,26 @@ module AttributeFieldsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_checkbox
|
def render_checkbox
|
||||||
|
|
||||||
@prefiled_value ||=[]
|
@prefiled_value ||=[]
|
||||||
markup_value = eval(self.markup_value) rescue {}
|
# begin
|
||||||
|
# markup_value = eval(self.markup_value)
|
||||||
|
# rescue
|
||||||
|
# markup_value = self.markup_value
|
||||||
|
# ensure
|
||||||
|
# markup_value ||= {}
|
||||||
|
# end
|
||||||
|
|
||||||
control_group_wrapper do
|
control_group_wrapper do
|
||||||
markup_value.collect do |key,value|
|
a = self[:option_list].collect do |key,value|
|
||||||
label_tag(key,check_box_tag(get_field_name_base+"[value][#{key}]", value[I18n.locale.to_s], (@prefiled_value.include?(key) ? true : false), {})+value[I18n.locale.to_s],@markup_options.merge(:class=>"control-label"))
|
label_tag(key,check_box_tag(get_field_name_base+"[#{key}]", true , (@prefiled_value.include?(key) ? true : false), {})+value[I18n.locale.to_s],@markup_options.merge(:class=>"control-label"))
|
||||||
end.join rescue ""
|
end.join rescue ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_date
|
def render_date
|
||||||
control_group_wrapper{date_select(get_field_name_base+"[value]",nil,@markup_options.merge(:default=>@prefiled_value),:class=>"input-small")}
|
#NP
|
||||||
|
control_group_wrapper{date_select(get_field_name_base,nil,@markup_options.merge(:default=>@prefiled_value),:class=>"input-small")}
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_date_durnation #Need re-write low priority
|
def render_date_durnation #Need re-write low priority
|
||||||
|
@ -63,17 +77,27 @@ module AttributeFieldsHelper
|
||||||
|
|
||||||
def render_radio_button
|
def render_radio_button
|
||||||
@prefiled_value ||=[]
|
@prefiled_value ||=[]
|
||||||
markup_value = eval(self.markup_value) rescue {}
|
# begin
|
||||||
|
# markup_value = eval(self.markup_value)
|
||||||
|
# rescue
|
||||||
|
# markup_value = self.markup_value
|
||||||
|
# ensure
|
||||||
|
# markup_value ||= {}
|
||||||
|
# end
|
||||||
control_group_wrapper do
|
control_group_wrapper do
|
||||||
markup_value.collect do |key,value|
|
self[:option_list].collect do |key,value|
|
||||||
label_tag(key,radio_button_tag(get_field_name_base+"[value][#{key}]", value[I18n.locale.to_s], (@prefiled_value.include?(key) ? true : false), {})+value[I18n.locale.to_s],@markup_options.merge(:class=>"control-label"))
|
label_tag(key,radio_button_tag(get_field_name_base, key , (@prefiled_value.include?(key) ? true : false), {})+value[I18n.locale.to_s],@markup_options.merge(:class=>"control-label"))
|
||||||
end.join rescue ""
|
end.join
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_select
|
def render_select
|
||||||
markup_value = (self.markup_value.is_a?(Hash) ? self.markup_value : eval(self.markup_value) )rescue {}
|
|
||||||
control_group_wrapper{select_tag( get_field_name_base+"[value]",options_for_select(markup_value.collect{|p| [p[1][I18n.locale.to_s],p[0]]},@prefiled_value),@markup_options)} rescue ""
|
prompt = @panel_setting[:prompt][I18n.locale] rescue nil
|
||||||
|
@markup_options.merge!(:prompt => prompt) unless prompt.nil?
|
||||||
|
# markup_value = (self.markup_value.is_a?(Hash) ? self.markup_value : eval(self.markup_value) )rescue {}
|
||||||
|
# check self[:option_list].collect{|p| [p[1][I18n.locale.to_s],p[0]]}
|
||||||
|
control_group_wrapper{select_tag( get_field_name_base,options_for_select(self.option_list.collect{|p| [p[1][I18n.locale.to_s],p[0]]},@prefiled_value),@markup_options)} rescue ""
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_text_area
|
def render_text_area
|
||||||
|
@ -81,28 +105,35 @@ module AttributeFieldsHelper
|
||||||
if(add_more and value.is_a?(Hash))
|
if(add_more and value.is_a?(Hash))
|
||||||
values = value
|
values = value
|
||||||
values.each_with_index.collect do |value,index|
|
values.each_with_index.collect do |value,index|
|
||||||
text_area_tag(get_field_name_base + (key.nil? ? '' : "[#{key}][#{index}]"), value.last,@markup_options)
|
place_holder= @panel_setting["placeholder"][key]
|
||||||
|
text_area_tag(get_field_name_base + (key.nil? ? '' : "[#{key}][#{index}]"), value.last,@markup_options.merge(:placeholder=>place_holder))
|
||||||
end.join.html_safe
|
end.join.html_safe
|
||||||
else
|
else
|
||||||
value = can_muti_lang_input ? @prefiled_value[key] : @prefiled_value
|
value = can_muti_lang_input ? @prefiled_value[key] : @prefiled_value
|
||||||
key = can_muti_lang_input ? "[#{key}]" : "[value]"
|
key = can_muti_lang_input ? "[#{key}]" : ""
|
||||||
text_area_tag(get_field_name_base + key, value,@markup_options)
|
place_holder= @panel_setting["placeholder"][I18n.locale.to_s] rescue ''
|
||||||
|
text_area_tag(get_field_name_base + key, value,@markup_options.merge(:placeholder=>place_holder))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_text_field
|
def render_text_field
|
||||||
control_group_wrapper do |key,value|
|
control_group_wrapper do |key,value|
|
||||||
if(add_more and value.is_a?(Hash))
|
if(add_more)
|
||||||
values = value
|
values = value
|
||||||
values.each_with_index.collect do |value,index|
|
result = ""
|
||||||
|
unless values.nil?
|
||||||
text_field_tag(get_field_name_base + (key.nil? ? '' : "[#{key}][#{index}]"), value.last,@markup_options)
|
result = values.each_with_index.collect do |value,index|
|
||||||
end.join.html_safe
|
place_holder= @panel_setting["placeholder"][key]
|
||||||
|
text_field_tag(get_field_name_base + (key.nil? ? '' : "[#{key}][#{index}]"), value.last,@markup_options.merge(:placeholder=>place_holder))
|
||||||
|
end.join.html_safe
|
||||||
|
end
|
||||||
|
result
|
||||||
else
|
else
|
||||||
value = can_muti_lang_input ? @prefiled_value[key] : @prefiled_value
|
value = (can_muti_lang_input ? @prefiled_value[key] : @prefiled_value) rescue nil
|
||||||
key = can_muti_lang_input ? "[#{key}]" : "[value]"
|
key_field = can_muti_lang_input ? "[#{key}]" : ""
|
||||||
text_field_tag(get_field_name_base + key, value,@markup_options)
|
place_holder= @panel_setting["placeholder"][key] rescue ''
|
||||||
|
text_field_tag(get_field_name_base + key_field, value,@markup_options.merge(:placeholder=>place_holder))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -121,16 +152,18 @@ protected
|
||||||
if can_muti_lang_input
|
if can_muti_lang_input
|
||||||
result << "<div class='tabbable'>"
|
result << "<div class='tabbable'>"
|
||||||
result << "<div class='tab-content'>"
|
result << "<div class='tab-content'>"
|
||||||
|
|
||||||
VALID_LOCALES.collect do |key|
|
VALID_LOCALES.collect do |key|
|
||||||
value = @prefiled_value[key.to_s] rescue nil
|
value = @prefiled_value[key.to_s] rescue nil
|
||||||
div_class = ["tab-pane" ,"fade"].join(" ")
|
div_class = ["tab-pane" ,"fade"].join(" ")
|
||||||
div_class << (key == I18n.locale.to_s ? " active in" : '')
|
div_class << (key == I18n.locale.to_s ? " active in" : '')
|
||||||
result << content_tag(:div,yield(key,value),:class=>div_class,:id=>"tab"+id.to_s+"_#{key}")
|
result << content_tag(:div,yield(key,value),:class=>div_class,:id=>"tab"+id.to_s+"_#{key}")
|
||||||
end
|
end
|
||||||
|
|
||||||
result << "</div>"
|
result << "</div>"
|
||||||
result << "<ul class='nav nav-pills'>"
|
result << "<ul class='nav nav-pills'>"
|
||||||
VALID_LOCALES.each do |key|
|
VALID_LOCALES.each do |key|
|
||||||
result << content_tag(:li,link_to(I18n.t("langs."+key),"#tab"+id.to_s+"_#{key}",:data=>{:toggle=>"tab"}),:class=>(key == I18n.locale.to_s ? "active" : nil))
|
result << content_tag(:li,link_to(t(:_locale, :locale => key),"#tab"+id.to_s+"_#{key}",:data=>{:toggle=>"tab"}),:class=>(key == I18n.locale.to_s ? "active" : nil))
|
||||||
end
|
end
|
||||||
result << "</ul>"
|
result << "</ul>"
|
||||||
result << "</div>"
|
result << "</div>"
|
||||||
|
@ -161,15 +194,13 @@ protected
|
||||||
|
|
||||||
def end_block
|
def end_block
|
||||||
if @new_attribute
|
if @new_attribute
|
||||||
hidden_field_tag(get_field_name_base+"[attribute_field_id]",id,:for=>"field_#{@index}")
|
hidden_field_tag(get_basic_field_name_base+"[attribute_field_id]",id,:for=>"field_#{@index}")
|
||||||
else
|
else
|
||||||
hidden_field_tag(get_field_name_base+"[id]",@attribute_value.id,:for=>"field_#{@index}")
|
hidden_field_tag(get_basic_field_name_base+"[id]",@attribute_value.id,:for=>"field_#{@index}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_field_name_base
|
def get_basic_field_name_base
|
||||||
# "user[#{self.attribute._type.downcase.pluralize}][#{self.attribute._id.to_s}][attribute_values][#{attribute_value.id}]"
|
|
||||||
# binding.pry if @attribute_value[:key] == 'status'
|
|
||||||
if @new_attribute
|
if @new_attribute
|
||||||
"user[new_attribute_values][#{@index}]"
|
"user[new_attribute_values][#{@index}]"
|
||||||
else
|
else
|
||||||
|
@ -177,12 +208,16 @@ protected
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_field_name_base
|
||||||
|
get_basic_field_name_base + "[value]"
|
||||||
|
end
|
||||||
|
|
||||||
def label
|
def label
|
||||||
label_tag(key,title,:class=>"control-label")
|
label_tag(key,title,:class=>"control-label",:func => "field_label")
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_muti_lang_input
|
def can_muti_lang_input
|
||||||
locale and LIST[:markups][markup]["muti_lang_input_supprt"]
|
LIST[:markups][markup]["muti_lang_input_supprt"] #and locale
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_add_more
|
def can_add_more
|
||||||
|
|
|
@ -45,7 +45,7 @@ module OrbitBackendHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_toggle_archive_btn(object)
|
def show_toggle_archive_btn(object)
|
||||||
object.disable ? t("object_disable.change_to_false") : t("object_disable.change_to_true")
|
object.disable ? t(:disable) : t(:enable)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -16,6 +16,6 @@ end
|
||||||
|
|
||||||
# FileUtils.mv(temp_file, File.join(Rails.root, 'public/static', 'nccu_calendar.xml'))
|
# FileUtils.mv(temp_file, File.join(Rails.root, 'public/static', 'nccu_calendar.xml'))
|
||||||
|
|
||||||
puts "[#{ DateTime.now.strftime("%Y %D %H:%M")}]NccuCalendar Synced"
|
puts "[#{ DateTime.now.strftime("%Y %D %H:%M")}]NccuCalendar Synced #{File.join(Rails.root, 'public/static', 'nccu_calendar.xml')}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,9 +2,9 @@ class AppManager
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
belongs_to :user
|
belongs_to :user,index: true
|
||||||
|
|
||||||
belongs_to :managing_app, :polymorphic => true #,:class_name => 'ModuleApp',:inverse_of => :managers,:foreign_key => "user_id"
|
belongs_to :managing_app, :polymorphic => true,index: true #,:class_name => 'ModuleApp',:inverse_of => :managers,:foreign_key => "user_id"
|
||||||
belongs_to :sub_managing_app, :polymorphic => true #,:class_name => 'ModuleApp',:inverse_of => :sub_manager,:foreign_key => "sub_user_id"
|
belongs_to :sub_managing_app, :polymorphic => true #,:class_name => 'ModuleApp',:inverse_of => :sub_manager,:foreign_key => "sub_user_id"
|
||||||
|
|
||||||
belongs_to :rule_creator,:class_name => 'User'
|
belongs_to :rule_creator,:class_name => 'User'
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
class CssDefault < Stylesheet
|
class CssDefault < Stylesheet
|
||||||
|
|
||||||
belongs_to :design
|
# belongs_to :design
|
||||||
|
# belongs_to :desktop_widget
|
||||||
|
|
||||||
|
belongs_to :css, polymorphic: true
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,13 +8,13 @@ class Design
|
||||||
field :title, :type => String
|
field :title, :type => String
|
||||||
field :version, :type => String
|
field :version, :type => String
|
||||||
|
|
||||||
has_one :css_default, :autosave => true, :dependent => :destroy
|
has_one :css_default, as: :css, :autosave => true, :dependent => :destroy
|
||||||
has_one :layout, :autosave => true, :dependent => :destroy
|
has_one :layout, :autosave => true, :dependent => :destroy
|
||||||
has_one :css_reset, :autosave => true, :dependent => :destroy
|
has_one :css_reset, :autosave => true, :dependent => :destroy
|
||||||
has_many :images, :autosave => true, :dependent => :destroy
|
has_many :images,as: :imgs, :autosave => true, :dependent => :destroy
|
||||||
has_many :javascripts, :autosave => true, :dependent => :destroy
|
has_many :javascripts, as: :js, :autosave => true, :dependent => :destroy
|
||||||
has_many :pages
|
has_many :pages
|
||||||
has_many :themes, :autosave => true, :dependent => :destroy
|
has_many :themes, as: :css, :autosave => true, :dependent => :destroy
|
||||||
|
|
||||||
accepts_nested_attributes_for :images, :allow_destroy => true
|
accepts_nested_attributes_for :images, :allow_destroy => true
|
||||||
accepts_nested_attributes_for :javascripts, :allow_destroy => true
|
accepts_nested_attributes_for :javascripts, :allow_destroy => true
|
||||||
|
|
|
@ -10,7 +10,10 @@ class Image
|
||||||
|
|
||||||
mount_uploader :file, ImageUploader
|
mount_uploader :file, ImageUploader
|
||||||
|
|
||||||
belongs_to :design
|
# belongs_to :design
|
||||||
|
# belongs_to :desktop_widget
|
||||||
|
|
||||||
|
belongs_to :imgs, polymorphic: true
|
||||||
|
|
||||||
before_save :set_name
|
before_save :set_name
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
class Javascript < DesignFile
|
class Javascript < DesignFile
|
||||||
belongs_to :design
|
# belongs_to :design
|
||||||
|
# belongs_to :desktop_widget
|
||||||
|
|
||||||
|
belongs_to :js, polymorphic: true
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,23 +1,27 @@
|
||||||
class Stylesheet < DesignFile
|
class Stylesheet < DesignFile
|
||||||
belongs_to :design
|
# belongs_to :design
|
||||||
mount_uploader :file_orig, AssetUploader
|
mount_uploader :file_orig, AssetUploader
|
||||||
|
|
||||||
def parse_urls
|
def parse_urls
|
||||||
orig_content = content = self.file.read.force_encoding("UTF-8")
|
orig_content = content = self.file.read.force_encoding("UTF-8")
|
||||||
# self.remove_file!
|
# self.remove_file!
|
||||||
# self.remove_file_orig!
|
# self.remove_file_orig!
|
||||||
names = []
|
names = {}
|
||||||
images = self.design.images
|
images = self.css.images
|
||||||
content.scan(/(?<=url)(.*?)(?=\))/){
|
content.scan(/(?<=url)(.*?)(?=\))/){
|
||||||
css_name = $1.gsub(' ','').gsub('(','')
|
css_name = $1.gsub(' ','').gsub('(','')
|
||||||
name = File.basename(css_name).gsub(/[\\\"]/, '')
|
unless names.has_key?(css_name)
|
||||||
image = images.detect{ |i| i.file_identifier.eql?(name) } rescue nil
|
name = File.basename(css_name).gsub(/[\\\"]/, '')
|
||||||
image.update_attribute(:in_css, true) if image
|
image = images.detect{ |i| i.file_identifier.eql?(name) } rescue nil
|
||||||
file_name = image.file_url rescue nil
|
if image
|
||||||
names << [css_name, file_name]
|
image.update_attribute(:in_css, true)
|
||||||
|
file_name = image.file_url
|
||||||
|
names.merge!({css_name => file_name})
|
||||||
|
end
|
||||||
|
end
|
||||||
}
|
}
|
||||||
names.each do |name|
|
names.each_pair do |key, value|
|
||||||
content.gsub!(name[0], name[1]) if name[1]
|
content.gsub!(key, value)
|
||||||
end
|
end
|
||||||
Dir.mktmpdir('f_path') { |dir|
|
Dir.mktmpdir('f_path') { |dir|
|
||||||
orig_file_name = self.file_identifier
|
orig_file_name = self.file_identifier
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class Theme < Stylesheet
|
class Theme < Stylesheet
|
||||||
|
|
||||||
belongs_to :design
|
belongs_to :css, polymorphic: true
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,15 @@ class Desktop
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
field :theme, default: "4f8d3f493b67fcd05f086359"
|
field :theme, default: "4f8d3f533b67fcd05f08635a"
|
||||||
field :customtheme
|
field :customtheme
|
||||||
field :wallpaper
|
field :wallpaper
|
||||||
|
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
has_and_belongs_to_many :desktop_widgets, :autosave => true
|
||||||
|
|
||||||
has_many :sections, :autosave => true, :dependent => :destroy
|
has_many :sections, :autosave => true, :dependent => :destroy
|
||||||
has_many :desktop_widgets, :autosave => true, :dependent => :destroy
|
# has_many :desktop_widgets, :autosave => true, :dependent => :destroy
|
||||||
|
|
||||||
before_create :initialize_section
|
before_create :initialize_section
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
class DesktopWidget
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
include ParserLayoutWidget
|
||||||
|
|
||||||
|
field :name
|
||||||
|
field :author
|
||||||
|
field :shape
|
||||||
|
field :version, :type => String
|
||||||
|
|
||||||
|
has_one :css_default, as: :css, :autosave => true, :dependent => :destroy
|
||||||
|
has_one :widget_layout, :autosave => true, :dependent => :destroy
|
||||||
|
has_many :images, as: :imgs, :autosave => true, :dependent => :destroy
|
||||||
|
has_many :javascripts, as: :js, :autosave => true, :dependent => :destroy
|
||||||
|
has_and_belongs_to_many :desktops, :autosave => true
|
||||||
|
belongs_to :tiles, :autosave => true
|
||||||
|
|
||||||
|
accepts_nested_attributes_for :images, :allow_destroy => true
|
||||||
|
accepts_nested_attributes_for :javascripts, :allow_destroy => true
|
||||||
|
|
||||||
|
after_save :parse_css_for_images
|
||||||
|
|
||||||
|
# belongs_to :desktop
|
||||||
|
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def parse_css_for_images
|
||||||
|
self.css_default.parse_urls
|
||||||
|
parse_widget_for_images(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,18 @@
|
||||||
|
class Group
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
belongs_to :section
|
||||||
|
has_many :tiles, :autosave => true, :dependent => :destroy
|
||||||
|
before_create :initialize_tile
|
||||||
|
|
||||||
|
def initialize_tile
|
||||||
|
self.tiles.build(data_category: "app", data_content: "quotes", position: 5, shape: "w1 h1", title: "Quotes")
|
||||||
|
self.tiles.build(data_category: "app", data_content: "dailyenglish", position: 6, shape: "w1 h1", title: "Daily English Word")
|
||||||
|
widgets = self.section.desktop.desktop_widgets.collect{|widget| widget.id}
|
||||||
|
for i in 0..3
|
||||||
|
self.tiles.build(data_category: "widget", position: i+1,desktop_widget_id: widgets[i])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -9,6 +9,6 @@ class Tile
|
||||||
field :title
|
field :title
|
||||||
|
|
||||||
belongs_to :group
|
belongs_to :group
|
||||||
|
has_one :desktop_widget
|
||||||
|
|
||||||
end
|
end
|
|
@ -0,0 +1,18 @@
|
||||||
|
class WidgetLayout < DesignFile
|
||||||
|
|
||||||
|
attr_reader :content
|
||||||
|
|
||||||
|
field :body
|
||||||
|
|
||||||
|
belongs_to :desktop_widget
|
||||||
|
|
||||||
|
|
||||||
|
def content
|
||||||
|
self.file.read.force_encoding("UTF-8") rescue ''
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.exist_one?
|
||||||
|
WidgetLayout.count > 0
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -1,13 +0,0 @@
|
||||||
class DesktopWidget
|
|
||||||
include Mongoid::Document
|
|
||||||
include Mongoid::Timestamps
|
|
||||||
|
|
||||||
field :name
|
|
||||||
field :author
|
|
||||||
field :shape
|
|
||||||
field :desktop_id
|
|
||||||
field :status
|
|
||||||
field :section
|
|
||||||
|
|
||||||
belongs_to :desktop
|
|
||||||
end
|
|
|
@ -1,19 +0,0 @@
|
||||||
class Group
|
|
||||||
include Mongoid::Document
|
|
||||||
include Mongoid::Timestamps
|
|
||||||
|
|
||||||
belongs_to :section
|
|
||||||
has_many :tiles, :autosave => true, :dependent => :destroy
|
|
||||||
before_create :initialize_tile
|
|
||||||
|
|
||||||
def initialize_tile
|
|
||||||
self.tiles.build(data_category: "widget", data_content: "timetable", position: 1, shape: "w2 h2", title: "Tiime Table")
|
|
||||||
self.tiles.build(data_category: "app", data_content: "quotes", position: 2, shape: "w1 h1", title: "Quotes")
|
|
||||||
self.tiles.build(data_category: "widget", data_content: "weather", position: 3, shape: "w2 h2", title: "Weather")
|
|
||||||
self.tiles.build(data_category: "widget", data_content: "clock", position: 4, shape: "w2 h1", title: "Clock")
|
|
||||||
self.tiles.build(data_category: "app", data_content: "dailyenglish", position: 5, shape: "w1 h1", title: "Daily English Word")
|
|
||||||
self.tiles.build(data_category: "widget", data_content: "school_events", position: 6, shape: "w2 h1", title: "School Events")
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ class ModuleApp
|
||||||
def assign_manager(user,assigner)
|
def assign_manager(user,assigner)
|
||||||
manager = AppManager.first(conditions: {managing_app_id: self.id,user_id: user.id}) rescue nil
|
manager = AppManager.first(conditions: {managing_app_id: self.id,user_id: user.id}) rescue nil
|
||||||
if manager.nil?
|
if manager.nil?
|
||||||
manager = self.managers.create(:user => user,:rule_creator => assigner)
|
manager = self.managers.create(:user_id => user.id,:rule_creator_id => (assigner.id rescue nil))
|
||||||
end
|
end
|
||||||
manager
|
manager
|
||||||
end
|
end
|
||||||
|
@ -56,7 +56,7 @@ class ModuleApp
|
||||||
def assign_sub_manager(user,assigner)
|
def assign_sub_manager(user,assigner)
|
||||||
submanager = AppManager.first(conditions: {sub_managing_app_id: self.id,user_id: user.id}) rescue nil
|
submanager = AppManager.first(conditions: {sub_managing_app_id: self.id,user_id: user.id}) rescue nil
|
||||||
if submanager.nil? && !self.managing_users.include?(user)
|
if submanager.nil? && !self.managing_users.include?(user)
|
||||||
submanager = self.sub_managers.create(:user => user,:rule_creator => assigner)
|
submanager = self.sub_managers.create(:user_id => user.id,:rule_creator_id => (assigner.id rescue nil) )
|
||||||
end
|
end
|
||||||
submanager
|
submanager
|
||||||
end
|
end
|
||||||
|
@ -82,7 +82,7 @@ class ModuleApp
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def set_key
|
def set_key
|
||||||
self.key = self.title.underscore if self.title
|
self.key = self.title.underscore.singularize if self.title
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,23 +2,28 @@ class ObjectAuth < PrototypeAuth
|
||||||
include OrbitCoreLib::ObjectTokenUnility
|
include OrbitCoreLib::ObjectTokenUnility
|
||||||
validates_uniqueness_of :title ,:scope => [:obj_authable_type,:obj_authable_id] #{ |c| }
|
validates_uniqueness_of :title ,:scope => [:obj_authable_type,:obj_authable_id] #{ |c| }
|
||||||
belongs_to :obj_authable, polymorphic: true
|
belongs_to :obj_authable, polymorphic: true
|
||||||
after_save :check_user_has_app_auth
|
after_save :check_user_has_can_access_app
|
||||||
# > - Something.find_with_auth(query)
|
# > - Something.find_with_auth(query)
|
||||||
# > - or Something.find(query).auth
|
# > - or Something.find(query).auth
|
||||||
|
def siblings
|
||||||
|
ObjectAuth.where({obj_authable_type: obj_authable_type,title: title})
|
||||||
|
end
|
||||||
|
|
||||||
def auth_obj
|
def auth_obj
|
||||||
class_obj = eval(self.obj_authable_type)
|
class_obj = eval(self.obj_authable_type)
|
||||||
class_obj.find self.obj_authable_id
|
class_obj.find self.obj_authable_id
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_user_has_app_auth
|
def check_user_has_can_access_app
|
||||||
sub_managing_users = auth_obj.app_auth.sub_managing_users rescue []
|
sub_managing_users = auth_obj.module_app.sub_managing_users rescue []
|
||||||
app_auth = auth_obj.app_auth
|
module_app = auth_obj.module_app
|
||||||
self.auth_users.each do |auth_user|
|
self.auth_users.each do |auth_user|
|
||||||
if !sub_managing_users.include? auth_user && !auth_user.admin?
|
if !sub_managing_users.include? auth_user && !auth_user.admin?
|
||||||
app_auth.assign_sub_manager(auth_user,User.current)
|
module_app.assign_sub_manager(auth_user,User.current)
|
||||||
app_auth.save!
|
module_app.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -0,0 +1,110 @@
|
||||||
|
class Preview
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
# field :object_f, :type => Hash
|
||||||
|
field :object, :type=> Hash
|
||||||
|
field :preview_at_link
|
||||||
|
field :expired_at , :type => DateTime
|
||||||
|
field :link_args, :type => Array
|
||||||
|
field :object_class_type
|
||||||
|
|
||||||
|
has_many :preview_files, :autosave => true, :dependent => :destroy
|
||||||
|
has_many :preview_associations, :autosave => true, :dependent => :destroy
|
||||||
|
# def object=(params)
|
||||||
|
# save_upload_temp_link(params,"news_bulletin_files_attributes") #unless params[]
|
||||||
|
# self.object_f = params
|
||||||
|
# end
|
||||||
|
|
||||||
|
# def object
|
||||||
|
# return object_f
|
||||||
|
# end
|
||||||
|
|
||||||
|
# def save_upload_temp_link(params,field_name = "bulletin_files_attributes")
|
||||||
|
# image = preview_files.build(:file=>params[:image])
|
||||||
|
# params[:image] = image.id
|
||||||
|
|
||||||
|
# params[field_name].each_with_index do |item,index|
|
||||||
|
# bfa = preview_files.build(:file=>params[field_name][index.to_s][:file])
|
||||||
|
# params[field_name][index.to_s] = bfa.id
|
||||||
|
# end unless params[field_name].nil?
|
||||||
|
# end
|
||||||
|
|
||||||
|
# def dig_in_hash(hash,paths_ary)
|
||||||
|
# hash.each_pair do |key,in_hash|
|
||||||
|
# if in_hash.kind_of? Array
|
||||||
|
# dig_in_array(hash,paths_ary)
|
||||||
|
# elsif in_hash.kind_of? Hash
|
||||||
|
# dig_in_hash(hash,paths_ary)
|
||||||
|
# else
|
||||||
|
# puts("\n End Node: \t #{paths_ary.join } #{in_hash.class} : #{key}##{in_hash}")
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
# def dig_in_array(array,paths_ary)
|
||||||
|
# array.each do |item|
|
||||||
|
# if item.kind_of? Array
|
||||||
|
# dig_in_array(hash,paths_ary)
|
||||||
|
# elsif item.kind_of? Hash
|
||||||
|
# dig_in_hash(hash,paths_ary)
|
||||||
|
# else
|
||||||
|
# puts("\n End Node: \t #{paths_ary.join } #{item.class} : {item}")
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
|
||||||
|
# def dig_in_hash_old(hash,paths_ary)
|
||||||
|
# hash.each_pair do |k,in_hash|
|
||||||
|
# if (!in_hash.kind_of? Array and !in_hash.kind_of? Hash)
|
||||||
|
# #p "UploadedFile : #{in_hash.is_a? ActionDispatch::Http::UploadedFile}"
|
||||||
|
# #in_hash = "no file" if in_hash.is_a? ActionDispatch::Http::UploadedFile
|
||||||
|
# #in_hash.select{|key,hash| hash.is_a? ActionDispatch::Http::UploadedFile}
|
||||||
|
# puts("\n End Node:# \n")
|
||||||
|
# p "#{paths_ary.join } #{in_hash.class} : #{in_hash}"
|
||||||
|
# #p "UploadedFile(#{in_hash}) : #{in_hash.is_a? ActionDispatch::Http::UploadedFile}"
|
||||||
|
# else
|
||||||
|
# if (!in_hash.first.kind_of? Array and !in_hash.first.kind_of? Hash)
|
||||||
|
# paths_ary << "[#{in_hash.first}]"
|
||||||
|
# end
|
||||||
|
# puts("\n Go Down [#{in_hash.first}]\n")
|
||||||
|
# dig_in_hash(in_hash,paths_ary)
|
||||||
|
# puts("\n Go Out \n")
|
||||||
|
# end
|
||||||
|
# puts "This is last"
|
||||||
|
# paths_ary.pop
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
def get_arg_hash
|
||||||
|
object.slice(*link_args).inject({}){|la,(k,v)| la[k.to_sym] = v; la}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_preview_link
|
||||||
|
ap = Rails.application.routes.url_helpers
|
||||||
|
ap.send preview_at_link,({:id=>id,:preview=>true}.merge get_arg_hash)
|
||||||
|
#func = eval("Rails.application.routes.url_helpers.#{preview_at_link}").send
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_virtual_object
|
||||||
|
virtual_object = eval(self.object_class_type).new object
|
||||||
|
preview_files.each do |file|
|
||||||
|
if file.file_in_array
|
||||||
|
eval("virtual_object.#{file.field_name_for_rebuild}.build :file=>file.file")
|
||||||
|
else
|
||||||
|
eval("virtual_object.#{file.field_name_for_rebuild} = file.file")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
preview_associations.each do |local_object|
|
||||||
|
if local_object.object_in_array
|
||||||
|
eval("virtual_object.#{local_object.field_name_for_rebuild}.build local_object.object")
|
||||||
|
else
|
||||||
|
eval("virtual_object.#{local_object.field_name_for_rebuild} = local_object.object")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
virtual_object
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,16 @@
|
||||||
|
class PreviewAssociation
|
||||||
|
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :object, :type=> Hash
|
||||||
|
field :field_name_for_rebuild
|
||||||
|
field :object_in_array , :type => Boolean,default: false
|
||||||
|
|
||||||
|
# field :to_save, :type => Boolean
|
||||||
|
field :should_destroy, :type => Boolean
|
||||||
|
|
||||||
|
belongs_to :preview
|
||||||
|
# embedded_in :news_bulletin
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,19 @@
|
||||||
|
class PreviewFile
|
||||||
|
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
mount_uploader :file, AssetUploader
|
||||||
|
|
||||||
|
field :title, localize: true
|
||||||
|
field :description, localize: true
|
||||||
|
field :field_name_for_rebuild
|
||||||
|
field :file_in_array , :type => Boolean,default: false
|
||||||
|
|
||||||
|
# field :to_save, :type => Boolean
|
||||||
|
field :should_destroy, :type => Boolean
|
||||||
|
|
||||||
|
belongs_to :preview
|
||||||
|
# embedded_in :news_bulletin
|
||||||
|
|
||||||
|
end
|
|
@ -11,6 +11,7 @@ class Attribute
|
||||||
has_many :attribute_fields, :autosave => true, :dependent => :destroy
|
has_many :attribute_fields, :autosave => true, :dependent => :destroy
|
||||||
accepts_nested_attributes_for :attribute_fields, :allow_destroy => true
|
accepts_nested_attributes_for :attribute_fields, :allow_destroy => true
|
||||||
|
|
||||||
|
|
||||||
def is_built_in?
|
def is_built_in?
|
||||||
self.built_in
|
self.built_in
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,26 +5,43 @@ class AttributeField
|
||||||
include ::AttributeFieldsHelper
|
include ::AttributeFieldsHelper
|
||||||
|
|
||||||
field :key
|
field :key
|
||||||
field :markup
|
field :markup ,:default=>"text_field"
|
||||||
field :markup_value ,:type => Hash
|
field :option_list ,:type => Hash,:default => {}
|
||||||
field :markup_options,:type => Hash
|
field :markup_options,:type => Hash
|
||||||
field :locale, :type => Boolean, :default => true
|
# field :locale, :type => Boolean, :default => true
|
||||||
# field :list_options, :type => Array
|
# field :list_options, :type => Array
|
||||||
field :built_in, :type => Boolean, :default => false
|
field :built_in, :type => Boolean, :default => false
|
||||||
field :disabled, :type => Boolean, :default => false
|
field :disabled, :type => Boolean, :default => false
|
||||||
field :add_more,:type => Boolean, :default => false
|
field :to_delete,:type=> Boolean,:default => false
|
||||||
|
field :typeA,:type=> Hash,:default=>{}
|
||||||
|
field :typeB,:type=> Hash,:default=>{}
|
||||||
|
field :typeC,:type=> Hash,:default=>{:claendar=>"west_claendar"}
|
||||||
|
field :typeD,:type=> Hash,:default=>{}
|
||||||
|
field :typeE,:type=> Hash,:default=>{}
|
||||||
|
|
||||||
|
|
||||||
#field :title, localize: true
|
#field :title, localize: true
|
||||||
|
|
||||||
field :locale_title, localize: true
|
field :title, localize: true
|
||||||
field :neutral_title
|
|
||||||
field :neutral_for
|
|
||||||
|
|
||||||
belongs_to :attribute
|
belongs_to :attribute
|
||||||
# belongs_to :role
|
# belongs_to :role
|
||||||
has_many :attribute_values,:autosave => true, :dependent => :destroy
|
has_many :attribute_values,:autosave => true, :dependent => :destroy
|
||||||
|
before_save :check_option_list
|
||||||
# validates_uniqueness_of :key
|
# validates_uniqueness_of :key
|
||||||
|
def add_more
|
||||||
|
(get_data["add_more"] == "true" ? true : false) rescue false
|
||||||
|
end
|
||||||
|
|
||||||
|
def locale
|
||||||
|
default = true
|
||||||
|
if get_data["locale"].nil?
|
||||||
|
return default
|
||||||
|
else
|
||||||
|
(get_data["locale"] == "true" ? true : false) rescue default
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self_defined_markup_options?
|
def self_defined_markup_options?
|
||||||
(self.attribute.role.method(self[:key].pluralize.to_sym) && self.attribute.role.method(self[:key].pluralize+"_for_"+markup)) rescue false
|
(self.attribute.role.method(self[:key].pluralize.to_sym) && self.attribute.role.method(self[:key].pluralize+"_for_"+markup)) rescue false
|
||||||
|
@ -36,16 +53,16 @@ class AttributeField
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def markup_value
|
def option_list
|
||||||
if self_defined_markup_options?
|
if self_defined_markup_options?
|
||||||
#Class need to have corresponding field and value agent
|
#Class need to have corresponding field and value agent
|
||||||
# Ex: For "status" the class must have field called "statuses" for the relation and "statuses_for_select" for the select function
|
# Ex: For "status" the class must have field called "statuses" for the relation and "statuses_for_select" for the select function
|
||||||
method = self.attribute.role.method(self[:key].pluralize+"_for_"+markup)
|
method = self.attribute.role.method(self[:key].pluralize+"_for_"+markup)
|
||||||
return (method.call rescue {})
|
return (method.call rescue {})
|
||||||
elsif self[:markup_value].nil? || (self[:markup_value].empty?)
|
elsif self[:option_list].nil? || (self[:option_list].empty?)
|
||||||
return {}
|
return {}
|
||||||
else
|
else
|
||||||
return self[:markup_value]
|
return self[:option_list]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -68,36 +85,49 @@ class AttributeField
|
||||||
self.attribute.role
|
self.attribute.role
|
||||||
end
|
end
|
||||||
|
|
||||||
def title_translations
|
def panel
|
||||||
if locale
|
panel = LIST[:markups][self[:markup]]["panel"]
|
||||||
return locale_title_translations
|
|
||||||
else
|
|
||||||
return Hash[VALID_LOCALES.map{|d| [d,neutral_title]}]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def title_translations=(var)
|
def get_data
|
||||||
if locale
|
self[panel]
|
||||||
self.locale_title_translations = var
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def title
|
|
||||||
if locale
|
|
||||||
return self.locale_title
|
|
||||||
else
|
|
||||||
return self.neutral_title
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def title=(var)
|
# def title_translations
|
||||||
# binding.pry
|
# if locale
|
||||||
if locale
|
# return self.locale_title_translations
|
||||||
self.locale_title = var
|
# else
|
||||||
else
|
# return self[:neutral_title] #Hash[VALID_LOCALES.map{|d| [d,neutral_title]}]
|
||||||
self.neutral_title = var
|
# end
|
||||||
end
|
# end
|
||||||
end
|
|
||||||
|
# def title_translations=(var)
|
||||||
|
# if locale
|
||||||
|
# self.locale_title_translations = var
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
# def title
|
||||||
|
# if locale
|
||||||
|
# return self.locale_title
|
||||||
|
# else
|
||||||
|
# return self.neutral_title
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
# def check_title
|
||||||
|
# if locale
|
||||||
|
# self.locale_title_translations = self[:temp_title]
|
||||||
|
# else
|
||||||
|
# self.neutral_title = self[:temp_title]
|
||||||
|
# end
|
||||||
|
# self.unset("temp_title")
|
||||||
|
# end
|
||||||
|
|
||||||
|
# def title=(var)
|
||||||
|
# self["temp_title"] = var
|
||||||
|
# end
|
||||||
|
|
||||||
# # Convert the string list_options into an array
|
# # Convert the string list_options into an array
|
||||||
# def select_list_options=(var)
|
# def select_list_options=(var)
|
||||||
|
@ -117,4 +147,9 @@ class AttributeField
|
||||||
self.disabled
|
self.disabled
|
||||||
end
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
def check_option_list
|
||||||
|
self[:option_list] = self[panel]["option_list"]
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,11 +10,56 @@ class AttributeValue
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
before_save :check_key
|
before_save :check_key
|
||||||
|
before_save :data_proc
|
||||||
# NO_MULTI_TAG = ["select","date","radio_button","checkbox","date_durnation"]
|
# NO_MULTI_TAG = ["select","date","radio_button","checkbox","date_durnation"]
|
||||||
|
|
||||||
|
|
||||||
|
def data_proc
|
||||||
|
# binding.pry
|
||||||
|
# binding.pry if self.attribute_field.markup == 'radio_button'
|
||||||
|
# if self.attribute_field
|
||||||
|
case self.attribute_field.markup
|
||||||
|
when 'text_field','text_area'
|
||||||
|
# binding.pry
|
||||||
|
self[:temp_data].each{|key,val|
|
||||||
|
self[key] = val
|
||||||
|
} unless self[:temp_data].nil?
|
||||||
|
when 'select','date','radio_button'
|
||||||
|
self["val"] = self[:temp_data]
|
||||||
|
when 'checkbox'
|
||||||
|
self["val"] = self[:temp_data].keys rescue {}
|
||||||
|
end #end of case
|
||||||
|
else # if not locale
|
||||||
|
case self.attribute_field.markup
|
||||||
|
when 'text_field','text_area'
|
||||||
|
self["val"] = self[:temp_data]
|
||||||
|
when 'select','date','radio_button'
|
||||||
|
self["val"] = self[:temp_data]
|
||||||
|
when 'checkbox'
|
||||||
|
self["val"] = self[:temp_data].keys rescue {}
|
||||||
|
end #end of case
|
||||||
|
# end #of if self.attribute_field
|
||||||
|
self.unset('temp_data')
|
||||||
|
end
|
||||||
|
|
||||||
|
def value
|
||||||
|
|
||||||
|
result=""
|
||||||
|
if self.attribute_field.locale && (self.attribute_field.markup == "text_field" || self.attribute_field.markup == "text_area")
|
||||||
|
result= Hash[VALID_LOCALES.collect{|lang| [lang,self[lang.to_sym]]}]
|
||||||
|
else
|
||||||
|
result = self["val"]
|
||||||
|
end
|
||||||
|
result
|
||||||
|
end
|
||||||
|
|
||||||
|
def value=(value)
|
||||||
|
#save everything to temp_data waiting for futher process
|
||||||
|
# binding
|
||||||
|
self[:temp_data] = value
|
||||||
|
end
|
||||||
|
|
||||||
def check_key
|
def check_key
|
||||||
binding.pry if attribute_field.nil?
|
|
||||||
self.key = attribute_field.key
|
self.key = attribute_field.key
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -27,45 +72,46 @@ class AttributeValue
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_value_by_locale(locale)
|
def get_value_by_locale(locale)
|
||||||
|
|
||||||
case self.attribute_field.markup
|
case self.attribute_field.markup
|
||||||
when "text_field"
|
when "text_field"
|
||||||
self.attribute_field.locale ? self[locale] : self[:value]
|
self.attribute_field.locale ? self[locale.to_s] : self.value
|
||||||
when "select"
|
when "select"
|
||||||
markup_values = self.attribute_field.self_defined_markup_options? ? self.attribute_field.markup_value : eval(self.attribute_field.markup_value)
|
markup_values = self.attribute_field.self_defined_markup_options? ? self.attribute_field.markup_value : eval(self.attribute_field.markup_value)
|
||||||
markup_values[self[:value]][locale.to_s] rescue 'NoData'
|
markup_values[self.value][locale.to_s] rescue 'NoData'
|
||||||
when "text_area"
|
when "text_area"
|
||||||
self.attribute_field.locale ? self[locale] : self[:value]
|
self.attribute_field.locale ? self[locale.to_s] : self.value
|
||||||
when "date"
|
when "date"
|
||||||
Date.new(self[:value]["(1i)"].to_i,self[:value]["(2i)"].to_i,self[:value]["(3i)"].to_i) rescue nil
|
Date.new(self[:val]["(1i)"].to_i,self[:val]["(2i)"].to_i,self[:val]["(3i)"].to_i) rescue nil
|
||||||
when "addr"
|
when "addr"
|
||||||
self[:value]
|
self.value
|
||||||
when "radio_button"
|
when "radio_button"
|
||||||
markup_values = eval(self.attribute_field.markup_value)
|
markup_values = eval(self.attribute_field.markup_value)
|
||||||
markup_values[self[:value].first[0]][locale.to_s]
|
markup_values[:value][locale.to_s]
|
||||||
when "checkbox"
|
when "checkbox"
|
||||||
markup_values = eval(self.attribute_field.markup_value)
|
markup_values = self.attribute_field.markup_value
|
||||||
self[:value].keys.collect{|key| markup_values[key][locale.to_s] }.join(",")
|
self[:value].keys.collect{|key| markup_values[key][locale.to_s]}.join(",")
|
||||||
when "date_durnation"
|
when "date_durnation"
|
||||||
self[:value]
|
self.value
|
||||||
else
|
else
|
||||||
self.attribute_field.locale ? self[locale] : self[:value]
|
self.attribute_field.locale ? self[locale.to_s] : self.value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_values
|
# def get_values
|
||||||
unless ['select','checkbox','radio_button'].include?(self.attribute_field.markup )
|
# unless ['select','checkbox','radio_button'].include?(self.attribute_field.markup )
|
||||||
if self.attribute_field.locale && LIST[:markups][self.attribute_field.markup]["muti_lang_input_supprt"]
|
# if self.attribute_field.locale && LIST[:markups][self.attribute_field.markup]["muti_lang_input_supprt"]
|
||||||
return Hash[VALID_LOCALES.collect{|lang| [lang,get_value_by_locale(lang.to_sym)]}]
|
# return Hash[VALID_LOCALES.collect{|lang| [lang,get_value_by_locale(lang.to_sym)]}]
|
||||||
else
|
# else
|
||||||
return get_value_by_locale("")
|
# return get_value_by_locale("")
|
||||||
end
|
# end
|
||||||
else
|
# else
|
||||||
if self.attribute_field.markup == "select"
|
# if self.attribute_field.markup == "select"
|
||||||
self[:value]
|
# self[:value]
|
||||||
else
|
# else
|
||||||
self[:value].keys rescue self[:value]
|
# self[:value].keys rescue self[:value]
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,10 +9,7 @@ class User
|
||||||
|
|
||||||
field :admin, :type => Boolean, :default => true
|
field :admin, :type => Boolean, :default => true
|
||||||
field :active_role
|
field :active_role
|
||||||
field :nccu_ldap_uid
|
|
||||||
field :email
|
field :email
|
||||||
# field :cache_dept
|
|
||||||
# has_one :cache_dept, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
|
||||||
field :cache_dept,type: Hash
|
field :cache_dept,type: Hash
|
||||||
field :status_record,type: Hash
|
field :status_record,type: Hash
|
||||||
|
|
||||||
|
@ -38,7 +35,8 @@ class User
|
||||||
before_save :save_roles
|
before_save :save_roles
|
||||||
scope :remote_account, where(:nccu_id.ne => nil)
|
scope :remote_account, where(:nccu_id.ne => nil)
|
||||||
|
|
||||||
validates_uniqueness_of :email,:message=> I18n.t("devise.registrations.email_not_unique")
|
# validates_uniqueness_of :email,:message=> I18n.t("devise.registrations.email_not_unique")
|
||||||
|
|
||||||
# def new_attribute_values=(vars)
|
# def new_attribute_values=(vars)
|
||||||
# binding.pry
|
# binding.pry
|
||||||
# end
|
# end
|
||||||
|
@ -179,7 +177,7 @@ class User
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize_desktop
|
def initialize_desktop
|
||||||
self.build_desktop
|
self.build_desktop(desktop_widget_ids: DesktopWidget.all.collect{|widget| widget.id})
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
|
@ -2,26 +2,26 @@
|
||||||
<% if at_least_module_manager || sub_manager?(ad_banner_tab)%>
|
<% if at_least_module_manager || sub_manager?(ad_banner_tab)%>
|
||||||
<%= form_for ad_banner_tab,:url=> admin_ad_banner_path(ad_banner_tab),:method => :put,:class=>"input-medium" do |f| -%>
|
<%= form_for ad_banner_tab,:url=> admin_ad_banner_path(ad_banner_tab),:method => :put,:class=>"input-medium" do |f| -%>
|
||||||
<div class="adbanner-setup well">
|
<div class="adbanner-setup well">
|
||||||
<!--<p><%#= t("admin.ad.banner_best_size") %>:</p>-->
|
<!--<p><%#= t("ad.banner_best_size") %>:</p>-->
|
||||||
<%= f.label :ad_fx, t('admin.ad.ab_fx') %>
|
<%= f.label :ad_fx, t('ad.ab_fx') %>
|
||||||
<%= f.select :ad_fx ,AdBanner::FX_TYPES %>
|
<%= f.select :ad_fx ,AdBanner::FX_TYPES %>
|
||||||
<%= f.label :transition_sec, t('admin.ad.transition_sec') %>
|
<%= f.label :transition_sec, t('ad.transition_sec') %>
|
||||||
<%= f.text_field :transition_sec,:placeholder=>t('admin.ad.sec_place_holder'),:class=> "span3" %> <%= t("admin.ad.trans_unit_sec") %>
|
<%= f.text_field :transition_sec,:placeholder=>t('ad.sec_place_holder'),:class=> "span3" %> <%= t("ad.trans_unit_sec") %>
|
||||||
<%if at_least_module_manager%>
|
<%if at_least_module_manager%>
|
||||||
<%= f.label :best_size, t('admin.ad.best_size') %>
|
<%= f.label :best_size, t('ad.best_size') %>
|
||||||
<%= f.text_field :best_size %> Ex: 500px x 300px
|
<%= f.text_field :best_size %> Ex: 500px x 300px
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<br>
|
<br>
|
||||||
<%= f.submit t("admin.ad.update_banner"), :class => 'btn' %>
|
<%= f.submit t("ad.update_banner"), :class => 'btn' %>
|
||||||
<%= f.submit t("cancel"),:type=>'reset', :class => 'btn' %>
|
<%= f.submit t("cancel"),:type=>'reset', :class => 'btn' %>
|
||||||
</div>
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<h3><%= t("admin.ad.picture_list")%></h3>
|
<h3><%= t("ad.picture_list")%></h3>
|
||||||
<div class="adbanner-list">
|
<div class="adbanner-list">
|
||||||
<%if (at_least_module_manager || ad_banner_tab.cur_user_is_sub_manager_of(:edit) )%>
|
<%if (at_least_module_manager || ad_banner_tab.cur_user_is_sub_manager_of(:edit) )%>
|
||||||
<%= content_tag :div ,:class=>'adbanner-action' do%>
|
<%= content_tag :div ,:class=>'adbanner-action' do%>
|
||||||
<%= link_to t("admin.ad.new_image"),new_admin_ad_banner_ad_image_path(ad_banner_tab) ,:class => "btn btn-primary"%>
|
<%= link_to t("ad.new_image"),new_admin_ad_banner_ad_image_path(ad_banner_tab) ,:class => "btn btn-primary"%>
|
||||||
<%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(ad_banner_tab.id) , :class=>'preview_trigger btn btn-success'%>
|
<%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(ad_banner_tab.id) , :class=>'preview_trigger btn btn-success'%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
<% if at_least_module_manager %>
|
<% if at_least_module_manager %>
|
||||||
<%= show_ad_banner_permission_link ad_banner_tab%>
|
<%= show_ad_banner_permission_link ad_banner_tab%>
|
||||||
<%= link_to t('admin.ad.delete_banner'),admin_ad_banner_path(ad_banner_tab),:class => 'btn',:method => :delete,:confirm => t('sure?') %>
|
<%= link_to t(:delete),admin_ad_banner_path(ad_banner_tab),:class => 'btn',:method => :delete,:confirm => t('sure?') %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<%#= render :partial => 'new_add_banner_file', :object => ad_banner_tab.ad_images.build, :locals => { :field_name => "new_ad_images[]", :f => f, :classes => "r_destroy" } %>
|
<%#= render :partial => 'new_add_banner_file', :object => ad_banner_tab.ad_images.build, :locals => { :field_name => "new_ad_images[]", :f => f, :classes => "r_destroy" } %>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<li class="span3">
|
<li class="span3">
|
||||||
<%= image_tag ad_image.file rescue nil%>
|
<%= image_tag ad_image.file rescue nil%>
|
||||||
<p>
|
<p>
|
||||||
<%= ad_image.display? ? "[#{t('admin.ad.showing')}]" : "[#{t('admin.ad.not_showing')}]" %>
|
<%= ad_image.display? ? "[#{t('ad.showing')}]" : "[#{t('ad.not_showing')}]" %>
|
||||||
<%= "#{ad_image.post_date ||'NeedReset' }~#{ad_image.unpost_date || 'NeedReset'}" %>
|
<%= "#{ad_image.post_date ||'NeedReset' }~#{ad_image.unpost_date || 'NeedReset'}" %>
|
||||||
</p>
|
</p>
|
||||||
<%if at_least_module_manager || sub_manager?(ad_image.ad_banner) %>
|
<%if at_least_module_manager || sub_manager?(ad_image.ad_banner) %>
|
||||||
|
|
|
@ -4,33 +4,33 @@
|
||||||
|
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<a class="close" data-dismiss="modal">×</a>
|
<a class="close" data-dismiss="modal">×</a>
|
||||||
<h3><%= t("admin.ad.new_banner") %></h3>
|
<h3><%= t('new.banner') %></h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-body form-horizontal">
|
<div class="modal-body form-horizontal">
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<%= f.label :title,t('admin.ad.title'),:class => "control-label" %>
|
<%= f.label :title, t(:title),:class => "control-label" %>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.text_field :title %>
|
<%= f.text_field :title %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<%= f.label :transition_sec, t('admin.ad.transition_sec'),:class => "control-label" %>
|
<%= f.label :transition_sec, t('ad.transition_sec'),:class => "control-label" %>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.text_field :transition_sec %> <%= t("admin.ad.trans_unit_sec") %>
|
<%= f.text_field :transition_sec %> <%= t("ad.trans_unit_sec") %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<%= f.label :best_size, t('admin.ad.best_size'),:class => "control-label" %>
|
<%= f.label :best_size, t('ad.best_size'),:class => "control-label" %>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.text_field :best_size %> Ex: 500px x 300px
|
<%= f.text_field :best_size %> Ex: 500px x 300px
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<%= f.label :ad_fx, t('admin.ad.ab_fx') %>
|
<%= f.label :ad_fx, t('ad.ab_fx') %>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.select :ad_fx ,AdBanner::FX_TYPES %>
|
<%= f.select :ad_fx ,AdBanner::FX_TYPES %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<%= content_tag :li,link_to(t("admin.ad.new_banner"),"#new-a-banner",:data=>{:toggle=>"modal"}),:id=>'new_ad_banner_tab_but',:class => (@active.nil? ? 'active' : nil ) if at_least_module_manager%>
|
<%= content_tag :li,link_to(t('new.banner'),"#new-a-banner",:data=>{:toggle=>"modal"}),:id=>'new_ad_banner_tab_but',:class => (@active.nil? ? 'active' : nil ) if at_least_module_manager%>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<div class="widget-action clear">
|
<div class="widget-action clear">
|
||||||
<a href="#" class="action"><i title="Set the announcement to start and end dates" class="icon-exclamation-sign icon-white tip"></i></a>
|
<a href="#" class="action"><i title="Set the announcement to start and end dates" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<h3 class="widget-title"><i class="icons-calendar icons-white"></i> Date</h3>
|
<h3 class="widget-title"><i class="icons-calendar icons-white"></i><%= t('nccu.date') %></h3>
|
||||||
<div class="widget-content clear">
|
<div class="widget-content clear">
|
||||||
<div id="calendarRange">
|
<div id="calendarRange">
|
||||||
<div class="input-append">
|
<div class="input-append">
|
||||||
|
@ -36,8 +36,8 @@
|
||||||
today = today.format('isoDate');
|
today = today.format('isoDate');
|
||||||
var state = false;
|
var state = false;
|
||||||
var arr = state ? "▼" : "▲"
|
var arr = state ? "▼" : "▲"
|
||||||
var start_date = <%= @ad_image.post_date.nil?? 'today' : "'#{@ad_image.post_date.strftime('%Y / %m / %d')}'" %>;
|
var start_date = <%= (@ad_image.post_date.nil?? 'today' : "'#{@ad_image.post_date.strftime('%Y / %m / %d')}'").html_safe %>;
|
||||||
var end_date = <%= @ad_image.unpost_date.nil?? 'today' : "'#{@ad_image.unpost_date.strftime('%Y / %m / %d')}'" %>;
|
var end_date = <%= (@ad_image.unpost_date.nil?? 'today' : "'#{@ad_image.unpost_date.strftime('%Y / %m / %d')}'").html_safe %>;
|
||||||
//calendarRange
|
//calendarRange
|
||||||
$('#calendarRange .showDate').html(start_date+" - "+end_date);
|
$('#calendarRange .showDate').html(start_date+" - "+end_date);
|
||||||
$('#calendarRange .calendarInput').val(start_date+" - "+end_date);
|
$('#calendarRange .calendarInput').val(start_date+" - "+end_date);
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
<div class="widget-action clear">
|
<div class="widget-action clear">
|
||||||
<a class="action"><i title="Upload pictures" class="icon-exclamation-sign icon-white tip"></i></a>
|
<a class="action"><i title="Upload pictures" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<h3 class="widget-title"><i class="icons-picture icons-white"></i>Picture</h3>
|
<h3 class="widget-title"><i class="icons-picture icons-white"></i><%= t('nccu.picture') %></h3>
|
||||||
<div class="widget-content clear">
|
<div class="widget-content clear">
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="upload-picture">
|
<div class="upload-picture">
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
<%= image_tag @ad_image.file rescue ''%>
|
<%= image_tag @ad_image.file rescue ''%>
|
||||||
</div>
|
</div>
|
||||||
<% if !@ad_image.ad_banner.best_size.empty?%>
|
<% if !@ad_image.ad_banner.best_size.empty?%>
|
||||||
<span class="alert widgetInfo"><%= t("admin.ad.widget_info_for_ad_image_size",:best_size=> @ad_image.ad_banner.best_size) %>
|
<span class="alert widgetInfo"><%= t("ad.widget_info_for_ad_image_size",:best_size=> @ad_image.ad_banner.best_size) %>
|
||||||
</span>
|
</span>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<div class="controls file-upload input-prepend">
|
<div class="controls file-upload input-prepend">
|
||||||
|
@ -101,7 +101,7 @@
|
||||||
<div class="widget-action clear">
|
<div class="widget-action clear">
|
||||||
<a class="action"><i class="icon-exclamation-sign icon-white tip" data-original-title="Upload pictures"></i></a>
|
<a class="action"><i class="icon-exclamation-sign icon-white tip" data-original-title="Upload pictures"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<h3 class="widget-title"><i class="icons-star-thin icons-white"></i>Type</h3>
|
<h3 class="widget-title"><i class="icons-star-thin icons-white"></i><%= t(:type) %></h3>
|
||||||
<div class="widget-content clear">
|
<div class="widget-content clear">
|
||||||
<%= f.select :link_open ,AdImage::LINK_OPEN_TYPES%>
|
<%= f.select :link_open ,AdImage::LINK_OPEN_TYPES%>
|
||||||
</div>
|
</div>
|
||||||
|
@ -111,7 +111,7 @@
|
||||||
<div class="widget-action clear">
|
<div class="widget-action clear">
|
||||||
<a class="action"><i class="icon-exclamation-sign icon-white tip" data-original-title="Set the range time"></i></a>
|
<a class="action"><i class="icon-exclamation-sign icon-white tip" data-original-title="Set the range time"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<h3 class="widget-title"><i class="icons-time icons-white"></i>FEQ</h3>
|
<h3 class="widget-title"><i class="icons-time icons-white"></i><%= t(:frequency) %></h3>
|
||||||
<div class="widget-content clear">
|
<div class="widget-content clear">
|
||||||
<%= f.text_field :weight ,:class=> 'span3',:placeholder=>"在套圖中出現次數 1次請輸入1" %>
|
<%= f.text_field :weight ,:class=> 'span3',:placeholder=>"在套圖中出現次數 1次請輸入1" %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -121,7 +121,7 @@
|
||||||
<div class="widget-action clear">
|
<div class="widget-action clear">
|
||||||
<a class="action"><i class="icon-exclamation-sign icon-white tip" data-original-title="Add a reference link"></i></a>
|
<a class="action"><i class="icon-exclamation-sign icon-white tip" data-original-title="Add a reference link"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<h3 class="widget-title"><i class="icons-link icons-white"></i>Link</h3>
|
<h3 class="widget-title"><i class="icons-link icons-white"></i><%= t(:link) %></h3>
|
||||||
<div class="widget-content clear">
|
<div class="widget-content clear">
|
||||||
<%= f.text_field :out_link ,:class=> 'span3',:placeholder => "輸入連結"%>
|
<%= f.text_field :out_link ,:class=> 'span3',:placeholder => "輸入連結"%>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,18 +5,18 @@
|
||||||
<div class="main_list">
|
<div class="main_list">
|
||||||
<%= flash_messages %>
|
<%= flash_messages %>
|
||||||
<div class="button_bar up">
|
<div class="button_bar up">
|
||||||
<% #link_to t('admin.new_user'), new_admin_user_path, :class => 'new' %>
|
<% #link_to t('new.user'), new_admin_user_path, :class => 'new' %>
|
||||||
</div>
|
</div>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= t('admin.app.title') %></td>
|
<td><%= t(:title) %></td>
|
||||||
<td><%= t('admin.app.description') %></td>
|
<td><%= t(:description) %></td>
|
||||||
<td><%= t('admin.app.use_status') %></td>
|
<td><%= t(:use_status) %></td>
|
||||||
<td><%= t('admin.app.autdor') %></td>
|
<td><%= t(:author) %></td>
|
||||||
<td><%= t('admin.app.organization') %></td>
|
<td><%= t(:organization) %></td>
|
||||||
<td><%= t('admin.app.version') %></td>
|
<td><%= t(:version) %></td>
|
||||||
<td class="action"><%= t('admin.action') %></td>
|
<td class="action"><%= t(:action) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -47,6 +47,6 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div class="button_bar">
|
<div class="button_bar">
|
||||||
<%# link_to t('admin.new_user'), new_admin_user_path, :class => 'new' %>
|
<%# link_to t('new.user'), new_admin_user_path, :class => 'new' %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
<div class="quick-edit">
|
<div class="quick-edit">
|
||||||
<ul class="nav nav-pills hide">
|
<ul class="nav nav-pills hide">
|
||||||
|
|
||||||
<li><%= link_to t('asset_category.edit'), edit_admin_asset_category_path(asset_category), :remote => true %></li>
|
<li><%= link_to t(:edit), edit_admin_asset_category_path(asset_category), :remote => true %></li>
|
||||||
<li><%= link_to t('asset_category.delete'), admin_asset_category_path(asset_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
|
<li><%= link_to t(:delete), admin_asset_category_path(asset_category), :confirm => t(:sure?), :method => :delete, :remote => true %></li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<table class="table main-list">
|
<table class="table main-list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="span2"><%= t('asset_category.key') %></th>
|
<th class="span2"><%= t(:key) %></th>
|
||||||
<% @site_valid_locales.each do |locale| %>
|
<% @site_valid_locales.each do |locale| %>
|
||||||
<th class="span2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
|
<th class="span2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div id='pop_up_content' class="main2">
|
<div id='pop_up_content' class="main2">
|
||||||
<h1><%= t('editing_asset') %></h1>
|
<h1><%= t('editing.asset') %></h1>
|
||||||
|
|
||||||
<%= flash_messages %>
|
<%= flash_messages %>
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
<%= link_back %>
|
<%= link_back %>
|
||||||
<%= f.submit t(:edit) %>
|
<%= f.submit t(:edit) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<a id='ajax_form_submit' class="btn btn-primary"><%= t(:update) %></a>
|
<a id='ajax_form_submit' class="btn btn-primary"><%= t(:update_) %></a>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label for="title" class="control-label"><%= t 'admin.title' %></label>
|
<label for="title" class="control-label"><%= t :title %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.fields_for :title_translations do |f| %>
|
<%= f.fields_for :title_translations do |f| %>
|
||||||
<% @site_valid_locales.each do |locale| %>
|
<% @site_valid_locales.each do |locale| %>
|
||||||
|
@ -14,13 +14,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label"><%= f.label :category, t('admin.category') %></label>
|
<label class="control-label"><%= f.label :category, t(:category) %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.select :asset_category_id, @asset_categories.collect{|t| [ t.title, t.id ]}, {}, :class => "input-large" %>
|
<%= f.select :asset_category_id, @asset_categories.collect{|t| [ t.title, t.id ]}, {}, :class => "input-large" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label"><%= t 'admin.tags' %></label>
|
<label class="control-label"><%= t :tags %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<% @tags.each do |tag| %>
|
<% @tags.each do |tag| %>
|
||||||
<%= content_tag :label, :class => "checkbox inline" do -%>
|
<%= content_tag :label, :class => "checkbox inline" do -%>
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label"><%= f.label :data, t('admin.data') %></label>
|
<label class="control-label"><%= f.label :data, t(:data) %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.file_field :data, :class => 'upload' %>
|
<%= f.file_field :data, :class => 'upload' %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div id='pop_up_content' class="main2">
|
<div id='pop_up_content' class="main2">
|
||||||
<h1><%= t('admin.new_asset') %></h1>
|
<h1><%= t('new.asset') %></h1>
|
||||||
|
|
||||||
<%= flash_messages %>
|
<%= flash_messages %>
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
<%= f.error_messages %>
|
<%= f.error_messages %>
|
||||||
<%= render :partial => "form", :locals => { :f => f } %>
|
<%= render :partial => "form", :locals => { :f => f } %>
|
||||||
<div class="button_bar">
|
<div class="button_bar">
|
||||||
<a id='ajax_form_submit' class="btn btn-primary"><%= t(:create) %></a>
|
<a id='ajax_form_submit' class="btn btn-primary"><%= t(:create_) %></a>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<%= render_sort_bar(true, delete_admin_assets_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]),
|
<%= 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'],
|
['title', 'title','span4', :title],
|
||||||
['description', 'description', 'span1-2', 'admin.data'],
|
['description', 'description', 'span1-2', :data],
|
||||||
['intro', 'intro', 'span1-2', 'admin.file_type'],
|
['intro', 'intro', 'span1-2', :type],
|
||||||
['intro', 'intro', 'span1-2', 'admin.file_length'],
|
['intro', 'intro', 'span1-2', :size],
|
||||||
['intro', 'intro', 'span1-2', 'admin.description'],
|
['intro', 'intro', 'span1-2', :description],
|
||||||
['intro', 'intro', 'span1-2', 'admin.tags']).html_safe %>
|
['intro', 'intro', 'span1-2', :tags]).html_safe %>
|
||||||
|
|
|
@ -1 +1,25 @@
|
||||||
<%= @asset.data.url %>#<%= show_all_fields(@asset, 'title') %>#<%= show_all_fields(@asset, 'description') %>
|
<% if !request.xhr? %>
|
||||||
|
<textarea>
|
||||||
|
<% end %>
|
||||||
|
var returnurl = "<%= @asset.data.url %>";
|
||||||
|
var returntitle = "<%= show_all_fields(@asset, 'title') %>";
|
||||||
|
var returndescription = "<%= show_all_fields(@asset, 'description') %>";
|
||||||
|
var win = tinyMCEPopup.getWindowArg("window");
|
||||||
|
win.document.getElementById(tinyMCEPopup.getWindowArg("input")).value = returnurl;
|
||||||
|
if(win.document.getElementById(tinyMCEPopup.getWindowArg("alt")))
|
||||||
|
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();
|
||||||
|
<% if !request.xhr? %>
|
||||||
|
</textarea>
|
||||||
|
<% end %>
|
|
@ -1,7 +1,7 @@
|
||||||
<% content_for :secondary do %>
|
<% content_for :secondary do %>
|
||||||
<div class="assets_setup">
|
<div class="assets_setup">
|
||||||
<ul class="list">
|
<ul class="list">
|
||||||
<li><%= link_to t(:new_asset, :scope => :admin), new_admin_asset_path, :remote => true, :class => 'button positive' %></li>
|
<li><%= link_to t('new.asset'), new_admin_asset_path, :remote => true, :class => 'button positive' %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
<body onload="tinyMCEPopup.executeOnLoad('init();')">
|
<body onload="tinyMCEPopup.executeOnLoad('init();')">
|
||||||
<%= form_for :asset, :url => admin_assets_path(:uploader => true), :html => {:id => 'ajaxForm', :multipart => true } do |f| %>
|
<%= form_for :asset, :url => admin_assets_path(:uploader => true), :html => {:id => 'ajaxForm', :multipart => true } do |f| %>
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h3><%= t 'admin.file_upload' %></h3>
|
<h3><%= t 'file.upload' %></h3>
|
||||||
</div>
|
</div>
|
||||||
<label class="control-label error" id="dyn_error"></label>
|
<label class="control-label error" id="dyn_error"></label>
|
||||||
<div class="modal-body form-horizontal">
|
<div class="modal-body form-horizontal">
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label for="title" class="control-label error"><%= t 'admin.title' %></label>
|
<label for="title" class="control-label error"><%= t :title %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.fields_for :title_translations do |f| %>
|
<%= f.fields_for :title_translations do |f| %>
|
||||||
<div>
|
<div>
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label for="description" class="control-label error"><%= t 'admin.description' %></label>
|
<label for="description" class="control-label error"><%= t :description %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.fields_for :description_translations do |f| %>
|
<%= f.fields_for :description_translations do |f| %>
|
||||||
<div>
|
<div>
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<%#= f.label :data, t('admin.data'), :class => "control-label" %>
|
<%#= f.label :data, t(:data), :class => "control-label" %>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.file_field :data, :class => 'upload' %>
|
<%= f.file_field :data, :class => 'upload' %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -54,7 +54,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div style="position: absolute; width: 100%; bottom: 0;">
|
<div style="position: absolute; width: 100%; bottom: 0;">
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<a id='ajax_form_submit' class="btn btn-primary"><%= t(:create) %></a>
|
<!-- <a id='ajax_form_submit' class="btn btn-primary"><#%= t(:create) %></a> -->
|
||||||
|
<input type="submit" value="<%= t(:create_) %>" class="btn btn-primary" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="form-actions form-fixed pagination-right">
|
<div class="form-actions form-fixed pagination-right">
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_admin_asset_path, :remote => true, :class => 'btn btn-primary pull-right' %>
|
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:add), new_admin_asset_path, :remote => true, :class => 'btn btn-primary pull-right' %>
|
||||||
<div id="asset_pagination" class="paginationFixed">
|
<div id="asset_pagination" class="paginationFixed">
|
||||||
<%= paginate @assets, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]}, :remote => true %>
|
<%= paginate @assets, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]}, :remote => true %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<% content_for :secondary do %>
|
<% content_for :secondary do %>
|
||||||
<div class="assets_setup">
|
<div class="assets_setup">
|
||||||
<ul class="list">
|
<ul class="list">
|
||||||
<li><%= link_to t(:new_asset, :scope => :admin), new_admin_asset_path, :remote => true, :class => 'button positive' %></li>
|
<li><%= link_to t('new.asset'), new_admin_asset_path, :remote => true, :class => 'button positive' %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<td class='select_type'>
|
<td class='select_type'>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>markup<%= f.select :markup, LIST[:markups].keys, {}, {:style => "width:90px"} %> </li>
|
<li>markup<%= f.select :markup, LIST[:markups].keys, {}, {:style => "width:90px"} %> </li>
|
||||||
<li>markup_value<%= f.text_field :markup_value,:size=>50 %></li>
|
<li>markup_value<%= f.text_field :markup_value,:size=>50 %></li>
|
||||||
|
@ -22,12 +21,9 @@
|
||||||
<li>neutral_for<%= f.select :neutral_for, VALID_LOCALES, {}, {:style => "width:90px"} %> </li>
|
<li>neutral_for<%= f.select :neutral_for, VALID_LOCALES, {}, {:style => "width:90px"} %> </li>
|
||||||
<!--
|
<!--
|
||||||
<li><%#= attribute_field[:markup].eql?('select') ? nil : "style='display:none'"%> </li>
|
<li><%#= attribute_field[:markup].eql?('select') ? nil : "style='display:none'"%> </li>
|
||||||
<li><%#= t('admin.options') %>: <%#= f.text_field :markup_value%></li>
|
<li><%#= t(:options) %>: <%#= f.text_field :markup_value%></li>
|
||||||
-->
|
-->
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td class="action">
|
<td class="action">
|
||||||
<% if attribute_field.new_record? %>
|
<% if attribute_field.new_record? %>
|
||||||
|
|
|
@ -1,14 +1,139 @@
|
||||||
<% content_for :secondary do %>
|
<%= form_for @attribute,:url => admin_info_path(@attribute) ,:class=> "form-horizontal" do |f| %>
|
||||||
<%= render 'admin/users/side_bar' %>
|
<div class="site-map role-block">
|
||||||
|
<div class="map-block back">
|
||||||
|
<h4><span><%= t("admin.info")%></span></h4>
|
||||||
|
<div class="form-horizontal">
|
||||||
|
<div class="clear">
|
||||||
|
<div class="control-group pull-left">
|
||||||
|
<label class="control-label" for="key"><%= t("admin.key") %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<% if @attribute.new_record? %>
|
||||||
|
<%= f.text_field :key,:placeholder=>"Key" %>
|
||||||
|
<% else %>
|
||||||
|
<div><%= @attribute.key%></div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%= render :partial=>"placeholder_block",:locals=>{:value=>@attribute.title_translations,:class_ext=>"pull-left",:label_ext=>t("admin.infos.item_name"),:field_name=>"info[title_translations]"}%>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="map-block back attributes">
|
||||||
|
<h4><span><%= t("admin.attributes")%></span></h4>
|
||||||
|
<%= render :partial=>"attribute_field",:collection=>@attribute.attribute_fields%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-actions form-fixed pagination-right">
|
||||||
|
<%= link_to content_tag(:i,t("admin.infos.add_attribute_field"),:class=>"icon-plus icon-white"),admin_info_add_attribute_field_path(@attribute),:class=>"btn btn-primary",:remote => true%>
|
||||||
|
<%= f.submit t("admin.infos.save"),:class=>"btn btn-primary"%>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% content_for :page_specific_css do -%>
|
||||||
|
<%= stylesheet_link_tag "member" %>
|
||||||
|
<%= stylesheet_link_tag "site-map" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div id="profile">
|
<% content_for :page_specific_javascript do -%>
|
||||||
<%= form_for @attribute, :url => eval("admin_#{@attribute_type}_path(@attribute)") do |f| %>
|
<script>
|
||||||
<%= f.error_messages %>
|
var CloneTarget ;
|
||||||
<%= render :partial => "admin/#{@attribute_type}s/form", :locals => { :f => f, :is_new => false } %>
|
|
||||||
<div class='button_bar'>
|
var NewNode;
|
||||||
<%= link_back %>
|
|
||||||
<%= link_to t('update'), "#", :onclick=>"$('#edit_#{@attribute_type}_#{@attribute.id}').submit()" %>
|
$(document).ready(function(){
|
||||||
</div>
|
// function mas(){
|
||||||
<% end %>
|
// $('.site-map').masonry({
|
||||||
</div>
|
// itemSelector: '.map-block',
|
||||||
|
// columnWidth: 450,
|
||||||
|
// isAnimated: true
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
function checkSwitch() {
|
||||||
|
$(".groups").addClass('disabled').has('.groups > .form-horizontal > div:not(.hide)').removeClass('disabled');
|
||||||
|
}
|
||||||
|
function checkMultipleInput() {
|
||||||
|
$(".multipleInput").each(function() {
|
||||||
|
$(this).find('.controls').length==1 ? $(this).addClass("plural") : $(this).removeClass("plural")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function removeInput(){
|
||||||
|
$(".removeInput").live('click',function (){
|
||||||
|
$(this).parents(".controls").remove();
|
||||||
|
checkMultipleInput();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
checkSwitch();
|
||||||
|
checkMultipleInput();
|
||||||
|
removeInput();
|
||||||
|
$(".remove_attribute").live('click',function(){
|
||||||
|
$(this).siblings(".attribute_field_to_delete").val("true");
|
||||||
|
$(this).parents(".form-horizontal").fadeOut("slow", function () { $(this).hide(); });
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".help-block a").live('click',function (){
|
||||||
|
CloneTarget = $(this).parents(".controls").prev(".multipleInput").find('.controls:last');
|
||||||
|
NewNode = CloneTarget.clone();
|
||||||
|
var index;
|
||||||
|
NewNode.find("input").each(function(k,v){
|
||||||
|
index = CloneTarget.parents("div.control-group").find(".list_count").val()
|
||||||
|
field_name = CloneTarget.parents("div.control-group").find(".field_name").val()
|
||||||
|
ori_str = $(v).attr("name").replace(field_name,"");
|
||||||
|
lang = ori_str.match(/\[\D*\]/);
|
||||||
|
new_field_name = (field_name+"[" + (parseInt(index)+1) + "]" + lang);
|
||||||
|
$(v).attr("name",new_field_name);
|
||||||
|
})
|
||||||
|
|
||||||
|
$(this).parents("div.control-group").find(".list_count").val(parseInt(index)+1)
|
||||||
|
$(this).parents(".controls").prev(".multipleInput").append(NewNode);
|
||||||
|
$(this).parents(".controls").prev(".multipleInput").find('.controls:last input').val("");
|
||||||
|
removeInput();
|
||||||
|
checkMultipleInput();
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
$(".status select").each(function (i) {
|
||||||
|
$(this).change(function () {
|
||||||
|
$(".status option:selected").eq(i).each(function () {
|
||||||
|
if($(this).attr("value")=="alumna") {
|
||||||
|
$(this).parents(".status").nextAll(".graduated").removeClass("hide");
|
||||||
|
$(this).parents(".status").nextAll(".graduated").find("select").removeAttr("disabled");
|
||||||
|
}else{
|
||||||
|
$(this).parents(".status").nextAll(".graduated").addClass("hide");
|
||||||
|
$(this).parents(".status").nextAll(".graduated").find("select").attr({disabled:''});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
})
|
||||||
|
$('.onoff').live('click',function () {
|
||||||
|
if($(this).parents("h4").length==1) {
|
||||||
|
$(this).parents(".map-block").toggleClass("disabled");
|
||||||
|
$(this).parents(".map-block").find(".form-horizontal").toggleClass("hide");
|
||||||
|
if($(this).parents(".map-block").hasClass("disabled")){
|
||||||
|
$(this).text("OFF");
|
||||||
|
}else{
|
||||||
|
$(this).text("ON");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($(this).parents("legend").length==1) {
|
||||||
|
$(this).toggleClass("disabled");
|
||||||
|
$(this).parents("legend").next("div").toggleClass("hide");
|
||||||
|
if($(this).parents("legend").next("div").hasClass("hide")){
|
||||||
|
$(this).text("OFF");
|
||||||
|
$(this).siblings(".attribute_field_disabled").val("true");
|
||||||
|
}else{
|
||||||
|
$(this).text("ON");
|
||||||
|
$(this).siblings(".attribute_field_disabled").val("false");
|
||||||
|
}
|
||||||
|
checkSwitch();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$(".dataType").change(function () {
|
||||||
|
$(this).parents("legend").next("div").find("div[class^='type']").addClass("hide");
|
||||||
|
$(this).parents("legend").next("div").find("."+$(this).find("option:selected").attr("ref")).removeClass("hide");
|
||||||
|
})
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<% end -%>
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
|
|
||||||
<div class="main_list">
|
<div class="main_list">
|
||||||
<div class="button_bar up">
|
<div class="button_bar up">
|
||||||
<%= link_to t("admin.new_#{@attribute_type}"), eval("new_admin_#{@attribute_type}_path"), :class => 'new' %>
|
<%= link_to t("new.#{@attribute_type}"), eval("new_admin_#{@attribute_type}_path"), :class => 'new' %>
|
||||||
</div>
|
</div>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="<%= @attribute_type %>s"><%= t("admin.#{@attribute_type}") %></td>
|
<td class="<%= @attribute_type %>s"><%= t("#{@attribute_type}") %></td>
|
||||||
<td class="action"><%= t('admin.action') %></td>
|
<td class="action"><%= t(:action) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -34,6 +34,6 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div class="button_bar">
|
<div class="button_bar">
|
||||||
<%= link_to t("admin.new_#{@attribute_type}"), eval("new_admin_#{@attribute_type}_path"), :class => 'new' %>
|
<%= link_to t("new.#{@attribute_type}"), eval("new_admin_#{@attribute_type}_path"), :class => 'new' %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
<div id="open_for_all_user">
|
<div id="open_for_all_user">
|
||||||
<h1><%= t("admin.user_role.auth.all_member") %></h1>
|
<h1><%= t("auth.all_member") %></h1>
|
||||||
<%= form_tag(submit_url) do %>
|
<%= form_tag(submit_url) do %>
|
||||||
<%= check_box_tag 'auth_all',true,(auth.all rescue true) %><%= submit_tag t("admin.user_role.auth.all_member") %><br/>
|
<%= check_box_tag 'auth_all',true,(auth.all rescue true) %><%= submit_tag t("auth.all_member") %><br/>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="user_role_management">
|
<div id="user_role_management">
|
||||||
<h1><%= t("admin.user_role.auth.user") %></h1>
|
<h1><%= t(:user) %></h1>
|
||||||
<%= form_tag(submit_url) do %>
|
<%= form_tag(submit_url) do %>
|
||||||
<%= collection_select(:new,:role, Role.all, :id, :key, :prompt => true) %>
|
<%= collection_select(:new,:role, Role.all, :id, :key, :prompt => true) %>
|
||||||
<%= submit_tag t("admin.user_role.auth.by_role") %><br/>
|
<%= submit_tag t("auth.by_role") %><br/>
|
||||||
<%= collection_select(:new,:sub_role, SubRole.all, :id, :key, :prompt => true) %>
|
<%= collection_select(:new,:sub_role, SubRole.all, :id, :key, :prompt => true) %>
|
||||||
<%= submit_tag t("admin.user_role.auth.by_sub_role") %><br/>
|
<%= submit_tag t("auth.by_sub_role") %><br/>
|
||||||
<%= collection_select(:new,:privilege_user, User.all, :id, :name, :prompt => true) %>
|
<%= collection_select(:new,:privilege_user, User.all, :id, :name, :prompt => true) %>
|
||||||
<%= submit_tag t("admin.user_role.auth.add_to_privilege_list") %><br/>
|
<%= submit_tag t("auth.add_to_privilege_list") %><br/>
|
||||||
<%= collection_select(:new,:blocked_user, User.all, :id, :name, :prompt => true) %>
|
<%= collection_select(:new,:blocked_user, User.all, :id, :name, :prompt => true) %>
|
||||||
<%= submit_tag t("admin.user_role.auth.add_to_block_list") %><br/>
|
<%= submit_tag t("auth.add_to_block_list") %><br/>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% unless auth.nil? %>
|
<% unless auth.nil? %>
|
||||||
<% auth.roles.each do |role| %>
|
<% auth.roles.each do |role| %>
|
||||||
|
|
|
@ -111,7 +111,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item element">
|
<div class="item element">
|
||||||
<h3><i class="icons-asset"></i><a href=""><%= t(:file) %></a></a></h3>
|
<h3><i class="icons-asset"></i><a href=""><%= t(:file_) %></a></a></h3>
|
||||||
<div class="detail w-a h-a">
|
<div class="detail w-a h-a">
|
||||||
<p class="totle"><span><%= t(:all_file) %></span>3,422</p>
|
<p class="totle"><span><%= t(:all_file) %></span>3,422</p>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
|
|
|
@ -1,24 +1,22 @@
|
||||||
<%= form_for @design, :url => admin_design_path(@design), :html => {:class => 'form-horizontal'}, :remote => true do |f| %>
|
<%= form_for @design, :url => admin_design_path(@design), :html => {:class => 'form-horizontal'}, :remote => true do |f| %>
|
||||||
<%= f.error_messages %>
|
<%= f.error_messages %>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<%= f.label :title, t('admin.title'), :class => "control-label" %>
|
<%= f.label :title, t(:title), :class => "control-label" %>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.text_field :title %>
|
<%= f.text_field :title %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<%= f.label :author, t('admin.author'), :class => "control-label" %>
|
<%= f.label :author, t(:author), :class => "control-label" %>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.text_field :author %>
|
<%= f.text_field :author %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<%= f.label :intro, t('admin.intro'), :class => "control-label" %>
|
<%= f.label :intro, t(:intro), :class => "control-label" %>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.text_field :intro %>
|
<%= f.text_field :intro %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<%= f.submit t('update') %>
|
<%= f.submit t('update') %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<%= form_for :image, :url => upload_image_admin_design_path, :html => {:id => 'ajaxForm', :class => 'form-horizontal'}, :method => :post do |f| %>
|
<%= form_for :image, :url => upload_image_admin_design_path, :html => {:id => 'ajaxForm', :class => 'form-horizontal'}, :method => :post do |f| %>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<%= f.label :image, t('admin.image'), :class => "control-label" %>
|
<%= f.label :image, t(:image), :class => "control-label" %>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.file_field :file %>
|
<%= f.file_field :file %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<h1><%= t('admin.new_design') %></h1>
|
<h1><%= t('new.design') %></h1>
|
||||||
|
|
||||||
<%= form_for @design, :url => admin_design_path(@design),:html => {:multipart => true} do |f| %>
|
<%= form_for @design, :url => admin_design_path(@design),:html => {:multipart => true} do |f| %>
|
||||||
<%= f.error_messages %>
|
<%= f.error_messages %>
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue