Compare commits

..
Author SHA1 Message Date
saurabhbhatia d47b300dcf Import Data, Sync Data
Conflicts:

	vendor/built_in_modules/personal_book/app/models/writing_book.rb
	vendor/built_in_modules/personal_conference/app/models/writing_conference.rb
	vendor/built_in_modules/personal_journal/app/models/writing_journal.rb
2013-10-18 12:02:48 +08:00
saurabhbhatia f85f6df8b1 NTU CPH initiated 2013-10-18 11:32:58 +08:00
chris 7b1b1fa2d3 Fix bug in open_for, it now takes all the open_for into account
Add open_for_user
2013-10-17 14:20:49 +08:00
Manson Wang a67be030c5 Fix JS Path 2013-10-17 11:21:46 +08:00
chris a76164465e Fix editing a tag module 2013-10-16 23:34:51 +08:00
saurabhbhatia d2459f42c0 Added Favicon and default image for orbitbar 2013-10-16 18:50:22 +08:00
saurabhbhatia 155039ac16 Updated fixes for site info - desktop openess, title always displayed 2013-10-16 18:33:57 +08:00
Manson Wang 2bcecc322e Update Ad_Banner for new jQuery
Removed loading module.js in module_widget.html.erb
2013-10-16 12:28:21 +08:00
Spen fbe6017382 new ui ask module lose 2 file 2013-10-16 10:31:16 +08:00
harrybomrah df5cda7a98 new feature added for not loading submenus inside api for desktop 2013-10-16 09:37:39 +08:00
harrybomrah fbea249782 jquery update and also fixed app manager bug .. jquery updated to 1.10.2 and jquery ui updated to 1.10.0 .. gem jquery-rails vs 2.1.4 changed to 3.0.4 and jquery-ui-rails changed to 4.0.5 2013-10-16 09:37:33 +08:00
chris 279ac774d4 Migrate form old ui to new ui (categories, tags and authorizations) 2013-10-15 23:38:44 +08:00
Manson Wang 11b880752d Fix Ad_Banner backend refresh page after edit banner 2013-10-15 19:50:01 +08:00
Manson Wang 76ba7087b2 Fix Ad_Banner frontend for IE8
Fix backend bug in editing banner
Translation Added
2013-10-15 19:37:12 +08:00
Spen b9fbba2962 fix new ui ask module frontend 2013-10-15 17:01:07 +08:00
saurabhbhatia 96c3be68f7 Fixed Enable and Disable, Sitemap and Terms of Use for header and footer 2013-10-15 10:37:49 +08:00
saurabhbhatia 5fb3731430 Show Custom orbit bar icon only for frontend and desktop 2013-10-15 10:07:46 +08:00
saurabhbhatia fb34dc673f Changeable Orbitbar logo 2013-10-14 18:20:26 +08:00
harrybomrah 14ea611f8c fixed file view on server for desktop 2013-10-14 16:49:54 +08:00
harrybomrah 4f04eca74f test for fileview in desktop on server 2013-10-14 16:49:51 +08:00
saurabhbhatia 4120be6f8e fixes in sitemap, site preference 2013-10-14 16:48:50 +08:00
saurabhbhatia ae66e7257f Added Rackprofile to development assets 2013-10-14 10:55:01 +08:00
saurabhbhatia 55fa1cef4f Added Enable and disable terms of use, sitemap 2013-10-11 13:14:37 +00:00
saurabhbhatia 5c8a57e700 Fixed Sitemap Toggle 2013-10-09 09:06:21 +00:00
saurabhbhatia 7ef2dacf00 Fix links in member module 2013-10-09 05:22:51 +00:00
chris 08a8d668ec Display de page contexts in the mobile version as set in structure 2013-10-08 18:11:29 +08:00
chris b4f5fddc5c Add option to skip authorization 2013-10-08 17:18:58 +08:00
chris 315a24556c Fix parser common to skip not found module_app
Do not show default widget if there's no data
2013-10-08 16:42:20 +08:00
chris cce68beff1 Quick fix for front end reloading 2013-10-08 14:52:24 +08:00
chris cf7f7aa29c Fix tag page slide issues 2013-10-08 12:47:31 +08:00
chris 5328a26440 Fix structure position 2013-10-08 12:33:24 +08:00
74 changed files with 744 additions and 427 deletions

No files matched your search

