This commit is contained in:
Rueshyna 2012-11-21 10:46:33 +08:00
commit da1b871481
86 changed files with 3209 additions and 1258 deletions

View File

@ -7,6 +7,7 @@
//= require jquery //= require jquery
//= require jquery_ujs //= require jquery_ujs
//= require jquery-ui //= require jquery-ui
//= require jquery.form
//= require jquery.tinyscrollbar //= require jquery.tinyscrollbar
//= require jquery.miniColors.min //= require jquery.miniColors.min
//= require bootstrap //= require bootstrap

View File

@ -0,0 +1,33 @@
function checkSwitch() {
$(".groups").each(function() {
$(this).find('.form-horizontal > .hide').length < $(this).find('.form-horizontal > div').length ? $(this).removeClass("disabled") : $(this).addClass("disabled")
});
// $(".groups").addClass('disabled').has('.groups > .form-horizontal > div:not(.hide)').removeClass('disabled');
}
$(document).ready(function(){
checkSwitch();
$('.onoff').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");
}else{
$(this).text("ON");
}
checkSwitch();
}
return false;
});
});

View File

@ -0,0 +1,15 @@
$(document).ready(function(){
$(".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:''});
}
});
})
})
});

View File

@ -0,0 +1,112 @@
jQuery(document).ready(function($) {
// Stuff to do as soon as the DOM is ready. Use $() w/o colliding with other libs;
var current_textarea = {};
var parent = null;
var this_modal_window = null;
var lang = <%= VALID_LOCALES.to_s %>;
$("textarea[func=input_unit]").each(function(){
var id = $(this).attr("id");
current_textarea[id] = $(this).val();
})
console.log(current_textarea);
// current_textarea['en'] = $("textarea[for=en]").val();
// current_textarea['zh_tw'] = $("textarea[for=zh_tw]").val();
$("div.controls").on("click","a.edit-btn",function(){
parent = $(this).parent();
this_modal_window = $(this).parent().parent().parent().parent().find(".modal");
choosen_lang = $(this).parent().parent().find("ul li.active").attr("for");
$(this).parents(".editMore").find(".modal_tab").removeClass("active in");
$(this).parents(".editMore").find(".modal_tab[for="+choosen_lang+"]").addClass("active in");
$(this).parents(".editMore").find(".modal-body li").removeClass("active");
$(this).parents(".editMore").find(".modal-body li[for="+choosen_lang+"]").addClass("active");
// switch($(this).parent().parent().find("ul li.active a").attr("href")){
// case ".tab1":
// $("#tab3").addClass("active in");
// $(".modal-body li").eq(0).addClass("active");
// break;
// case ".tab2":
// $("#tab4").addClass("active in");
// $(".modal-body li").eq(1).addClass("active");
// break;
$.each(lang,function(i,value){
// console.log(this_modal_window);
var sa = parent.find("input.street_address_"+lang[i]).val();
var city = parent.find("input.city_"+lang[i]).val();
var county = parent.find("input.county_"+lang[i]).val();
var zip = parent.find("input.zip_"+lang[i]).val();
var country = parent.find("input.country_"+lang[i]).val();
this_modal_window.find('.tab-content div[for='+lang[i]+'] textarea[func=street_address]').val(sa);
this_modal_window.find('.tab-content div[for='+lang[i]+'] input[func=city]').val(city);
this_modal_window.find('.tab-content div[for='+lang[i]+'] input[func=county]').val(county);
this_modal_window.find('.tab-content div[for='+lang[i]+'] input[func=zip]').val(zip);
this_modal_window.find('.tab-content div[for='+lang[i]+'] input[func=country]').val(country);
var verify = sa + city + country +county + zip;
var combined = "";
if(verify!="")
combined = sa + "\n" + city + "\n" + county + "\n" + zip + "\n" + country+"\n";
var Text0 = parent.find("div."+lang[i]+" textarea[func=input_unit]").val();
Text1 = Text0.replace(/(\r\n|\n|\r)/gm,"");
var Text2 = combined;
Text2 = Text2.replace(/(\r\n|\n|\r)/gm,"");
if(Text1 != Text2){
this_modal_window.find('.tab-content div[for='+lang[i]+'] textarea[func=street_address]').val(Text0);
this_modal_window.find("input").val("");
}
});
});
$("textarea[func=input_unit]").change(function(){
var id = $(this).attr("id");
var lang = $(this).attr("for");
if(!parent)
parent = $(this).parent().parent();
console.log(current_textarea[id]);
if(current_textarea[id] != $(this).val())
parent.find("input.indicator_"+lang).val("true");
else
parent.find("input.indicator_"+lang).val("false");
})
$(".address-edit").on("hidden",function(){
$("#tab3").removeClass("active in");
$("#tab4").removeClass("active in");
$(".modal-body li").removeClass("active");
$(".modal-body input, .modal-body textarea").val("");
})
$(".bt-save").click(function(){
for(i=0;i<2;i++){
var sa = this_modal_window.find('.tab-content div[for='+lang[i]+'] textarea[func=street_address]').val();
var city = this_modal_window.find('.tab-content div[for='+lang[i]+'] input[func=city]').val();
var county = this_modal_window.find('.tab-content div[for='+lang[i]+'] input[func=county]').val();
var zip = this_modal_window.find('.tab-content div[for='+lang[i]+'] input[func=zip]').val();
var country = this_modal_window.find('.tab-content div[for='+lang[i]+'] input[func=country]').val();
parent.find("input.street_address_"+lang[i]).val(sa);
parent.find("input.city_"+lang[i]).val(city);
parent.find("input.county_"+lang[i]).val(county);
parent.find("input.zip_"+lang[i]).val(zip);
parent.find("input.country_"+lang[i]).val(country);
var verify = sa + city + country +county + zip;
var combined = "";
if(verify!="")
combined = sa + "\n" + city + "\n" + county + "\n" + zip + "\n" + country;
parent.find("textarea[for="+lang[i]+"]").val(combined);
parent.find("input.indicator_"+lang[i]).val("false");
current_textarea[parent.find("textarea[for="+lang[i]+"]").attr("id")] = combined;
}
})
});

View File

@ -0,0 +1,37 @@
// var $CloneTarget ;
function checkMultipleInput() {
$(".multipleInput").each(function() {
$(this).children('.controls').length==1 ? $(this).addClass("plural") : $(this).removeClass("plural")
});
}
function removeInput(){
$(".removeInput").click(function (){
$(this).parents(".controls").remove();
checkMultipleInput();
return false;
});
}
$(document).ready(function(){
var $modalNumber = 0;
checkMultipleInput();
removeInput();
$(".addinput").click(function (){
$modalNumber+=1;
var $CloneTarget = $(this).parents(".controls").prev(".multipleInput").children('.controls:last');
$(this).parents(".controls").prev(".multipleInput").append($CloneTarget.clone());
class_to_be_removed = $(this).parents(".controls").prev(".multipleInput").attr("ext_class")
// $(this).parents(".controls").prev(".multipleInput").children('.controls:last input').val("");
$(this).parents(".controls").prev(".multipleInput").children('.controls:last').find('input').val('')
$(this).parents(".controls").prev(".multipleInput").children('.controls:last').find('.tab-pane').removeClass(class_to_be_removed).addClass("NewInput_"+$modalNumber)
btn = $(this).parents(".controls").prev(".multipleInput").children('.controls:last').find(".nav.nav-pills li")
$.each(btn,function(i,value){
old_link = $(this).children("a").attr("href");
$(this).children("a").attr("href",".NewInput_"+$modalNumber);
});
removeInput();
checkMultipleInput();
return false;
})
});

View File