+5 -2
View File
@@ -11,13 +11,14 @@ gem "net-ldap", "~> 0.3.1"
gem 'devise', '1.5.3' gem 'devise', '1.5.3'
gem 'exception_notification' # Send error trace gem 'exception_notification' # Send error trace
gem 'execjs' gem 'execjs'
gem 'jquery-rails', '2.1.4' gem 'jquery-rails', '3.0.4'
gem 'jquery-ui-rails' gem 'jquery-ui-rails', "4.0.5"
gem "select2-rails", '3.3.1' gem "select2-rails", '3.3.1'
gem 'kaminari' gem 'kaminari'
gem 'time_difference' gem 'time_difference'
gem "acts_as_unvlogable" gem "acts_as_unvlogable"
gem 'youtube_it' gem 'youtube_it'
gem 'gotcha'
# gem "memcached", "~> 1.4.3" # gem "memcached", "~> 1.4.3"
# gem "memcache-client" # gem "memcache-client"
@@ -97,6 +98,8 @@ group :test, :development do
gem "watchr" gem "watchr"
gem "spork" gem "spork"
gem "capybara" gem "capybara"
#gem 'rack-mini-profiler'
gem "better_errors"
# gem 'yard' # gem 'yard'
# gem "bluecloth" # gem "bluecloth"
end end
+1 -1
View File
@@ -6,7 +6,7 @@
// //
//= require jquery //= require jquery
//= require jquery_ujs //= require jquery_ujs
//= require jquery-ui //= require jquery.ui.all
//= require desktop/jquery.form //= require desktop/jquery.form
//= require desktop/jquery.tinyscrollbar //= require desktop/jquery.tinyscrollbar
//= require desktop/jquery.miniColors.min //= require desktop/jquery.miniColors.min
+36 -37
View File
@@ -168,7 +168,7 @@ var orbitDesktop = function(dom){
o.loadIconCache(); o.loadIconCache();
var custom_load = window.location.hash; var custom_load = window.location.hash;
if(!custom_load){ if(!custom_load){
$(o.contentHolder).empty().load("/desktop/desktop",function(){ $(o.contentHolder).empty().load("/desktop/desktop_container",function(){
o.desktopData["d_desktop"] = ""; o.desktopData["d_desktop"] = "";
o.initializeDesktop("d_desktop","",false); o.initializeDesktop("d_desktop","",false);
}) })
@@ -605,10 +605,11 @@ var orbitDesktop = function(dom){
this.menu_item = function(dom,customload,submenuitem){ this.menu_item = function(dom,customload,submenuitem){
if(!customload)customload=false; if(!customload)customload=false;
var target = dom.attr("id"); var target = dom.attr("id"),
var url = dom.attr("href"); url = dom.attr("href"),
submenu_pass = ( dom.attr("sub-menu") == "false" ? false : true);
if(!url)return false; if(!url)return false;
o.data_method = dom.attr("callback-method"); o.data_method = dom.attr("callback-method");
if(o.currenthtml!=target){ if(o.currenthtml!=target){
if(o.desktopData[o.currentface] == "undefined"){ if(o.desktopData[o.currentface] == "undefined"){
@@ -629,33 +630,37 @@ var orbitDesktop = function(dom){
window.o[o.data_method](target,url,cache); window.o[o.data_method](target,url,cache);
} }
} }
try { if( submenu_pass ){
if(!customload){ try {
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data); if(!customload){
} else {
if(submenuitem){
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]"));
} else {
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data); o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data);
} else {
if(submenuitem){
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]"));
} else {
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data);
}
} }
} } catch(EX){}
} catch(EX){} }
header_ani(); header_ani();
}); });
}else{ }else{
$(o.contentHolder).html(o.desktopData[o.currentface]); $(o.contentHolder).html(o.desktopData[o.currentface]);
try{ if( submenu_pass ){
if(!customload){ try{
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),o.desktopData[o.currentface]); if(!customload){
}else{ o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),o.desktopData[o.currentface]);
if(submenuitem) }else{
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]"),o.desktopData[o.currentface]); if(submenuitem)
else o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]"),o.desktopData[o.currentface]);
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),o.desktopData[o.currentface]); else
} o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),o.desktopData[o.currentface]);
}catch(EX){} }
}catch(EX){}
}
cache = (o.lastlink == "/desktop/app_manager" ? false : true); // cache = (o.lastlink == "/desktop/app_manager" ? false : true);
if(typeof o.data_method != "undefined"){ if(typeof o.data_method != "undefined"){
if(o.data_method != ""){ if(o.data_method != ""){
window.o[o.data_method](target,url,cache); window.o[o.data_method](target,url,cache);
@@ -1095,7 +1100,7 @@ var orbitDesktop = function(dom){
data : options, data : options,
success : function(data){ success : function(data){
if(data.success == "true"){ if(data.success == "true"){
if(dom.is(":checked")){ console.log("true"); if(dom.is(":checked")){
elementSettingsData[$e.data("id")].sections.push({"id" : dom.data("section"),"name":sectionDetails.name}); elementSettingsData[$e.data("id")].sections.push({"id" : dom.data("section"),"name":sectionDetails.name});
o.notify("Added to " + sectionDetails.name,"success"); o.notify("Added to " + sectionDetails.name,"success");
}else{ }else{
@@ -1119,20 +1124,16 @@ var orbitDesktop = function(dom){
var info_open = function(){ var info_open = function(){
if($appinfo.is(":hidden")){ if($appinfo.is(":hidden")){
$('.overview').stop().animate({'width': '+=480'},0 , function(){ $('.overview').stop().animate({'width': '+=480'},0 , function(){
$('.tinycanvas').tinyscrollbar_update(); // $('.tinycanvas').tinyscrollbar_update('relative');
}); });
$appinfo $appinfo
.css({ .css({
'display': 'block',
'margin-left': -480 'margin-left': -480
}) }).fadeIn(200)
.delay(300)
.animate({ .animate({
'margin-left': 0 'margin-left': 0
}, 500, 'easeInOutQuint'); }, 500, 'easeInOutQuint');
} else { }
$('.tinycanvas').tinyscrollbar_update();
}
} }
var info_close = function(){ var info_close = function(){
@@ -1143,13 +1144,11 @@ var orbitDesktop = function(dom){
'margin-left': -480 'margin-left': -480
},500 , 'easeInOutQuint', function(){ },500 , 'easeInOutQuint', function(){
$('.overview').animate({'width': '-=480'}, 0, function(){ $('.overview').animate({'width': '-=480'}, 0, function(){
$('.tinycanvas').tinyscrollbar_update(); // $('.tinycanvas').tinyscrollbar_update();
}); });
$(this).attr("style",""); $(this).fadeOut(300).attr("style","");
}); });
} else { }
$('.tinycanvas').tinyscrollbar_update();
}
} }
$(window).on('keydown', function(){ $(window).on('keydown', function(){
if($('#searchbox').val() == 'Search'){ if($('#searchbox').val() == 'Search'){
+46 -18
View File
@@ -1,30 +1,58 @@
var banners = [];
var banner_index = 0;
$(document).ready(function() { $(document).ready(function() {
$.each($(".dymanic_load"),function(){ $.each($(".dymanic_load"),function(){
if($(this).attr("path")==''){$(this).html("App setting Failed");} if($(this).attr("path")==''){
$(this).html("App setting Failed");
if($(this).attr("path")!=''){ }else{
ajax_load_proc($(this),$(this).attr("path")); // Check if this App is AD_Banner
} if($(this).attr("path").indexOf("show_banner")>0){
ajax_load_proc($(this),$(this).attr("path"),"true");
}else{
ajax_load_proc($(this),$(this).attr("path"),$(this).attr("path"));
} }
); }
$("#main_content").addClass("module");
}); });
function ajax_load_proc(wapper,url){ $("#main_content").addClass("module");
});
function ajax_load_proc(wapper,url,isBanner){
$.get(encodeURI(url), {}, function(respText,textSta,XML){ $.get(encodeURI(url), {}, function(respText,textSta,XML){
if (textSta == 'success') { if (textSta == 'success') {
wapper.html(respText); if(isBanner=="true"){
}; wapper.html(respText);
if(textSta == 'error') var banner = banners[banner_index];
wapper.html("Loading Failed<br/> <a href='"+$(this).attr('path')+"'>Go See</a>"); $(banner.banner_name+" > img").each(function(){
$(this).load(function(){ banner.image_loaded++; });
});
BannerCycle(banner_index);
banner_index++;
}else{
wapper.html(respText);
}
};
if(textSta == 'error')
wapper.html("Loading Failed<br/> <a href='"+$(this).attr('path')+"'>Go See</a>");
}); });
} }
// Ad Banner FX code [start] function BannerCycle(banner_index){
function getTimeout() { var banner = banners[banner_index];
return $(this).attr('time_to_next'); // Wait untill all images are loaded
} if (banner.image_loaded==$(banner.banner_name+" img").length){
$(banner.banner_name).cycle({
delay: -1000,
fx: banner.banner_fx,
timeout: banner.time_to_next,
pager: banner.banner_pager,
pagerAnchorBuilder: function(idx, slide) { return "<li><a href='#'></a></li>"; }
});
}else{
setTimeout("BannerCycle("+banner_index+")",500);
}
}
$(document).ready(function() { $(document).ready(function() {
$(document).on('click', '.slideshow img', function() $(document).on('click', '.slideshow img', function()
@@ -44,7 +44,13 @@ $(function(){
startCollapsed: true, startCollapsed: true,
disableNesting: 'no-nest', disableNesting: 'no-nest',
update: function(event, ui) { update: function(event, ui) {
$.post("<%= Rails.application.routes.url_helpers.admin_update_position_path %>", { id: ui.item.attr('id'), parent_id: (ui.item.parent().closest('li').attr('id') || ui.item.parent().closest('ol').attr('id')), position: ui.item.index() } ); var position = null;
if($(ui.item).closest('ol').hasClass('item-groups')) {
position = $(ui.item).index() - 1;
} else {
position = $(ui.item).index();
};
$.post("<%= Rails.application.routes.url_helpers.admin_update_position_path %>", { id: ui.item.attr('id'), parent_id: (ui.item.parent().closest('li').attr('id') || ui.item.parent().closest('ol').attr('id')), position: position } );
} }
}); });
$(".sortable").delegate(".brand, .delete", clickEvent, function(e){ $(".sortable").delegate(".brand, .delete", clickEvent, function(e){
@@ -55,6 +55,13 @@
} else { } else {
$viewPage.find('.content').load(url, function(){ $viewPage.find('.content').load(url, function(){
$viewPage.clone(true).appendTo( $pageslide.empty() ).show(); $viewPage.clone(true).appendTo( $pageslide.empty() ).show();
if($('#filter-default-tag').length) {
$('#filter-default-tag').fastLiveFilter('.add-default-tags-list', '.filter-item', '.tag');
addTagsTab();
$('#view-page .card').cardCheck({
item: $('#view-page input[type="checkbox"]'),
});
};
if(callback)callback.call(this,$viewPage,element); if(callback)callback.call(this,$viewPage,element);
}); });
} }
+1 -1
View File
@@ -4,4 +4,4 @@
//= require basic/bootstrap //= require basic/bootstrap
//= require kernel //= require kernel
//= require lib/jquery.preload-min.js //= require lib/jquery.preload-min.js
//= require lib/jquery.cycle.all.latest.js //= require lib/jquery.cycle.all.js
@@ -40,6 +40,7 @@ class Admin::AdBannersController < OrbitBackendController
def edit def edit
@ad_banner = AdBanner.find(params[:id]) @ad_banner = AdBanner.find(params[:id])
render layout: false
end end
def update def update
@@ -34,38 +34,30 @@ class Admin::AuthorizationsController < OrbitBackendController
end end
def add_roles def add_roles
roles = Role.find(params[:role_ids]) rescue [] roles = Role.find(params[:role_ids]) rescue nil
users = [] unless roles.nil?
roles.each do |role|
users += role.users.all.entries
end
unless roles.blank?
authorization = get_or_create_authorization authorization = get_or_create_authorization
add_roles_to_auth(authorization, roles) unless @error add_roles_to_auth(authorization, roles)
end end
@users = authorization.authorized_users @users = authorization.authorized_users
render 'admin/authorizations/reload_users' render 'admin/authorizations/reload_users'
end end
def add_sub_roles def add_sub_roles
sub_roles = SubRole.find(params[:sub_role_ids]) rescue [] sub_roles = SubRole.find(params[:sub_role_ids]) rescue nil
users = [] unless sub_roles.nil?
sub_roles.each do |sub_role|
users += sub_role.users.all.entries
end
unless sub_roles.blank?
authorization = get_or_create_authorization authorization = get_or_create_authorization
add_sub_roles_to_auth(authorization, sub_roles) unless @error add_sub_roles_to_auth(authorization, sub_roles)
end end
@users = authorization.authorized_users @users = authorization.authorized_users
render 'admin/authorizations/reload_users' render 'admin/authorizations/reload_users'
end end
def add_users def add_users
users = User.find(params[:user_ids]) rescue [] users = User.find(params[:user_ids]) rescue nil
unless users.blank? unless users.nil?
authorization = get_or_create_authorization authorization = get_or_create_authorization
add_users_to_auth(authorization, users) unless @error add_users_to_auth(authorization, users)
end end
@users = authorization.authorized_users @users = authorization.authorized_users
render 'admin/authorizations/reload_users' render 'admin/authorizations/reload_users'
@@ -120,10 +112,6 @@ class Admin::AuthorizationsController < OrbitBackendController
protected protected
def add_managers_to_auth(users)
@module_app.add_managers(users)
end
def add_roles_to_auth(authorization, roles) def add_roles_to_auth(authorization, roles)
authorization.add_roles(roles) authorization.add_roles(roles)
end end
@@ -151,7 +139,7 @@ class Admin::AuthorizationsController < OrbitBackendController
@error = t(:no_data) @error = t(:no_data)
end end
when nil when nil
@module_app.auth_manager || @module_app.create_auth_manager(module_app_id: @module_app.id, title: "#{@type}_#{@module_app.key}") @module_app.auth_manager || @module_app.create_auth_manager(module_app_id: @module_app.id, title: @module_app.key)
else else
auth = @object.get_authorization_by_title("#{@type}_#{@module_app.key}") auth = @object.get_authorization_by_title("#{@type}_#{@module_app.key}")
unless auth unless auth
@@ -162,10 +150,6 @@ class Admin::AuthorizationsController < OrbitBackendController
end end
end end
def remove_managers_from_auth(users)
@module_app.remove_manager(users)
end
def remove_roles_form_auth(authorization, roles) def remove_roles_form_auth(authorization, roles)
authorization.remove_roles(roles) authorization.remove_roles(roles)
end end
+1 -1
View File
@@ -27,7 +27,7 @@ class Admin::ItemsController < OrbitBackendController
def update_position def update_position
item = Item.find(params[:id]) item = Item.find(params[:id])
item.shift_to(params[:parent_id], params[:position].to_i - 1) item.shift_to(params[:parent_id], params[:position].to_i)
render :nothing => true, status: 200 render :nothing => true, status: 200
end end
+1 -1
View File
@@ -60,7 +60,7 @@ class Admin::SitesController < OrbitBackendController
end end
def preference def preference
end end
@@ -274,8 +274,6 @@ class Admin::UsersNewInterfaceController < OrbitMemberController
else else
user.move_below(user_at_position) user.move_below(user_at_position)
end end
elsif to_go > User.count
user.move_to_bottom
end end
end end
render nothing: true, status: 200 render nothing: true, status: 200
+3 -1
View File
@@ -140,7 +140,9 @@ class ApplicationController < ActionController::Base
# update session if passed # update session if passed
session[:locale] = params[:locale] if params[:locale] session[:locale] = params[:locale] if params[:locale]
browser_locale = condition = nil browser_locale = condition = nil
default_locale = @site.default_locale if @site.default_locale.present?
# check if locale is valid for non site pages # check if locale is valid for non site pages
if LIST[:forbidden_item_names].include?(env['PATH_INFO'].split('/')[1].to_s) if LIST[:forbidden_item_names].include?(env['PATH_INFO'].split('/')[1].to_s)
condition = VALID_LOCALES.include?(session[:locale]) condition = VALID_LOCALES.include?(session[:locale])
elsif session[:locale] elsif session[:locale]
@@ -152,7 +154,7 @@ class ApplicationController < ActionController::Base
browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil
condition = @site.in_use_locales.include?(browser_locale) condition = @site.in_use_locales.include?(browser_locale)
end end
session[:locale] = condition ? (default_locale || browser_locale || session[:locale]) : I18n.default_locale.to_s session[:locale] = condition ? ( browser_locale || session[:locale] || default_locale) : I18n.default_locale.to_s
I18n.locale = session[:locale].to_sym I18n.locale = session[:locale].to_sym
@site_in_use_locales = site_locales_default_head(@site.in_use_locales) @site_in_use_locales = site_locales_default_head(@site.in_use_locales)
@site_valid_locales = site_locales_default_head(@site.valid_locales) @site_valid_locales = site_locales_default_head(@site.valid_locales)
+4 -3
View File
@@ -19,7 +19,7 @@ class DesktopController< ApplicationController
render :layout => "compatibility" render :layout => "compatibility"
end end
def desktop def desktop_container
render :layout => false render :layout => false
end end
@@ -340,10 +340,11 @@ class DesktopController< ApplicationController
render :json=>b.to_json render :json=>b.to_json
end end
private protected
def check_desktop_open def check_desktop_open
if Me.desktop_closed && current_user.nil? #Need to be change @site = Site.first
if @site.desktop_closed #Need to be change
redirect_to '/admin/dashboards' redirect_to '/admin/dashboards'
end end
end end
+24 -2
View File
@@ -12,7 +12,16 @@ class FrontController < ApplicationController
end end
def show_footer def show_footer
render :text => @site.footer @page = Page.find(:all, :conditions => {:name => /terms/i})
@name = @page.first.name
@url = "/#{@name}"
if !@site.enable_terms_of_use
render :text => (@site.footer + "<a href='#{@url}'>Terms of Use</a>")
else
render :text => @site.footer
end
end end
def show_menu def show_menu
@@ -21,7 +30,15 @@ class FrontController < ApplicationController
end end
def show_site_sub_menu def show_site_sub_menu
render :text => @site.sub_menu @page = Page.find(:all, :conditions => {:name => /sitemap/i})
@name = @page.first.name
@url = "/#{@name}"
if !@site.sitemap_menu_in_header
render :text => (@site.sub_menu + "<a href='#{@url}'>Sitemap</a>")
else
render :text => @site.sub_menu
end
end end
def show_sitemap def show_sitemap
@@ -43,6 +60,11 @@ class FrontController < ApplicationController
@tags = module_app.sorted_tags_for_cloud @tags = module_app.sorted_tags_for_cloud
end end
def show_terms_of_use
@site = Site.first rescue nil
@terms = @site.terms_of_use
end
private private
def menu_level(page, current_page, current, menu) def menu_level(page, current_page, current, menu)
+9 -1
View File
@@ -43,7 +43,7 @@ class MobileController < ApplicationController
def page def page
@page_title = t('mobile.page') @page_title = t('mobile.page')
@page_contexts = PageContext.where(:archived => false).page(params[:page_main]).per(15) @page_contexts = get_sorted_page_from_structure
end end
def page_content def page_content
@@ -57,4 +57,12 @@ class MobileController < ApplicationController
@no_footer = true if request.path =~ /app/ @no_footer = true if request.path =~ /app/
end end
def get_sorted_page_from_structure
page_contexts = Item.structure_ordered_items.inject([]){ |pages, page|
pages << page.page_contexts.where(archived: false).limit(1)[0] if page.is_a?(Page) && !page.page_contexts.blank?
pages
}
Kaminari.paginate_array(page_contexts).page(params[:page]).per(15)
end
end end
+4 -3
View File
@@ -9,7 +9,7 @@ class PagesController < ApplicationController
if @item if @item
delayed_impressionist(@item) delayed_impressionist(@item)
render_page render_page
else else
redirect_to '/admin/dashboards',:notice=>t(:need_home) redirect_to '/admin/dashboards',:notice=>t(:need_home)
# render :text => t(:need_home) # render :text => t(:need_home)
@@ -19,6 +19,7 @@ class PagesController < ApplicationController
def show def show
#begin #begin
@item = Item.first(:conditions => {:path => params[:page_name]}) @item = Item.first(:conditions => {:path => params[:page_name]})
if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s)) if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s))
delayed_impressionist(@item) delayed_impressionist(@item)
case @item.class.to_s case @item.class.to_s
@@ -26,7 +27,7 @@ class PagesController < ApplicationController
if params[:clicked_field_name] if params[:clicked_field_name]
render_page({"clicked_field_name"=>params["clicked_field_name"]}) unless save_from_no_lang_for_page render_page({"clicked_field_name"=>params["clicked_field_name"]}) unless save_from_no_lang_for_page
else else
render_page(params) unless save_from_no_lang_for_page render_page(params.except(:controller, :action, :page_name)) unless save_from_no_lang_for_page
end end
when 'Link' when 'Link'
redirect_to(@item[:url]) unless save_from_no_lang_for_page redirect_to(@item[:url]) unless save_from_no_lang_for_page
@@ -113,7 +114,7 @@ class PagesController < ApplicationController
end end
def check_frontend_open def check_frontend_open
if !Site.first.frontend_closed && current_user.nil? #Need to be change if Site.first.frontend_open && current_user.nil? #Need to be change
redirect_to '/admin/dashboards' redirect_to '/admin/dashboards'
end end
end end
+1 -1
View File
@@ -180,7 +180,7 @@ module ApplicationHelper
page_title = page.page_title ? page.page_title : page.title page_title = page.page_title ? page.page_title : page.title
if page.root? && @site.title if page.root? && @site.title
res << @site.title res << @site.title
elsif @site.title && @site.title_always_on elsif @site.title && !@site.title_always_on
res << @site.title + ' - ' + page_title res << @site.title + ' - ' + page_title
else else
res << page_title res << page_title
+1 -1
View File
@@ -199,7 +199,7 @@ module OrbitBackendHelper
objects.join(' ') objects.join(' ')
else else
objects = Array(objects).map do |object| objects = Array(objects).map do |object|
display_value(object.send(field)) display_value(object.send(field)) rescue ''
end end
objects.join(', ') objects.join(', ')
end end
+1 -1
View File
@@ -2,8 +2,8 @@ class AdBanner
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes include Mongoid::MultiParameterAttributes
include OrbitCoreLib::ObjectAuthable
include OrbitTag::Taggable include OrbitTag::Taggable
include OrbitModel::Authorizable
field :title field :title
field :transition_msec,type: Integer field :transition_msec,type: Integer
-1
View File
@@ -1,4 +1,3 @@
class AuthManager < Authorization class AuthManager < Authorization
# belongs_to :manager_authorizable, polymorphic: true
has_and_belongs_to_many :authorized_users, class_name: 'User', inverse_of: 'managing_apps' has_and_belongs_to_many :authorized_users, class_name: 'User', inverse_of: 'managing_apps'
end end
+10 -8
View File
@@ -46,15 +46,17 @@ class Item
def shift_to(new_parent, position) def shift_to(new_parent, position)
position = position.to_i position = position.to_i
unless self.parent_id.to_s.eql?(new_parent) && self.position == position new_parent = Item.find(new_parent)
new_parent = Item.find(new_parent) current_position_sibling = find_by_parent_and_position(new_parent, position)
current_position_sibling = find_by_parent_and_position(new_parent, position) if current_position_sibling
if current_position_sibling if self.position > current_position_sibling.position
move_above(current_position_sibling) self.move_above(current_position_sibling)
elsif self.parent != new_parent else
self.parent = new_parent self.move_below(current_position_sibling)
save
end end
elsif self.parent != new_parent
self.parent = new_parent
save
end end
end end
+3 -16
View File
@@ -7,6 +7,7 @@ class ModuleApp
field :auth_approval_users, type: Array, default: nil field :auth_approval_users, type: Array, default: nil
field :auth_manager_users, type: Array, default: nil field :auth_manager_users, type: Array, default: nil
field :auth_sub_manager_users, type: Array, default: nil field :auth_sub_manager_users, type: Array, default: nil
field :has_category, type: Boolean, default: false
field :key field :key
field :title field :title
field :sidebar_order,type: Integer,default: 0 field :sidebar_order,type: Integer,default: 0
@@ -189,7 +190,8 @@ class ModuleApp
end end
def update_auth_manager_users def update_auth_manager_users
self.update_attribute(:auth_manager_users, self.auth_manager_authorized_users.map{|user| user.id}) users = self.auth_manager_authorized_users
self.update_attribute(:auth_manager_users, users.map{|user| user.id}) if users
end end
def update_auth_sub_manager_users def update_auth_sub_manager_users
@@ -207,21 +209,6 @@ class ModuleApp
managers.include?(user) managers.include?(user)
end end
def add_managers(users)
users = Array(users)
if auth_manager = self.auth_manager
auth_manager.update_attribute(:authorized_users, (auth_manager.authorized_users + users).uniq)
else
self.create_auth_manager(authorized_users: users)
end
end
def remove_managers(users)
users = Array(users)
users = users.delete_if{|user| user == current_user || is_admin?}
self.auth_manager.update_attribute(:authorized_users, auth_manager.authorized_users - users)
end
def is_manager?(user) def is_manager?(user)
if user && !auth_manager_users.blank? if user && !auth_manager_users.blank?
auth_manager_users.include?(user.id) auth_manager_users.include?(user.id)
+2 -2
View File
@@ -30,8 +30,8 @@ class ModuleTag
if self.new_record? if self.new_record?
self.build_tag(name_translations: self.name_translations, is_default: self.is_default) self.build_tag(name_translations: self.name_translations, is_default: self.is_default)
else else
self.tag.name_translations = self.name_translations self.tag.attributes = {:name_translations => self.name_translations}
self.tag.is_default = self.is_default self.tag.attributes = {:is_default => self.is_default}
end end
end end
+5 -3
View File
@@ -12,14 +12,15 @@ class Site
field :private_key, :type => Binary field :private_key, :type => Binary
field :public_key, :type => Binary field :public_key, :type => Binary
field :frontend_closed, :type => Boolean, :default => false field :frontend_open, :type => Boolean, :default => true
field :backend_openness_on, :type => Boolean, :default => false field :backend_openness_on, :type => Boolean, :default => false
field :desktop_closed, :type => Boolean, :default => false field :desktop_closed, :type => Boolean, :default => false
field :sitemap_menu_in_header, :type => Boolean, :default => false
field :enable_terms_of_use, :type => Boolean, :default => false
field :title_always_on, :type => Boolean, :default => false field :title_always_on, :type => Boolean, :default => false
field :dashbroad_allow_visitor, :type => Boolean, :default => false field :dashbroad_allow_visitor, :type => Boolean, :default => false
field :mail_settings, :type => Hash field :mail_settings, :type => Hash
field :enabled_for, :type => Array, :default => nil
field :disk_space, :type => String field :disk_space, :type => String
field :system_package_info, :type => Hash,:default=>{} field :system_package_info, :type => Hash,:default=>{}
@@ -28,13 +29,14 @@ class Site
field :department field :department
mount_uploader :default_image, ImageUploader mount_uploader :default_image, ImageUploader
mount_uploader :favicon, ImageUploader
field :search,:type => Hash field :search,:type => Hash
field :resque_namespace,:type => String, :default=>APP_CONFIG['orbit'] field :resque_namespace,:type => String, :default=>APP_CONFIG['orbit']
field :title, localize: true field :title, localize: true
field :footer, localize: true field :footer, localize: true
field :sub_menu, localize: true field :sub_menu, localize: true
field :terms_of_user, localize: true field :terms_of_use, localize: true
field :google_analytics field :google_analytics
field :default_locale field :default_locale
-5
View File
@@ -1,8 +1,3 @@
# class Tag < ProtoTag
# belongs_to :module_app
# end
class Tag class Tag
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
+31 -25
View File
@@ -1,25 +1,31 @@
<div class="content"> <%= form_for @ad_banner, url: admin_ad_banner_path(@ad_banner) do |f| %>
<%= form_for(:ad_banner, :url => admin_ad_banner_path(:ad_banner), :remote => true) do |f| %> <fieldset>
<fieldset> <legend><%= t("ad_banner.banner") %></legend>
<legend>Ad Banner</legend> <label><%= t("ad_banner.banner_name") %></label>
<label>Banner Name</label> <%= f.text_field :title, :class=>"input-large", :placeholder=>"Banner Name" %>
<%= f.text_field :title, :class=>"input-large", :placeholder=>"Banner Name" %> <span class="help-block"><%= t("ad_banner.banner_name_note") %></span>
<span class="help-block">Banner Name only english</span> <label for="timeout"><%= t("ad_banner.ste") %></label>
<label for="timeout">Ste</label> <%= f.text_field :transition_sec, :class => 'input-large', :placeholder => 'Time' %>
<%= f.text_field :transition_sec, :class => 'input-large', :placeholder => 'Time' %> <span class="help-block"><%= t("ad_banner.ste_note") %></span>
<span class="help-block">Please enter the number of seconds</span> <label><%= t("ad_banner.best_size") %></label>
<label>Best Size</label> <%= f.text_field :best_size, :class=>"input-large", :placeholder=>"Banner Size" %>
<%= f.text_field :best_size, :class=>"input-large", :placeholder=>"Banner Size" %> <span class="help-block"><%= t("ad_banner.best_size") %> EX:120x30 </span>
<span class="help-block">Best Size EX:120x30 </span> <label><%= t("ad_banner.effect") %></label>
<label>Effect</label> <%= f.select :ad_fx ,AdBanner::FX_TYPES %>
<%= f.select :ad_fx ,AdBanner::FX_TYPES %> <div class="preview">
<div class="preview"> <%= image_tag "slideshow_preview_A.png", :width=>220 %>
<%= image_tag "slideshow_preview_A.png", :width=>220 %> <%= image_tag "slideshow_preview_B.png", :width=>220 %>
<%= image_tag "slideshow_preview_B.png", :width=>220 %> </div>
</div> <span class="help-block"><%= t("ad_banner.effect") %></span>
<span class="help-block">Effect</span> <a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a> <%= f.submit t(:update_), class: 'btn btn-primary btn-small' %>
<%= f.submit t(:create_), class: 'btn btn-primary btn-small' %> </fieldset>
</fieldset> <% end %>
<% end %> <script type="text/javascript">
</div> $('select').on('change', function() {
$(".preview").cycle({
delay: -3000,
fx: $(this).val()
});
});
</script>
+4 -6
View File
@@ -1,3 +1,5 @@
<%= javascript_include_tag "lib/jquery.cycle.all.js"%>
<table class="table main-list"> <table class="table main-list">
<thead> <thead>
<tr> <tr>
@@ -13,7 +15,7 @@
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<% if is_admin?%> <% if is_admin?%>
<li><%= link_to t(:edit), edit_admin_ad_banner_path(ad_banner)%></li> <li><%= link_to t(:edit), edit_admin_ad_banner_path(ad_banner), :class => "open-slide" %></li>
<li><%= link_to 'Destroy', admin_ad_banner_path(ad_banner), method: :delete , :confirm => t(:sure?) %></li> <li><%= link_to 'Destroy', admin_ad_banner_path(ad_banner), method: :delete , :confirm => t(:sure?) %></li>
<% end %> <% end %>
@@ -30,12 +32,8 @@
<!-- footer --> <!-- footer -->
<div class="bottomnav clearfix"> <div class="bottomnav clearfix">
<div class="action pull-right"> <div class="action pull-right">
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add_new), "#add-banner", :class => "btn btn-primary open-slide"%> <%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add_new), new_admin_ad_banner_path, :class => "btn btn-primary open-slide"%>
</div> </div>
</div> </div>
<div id="add-banner" class="nano" style="display:none">
<%= render 'new' %>
</div>
<% end %> <% end %>
+31 -25
View File
@@ -1,25 +1,31 @@
<div class="content"> <%= form_for(:ad_banner, :url => admin_ad_banners_path) do |f| %>
<%= form_for(:ad_banner, :url => admin_ad_banners_path) do |f| %> <fieldset>
<fieldset> <legend><%= t("ad_banner.banner") %></legend>
<legend>Ad Banner</legend> <label><%= t("ad_banner.banner_name") %></label>
<label>Banner Name</label> <%= f.text_field :title, :class=>"input-large", :placeholder=>"Banner Name" %>
<%= f.text_field :title, :class=>"input-large", :placeholder=>"Banner Name" %> <span class="help-block"><%= t("ad_banner.banner_name_note") %></span>
<span class="help-block">Banner Name only english</span> <label for="timeout"><%= t("ad_banner.ste") %></label>
<label for="timeout">Ste</label> <%= f.text_field :transition_sec, :class => 'input-large', :placeholder => 'Time' %>
<%= f.text_field :transition_sec, :class => 'input-large', :placeholder => 'Time' %> <span class="help-block"><%= t("ad_banner.ste_note") %></span>
<span class="help-block">Please enter the number of seconds</span> <label><%= t("ad_banner.best_size") %></label>
<label>Best Size</label> <%= f.text_field :best_size, :class=>"input-large", :placeholder=>"Banner Size" %>
<%= f.text_field :best_size, :class=>"input-large", :placeholder=>"Banner Size" %> <span class="help-block"><%= t("ad_banner.best_size") %> EX:120x30 </span>
<span class="help-block">Best Size EX:120x30 </span> <label><%= t("ad_banner.effect") %></label>
<label>Effect</label> <%= f.select :ad_fx ,AdBanner::FX_TYPES %>
<%= f.select :ad_fx ,AdBanner::FX_TYPES %> <div class="preview">
<div class="preview"> <%= image_tag "slideshow_preview_A.png", :width=>220 %>
<%= image_tag "slideshow_preview_A.png", :width=>220 %> <%= image_tag "slideshow_preview_B.png", :width=>220 %>
<%= image_tag "slideshow_preview_B.png", :width=>220 %> </div>
</div> <span class="help-block"><%= t("ad_banner.effect") %></span>
<span class="help-block">Effect</span> <a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a> <%= f.submit t(:create_), class: 'btn btn-primary btn-small' %>
<%= f.submit t(:create_), class: 'btn btn-primary btn-small' %> </fieldset>
</fieldset> <% end %>
<% end %> <script type="text/javascript">
</div> $('select').on('change', function() {
$(".preview").cycle({
delay: -3000,
fx: $(this).val()
});
});
</script>
+1
View File
@@ -1,3 +1,4 @@
<%= Rails.logger.info"@@@@@@@@@@@@@@@@"+design.inspect%>
<tr class="with_action"> <tr class="with_action">
<td class="span1"><%= check_box_tag 'to_delete[]', design.id, false, :class => "checkbox_in_list" %></td> <td class="span1"><%= check_box_tag 'to_delete[]', design.id, false, :class => "checkbox_in_list" %></td>
<td class="span2"> <td class="span2">
+1 -1
View File
@@ -5,6 +5,6 @@ $("#tags_index").html("<%= j render 'index' %>")
$.pageslide.close(); $.pageslide.close();
openSlide(); openSlide();
$('.card').cardCheck({ $('.card').cardCheck({
check: $('.card input[type="checkbox"]'), item: $('.card input[type="checkbox"]'),
}); });
checkedLength() checkedLength()
@@ -7,6 +7,7 @@
<%= f.hidden_field :public_r_tag_object_id, :value => @part.page.id %> <%= f.hidden_field :public_r_tag_object_id, :value => @part.page.id %>
<%#= f.select :public_r_tag_object_id, options_for_select([t(:horizontal), t(:vertical)], t(:horizontal)) %> <%#= f.select :public_r_tag_object_id, options_for_select([t(:horizontal), t(:vertical)], t(:horizontal)) %>
<% elsif @r_tag.eql?('sitemap') %> <% elsif @r_tag.eql?('sitemap') %>
<% elsif @r_tag.eql?('terms_of_use') %>
<% elsif @r_tag.eql?('breadcrumb') %> <% elsif @r_tag.eql?('breadcrumb') %>
<% else %> <% else %>
<%= f.select :public_r_tag_object_id, options_from_collection_for_select(@tag_objects, :id, :title, :selected => @part.public_r_tag_object_id) %> <%= f.select :public_r_tag_object_id, options_from_collection_for_select(@tag_objects, :id, :title, :selected => @part.public_r_tag_object_id) %>
+2 -2
View File
@@ -91,5 +91,5 @@
</div> </div>
</div> </div>
<%=javascript_include_tag "inc/update_cates_and_tags.js" %> <%=javascript_include_tag "lib/items/update_cates_and_tags.js" %>
<%= javascript_include_tag "inc/page_widget_edit_interface.js" %> <%= javascript_include_tag "lib/items/page_widget_edit_interface.js" %>
@@ -1,13 +1,13 @@
<li> <li class="map-block <%= 'disabled' if !sitemap_block.show_in_sitemap_for(temp_locale) %>">
<h6> <h6>
<input type="checkbox" class="toggle-check" data-deploy="right"> <input type="checkbox" id="<%= sitemap_block.id %>" class="toggle-check onoff" temp_locale="<%= temp_locale %>" data-deploy="right">
<span><%= sitemap_block_counter + 1 %> <%= sitemap_block.title_translations[temp_locale] %></span> <span><%= sitemap_block_counter + 1 %> <%= sitemap_block.title_translations[temp_locale] %></span>
</h6> </h6>
<ul> <ul>
<% sitemap_block.children.each_with_index do |child, i| %> <% sitemap_block.children.each_with_index do |child, i| %>
<li "<%= 'disabled' if !child.show_in_sitemap_for(temp_locale) %>"> <li class="<%= 'disabled' if !child.show_in_sitemap_for(temp_locale) %>">
<h6> <h6>
<input type="checkbox" class="toggle-check" data-deploy="right"> <input type="checkbox" id="<%= child.id %>" class="toggle-check onoff" temp_locale="<%= temp_locale %>" data-deploy="right">
<span><%= "#{sitemap_block_counter + 1}-#{i + 1}" %> <%= child.title_translations[temp_locale] %></span> <span><%= "#{sitemap_block_counter + 1}-#{i + 1}" %> <%= child.title_translations[temp_locale] %></span>
</h6> </h6>
</li> </li>
+38 -20
View File
@@ -20,8 +20,7 @@
<!-- Input Area --> <!-- Input Area -->
<div class="input-area"> <div class="input-area">
<div class="nav-name"><strong>Classification</strong></div>
<div class="nav-name"><strong>Classification</strong></div>
<ul class="nav nav-pills language-nav"> <ul class="nav nav-pills language-nav">
<li class="active"> <li class="active">
<a href="#sidebar-nav" data-toggle="tab">Sidebar Nav</a> <a href="#sidebar-nav" data-toggle="tab">Sidebar Nav</a>
@@ -114,10 +113,10 @@
<!-- Openness --> <!-- Openness -->
<div id="openness" class="tab-pane fade"> <div id="openness" class="tab-pane fade">
<div class="control-group"> <div class="control-group">
<label class="control-label muted"><%= I18n.t('site.frontend_closed')%></label> <label class="control-label muted"><%= I18n.t('site.frontend_open')%></label>
<div class="controls"> <div class="controls">
<%= f.check_box :frontend_closed , :class=>"toggle-check"%> <%= f.check_box :frontend_open , :class=>"toggle-check"%>
<span class="help-block">Only can be viewed by users logged in</span> <span class="help-block">If Checked, the frontend will be open for all users.</span>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
@@ -147,6 +146,8 @@
<div class="control-group"> <div class="control-group">
<label class="control-label muted">Default Language</label> <label class="control-label muted">Default Language</label>
<div class="controls"> <div class="controls">
<%= @site_in_use_locales %>
<% @site_in_use_locales.each do |locale| %> <% @site_in_use_locales.each do |locale| %>
<%= check_box_tag :default_locale, locale, (@site.enabled_for.nil?), :class=>"toggle-check" %> <%= check_box_tag :default_locale, locale, (@site.enabled_for.nil?), :class=>"toggle-check" %>
<%= I18nVariable.from_locale(locale) %> <%= I18nVariable.from_locale(locale) %>
@@ -157,10 +158,9 @@
<label class="control-label muted">Enable Language</label> <label class="control-label muted">Enable Language</label>
<div class="controls"> <div class="controls">
<% @site_valid_locales.each do |valid_locale| %> <% @site_valid_locales.each do |valid_locale| %>
<%= check_box_tag 'site[enabled_for][]', valid_locale, (@site.enabled_for.nil?), :class=>"toggle-check" %> <%= check_box_tag "site[in_use_locales][]", locale, @site.valid_locales.include?(locale), :class=>"toggle-check" %>
<%= I18nVariable.from_locale(valid_locale) %> <%= I18nVariable.from_locale(valid_locale) %>
<% end %> <% end %>
<%= hidden_field_tag 'site[enabled_for][]', '' %>
</div> </div>
</div> </div>
@@ -174,7 +174,7 @@
<!-- if this page editing please add class "fileupload-edit" --> <!-- if this page editing please add class "fileupload-edit" -->
<div class="fileupload fileupload-new clearfix" data-provides="fileupload"> <div class="fileupload fileupload-new clearfix" data-provides="fileupload">
<div class="fileupload-new thumbnail pull-left"> <div class="fileupload-new thumbnail pull-left">
<% if @site.default_image %> <% if @site.default_image %>
<%= image_tag( @site.default_image, :size=>"120x120") rescue ''%> <%= image_tag( @site.default_image, :size=>"120x120") rescue ''%>
<% else %> <% else %>
<img class="pull-left upload-picture" src="/assets/default-img.png" /> <img class="pull-left upload-picture" src="/assets/default-img.png" />
@@ -189,23 +189,41 @@
<%end%> <%end%>
</span> </span>
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Cancel</a> <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Cancel</a>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn btn-danger fileupload-remove">
<% if @site.default_image.file %>
<label class="checkbox">
<%= check_box_tag 'site[remove_default_image]' %>
<%= t(:delete_) %>
</label>
<% end %>
</label>
</div>
</div> </div>
</div> </div>
<div class="control-group">
<label class="control-label muted">Orbit Favicon</label>
<div class="controls">
<!-- if this page editing please add class "fileupload-edit" -->
<div class="fileupload fileupload-new clearfix" data-provides="fileupload">
<div class="fileupload-new thumbnail pull-left">
<% if @site.favicon %>
<%= image_tag( @site.favicon, :size=>"120x120") rescue ''%>
<% else %>
<img class="pull-left upload-picture" src="/assets/default-img.png" />
<% end %>
</div>
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
<span class="btn btn-file">
<% if @site.favicon.file.present?%>
<%= f.file_field :favicon, :id => "input-upload", :class => 'fileupload-new', :onchange => "document.getElementById('fu').innerHTML = this.form.fu.value = this.value;" %>Change
<%else%>
<%= f.file_field :favicon, :id => "input-upload", :class => 'fileupload-new', :onchange => "document.getElementById('fu').innerHTML = this.form.fu.value = this.value;" %>Select Image
<%end%>
</span>
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Cancel</a>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- Form Actions --> <!-- Form Actions -->
<div class="form-actions"> <div class="form-actions">
+31 -19
View File
@@ -47,7 +47,7 @@
<!-- Always shoe in the title bar --> <!-- Always shoe in the title bar -->
<div class="control-group"> <div class="control-group">
<label class="control-label muted">Always show in the title bar <label class="control-label muted"><%= t :always_display_title %>
</label> </label>
<div class="controls"> <div class="controls">
<%= f.check_box :title_always_on, :class => "toggle-check" %> <%= f.check_box :title_always_on, :class => "toggle-check" %>
@@ -55,7 +55,6 @@
</div> </div>
<hr> <hr>
<!-- CKeditor Site Header --> <!-- CKeditor Site Header -->
<% @site_valid_locales.each do |locale|%> <% @site_valid_locales.each do |locale|%>
<%= content_tag :div, :class => "tab-pane fade #{active_when_current_locale_eq locale} #{locale}" do %> <%= content_tag :div, :class => "tab-pane fade #{active_when_current_locale_eq locale} #{locale}" do %>
@@ -70,15 +69,30 @@
<%end%> <%end%>
<%end%> <%end%>
<!-- Sitemap menu in Header --> <!-- Sitemap menu in Header -->
<div class="control-group"> <div class="control-group">
<label class="control-label muted">Sitemap menu in header <label class="control-label muted">Sitemap menu in header
</label> </label>
<div class="controls"> <div class="controls">
<input type="checkbox" class="toggle-check" data-disabled="true"> <%= f.check_box :sitemap_menu_in_header, :class => "toggle-check" %>
</div>
</div> </div>
</div>
<hr>
<!-- CKeditor Site Footer -->
<% @site_valid_locales.each do |locale|%>
<%= content_tag :div, :class => "tab-pane fade #{active_when_current_locale_eq locale} #{locale}" do %>
<label class="control-label muted"><%= t('site.footer')%></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :footer_translations do |f| %>
<%= f.text_area locale, :class => "ckeditor input-block-level", :value => (@site.footer_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<%end%>
<%end%>
<hr> <hr>
<!-- Terms of Use --> <!-- Terms of Use -->
@@ -86,27 +100,25 @@
<label class="control-label muted">Terms of Use <label class="control-label muted">Terms of Use
</label> </label>
<div class="controls"> <div class="controls">
<input type="checkbox" class="toggle-check terms" data-disabled="true" checked="checked"> <%= f.check_box :enable_terms_of_use, :class => "toggle-check" %>
</div> </div>
</div> </div>
<!-- CKeditor Default Terms of Use --> <!-- CKeditor Site Footer -->
<div class="control-group input-content hide">
<% @site_valid_locales.each do |locale|%> <% @site_valid_locales.each do |locale|%>
<%= content_tag :div, :class => "tab-pane fade #{active_when_current_locale_eq locale} #{locale}" do %> <%= content_tag :div, :class => "tab-pane fade #{active_when_current_locale_eq locale} #{locale}" do %>
<label class="control-label muted">Default Terms of Use</label> <label class="control-label muted"><%= t('site.default_terms_of_use')%></label>
<div class="controls"> <div class="controls">
<div class="textarea"> <div class="textarea">
<%= f.fields_for :terms_of_user_translations do |f| %> <%= f.fields_for :terms_of_use_translations do |f| %>
<%= f.text_area locale, :class => "ckeditor input-block-level", :value => (@site.terms_of_user_translations[locale] rescue nil) %> <%= f.text_area locale, :class => "ckeditor input-block-level", :value => (@site.terms_of_use_translations[locale] rescue nil) %>
<% end %> <% end %>
</div>
</div> </div>
</div> </div>
<%end%> <%end%>
<%end%> <%end%>
</div>
<!-- Form Actions --> <!-- Form Actions -->
<div class="form-actions"> <div class="form-actions">
<%= f.submit t("submit"), :class => "btn btn-primary" %> <%= f.submit t("submit"), :class => "btn btn-primary" %>
+54 -17
View File
@@ -12,28 +12,65 @@
<% content_for :side_bar do %> <% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %> <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %>
<% end %> <% end %>
<section>
<h3>Sitemap</h3>
<div>
<div id="sitemap"> <div id="sitemap">
<ul id="map-tree-language" class="nav nav-pills"> <ul id="map-tree-language" class="nav nav-pills">
<% @site_valid_locales.each_with_index do |locale, i| %> <% @site_valid_locales.each_with_index do |locale, i| %>
<li <%= ( i == 0 ) ? " class=active" : '' %>><a data-toggle="tab" href="#<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li> <li <%= ( i == 0 ) ? "class=active" : '' %>>
<% end %> <a data-toggle="tab" href="#<%= locale %>">
</ul> <%= I18nVariable.from_locale(locale) %>
</a>
</li>
<% end %>
</ul>
<div class="tab-content map-tree-content"> <div class="tab-content map-tree-content">
<div class="line"></div> <div class="line"></div>
<% @site_valid_locales.each_with_index do |temp_locale, i| %> <% @site_valid_locales.each_with_index do |temp_locale, i| %>
<ul id="<%= temp_locale %>" class="map-tree tab-pane fade in active"> <ul id="<%= temp_locale %>" class="map-tree tab-pane fade in <%= ( i == 0 ) ? "in active" : '' %>">
<%= render :partial => 'sitemap_block', :collection => @items, :locals => {:temp_locale => temp_locale} %> <%= render :partial => 'sitemap_block', :collection => @items, :locals => {:temp_locale => temp_locale} %>
</ul> </ul>
<% end %> <% end %>
</div> </div>
</div> </div>
</div>
</section> <% content_for :page_specific_javascript do %>
<script>
$(document).ready(function(){
$('.site-map').masonry({
itemSelector: '.map-block',
columnWidth: 260
});
$('a[data-toggle="tab"]').on('shown', function (e) {
$('.site-map').masonry({
itemSelector: '.map-block',
columnWidth: 260
});
})
});
$(document).on('click', 'li .onoff', function () {
$(this).parents("li").toggleClass("disabled");
if($(this).parents("li").attr("class").indexOf("disabled") > 0){
$(this).text("<%= t('off_upcase') %>")
} else {
$(this).text("<%= t('on_upcase') %>")
}
$.getScript('<%= admin_sites_path %>' + '/' + $(this).attr('id') + '/sitemap_toggle?temp_locale=' + $(this).attr('temp_locale'));
});
$(document).on('click', 'h6 .onoff', function () {
$(this).parents(".map-block").toggleClass("disabled");
if($(this).parents("h6").parents("li").attr("class").indexOf("disabled") > 0){
$(this).text("<%= t('off_upcase') %>")
$(this).parents(".map-block").find('li').addClass('disabled')
$(this).parents(".map-block").find('checkbox').text("<%= t('off_upcase') %>")
// $(this).parents(".map-block").find('li checkbox').attr('disabled', 'disabled')
} else {
$(this).text("<%= t('on_upcase') %>")
$(this).parents(".map-block").find('li').removeClass('disabled')
$(this).parents(".map-block").find('checkbox').text("<%= t('on_upcase') %>")
// $(this).parents(".map-block").find('li checkbox').removeAttr("disabled")
}
$.getScript('<%= admin_sites_path %>' + '/' + $(this).attr('id') + '/sitemap_toggle?parent=true&temp_locale=' + $(this).attr('temp_locale'));
});
</script>
<% end %>
+1 -1
View File
@@ -4,6 +4,6 @@ $("#tags_index").html("<%= j render 'index' %>")
$.pageslide.close(); $.pageslide.close();
openSlide(); openSlide();
$('.card').cardCheck({ $('.card').cardCheck({
check: $('.card input[type="checkbox"]'), item: $('.card input[type="checkbox"]'),
}); });
checkedLength() checkedLength()
@@ -1,8 +1,9 @@
<%= render :partial => 'shared/search_header',:locals=>{:items=>@data} %> <% if @data.present? %>
<%= render :partial => 'shared/search_header',:locals=>{:items=>@data} %>
<%= render @partial %> <%= render @partial %>
<% if @paginate and !@data.blank? %> <% if @paginate %>
<%= paginate @data, :param_name => :page_main, :params => {:same_page_id => @page_id} %> <%= paginate @data, :param_name => :page_main, :params => {:same_page_id => @page_id} %>
<% elsif @page_part.module_app %> <% elsif @page_part.module_app %>
<%= @page_part.module_app.get_registration.default_widget_setting.link_to_more_tag(request,params) %> <%= @page_part.module_app.get_registration.default_widget_setting.link_to_more_tag(request,params) %>
<% end %>
<% end %> <% end %>
+17 -5
View File
@@ -2,9 +2,9 @@
<div id="side"> <div id="side">
<div id="rwidget" class="wh2 thmc4"> <div id="rwidget" class="wh2 thmc4">
<ul class="docklist"> <ul class="docklist">
<li class="d_cate"><a callback-method='initializeDesktop' href="desktop/desktop" class="widget_fn wh2 hh2" id='home' 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/desktop_container" class="widget_fn wh2 hh2" id='home' onclick="return false;" sub-menu="false"><span class="widget_icon"><img src="" alt="Home" id="home_icon" width="30" height="30"/></span></a>
<ul class="dock_child hh2 thmc4" style="width: 120px;"> <ul class="dock_child hh2 thmc4" style="width: 120px;">
<li class="dock_item"><a callback-method='initializeAppManager' href="<%= desktop_app_manager_path %>" class="widget_fn wh2 hh2" 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='initializeAppManager' href="<%= desktop_app_manager_path %>" class="widget_fn wh2 hh2" id="d_app_manager" onclick="return false;" sub-menu="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='initializeSettings' href="<%= desktop_settings_path %>" custom-load="settings" class="widget_fn wh2 hh2" 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 %>" custom-load="settings" class="widget_fn wh2 hh2" 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>
@@ -92,10 +92,22 @@
orbitDesktop.prototype.sectionId = "<%= @section.id %>"; orbitDesktop.prototype.sectionId = "<%= @section.id %>";
orbitDesktop.prototype.currentLanguage = "<%= I18n.locale %>"; orbitDesktop.prototype.currentLanguage = "<%= I18n.locale %>";
orbitDesktop.prototype.currentUsername = "<%= @currentusername %>"; orbitDesktop.prototype.currentUsername = "<%= @currentusername %>";
//uselessfunction();
var od = new orbitDesktop("#ajax_container"); var od = new orbitDesktop("#ajax_container");
if($.browser.msie){ var getInternetExplorerVersion = function(){
if($.browser.version < 9){ var rv = -1; // Return value assumes failure.
if (navigator.appName == 'Microsoft Internet Explorer')
{
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat( RegExp.$1 );
}
return rv;
}
var version = getInternetExplorerVersion();
if( version != -1){
if(version < 9){
$.fx.off = true; $.fx.off = true;
o.notify("We turn off the animation (javascript) for you, but still you can turn it on",10); o.notify("We turn off the animation (javascript) for you, but still you can turn it on",10);
} }
+9 -16
View File
@@ -1,4 +1,3 @@
<%= javascript_include_tag "lib/jquery.cycle.all.latest.js"%>
<div style='position:relative'> <div style='position:relative'>
<ul id='banner_nav' class='clear banner_nav-<%= @ad_banner.title.dehumanize %>'></ul> <ul id='banner_nav' class='clear banner_nav-<%= @ad_banner.title.dehumanize %>'></ul>
<div id='slideshow-<%= @ad_banner.title.dehumanize %>' class='slideshow'> <div id='slideshow-<%= @ad_banner.title.dehumanize %>' class='slideshow'>
@@ -10,18 +9,12 @@
</div> </div>
</div> </div>
<script type='text/javascript'> <script type='text/javascript'>
$(document).ready(function(){ var banner = {"banner_name":"#slideshow-<%= @ad_banner.title.dehumanize %>",
jQuery(function( $ ){ "banner_fx":"<%= @ad_banner.ad_fx.nil? ? 'fade': @ad_banner.ad_fx %>",
"banner_pager":".banner_nav-<%= @ad_banner.title.dehumanize %>",
$('#slideshow-<%= @ad_banner.title.dehumanize %>').cycle({ "image_count":"<%= @ad_banner.ad_images.length %>",
delay: -1000, "image_loaded":0,
fx: "<%= @ad_banner.ad_fx.nil? ? 'fade': @ad_banner.ad_fx %>", "time_to_next":<%= @ad_banner.transition_msec %>,
timeoutFn: getTimeout, };
pager: '.banner_nav-<%= @ad_banner.title.dehumanize %>', banners.push(banner);
pagerAnchorBuilder: function(idx, slide) { </script>
return "<li><a href='#'></a></li>";
}
});
});
});
</script>
@@ -0,0 +1 @@
<%= @terms.html_safe %>
+16 -1
View File
@@ -27,4 +27,19 @@
</a> </a>
</li> </li>
</ul> </ul>
<% if @site.default_image.present?%>
<style>
#orbit-bar .orbitlogo {
width: 20px;
height: 20px;
background-size: 70%;
display: inline-block;
background-position: center;
background-repeat: no-repeat;
background-image: url(<%= @site.default_image %>);
/* For Suck IE */
background-image: url(<%= @site.default_image%>)\9;
}
</style>
<% end %>
+1 -1
View File
@@ -5,7 +5,7 @@
<%= javascript_include_tag "html5" %> <%= javascript_include_tag "html5" %>
<![endif]--> <![endif]-->
<%#= stylesheet_link_tag "module_widget" %> <%#= stylesheet_link_tag "module_widget" %>
<%= javascript_include_tag "module" %> <%#= javascript_include_tag "module" %>
<%#= javascript_include_tag "#{@app_title}/module_widget" %> <%#= javascript_include_tag "#{@app_title}/module_widget" %>
<%= yield :page_specific_javascript %> <%= yield :page_specific_javascript %>
<%= csrf_meta_tag %> <%= csrf_meta_tag %>
+1
View File
@@ -44,6 +44,7 @@ public_r_tags:
- sitemap - sitemap
- breadcrumb - breadcrumb
- tag_cloud - tag_cloud
- terms_of_use
page_part_kinds: page_part_kinds:
- text - text
+1
View File
@@ -390,6 +390,7 @@ en:
footer: Site footer footer: Site footer
footer_help: Footer Guide footer_help: Footer Guide
frontend_closed: Frontend Closed frontend_closed: Frontend Closed
frontend_open: Frontend Open
header: Site header header: Site header
info: Site information info: Site information
keywords: Site keywords keywords: Site keywords
+3 -1
View File
@@ -2,6 +2,7 @@ en:
add_category: Add category add_category: Add category
add_link: Add link add_link: Add link
add_page: Add page add_page: Add page
add_tags: Add Tags
add_to_default: Add to default add_to_default: Add to default
alternative: Alternative alternative: Alternative
approval_setting: Approval Setting approval_setting: Approval Setting
@@ -70,4 +71,5 @@ en:
error: error:
tag: Error when updating category tag: Error when updating category
tag: Error when updating tag tag: Error when updating tag
url_alt: Alternative text url_alt: Alternative text
use_default: Use Default
+2
View File
@@ -2,6 +2,7 @@ zh_tw:
add_category: 新增類別 add_category: 新增類別
add_link: 新增連結 add_link: 新增連結
add_page: 新增頁面 add_page: 新增頁面
add_tags: Add Tags
add_to_default: 加入預設 add_to_default: 加入預設
alternative: 註解 alternative: 註解
approval_setting: 審核設定 approval_setting: 審核設定
@@ -71,3 +72,4 @@ zh_tw:
tag: 更新類別時發生錯誤 tag: 更新類別時發生錯誤
tag: 更新標籤時發生錯誤 tag: 更新標籤時發生錯誤
url_alt: 註解 url_alt: 註解
use_default: Use Default
+1
View File
@@ -385,6 +385,7 @@ zh_tw:
thumbnail: 縮圖 thumbnail: 縮圖
site: site:
frontend_closed: 前台關閉? frontend_closed: 前台關閉?
frontend_open: 前台關閉 ?
backend_openness_on: 開啟開放式後台(訪客可遊覽) backend_openness_on: 開啟開放式後台(訪客可遊覽)
default_image: 預設圖像 default_image: 預設圖像
description: 網站描述 description: 網站描述
+2 -2
View File
@@ -283,7 +283,7 @@ Orbit::Application.routes.draw do
match "/desktop/compatibility" => "desktop#compatibility" match "/desktop/compatibility" => "desktop#compatibility"
match "desktop" => "desktop#index" match "desktop" => "desktop#index"
match "/desktop/desktop" => "desktop#desktop" match "/desktop/desktop_container" => "desktop#desktop_container"
match '/desktop/appactivation'=>'desktop#appactivation' match '/desktop/appactivation'=>'desktop#appactivation'
match '/desktop/app_manager'=>'desktop#app_manager' match '/desktop/app_manager'=>'desktop#app_manager'
match '/desktop/allsections'=>'desktop#allsections' match '/desktop/allsections'=>'desktop#allsections'
@@ -338,7 +338,7 @@ Orbit::Application.routes.draw do
end end
end end
controller_paths :front, %w[show_breadcrumb show_banner show_footer show_menu show_page_sub_menu show_site_sub_menu show_sitemap show_tag_cloud] controller_paths :front, %w[show_breadcrumb show_banner show_footer show_menu show_page_sub_menu show_site_sub_menu show_sitemap show_tag_cloud show_terms_of_use]
# controller_paths :mobile, %w[index announcement announcement_content dialog_contact dialog_copyright dialog_language map page page_content] # controller_paths :mobile, %w[index announcement announcement_content dialog_contact dialog_copyright dialog_language map page page_content]
# scope 'app' do # scope 'app' do
+52 -27
View File
@@ -188,6 +188,15 @@ module OrbitCoreLib
end end
end end
def open_for_user(arg = nil)
if arg
key = arg.shift
prepend_before_filter key[0] => key[1] {|f| f.open_for :user}
else
prepend_before_filter {|f| f.open_for :user}
end
end
def open_for_visitor(arg = nil) def open_for_visitor(arg = nil)
if arg if arg
key = arg.shift key = arg.shift
@@ -197,37 +206,50 @@ module OrbitCoreLib
end end
end end
def skip_authorization(arg = nil)
if arg
key = arg.shift
prepend_before_filter key[0] => key[1] {|f| f.no_authorization}
else
prepend_before_filter {|f| f.no_authorization}
end
end
end end
module InstanceMethods module InstanceMethods
protected protected
def can_use def can_use
setup_vars setup_vars
set_current_user unless @no_authorization
if @user_type if @user_type
@user_type.each do |user_type| @open = false
open = false @visitor = false
visitor = false @user_type.each do |user_type|
case user_type case user_type
when :admin when :admin
open ||= check_admin @open ||= check_admin
when :manager when :manager
open ||= check_manager @open ||= check_manager
when :sub_manager when :sub_manager
open ||= check_sub_manager @open ||= check_sub_manager
when :approver when :approver
open ||= check_sub_manager @open ||= check_sub_manager
when :visitor when :user
open ||= true @open ||= true
visitor ||= true when :visitor
set_current_user
@open ||= true
@visitor ||= true
end
end end
check_backend_openness if visitor check_backend_openness if @visitor
authenticate_user! unless visitor authenticate_user! unless @visitor
redirect_to root_url unless open redirect_to root_url unless @open
else
authenticate_user!
check_user_can_use
end end
else
authenticate_user!
check_user_can_use
end end
end end
@@ -248,10 +270,14 @@ module OrbitCoreLib
end end
def open_for(var) def open_for(var)
@user_type ||= [] @user_type ||= []
@user_type << var @user_type << var
end end
def no_authorization
@no_authorization = true
end
def check_user_can_use def check_user_can_use
unless current_or_guest_user.admin? || @module_app.is_manager?(current_or_guest_user) || @module_app.is_sub_manager?(current_or_guest_user) || @module_app.can_approve?(current_or_guest_user) unless current_or_guest_user.admin? || @module_app.is_manager?(current_or_guest_user) || @module_app.is_sub_manager?(current_or_guest_user) || @module_app.can_approve?(current_or_guest_user)
redirect_to root_url redirect_to root_url
@@ -259,9 +285,8 @@ module OrbitCoreLib
end end
def setup_vars def setup_vars
@app_title ||= controller_path.split('/')[1].singularize @app_title ||= controller_path.split('/')[1].singularize rescue nil
@module_app ||= ModuleApp.first(conditions: {:key => @app_title} ) @module_app ||= ModuleApp.first(conditions: {:key => @app_title} ) rescue nil
# raise ModuleAppError, 'Can not find ModuleApp' if @module_app.nil?
end end
end end
end end
+1
View File
@@ -7,6 +7,7 @@ module OrbitModel
has_one :auth_approval, as: :approval_authorizable, dependent: :destroy has_one :auth_approval, as: :approval_authorizable, dependent: :destroy
has_one :auth_sub_manager, as: :sub_manager_authorizable, dependent: :destroy has_one :auth_sub_manager, as: :sub_manager_authorizable, dependent: :destroy
delegate :authorized_users, to: :auth_approval, prefix: true, allow_nil: true delegate :authorized_users, to: :auth_approval, prefix: true, allow_nil: true
delegate :authorized_users, to: :auth_manager, prefix: true, allow_nil: true
delegate :authorized_users, to: :auth_sub_manager, prefix: true, allow_nil: true delegate :authorized_users, to: :auth_sub_manager, prefix: true, allow_nil: true
send :include, InstanceMethods send :include, InstanceMethods
end end
+12 -2
View File
@@ -125,6 +125,7 @@ module ParserCommon
def parse_sub_menus_edit(body = nil, page = nil, edit=nil) def parse_sub_menus_edit(body = nil, page = nil, edit=nil)
body.css('sub_menu').each do |sub_menu| body.css('sub_menu').each do |sub_menu|
menu_page = Page.find(sub_menu['id']) rescue nil menu_page = Page.find(sub_menu['id']) rescue nil
res = '' res = ''
if menu_page && menu_page.visible_children.size > 0 if menu_page && menu_page.visible_children.size > 0
res << "<div class='category_list'>" res << "<div class='category_list'>"
@@ -245,6 +246,15 @@ module ParserCommon
sitemap.swap(fragment) sitemap.swap(fragment)
end end
# terms_of_use
def parse_terms_of_uses_edit(body = nil, page = nil, edit=nil)
terms_of_use = body.css('terms_of_use').first
url = front_show_terms_of_use_path
options = "?inner=true"
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load' path='#{url + options}'></div>")
terms_of_use.swap(fragment)
end
# page_contents # page_contents
def parse_contents_edit(body, page, edit=nil) def parse_contents_edit(body, page, edit=nil)
public_r_tags = [] public_r_tags = []
@@ -286,8 +296,8 @@ module ParserCommon
when 'default_widget' when 'default_widget'
"/panel/orbit_app/widget/#{part.widget_style}?inner=true" "/panel/orbit_app/widget/#{part.widget_style}?inner=true"
else else
raise ModuleAppError,"PagePart can't find ModuleApp" if part.module_app.nil? # raise ModuleAppError,"PagePart can't find ModuleApp" if part.module_app.nil?
"/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true" "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true" rescue ''
end end
categories_str=(!part[:category].blank? ? part[:category] : category).collect{|t| "category_id[]=#{t}"}.join('&') categories_str=(!part[:category].blank? ? part[:category] : category).collect{|t| "category_id[]=#{t}"}.join('&')
+5
View File
@@ -222,4 +222,9 @@ module ParserFrontEnd
def generate_tag_clouds(*args) def generate_tag_clouds(*args)
"<div class='dymanic_load' path='#{front_show_tag_cloud_path(args[0])}'></div>" "<div class='dymanic_load' path='#{front_show_tag_cloud_path(args[0])}'></div>"
end end
# tag_cloud
def generate_terms_of_uses(*args)
"<div class='dymanic_load' path='#{front_show_terms_of_use_path}'></div>"
end
end end
+177 -80
View File
@@ -1,96 +1,193 @@
namespace :new_ui do namespace :new_ui do
MODULE_APPS = [ %w(announcement bulletin),
%w(archive archive_file),
%w(ask ask_question ask_category),
%w(asset asset),
%w(faq qa),
%w(gallery gallery_album gallery_category),
%w(location location),
%w(personal_book writing_book),
%w(personal_conference writing_conference),
%w(personal_experience experience),
%w(personal_honor honor),
%w(personal_journal writing_journal),
%w(personal_patent writing_patent),
%w(personal_project project),
%w(web_resource web_link)
] # app_key, model_name, category_name
task :migrate => :environment do
@db = Mongoid.database
migrate_tags
migrate_categories
migrate_approval_on_object
migrate_managers
end
# :category_name is optional, depends on the naming of the category model: if no conventional, specify it # :category_name is optional, depends on the naming of the category model: if no conventional, specify it
task :migrate_categories, [:app_key, :model_name, :category_name] => :environment do |t, args| task :migrate_categories, [:app_key, :model_name, :category_name] => :environment do |t, args|
@db = Mongoid.database migrate_categories(args)
if args[:app_key] && args[:model_name]
migrate_category(args[:app_key], args[:model_name], args[:category_name])
else
module_apps = [ %w(announcement bulletin),
%w(archive archive_file),
%w(ask ask_question ask),
%w(asset asset),
%w(faq qa),
%w(gallery gallery_album gallery),
%w(personal_book writing_book),
%w(personal_conference writing_conference),
%w(personal_experience experience),
%w(personal_honor honor),
%w(personal_journal writing_journal),
%w(personal_patent writing_patent),
%w(personal_project project),
%w(web_resource web_link)
]
module_apps.each{|value_array| migrate_category(value_array[0], value_array[1], value_array[2])}
end
end
def migrate_category(app_key, model_name, category_name=nil)
category_name = model_name unless category_name
# # coll_cat = @db["#{category_name}_categories"]
# # categories = coll_cat.find if coll_cat
module_app = ModuleApp.where(key: app_key)[0]
if module_app.has_category
categories = "#{category_name}_categories".classify.constantize.admin_manager_all rescue nil
categories = "#{category_name}_categories".classify.constantize.all if categories.blank?
categories.each do |category|
new_category = module_app.categories.build
new_category.title_translations = category['title']
new_category.disable = category['disable']
new_category.save
model_name.classify.constantize.where("#{category_name}_category_id" => category['_id']).each do |object|
if object.id.is_a?(String)
object.destroy
else
object.category = new_category.id
object.remove_attribute("#{category_name}_category_id")
object.save
end
end
if object_auths = ObjectAuth.where(obj_authable_type: "#{category_name.classify}Category")
object_auths.each do |object_auth|
case object_auth.title
when 'fact_check'
new_object_auth = new_category.get_object_auth_by_title("approval_#{module_app.key}")
else
new_object_auth = new_category.get_object_auth_by_title("category_#{module_app.key}")
end
object_auth.auth_users.each do |user|
new_object_auth.add_user_to_privilege_list(user)
end
object_auth.destroy
end
end
category.destroy
end
end
end end
task :migrate_tags => :environment do task :migrate_tags => :environment do
tags = Tag.where(_type: 'Tag') migrate_tags
tags.each do |tag| end
module_app = ModuleApp.find(tag.module_tag_id)
new_tag = module_app.module_tags.build task :fix_tagged_ids => :environment do
new_tag.name_translations = tag['name'] fix_tagged_ids
new_tag.is_default = tag['is_default'] end
new_tag.save
n_tag = new_tag.tag def migrate_categories(args = nil)
n_tag.cloud_view_count = tag['cloud_view_count'] if args && args[:app_key] && args[:model_name]
n_tag.view_count = tag['view_count'] migrate_category(args[:app_key], args[:model_name], args[:category_name])
n_tag.save else
tag.taggings.each do |tagging| MODULE_APPS.each{|value_array| migrate_category(value_array[0], value_array[1], value_array[2])}
tagging.taggable.taggings.create(tag_id: n_tag.id)
end
tag.destroy
end end
end end
task :change_auth_naming => :environment do def migrate_category(app_key, model_name, category_name = nil)
ObjectAuth.where(title: /submit_/).each do |auth| @db ||= Mongoid.database
auth.update_attribute(:title, auth.title.gsub('submit_', 'category_')) category_name = "#{model_name}_category" unless category_name
collection_category = @db[category_name.pluralize]
categories = collection_category.find.entries if collection_category
collection_model = @db[model_name.pluralize]
collection_buffer_category = @db['buffer_categories']
collection_prototype_auth = @db['prototype_auths']
if categories.present?
module_app = ModuleApp.where(key: app_key).first
if module_app.try(:has_category)
categories.each do |category|
new_category = module_app.categories.build
new_category.title_translations = category['title']
new_category.disable = category['disable']
new_category.save
collection_model.find("#{category_name}_id" => category['_id']).each do |object|
object['category_id'] = new_category.id
object.delete("#{category_name}_id")
collection_model.save object
collection_buffer_category.save ({ '_type' => 'BufferCategory', 'category_id' => new_category.id, 'categorizable_type' => model_name.camelize, 'categorizable_id' => object['_id'] })
end
object_auths = collection_prototype_auth.find(_type: 'ObjectAuth', obj_authable_id: category['_id'], '$or' => [{privilege_user_ids: {'$not' => {'$size' => 0}}}, {role_ids: {'$not' => {'$size' => 0}}}, {sub_role_ids: {'$not' => {'$size' => 0}}}]).entries
if object_auths.present?
object_auths.each do |object_auth|
if object_auth['title'].eql?('fact_check')
authorization = new_category.auth_approval || new_category.create_auth_approval(module_app_id: module_app.id, title: "category_approval_#{module_app.key}")
else
authorization = new_category.auth_sub_manager || new_category.create_auth_sub_manager(module_app_id: module_app.id, title: "category_authorization_#{module_app.key}")
end
add_users(object_auth, authorization)
collection_prototype_auth.remove(object_auth)
end
end
end
collection_category.drop
collection_prototype_auth.remove(obj_authable_type: category_name.classify)
end
else
collection_category.drop
collection_prototype_auth.remove(obj_authable_type: category_name.classify)
end end
end end
def fix_tagged_ids
Tag.all.each do |tag|
tag.taggings.each do |tagging|
tagged_ids = tagging.taggable.tagged_ids
unless tagged_ids.include?(tag.id.to_s)
tagged_ids << tag.id.to_s
tagging.taggable.update_attribute(:tagged_ids, tagged_ids)
end
end
end
end
def migrate_tags
@db ||= Mongoid.database
tags = Tag.where(_type: 'Tag').entries
tags.each_with_index do |tag, i|
unless tag.tag_lease
if module_app = ModuleApp.find(tag[:module_tag_id])
new_tag = module_app.module_tags.build
new_tag.name_translations = tag['name']
new_tag.is_default = tag['is_default']
new_tag.save
n_tag = new_tag.tag
n_tag.cloud_view_count = tag['cloud_view_count']
n_tag.view_count = tag['view_count']
n_tag.save
tag.taggings.each do |tagging|
tagged_ids = tagging.taggable.tagged_ids
unless tagged_ids.include?(tag.id.to_s)
tagged_ids << tag.id.to_s
tagging.taggable.update_attribute(:tagged_ids, tagged_ids)
end
tagging.taggable.taggings.create(tag_id: n_tag.id)
end
end
tag.destroy
end
end
old_tags = Tag.where(_type: {'$ne' => 'Tag'}).delete
@db = Mongoid.database
@db['proto_tags'].drop
end
def migrate_approval_on_object
@db ||= Mongoid.database
collection_prototype_auth = @db['prototype_auths']
object_auths = collection_prototype_auth.find({_type: 'ObjectAuth', obj_authable_type: {'$in' => ["AdBanner", "PageContext"]}, '$or' => [{privilege_user_ids: {'$not' => {'$size' => 0}}}, {role_ids: {'$not' => {'$size' => 0}}}, {sub_role_ids: {'$not' => {'$size' => 0}}}]}).entries
object_auths.each do |object_auth|
case object_auth['obj_authable_type']
when 'AdBanner'
module_app = ModuleApp.where(key: 'ad_banner').first
when 'PageContext'
module_app = ModuleApp.where(key: 'page_content').first
end
if module_app
object = object_auth['obj_authable_type'].constantize.find(object_auth['obj_authable_id']) rescue nil
if object
authorization = object.create_auth_sub_manager(module_app_id: module_app.id, title: "#{object_auth['obj_authable_type'].underscore}_authorization_#{module_app.key}")
add_users(object_auth, authorization) if authorization
end
end
collection_prototype_auth.remove(object_auth)
end
collection_prototype_auth.remove(obj_authable_type: {'$in' => ["AdBanner", "PageContext"]})
end
def add_users(object_auth, authorization)
if authorization
if object_auth['role_ids'].present?
roles = Role.find(object_auth['role_ids']) rescue nil
authorization.add_roles(roles) if roles
end
if object_auth['sub_role_ids'].present?
sub_roles = SubRole.find(object_auth['sub_role_ids']) rescue nil
authorization.add_sub_roles(sub_roles) if sub_roles
end
if object_auth['privilege_user_ids'].present?
users = User.find(object_auth['privilege_user_ids']) rescue nil
authorization.add_users(users) if users
end
end
end
def migrate_managers
@db ||= Mongoid.database
collection_app_manager = @db['app_managers']
app_managers = collection_app_manager.find(managing_app_id: {'$not' => {'$size' => 0}}).entries
app_managers.each do |app_manager|
module_app = ModuleApp.find(app_manager['managing_app_id']) rescue nil
user = User.find(app_manager['user_id']) rescue nil
if module_app && user
authorization = module_app.auth_manager || module_app.create_auth_manager(module_app_id: module_app.id, title: module_app.key)
authorization.add_users(user)
end
end
collection_app_manager.drop
end
task :reset_user_position => :environment do task :reset_user_position => :environment do
User.where(email: /guest/).each{|d|d.update_attribute(:position, nil)} User.where(email: /guest/).each{|d|d.update_attribute(:position, nil)}
User.not_guest_user.each_with_index do |user, i| User.not_guest_user.each_with_index do |user, i|
@@ -3,6 +3,12 @@ en:
ad_banner: ad_banner:
ad_banner: Ad Banner ad_banner: Ad Banner
banner: Banner banner: Banner
banner_name: Banner Name
banner_name_note: Banner Name only english
ste: Transition Interval
ste_note: Please enter the number of seconds
best_size: Best Size
effect: Effect
all: All all: All
categories: Categories categories: Categories
add: Add add: Add
@@ -3,6 +3,12 @@ zh_tw:
ad_banner: ad_banner:
ad_banner: 廣告輪播 ad_banner: 廣告輪播
banner: 橫幅 banner: 橫幅
banner_name: 橫幅名稱
banner_name_note: 橫幅名稱只能為英文
ste: 轉換間隔時間
ste_note: 請輸入秒數
best_size: 最佳尺寸
effect: 效果
all: 全部 all: 全部
categories: 類別 categories: 類別
add: 新增 add: 新增
+3 -1
View File
@@ -11,7 +11,9 @@ module AdBanner
update_info 'some update_info' update_info 'some update_info'
taggable taggable
authorizable authorizable do
authorizable_on('AdBanner')
end
# front_end do # front_end do
# app_page 'bulletins' # app_page 'bulletins'
@@ -9,27 +9,33 @@ class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController
def index def index
@ask_question = AskQuestion.new @ask_question = AskQuestion.new
@categories = @module_app.categories.enabled
end end
def create def create
@ask_question = AskQuestion.new(params[:ask_question]) @ask_question = AskQuestion.new(params[:ask_question])
if gotcha_valid? && @ask_question.save if gotcha_valid? && @ask_question.save
@acknowledgement = AskAcknowledgement.last @acknowledgement = AskAcknowledgement.last
@ask_acknowledgement = AskAcknowledgement.first || AskAcknowlegement.new @ask_acknowledgement = AskAcknowledgement.first || AskAcknowlegement.new
#@ask_question.save
#redirect_to root_path
AskAdmin.all.each do |ask_admin| AskAdmin.all.each do |ask_admin|
AskMailer.notice(ask_admin, @ask_question).deliver AskMailer.notice(ask_admin, @ask_question).deliver
Resque.enqueue(SendAskNoticeMail, ask_admin.id, @ask_question.id) Resque.enqueue(SendAskNoticeMail, ask_admin.id, @ask_question.id)
end end
# redirect_to panel_ask_front_end_thank_you_path
# Render to create.js.erb
respond_to do |format| respond_to do |format|
format.js format.js
# format.js { render :thank_you, notice: 'Your question has been successfully sent.' } end
else
# Render to index.js.erb
respond_to do |format|
format.js { render :index }
end end
end end
end end
def thank_you def thank_you
@acknowledgement = AskAcknowledgement.last @acknowledgement = AskAcknowledgement.last
@item = Page.find(params[:page_id]) rescue nil @item = Page.find(params[:page_id]) rescue nil
@@ -35,7 +35,7 @@ $(document).ready(function(){
<div class="control-group"> <div class="control-group">
<%= f.label :ask_category_id, class: 'control-label required' %> <%= f.label :ask_category_id, class: 'control-label required' %>
<div class="controls"> <div class="controls">
<%= f.collection_select :ask_category_id, AskCategory.all, :id, :name %> <%= f.select :category_id, @categories.collect{|t| [ t.title, t.id ]} %>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
@@ -0,0 +1 @@
window.location.href = "<%= panel_ask_front_end_sorry_path %>";
@@ -0,0 +1 @@
<h3><%= t(:ask_fail, :scope => :ask) %> !</h3>
+2
View File
@@ -19,8 +19,10 @@ Rails.application.routes.draw do
namespace :front_end do namespace :front_end do
match "ask_questions/thank_you" => "ask_questions#thank_you", :as => 'thank_you' match "ask_questions/thank_you" => "ask_questions#thank_you", :as => 'thank_you'
match "ask_questions/sorry" => "ask_questions#sorry", :as => 'sorry'
resources :ask_questions resources :ask_questions
end end
end end
end end
@@ -71,11 +71,11 @@ module Panel::PersonalBook::Desktop::PersonalBooksHelper
def link_publication_file publication def link_publication_file publication
publication.writing_book_files.map{|file| publication.writing_book_files.map{|file|
link_to(image_tag(check_file_type(file.file.url)) + \ link_to(image_tag(check_file_type(file.file.url)) + \
content_tag(:span, file.title_translations[I18n.locale.to_s], :class => "filetitle"), content_tag(:span, (file.title_translations[I18n.locale.to_s] rescue nil), :class => "filetitle"),
file.file.url, file.file.url,
:class => "file", :class => "file",
"target" => "_blank", "target" => "_blank",
"title" => file.title_translations[I18n.locale.to_s]) "title" => (file.title_translations[I18n.locale.to_s] rescue nil))
}.inject(:+) }.inject(:+)
end end
@@ -71,11 +71,11 @@ module Panel::PersonalConference::Desktop::ConferencePagesHelper
def link_publication_file publication def link_publication_file publication
publication.writing_conference_files.map{|file| publication.writing_conference_files.map{|file|
link_to(image_tag(check_file_type(file.file.url)) + \ link_to(image_tag(check_file_type(file.file.url)) + \
content_tag(:span, file.title_translations[I18n.locale.to_s], :class => "filetitle"), content_tag(:span, (file.title_translations[I18n.locale.to_s] rescue nil), :class => "filetitle"),
file.file.url, file.file.url,
:class => "file", :class => "file",
"target" => "_blank", "target" => "_blank",
"title" => file.title_translations[I18n.locale.to_s]) "title" => (file.title_translations[I18n.locale.to_s] rescue nil))
}.inject(:+) }.inject(:+)
end end
@@ -71,11 +71,11 @@ module Panel::PersonalDiploma::Desktop::PersonalDiplomasHelper
def link_publication_file publication def link_publication_file publication
publication.writing_conference_files.map{|file| publication.writing_conference_files.map{|file|
link_to(image_tag(check_file_type(file.file.url)) + \ link_to(image_tag(check_file_type(file.file.url)) + \
content_tag(:span, file.title_translations[I18n.locale.to_s], :class => "filetitle"), content_tag(:span, (file.title_translations[I18n.locale.to_s] rescue nil), :class => "filetitle"),
file.file.url, file.file.url,
:class => "file", :class => "file",
"target" => "_blank", "target" => "_blank",
"title" => file.title_translations[I18n.locale.to_s]) "title" => (file.title_translations[I18n.locale.to_s] rescue nil))
}.inject(:+) }.inject(:+)
end end
@@ -71,11 +71,11 @@ module Panel::PersonalExperience::Desktop::PersonalExperiencesHelper
def link_publication_file publication def link_publication_file publication
publication.writing_conference_files.map{|file| publication.writing_conference_files.map{|file|
link_to(image_tag(check_file_type(file.file.url)) + \ link_to(image_tag(check_file_type(file.file.url)) + \
content_tag(:span, file.title_translations[I18n.locale.to_s], :class => "filetitle"), content_tag(:span, file.title_translations[I18n.locale.to_s] rescue nil), :class => "filetitle"),
file.file.url, file.file.url,
:class => "file", :class => "file",
"target" => "_blank", "target" => "_blank",
"title" => file.title_translations[I18n.locale.to_s]) "title" => file.title_translations[I18n.locale.to_s] rescue nil))
}.inject(:+) }.inject(:+)
end end
@@ -64,11 +64,11 @@ module Panel::PersonalHonor::Desktop::PersonalHonorsHelper
def link_publication_file publication def link_publication_file publication
publication.writing_book_files.map{|file| publication.writing_book_files.map{|file|
link_to(image_tag(check_file_type(file.file.url)) + \ link_to(image_tag(check_file_type(file.file.url)) + \
content_tag(:span, file.title_translations[I18n.locale.to_s], :class => "filetitle"), content_tag(:span, (file.title_translations[I18n.locale.to_s] rescue nil), :class => "filetitle"),
file.file.url, file.file.url,
:class => "file", :class => "file",
"target" => "_blank", "target" => "_blank",
"title" => file.title_translations[I18n.locale.to_s]) "title" => (file.title_translations[I18n.locale.to_s] rescue nil))
}.inject(:+) }.inject(:+)
end end
@@ -1,5 +1,6 @@
module Panel::PersonalJournal::Desktop::JournalPagesHelper module Panel::PersonalJournal::Desktop::JournalPagesHelper
def publication_record publication, view def publication_record publication, view
content_tag :li, content_tag :li,
"item" => "true", "item" => "true",
"data-id" => publication.id.to_s, "data-id" => publication.id.to_s,
@@ -88,12 +89,13 @@ module Panel::PersonalJournal::Desktop::JournalPagesHelper
def link_publication_file publication def link_publication_file publication
publication.writing_journal_files.map{|file| publication.writing_journal_files.map{|file|
link_to(image_tag(check_file_type(file.file.url)) + \ link_to(image_tag(check_file_type(file.file.url)) + \
content_tag(:span, file.title_translations[I18n.locale.to_s], :class => "filetitle"), content_tag(:span, (file.title_translations[I18n.locale.to_s] rescue nil), :class => "filetitle"),
file.file.url, file.file.url,
:class => "file", :class => "file",
"target" => "_blank", "target" => "_blank",
"title" => file.title_translations[I18n.locale.to_s]) "title" => (file.title_translations[I18n.locale.to_s] rescue nil))
}.inject(:+) }.inject(:+)
end end
@@ -71,11 +71,11 @@ module Panel::PersonalLab::Desktop::PersonalLabsHelper
def link_publication_file publication def link_publication_file publication
publication.lab_files.map{|file| publication.lab_files.map{|file|
link_to(image_tag(check_file_type(file.file.url)) + \ link_to(image_tag(check_file_type(file.file.url)) + \
content_tag(:span, file.title_translations[I18n.locale.to_s], :class => "filetitle"), content_tag(:span, (file.title_translations[I18n.locale.to_s] rescue nil), :class => "filetitle"),
file.file.url, file.file.url,
:class => "file", :class => "file",
"target" => "_blank", "target" => "_blank",
"title" => file.title_translations[I18n.locale.to_s]) "title" => (file.title_translations[I18n.locale.to_s] rescue nil))
}.inject(:+) }.inject(:+)
end end
@@ -71,11 +71,11 @@ module Panel::PersonalPatent::Desktop::PersonalPatentsHelper
def link_publication_file publication def link_publication_file publication
publication.writing_patent_files.map{|file| publication.writing_patent_files.map{|file|
link_to(image_tag(check_file_type(file.file.url)) + \ link_to(image_tag(check_file_type(file.file.url)) + \
content_tag(:span, file.title_translations[I18n.locale.to_s], :class => "filetitle"), content_tag(:span, (file.title_translations[I18n.locale.to_s] rescue nil), :class => "filetitle"),
file.file.url, file.file.url,
:class => "file", :class => "file",
"target" => "_blank", "target" => "_blank",
"title" => file.title_translations[I18n.locale.to_s]) "title" => (file.title_translations[I18n.locale.to_s] rescue nil))
}.inject(:+) }.inject(:+)
end end
@@ -72,11 +72,11 @@ module Panel::PersonalProject::Desktop::PersonalProjectsHelper
def link_publication_file publication def link_publication_file publication
publication.project_files.map{|file| publication.project_files.map{|file|
link_to(image_tag(check_file_type(file.file.url)) + \ link_to(image_tag(check_file_type(file.file.url)) + \
content_tag(:span, file.title_translations[I18n.locale.to_s], :class => "filetitle"), content_tag(:span, (file.title_translations[I18n.locale.to_s] rescue nil), :class => "filetitle"),
file.file.url, file.file.url,
:class => "file", :class => "file",
"target" => "_blank", "target" => "_blank",
"title" => file.title_translations[I18n.locale.to_s]) "title" => (file.title_translations[I18n.locale.to_s] rescue nil))
}.inject(:+) }.inject(:+)
end end
@@ -72,11 +72,11 @@ module Panel::PersonalResearch::Desktop::PersonalResearchsHelper
def link_publication_file publication def link_publication_file publication
publication.research_files.map{|file| publication.research_files.map{|file|
link_to(image_tag(check_file_type(file.file.url)) + \ link_to(image_tag(check_file_type(file.file.url)) + \
content_tag(:span, file.title_translations[I18n.locale.to_s], :class => "filetitle"), content_tag(:span, (file.title_translations[I18n.locale.to_s] rescue nil), :class => "filetitle"),
file.file.url, file.file.url,
:class => "file", :class => "file",
"target" => "_blank", "target" => "_blank",
"title" => file.title_translations[I18n.locale.to_s]) "title" => (file.title_translations[I18n.locale.to_s] rescue nil))
}.inject(:+) }.inject(:+)
end end