@ -2,6 +2,9 @@
//harry //harry
//Inititialize function will initialize desktop //Inititialize function will initialize desktop
//callback-method will be called after desktop controlled ajax call;
//container=true is the area where the view will be loaded
$.extend($.expr[':'], { $.extend($.expr[':'], {
'containsi': function (elem, i, match, array) { 'containsi': function (elem, i, match, array) {
@ -82,7 +85,7 @@ var orbitDesktop = function(dom){
$(".docklist a").click(function(){ $(".docklist a").click(function(){
var target = $(this).attr("id"); var target = $(this).attr("id");
var url = $(this).attr("href"); var url = $(this).attr("href");
o.data_method = $(this).attr("data-method"); o.data_method = $(this).attr("callback-method");
if(o.currenthtml!=target){ if(o.currenthtml!=target){
if(o.desktopData[o.currentface] == "undefined") if(o.desktopData[o.currentface] == "undefined")
o.desktopData[o.currentface] = ""; o.desktopData[o.currentface] = "";
@ -97,9 +100,11 @@ var orbitDesktop = function(dom){
if(o.data_method != "") if(o.data_method != "")
window.o[o.data_method](target,url,cache); window.o[o.data_method](target,url,cache);
} }
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"));
}); });
}else{ }else{
$(o.contentHolder).html(o.desktopData[o.currentface]); $(o.contentHolder).html(o.desktopData[o.currentface]);
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]").trigger("click"));
cache = true; cache = true;
if(typeof o.data_method != "undefined"){ if(typeof o.data_method != "undefined"){
if(o.data_method != "") if(o.data_method != "")
@ -110,32 +115,11 @@ var orbitDesktop = function(dom){
} }
return false; return false;
}) })
$('body').on({ $('body').on({
click: function(){ click: function(){
if(!$(this).hasClass('active')){ o.sub_menu_item($(this));
var sub_data_method = $(this).attr('data-method');
if(sub_data_method){
$("#panel_r").load($(this).attr("href"),function(){
// o.simple_drop_down();
// o.tinyscrollbar_ext({
// main: '.tinycanvas',
// fill: '.s_grid_con'
// })
if(typeof o.data_method != "undefined"){
if(o.data_method != ""){
if(typeof sub_data_method != "undefined"){
if(sub_data_method != ""){
window.o[o.data_method][sub_data_method]();
}
}
}
}
})
}
$('.s_menu a').removeClass('thmc1 thmtxt active');
$(this).addClass('thmc1 thmtxt active');
}
return false; return false;
}, },
mouseenter: function(){ mouseenter: function(){
@ -147,7 +131,23 @@ var orbitDesktop = function(dom){
var t = $(this).hasClass('active') ? '' : 'thmc1 thmtxt'; var t = $(this).hasClass('active') ? '' : 'thmc1 thmtxt';
$(this).switchClass(t,'admtxt',0); $(this).switchClass(t,'admtxt',0);
} }
},'.s_menu a'); },'*[content-type=menu] a');
$("body").on("submit","form[type=ajax_form]",function(){
var callback_method = $(this).attr("callback-method");
var options = {
success:function(responseText, statusText, xhr, $form){
if(typeof callback_method != "undefined"){
if(callback_method != ""){
window.o[o.data_method][callback_method](responseText,statusText,xhr,$form);
}
}
}
}
$(this).ajaxSubmit(options);
return false;
})
$(window).resize(function(){ $(window).resize(function(){
var ww = $(window).width(); var ww = $(window).width();
$("img#thmbackground").attr({"width":ww}); $("img#thmbackground").attr({"width":ww});
@ -171,6 +171,26 @@ var orbitDesktop = function(dom){
$fn_des.stop(true, true).fadeOut(); $fn_des.stop(true, true).fadeOut();
}); });
}; };
this.sub_menu_item = function(dom){
if(!dom.hasClass('active')){
var sub_data_method = dom.attr('callback-method');
if(sub_data_method){
$("div[container=true]").load(dom.attr("href"),function(){
if(typeof o.data_method != "undefined"){
if(o.data_method != ""){
if(typeof sub_data_method != "undefined"){
if(sub_data_method != ""){
window.o[o.data_method][sub_data_method]();
}
}
}
}
})
}
$('*[content-type=menu] a').removeClass('thmc1 thmtxt active');
dom.addClass('thmc1 thmtxt active');
}
}
this.initializeDesktop = function(target,url,cache){ //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";
@ -806,6 +826,14 @@ var orbitDesktop = function(dom){
}; };
this.initializeJournalPapers = function(target,url,cache){ // this init journal papers this.initializeJournalPapers = function(target,url,cache){ // this init journal papers
this.initializeJournalPapers.formCallback = function(data){
if(data.success){
o.notify(data.msg,"success");
o.sub_menu_item($("div[content-type=menu] a").eq(0));
}else{
o.notify(data.msg,"alert");
}
}
this.initializeJournalPapers.list = function(){ // to open list part in journal papers page this.initializeJournalPapers.list = function(){ // to open list part in journal papers page
var journalData; var journalData;
@ -817,7 +845,6 @@ var orbitDesktop = function(dom){
fill: '.list_t' fill: '.list_t'
}) })
$("#journal_selection_options a").click(function(){ $("#journal_selection_options a").click(function(){
switch($(this).attr("href")){ switch($(this).attr("href")){
case "all": case "all":
@ -849,10 +876,26 @@ var orbitDesktop = function(dom){
} }
return false; return false;
}) })
$("div[container=true]").on("click",".journal_paper_edit",function(){
$.ajax({
url : $(this).attr("href"),
type : "get",
success : function(data){
var prev_data = $("div[container=true]").html();
$("div[container=true]").html(data);
$(".bt-cancel").click(function(){
$("div[container=true]").html(prev_data);
})
}
})
return false;
})
} }
var bindSecondaryHandlers = function(){ var bindSecondaryHandlers = function(){
$("#journal_p div#paper_list a").click(function(){ $("#journal_p div#paper_list a.icon-check-empty").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")) {
@ -873,7 +916,7 @@ var orbitDesktop = function(dom){
li; li;
$.each(journalData,function(i,journal){ $.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){ $.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+journal.title+'</div><div class="list_t_des">'+paper.title+'</div></li>'); li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+journal.title+'</div><div class="list_t_des">'+paper.title+'</div><a class="journal_paper_edit" href="'+paper.url_edit+'">Edit</a></li>');
column.find("ul").append(li); column.find("ul").append(li);
if(counter%5==0){ if(counter%5==0){
$("#journal_p div#paper_list div.overview").append(column); $("#journal_p div#paper_list div.overview").append(column);
@ -902,6 +945,7 @@ var orbitDesktop = function(dom){
var img = $('<div class="list_t_des"><a href="'+file.url+'" target="_blank" ><img src="'+file.icon+'" />'+thistitle+'</a></div>'); var img = $('<div class="list_t_des"><a href="'+file.url+'" target="_blank" ><img src="'+file.icon+'" />'+thistitle+'</a></div>');
li.append(img); li.append(img);
}) })
li.append('<a class="journal_paper_edit" href="'+paper.url_edit+'">Edit</a>');
column.find("ul").append(li); column.find("ul").append(li);
if(counter%5==0){ if(counter%5==0){
$("#journal_p div#paper_list div.overview").append(column); $("#journal_p div#paper_list div.overview").append(column);
@ -920,7 +964,7 @@ var orbitDesktop = function(dom){
li; li;
$.each(journalData,function(i,journal){ $.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){ $.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des">'+paper.keywords+'</div></li>'); li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des">'+paper.keywords+'</div><a class="journal_paper_edit" href="'+paper.url_edit+'">Edit</a></li>');
column.find("ul").append(li); column.find("ul").append(li);
if(counter%5==0){ if(counter%5==0){
$("#journal_p div#paper_list div.overview").append(column); $("#journal_p div#paper_list div.overview").append(column);
@ -940,7 +984,7 @@ var orbitDesktop = function(dom){
li; li;
$.each(journalData,function(i,journal){ $.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){ $.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div></li>'); li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><a class="journal_paper_edit" href="'+paper.url_edit+'">Edit</a></li>');
column.find("ul").append(li); column.find("ul").append(li);
if(counter%5==0){ if(counter%5==0){
$("#journal_p div#paper_list div.overview").append(column); $("#journal_p div#paper_list div.overview").append(column);
@ -959,7 +1003,7 @@ var orbitDesktop = function(dom){
li; li;
$.each(journalData,function(i,journal){ $.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){ $.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item" style="height:auto;"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des">'+paper.abstract+'</div></li>'); li = $('<li class="list_t_item" style="height:auto;"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des">'+paper.abstract+'</div><a class="journal_paper_edit" href="'+paper.url_edit+'">Edit</a></li>');
column.find("ul").append(li); column.find("ul").append(li);
$("#journal_p div#paper_list div.overview").append(column); $("#journal_p div#paper_list div.overview").append(column);
column = $('<div class="g_col list_t"><ul></ul></div>'); column = $('<div class="g_col list_t"><ul></ul></div>');
@ -969,12 +1013,15 @@ var orbitDesktop = function(dom){
bindSecondaryHandlers(); bindSecondaryHandlers();
} }
var getData = function(){
$.getJSON("/desktop/journal_pages/get_journals_json",function(journals){ $.getJSON("/desktop/journal_pages/get_journals_json",function(journals){
journalData = eval(journals); journalData = eval(journals);
journalview(); journalview();
bindHandlers(); bindHandlers();
}) })
} }
getData();
}
this.initializeJournalPapers.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

View File

@ -280,7 +280,7 @@
margin-top: 8px; margin-top: 8px;
} }
.nav-tabs li a { .nav-tabs li a {
padding-right: 32px; /*padding-right: 32px;*/
} }
.user-role { .user-role {
@ -314,7 +314,8 @@
float: left; float: left;
} }
.role-block .nav-pills { .role-block .nav-pills {
margin-bottom: 0;g margin-bottom: 0;
margin-left: 10px;
} }
.role-block .nav-pills > li > a { .role-block .nav-pills > li > a {
margin-top: 0; margin-top: 0;
@ -345,7 +346,13 @@
-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 { .input-append > .active {
margin-bottom: 5px; display: inline-block;
margin-right: 10px; }
.input-append .active {
background-color: transparent;
border-color: transparent;
}
.language-swich .tab-pane {
/*margin-bottom: 5px;*/
} }

View File

@ -111,7 +111,7 @@
.role-block .form-horizontal .controls { .role-block .form-horizontal .controls {
margin-left: 120px; margin-left: 120px;
} }
.role-block .form-horizontal .controls>.input-append { .role-block .form-horizontal .controls .input-append {
margin-bottom: 10px; margin-bottom: 10px;
} }
.role-block .form-horizontal legend .onoff { .role-block .form-horizontal legend .onoff {

View File

@ -1,7 +1,7 @@
class Admin::AdBannersController < OrbitBackendController class Admin::AdBannersController < OrbitBackendController
layout "new_admin"
before_filter :force_order_for_visitor,:only=>[:index] before_filter :force_order_for_visitor,:only=>[:index]
#before_filter :force_order_for_user,:except => [:index] before_filter :force_order_for_user,:except => [:index]
before_filter :for_app_sub_manager,:except => [:index] before_filter :for_app_sub_manager,:except => [:index]
before_filter :for_app_manager,:except => [:index,:show,:update,:realtime_preview] before_filter :for_app_manager,:except => [:index,:show,:update,:realtime_preview]

View File

@ -1,7 +1,13 @@
class Admin::AdImagesController < OrbitBackendController class Admin::AdImagesController < Admin::AdBannersController
layout 'new_admin'
before_filter :authenticate_user! # before_filter :force_order_for_user
before_filter :for_app_sub_manager # before_filter :for_app_sub_manager
# before_filter :for_app_manager
def initialize
super
@app_title = "ad_banner"
end
def edit def edit
@ad_banner = AdBanner.find params[:ad_banner_id] @ad_banner = AdBanner.find params[:ad_banner_id]

View File

@ -52,7 +52,7 @@ class Admin::DesignsController < OrbitBackendController
case params[:type] case params[:type]
when 'layout', 'css_default', 'css_reset' when 'layout', 'css_default', 'css_reset'
@object = @design.send(params[:type]) @object = @design.send(params[:type])
when 'image', 'javascript', 'theme' when 'javascripts', 'themes'#, 'images'
@object = @design.send(params[:type]).find(params[:object_id]) @object = @design.send(params[:type]).find(params[:object_id])
end end

View File

@ -1,10 +1,4 @@
class Admin::LinksController < ApplicationController class Admin::LinksController < Admin::ItemsController
layout "site_editor"
before_filter :authenticate_user!
before_filter :find_parent_item
before_filter :is_admin?
def show def show
@item ||= Link.find(params[:id]) @item ||= Link.find(params[:id])

View File

@ -6,6 +6,8 @@ class Admin::PagePartsController < ApplicationController
before_filter :is_admin? before_filter :is_admin?
before_filter :set_current_item before_filter :set_current_item
helper 'admin/items'
def show def show
@part = PagePart.find(params[:id]) @part = PagePart.find(params[:id])
respond_to do |format| respond_to do |format|

View File

@ -1,11 +1,4 @@
class Admin::PagesController < ApplicationController class Admin::PagesController < Admin::ItemsController
layout "site_editor"
before_filter :authenticate_user!
before_filter :find_parent_item
before_filter :is_admin?
before_filter :set_current_item
def show def show
@item = Page.find(params[:id]) @item = Page.find(params[:id])
@ -40,7 +33,7 @@ class Admin::PagesController < ApplicationController
@frontend_path = @item.app_frontend_url ? @item.app_frontend_url : @module_app.widgets.keys[0] @frontend_path = @item.app_frontend_url ? @item.app_frontend_url : @module_app.widgets.keys[0]
if @module_app.widgets.any?{|b| b.class == Array} if @module_app && @module_app.widgets && @module_app.widgets.any?{|b| b.class == Array}
@frontend_style = @module_app.widgets[@frontend_path] if !@frontend_path.blank? && !@module_app.widgets.blank? @frontend_style = @module_app.widgets[@frontend_path] if !@frontend_path.blank? && !@module_app.widgets.blank?
end end

View File

@ -78,7 +78,7 @@ 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 # binding.pry
if @user.save if @user.save
flash[:notice] = t('create.success.user') flash[:notice] = t('create.success.user')
redirect_to :action => :index redirect_to :action => :index
@ -103,6 +103,7 @@ class Admin::UsersNewInterfaceController < ApplicationController
def update def update
@user = User.find(params[:id]) @user = User.find(params[:id])
@user.update_attributes(params[:user]) @user.update_attributes(params[:user])
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)

View File

@ -8,6 +8,8 @@ class ApplicationController < ActionController::Base
helper :admin helper :admin
before_filter :set_locale, :set_site before_filter :set_locale, :set_site
helper_attr :site_valid_locales
def set_current_user def set_current_user
User.current = current_or_guest_user User.current = current_or_guest_user
end end

View File

@ -21,6 +21,7 @@ class Desktop::JournalPagesController < ApplicationController
respond_to do |format| respond_to do |format|
format.html { render :layout => false} format.html { render :layout => false}
end end
end end
def edit def edit
@ -39,14 +40,19 @@ class Desktop::JournalPagesController < ApplicationController
@writing_journal = WritingJournal.new(params[:writing_journal]) @writing_journal = WritingJournal.new(params[:writing_journal])
if @writing_journal.save if @writing_journal.save
respond_to do |format| # respond_to do |format|
format.html { redirect_to desktop_journal_pages_url, :layout => false, notice: 'User was successfully created.'} # format.html { redirect_to desktop_journal_pages_url, :layout => false, notice: 'User was successfully created.'}
# format.json { render json: @writing_journal, status: :created, location: @writing_journal} # # format.json { render json: @writing_journal, status: :created, location: @writing_journal}
# format.js # # format.js
end # end
render :json => {"success"=>true,"msg"=>"Paper successfully saved!"}.to_json
else else
render :json => {"success"=>false,"msg"=>"Saving failed!"}
end end
end end
render :json => {"success"=>true,"msg"=>"Paper successfully saved!"}.to_json
end end
def update def update
@ -74,19 +80,19 @@ class Desktop::JournalPagesController < ApplicationController
if not file.nil? if not file.nil?
file_type = MIME::Types.type_for(file).first.to_s.split("/")[1] file_type = MIME::Types.type_for(file).first.to_s.split("/")[1]
case file_type # case file_type
when "jpg", "jpeg" # when "jpg", "jpeg"
type = "jpg" # type = "jpg"
when "text", "txt" # when "text", "txt"
type = "txt" # type = "txt"
when "pdf" # when "pdf"
type = "pdf" # type = "pdf"
when "png" # when "png"
type = "png" # type = "png"
else "readme" # else "readme"
end # end
file_type = "/assets/ft-icons/#{type}/#{type}-48_32.png" file_type = "/assets/ft-icons/#{file_type}/#{file_type}-48_32.png"
else else
file_type = "" file_type = ""
end end

View File

@ -11,7 +11,7 @@ class OrbitBackendController < ApplicationController
layout 'new_admin' layout 'new_admin'
def setup_vars def setup_vars
@app_title = controller_path.split('/')[1].singularize @app_title ||= controller_path.split('/')[1].singularize
@module_app ||= ModuleApp.first(conditions: {:key => @app_title} ) @module_app ||= ModuleApp.first(conditions: {:key => @app_title} )
end end

View File

@ -15,7 +15,10 @@ module ApplicationHelper
end end
def create_guest_user def create_guest_user
u = nil
User.without_callback(:create, :before, :initialize_desktop) do
u = User.create(:name => "guest", :email => "guest_#{Time.now.to_i}#{rand(99)}@example.com") u = User.create(:name => "guest", :email => "guest_#{Time.now.to_i}#{rand(99)}@example.com")
end
u.admin = false u.admin = false
u.save(:validate => false) u.save(:validate => false)
u u

View File

@ -1,12 +1,12 @@
#encoding: utf-8 #encoding: utf-8
# require ActionView::Helpers::FormTagHelper
module AttributeFieldsHelper module AttributeFieldsHelper
include ActionView::Helpers::FormTagHelper include ActionView::Helpers::FormTagHelper
include ActionView::Helpers::FormOptionsHelper include ActionView::Helpers::FormOptionsHelper
include ActionView::Helpers::DateHelper include ActionView::Helpers::DateHelper
include ActionView::Helpers::TagHelper include ActionView::Helpers::TagHelper
include ActionView::Helpers::RenderingHelper include ActionView::Helpers::RenderingHelper
include ActionView::Context
include OrbitBasis::RenderAnywhere
def block_helper(user,index,disable = false) def block_helper(user,index,disable = false)
unless self.disabled unless self.disabled
@ -28,37 +28,25 @@ 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 value = (can_muti_lang_input? ? @prefiled_value[key] : @prefiled_value) rescue nil
key_field = can_muti_lang_input? ? "[#{key}]" : ""
place_holder= @panel_setting["placeholder"][key] rescue ''
result = text_area_tag(get_field_name_base + key_field, value,@markup_options.merge({:placeholder=>place_holder,:for=>key}))
if(add_more and value.is_a?(Array)) add_ext= @attribute_value.address_ext[key] rescue {}
values = value
result << values.each_with_index.collect do |value,index|
text_field_tag(get_field_name_base + (key.nil? ? '' : "[#{key}][#{index}]"), value.last,@markup_options)
end.join.html_safe
else
result << text_field_tag(get_field_name_base + (key.nil? ? '' : "[#{key}]"), value,@markup_options)
end
result << ('<a href="#'+self.key+'-edit" class="btn" type="button" data-toggle="modal"><i class="icon-edit"></i></a>').html_safe result << hidden_field_tag(get_basic_field_name_base+"[address_ext][#{key}][county]",add_ext["county"],:class=>"county_#{key}")
result << '<a href="#" class="btn" type="button"><i class="icon-trash"></i></a>'.html_safe result << hidden_field_tag(get_basic_field_name_base+"[address_ext][#{key}][street_address]",add_ext["street_address"],:class=>"street_address_#{key}")
result << '</div>'.html_safe result << hidden_field_tag(get_basic_field_name_base+"[address_ext][#{key}][city]",add_ext["city"],:class=>"city_#{key}")
result << gen_modal_dialog result << hidden_field_tag(get_basic_field_name_base+"[address_ext][#{key}][zip]",add_ext["zip"],:class=>"zip_#{key}")
result << hidden_field_tag(get_basic_field_name_base+"[address_ext][#{key}][country]",add_ext["country"],:class=>"country_#{key}")
result << hidden_field_tag(get_basic_field_name_base+"[address_ext][#{key}][indicator]",add_ext["indicator"],:class=>"indicator_#{key}")
end end
end end
def render_checkbox def render_checkbox
@prefiled_value ||=[] @prefiled_value ||=[]
# 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
a = self[:option_list].collect do |key,value| a = self[:option_list].collect do |key,value|
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")) 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"))
@ -67,7 +55,6 @@ module AttributeFieldsHelper
end end
def render_date def render_date
#NP
control_group_wrapper{date_select(get_field_name_base,nil,@markup_options.merge(:default=>@prefiled_value),:class=>"input-small")} control_group_wrapper{date_select(get_field_name_base,nil,@markup_options.merge(:default=>@prefiled_value),:class=>"input-small")}
end end
@ -77,13 +64,6 @@ module AttributeFieldsHelper
def render_radio_button def render_radio_button
@prefiled_value ||=[] @prefiled_value ||=[]
# 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
self[:option_list].collect do |key,value| self[:option_list].collect do |key,value|
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")) 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"))
@ -92,106 +72,148 @@ module AttributeFieldsHelper
end end
def render_select def render_select
prompt = @panel_setting["initial"][I18n.locale.to_s] rescue nil
prompt = @panel_setting[:prompt][I18n.locale] rescue nil
@markup_options.merge!(:prompt => prompt) unless prompt.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 "" 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
control_group_wrapper do |key,value| control_group_wrapper do |key,value|
if(add_more and value.is_a?(Hash)) value = can_muti_lang_input? ? @prefiled_value[key] : @prefiled_value
values = value key = can_muti_lang_input? ? "[#{key}]" : ""
values.each_with_index.collect do |value,index|
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
else
value = can_muti_lang_input ? @prefiled_value[key] : @prefiled_value
key = can_muti_lang_input ? "[#{key}]" : ""
place_holder= @panel_setting["placeholder"][I18n.locale.to_s] rescue '' 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)) text_area_tag(get_field_name_base + key, value,@markup_options.merge(:placeholder=>place_holder))
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) add_more_blank = can_add_more ? "[]" : ""
values = value key_field = can_muti_lang_input? ? "[#{key}]" : ""
result = ""
unless values.nil?
result = values.each_with_index.collect do |value,index|
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
value = (can_muti_lang_input ? @prefiled_value[key] : @prefiled_value) rescue nil
key_field = can_muti_lang_input ? "[#{key}]" : ""
place_holder= @panel_setting["placeholder"][key] rescue '' place_holder= @panel_setting["placeholder"][key] rescue ''
text_field_tag(get_field_name_base + key_field, value,@markup_options.merge(:placeholder=>place_holder)) text_field_tag([get_field_name_base,add_more_blank,key_field].join, value,@markup_options.merge(:placeholder=>place_holder))
end
end end
end end
protected protected
def lang_panel_control_wrapper(&block)
result = '<div class="tabbable">'
result << '<div class="tab-content">'
result << controls_wrapper{yield}
result << '</div>'
result << '</div>'
result.html_safe
end
def controls_wrapper(&block) def lang_panel_tabbable_wrapper(add_more_params,&block)
result = "<div class='controls'>" add_more_counter = ''
if can_muti_lang_input content_tag :div,:class=>"tabbable" do
result << "<div class='tabbable'>" tmp = content_tag :div,:class=> (add_more || self.markup=='address') ? "tab-content input-append" : "tab-content" do
result << "<div class='tab-content'>" buff = VALID_LOCALES.collect do |key|
value = @prefiled_value[key] rescue nil
div_class_ary = ["tab-pane" ,"fade",key,get_pairing_tab_class({})]
VALID_LOCALES.collect do |key|
value = @prefiled_value[key.to_s] rescue nil
div_class = ["tab-pane" ,"fade"].join(" ")
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}")
end
result << "</div>"
result << "<ul class='nav nav-pills'>"
VALID_LOCALES.each do |key|
result << content_tag(:li,link_to(I18n.t(:_locale, :locale => key),"#tab"+id.to_s+"_#{key}",:data=>{:toggle=>"tab"}),:class=>(key == I18n.locale.to_s ? "active" : nil))
end
result << "</ul>"
result << "</div>"
# @prefiled_value.collect do |key,value|
# result << yield(key,value)
# end
else
result << yield
end
if can_add_more if can_add_more
result << '<span class="help-block">' add_more_value = add_more_params[0][:value]
result << '<a href="#"><i class="icon-plus-sign"></i> Add</a>' add_more_counter = add_more_params[0][:counter]
result << '</span>' value = add_more_value[key] rescue nil
div_class_ary << "add_more_item_#{add_more_counter}"
end end
result << "</div>"
div_class = div_class_ary.join(" ")
div_class << (key == I18n.locale.to_s ? " active in" : '')
content_tag(:div,yield(key,value),:class=>div_class)
end# of VALID_LOCALES.collect for tabed input
buff << link_to((content_tag :i,'',:class=>'icon-edit'),"##{get_pairing_tab_class({})}_m_window",:class=>'btn edit-btn',:type=>'button',:data=>{:toggle=>"modal"}) if self.markup == 'address'
buff << link_to((content_tag :i,'',:class=>'icon-trash'),"#") if self.add_more
# buff << '<a href="#" class="btn removeInput" type="button"><i class="icon-trash"></i></a>' if self.add_more
buff.join("\n").html_safe
end
tmp << content_tag(:ul,:class=> 'nav nav-pills') do
VALID_LOCALES.each.collect do |key|
# link_entry = self.add_more ? "#{add_more_tab(:tab_btn,loop_counter,key)}" : "#tab"+id.to_s+"_#{key}"
link_entry_ary = [".#{get_pairing_tab_class({})}",".#{key}"]
# link_entry_ary << ".add_more_item_#{add_more_counter}" if can_add_more
link_entry = link_entry_ary.join
content_tag(:li,link_to(I18n.t("langs."+key),link_entry,:data=>{:toggle=>"tab"}),:class=>(key == I18n.locale.to_s ? "active" : nil),:for=>key)
end.join.html_safe # of VALID_LOCALES.collect for tabs
end # of content ul
end
end
def controls_wrapper(*add_more_params,&block)
content_tag :div,:class=>'controls' do
result = ''
add_more_counter = ""
if can_add_more
add_more_counter = add_more_params[0][:counter]
add_more_value = add_more_params[0][:value]
end
if can_muti_lang_input?
result << lang_panel_tabbable_wrapper(add_more_params,&block)
result << gen_modal_dialog if self.markup == "address"
else
value = case can_add_more
when true
add_more_params[0]
else
@prefiled_value
end
result << yield(nil,value)
end
result.html_safe result.html_safe
end end # of controls div
end # of def controls_wrapper(&block)
def control_group_wrapper(&block) def control_group_wrapper(&block)
div_class = can_muti_lang_input ? "control-group language-swich" : "control-group" div_class = can_muti_lang_input? ? "control-group language-swich" : "control-group"
result =""
case self.markup
when "text_field"
if can_add_more
multipleInput_ary = %w{multipleInput editMore}
add_more_seri = "add_more_group_#{id}"
multipleInputs = content_tag :div,:class=> multipleInput_ary.join(' ') ,:ext_class=>get_pairing_tab_class({}) do
@attribute_value.add_more_counter.times.collect do |t|
controls_wrapper(:value=>(@prefiled_value[t] rescue nil),:counter=>t,&block)
end.join("\n").html_safe # of add_more fields
end # of div multipleInput editMore
result = label + multipleInputs + add_more_unt
# result = label + 一堆的輸入框(要用 multipleInput editMore 包起來) + add_more btn + hidden_fields
else
temp = label + controls_wrapper(&block) temp = label + controls_wrapper(&block)
result = content_tag(:div,temp,:class=>div_class) result = content_tag(:div,temp,:class=>div_class)
result << end_block end
when "address"
address = content_tag :div,:class=>"multipleInput editMore" do
controls_wrapper(&block)
end # of div multipleInput editMore
result = label + address
else
temp = label + controls_wrapper(&block)
result = content_tag(:div,temp,:class=>div_class)
end
result << end_block
result.html_safe result.html_safe
end end
def add_more_unt
temp_field_name = get_basic_field_name_base + '[temp]'
add_more = content_tag :div,:class=> 'controls' do
content_tag :span,:class=> 'help-block' do
content = link_to (content_tag :i,I18n.t("admin.infos.add"),:class=>"icon-plus-sign"),"#",:class=>'addinput'
content << hidden_field_tag("#{temp_field_name}[count]",@attribute_value.add_more_counter ,:class=>"list_count")
content << hidden_field_tag("#{temp_field_name}[count]",get_basic_field_name_base,:class=>"field_name")
content
end # of span
end # of div
end
def end_block def end_block
if @new_attribute if @new_attribute
hidden_field_tag(get_basic_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}")
@ -200,6 +222,23 @@ protected
end end
end end
def add_more_tab(mode,counter,key)
case mode
when :input_field
get_pairing_tab_class(:suffix=>['','tab'+counter.to_s,key].join('-'))
when :tab_btn
".#{get_pairing_tab_class(:suffix=>['','tab'+counter.to_s,key].join('-'))}"
end
end
def get_pairing_tab_class(opts)
prefix = opts[:prefix]
suffix = opts[:suffix]
str = get_basic_field_name_base.gsub("[","-").gsub("]",'')
str = prefix.nil? ? str : prefix+ str
suffix.nil? ? str : str + suffix
end
def get_basic_field_name_base def get_basic_field_name_base
if @new_attribute if @new_attribute
"user[new_attribute_values][#{@index}]" "user[new_attribute_values][#{@index}]"
@ -216,36 +255,30 @@ protected
label_tag(key,title,:class=>"control-label",:func => "field_label") label_tag(key,title,:class=>"control-label",:func => "field_label")
end end
def can_muti_lang_input def can_muti_lang_input?
LIST[:markups][markup]["muti_lang_input_supprt"] #and locale if self.markup == "address"
return true
else
LIST[:markups][markup]["muti_lang_input_supprt"] and !(get_data["cross_lang"] == "true")
end
end end
def can_add_more def can_add_more
if self.markup == "address"
return false
else
locale and LIST[:markups][markup]["ext_support"] && add_more locale and LIST[:markups][markup]["ext_support"] && add_more
end end
end
def render_anywhere(partial, assigns) def gen_modal_dialog
view = ActionView::Base.new(Rails::Configuration.new.view_path, assigns) render_anywhere("shared/attribute_field/address_modal_dialog",{
ActionView::Base.helper_modules.each { |helper| view.extend helper } :field_name=>title,
view.extend ApplicationHelper :html_id=>"#{get_pairing_tab_class({})}_m_window",
view.render(:partial => partial) :btn_class => "#{get_pairing_tab_class({})}",
end :field_name_basic => get_basic_field_name_base
}
def gen_modal_dialog )
result = '<div class="modal hide fade" id="address-edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none; ">' end
result << '<div class="modal-header">'
result << '<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>'
result << '<h3 id="myModalLabel">'+title+'</h3>'
result << '</div>'
result << '<div class="modal-body">'
result << '<p>One fine body…</p>'
result << '</div>'
result << '<div class="modal-footer">'
result << '<button class="btn" data-dismiss="modal" aria-hidden="true">'+I18n.t("modal.close")+'</button>'
result << '<button class="btn btn-primary">'+I18n.t("modal.save_and_close")+'</button>'
result << '</div>'
result << '</div>'
result.html_safe
end
end end

View File

@ -0,0 +1,68 @@
module AttributeValuesHelper
def show_west_calender
date = get_date
case self.attribute_field["typeC"]["format"]
when 'format1' # Y/M/D h:m
date.strftime("%Y/%m/%d %H:%M")
when 'format2' # Y/M/D
date.strftime("%Y/%m/%d")
when 'format3' # Y/M
date.strftime("%Y/%m")
when 'format4' # Y
date.strftime("%Y")
end # of case west cal format
end
def show_minguo_calendar
get_minguo
date = get_date
year_str = ""
unless date.year == 1912
m_year = (date.year - 1912).abs.to_s + I18n.t("admin.infos.date.minguo_calendar.year")
year_str = minguo_format_year(m_year)
end
get_minguo_year + minguo_m_y_d_time
end
def get_minguo_year
date = get_date
m_year = (date.year - 1911).abs
year_end = I18n.t("admin.infos.date.minguo_calendar.year")
case
when date.year <1912
I18n.t("admin.infos.date.minguo_calendar.before") + (m_year+1).to_s + year_end
when date.year ==1912
I18n.t("admin.infos.date.minguo_calendar.first_year")
when date.year >1912
I18n.t("admin.infos.date.minguo_calendar.after")+ (m_year).to_s + year_end
end # of case tw_claendar year
end
def minguo_m_y_d_time
date = get_date
case self.attribute_field["typeC"]["format"]
when 'format1' # Y/M/D h:m
date.strftime(" %m/%d %H:%M")
when 'format2' # Y/M/D
date.strftime(" %m/%d")
when 'format3' # Y/M
date.strftime(" %m#{I18n.t("admin.infos.date.minguo_calendar.month")}")
when 'format4' # Y
''
end # of case
end
def get_date_by_format
case I18n.locale
when :zh_tw
case
when self.attribute_field["typeC"]["claendar"] == "west_claendar"
show_west_calender
when self.attribute_field["typeC"]["claendar"] == "tw_claendar"
show_minguo_calendar
end #case self.attribute_field["typeC"]["claendar"]
when :en
show_west_calender
end
end
end

View File

@ -11,10 +11,10 @@ class Design
has_one :css_default, as: :css, :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,as: :imgs, :autosave => true, :dependent => :destroy has_many :images, as: :imgs, :autosave => true, :dependent => :destroy
has_many :javascripts, as: :js, :autosave => true, :dependent => :destroy has_many :javascripts, as: :js, :autosave => true, :dependent => :destroy
has_many :pages has_many :pages
has_many :themes, as: :css, :autosave => true, :dependent => :destroy has_many :themes, :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

View File

@ -7,7 +7,12 @@ class Stylesheet < DesignFile
# self.remove_file! # self.remove_file!
# self.remove_file_orig! # self.remove_file_orig!
names = {} names = {}
case self._type
when 'Theme'
images = self.design.images
when 'CssDefault'
images = self.css.images images = self.css.images
end
content.scan(/(?<=url)(.*?)(?=\))/){ content.scan(/(?<=url)(.*?)(?=\))/){
css_name = $1.gsub(' ','').gsub('(','') css_name = $1.gsub(' ','').gsub('(','')
unless names.has_key?(css_name) unless names.has_key?(css_name)

View File

@ -1,6 +1,6 @@
class Theme < Stylesheet class Theme < Stylesheet
belongs_to :css, polymorphic: true belongs_to :design
protected protected

View File

@ -1,5 +1,4 @@
class AttributeField class AttributeField
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
include ::AttributeFieldsHelper include ::AttributeFieldsHelper
@ -8,28 +7,24 @@ class AttributeField
field :markup ,:default=>"text_field" field :markup ,:default=>"text_field"
field :option_list ,:type => Hash,:default => {} field :option_list ,:type => Hash,:default => {}
field :markup_options,:type => Hash field :markup_options,:type => Hash
# field :locale, :type => Boolean, :default => true
# 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 :to_delete,:type=> Boolean,:default => false field :to_delete,:type=> Boolean,:default => false
field :typeA,:type=> Hash,:default=>{} field :typeA,:type=> Hash,:default=>{:cross_lang=>false}
field :typeB,:type=> Hash,:default=>{} field :typeB,:type=> Hash,:default=>{}
field :typeC,:type=> Hash,:default=>{:claendar=>"west_claendar"} field :typeC,:type=> Hash,:default=>{:claendar=>"west_claendar",:format=>"format3"}
field :typeD,:type=> Hash,:default=>{} field :typeD,:type=> Hash,:default=>{:cross_lang=>false}
field :typeE,:type=> Hash,:default=>{} field :typeE,:type=> Hash,:default=>{}
#field :title, localize: true
field :title, localize: true field :title, localize: true
belongs_to :attribute belongs_to :attribute
# belongs_to :role
has_many :attribute_values,:autosave => true, :dependent => :destroy has_many :attribute_values,:autosave => true, :dependent => :destroy
before_save :check_option_list before_save :check_option_list
# validates_uniqueness_of :key
def markup_value
get_data["option_list"]
end
def add_more def add_more
(get_data["add_more"] == "true" ? true : false) rescue false (get_data["add_more"] == "true" ? true : false) rescue false
end end
@ -47,12 +42,6 @@ class AttributeField
(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
end end
def markup_value=(var)
if !self_defined_markup_options?
self[:markup_value] = (eval(var) rescue {})
end
end
def option_list 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
@ -66,8 +55,6 @@ class AttributeField
end end
end end
def markup_options=(var) def markup_options=(var)
self[:markup_options] = (eval(var) rescue {}) self[:markup_options] = (eval(var) rescue {})
end end
@ -94,50 +81,17 @@ class AttributeField
end end
# def title_translations
# if locale
# return self.locale_title_translations
# else
# return self[:neutral_title] #Hash[VALID_LOCALES.map{|d| [d,neutral_title]}]
# end
# end
# def title_translations=(var) def typeA=(var)
# if locale check_add_more_convert(var)
# self.locale_title_translations = var check_cross_lang_convert(var,"typeA")
# end self["typeA"] = var
# end end
# def title def typeD=(var)
# if locale check_cross_lang_convert(var,"typeD")
# return self.locale_title self["typeD"] = var
# else end
# 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
# def select_list_options=(var)
# self.list_options = var.gsub(' ', '').split(',')
# end
# # Convert the array list_options into a string
# def select_list_options
# self.list_options.to_a.join(', ')
# end
def is_built_in? def is_built_in?
self.built_in self.built_in
@ -149,7 +103,82 @@ class AttributeField
protected protected
def check_option_list def check_option_list
self[:option_list] = self[panel]["option_list"] self[:option_list] = self[panel]["option_list"] rescue nil
end
def add_more_convert(opt)
case opt
when :to_add_more
self.attribute_values.each do |av|
VALID_LOCALES.each do |loc|
splited_str = av[loc].split(",") rescue []
av["val"] = [] if av["val"].nil?
splited_str.each_with_index{|value,index| av["val"][index] = av["val"][index].nil? ? {loc=>value} : av["val"][index].merge(loc=>value) }
end
av.unset_all_lang_values
av.save
end #of self.attribute_values.each
when :to_no_add_more
self.attribute_values.each do |av|
VALID_LOCALES.each do |loc|
if av["val"].kind_of? Array
av[loc] = av["val"].collect{|t| t[loc]}.join(",")
else
av[loc] = av["val"]
end
end
av.unset("val")
av.save
end #of self.attribute_values.each
end
end
def cross_lang_convert(opt)
case opt
when :to_cross_lang
self.attribute_values.each do |av|
if add_more
av["val"] = av["val"].collect{|t| t.invert.keys.join(",")}
else
av["val"] = VALID_LOCALES.collect{|t| av[t]}.join(",")
av.unset_all_lang_values
end
av.save
end #of self.attribute_values.each
when :to_no_cross_lang
default_locale = I18n.default_locale.to_s
self.attribute_values.each do |av|
if add_more
av["val"] = av["val"].collect{|t| {default_locale => t} } #unless av["val"].nil?
else
av[default_locale] = av["val"]
av.unset("val")
end
av.save
end #of self.attribute_values.each
end
end
def check_add_more_convert(var)
if self["typeA"]["add_more"] != var["add_more"]
case var["add_more"]
when "true" #from no-add_more to add_more
add_more_convert(:to_add_more)
else #from add_more to no-add_more
add_more_convert(:to_no_add_more)
end # of case
end # of if
end
def check_cross_lang_convert(var,field)
if self[field]["cross_lang"] != var["cross_lang"]
case var["cross_lang"]
when "true" #from no-add_more to add_more
cross_lang_convert(:to_cross_lang)
else #from add_more to no-add_more
cross_lang_convert(:to_no_cross_lang)
end # of case
end # of if
end end
end end

View File

@ -1,11 +1,12 @@
class AttributeValue class AttributeValue
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes include Mongoid::MultiParameterAttributes
include AttributeValuesHelper
field :key field :key
field :address_ext
belongs_to :attribute_field belongs_to :attribute_field
belongs_to :user belongs_to :user
@ -14,51 +15,109 @@ class AttributeValue
# 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 def add_more_counter
# binding.pry if self.attribute_field.markup == 'radio_button' index_max = self["val"].count rescue 0
# if self.attribute_field index_max == 0 ? 1 : index_max
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 end
def value def value(index = nil)
result = case self.attribute_field.markup
result="" when 'text_field','text_area'
if self.attribute_field.locale && (self.attribute_field.markup == "text_field" || self.attribute_field.markup == "text_area") if self.attribute_field.add_more and (self.attribute_field.markup == "text_field")
result= Hash[VALID_LOCALES.collect{|lang| [lang,self[lang.to_sym]]}] index.nil? ? self["val"] : self["val"][index]
# self.attribute_field.get_data[:cross_lang] ? Hash[VALID_LOCALES.collect{|lang| [lang,self[lang.to_sym]]}] : self["val"] #if !self.attribute_field.get_data[:cross_lang]
else else
result = self["val"] self.attribute_field.get_data["cross_lang"] =="true" ? self["val"] : Hash[VALID_LOCALES.collect{|lang| [lang,self[lang.to_sym]]}]
end end
result when 'select','date','radio_button','address'
self["val"]
when 'checkbox'
self["val"]
end #end of case self.attribute_field.markup
end end
def value=(value) def value=(value)
#save everything to temp_data waiting for futher process #save everything to temp_data waiting for futher process
# binding
self[:temp_data] = value self[:temp_data] = value
end end
def get_value_by_locale(locale,add_more_index=nil)
case self.attribute_field.markup
when "text_field"
case self.attribute_field.add_more
when true
add_more_index.nil? ? self.value.collect{|t| t[locale]}.join(",") : self.value(add_more_index)[locale]
when false
self.attribute_field.locale ? self[locale.to_s] : self.value
end
when "select"
markup_values = self.attribute_field.self_defined_markup_options? ? self.attribute_field.markup_value : self.attribute_field.markup_value
markup_values[self.value][locale.to_s] rescue 'NoData'
when "text_area"
self.attribute_field.locale ? self[locale.to_s] : self.value
when "date"
get_date_by_format
when "address"
self.value[locale.to_s]
when "radio_button"
markup_values = self.attribute_field.markup_value
markup_values[self.value][locale.to_s]
when "checkbox"
markup_values = self.attribute_field.markup_value
self.value.collect{|key| markup_values[key][locale.to_s]}.join(",")
when "date_durnation"
self.value
else
self.attribute_field.locale ? self[locale.to_s] : self.value
end
end
protected
def unset_all_lang_values
VALID_LOCALES.each{|t| self.unset t}
end
def data_proc
unless self[:temp_data].nil?
case self.attribute_field.markup
when "address"
self["val"] = self["temp_data"]
when 'text_field','text_area'
if self.attribute_field.add_more
self["val"] = self["temp_data"]
else # if not add_more
if self.attribute_field.can_muti_lang_input?
self[:temp_data].each do |key,val|
self[key] = val
end if(!self.attribute_field.get_data[:cross_lang])
else
self["val"] = self[:temp_data]
end
end # of self.attribute_field.add_more
when 'select','date','radio_button'
self["val"] = self[:temp_data]
when 'checkbox'
self["val"] = self[:temp_data].keys
end #end of case self.attribute_field.markup
end # of self[:temp_data].nil?
self.unset('temp_data')
self.unset('temp')
end #of data_proc
def check_key def check_key
self.key = attribute_field.key self.key = attribute_field.key
end end
@ -71,47 +130,9 @@ class AttributeValue
end end
end end
def get_value_by_locale(locale)
case self.attribute_field.markup def get_date
when "text_field"
self.attribute_field.locale ? self[locale.to_s] : self.value
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.value][locale.to_s] rescue 'NoData'
when "text_area"
self.attribute_field.locale ? self[locale.to_s] : self.value
when "date"
Date.new(self[:val]["(1i)"].to_i,self[:val]["(2i)"].to_i,self[:val]["(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"
self.value
when "radio_button"
markup_values = eval(self.attribute_field.markup_value)
markup_values[:value][locale.to_s]
when "checkbox"
markup_values = self.attribute_field.markup_value
self[:value].keys.collect{|key| markup_values[key][locale.to_s]}.join(",")
when "date_durnation"
self.value
else
self.attribute_field.locale ? self[locale.to_s] : self.value
end end
end
# def get_values
# 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"]
# return Hash[VALID_LOCALES.collect{|lang| [lang,get_value_by_locale(lang.to_sym)]}]
# else
# return get_value_by_locale("")
# end
# else
# if self.attribute_field.markup == "select"
# self[:value]
# else
# self[:value].keys rescue self[:value]
# end
# end
# end
end end

View File

@ -42,14 +42,6 @@
var NewNode; var NewNode;
$(document).ready(function(){ $(document).ready(function(){
// function mas(){
// $('.site-map').masonry({
// itemSelector: '.map-block',
// columnWidth: 450,
// isAnimated: true
// });
// }
function checkSwitch() { function checkSwitch() {
$(".groups").addClass('disabled').has('.groups > .form-horizontal > div:not(.hide)').removeClass('disabled'); $(".groups").addClass('disabled').has('.groups > .form-horizontal > div:not(.hide)').removeClass('disabled');
} }

View File

@ -34,10 +34,10 @@
<div class="tab-pane" id="css_default"><%= render :partial => 'tab_form', :locals => {:type => :css_default, :object => @design.css_default} %></div> <div class="tab-pane" id="css_default"><%= render :partial => 'tab_form', :locals => {:type => :css_default, :object => @design.css_default} %></div>
<div class="tab-pane" id="css_reset"><%= render :partial => 'tab_form', :locals => {:type => :css_reset, :object => @design.css_reset} %></div> <div class="tab-pane" id="css_reset"><%= render :partial => 'tab_form', :locals => {:type => :css_reset, :object => @design.css_reset} %></div>
<% @design.themes.each do |theme| %> <% @design.themes.each do |theme| %>
<div class="tab-pane" id="<%= dom_id theme %>"><%= render :partial => 'tab_form', :locals => {:type => :css_reset, :object => theme} %></div> <div class="tab-pane" id="<%= dom_id theme %>"><%= render :partial => 'tab_form', :locals => {:type => :themes, :object => theme} %></div>
<% end %> <% end %>
<% @design.javascripts.each do |js| %> <% @design.javascripts.each do |js| %>
<div class="tab-pane" id="<%= dom_id js %>"><%= render :partial => 'tab_form', :locals => {:type => :css_reset, :object => js} %></div> <div class="tab-pane" id="<%= dom_id js %>"><%= render :partial => 'tab_form', :locals => {:type => :javascripts, :object => js} %></div>
<% end %> <% end %>
<div class="tab-pane" id="images"><%= render :partial => 'images' %></div> <div class="tab-pane" id="images"><%= render :partial => 'images' %></div>
</div> </div>

View File

@ -33,8 +33,8 @@
<label class="control-label"><%= t("admin.infos.options")%></label> <label class="control-label"><%= t("admin.infos.options")%></label>
<div class="controls"> <div class="controls">
<label class="checkbox inline"> <label class="checkbox inline">
<%= check_box_tag("info[attribute_fields][#{attribute_field_counter}][typeA][multilingual]","true",attribute_field["typeA"]["multilingual"]) %> <%= check_box_tag("info[attribute_fields][#{attribute_field_counter}][typeA][cross_lang]","true",attribute_field["typeA"]["cross_lang"]) %>
<%= t("admin.infos.multilingual")%> <%= t("admin.infos.cross_lang")%>
</label> </label>
<label class="checkbox inline"> <label class="checkbox inline">
<%= check_box_tag("info[attribute_fields][#{attribute_field_counter}][typeA][add_more]","true",attribute_field["typeA"]["add_more"]) %> <%= check_box_tag("info[attribute_fields][#{attribute_field_counter}][typeA][add_more]","true",attribute_field["typeA"]["add_more"]) %>
@ -48,7 +48,12 @@
<%= content_tag :div,:class=>show_type_panel(attribute_field,"typeB") do %> <%= content_tag :div,:class=>show_type_panel(attribute_field,"typeB") do %>
<%= render :partial=> "placeholder_block",:locals=>{:label_ext=>t("admin.infos.initial"),:values=>attribute_field["typeB"]["initial"],:field_name=>"info[attribute_fields][#{attribute_field_counter}][typeB][initial]"}%> <%= render :partial=> "placeholder_block",:locals=>{:label_ext=>t("admin.infos.initial"),:values=>attribute_field["typeB"]["initial"],:field_name=>"info[attribute_fields][#{attribute_field_counter}][typeB][initial]"}%>
<% if attribute_field.self_defined_markup_options?%>
<%= render :partial=>"list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "info[attribute_fields][#{attribute_field_counter}][attribute][role][statuses]"} %>
<%else #normal list%>
<%= render :partial=>"list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "info[attribute_fields][#{attribute_field_counter}][typeB][option_list]"} %> <%= render :partial=>"list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "info[attribute_fields][#{attribute_field_counter}][typeB][option_list]"} %>
<% end #of self_defined_markup_options?%>
<% end %> <% end %>
<%= content_tag :div,:class=>show_type_panel(attribute_field,"typeC") do %> <%= content_tag :div,:class=>show_type_panel(attribute_field,"typeC") do %>
<div class="control-group"> <div class="control-group">
@ -85,8 +90,8 @@
<label class="control-label"><%= t("admin.infos.options")%></label> <label class="control-label"><%= t("admin.infos.options")%></label>
<div class="controls"> <div class="controls">
<label class="checkbox inline"> <label class="checkbox inline">
<%= check_box_tag("info[attribute_fields][#{attribute_field_counter}][typeD][multilingual]","true",attribute_field["typeD"]["multilingual"]) %> <%= check_box_tag("info[attribute_fields][#{attribute_field_counter}][typeD][cross_lang]","true",attribute_field["typeD"]["cross_lang"]) %>
<%= t("admin.infos.multilingual")%> <%= t("admin.infos.cross_lang")%>
</label> </label>
</div> </div>
</div> </div>

View File

@ -31,8 +31,8 @@
<table id='attributes' border="0" cellspacing="0" cellpadding="0"> <table id='attributes' border="0" cellspacing="0" cellpadding="0">
<thead class="list_head"> <thead class="list_head">
<tr> <tr>
<td><%= t(:key) %></td> <td><%= t('admin.key') %></td>
<td><%= t(:multilingual) %></td> <td><%= t('admin.cross_lang') %></td>
<% @site_valid_locales.each do |locale| %> <% @site_valid_locales.each do |locale| %>
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td> <td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
<% end %> <% end %>

View File

@ -1,5 +1,5 @@
$('#app_page_url').html("<%= escape_javascript(select 'page', 'app_frontend_url', @module_app.app_pages) %>"); $('#app_page_url').html("<%= escape_javascript(select 'page', 'app_frontend_url', @module_app.app_pages) %>");
$('#app_page_frontend_style').html("<%= escape_javascript(select 'page', 'frontend_style', @module_app.widgets[@frontend_path]) if !@frontend_path.blank? %>"); $('#app_page_frontend_style').html("<%= escape_javascript(select 'page', 'frontend_style', @module_app.widgets[@frontend_path]) if !@frontend_path.blank? %>");
$('#app_page_category').html("<%= j (select 'page', 'category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, {:include_blank => true}) if @categories %>"); $('#app_page_category').html("<%= j (select 'page', 'category', @categories.collect{|category| [category.title, category.id]}, {:include_blank => true}) if @categories %>");
$('#app_page_tag').html("<%= j (select 'page', 'tag', @tags.collect{|tag| [tag[I18n.locale], tag.id]}, {:include_blank => true}) if @tags %>"); $('#app_page_tag').html("<%= j (select 'page', 'tag', @tags.collect{|tag| [tag[I18n.locale], tag.id]}, {:include_blank => true}) if @tags %>");
$('#app_page_frontend_field').html("<%= j render '../admin/pages/frontend_fields' %>") $('#app_page_frontend_field').html("<%= j render '../admin/pages/frontend_fields' %>")

View File

@ -1,4 +1,4 @@
<%= flash_messages %> <%#= flash_messages %>
<div id="poststuff"> <div id="poststuff">
<h1><%= t('editing.page') %></h1> <h1><%= t('editing.page') %></h1>
<%= form_for @item, :url => admin_page_path(@item), :html => { :class => 'form-horizontal edit_page' } do |f| %> <%= form_for @item, :url => admin_page_path(@item), :html => { :class => 'form-horizontal edit_page' } do |f| %>

View File

@ -1,4 +1,4 @@
<%= flash_messages %> <%#= flash_messages %>
<div id="poststuff"> <div id="poststuff">
<h1><%= t('new.page') %></h1> <h1><%= t('new.page') %></h1>
<%= form_for @item, :url => admin_pages_path, :html => { :class => 'form-horizontal edit_page' } do |f| %> <%= form_for @item, :url => admin_pages_path, :html => { :class => 'form-horizontal edit_page' } do |f| %>

View File

@ -1,4 +1,4 @@
<%= flash_messages %> <%#= flash_messages %>
<%= page_stylesheets(@item, true).html_safe %> <%= page_stylesheets(@item, true).html_safe %>

View File

@ -1,3 +1,3 @@
$('#back_sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>");
$('#back_main').html("<%= escape_javascript(render(:partial => 'admin/pages/show')) %>"); $('#back_main').html("<%= escape_javascript(render(:partial => 'admin/pages/show')) %>");
$('#back_sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>");
history.pushState(null, document.title, "<%= escape_javascript(admin_page_url(@item)) %>"); history.pushState(null, document.title, "<%= escape_javascript(admin_page_url(@item)) %>");

View File

@ -1,2 +1,3 @@
$('#back_main').html("<%= escape_javascript(render(:partial => 'admin/pages/show')) %>"); $('#back_main').html("<%= escape_javascript(render(:partial => 'admin/pages/show')) %>");
$('#back_sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>");
history.pushState(null, document.title, "<%= escape_javascript(admin_page_url(@item)) %>"); history.pushState(null, document.title, "<%= escape_javascript(admin_page_url(@item)) %>");

View File

@ -17,91 +17,3 @@
<%= render :partial=>"infos"%> <%= render :partial=>"infos"%>
<%= render :partial=>"roles"%> <%= render :partial=>"roles"%>
<% content_for :page_specific_javascript do -%>
<script>
// $('.site-map').masonry({
// itemSelector: '.map-block',
// columnWidth: 450,
// isAnimated: true
// });
$(document).ready(function(){
function subrole_disable_field( triggled_object, switch_value_str){
var switch_field = triggled_object.attr("for");
$("input.subrole_disable_field[for="+switch_field+"]").val(switch_value_str)
}
function checkSwitch() {
$(".groups").each(function() {
$(this).find('.form-horizontal > .hide').length < $(this).find('.form-horizontal > div').length ? $(this).removeClass("disabled") : $(this).addClass("disabled")
});
}
function checkMultipleInput() {
$(".multipleInput").each(function() {
$(this).find('.controls').length==1 ? $(this).addClass("plural") : $(this).removeClass("plural")
});
}
function removeInput(){
$(".removeInput").click(function (){
$(this).parents(".controls").remove();
checkMultipleInput();
return false;
});
}
checkSwitch();
checkMultipleInput();
removeInput();
$(".help-block a").click(function (){
var $CloneTarget = $(this).parents(".controls").prev(".multipleInput").find('.controls:last');
$(this).parents(".controls").prev(".multipleInput").append($CloneTarget.clone());
$(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').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");
// console.log("LV1");
// console.log($(this));
}else{
$(this).text("ON");
// console.log("LV1");
// console.log($(this));
}
}
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");
console.log("LV2");
subrole_disable_field($(this),"true");
}else{
$(this).text("ON");
console.log("LV2");
subrole_disable_field($(this),"false");
}
checkSwitch();
}
return false;
});
})
</script>
<% end -%>

View File

@ -2,6 +2,6 @@
<% show_sub_role.attribute_fields.each do |item|%> <% show_sub_role.attribute_fields.each do |item|%>
<tr> <tr>
<td class="span1"><%= item.title %></td> <td class="span1"><%= item.title %></td>
<td><%= show_attribute_value(@user.get_attribute_value(item).get_value_by_locale(I18n.locale)) %></td> <td><%= show_attribute_value(@user.get_attribute_value(item).get_value_by_locale(I18n.locale)) rescue '' %></td>
</tr> </tr>
<% end %> <% end %>

View File

@ -11,6 +11,10 @@
<%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %> <%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %>
<%= javascript_include_tag "inc/modal-preview" %> <%= javascript_include_tag "inc/modal-preview" %>
<%= javascript_include_tag "lib/contenteditable" %> <%= javascript_include_tag "lib/contenteditable" %>
<%= javascript_include_tag "inc/ploy_input_field" %>
<%= javascript_include_tag "inc/input_module" %>
<%= javascript_include_tag "inc/attribute_panel_select" %>
<%= javascript_include_tag "inc/attribute_onoff" %>
<% end -%> <% end -%>

View File

@ -11,10 +11,14 @@
<%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %> <%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %>
<%= javascript_include_tag "inc/modal-preview" %> <%= javascript_include_tag "inc/modal-preview" %>
<%= javascript_include_tag "lib/contenteditable" %> <%= javascript_include_tag "lib/contenteditable" %>
<%= javascript_include_tag "inc/ploy_input_field" %>
<%= javascript_include_tag "inc/input_module" %>
<%= javascript_include_tag "inc/attribute_panel_select" %>
<%= javascript_include_tag "inc/attribute_onoff" %>
<% end -%> <% end -%>
<%= content_tag :div,:class=>"user-role site-map" do%> <%= content_tag :div,:class=>"user-role site-map role-block" do%>
<%= form_for @user, :url => admin_users_new_interface_index_path, :html => { :multipart => true },:method => :post do |f| %> <%= form_for @user, :url => admin_users_new_interface_index_path, :html => { :multipart => true },:method => :post do |f| %>
<%= f.error_messages %> <%= f.error_messages %>

View File

@ -8,16 +8,16 @@
<div id="holder"> <div id="holder">
<div id="panel_l" class="ph"> <div id="panel_l" class="ph">
<div class="s_menu sm_v"> <div class="s_menu sm_v" content-type="menu">
<ul id='setting_left_nav'> <ul id='setting_left_nav'>
<li><a href="<%= desktop_appstore_onlinestore_path %>" data-method="onlinestore" class="admtxt hh2 w2 hp" onclick='return false;'>Online Store</a></li> <li><a href="<%= desktop_appstore_onlinestore_path %>" callback-method="onlinestore" class="admtxt hh2 w2 hp" onclick='return false;'>Online Store</a></li>
<li><a href="<%= desktop_appstore_widgets_path %>" data-method="widgets" class="admtxt hh2 w2 hp" onclick='return false;'>Widgets</a></li> <li><a href="<%= desktop_appstore_widgets_path %>" callback-method="widgets" class="admtxt hh2 w2 hp" onclick='return false;'>Widgets</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Apps</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Apps</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Registeration</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Registeration</a></li>
</ul> </ul>
</div> </div>
</div> </div>
<div id="panel_r" class="ph pw admbg hp"> <div id="panel_r" container="true" class="ph pw admbg hp">
</div> </div>
<div class="clear"></div> <div class="clear"></div>

View File

@ -11,10 +11,10 @@
</div> </div>
<div id="holder"> <div id="holder">
<div id="panel_l" class="ph"> <div id="panel_l" class="ph">
<div class="s_menu sm_v"> <div class="s_menu sm_v" content-type="menu">
<ul id='setting_left_nav'> <ul id='setting_left_nav'>
<li><a href="<%= desktop_publications_books_list_path %>" data-method="harry"class="hh2 w2 hp active thmc1 thmtxt" onclick='return false;'>List</a></li> <li><a href="<%= desktop_publications_books_list_path %>" callback-method="harry"class="hh2 w2 hp active thmc1 thmtxt" onclick='return false;'>List</a></li>
<li><a href="<%= desktop_publications_books_add_path %>" data-method="addbook"class="admtxt hh2 w2 hp" onclick='return false;'>Add/Edit</a></li> <li><a href="<%= desktop_publications_books_add_path %>" callback-method="addbook"class="admtxt hh2 w2 hp" onclick='return false;'>Add/Edit</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Books</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Books</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Co-Authors</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Co-Authors</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Tags &amp; Keywords</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Tags &amp; Keywords</a></li>
@ -24,7 +24,7 @@
</ul> </ul>
</div> </div>
</div> </div>
<div id="panel_r" class="ph pw admbg hp"> <div id="panel_r" container="true" class="ph pw admbg hp">
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>

View File

@ -1,64 +1,64 @@
<div id="side"> <div id="side">
<div id="rwidget" class="wh3 thmc4"> <div id="rwidget" class="wh3 thmc4">
<ul class="docklist"> <ul class="docklist">
<li class="d_cate"><a data-method='initializeDesktop' href="desktop/" class="widget_fn wh3 hh3" id='d_desktop' onclick="return false;"><span class="widget_icon"><img src="" alt="Home" id="home_icon" width="30" height="30"/></span></a> <li class="d_cate"><a callback-method='initializeDesktop' href="desktop/" class="widget_fn wh3 hh3" id='d_desktop' onclick="return false;"><span class="widget_icon"><img src="" alt="Home" id="home_icon" width="30" height="30"/></span></a>
<ul class="dock_child hh3 thmc4" style="width: 180px;"> <ul class="dock_child hh3 thmc4" style="width: 180px;">
<li class="dock_item"><a data-method='initializeAppSearch' href="<%= desktop_app_manager_path %>" class="widget_fn wh3 hh3" id="d_app_manager" onclick="return false;"><span class="widget_icon"><img src="" alt="App Manager" id="app_manager_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='initializeAppSearch' href="<%= desktop_app_manager_path %>" class="widget_fn wh3 hh3" id="d_app_manager" onclick="return false;"><span class="widget_icon"><img src="" alt="App Manager" id="app_manager_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a data-method='initializeSectionsManager' href="<%= desktop_sections_path %>" class="widget_fn wh3 hh3" id="d_sections" onclick="return false;"><span class="widget_icon"><img src="" alt="All Sections" id="sections_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='initializeSectionsManager' href="<%= desktop_sections_path %>" class="widget_fn wh3 hh3" id="d_sections" onclick="return false;"><span class="widget_icon"><img src="" alt="All Sections" id="sections_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a data-method='initializeSettings' href="<%= desktop_settings_path %>" class="widget_fn wh3 hh3" id="d_settings" onclick="return false;"><span class="widget_icon"><img src="" alt="Settings" id="settings_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='initializeSettings' href="<%= desktop_settings_path %>" class="widget_fn wh3 hh3" id="d_settings" onclick="return false;"><span class="widget_icon"><img src="" alt="Settings" id="settings_icon" width="30" height="30"/></span></a></li>
</ul> </ul>
</li> </li>
<li class="d_cate"><a data-method='' href="" class="widget_fn wh3 hh3" id='d_publication' onclick="return false;"><span class="widget_icon"><img src="" alt="Publication" id="publication_icon" width="30" height="30"/></span></a> <li class="d_cate"><a callback-method='' href="" class="widget_fn wh3 hh3" id='d_publication' onclick="return false;"><span class="widget_icon"><img src="" alt="Publication" id="publication_icon" width="30" height="30"/></span></a>
<ul class="dock_child hh3 thmc4" style="width: 180px;"> <ul class="dock_child hh3 thmc4" style="width: 180px;">
<li class="dock_item"><a data-method='initializeJournalPapers' href="<%= desktop_publications_journal_p_path %>" class="widget_fn wh3 hh3" id='d_journal_p' onclick="return false;"><span class="widget_icon"><img src="" alt="Journal Papers" id="journal_p_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='initializeJournalPapers' href="<%= desktop_publications_journal_p_path %>" class="widget_fn wh3 hh3" id='d_journal_p' onclick="return false;"><span class="widget_icon"><img src="" alt="Journal Papers" id="journal_p_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a data-method='initializeSeminar' href="<%= desktop_publications_seminar_p_path %>" class="widget_fn wh3 hh3" id='d_seminar_p' onclick="return false;"><span class="widget_icon"><img src="" alt="Seminar Papers" id="seminar_p_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='initializeSeminar' href="<%= desktop_publications_seminar_p_path %>" class="widget_fn wh3 hh3" id='d_seminar_p' onclick="return false;"><span class="widget_icon"><img src="" alt="Seminar Papers" id="seminar_p_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a data-method='initializeContact' href="<%= desktop_publications_books_path %>" class="widget_fn wh3 hh3" id='d_books' onclick="return false;"><span class="widget_icon"><img src="" alt="Books" id="books_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='initializeContact' href="<%= desktop_publications_books_path %>" class="widget_fn wh3 hh3" id='d_books' onclick="return false;"><span class="widget_icon"><img src="" alt="Books" id="books_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a data-method='initializeContact' href="<%= desktop_publications_books_path %>" class="widget_fn wh3 hh3" id='d_contacts' onclick="return false;"><span class="widget_icon"><img src="" alt="Books" id="books_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='initializeContact' href="<%= desktop_publications_books_path %>" class="widget_fn wh3 hh3" id='d_contacts' onclick="return false;"><span class="widget_icon"><img src="" alt="Books" id="books_icon" width="30" height="30"/></span></a></li>
</ul> </ul>
</li> </li>
<li class="d_cate"><a data-method='' href="" class="widget_fn wh3 hh3" id='d_research' onclick="return false;"><span class="widget_icon"><img src="" alt="Research" id="research_icon" width="30" height="30"/></span></a> <li class="d_cate"><a callback-method='' href="" class="widget_fn wh3 hh3" id='d_research' onclick="return false;"><span class="widget_icon"><img src="" alt="Research" id="research_icon" width="30" height="30"/></span></a>
<ul class="dock_child hh3 thmc4" style="width: 240px;"> <ul class="dock_child hh3 thmc4" style="width: 240px;">
<li class="dock_item"><a data-method='initializeResearchDomain' href="<%= desktop_research_research_d_path %>" class="widget_fn wh3 hh3" id='d_research_d' onclick="return false;"><span class="widget_icon"><img src="" alt="Research Domain" id="research_d_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='initializeResearchDomain' href="<%= desktop_research_research_d_path %>" class="widget_fn wh3 hh3" id='d_research_d' onclick="return false;"><span class="widget_icon"><img src="" alt="Research Domain" id="research_d_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a data-method='initializeResearchProject' href="<%= desktop_research_research_p_path %>" class="widget_fn wh3 hh3" id='d_research_p' onclick="return false;"><span class="widget_icon"><img src="" alt="Research Project" id="research_p_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='initializeResearchProject' href="<%= desktop_research_research_p_path %>" class="widget_fn wh3 hh3" id='d_research_p' onclick="return false;"><span class="widget_icon"><img src="" alt="Research Project" id="research_p_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a data-method='' href="" class="widget_fn wh3 hh3" id='d_patents' onclick="return false;"><span class="widget_icon"><img src="" alt="Patents" id="patents_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='' href="" class="widget_fn wh3 hh3" id='d_patents' onclick="return false;"><span class="widget_icon"><img src="" alt="Patents" id="patents_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a data-method='' href="labs" class="widget_fn wh3 hh3" id='d_labs' onclick="return false;"><span class="widget_icon"><img src="" alt="Labs" id="labs_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='' href="labs" class="widget_fn wh3 hh3" id='d_labs' onclick="return false;"><span class="widget_icon"><img src="" alt="Labs" id="labs_icon" width="30" height="30"/></span></a></li>
</ul> </ul>
</li> </li>
<li class="d_cate"><a data-method='' href="" class="widget_fn wh3 hh3" id='d_experience' onclick="return false;"><span class="widget_icon"><img src="" alt="Experience" id="experience_icon" width="30" height="30"/></span></a> <li class="d_cate"><a callback-method='' href="" class="widget_fn wh3 hh3" id='d_experience' onclick="return false;"><span class="widget_icon"><img src="" alt="Experience" id="experience_icon" width="30" height="30"/></span></a>
<ul class="dock_child hh3 thmc4" style="width: 300px;"> <ul class="dock_child hh3 thmc4" style="width: 300px;">
<li class="dock_item"><a data-method='' href="working" class="widget_fn wh3 hh3" id='d_working' onclick="return false;"><span class="widget_icon"><img src="" alt="Working" id="working_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='' href="working" class="widget_fn wh3 hh3" id='d_working' onclick="return false;"><span class="widget_icon"><img src="" alt="Working" id="working_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a data-method='' href="education" class="widget_fn wh3 hh3" id='d_education' onclick="return false;"><span class="widget_icon"><img src="" alt="Education" id="education_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='' href="education" class="widget_fn wh3 hh3" id='d_education' onclick="return false;"><span class="widget_icon"><img src="" alt="Education" id="education_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a data-method='' href="honors" class="widget_fn wh3 hh3" id='d_honors' onclick="return false;"><span class="widget_icon"><img src="" alt="Honors" id="honors_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='' href="honors" class="widget_fn wh3 hh3" id='d_honors' onclick="return false;"><span class="widget_icon"><img src="" alt="Honors" id="honors_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a data-method='' href="activities" class="widget_fn wh3 hh3" id='d_activities' onclick="return false;"><span class="widget_icon"><img src="" alt="Activities" id="activities_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='' href="activities" class="widget_fn wh3 hh3" id='d_activities' onclick="return false;"><span class="widget_icon"><img src="" alt="Activities" id="activities_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a data-method='' href="clubs" class="widget_fn wh3 hh3" id='d_clubs' onclick="return false;"><span class="widget_icon"><img src="" alt="Clubs" id="clubs_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='' href="clubs" class="widget_fn wh3 hh3" id='d_clubs' onclick="return false;"><span class="widget_icon"><img src="" alt="Clubs" id="clubs_icon" width="30" height="30"/></span></a></li>
</ul> </ul>
</li> </li>
<li class="d_cate"><a data-method='' href="" class="widget_fn wh3 hh3" id='d_landt' onclick="return false;"><span class="widget_icon"><img src="" alt="Learning & Teaching" id="landt_icon" width="30" height="30"/></span></a> <li class="d_cate"><a callback-method='' href="" class="widget_fn wh3 hh3" id='d_landt' onclick="return false;"><span class="widget_icon"><img src="" alt="Learning & Teaching" id="landt_icon" width="30" height="30"/></span></a>
<ul class="dock_child hh3 thmc4" style="width: 180px;"> <ul class="dock_child hh3 thmc4" style="width: 180px;">
<li class="dock_item"><a data-method='' href="courses" class="widget_fn wh3 hh3" id='d_courses' onclick="return false;"><span class="widget_icon"><img src="" alt="Courses" id="courses_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='' href="courses" class="widget_fn wh3 hh3" id='d_courses' onclick="return false;"><span class="widget_icon"><img src="" alt="Courses" id="courses_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a data-method='' href="homework" class="widget_fn wh3 hh3" id='d_homework' onclick="return false;"><span class="widget_icon"><img src="" alt="Homework" id="homework_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='' href="homework" class="widget_fn wh3 hh3" id='d_homework' onclick="return false;"><span class="widget_icon"><img src="" alt="Homework" id="homework_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a data-method='' href="certification" class="widget_fn wh3 hh3" id='d_certification' onclick="return false;"><span class="widget_icon"><img src="" alt="Certification" id="certification_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='' href="certification" class="widget_fn wh3 hh3" id='d_certification' onclick="return false;"><span class="widget_icon"><img src="" alt="Certification" id="certification_icon" width="30" height="30"/></span></a></li>
</ul> </ul>
</li> </li>
<li class="d_cate"><a data-method='' href="" class="widget_fn wh3 hh3" id='d_personal' onclick="return false;"><span class="widget_icon"><img src="" alt="Personal" id="personal_icon" width="30" height="30"/></span></a> <li class="d_cate"><a callback-method='' href="" class="widget_fn wh3 hh3" id='d_personal' onclick="return false;"><span class="widget_icon"><img src="" alt="Personal" id="personal_icon" width="30" height="30"/></span></a>
<ul class="dock_child hh3 thmc4" style="width: 300px;"> <ul class="dock_child hh3 thmc4" style="width: 300px;">
<li class="dock_item"><a data-method='' href="mypage" class="widget_fn wh3 hh3" id='d_mypage' onclick="return false;"><span class="widget_icon"><img src="" alt="myPage" id="mypage_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='' href="mypage" class="widget_fn wh3 hh3" id='d_mypage' onclick="return false;"><span class="widget_icon"><img src="" alt="myPage" id="mypage_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a data-method='' href="blog" class="widget_fn wh3 hh3" id='d_blog' onclick="return false;"><span class="widget_icon"><img src="" alt="Blog" id="blog_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='' href="blog" class="widget_fn wh3 hh3" id='d_blog' onclick="return false;"><span class="widget_icon"><img src="" alt="Blog" id="blog_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a data-method='' href="album" class="widget_fn wh3 hh3" id='d_album' onclick="return false;"><span class="widget_icon"><img src="" alt="Album" id="album_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='' href="album" class="widget_fn wh3 hh3" id='d_album' onclick="return false;"><span class="widget_icon"><img src="" alt="Album" id="album_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a data-method='' href="calendar" class="widget_fn wh3 hh3" id='d_calendar' onclick="return false;"><span class="widget_icon"><img src="" alt="Calendar" id="calendar_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='' href="calendar" class="widget_fn wh3 hh3" id='d_calendar' onclick="return false;"><span class="widget_icon"><img src="" alt="Calendar" id="calendar_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a data-method='' href="files" class="widget_fn wh3 hh3" id='d_files' onclick="return false;"><span class="widget_icon"><img src="" alt="Files" id="files_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='' href="files" class="widget_fn wh3 hh3" id='d_files' onclick="return false;"><span class="widget_icon"><img src="" alt="Files" id="files_icon" width="30" height="30"/></span></a></li>
</ul> </ul>
</li> </li>
<li class="d_cate"><a data-method='initializeOrbitTimeline' href="<%= desktop_orbit_orbit_path %>" class="widget_fn wh3 hh3" id='d_orbit' onclick="return false;"><span class="widget_icon"><img src="" alt="Orbit" id="orbit_icon" width="30" height="30"/></span></a> <li class="d_cate"><a callback-method='initializeOrbitTimeline' href="<%= desktop_orbit_orbit_path %>" class="widget_fn wh3 hh3" id='d_orbit' onclick="return false;"><span class="widget_icon"><img src="" alt="Orbit" id="orbit_icon" width="30" height="30"/></span></a>
<ul class="dock_child hh3 thmc4" style="width: 60px;"> <ul class="dock_child hh3 thmc4" style="width: 60px;">
<li class="dock_item"><a data-method='' href="" class="widget_fn wh3 hh3" id='d_connection' onclick="return false;"><span class="widget_icon"><img src="" alt="Academia Connection" id="connection_icon" width="30" height="30"/></span></a></li> <li class="dock_item"><a callback-method='' href="" class="widget_fn wh3 hh3" id='d_connection' onclick="return false;"><span class="widget_icon"><img src="" alt="Academia Connection" id="connection_icon" width="30" height="30"/></span></a></li>
</ul> </ul>
</li> </li>
<li class="d_cate"><a data-method='initializeAppstore' href="<%= desktop_appstore_appstore_path %>" class="widget_fn wh3 hh3" id='d_appstore' onclick="return false;"><span class="widget_icon"><img src="" alt="AppStore" id="appstore_icon" width="30" height="30"/></span></a></li> <li class="d_cate"><a callback-method='initializeAppstore' href="<%= desktop_appstore_appstore_path %>" class="widget_fn wh3 hh3" id='d_appstore' onclick="return false;"><span class="widget_icon"><img src="" alt="AppStore" id="appstore_icon" width="30" height="30"/></span></a></li>
</ul> </ul>
<div class="fn_des hh3 admbg admtxt"></div> <div class="fn_des hh3 admbg admtxt"></div>
</div> </div>

View File

@ -11,12 +11,12 @@
</div> </div>
<div id="holder"> <div id="holder">
<div id="panel_l" class="ph"> <div id="panel_l" class="ph">
<div class="s_menu sm_v"> <div class="s_menu sm_v" content-type="menu">
<ul id='setting_left_nav'> <ul id='setting_left_nav'>
<li><a href="<%= desktop_journal_pages_path %>" data-method="list" class="hh2 w2 hp active thmc1 thmtxt xx" onclick='return false;'>List</a></li> <li><a href="<%= desktop_journal_pages_path %>" callback-method="list" load="true" class="hh2 w2 hp thmc1 thmtxt xx" onclick='return false;'>List</a></li>
<li><a href="<%= new_desktop_journal_page_path %>" data-method="addpaper" class="admtxt hh2 w2 hp xx" onclick='return false;'>Add/Edit</a></li> <li><a href="<%= new_desktop_journal_page_path %>" callback-method="addpaper" class="admtxt hh2 w2 hp xx" onclick='return false;'>Add/Edit</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Journals</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Journals</a></li>
<li><a href="<%= new_desktop_co_author_path %>" data-method="coauthor" class="admtxt hh2 w2 hp" onclick='return false;'>Co-Authors</a></li> <li><a href="<%= new_desktop_co_author_path %>" class="admtxt hh2 w2 hp" callback-method="coauthor" onclick='return false;'>Co-Authors</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Tags &amp; Keywords</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Tags &amp; Keywords</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Analysis</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Analysis</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Import</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Import</a></li>
@ -24,7 +24,7 @@
</ul> </ul>
</div> </div>
</div> </div>
<div id="panel_r" class="ph pw admbg hp"> <div id="panel_r" container="true" class="ph pw admbg hp">
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>

View File

@ -1,7 +1,8 @@
<div class="toolbar hh2"> <div class="toolbar hh2">
<div class="fn_g hp"> <div class="fn_g hp">
<%= button_tag "Save", name: "commit", value: "Save", class: "fn_btn hh2 thmc2 thmtxt" %> <%= f.submit "Save", name: "commit", value: "Save", class: "fn_btn hh2 thmc2 thmtxt" %>
<%= button_tag "Cancel", name: "commit", value: "Cancel", class: "fn_btn hh2 thmc2 thmtxt" %> <%#= button_tag "Cancel", name: "cancel", value: "Cancel", class: "fn_btn hh2 thmc2 thmtxt" %>
<%= content_tag(:button, "Cancel", :class=>"fn_btn hh2 bt-cancel thmc2 thmtxt") %>
</div> </div>
<div class="hh2 hp sdm"> <div class="hh2 hp sdm">
<div class="sdm_t hh2">Entry Year</div> <div class="sdm_t hh2">Entry Year</div>

View File

@ -1,3 +1,3 @@
<%= form_for @writing_journal, url: desktop_journal_page_path(@writing_journal) do |f| %> <%= form_for @writing_journal, url: desktop_journal_page_path(@writing_journal),html: { multipart: true ,:type=>"ajax_form", "callback-method"=>"formCallback"} do |f| %>
<%= render partial: 'desktop/journal_pages/form', locals: {:f => f} %> <%= render partial: 'desktop/journal_pages/form', locals: {:f => f} %>
<%end%> <%end%>

View File

@ -1,3 +1,3 @@
<%= form_for @writing_journal , url: desktop_journal_pages_path do |f| %> <%= form_for @writing_journal, html: { multipart: true ,:type=>"ajax_form", "callback-method"=>"formCallback"} , url: desktop_journal_pages_path do |f| %>
<%= render partial: 'desktop/journal_pages/form', locals: {:f => f} %> <%= render partial: 'desktop/journal_pages/form', locals: {:f => f} %>
<%end%> <%end%>

View File

@ -11,10 +11,10 @@
</div> </div>
<div id="holder"> <div id="holder">
<div id="panel_l" class="ph"> <div id="panel_l" class="ph">
<div class="s_menu sm_v"> <div class="s_menu sm_v" content-type="menu">
<ul id='setting_left_nav'> <ul id='setting_left_nav'>
<li><a href="<%= desktop_research_research_d_list_path %>" data-method="list" class="hh2 w2 hp active thmc1 thmtxt" onclick='return false;'>List</a></li> <li><a href="<%= desktop_research_research_d_list_path %>" callback-method="list" class="hh2 w2 hp active thmc1 thmtxt" onclick='return false;'>List</a></li>
<li><a href="<%= desktop_research_research_d_add_path %>" data-method="add_this" class="admtxt hh2 w2 hp" onclick='return false;'>Add/Edit</a></li> <li><a href="<%= desktop_research_research_d_add_path %>" callback-method="add_this" class="admtxt hh2 w2 hp" onclick='return false;'>Add/Edit</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Domains</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Domains</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Co-Authors</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Co-Authors</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Tags &amp; Keywords</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Tags &amp; Keywords</a></li>
@ -24,7 +24,7 @@
</ul> </ul>
</div> </div>
</div> </div>
<div id="panel_r" class="ph pw admbg hp"> <div id="panel_r" container="true" class="ph pw admbg hp">
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>

View File

@ -11,10 +11,10 @@
</div> </div>
<div id="holder"> <div id="holder">
<div id="panel_l" class="ph"> <div id="panel_l" class="ph">
<div class="s_menu sm_v"> <div class="s_menu sm_v" content-type="menu">
<ul id='setting_left_nav'> <ul id='setting_left_nav'>
<li><a href="<%= desktop_publications_research_p_list_path %>" data-method="list" class="hh2 w2 hp active thmc1 thmtxt" onclick='return false;'>List</a></li> <li><a href="<%= desktop_publications_research_p_list_path %>" callback-method="list" class="hh2 w2 hp active thmc1 thmtxt" onclick='return false;'>List</a></li>
<li><a href="<%= desktop_publications_research_p_add_path %>" data-method="add_this" class="admtxt hh2 w2 hp" onclick='return false;'>Add/Edit</a></li> <li><a href="<%= desktop_publications_research_p_add_path %>" callback-method="add_this" class="admtxt hh2 w2 hp" onclick='return false;'>Add/Edit</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Projects</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Projects</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Co-Authors</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Co-Authors</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Tags &amp; Keywords</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Tags &amp; Keywords</a></li>
@ -24,7 +24,7 @@
</ul> </ul>
</div> </div>
</div> </div>
<div id="panel_r" class="ph pw admbg hp"> <div id="panel_r" container="true" class="ph pw admbg hp">
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>

View File

@ -11,10 +11,10 @@
</div> </div>
<div id="holder"> <div id="holder">
<div id="panel_l" class="ph"> <div id="panel_l" class="ph">
<div class="s_menu sm_v"> <div class="s_menu sm_v" content-type="menu">
<ul id='setting_left_nav'> <ul id='setting_left_nav'>
<li><a href="<%= desktop_publications_seminar_p_list_path %>" data-method="list" class="hh2 w2 hp active thmc1 thmtxt" onclick='return false;'>List</a></li> <li><a href="<%= desktop_publications_seminar_p_list_path %>" callback-method="list" class="hh2 w2 hp active thmc1 thmtxt" onclick='return false;'>List</a></li>
<li><a href="<%= desktop_publications_seminar_p_add_path %>" data-method="addseminar" class="admtxt hh2 w2 hp" onclick='return false;'>Add/Edit</a></li> <li><a href="<%= desktop_publications_seminar_p_add_path %>" callback-method="addseminar" class="admtxt hh2 w2 hp" onclick='return false;'>Add/Edit</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Seminar</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Seminar</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Co-Authors</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Co-Authors</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Tags &amp; Keywords</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Tags &amp; Keywords</a></li>
@ -24,7 +24,7 @@
</ul> </ul>
</div> </div>
</div> </div>
<div id="panel_r" class="ph pw admbg hp"> <div id="panel_r" container="true" class="ph pw admbg hp">
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>

View File

@ -7,17 +7,17 @@
</div> </div>
<div id="holder"> <div id="holder">
<div id="panel_l" class="ph"> <div id="panel_l" class="ph">
<div class="s_menu sm_v"> <div class="s_menu sm_v" content-type="menu">
<ul id='setting_left_nav'> <ul id='setting_left_nav'>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Overview</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Overview</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Account</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Account</a></li>
<li><a href="<%= desktop_sections_path %>" data-method="sections" class="admtxt hh2 w2 hp" onclick='return false;'>Sections</a></li> <li><a href="<%= desktop_sections_path %>" callback-method="sections" class="admtxt hh2 w2 hp" onclick='return false;'>Sections</a></li>
<li><a href="<%= desktop_themes_path %>" data-method="themes" class="admtxt hh2 w2 hp" onclick='return false;'>Theme</a></li> <li><a href="<%= desktop_themes_path %>" callback-method="themes" class="admtxt hh2 w2 hp" onclick='return false;'>Theme</a></li>
<li><a href="<%= desktop_connections_path %>" data-method="connection" class="admtxt hh2 w2 hp" onclick='return false;'>Connection</a></li> <li><a href="<%= desktop_connections_path %>" callback-method="connection" class="admtxt hh2 w2 hp" onclick='return false;'>Connection</a></li>
</ul> </ul>
</div> </div>
</div> </div>
<div id="panel_r" class="ph pw admbg hp"> <div id="panel_r" container="true" class="ph pw admbg hp">
</div> </div>
<div class="clear"></div> <div class="clear"></div>

View File

@ -75,8 +75,8 @@
<%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %> <%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %>
<%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %> <%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %>
<%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %> <%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %>
<%= content_tag :li, link_to((t('gallery.categories') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_gallery_back_end_gallery_categories_path), :class => active_for_action('gallery_categories','index') %> <%= content_tag(:li, link_to((t('gallery.categories') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_gallery_back_end_gallery_categories_path), :class => active_for_action('gallery_categories','index') )if (is_manager? rescue nil)%>
<%= content_tag :li, link_to((t('gallery.tags') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_gallery_back_end_tags_path), :class => active_for_action('/panel/gallery/back_end/tags', 'index') %> <%= content_tag :li, link_to((t('gallery.tags') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_gallery_back_end_tags_path), :class => active_for_action('/panel/gallery/back_end/tags', 'index') if (is_manager? rescue nil) %>
<%= content_tag :li, link_to((t('admin.module.authorization') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe,admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "gallery"}))), :class => active_for_app_auth('gallery') if (is_admin? rescue nil) %> <%= content_tag :li, link_to((t('admin.module.authorization') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe,admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "gallery"}))), :class => active_for_app_auth('gallery') if (is_admin? rescue nil) %>
<% end -%> <% end -%>
<% end %> <% end %>
@ -85,9 +85,9 @@
<%= link_to content_tag(:i, nil, :class => 'icons-asset') + content_tag(:span, t('admin.archive')), panel_archive_back_end_archive_files_path %> <%= link_to content_tag(:i, nil, :class => 'icons-asset') + content_tag(:span, t('admin.archive')), panel_archive_back_end_archive_files_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('archive_files', 'tags', 'archive_file_categorys')) do -%> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('archive_files', 'tags', 'archive_file_categorys')) do -%>
<%= content_tag :li, link_to((t('admin.all_articles') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_archive_back_end_archive_files_path), :class => active_for_action('archive_file', 'index') %> <%= content_tag :li, link_to((t('admin.all_articles') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_archive_back_end_archive_files_path), :class => active_for_action('archive_file', 'index') %>
<%= content_tag :li, link_to((t('admin.add_new') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_panel_archive_back_end_archive_file_path), :class => active_for_action('archive_file', 'new') %> <%= content_tag :li, link_to((t('admin.add_new') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_panel_archive_back_end_archive_file_path), :class => active_for_action('archive_file', 'new') if (is_admin? rescue nil)%>
<%= content_tag :li, link_to((t('admin.categories') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_archive_back_end_archive_file_categorys_path), :class => active_for_action('archive_file_categorys', 'index') %> <%= content_tag(:li, link_to((t('admin.categories') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_archive_back_end_archive_file_categorys_path), :class => active_for_action('archive_file_categorys', 'index'))if (is_manager? rescue nil)%>
<%= content_tag :li, link_to((t('admin.tags') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_archive_back_end_tags_path), :class => active_for_action('tags', 'index') %> <%= content_tag :li, link_to((t('admin.tags') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_archive_back_end_tags_path), :class => active_for_action('tags', 'index') if (is_manager? rescue nil)%>
<% end -%> <% end -%>
<% end -%> <% end -%>
@ -98,7 +98,7 @@
<%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %> <%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %>
<%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %> <%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %>
<%= content_tag :li, link_to((t('admin.calendars') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_panel_calendar_back_end_cal_path), :class => active_for_action('cals','new') %> <%= content_tag :li, link_to((t('admin.calendars') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_panel_calendar_back_end_cal_path), :class => active_for_action('cals','new') %>
<%= content_tag :li, link_to(t('admin.tags'), panel_calendar_back_end_tags_path), :class => active_for_action('/panel/calendar/back_end/tags', 'index') %> <%= content_tag :li, link_to(t('admin.tags'), panel_calendar_back_end_tags_path), :class => active_for_action('/panel/calendar/back_end/tags', 'index')if (is_manager? rescue nil) %>
<%#= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "gallery"}))), :class => active_for_app_auth('gallery') if (is_admin? rescue nil) %> <%#= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "gallery"}))), :class => active_for_app_auth('gallery') if (is_admin? rescue nil) %>
<% end -%> <% end -%>
<% end %> <% end %>

View File

@ -1,13 +0,0 @@
<div class="modal hide fade" id="address-edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none; ">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Modal header</h3>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
</div>

View File

@ -0,0 +1,62 @@
<div class="modal hide fade address-edit <%= btn_class %>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" id=<%= html_id%>>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel"><%= (field_name rescue nil) || t("address_modal.default_title") %></h3>
</div>
<div class="modal-body">
<div class="tabbable">
<ul class="nav nav-tabs">
<% VALID_LOCALES.each do |locale|%>
<% active = (locale == I18n.locale.to_s ? ["active"] : [] ) %>
<%= content_tag :li,:class=>active.push("modal_tab","address_tab").join(' '),:for=>locale do%>
<%= link_to t("langs.#{locale}"),".#{btn_class}.address_modal.#{locale}",:data=>{:toggle=>"tab"}%>
<% end %>
<% end %>
</ul>
<div class="tab-content">
<% VALID_LOCALES.each do |locale|%>
<!-- start of lang tab context -->
<% active = (locale == I18n.locale.to_s ? "active" : "" ) %>
<div class="tab-pane <%= active %> fade in <%= "#{btn_class} address_modal #{locale}" %>" for="<%= locale %>">
<div class="control-group">
<label class="control-label" for="street_address"><%= t("address_modal.street_address") %></label>
<div class="controls">
<%= text_area_tag("#{field_name_basic}[temp][address_ext][#{locale}][street_address]",nil,:rows=>3,:func=>'street_address') %>
</div>
</div>
<div class="control-group">
<label class="control-label" for="city"><%= t("address_modal.city") %></label>
<div class="controls">
<%= text_field_tag("#{field_name_basic}[temp][address_ext][#{locale}][city]",'',:func=>'city') %>
</div>
</div>
<div class="control-group">
<label class="control-label" for="counties"><%= t("address_modal.county") %></label>
<div class="controls">
<%= text_field_tag("#{field_name_basic}[temp][address_ext][#{locale}][county]",'',:func=>'county') %>
</div>
</div>
<div class="control-group">
<label class="control-label" for="zip"><%= t("address_modal.zip") %></label>
<div class="controls">
<%= text_field_tag("#{field_name_basic}[temp][address_ext][#{locale}][zip]",nil,:class=>"input-mini",:func=>'zip') %>
</div>
</div>
<div class="control-group">
<label class="control-label" for="country"><%= t("address_modal.country") %></label>
<div class="controls">
<%= text_field_tag("#{field_name_basic}[temp][address_ext][#{locale}][country]",'',:func=>'country') %>
</div>
</div>
</div>
<!-- end of tab context -->
<% end %>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true"><%=t("modal.close")%></button>
<button href="" class="btn btn-primary bt-save" data-dismiss="modal" aria-hidden="true"><%=t("modal.save_and_close")%></button>
</div>
</div>

View File

@ -1,21 +0,0 @@
#encoding: utf-8
require 'mysql2'
$mid_site_connection
module MiddleSiteConnection
@mid_host = {
:host => 'mruling.nccu.edu.tw', #mruling.nccu.edu.tw or 127.0.0.1
:port => 3306, #3306 or 8005
:username => "rulingcom",
:password => "5w3iJQ9OJQMGhJibKP6YQje8",
:database => "RSS23_NCCU_MIDDLE",
:encoding => "UTF8"
}
def self.establish
$mid_site_connection = Mysql2::Client.new(@mid_host)
end
end

View File

@ -33,9 +33,9 @@ markups:
# date_durnation: # date_durnation:
# muti_lang_input_supprt: false # muti_lang_input_supprt: false
# ext_support: false # ext_support: false
# address: address:
# muti_lang_input_supprt: true muti_lang_input_supprt: true
# ext_support: true ext_support: true
public_r_tags: public_r_tags:

View File

@ -158,8 +158,19 @@ zh_tw:
user: 使用者列表 user: 使用者列表
list_: 列表 list_: 列表
list_lower: 列表 list_lower: 列表
address_modal:
default_title: 地址
street_address: 街道地址
city: 城市
county: 縣市
zip: 郵遞區號
country: 國家/地區
langs:
zh_tw: 中文
en: 英文
lists: lists:
markups: markups:
address: 地址欄位
text_field: 文字輸入框 text_field: 文字輸入框
select: 下拉選單 select: 下拉選單
date: 日期 date: 日期
@ -350,278 +361,284 @@ zh_tw:
# : ======= # : =======
errors: errors:
at_least_one: 必須至少有一個值 at_least_one: 必須至少有一個值
# admin: admin:
# infos: infos:
# add_attribute_field: 新增 add_attribute_field: 新增
# save: 儲存 save: 儲存
# initial: 起始值 initial: 起始值
# markup: 輸入模式 markup: 輸入模式
# item_name: 資料表名稱 item_name: 資料表名稱
# name: 名稱 name: 名稱
# options: 選項 options: 選項
# multilingual: 多語言輸入 :cross_lang: 跨語言輸入
# add_more: 使用者可自行延伸欄位 add_more: 使用者可自行延伸欄位
# add: 新增 add: 新增
# placeholder: 輸入協助 placeholder: 輸入協助
# type: 類型 type: 類型
# placeholder: 提示內容 placeholder: 提示內容
# list: 自定選單 list: 自定選單
# is_range: 是 is_range:
# not_range: 否 not_range:
# date: date:
# claendar: 紀年法 claendar: 紀年法
# range: 本欄為時間區段 range: 本欄為時間區段
# format: 格式 format: 格式
# tw_claendar: 民國 tw_claendar: 民國
# west_claendar: 西元 minguo_calendar:
# access: after: 民國
# denied: before: 民前
# app: first_year: 民國元年
# not_sub_manager: 拒絕存取因你不是此應用程式次管理員 year:
# not_manager: 拒絕存取因你不是此應用程式管理員 month:
# not_authed_user: 拒絕存取因你不是此應用程式授權使用者 west_claendar: 西元
# not_admin: 拒絕存取因你不是此應用程式次管理員 access:
# object: 拒絕存取因你不是網站管理者 denied:
# action: 操作 app:
# ad_banner: 廣告輪播 not_sub_manager: 拒絕存取因你不是此應用程式次管理員
# orbit_gallery: 活動花絮 not_manager: 拒絕存取因你不是此應用程式管理員
# ad: not_authed_user: 拒絕存取因你不是此應用程式授權使用者
# sec_place_holder: 3秒請輸入3 not_admin: 拒絕存取因你不是此應用程式次管理員
# ab_fx: 轉場特效 object: 拒絕存取因你不是網站管理者
# all_banners: 輪播清單 action: 操作
# banner_best_size: Banner 尺寸 ad_banner: 廣告輪播
# best_size: 最佳尺寸 orbit_gallery: 活動花絮
# cate_auth: 分類授權 ad:
# delete_banner: 刪除整組輪播 sec_place_holder: 3秒請輸入3
# new_banner: 新增輪播 ab_fx: 轉場特效
# new_image: 新增橫幅 all_banners: 輪播清單
# showing: 顯示中 banner_best_size: Banner 尺寸
# not_showing: 沒有顯示 best_size: 最佳尺寸
# picture_list: 圖片列表 cate_auth: 分類授權
# title: 標題 delete_banner: 刪除整組輪播
# transition_sec: 轉場單位時間 new_banner: 新增輪播
# trans_unit_sec: 秒 new_image: 新增橫幅
# update_banner: 更新輪播 showing: 顯示中
# widget_info_for_ad_image_size: "此區塊圖片尺寸請使用 %{best_size}" not_showing: 沒有顯示
# add: 新增 picture_list: 圖片列表
# add_item: 新增項目 title: 標題
# add_language: 新增語言 transition_sec: 轉場單位時間
# add_drop_down_item: 增加Orbit選單 trans_unit_sec:
# admin: 網站管理者 update_banner: 更新輪播
# all_articles: 列表 widget_info_for_ad_image_size: "此區塊圖片尺寸請使用 %{best_size}"
# always_display_title: 永遠顯示於標題列 add: 新增
# announcement: 公告管理 add_item: 新增項目
# asset: 資產 add_language: 新增語言
# assets: add_drop_down_item: 增加Orbit選單
# file: 檔案 admin: 網站管理者
# album: 相簿 all_articles: 列表
# video: 影片 always_display_title: 永遠顯示於標題列
# book: 書籍 announcement: 公告管理
# attributes: 屬性 asset: 資產
# author: 作者 assets:
# calendar: 行事曆 file: 檔案
# cant_delete_self: 您不可以刪除自己。 album: 相簿
# cant_revoke_self_admin: 您不可以撤銷自己的管理身份。 video: 影片
# category: 類別 book: 書籍
# choose_file: 請選擇一個文件... attributes: 屬性
# class: 階級 author: 作者
# content: 內容 calendar: 行事曆
# contenteditable: cant_delete_self: 您不可以刪除自己。
# update_done: 更新完成 cant_revoke_self_admin: 您不可以撤銷自己的管理身份。
# update_failed: 更新失敗 category: 類別
# create_error_link: 新增連接時出錯。 choose_file: 請選擇一個文件...
# create_error_page: 新增頁面時出錯。 class: 階級
# create_success_home: 首頁已成功新增。 content: 內容
# create_success_layout: 樣板已成功新增。 contenteditable:
# create_success_link: 連結已成功新增。 update_done: 更新完成
# create_success_page: 頁面已成功新增。 update_failed: 更新失敗
# create_success_home: 首頁已成功新增。 create_error_link: 新增連接時出錯。
# create_success_layout: 佈局已成功新增。 create_error_page: 新增頁面時出錯。
# create_success_link: 連結已成功新增。 create_success_home: 首頁已成功新增。
# create_success_page: 頁面已成功新增。 create_success_layout: 樣板已成功新增。
# create_success_snippet: 片段已成功新增。 create_success_link: 連結已成功新增。
# create_success_user: 用戶已成功新增。。 create_success_page: 頁面已成功新增。
# dashboard: 儀表板 create_success_home: 首頁已成功新增。
# data: 選擇檔案 create_success_layout: 佈局已成功新增。
# delete_language: 刪除語言 create_success_link: 連結已成功新增。
# description: 描述 create_success_page: 頁面已成功新增。
# design: 版型管理 create_success_snippet: 片段已成功新增。
# disable_language: 禁用語言 create_success_user: 用戶已成功新增。。
# edit: 編輯 dashboard: 儀表板
# editing_home: 編輯首頁 data: 選擇檔案
# editing_layout: 編輯樣板 delete_language: 刪除語言
# editing_link: 編輯連結 description: 描述
# editing_page: 編輯頁面 design: 版型管理
# editing_snippet: 編輯片段 disable_language: 禁用語言
# editing_info: 編輯用戶資料 edit: 編輯
# editing_role: 編輯用戶身份 editing_home: 編輯首頁
# email: Email editing_layout: 編輯樣板
# enable_language: 啟用語言 editing_link: 編輯連結
# enabled_for: 啟用 editing_page: 編輯頁面
# file_name: 檔名 editing_snippet: 編輯片段
# file_size: 檔案大小 editing_info: 編輯用戶資料
# file_upload: 文件上載 editing_role: 編輯用戶身份
# format: 格式 email: Email
# home: 首頁 enable_language: 啟用語言
# id: ID enabled_for: 啟用
# info: 資料 file_name: 檔名
# intro: 簡介 file_size: 檔案大小
# is_published: 被出版 file_upload: 文件上載
# item: 網站架構 format: 格式
# key: 關鍵 home: 首頁
# keywords: 關鍵字 id: ID
# language: 語言 info: 資料
# layout: 佈局 intro: 簡介
# layout_name: 佈局名字 is_published: 被出版
# link: 連結管理 item: 網站架構
# links: 網路資源 key: 關鍵
# list_assets: 資產列表 keywords: 關鍵字
# list_designs: 設計列表 language: 語言
# list_items: 項目列表 layout: 佈局
# list_puchases: 購買清單 layout_name: 佈局名字
# list_snippets: 斷片列表 link: 連結管理
# list_users: 使用列表 links: 網路資源
# list_infos: 用戶資料列表 list_assets: 資產列表
# list_roles: 用戶身份列表 list_designs: 設計列表
# mail_address: 郵件地址 list_items: 項目列表
# mail_port: 傳輸埠 list_puchases: 購買清單
# mail_domain: 網域名稱 list_snippets: 斷片列表
# mail_authentication: 認證 list_users: 使用列表
# mail_user_name: 帳號 list_infos: 用戶資料列表
# mail_password: 密碼 list_roles: 用戶身份列表
# mail_tls: TLS mail_address: 郵件地址
# mail_enable_starttls_auto: Enable Start TLS Auto mail_port: 傳輸埠
# member: 會員 mail_domain: 網域名稱
# menu_enabled_for: 選單啟用 mail_authentication: 認證
# module: mail_user_name: 帳號
# authorization: 模組授權 mail_password: 密碼
# move_down: 往下移 mail_tls: TLS
# move_up: 往上移 mail_enable_starttls_auto: Enable Start TLS Auto
# multilingual: 多種語言 member: 會員
# my_avatar: 我的頭像 menu_enabled_for: 選單啟用
# no_home_page: 您沒有首頁 module:
# no_layout: 您沒有佈局 authorization: 模組授權
# name: 名稱 move_down: 往下移
# new_admin: move_up: 往上移
# side_bar: multilingual: 多種語言
# all_user: 所有使用者 my_avatar: 我的頭像
# add_user: 新增使用者 no_home_page: 您沒有首頁
# user_roles: 角色 no_layout: 您沒有佈局
# user_info: 使用者資訊 name: 名稱
# user: 會員 new_admin:
# users: side_bar:
# all_plugin_summary: 全部 all_user: 所有使用者
# profile: 基本資料 add_user: 新增使用者
# roles: user_roles: 角色
# staff: 職員資料 user_info: 使用者資訊
# student: 學生資料 user: 會員
# teacher: 教師資料 users:
# action: all_plugin_summary: 全部
# add: 新增 profile: 基本資料
# edit: 編輯 roles:
# delete: 刪除 staff: 職員資料
# quick_edit: 快速編輯 student: 學生資料
# next: 下一頁 teacher: 教師資料
# prev: 上一頁 action:
# attributes: add: 新增
# roles: 角色 edit: 編輯
# name: 名稱 delete: 刪除
# publications: 出版數 quick_edit: 快速編輯
# courses: 開課數 next: 下一頁
# followers: 被關注數 prev: 上一頁
# show_mode: attributes:
# index: 清單 roles: 角色
# summary: 摘要 name: 名稱
# thumbnail: 縮圖 publications: 出版數
# table_header: courses: 開課數
# status: 狀態 followers: 被關注數
# category: 分類 show_mode:
# tags: 標籤 index: 清單
# clear_filter: 重置 summary: 摘要
# new_asset: 新增資產 thumbnail: 縮圖
# new_component: 新增元件 table_header:
# new_design: 新設計 status: 狀態
# new_home: 新增首頁 category: 分類
# new_layout: 新增樣板 tags: 標籤
# new_link: 新增連結 clear_filter: 重置
# new_page: 新增頁面 new_asset: 新增資產
# new_snippet: 新增片段 new_component: 新增元件
# new_user: 新增使用 new_design: 新設計
# new_info: 新增用戶資料 new_home: 新增首頁
# new_role: 新增用戶身份 new_layout: 新增樣板
# news: 新聞 new_link: 新增連結
# non_multilingual: new_page: 新增頁面
# object_auth: new_snippet: 新增片段
# list_title_of_users: 授權清單-%{auth_title} new_user: 新增使用
# update_done: 更新完成,結果顯示於清單 new_info: 新增用戶資料
# update_failed: 更新失敗 new_role: 新增用戶身份
# options: 選項 news: 新聞
# orig_upload_file: 原上傳檔名 non_multilingual:
# page: 頁面管理 object_auth:
# page_context: list_title_of_users: 授權清單-%{auth_title}
# edit: 編輯 update_done: 更新完成,結果顯示於清單
# ob_auth: update_failed: 更新失敗
# edit: 分類授權 options: 選項
# page_part_kinds: orig_upload_file: 原上傳檔名
# text: 文字區塊 page: 頁面管理
# public_r_tag: 系統模塊 page_context:
# module_widget: 外掛模塊 edit: 編輯
# position: 位置 ob_auth:
# published?: 發布? edit: 分類授權
# purchase: 購買 page_part_kinds:
# role: 身份 text: 文字區塊
# roles: 身份 public_r_tag: 系統模塊
# site_description: 網站描述 module_widget: 外掛模塊
# site_footer: 網站頁尾 position: 位置
# site_settings: 基本設定 published?: 發布?
# site_sub_menu: 網站次選單 purchase: 購買
# site_title: 網站標題 role: 身份
# setup_member: 成員設置 roles: 身份
# setup_translations: 語系設定 site_description: 網站描述
# setup_designs: 版型設定 site_footer: 網站頁尾
# site: 網站 site_settings: 基本設定
# site_setting: 網站設定 site_sub_menu: 網站次選單
# super_pages: 可編頁面 site_title: 網站標題
# structure: 網站結構 setup_member: 成員設置
# tags: 標籤 setup_translations: 語系設定
# title: 標題 setup_designs: 版型設定
# translation: 翻譯 site: 網站
# type: 類型 site_setting: 網站設定
# up_to_date: 最新版本 super_pages: 可編頁面
# update_error_link: 更新鏈接時出現錯誤。 structure: 網站結構
# update_error_page: 更新頁面時出現錯誤。 tags: 標籤
# update_success_content: 內容已成功更新。 title: 標題
# update_success_home: 首頁已成功更新。 translation: 翻譯
# update_success_layout: 樣板已成功更新。 type: 類型
# update_success_link: 連結已成功更新。 up_to_date: 最新版本
# update_success_page: 頁面已成功更新。 update_error_link: 更新鏈接時出現錯誤。
# update_success_snippet: 片段已成功更新。 update_error_page: 更新頁面時出現錯誤。
# update_success_user: 用戶已成功更新 update_success_content: 內容已成功更新。
# upload_design: 上傳設計 update_success_home: 首頁已成功更新。
# url: URL update_success_layout: 樣板已成功更新。
# user: 用戶 update_success_link: 連結已成功更新。
# user_new_interface: update_success_page: 頁面已成功更新。
# sys_basic_form: 系統基本資料表 update_success_snippet: 片段已成功更新。
# password: 密碼 update_success_user: 用戶已成功更新
# password_confirmation: 確認密碼 upload_design: 上傳設計
# email: 使用者帳號信箱 url: URL
# user_role: user: 用戶
# auth: user_new_interface:
# all_member: 所有會員 sys_basic_form: 系統基本資料表
# manager: 管理員 password: 密碼
# sub_manager: 次管理員 password_confirmation: 確認密碼
# by_role: 根據身份 email: 使用者帳號信箱
# by_sub_role: 根據次身份 user_role:
# block_list: 封鎖名單 auth:
# add_manager: 增加到管理員 all_member: 所有會員
# add_sub_manager: 增加到次管理員 manager: 管理員
# add_to_block_list: 封鎖名單 sub_manager: 次管理員
# add_to_privilege_list: 特許名單 by_role: 根據身份
# auth_by: -由%{user_display_name}授權 by_sub_role: 根據次身份
# user: 使用會員 block_list: 封鎖名單
# info: 用戶資料 add_manager: 增加到管理員
# panel: 用戶面板 add_sub_manager: 增加到次管理員
# role: 用戶身份 add_to_block_list: 封鎖名單
add_to_privilege_list: 特許名單
auth_by: -由%{user_display_name}授權
user: 使用會員
info: 用戶資料
panel: 用戶面板
role: 用戶身份
dashboard: dashboard:
bulletin: 公告 bulletin: 公告

View File

@ -1,4 +1,11 @@
module OrbitBasis module OrbitBasis
module RenderAnywhere
def render_anywhere(partial,opts)
view = ActionView::Base.new(Orbit::Application.config.paths["app/views"].first)
view.extend ApplicationHelper
view.render(:partial => partial,:locals=>opts)
end
end
module BaseModel module BaseModel
extend ActiveSupport::Concern extend ActiveSupport::Concern

View File

@ -15,7 +15,7 @@ module OrbitControllerLib
instance_variable_set(ivar_name, []) instance_variable_set(ivar_name, [])
if(is_manager? || is_admin?) if(is_manager? || is_admin?)
instance_variable_set(ivar_name, (id ? class_ref.admin_manager_all.find(id).to_a : class_ref.admin_manager_all)) instance_variable_set(ivar_name, (id ? class_ref.admin_manager_all.find(id).to_a : class_ref.admin_manager_all))
elsif is_sub_manager? else #is_sub_manager?
instance_variable_set(ivar_name, (class_ref.all)) instance_variable_set(ivar_name, (class_ref.all))
end end
instance_variable_get(ivar_name) instance_variable_get(ivar_name)

View File

@ -112,10 +112,14 @@ module ParserCommon
# page_menu # page_menu
def parse_menu(body, page, edit=nil) def parse_menu(body, page, edit=nil)
page_menu = body.css('.page_menu').first page_menu = body.css('.page_menu').first
if page_menu
home = get_homepage home = get_homepage
menu = page.design.layout.menu menu = page.design.layout.menu
fragment = Nokogiri::HTML::DocumentFragment.new(body, menu_level(home, page, 1, menu, edit)) fragment = Nokogiri::HTML::DocumentFragment.new(body, menu_level(home, page, 1, menu, edit))
page_menu.swap(fragment) page_menu.swap(fragment)
else
''
end
end end
# sub_menus # sub_menus
@ -173,10 +177,14 @@ module ParserCommon
# sitemap # sitemap
def parse_sitemaps(body = nil, page = nil, edit=nil) def parse_sitemaps(body = nil, page = nil, edit=nil)
sitemap = body.css('sitemap').first sitemap = body.css('sitemap').first
if sitemap
url = admin_site_sitemap_frontend_path(@site) url = admin_site_sitemap_frontend_path(@site)
options = "?inner=true" options = "?inner=true"
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load' path='#{url + options}'></div>") fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load' path='#{url + options}'></div>")
sitemap.swap(fragment) sitemap.swap(fragment)
else
''
end
end end
# page_contents # page_contents

View File

@ -1,170 +0,0 @@
# encoding: utf-8
# require 'ruby-debug'
require "#{Rails.root}/config/initializers/middle_site_connection"
namespace :mid_site do
desc "mid_site Rake task"
attr_from_mid = %w{nccu_id psn_nam ut_cod up_ut_cod eml_adr off_tel_ext sta_num}
officer_posgrp_code = %w{02 06 10 05} #from RSS2
admin_role = nil
sub_role = nil
test_account_ldap_id ='139716'
MiddleSiteConnection.establish
task :sync => :environment do
info_profile = Info.first(conditions: {:key => 'profile'})
def find_or_create_sub_role(role,ut_query=[],key='')
sub_role = role.sub_roles.get_sub_role_from_key(key)
if sub_role.nil?
ut_data = ut_query.find{|ut_data| ut_data["ut_cod"] == key }
sub_role = role.sub_roles.create!(:key => key)
sub_role.title_translations ={"en" => (ut_data["ut_eng_m"] rescue ''), "zh_tw" => (ut_data["ut_chi_m"] rescue '')}
sub_role.save!
p "Created SubRole(key: #{key}): EN: #{sub_role.title_translations['en']}, CH: #{sub_role.title_translations['zh_tw']} ParentRole(#{role.key}): #{role.title_translations['en']}"
end
sub_role
end
users_from_mid = $mid_site_connection.query("SELECT #{attr_from_mid.join(',')} FROM rss_pautlst_ut WHERE posgrp_cod IN (#{officer_posgrp_code.join(',')})")
ut_data_from_mid = $mid_site_connection.query("SELECT ut_odr, ut_cod, up_ut_cod, ut_chi_m, ut_eng_m FROM rss_paunit WHERE ut_tpe = '1' AND ut_grp != '3' AND up_ut_cod != 'F00' ORDER BY ut_odr, ut_cod")
remote_list = users_from_mid.collect{|t| t["nccu_id"]}
#remove delete user sho has been deleted at remote first
local_need_remove = User.all.collect{|t| t.nccu_id rescue nil}.uniq.delete_if {|x| x == nil} - remote_list
desc "Going to delete User with IDs: #{local_need_remove.inspect}"
local_need_remove = User.excludes(nccu_ldap_uid: test_account_ldap_id ).collect{|t| t.nccu_ldap_uid rescue nil}.uniq.delete_if {|x| x == nil} - remote_list
AppManager.all.collect{|am| am if am.user.nil? }.delete_if {|x| x == nil}.each{|am| am.destroy}
desc "Deletion completed! \n"
#starting update user
desc "Updating and Newing Users"
users_from_mid.each do |mid_user|
ut_item = ut_data_from_mid.find{|ut_data| ut_data["ut_cod"] == mid_user["ut_cod"]}
up_ut_item = ut_data_from_mid.find{|ut_data| ut_data["ut_cod"] == mid_user["up_ut_cod"] }
local_user = User.find_or_initialize_by(:nccu_ldap_uid => mid_user["nccu_id"])
users_name_from_mid = $mid_site_connection.query("SELECT eng_nam_l,eng_nam_f,chi_nam_l,chi_nam_f FROM rss_zzperson_view WHERE nccu_id =#{mid_user["nccu_id"]}").first
first_name = AttributeValue.find_or_create_by( :user_id => local_user.id, :attribute_field_id => info_profile.attribute_fields[0].id, :key => 'first_name')
last_name = AttributeValue.find_or_create_by( :user_id => local_user.id, :attribute_field_id => info_profile.attribute_fields[1].id, :key => 'last_name')
first_name['en'] = users_name_from_mid["eng_nam_f"]
first_name['zh_tw'] = users_name_from_mid["chi_nam_f"]
first_name.save
last_name['en'] = users_name_from_mid["eng_nam_l"]
last_name['zh_tw'] = users_name_from_mid["chi_nam_l"]
last_name.save
user_model_mapper = Hash[:ut_cod => mid_user["ut_cod"] ,:up_ut_cod => mid_user["up_ut_cod"],:email => mid_user["eml_adr"],:off_tel_ext => mid_user["off_tel_ext"],:sta_num => mid_user["sta_num"]]
user_model_mapper[:admin] = false
local_user.update_attributes(user_model_mapper)
local_user.role = Role.find_or_create_by( :key => "department_admin",:build_in => true)
local_user.role.title_translations = {"en" => 'Department Admin', "zh_tw" => '系所使用者' }
unless local_user.ut_cod == local_user.up_ut_cod #if the ut_cod has additions info for up ut
local_user.sub_roles << find_or_create_sub_role(local_user.role,ut_data_from_mid,local_user.up_ut_cod)
end
local_user.sub_roles << find_or_create_sub_role(local_user.role,ut_data_from_mid,local_user.ut_cod)
local_user.save!
end
sys_users = User.all(conditions: {admin: false}).includes(:avatar).to_a
end
task :install_admin => :before_instll_admin do
admins_nccu_id = '2772'
info_profile = Info.first(conditions: {:key => 'profile'})
user_from_mid = $mid_site_connection.query("SELECT #{attr_from_mid.join(',')} FROM rss_pautlst_ut WHERE posgrp_cod IN (#{officer_posgrp_code.join(',')}) AND nccu_id = '#{admins_nccu_id}' limit 1")
admin_at_mid = user_from_mid.first
local_user = User.find_or_initialize_by(:nccu_ldap_uid => admin_at_mid["nccu_id"])
local_user.update_attributes(:email => admin_at_mid["eml_adr"], :admin => true, :role_id => admin_role.id, :sub_role_ids => [sub_role.id])
users_name_from_mid = $mid_site_connection.query("SELECT eng_nam_l,eng_nam_f,chi_nam_l,chi_nam_f FROM rss_zzperson_view WHERE nccu_id =#{admin_at_mid["nccu_id"]}").first
first_name = AttributeValue.find_or_create_by( :user_id => local_user.id, :attribute_field_id => info_profile.attribute_fields[0].id, :key => 'first_name')
last_name = AttributeValue.find_or_create_by( :user_id => local_user.id, :attribute_field_id => info_profile.attribute_fields[1].id, :key => 'last_name')
first_name['en'] = users_name_from_mid["eng_nam_f"]
first_name['zh_tw'] = users_name_from_mid["chi_nam_f"]
first_name.save
last_name['en'] = users_name_from_mid["eng_nam_l"]
last_name['zh_tw'] = users_name_from_mid["chi_nam_l"]
last_name.save
end
task :install_test => :before_instll_admin do
admins_nccu_id = '139716'
# admin_role = Role.find_or_create_by( key: 'administrator')
# sub_role = admin_role.sub_roles.find_or_create_by(:key => 'computer_center')
info_profile = Info.first(conditions: {:key => 'profile'})
user_from_mid = $mid_site_connection.query("SELECT #{attr_from_mid.join(',')} FROM rss_pautlst_ut WHERE nccu_id = '#{admins_nccu_id}' limit 1")
admin_at_mid = user_from_mid.first
user_first_name = admin_at_mid["psn_nam"].size > 3 ? admin_at_mid["psn_nam"][3..-1] : admin_at_mid["psn_nam"][1..-1]
user_last_name = admin_at_mid["psn_nam"].size > 3 ? admin_at_mid["psn_nam"][1..2] : admin_at_mid["psn_nam"][0]
local_user = User.find_or_initialize_by(:nccu_ldap_uid => admin_at_mid["nccu_id"])
local_user.update_attributes(:email => admin_at_mid["eml_adr"], :admin => true, :role_id => admin_role.id, :sub_role_ids => [sub_role.id])
AttributeValue.create( :user_id => local_user.id, :attribute_field_id => info_profile.attribute_fields[0].id, :key => 'first_name', :en => user_first_name, :zh_tw => user_first_name )
AttributeValue.create( :user_id => local_user.id, :attribute_field_id => info_profile.attribute_fields[1].id, :key => 'last_name', :en => user_last_name, :zh_tw => user_last_name )
end
task :before_instll_admin => :environment do
var_1 = {"en" => 'Administrator', "zh_tw" => '管理員' }
var_1_1 = {"en" => 'Computer Center', "zh_tw" => '計算機中心'}
admin_role = Role.find_or_create_by( :key => 'administrator',:built_in => true)
admin_role.title_translations =var_1
admin_role.save!
sub_role = admin_role.sub_roles.find_or_create_by(:key => 'computer_center', :built_in => true)
sub_role.title_translations =var_1_1
sub_role.save!
#var_1_1_1 = I18nVariable.create!( :document_class => 'Attribute', :key => 'field', :en => 'Field', :zh_tw => '領域', :parent_id => var_1_1.id )
#var_1_1_2 = I18nVariable.create!( :document_class => 'Attribute', :key => 'department', :en => 'Department', :zh_tw => '學系', :parent_id => var_1_1.id )
end
task :clean_local_account => :environment do
User.remote_account.each{|user| user.destroy}
end
task :claen_cc => [:clean_i18n_vars,:clean_admin_role_and_sub_role] do
end
task :clean_i18n_vars => :environment do
i18ns = I18nVariable.any_in( key: ['administrator','computer_center'])
i18ns.each { |var| var.destroy }
end
task :clean_ldap_users => :environment do
User.where(:nccu_ldap_uid.ne => nil ).each {|t| t.destroy}
end
task :clean_admin_role_and_sub_role => :environment do
data = Role.any_in( key: ['administrator','computer_center'])
data.each { |var| var.destroy }
data = SubRole.any_in( key: ['administrator','computer_center'])
data.each { |var| var.destroy }
end
end

View File

@ -3,6 +3,32 @@ require 'spec_helper'
describe AttributeValue do describe AttributeValue do
describe "#attribute_value" do describe "#attribute_value" do
context "Date should render out right value"
before do
@user = User.where(email:'chris@rulingcom.com').first
@af = AttributeField.last
@af.markup = "date"
@af.save
@av = @user.attribute_values.build :attribute_field=>@af
end # of before
it "should be 民前 1年" do
@av.value = {"(1i)"=>"1911", "(2i)"=>"11", "(3i)"=>"6"}
binding.pry
@av.get_value_by_locale("zh_tw").should match /^民前.*/
end
it "should be 民國元年" do
@av.value = {"(1i)"=>"1912", "(2i)"=>"11", "(3i)"=>"6"}
@av.get_value_by_locale("zh_tw").should "民國元年"
end
it "should be 民國 75年" do
@av.value ={"(1i)"=>"1913", "(2i)"=>"11", "(3i)"=>"6"}
@av.get_value_by_locale("zh_tw").should match /^民國.*/
end
context "Data should be able to input and out put as aspect" context "Data should be able to input and out put as aspect"
before do before do
@ -15,45 +41,47 @@ describe AttributeValue do
LIST[:markups].each do |markup| LIST[:markups].each do |markup|
@av = nil @av = nil
it "[#{markup[0]}]Input: should save data at right way when local is set to #{locale_sat}" do it "[#{markup[0]}]Input: should save data at right way when local is set to #{locale_sat}" do
@af.markup = markup[0] pending
@av = nil # @af.markup = markup[0]
@input_value = assume_result = case markup[0] # @av = nil
when 'text_field','text_area' # @input_value = assume_result = case markup[0]
(locale_sat ? {"en"=> "lalala","zh_tw"=>"拉拉拉"} : "hahaha") # when 'text_field','text_area'
when 'select','radio_button' # (locale_sat ? {"en"=> "lalala","zh_tw"=>"拉拉拉"} : "hahaha")
"1" # when 'select','radio_button'
when 'date' # "1"
{"(1i)"=>Date.today.year.to_s,"(2i)"=>Date.today.month.to_s,"(3i)"=>Date.today.day.to_s} # when 'date'
when 'checkbox' # {"(1i)"=>Date.today.year.to_s,"(2i)"=>Date.today.month.to_s,"(3i)"=>Date.today.day.to_s}
{"1"=>"true", "3"=>"true"} # when 'checkbox'
end #end of case # {"1"=>"true", "3"=>"true"}
assume_result = ["1","3"] if markup[0] == 'checkbox' # end #end of case
@af.locale = locale_sat # assume_result = ["1","3"] if markup[0] == 'checkbox'
@af.save # @af.locale = locale_sat
@data_hash = {"attribute_field_id" => @af.id,"value" => @input_value} # @af.save
@av = @user.attribute_values.build(@data_hash) # @data_hash = {"attribute_field_id" => @af.id,"value" => @input_value}
@av.save # @av = @user.attribute_values.build(@data_hash)
# @av.save
@av.value.should == assume_result # @av.value.should == assume_result
# @av.destroy # @av.destroy
end end
it "[#{markup[0]}]Output(just for show): should output data at right way when local is set to #{locale_sat}" do it "[#{markup[0]}]Output(just for show): should output data at right way when local is set to #{locale_sat}" do
locale = I18n.locale pending
assume_result = case markup[0] # locale = I18n.locale
when 'text_area' # assume_result = case markup[0]
(locale_sat ? "拉拉拉" : "hahaha") # when 'text_area'
when 'text_field' # (locale_sat ? "拉拉拉" : "hahaha")
(locale_sat ? "拉拉拉" : "hahaha") # when 'text_field'
when 'select','radio_button' # (locale_sat ? "拉拉拉" : "hahaha")
(locale_sat ? "男性" : "男性") # when 'select','radio_button'
when 'date' # (locale_sat ? "男性" : "男性")
Date.today # when 'date'
when 'checkbox' # Date.today
(locale_sat ? "男性,不公開" : "男性,不公開") # when 'checkbox'
end #end of case # (locale_sat ? "男性,不公開" : "男性,不公開")
# end #end of case
@av.get_value_by_locale(locale).should == assume_result # @av.get_value_by_locale(locale).should == assume_result
end end
end #end of LIST loop end #end of LIST loop

View File

@ -1,6 +1,6 @@
class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendController class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendController
include OrbitControllerLib::DivisionForDisable include OrbitControllerLib::DivisionForDisable
before_filter :for_app_manager,:except => [:index] before_filter :for_app_manager,:except => [:index,:get_categorys_json,:get_bulletins_json]
def index def index
@bulletin_categorys = get_categories_for_index("BulletinCategory") @bulletin_categorys = get_categories_for_index("BulletinCategory")
@ -15,6 +15,48 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendCo
end end
end end
def get_categorys_json
categorys = BulletinCategory.all
data = Array.new
categorys.each do |c|
data << {
category: c.title,
link: "http://#{request.host_with_port}#{panel_announcement_back_end_bulletin_category_get_bulletins_json_path(c)}"
}
end
#render :json => @data.to_json
#to print readable json
render :json => JSON.pretty_generate(data)
end
def get_bulletins_json
bulletin = BulletinCategory.find(params[:bulletin_category_id]).bulletins
p bulletin
data = Array.new
bulletin.each do |b|
deadline = b.deadline
if not deadline.nil?
deadline = display_date_time(deadline)
else
deadline = I18n.t("no_deadline")
end
data << {
title: b.title,
link: "http://#{request.host_with_port}#{panel_announcement_front_end_bulletin_path(b, :category_id => b.bulletin_category.id)}",
postdate: display_date_time(b.postdate),
deadline: deadline,
tag: b.sorted_tags.to_a,
}
end
render :json => JSON.pretty_generate(data)
end
# GET /bulletins/1 # GET /bulletins/1
# GET /bulletins/1.xml # GET /bulletins/1.xml
def show def show

View File

@ -7,8 +7,8 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# before_filter :for_admin_only,:only => [:] # before_filter :for_admin_only,:only => [:]
# before_filter :for_app_manager,:only => [:index,:show,] # before_filter :for_app_manager,:only => [:index,:show,]
before_filter :force_order_for_visitor,:only=>[:index,:show,:get_sorted_and_filtered_bulletins] before_filter :force_order_for_visitor,:only=>[:index,:show,:get_sorted_and_filtered_bulletins]
before_filter :force_order_for_user,:except => [:index,:show,:get_sorted_and_filtered_bulletins,:get_bulletins_json] before_filter :force_order_for_user,:except => [:index,:show,:get_sorted_and_filtered_bulletins]
before_filter :for_app_sub_manager,:except => [:index,:show,:get_sorted_and_filtered_bulletins,:get_bulletins_json] before_filter :for_app_sub_manager,:except => [:index,:show,:get_sorted_and_filtered_bulletins]
before_filter :only => [ :new,:create,:edit,:update,:create] do |controller| before_filter :only => [ :new,:create,:edit,:update,:create] do |controller|
controller.get_categorys('BulletinCategory') controller.get_categorys('BulletinCategory')
@ -22,38 +22,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
render '/shared/preview/preview.html.erb',:layout=>false render '/shared/preview/preview.html.erb',:layout=>false
end end
def get_bulletins_json
@bulletins = Bulletin.all
@data = Hash.new
@data[I18n.t("category")] = Hash.new
@bulletins.each do |b|
deadline = b.deadline
if not deadline.nil?
deadline = display_date_time(deadline)
else
deadline = I18n.t("no_deadline")
end
if @data[I18n.t("category")][b.bulletin_category.title].nil?
@data[I18n.t("category")][b.bulletin_category.title] = Array.new
@data[I18n.t("category")][b.bulletin_category.title] << { title: b.title,
postdate: display_date_time(b.postdate),
deadline: deadline,
tag: b.sorted_tags.to_a,
}
else
@data[I18n.t("category")][b.bulletin_category.title] << { title: b.title,
postdate: display_date_time(b.postdate),
deadline: deadline,
tag: b.sorted_tags.to_a,
}
end
end
#render :json => @data.to_json
#to print readable json
render :json => JSON.pretty_generate(@data)
end
def index def index
# @bulletins = Bulletin.all # @bulletins = Bulletin.all

View File

@ -18,9 +18,14 @@ module Panel::Announcement::BackEnd::BulletinsHelper
end end
def show_delete_link(bulletin) def show_delete_link(bulletin)
by_bulletin = (bulletin.create_user_id == current_user.id) if !current_user.nil?
by_bulletin = (bulletin.create_user_id == current_user.id )
by_user = (is_manager? or is_admin?) by_user = (is_manager? or is_admin?)
by_bulletin or by_user by_bulletin or by_user
else
false
end
end end
def show_bulletin_title_at_index (bulletin) def show_bulletin_title_at_index (bulletin)

View File

@ -221,7 +221,7 @@
<span>or</span> <span>or</span>
<label class="file-select" for="fileselect">select from a folder <label class="file-select" for="fileselect">select from a folder
<!-- <input type="file" class="upload" id="fileselect" name="fileselect[]" multiple="multiple" /> --> <!-- <input type="file" class="upload" id="fileselect" name="fileselect[]" multiple="multiple" /> -->
<%= f.fields_for @bulletin.bulletin_files.build, do |f| %> <%= f.fields_for @bulletin.bulletin_files.build do |f| %>
<%= f.file_field :file, :multiple => true, :class => 'upload', :id => 'fileselect' %> <%= f.file_field :file, :multiple => true, :class => 'upload', :id => 'fileselect' %>
<% end %> <% end %>
</label> </label>

View File

@ -225,7 +225,7 @@
</ul> </ul>
</div> </div>
<table class="table table-bordered"> <table class="table table-bordered">
<tr> <tr>
<%= content_tag (:th) do %> <%= content_tag (:th) do %>
<%= t(:category) %> <%= t(:category) %>
@ -244,7 +244,7 @@
<%= t("search.too_many",:search_word => params[:search_query],:exceed_num=>@bulletins.count) if (@bulletins.count ==30) %> <%= t("search.too_many",:search_word => params[:search_query],:exceed_num=>@bulletins.count) if (@bulletins.count ==30) %>
<% end %> <% end %>
<% @bulletins.each do |post| %> <% @bulletins.each do |post| %>
<tr class=<%= cycle('odd', '') %>> <tr class=<%= cycle('odd', '') %>>
<%= content_tag(:th) do%> <%= content_tag(:th) do%>
<td><%= (post.bulletin_category.title rescue nil ) %></td> <td><%= (post.bulletin_category.title rescue nil ) %></td>
@ -255,9 +255,10 @@
<td class="date"><%= display_date_time(post.postdate) %></td> <td class="date"><%= display_date_time(post.postdate) %></td>
</tr> </tr>
<% end %> <% end %>
</table> </table>
<% end %>
<% else %> <% else %>
<table class="table table-bordered"> <table class="table table-bordered">
@ -269,8 +270,8 @@
<% @bulletins.each do |post| %> <% @bulletins.each do |post| %>
<tr> <tr>
<td><%= post.bulletin_category.i18n_variable[I18n.locale] rescue nil %></td> <td><%= post.bulletin_category.title rescue nil %></td>
<td><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %> <td><%= link_to post.title, panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
<%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %> <%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %>
</td> </td>
<td><%= display_date_time(post.postdate) %></td> <td><%= display_date_time(post.postdate) %></td>

View File

@ -12,6 +12,7 @@ Rails.application.routes.draw do
match "approve/:bulletin_id" => "approvals#approve",:as => :approve,:via => :post match "approve/:bulletin_id" => "approvals#approve",:as => :approve,:via => :post
match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add
match "link_quick_edit/:bulletin_id" => "bulletins#link_quick_edit" ,:as => :link_quick_edit match "link_quick_edit/:bulletin_id" => "bulletins#link_quick_edit" ,:as => :link_quick_edit
member do member do
get 'load_quick_edit' get 'load_quick_edit'
end end
@ -19,13 +20,17 @@ Rails.application.routes.draw do
post "preview" post "preview"
put "preview" put "preview"
get 'delete' get 'delete'
get 'get_bulletins_json'
end end
match "file_quick_add/:bulletin_id" => "bulletins#file_quick_add" ,:as => :file_quick_add match "file_quick_add/:bulletin_id" => "bulletins#file_quick_add" ,:as => :file_quick_add
match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit
end end
resources :bulletin_categorys resources :bulletin_categorys do
collection do
get 'get_categorys_json'
end
match "get_bulletins_json/" => "bulletin_categorys#get_bulletins_json", :as => :get_bulletins_json
end
resources :bulletin_links, :controller => 'bulletin_links' do resources :bulletin_links, :controller => 'bulletin_links' do
match "link_quick_edit/:bulletin_link_id" => "bulletin_links#link_quick_edit" ,:as => :link_quick_edit match "link_quick_edit/:bulletin_link_id" => "bulletin_links#link_quick_edit" ,:as => :link_quick_edit

View File

@ -15,7 +15,7 @@
<div class="control-group"> <div class="control-group">
<%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %> <%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<div class="controls"> <div class="controls">
<%= f.text_field locale, :class =>' input-xxlarge', :value => (@archive_file_category.title[locale] rescue nil) %> <%= f.text_field locale, :class =>' input-xxlarge', :value => (@archive_file_category.title_translations[locale] rescue nil) %>
</div> </div>
</div> </div>
<% end %> <% end %>

View File

@ -1,4 +1,4 @@
$("#<%= dom_id @archive_file_category %>").replaceWith("<%= j render :partial => 'link_category', :collection => [@archive_file_category] %>"); $("#<%= dom_id @archive_file_category %>").replaceWith("<%= j render :partial => 'archive_file_category', :collection => [@archive_file_category] %>");
<% @archive_file_category = WebLinkCategory.new(:display => 'List') # reset for new form %> <% @archive_file_category = ArchiveFileCategory.new(:display => 'List') # reset for new form %>
$(".edit_archive_file_category").replaceWith("<%= j render "form" %>") $(".edit_archive_file_category").replaceWith("<%= j render "form" %>")
$(".new_archive_file_category")[0].reset(); $(".new_archive_file_category")[0].reset();

View File

@ -242,7 +242,8 @@ var calendarAPI = function(){
this.loadMonthView = function(month,year){ this.loadMonthView = function(month,year){
$("#range_selection").hide(); $("#range_selection").hide();
$("#navigation").show(); $("#navigation").show();
$("#sec1").removeClass("span8").addClass("span3"); $("#sec1").removeClass("span7").addClass("span3");
$("#sec3").removeClass("span5").addClass("span4");
$("#sec2").show(); $("#sec2").show();
c.view = "month"; c.view = "month";
if(!month){ if(!month){
@ -512,7 +513,7 @@ var calendarAPI = function(){
this.loadDayView = function(day,month,year){ this.loadDayView = function(day,month,year){
$("#range_selection").hide(); $("#range_selection").hide();
$("#navigation").show(); $("#navigation").show();
$("#sec1").removeClass("span8").addClass("span3"); $("#sec1").removeClass("span7").addClass("span3");
$("#sec2").show(); $("#sec2").show();
c.view = "day"; c.view = "day";
if(!day){ if(!day){
@ -594,7 +595,8 @@ var calendarAPI = function(){
$('#view_holder').load(url, function() { $('#view_holder').load(url, function() {
$("#navigation").hide(); $("#navigation").hide();
$("#range_selection").html($("#agenda_date_range").html()).show(); $("#range_selection").html($("#agenda_date_range").html()).show();
$("#sec1").removeClass("span3").addClass("span8"); $("#sec1").removeClass("span3").addClass("span7");
$("#sec3").removeClass("span4").addClass("span5");
$("#sec2").hide(); $("#sec2").hide();
bindHandlers(); bindHandlers();
}) })

View File

@ -1,7 +1,7 @@
/* orbit calendar */ /* orbit calendar */
#orbit_calendar { #orbit_calendar {
padding: 10px 8px; padding: 10px 8px;
min-width: 960px;
transition: all 0.3s ease; transition: all 0.3s ease;
-webkit-transition: all 0.3s ease; -webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease; -moz-transition: all 0.3s ease;

View File

@ -42,7 +42,7 @@
<div id="calendar_agenda"> <div id="calendar_agenda">
<% @datesets.each_with_index do |dateset,i| %> <% @datesets.each_with_index do |dateset,i| %>
<div class="row-fluid"> <div class="row-fluid">
<div class="span3"> <div class="span4">
<h4><%= Date::MONTHNAMES[@calendartitle[i][0]] + " - " + @calendartitle[i][1].to_s %></h4> <h4><%= Date::MONTHNAMES[@calendartitle[i][0]] + " - " + @calendartitle[i][1].to_s %></h4>
<div class="tiny_calendar"> <div class="tiny_calendar">
<table class="table"> <table class="table">
@ -71,7 +71,7 @@
</table> </table>
</div> </div>
</div> </div>
<div class="span9"> <div class="span8">
<table class="table event_list"> <table class="table event_list">
<thead> <thead>
<tr height="0"> <tr height="0">

File diff suppressed because it is too large Load Diff

View File

@ -45,7 +45,7 @@ var galleryAPI = function(){
}else{ }else{
var cids = "all"; var cids = "all";
} }
$.getJSON("panel/gallery/front_end/get_albums",{"cid":cids,"tid":tids,"inner":true},function(categories){ $.getJSON("/panel/gallery/front_end/get_albums",{"cid":cids,"tid":tids,"inner":true},function(categories){
$.each(categories,function(x,category){ $.each(categories,function(x,category){
$.each(category,function(i,album){ $.each(category,function(i,album){
album.description = (album.description?album.description:"<%= I18n.t('gallery.no_description') %>") album.description = (album.description?album.description:"<%= I18n.t('gallery.no_description') %>")

View File

@ -90,7 +90,7 @@
-moz-transition: all, 0.3s ease; -moz-transition: all, 0.3s ease;
} }
.rgalbum .albumname { .rgalbum .albumname {
font-size: 15px; font-size: 18px;
padding: 6px 0; padding: 6px 0;
display: block; display: block;
transition: background 0.3s ease; transition: background 0.3s ease;
@ -105,14 +105,14 @@
.rgp .rgtitle { margin: 0 0 10px 0; } .rgp .rgtitle { margin: 0 0 10px 0; }
/* Photo Edit */ /* Photo Edit */
.albumname_edit label, .albumname_edit .rginput, .rgphoto_edit img, .rgphoto_edit .rginput { float: left; } .albumname_edit label, .albumname_edit .rginput, .rgphoto_edit > a, .rgphoto_edit .rginput { float: left; }
.rgphoto_edit, .albumname_edit { .rgphoto_edit, .albumname_edit {
clear: both; clear: both;
overflow: hidden; overflow: hidden;
margin-bottom: 10px; margin-bottom: 10px;
} }
.albumname_edit label { .albumname_edit label {
width: 120px; width: 150px;
margin: 0 10px 0 0; margin: 0 10px 0 0;
text-align: right; text-align: right;
padding: 0; padding: 0;
@ -398,7 +398,7 @@
.rgih26 { width: 208px; } .rgih26 { width: 208px; }
.rgih26 span { } .rgih26 span { }
.rgih26 input { width: 376px; } .rgih26 input { width: 356px; }
.rgih26.focus { } .rgih26.focus { }
.rgih26.focus span { } .rgih26.focus span { }
.rgih68 { width: 396px; } .rgih68 { width: 396px; }
@ -408,7 +408,7 @@
.rgih68.focus span { } .rgih68.focus span { }
.rgih98 { width: 396px; } .rgih98 { width: 396px; }
.rgih98 span { } .rgih98 span { }
.rgih98 textarea { width: 376px; height: 80px; } .rgih98 textarea { width: 356px; height: 110px; }
.rgih98.focus { } .rgih98.focus { }
.rgih98.focus span { } .rgih98.focus span { }
@ -476,7 +476,7 @@
.tag_search { .tag_search {
position: absolute; position: absolute;
left: -1px; left: -1px;
bottom: -32px; bottom: -30px;
width: 200px; width: 200px;
height: 32px; height: 32px;
background-color: #f5f5f5; background-color: #f5f5f5;
@ -552,3 +552,6 @@
padding-left: 12px; padding-left: 12px;
padding-right: 12px; padding-right: 12px;
} }
.o_album_edit form {
margin-left: 8px;
}

View File

@ -0,0 +1,66 @@
.widget_gallery {
margin-bottom: 20px;
}
.widget_gallery:after {
display: table;
width: 100%;
content: '';
}
.widget_gallery ul {
list-style: none;
margin: 0;
padding: 0;
}
.widget_gallery li a {
display: block;
}
.widget_gallery li a img {
height: auto;
display: block;
}
/* widget 1 */
.w1 ul {
margin: 0 -1%;
}
.w1 li {
float: left;
margin: 1%;
}
.w1.c2 li { width: 48%; }
.w1.c3 li { width: 31.3333%; }
.w1.c4 li { width: 23%; }
.w1.c5 li { width: 18%; }
.w1.c6 li { width: 14.6666%; }
.w1 li a:hover {
box-shadow: 0 0 20px rgba(0,0,0,0.9);
outline: solid 4px #429DFF;
position: relative;
}
.w1 li a img {
width: 100%;
}
/* widget 2 */
.w2 li {
width: 100%;
}
.w2 li a img {
width: 100%;
height: auto;
}
.w2 li a {
position: relative;
overflow: hidden;
color: #fff;
text-transform: capitalize;
}
.w2 li a .desc {
position: absolute;
bottom: -60px;
opacity: 0;
display: block;
width: 100%;
padding: 5%;
background-color: rgba(8, 166, 255, 0.8);
}

View File

@ -1,7 +1,7 @@
class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
include AdminHelper include AdminHelper
before_filter :force_order_for_user, :except => [:index,:get_album_json] before_filter :force_order_for_user, :except => [:index,:get_album_json,:get_imgs_json]
def index def index
if is_manager? || is_admin? || is_sub_manager? if is_manager? || is_admin? || is_sub_manager?
@ -119,9 +119,27 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
albums.each do |album| albums.each do |album|
tag_names = Array.new tag_names = Array.new
all_image = Array.new
album.tag_ids.each do |tag|
tag_names << GalleryTag.find(tag)[I18n.locale]
end
output << {
album_cover_file: "http://#{request.host_with_port}#{album.cover_path}",
album_name: album.name,
album_tag_names: tag_names,
album_link:"http://#{request.host_with_port}#{panel_gallery_back_end_album_get_imgs_json_path(album)}"
}
end
render :json=>JSON.pretty_generate(output)
end
def get_imgs_json
album = GalleryAlbum.find(params[:album_id])
images = album.gallery_images.all images = album.gallery_images.all
output = Array.new
images.each do |image| images.each do |image|
tags = Array.new tags = Array.new
@ -129,28 +147,14 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
tags << GalleryTag.find(tag)[I18n.locale] tags << GalleryTag.find(tag)[I18n.locale]
end end
all_image << { output << {
image_title: image.title, image_title: image.title,
image_description: image.description, image_description: image.description,
image_file: { url: "http://#{request.host_with_port+image.file.url}", image_file: { url: "http://#{request.host_with_port}#{image.file.url}",
thumb: "http://#{request.host_with_port+image.file.thumb.to_s}"}, thumb: "http://#{request.host_with_port}#{image.file.thumb.to_s}"},
image_tag_names: tags} image_tag_names: tags}
end end
album.tag_ids.each do |tag|
tag_names << GalleryTag.find(tag)[I18n.locale]
end
output << {
album_cover_file: "http://#{request.host_with_port+album.cover_path}",
album_name: album.name,
album_tag_names: tag_names,
images: all_image
}
end
#render :json=>{:images => @output,
# :tag_names => @tag_names}.to_json
render :json=>JSON.pretty_generate(output) render :json=>JSON.pretty_generate(output)
end end

View File

@ -0,0 +1,23 @@
class Panel::Gallery::Widget::AlbumsController < OrbitWidgetController
def widget1
@settings = {"vertical"=>2,"horizontal"=>6}
@class = "c" + @settings["horizontal"].to_s
@total = @settings["vertical"] * @settings["horizontal"]
@rnd = Random.new
@images = []
for i in 0..@total-1
@sn = @rnd.rand(0...GalleryImage.count)
if @sn < 0
@sn = @sn * -1
end
image = GalleryImage.skip(@sn).limit(1).first
values = {"show_link"=>theater_panel_gallery_front_end_album_path(image),"thumb"=>image.file.thumb.url}
@images << values
end
end
def widget2
end
end

View File

@ -0,0 +1,20 @@
<%= stylesheet_link_tag "widget_gallery" %>
<%# content_for :page_specific_javascript do %>
<%#= javascript_include_tag "cycle" %>
<%# end %>
<div class="four columns">
<h4>Gallery Widget</h4>
<p>WIDGET 1</p>
<div class="widget_gallery w1 <%= @class %>">
<ul>
<% @images.each do |image| %>
<li><a href="<%= image['show_link'] %>" title="photo description 1"><img src="<%= image['thumb'] %>" alt=""/></a></li>
<% end %>
<!-- <li><a href="" title="photo description 2"><img src="images/assets/2.jpg" alt=""/></a></li>
<li><a href="" title="photo description 3"><img src="images/assets/3.jpg" alt=""/></a></li>
<li><a href="" title="photo description 4"><img src="images/assets/4.jpg" alt=""/></a></li>
<li><a href="" title="photo description 5"><img src="images/assets/5.jpg" alt=""/></a></li>
<li><a href="" title="photo description 6"><img src="images/assets/6.jpg" alt=""/></a></li> -->
</ul>
</div>
</div>

View File

@ -1,4 +1,5 @@
Rails.application.routes.draw do Rails.application.routes.draw do
namespace :panel do namespace :panel do
namespace :gallery do namespace :gallery do
namespace :back_end do namespace :back_end do
@ -6,11 +7,14 @@ Rails.application.routes.draw do
match "upload_image" => "albums#upload_image" match "upload_image" => "albums#upload_image"
match "save_tags" => "tags#save_tags" match "save_tags" => "tags#save_tags"
match "albums/save_tags" => "tags#save_tags" match "albums/save_tags" => "tags#save_tags"
resources :albums do resources :albums do
match "set_cover" => "albums#set_cover" match "set_cover" => "albums#set_cover"
match "imgs" => "albums#imgs" match "imgs" => "albums#imgs"
match "upload_panel" => "albums#upload_panel" match "upload_panel" => "albums#upload_panel"
match "images_tags" => "albums#images_tags" match "images_tags" => "albums#images_tags"
match "get_imgs_json" => "albums#get_imgs_json"
collection do collection do
get "get_album_json" get "get_album_json"
end end
@ -21,9 +25,10 @@ Rails.application.routes.draw do
resources :album_images resources :album_images
resources :gallery_categories resources :gallery_categories
resources :tags resources :tags
end end
namespace :front_end do namespace :front_end do
match "orbit_galleries" => "orbit_galleries#index"
match "get_albums" => "albums#get_albums" match "get_albums" => "albums#get_albums"
# match "orbit_galleries" => "orbit_galleries#index" # match "orbit_galleries" => "orbit_galleries#index"
# match "gallery_category_save" => "orbit_galleries#new_category" # match "gallery_category_save" => "orbit_galleries#new_category"
@ -50,6 +55,10 @@ Rails.application.routes.draw do
end end
resources :album_images resources :album_images
end end
namespace :widget do
match "widget1" => "albums#widget1"
end
end end
end end
end end

View File

@ -59,8 +59,8 @@ class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController
@data = Array.new @data = Array.new
locations.each do |location| locations.each do |location|
picurl = "http://#{request.host_with_port + location.file.url}", picurl = location.file.blank? ? '' : "http://#{request.host_with_port + location.file.url}"
thumburl = "http://#{request.host_with_port + location.file.thumb.url}" thumburl = location.file.blank? ? '' : "http://#{request.host_with_port + location.file.thumb.url}"
@data << { name: location.name, @data << { name: location.name,
pic_url: picurl, pic_url: picurl,
thumb_url: thumburl, thumb_url: thumburl,

View File

@ -13,7 +13,7 @@
<tbody id="tbody_locations" class="sort-holder"> <tbody id="tbody_locations" class="sort-holder">
<% @locations.each do |location| %> <% @locations.each do |location| %>
<tr class="with_action"> <tr class="with_action">
<td><%= image_tag(location.file, alt: location.file, size: "50x50" )%></td> <td><%= image_tag(location.file, alt: location.file, size: "50x50" ) if !location.file.blank? %></td>
<td><%= location.name%></td> <td><%= location.name%></td>
<td><%= location.longitude%></td> <td><%= location.longitude%></td>
<td><%= location.latitude%></td> <td><%= location.latitude%></td>

View File

@ -17,7 +17,7 @@ module Panel::News::BackEnd::NewsBulletinsHelper
end end
def news_show_delete_link(news_bulletin) def news_show_delete_link(news_bulletin)
by_news_bulletin = (news_bulletin.create_user_id == current_user.id) by_news_bulletin = current_user.nil? ? false : (news_bulletin.create_user_id == current_user.id)
by_user = (is_manager? or is_admin?) by_user = (is_manager? or is_admin?)
by_news_bulletin or by_user by_news_bulletin or by_user
end end

View File

@ -229,7 +229,7 @@ class Panel::PersonalJournal::BackEnd::WritingJournalsController < OrbitBackendC
if @writing_journal.save if @writing_journal.save
if params[:writing_journal][:user_id] if params[:writing_journal][:user_id]
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:writing_journal][:user_id],:show_plugin_profile=>Journal)) } format.html { redirect_to(admin_users_new_interface_url(:id=>params[:writing_journal][:user_id],:show_plugin_profile=>'Journal')) }
else else
format.html { redirect_to(panel_personal_journal_back_end_writing_journals_url) } format.html { redirect_to(panel_personal_journal_back_end_writing_journals_url) }
end end