Compare commits
67
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11e9f5d7cd | ||
|
|
2eaa44c279 | ||
|
|
fe7393b9e2 | ||
|
|
f12e5b8768 | ||
|
|
57e1ef7bae | ||
|
|
642d0ed239 | ||
|
|
0904978292 | ||
|
|
ddd9a9668e | ||
|
|
a468b69013 | ||
|
|
b6c8a88b73 | ||
|
|
5b7ac1a22b | ||
|
|
d5109c837c | ||
|
|
c63ac751ea | ||
|
|
8c1e65994a | ||
|
|
f9a148c901 | ||
|
|
5ea0c5bd5c | ||
|
|
d2f131d160 | ||
|
|
8d71c377f2 | ||
|
|
ec173c4ce1 | ||
|
|
ba7d6558ee | ||
|
|
88c57e0b0c | ||
|
|
d4962d20b3 | ||
|
|
21bf3a0ccd | ||
|
|
cf0d7cfc64 | ||
|
|
15347f25dc | ||
|
|
443d1c4fbe | ||
|
|
7ba0977e16 | ||
|
|
531cee70d2 | ||
|
|
b659c7021d | ||
|
|
515185d87c | ||
|
|
adc15951bb | ||
|
|
32c259ac9e | ||
|
|
51640423a7 | ||
|
|
dd206437d8 | ||
|
|
7729161123 | ||
|
|
f2706ff2c1 | ||
|
|
5c94200b77 | ||
|
|
6b8b749b0f | ||
|
|
253cca06cc | ||
|
|
30824d1620 | ||
|
|
704db56925 | ||
|
|
06fd305bf9 | ||
|
|
c0f1614cb9 | ||
|
|
3e0b7d81ae | ||
|
|
2806dd35a9 | ||
|
|
54a35b30be | ||
|
|
37aa950028 | ||
|
|
3d0a1cef56 | ||
|
|
4a5256bf4f | ||
|
|
5b368235e8 | ||
|
|
b8da40b4ae | ||
|
|
287e77836d | ||
|
|
3e6c2b1ec2 | ||
|
|
f2247aab32 | ||
|
|
ef2c732d2e | ||
|
|
1096db79b6 | ||
|
|
88d55989de | ||
|
|
c2331695cd | ||
|
|
127ab3845c | ||
|
|
aefd62da2a | ||
|
|
167a71272a | ||
|
|
caf0426bd4 | ||
|
|
7d077a92a5 | ||
|
|
64101109dd | ||
|
|
3e567223e3 | ||
|
|
79ef86f2c9 | ||
|
|
d047a3d62a |
No files matched your search
@@ -50,7 +50,7 @@ gem 'tinymce-rails'
|
|||||||
gem 'therubyracer' if RUBY_PLATFORM.downcase.include?("linux")
|
gem 'therubyracer' if RUBY_PLATFORM.downcase.include?("linux")
|
||||||
gem 'libv8', '~> 3.11.8' if RUBY_PLATFORM.downcase.include?("linux")
|
gem 'libv8', '~> 3.11.8' if RUBY_PLATFORM.downcase.include?("linux")
|
||||||
gem 'mongoid-encryptor', :require => 'mongoid/encryptor'
|
gem 'mongoid-encryptor', :require => 'mongoid/encryptor'
|
||||||
gem 'rb-readline' if RUBY_PLATFORM.downcase.include?("linux")
|
gem 'rb-readline','~> 0.4.2' if RUBY_PLATFORM.downcase.include?("linux")
|
||||||
|
|
||||||
|
|
||||||
gem "impressionist", :git => 'git://github.com/charlotte-ruby/impressionist.git'
|
gem "impressionist", :git => 'git://github.com/charlotte-ruby/impressionist.git'
|
||||||
@@ -63,6 +63,9 @@ gem 'chinese_pinyin', '0.4.1'
|
|||||||
gem 'rmmseg-cpp-huacnlee', '0.2.9'
|
gem 'rmmseg-cpp-huacnlee', '0.2.9'
|
||||||
gem 'redis-namespace'
|
gem 'redis-namespace'
|
||||||
gem 'redis-search'
|
gem 'redis-search'
|
||||||
|
gem 'syslog-logger'
|
||||||
|
gem "recaptcha", :require => "recaptcha/rails"
|
||||||
|
gem 'mongoid-versioning'
|
||||||
|
|
||||||
# Gems used only for assets and not required
|
# Gems used only for assets and not required
|
||||||
# in production environments by default.
|
# in production environments by default.
|
||||||
|
|||||||
@@ -319,6 +319,7 @@ GEM
|
|||||||
nokogiri
|
nokogiri
|
||||||
sunspot (= 1.3.3)
|
sunspot (= 1.3.3)
|
||||||
sunspot_solr (1.3.3)
|
sunspot_solr (1.3.3)
|
||||||
|
syslog-logger (1.6.8)
|
||||||
terminal-table (1.4.5)
|
terminal-table (1.4.5)
|
||||||
thor (0.17.0)
|
thor (0.17.0)
|
||||||
tilt (1.3.3)
|
tilt (1.3.3)
|
||||||
@@ -402,6 +403,7 @@ DEPENDENCIES
|
|||||||
sunspot-rails-tester
|
sunspot-rails-tester
|
||||||
sunspot_mongo
|
sunspot_mongo
|
||||||
sunspot_solr
|
sunspot_solr
|
||||||
|
syslog-logger
|
||||||
tinymce-rails
|
tinymce-rails
|
||||||
uglifier
|
uglifier
|
||||||
watchr
|
watchr
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 524 B |
Binary file not shown.
|
After Width: | Height: | Size: 738 B |
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
orbitDesktop.prototype.themefolder = "desktop_themes";
|
orbitDesktop.prototype.themefolder = "desktop_themes";
|
||||||
orbitDesktopAPI.prototype.notifyImgPath = "/assets/";
|
orbitDesktopAPI.prototype.notifyImgPath = "/assets/";
|
||||||
alert("<%= @desktop.inspect %>")
|
// alert("<%= @desktop.inspect %>")
|
||||||
var od = new orbitDesktop("#ajax_container");
|
var od = new orbitDesktop("#ajax_container");
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
getEvent(selet);
|
|
||||||
function resetText() {
|
function resetText() {
|
||||||
$events.find('li').find($mon).html('');
|
$events.find('li').find($mon).html('');
|
||||||
$events.find('li').find($day).html('');
|
$events.find('li').find($day).html('');
|
||||||
@@ -63,60 +63,4 @@ $(document).ready(function(){
|
|||||||
$events.find('li').find($link_text).attr('href', '');
|
$events.find('li').find($link_text).attr('href', '');
|
||||||
$events.find('li').find($time).html('');
|
$events.find('li').find($time).html('');
|
||||||
}
|
}
|
||||||
function getEvent(selet){
|
|
||||||
$.ajax({
|
|
||||||
type: "GET",
|
|
||||||
url: "/static/nccu_calendar.xml",
|
|
||||||
dataType: "xml",
|
|
||||||
timeout: 1000,
|
|
||||||
error: function(xml){
|
|
||||||
$events.find('.links_next').addClass('disabled')
|
|
||||||
$events.find('.error_mag').show();
|
|
||||||
$events.find('ul').hide();
|
|
||||||
$events.find('.error_mag').html("讀取錯誤");
|
|
||||||
},
|
|
||||||
success: function(xml) {
|
|
||||||
xmlLength = $(xml).find('entry').length;
|
|
||||||
$(xml).find('entry').slice(selet, selet+objLength).each(function(i){
|
|
||||||
title_text = $(this).find('title').text()
|
|
||||||
link_text = $(this).find('link').attr('href')
|
|
||||||
summary_text = $(this).find('summary').text()
|
|
||||||
indexA = summary_text.indexOf("-");
|
|
||||||
indexB = summary_text.indexOf(" ");
|
|
||||||
indexC = summary_text.indexOf("/");
|
|
||||||
//清除前後空白字元
|
|
||||||
summary_text = jQuery.trim(summary_text);
|
|
||||||
//篩選標題
|
|
||||||
title_text = title_text.slice(0, 16)
|
|
||||||
if (summary_text.length == 31) {
|
|
||||||
startDate_text = summary_text.slice(0, indexA);
|
|
||||||
startMon_text = startDate_text.slice((indexC+1), (indexC+3));
|
|
||||||
startDay_text = startDate_text.slice(7);
|
|
||||||
endDate_text = summary_text.slice((indexA+1), indexB);
|
|
||||||
time_text = summary_text.slice((indexB+1));
|
|
||||||
} else {
|
|
||||||
startDate_text = summary_text.slice(0, indexB);
|
|
||||||
startMon_text = startDate_text.slice((indexC+1), (indexC+3));
|
|
||||||
startDay_text = startDate_text.slice(7);
|
|
||||||
endDate_text = '';
|
|
||||||
time_text = summary_text.slice((indexB+1));
|
|
||||||
}
|
|
||||||
if(startMon_text.slice(0, 1) == '0'){
|
|
||||||
startMon_text = month[startMon_text.slice(1)-1];
|
|
||||||
} else {
|
|
||||||
startMon_text = month[startMon_text-1];
|
|
||||||
}
|
|
||||||
$events.find('li').eq(i).find($mon).html(startMon_text);
|
|
||||||
$events.find('li').eq(i).find($day).html(startDay_text);
|
|
||||||
$events.find('li').eq(i).find($link_text).html(title_text+"…");
|
|
||||||
$events.find('li').eq(i).find($link_text).attr('href', link_text);
|
|
||||||
$events.find('li').eq(i).find($time).html('時間:'+time_text);
|
|
||||||
//console.log();
|
|
||||||
/*$('<li></li>')
|
|
||||||
.html('<div class="event_date"><span class="mon">'+startMon_text+'</span><span class="day">'+startDay_text+'</div>')
|
|
||||||
.appendTo('.events ul');*/
|
|
||||||
});//close each(
|
|
||||||
}
|
|
||||||
}); //close $.ajax(
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<%#= encoding: utf-8 %>
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
$(document).on('click', '.survey_question_item a.remove_existing_record_question', function(){
|
||||||
|
if(confirm("<%= I18n.t(:sure?)%>")){
|
||||||
|
$(this).next('.should_destroy').val(1);
|
||||||
|
$(".survey_question_item#" + $(this).prev().attr('value')).hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.survey_question_option_item a.remove_existing_record_option', function(){
|
||||||
|
if(confirm("<%= I18n.t(:sure?)%>")){
|
||||||
|
$(this).next('.should_destroy').val(1);
|
||||||
|
$(".survey_question_option_item#" + $(this).prev().attr('value')).hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.survey_question_radiogroup_item a.remove_existing_record_radiogroup', function(){
|
||||||
|
if(confirm("<%= I18n.t(:sure?)%>")){
|
||||||
|
$(this).next('.should_destroy').val(1);
|
||||||
|
$(".survey_question_radiogroup_item#" + $(this).prev().attr('value')).hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.survey_question_item .type-selector').live('change', function(){
|
||||||
|
$item = $(this).parents('.survey_question_item');
|
||||||
|
$item.find('.type-specify').hide();
|
||||||
|
$item.find('.type-specify.type-' + $(this).val()).show();
|
||||||
|
$item.find('.type-specify.hide-type-' + $(this).val()).hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.survey_question_item .type-selector').trigger('change');
|
||||||
|
|
||||||
|
$('.survey_question_item .add_survey_question_option a.add').live('click', function(){
|
||||||
|
var new_id = $(this).prev().attr('value');
|
||||||
|
var old_id = new RegExp("new_survey_question_options", "g");
|
||||||
|
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||||
|
$_new = $($(this).next().html().replace(old_id, new_id));
|
||||||
|
$(this).parents('.survey_question_options_wrapper').find('tbody').append($_new);
|
||||||
|
$_new.find('a.delete_option').on('click', function(){
|
||||||
|
$(this).parents('.survey_question_option_item').remove();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.survey_question_item .add_survey_question_radiogroup a.add').live('click', function(){
|
||||||
|
var new_id = $(this).prev().attr('value');
|
||||||
|
var old_id = new RegExp("new_survey_question_radiogroups", "g");
|
||||||
|
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||||
|
$_new = $($(this).next().html().replace(old_id, new_id));
|
||||||
|
$(this).parents('.survey_question_radiogroups_wrapper').find('tbody').append($_new);
|
||||||
|
$_new.find('a.delete_radiogroup').on('click', function(){
|
||||||
|
$(this).parents('.survey_question_radiogroup_item').remove();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
@@ -149,7 +149,7 @@ Version: 3.3.1 Timestamp: Wed Feb 20 09:57:22 PST 2013
|
|||||||
margin-top: 4px; }
|
margin-top: 4px; }
|
||||||
|
|
||||||
.select2-search input.select2-active {
|
.select2-search input.select2-active {
|
||||||
background: white image-url("select2-spinner.gif") no-repeat 100%; }
|
background: white url("select2/spinner.gif") no-repeat 100%; }
|
||||||
|
|
||||||
.select2-container-active .select2-choice,
|
.select2-container-active .select2-choice,
|
||||||
.select2-container-active .select2-choices {
|
.select2-container-active .select2-choices {
|
||||||
@@ -261,7 +261,7 @@ disabled look for disabled choices in the results dropdown
|
|||||||
display: none; }
|
display: none; }
|
||||||
|
|
||||||
.select2-more-results.select2-active {
|
.select2-more-results.select2-active {
|
||||||
background: #f4f4f4 image-url("select2-spinner.gif") no-repeat 100%; }
|
background: #f4f4f4 url("select2/spinner.gif") no-repeat 100%; }
|
||||||
|
|
||||||
.select2-more-results {
|
.select2-more-results {
|
||||||
background: #f4f4f4;
|
background: #f4f4f4;
|
||||||
@@ -323,7 +323,7 @@ disabled look for disabled choices in the results dropdown
|
|||||||
background: transparent !important; }
|
background: transparent !important; }
|
||||||
|
|
||||||
.select2-container-multi .select2-choices .select2-search-field input.select2-active {
|
.select2-container-multi .select2-choices .select2-search-field input.select2-active {
|
||||||
background: white image-url("select2-spinner.gif") no-repeat 100% !important; }
|
background: white url("select2/spinner.gif") no-repeat 100% !important; }
|
||||||
|
|
||||||
.select2-default {
|
.select2-default {
|
||||||
color: #999999 !important; }
|
color: #999999 !important; }
|
||||||
@@ -404,4 +404,4 @@ disabled look for disabled choices in the results dropdown
|
|||||||
background-size: 60px 40px !important; }
|
background-size: 60px 40px !important; }
|
||||||
|
|
||||||
.select2-search input {
|
.select2-search input {
|
||||||
background-position: 100% -21px !important; } }
|
background-position: 100% -21px !important; } }
|
||||||
@@ -12,6 +12,9 @@
|
|||||||
.main-list {
|
.main-list {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
#filter .main-list, #filter + .main-list {
|
||||||
|
table-layout: fixed;
|
||||||
|
}
|
||||||
.main-wrap>.main-list thead th {
|
.main-wrap>.main-list thead th {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border-right: medium none;
|
border-right: medium none;
|
||||||
@@ -36,7 +39,7 @@
|
|||||||
}
|
}
|
||||||
.main-list tbody .quick-edit .nav {
|
.main-list tbody .quick-edit .nav {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 350px;
|
width: 440px;
|
||||||
left: -8px;
|
left: -8px;
|
||||||
}
|
}
|
||||||
.main-list tbody .quick-edit .nav .dropdown-menu {
|
.main-list tbody .quick-edit .nav .dropdown-menu {
|
||||||
|
|||||||
@@ -0,0 +1,150 @@
|
|||||||
|
.o-question {
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
.o-question input[type=checkbox], .o-question input[type=radio] {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.o-question textarea {
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
|
.o-question-topic {
|
||||||
|
font-size: 2em;
|
||||||
|
line-height: normal;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.5em 0;
|
||||||
|
}
|
||||||
|
.o-question-description {
|
||||||
|
font-size: 0.9em;
|
||||||
|
line-height: 1.5em;
|
||||||
|
}
|
||||||
|
.o-question-list {
|
||||||
|
clear: both;
|
||||||
|
margin: 40px 0;
|
||||||
|
padding: 0;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.o-question-list > li {
|
||||||
|
margin: 0 0 0 40px;
|
||||||
|
padding: 16px 0;
|
||||||
|
border-top: solid 1px #eee;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.o-question-list > li .required-star {
|
||||||
|
position: absolute;
|
||||||
|
left: -42px;
|
||||||
|
padding-top: 4px;
|
||||||
|
}
|
||||||
|
.o-question-list > li:first-child {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
.o-question-title {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 1.2em;
|
||||||
|
line-height: 1.5em;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
.o-question-title + .o-question-description {
|
||||||
|
font-weight: normal;
|
||||||
|
background-color: #f6f6f6;
|
||||||
|
padding: 16px;
|
||||||
|
position: relative;
|
||||||
|
margin-top: 20px;
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
.o-question-title + .o-question-description:before {
|
||||||
|
display: block;
|
||||||
|
content: "";
|
||||||
|
border-left: 12px solid transparent;
|
||||||
|
border-right: 12px solid transparent;
|
||||||
|
border-bottom: 12px solid #f6f6f6;
|
||||||
|
position: absolute;
|
||||||
|
top: -12px;
|
||||||
|
left: 16px;
|
||||||
|
}
|
||||||
|
.o-question-title + input[type=text],
|
||||||
|
.o-question-title + textarea,
|
||||||
|
.o-question-title + select,
|
||||||
|
.o-question-description + input[type=text],
|
||||||
|
.o-question-description + textarea,
|
||||||
|
.o-question-description + select {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.o-question-title + input[type=text], .o-question-title + textarea {
|
||||||
|
border: solid 1px #ccc;
|
||||||
|
padding: 6px;
|
||||||
|
margin: 20px 0;
|
||||||
|
line-height: 24px;
|
||||||
|
}
|
||||||
|
.o-question-title + input[type=text] {
|
||||||
|
width: 40%;
|
||||||
|
}
|
||||||
|
.o-question-title + textarea {
|
||||||
|
width: 70%;
|
||||||
|
}
|
||||||
|
.o-question-group {
|
||||||
|
margin: 20px 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.o-question-option {
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
.o-question-group.view-list {
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
.o-question-group.view-list .o-question-option {}
|
||||||
|
.o-question-group.view-list > li {
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
.o-question-group.view-list > li:first-child {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.o-question-group.view-list > li > * {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.o-question-group.view-list > li input + .o-question-option {
|
||||||
|
margin: 0 0 0 12px;
|
||||||
|
}
|
||||||
|
.o-question-group.view-dropdown {
|
||||||
|
height: 24px;
|
||||||
|
line-height: 24px;
|
||||||
|
}
|
||||||
|
.o-question-group.view-grid {
|
||||||
|
border-collapse: collapse;
|
||||||
|
max-width: 90%;
|
||||||
|
min-width: 50%;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
.o-question-group.view-grid th, .o-question-group.view-grid td {
|
||||||
|
padding: 6px;
|
||||||
|
}
|
||||||
|
.o-question-group.view-grid thead th {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.o-question-group.view-grid tbody th {}
|
||||||
|
.o-question-group.view-grid tbody .odd .o-question-title, .o-question-group.view-grid tbody .odd td {
|
||||||
|
background-color: #f6f6f6;
|
||||||
|
}
|
||||||
|
.o-question-group.view-grid .o-question-title {
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
.o-question-group.view-grid tbody .odd .o-question-title {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
.o-question-group.view-grid tbody .odd td {}
|
||||||
|
.o-question-group.view-grid tbody tr:hover td {
|
||||||
|
background-color: #aaa;
|
||||||
|
}
|
||||||
|
.o-question-group.view-grid tbody td {
|
||||||
|
vertical-align: middle;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.o-question-group.view-grid tbody td input {
|
||||||
|
vertical-align: baseline;
|
||||||
|
}
|
||||||
|
.o-question-action {
|
||||||
|
padding: 20px;
|
||||||
|
background-color: #f6f6f6;
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700);
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 50px 0;
|
||||||
|
background-color: #eee;
|
||||||
|
font-family: 'Open Sans', sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper {
|
||||||
|
background: #FFFFFF none;
|
||||||
|
box-shadow: 0 0 50px rgba(0, 0, 0, 0.1);
|
||||||
|
margin: 0 auto;
|
||||||
|
overflow: hidden;
|
||||||
|
width: 980px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper > h1 {
|
||||||
|
margin: 0;
|
||||||
|
padding: 20px;
|
||||||
|
font-family: 'Open Sans', sans-serif;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
section {
|
||||||
|
border-top: dashed 3px #eee;
|
||||||
|
padding: 40px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
section:first-child {
|
||||||
|
border: 0;
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
section > h2 {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: bold;
|
||||||
|
border: solid 1px #ddd;
|
||||||
|
background-color: #2676C0;
|
||||||
|
color: #fff;
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0 16px;
|
||||||
|
box-shadow: 0 1px 1px #fff, 0 2px 6px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
.side {
|
||||||
|
float: right;
|
||||||
|
width: 189px;
|
||||||
|
padding-left: 20px;
|
||||||
|
border-left: solid 1px #eee;
|
||||||
|
}
|
||||||
|
.main {
|
||||||
|
float: left;
|
||||||
|
width: 710px;
|
||||||
|
padding-right: 20px;
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ class Admin::AssetsController < OrbitBackendController
|
|||||||
def new
|
def new
|
||||||
@asset = Asset.new
|
@asset = Asset.new
|
||||||
@asset_categories = AssetCategory.all
|
@asset_categories = AssetCategory.all
|
||||||
@tags = AssetTag.all
|
@tags = get_tags
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {}
|
format.html {}
|
||||||
format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/new'} }
|
format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/new'} }
|
||||||
@@ -21,7 +21,7 @@ class Admin::AssetsController < OrbitBackendController
|
|||||||
def edit
|
def edit
|
||||||
@asset = Asset.find(params[:id])
|
@asset = Asset.find(params[:id])
|
||||||
@asset_categories = AssetCategory.all
|
@asset_categories = AssetCategory.all
|
||||||
@tags = AssetTag.all
|
@tags = get_tags
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {}
|
format.html {}
|
||||||
format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/edit'} }
|
format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/edit'} }
|
||||||
@@ -46,7 +46,7 @@ class Admin::AssetsController < OrbitBackendController
|
|||||||
else
|
else
|
||||||
flash[:error] = t('create.fail')
|
flash[:error] = t('create.fail')
|
||||||
@asset_categories = AssetCategory.all
|
@asset_categories = AssetCategory.all
|
||||||
@tags = AssetTag.all
|
@tags = get_tags
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js {
|
format.js {
|
||||||
if params[:uploader]
|
if params[:uploader]
|
||||||
@@ -69,7 +69,7 @@ class Admin::AssetsController < OrbitBackendController
|
|||||||
else
|
else
|
||||||
flash[:error] = t('update.fail')
|
flash[:error] = t('update.fail')
|
||||||
@asset_categories = AssetCategory.all
|
@asset_categories = AssetCategory.all
|
||||||
@tags = AssetTag.all
|
@tags = get_tags
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render :action => :edit }
|
format.html { render :action => :edit }
|
||||||
format.js { render 'js/reload_pop_up', :locals => {:value => @asset, :values => nil, :partial => 'admin/assets/edit', :locals => {:is_html => false}} }
|
format.js { render 'js/reload_pop_up', :locals => {:value => @asset, :values => nil, :partial => 'admin/assets/edit', :locals => {:is_html => false}} }
|
||||||
@@ -96,7 +96,7 @@ class Admin::AssetsController < OrbitBackendController
|
|||||||
def file_upload
|
def file_upload
|
||||||
@asset = Asset.new
|
@asset = Asset.new
|
||||||
@asset_categories = AssetCategory.all
|
@asset_categories = AssetCategory.all
|
||||||
@tags = AssetTag.all
|
@tags = get_tags
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ class Admin::PagePartsController < OrbitBackendController
|
|||||||
@part = PagePart.find(params[:id])
|
@part = PagePart.find(params[:id])
|
||||||
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
|
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
|
||||||
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
||||||
|
if @r_tag.eql?('tag_cloud')
|
||||||
|
@tag_objects = ModuleApp.where(has_tag: true)
|
||||||
|
else
|
||||||
|
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
@module_apps = ModuleApp.for_widget_select
|
@module_apps = ModuleApp.for_widget_select
|
||||||
@categories = nil
|
@categories = nil
|
||||||
@@ -119,7 +124,11 @@ class Admin::PagePartsController < OrbitBackendController
|
|||||||
def reload_r_tag_options
|
def reload_r_tag_options
|
||||||
@part = PagePart.find params[:id]
|
@part = PagePart.find params[:id]
|
||||||
@r_tag = params[:type]
|
@r_tag = params[:type]
|
||||||
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
if params[:type].eql?('tag_cloud')
|
||||||
|
@tag_objects = ModuleApp.where(has_tag: true)
|
||||||
|
else
|
||||||
|
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
||||||
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js {}
|
format.js {}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,16 +2,10 @@ class Admin::TagsController < OrbitBackendController
|
|||||||
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]
|
||||||
|
|
||||||
|
|
||||||
# layout 'new_admin'
|
|
||||||
# before_filter :authenticate_user!
|
|
||||||
# before_filter :is_admin?
|
|
||||||
# before_filter :set_module_app
|
# before_filter :set_module_app
|
||||||
|
|
||||||
def index
|
def index
|
||||||
get_tags
|
@tags = get_tags
|
||||||
@module_app_id = @module_app.id rescue nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@@ -23,12 +17,7 @@ class Admin::TagsController < OrbitBackendController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
if params[:tag][:module_app_id].blank?
|
@tag = @module_app ? @module_app.tags.create(params[:tag]) : Tag.create(params[:tag])
|
||||||
@tag = Tag.create(params[:tag])
|
|
||||||
else
|
|
||||||
module_app = ModuleApp.find(params[:tag][:module_app_id])
|
|
||||||
@tag = eval("#{module_app.key.camelize}Tag").create(params[:tag])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@@ -47,15 +36,12 @@ class Admin::TagsController < OrbitBackendController
|
|||||||
protected
|
protected
|
||||||
|
|
||||||
def get_tags
|
def get_tags
|
||||||
@tags = (@module_app ? @module_app.tags : Tag.all)
|
@tags = @module_app.blank? ? Tag.all : @module_app.tags
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_vars
|
def setup_vars
|
||||||
@app_key = request.env['HTTP_REFERER'].split('/')[4]
|
@module_app = ModuleApp.find(params[:module_app_id]) if params[:module_app_id]
|
||||||
if @app_key
|
@module_app_id = @module_app.id rescue nil
|
||||||
@app_key.gsub!(/[?].*/, '')
|
|
||||||
@module_app = ModuleApp.first(conditions: {:key => @app_key})
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
class Admin::UserActionsController < OrbitBackendController
|
||||||
|
|
||||||
|
def index
|
||||||
|
@user_actions = UserAction.all
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -3,8 +3,8 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
include ParserFrontEnd, ParserBackEnd, ApplicationHelper
|
include ParserFrontEnd, ParserBackEnd, ApplicationHelper
|
||||||
include OrbitApp::ErrorHandlers::PageErrorHandler
|
include OrbitApp::ErrorHandlers::PageErrorHandler
|
||||||
include OrbitApp::ErrorHandlers::ObjectAuthErrorHandler
|
include OrbitApp::ErrorHandlers::ObjectAuthErrorHandler
|
||||||
include OrbitApp::ErrorHandlers::ModuleAppErrorHandler
|
include OrbitApp::ErrorHandlers::ModuleAppErrorHandler
|
||||||
|
|
||||||
rescue_from ObjectAuthError, :with => :render_object_auth_error
|
rescue_from ObjectAuthError, :with => :render_object_auth_error
|
||||||
rescue_from ModuleAppError, :with => :render_module_app_error
|
rescue_from ModuleAppError, :with => :render_module_app_error
|
||||||
@@ -29,15 +29,16 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
def set_current_user
|
def set_current_user
|
||||||
User.current = current_or_guest_user
|
User.current = current_or_guest_user
|
||||||
|
UserActionRecoder.perform(current_or_guest_user,params.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
def front_end_available(module_app_title='')
|
def front_end_available(module_app_title='')
|
||||||
app_controller = ModuleApp.first(conditions: {:key => module_app_title} )
|
app_controller = ModuleApp.first(conditions: {:key => module_app_title} )
|
||||||
unless app_controller.enable_frontend?
|
unless app_controller.enable_frontend?
|
||||||
render :nothing => true
|
render :nothing => true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_all_app_engines
|
def get_all_app_engines
|
||||||
ary = ["vender/plugins/new_blog"]
|
ary = ["vender/plugins/new_blog"]
|
||||||
app_engines = ary.collect{|t|
|
app_engines = ary.collect{|t|
|
||||||
@@ -50,23 +51,23 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
def flaten_controller
|
def flaten_controller
|
||||||
ary=[]
|
ary=[]
|
||||||
Find.find(File.join(Rails.root , 'vendor/plugins/')) { |name|
|
Find.find(File.join(Rails.root , 'vendor/plugins/')) { |name|
|
||||||
require_dependency(name) if /_controller\.rb$/ =~ name
|
require_dependency(name) if /_controller\.rb$/ =~ name
|
||||||
ary << name
|
ary << name
|
||||||
}
|
}
|
||||||
ary
|
ary
|
||||||
end
|
end
|
||||||
|
|
||||||
# Find the parent for the given item
|
# Find the parent for the given item
|
||||||
def find_parent_item
|
def find_parent_item
|
||||||
@parent_item = Item.first(:conditions => { :id => BSON::ObjectId(params[:parent_id]) }) rescue nil
|
@parent_item = Item.first(:conditions => { :id => BSON::ObjectId(params[:parent_id]) }) rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def auth_failed_in_backend
|
def auth_failed_in_backend
|
||||||
#redirect_to admin_dashboards_url
|
#redirect_to admin_dashboards_url
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def for_admin_only
|
def for_admin_only
|
||||||
if is_admin?
|
if is_admin?
|
||||||
true
|
true
|
||||||
@@ -75,7 +76,7 @@ class ApplicationController < ActionController::Base
|
|||||||
auth_failed_in_backend
|
auth_failed_in_backend
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def for_app_manager
|
def for_app_manager
|
||||||
if is_manager?
|
if is_manager?
|
||||||
true
|
true
|
||||||
@@ -84,7 +85,7 @@ class ApplicationController < ActionController::Base
|
|||||||
auth_failed_in_backend
|
auth_failed_in_backend
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def for_app_sub_manager
|
def for_app_sub_manager
|
||||||
if (@module_app.sub_managing_users.include?(current_or_guest_user) || is_manager?)
|
if (@module_app.sub_managing_users.include?(current_or_guest_user) || is_manager?)
|
||||||
true
|
true
|
||||||
@@ -107,9 +108,9 @@ class ApplicationController < ActionController::Base
|
|||||||
flash[:error] = t("access.denied.object")
|
flash[:error] = t("access.denied.object")
|
||||||
auth_failed_in_backend unless (obj.get_object_auth_by_title(title).auth_users.include?(current_or_guest_user) || is_manager? || is_admin? )
|
auth_failed_in_backend unless (obj.get_object_auth_by_title(title).auth_users.include?(current_or_guest_user) || is_manager? || is_admin? )
|
||||||
end
|
end
|
||||||
|
|
||||||
# Render the page
|
# Render the page
|
||||||
def render_page(args=nil)
|
def render_page(args={})
|
||||||
if @item
|
if @item
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render :text => parse_page_content(@item,args), :layout => 'page_layout' }
|
format.html { render :text => parse_page_content(@item,args), :layout => 'page_layout' }
|
||||||
@@ -131,9 +132,9 @@ class ApplicationController < ActionController::Base
|
|||||||
@orig_url = "http://#{request.host_with_port}/#{@item.path}?id=#{@object.id}"
|
@orig_url = "http://#{request.host_with_port}/#{@item.path}?id=#{@object.id}"
|
||||||
render 'shared/render_share', :layout => false
|
render 'shared/render_share', :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
# Set I18n.locale
|
# Set I18n.locale
|
||||||
def set_locale
|
def set_locale
|
||||||
# update session if passed
|
# update session if passed
|
||||||
@@ -147,24 +148,24 @@ class ApplicationController < ActionController::Base
|
|||||||
else
|
else
|
||||||
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 ? (browser_locale || session[:locale]) : I18n.default_locale.to_s
|
session[:locale] = condition ? (browser_locale || session[:locale]) : I18n.default_locale.to_s
|
||||||
I18n.locale = session[:locale].to_sym
|
I18n.locale = session[:locale].to_sym
|
||||||
end
|
end
|
||||||
|
|
||||||
# Set the site variables
|
# Set the site variables
|
||||||
def set_site
|
def set_site
|
||||||
# set site if exist or create site
|
# set site if exist or create site
|
||||||
@site = Site.first || Site.create({:valid_locales => [], :in_use_locales => []})
|
@site = Site.first || Site.create({:valid_locales => VALID_LOCALES, :in_use_locales => VALID_LOCALES})
|
||||||
session[:site] = @site.id
|
session[:site] = @site.id
|
||||||
@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)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_current_item
|
def set_current_item
|
||||||
session[:current_page] = params[:id] || @item.id rescue nil
|
session[:current_page] = params[:id] || @item.id rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def decrypt_data(encrypted_data, encrypted_key, encrypted_iv)
|
def decrypt_data(encrypted_data, encrypted_key, encrypted_iv)
|
||||||
site = Site.find(session[:site])
|
site = Site.find(session[:site])
|
||||||
if encrypted_data
|
if encrypted_data
|
||||||
@@ -180,7 +181,7 @@ class ApplicationController < ActionController::Base
|
|||||||
''
|
''
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_homepage
|
def get_homepage
|
||||||
Page.root
|
Page.root
|
||||||
end
|
end
|
||||||
@@ -228,6 +229,174 @@ class ApplicationController < ActionController::Base
|
|||||||
redirect_to ret
|
redirect_to ret
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_sorted_and_filtered(object_class, query = nil, objects = nil)
|
||||||
|
objects ||= get_objects(object_class, query)
|
||||||
|
object_class = object_class.classify.constantize
|
||||||
|
if !params[:sort].blank?
|
||||||
|
options = params[:sort_options]
|
||||||
|
options = [options] if !options.class.eql?(Array)
|
||||||
|
options.each do |option|
|
||||||
|
if object_class.fields.include?(option)
|
||||||
|
if object_class.fields[option].type.to_s.eql?('Object') && !object_class.relations[option].nil?
|
||||||
|
objects = get_objects_from_referenced_objects(object_class.fields[option].options[:class_name].constantize, objects, option)
|
||||||
|
else
|
||||||
|
(objects = objects.order_by(option, params[:direction])) rescue nil
|
||||||
|
end
|
||||||
|
elsif object_class.relations.include?(option)
|
||||||
|
case object_class.relations[option].macro
|
||||||
|
when :references_one
|
||||||
|
a = Array.new
|
||||||
|
objects.each { |object| a << [get_string_value_from_object(object), object] }
|
||||||
|
sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse!
|
||||||
|
objects = sorted.collect {|x| x[1] }
|
||||||
|
when :references_many, :references_and_referenced_in_many
|
||||||
|
objects = get_objects_from_self(object_class, objects, option)
|
||||||
|
when :referenced_in
|
||||||
|
objects = get_objects_from_referenced_objects(object_class.relations[option].class_name.constantize, objects, "#{option}_id")
|
||||||
|
end
|
||||||
|
elsif option.eql?('tags')
|
||||||
|
tag_array = @module_app.tags.inject([]){ |result, value|
|
||||||
|
result << [value.name, value]
|
||||||
|
}
|
||||||
|
params[:direction].eql?('asc') ? tag_array.sort : tag_array.sort.reverse!
|
||||||
|
sorted_objects = Array.new
|
||||||
|
tag_array.each do |x|
|
||||||
|
taggings = x[1].taggings
|
||||||
|
taggings.each {|tagging| sorted_objects << tagging.taggable }
|
||||||
|
end
|
||||||
|
# debugger
|
||||||
|
sorted_objects.flatten!
|
||||||
|
sorted_objects.uniq!
|
||||||
|
objects = get_with_nil(objects, option, sorted_objects)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if @filter
|
||||||
|
@filter.each do |key, value|
|
||||||
|
case key
|
||||||
|
when 'status'
|
||||||
|
a = Array.new
|
||||||
|
objects.each do |object|
|
||||||
|
value.each do |v|
|
||||||
|
a << object if object[v]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
objects = a.uniq
|
||||||
|
when 'categories'
|
||||||
|
a = Array.new
|
||||||
|
objects.each do |object|
|
||||||
|
a << object if (value.include?(object.send("#{object.class.to_s.underscore}_category").id.to_s) rescue nil)
|
||||||
|
end
|
||||||
|
objects = a.uniq
|
||||||
|
when 'tags'
|
||||||
|
a = Array.new
|
||||||
|
objects.each do |object|
|
||||||
|
object.tags.each do |tag|
|
||||||
|
a << object if value.include?(tag.id.to_s)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
objects = a.uniq
|
||||||
|
end if value.size > 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Kaminari.paginate_array(filter_authorized_objects(objects)).page(params[:page]).per(10)
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_viewable(object_class, query=nil)
|
||||||
|
objects = get_objects(object_class,query).order_by(:created_at, :desc)
|
||||||
|
Kaminari.paginate_array(objects).page(params[:page]).per(10)
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_objects(object_class, query=nil)
|
||||||
|
object_class = object_class.classify.constantize
|
||||||
|
# debugger
|
||||||
|
# a=1
|
||||||
|
if query
|
||||||
|
if object_class.include?(Mongoid::Sortable)
|
||||||
|
objects = object_class.default_sort(params[:sort]).where(query)
|
||||||
|
else
|
||||||
|
objects = object_class.where(query)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if object_class.include?(Mongoid::Sortable)
|
||||||
|
objects = object_class.default_sort(params[:sort]).all
|
||||||
|
else
|
||||||
|
objects = object_class.all
|
||||||
|
end
|
||||||
|
end
|
||||||
|
objects
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_objects_from_referenced_objects(object_class, objects, option)
|
||||||
|
referer_ids = objects.distinct(option)
|
||||||
|
referenced_objects = object_class.find(referer_ids) rescue nil
|
||||||
|
if referenced_objects
|
||||||
|
a = Array.new
|
||||||
|
referenced_objects.to_a.each { |referer| a << [get_string_value_from_object(referer), referer.id] }
|
||||||
|
sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse!
|
||||||
|
sorted_objects = sorted.collect {|x| objects.where(option => x[1]).entries }
|
||||||
|
sorted_objects.flatten!
|
||||||
|
sorted_objects.uniq!
|
||||||
|
get_with_nil(objects, option, sorted_objects)
|
||||||
|
else
|
||||||
|
objects
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_objects_from_self(object_class, objects, option)
|
||||||
|
referenced_class = object_class.relations[option].class_name.constantize
|
||||||
|
referenced_objects = referenced_class.all rescue nil
|
||||||
|
if referenced_objects
|
||||||
|
reverse_relation = nil
|
||||||
|
referenced_class.relations.each { |relation| reverse_relation = relation[1].name.to_s if relation[1].class_name.eql?(object_class.to_s) }
|
||||||
|
a = Array.new
|
||||||
|
referenced_objects.each { |referenced_object| a << [get_string_value_from_object(referenced_object), referenced_object] }
|
||||||
|
a.compact!
|
||||||
|
sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse!
|
||||||
|
sorted_objects = Array.new
|
||||||
|
sorted.each {|x| sorted_objects << x[1].send(reverse_relation) }
|
||||||
|
sorted_objects.flatten!
|
||||||
|
sorted_objects.uniq!
|
||||||
|
get_with_nil(objects, option, sorted_objects)
|
||||||
|
else
|
||||||
|
objects
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_string_value_from_object(object)
|
||||||
|
s = object.name_translations[I18n.locale.to_s] unless s rescue nil
|
||||||
|
s = object.title_translations[I18n.locale.to_s] unless s rescue nil
|
||||||
|
s = object.name unless s rescue nil
|
||||||
|
s = object.title unless s rescue nil
|
||||||
|
s.downcase rescue ''
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_with_nil(objects, option, sorted_objects)
|
||||||
|
tmp = Array.new
|
||||||
|
objects.each { |object| tmp << [get_string_value_from_object(object), object] if (object.send(option).blank? || (object.send(option).size == 0 rescue nil)) }
|
||||||
|
sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse!
|
||||||
|
sorted_tmp = sorted.collect {|a| a[1] }
|
||||||
|
a = params[:direction].eql?('asc') ? (sorted_tmp + sorted_objects) : (sorted_objects + sorted_tmp)
|
||||||
|
a.flatten
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def filter_authorized_objects(objects)
|
||||||
|
if(!is_admin? || !is_manager?)
|
||||||
|
objects.delete_if{ |object|
|
||||||
|
if object.is_pending == true
|
||||||
|
if check_permission(:manager)
|
||||||
|
object.create_user_id != current_user.id
|
||||||
|
else
|
||||||
|
!object.send("#{object.class.to_s.underscore}_category").authed_users('fact_check').include?(current_user) rescue false
|
||||||
|
end
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
objects
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|||||||
@@ -12,34 +12,34 @@ class DefaultWidgetController< OrbitWidgetController
|
|||||||
|
|
||||||
def query_for_default_widget
|
def query_for_default_widget
|
||||||
|
|
||||||
ori_class_name = @default_widget["query"].split('.')[0]
|
@ori_class_name = @default_widget["query"].split('.')[0]
|
||||||
result = nil
|
result = nil
|
||||||
result_objects = nil
|
result_objects = nil
|
||||||
|
|
||||||
if !params["tag_id"].blank?
|
if !params["tag_id"].blank?
|
||||||
@tags = Tag.find(params["tag_id"]) rescue nil
|
|
||||||
result_ids = nil
|
|
||||||
|
|
||||||
result_ids = @tags.collect{|tag| tag.send(ori_class_name.downcase.pluralize).entries.collect{|t| t.id}}
|
|
||||||
if params["category_id"].blank? #has tag no cate
|
if params["category_id"].blank? #has tag no cate
|
||||||
#nothing
|
result = @ori_class_name.constantize.where(:tagged_ids.in => params["tag_id"])
|
||||||
else #has tag and cate
|
else #has tag and cate
|
||||||
# result_ids = @tags.collect{|tag| tag.send(ori_class_name.downcase.pluralize).where(:#{get_category_field_name(ori_class_name)}.in=>params["category_id"]).available_for_lang(I18n.locale).can_display.collect{|t| t.id}}.flatten
|
result = eval("#{@ori_class_name}.where(:#{get_category_field_name(@ori_class_name)}.in=>params['category_id'], :tagged_ids.in => params['tag_id'])")
|
||||||
result_ids << eval("#{ori_class_name}.where(:#{get_category_field_name(ori_class_name)}.in=>params['category_id']).entries.collect{|t| t.id}")
|
|
||||||
result_ids.flatten!
|
|
||||||
|
|
||||||
end
|
end
|
||||||
result = eval("#{ori_class_name}.where(:id=>result_ids)")
|
|
||||||
elsif params["category_id"].blank? #no tag no cate
|
elsif params["category_id"].blank? #no tag no cate
|
||||||
result = eval(@default_widget["query"])
|
result = eval(@default_widget["query"])
|
||||||
else #no tag has cate
|
else #no tag has cate
|
||||||
result = eval("#{ori_class_name}.where(:#{get_category_field_name(ori_class_name)}.in=>params['category_id'])")
|
result = eval("#{@ori_class_name}.where(:#{get_category_field_name(@ori_class_name)}.in=>params['category_id'])")
|
||||||
end
|
end
|
||||||
date_now = Time.now
|
|
||||||
result.available_for_lang(I18n.locale).can_display.desc(:is_top, :postdate)
|
result.available_for_lang(I18n.locale).can_display.desc(:is_top, :postdate)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def search_result
|
||||||
|
@search = query_for_default_widget.solr_search do
|
||||||
|
fulltext params[:search_query]
|
||||||
|
end
|
||||||
|
search_result = @search.results.collect{|result| result.id}
|
||||||
|
@items = eval(@ori_class_name).all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result)
|
||||||
|
end
|
||||||
|
|
||||||
def default_widget
|
def default_widget
|
||||||
|
@search = params["search_query"].blank? ? false : true
|
||||||
if !params[:id].blank?
|
if !params[:id].blank?
|
||||||
clicked_field_name = params["clicked_field_name"].to_sym
|
clicked_field_name = params["clicked_field_name"].to_sym
|
||||||
redirect_to eval("#{@page_part.module_app.widget_fields_link_method[clicked_field_name][:method]}('#{params[:id]}', {inner: #{params[:inner] || true}})")
|
redirect_to eval("#{@page_part.module_app.widget_fields_link_method[clicked_field_name][:method]}('#{params[:id]}', {inner: #{params[:inner] || true}})")
|
||||||
@@ -64,8 +64,13 @@ class DefaultWidgetController< OrbitWidgetController
|
|||||||
@fields = @page_part.widget_field
|
@fields = @page_part.widget_field
|
||||||
@data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
|
@data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
|
||||||
end
|
end
|
||||||
if @paginate
|
|
||||||
@data = query_for_default_widget.includes(@widget_image_field).page(params[:page_main]).per(@data_limit)
|
if @paginate || @search
|
||||||
|
if @search
|
||||||
|
@data = search_result.page(params[:page_main]).per(@data_limit) rescue []
|
||||||
|
else #regular listing
|
||||||
|
@data = query_for_default_widget.includes(@widget_image_field).page(params[:page_main]).per(@data_limit)
|
||||||
|
end
|
||||||
# @data = query_for_default_widget.limit(@data_limit).includes(@widget_image_field)
|
# @data = query_for_default_widget.limit(@data_limit).includes(@widget_image_field)
|
||||||
else
|
else
|
||||||
@data = query_for_default_widget.includes(@widget_image_field).limit(@data_limit)
|
@data = query_for_default_widget.includes(@widget_image_field).limit(@data_limit)
|
||||||
@@ -85,9 +90,9 @@ class DefaultWidgetController< OrbitWidgetController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_category_field_name(ori_class_name)
|
def get_category_field_name()
|
||||||
ori_class_name = ori_class_name.constantize
|
@ori_class_name = @ori_class_name.constantize
|
||||||
ori_class_name.fields.each_key do |key|
|
@ori_class_name.fields.each_key do |key|
|
||||||
return key if key.include?('category_id')
|
return key if key.include?('category_id')
|
||||||
end
|
end
|
||||||
nil
|
nil
|
||||||
|
|||||||
@@ -38,6 +38,11 @@ class FrontController < ApplicationController
|
|||||||
@ad_images = AdImage.all
|
@ad_images = AdImage.all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show_tag_cloud
|
||||||
|
module_app = ModuleApp.find(params[:id]) rescue nil
|
||||||
|
@tags = module_app.sorted_tags_for_cloud
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def menu_level(page, current_page, current, menu)
|
def menu_level(page, current_page, current, menu)
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
class OrbitBackendController < ApplicationController
|
class OrbitBackendController < ApplicationController
|
||||||
include OrbitCoreLib::AppBackendUtility
|
include OrbitCoreLib::AppBackendUtility
|
||||||
include OrbitCoreLib::PermissionUtility
|
include OrbitCoreLib::PermissionUtility
|
||||||
|
include OrbitTag::Tagging
|
||||||
include AdminHelper
|
include AdminHelper
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
|
|
||||||
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} )
|
||||||
@@ -23,163 +24,15 @@ class OrbitBackendController < ApplicationController
|
|||||||
|
|
||||||
def force_order_for_user
|
def force_order_for_user
|
||||||
setup_vars
|
setup_vars
|
||||||
set_current_user
|
set_current_user
|
||||||
authenticate_user!
|
authenticate_user!
|
||||||
check_user_can_use
|
check_user_can_use
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_user_can_use
|
def check_user_can_use
|
||||||
unless check_permission
|
unless check_permission
|
||||||
#redirect_to polymorphic_path(['panel',@app_title,'back_end','public'])
|
#redirect_to polymorphic_path(['panel',@app_title,'back_end','public'])
|
||||||
redirect_to root_url
|
redirect_to root_url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
def get_sorted_and_filtered(object_class, query=nil)
|
|
||||||
objects = get_objects(object_class, query)
|
|
||||||
object_class = object_class.classify.constantize
|
|
||||||
if !params[:sort].blank?
|
|
||||||
options = params[:sort_options]
|
|
||||||
options = [options] if !options.class.eql?(Array)
|
|
||||||
options.each do |option|
|
|
||||||
if object_class.fields.include?(option)
|
|
||||||
if object_class.fields[option].type.to_s.eql?('Object') && !object_class.relations[option].nil?
|
|
||||||
objects = get_objects_from_referenced_objects(object_class.fields[option].options[:class_name].constantize, objects, option)
|
|
||||||
else
|
|
||||||
(objects = objects.order_by(option, params[:direction])) rescue nil
|
|
||||||
end
|
|
||||||
elsif object_class.relations.include?(option)
|
|
||||||
case object_class.relations[option].macro
|
|
||||||
when :references_one
|
|
||||||
a = Array.new
|
|
||||||
objects.each { |object| a << [get_string_value_from_object(object), object] }
|
|
||||||
sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse!
|
|
||||||
objects = sorted.collect {|x| x[1] }
|
|
||||||
when :references_many, :references_and_referenced_in_many
|
|
||||||
objects = get_objects_from_self(object_class, objects, option)
|
|
||||||
when :referenced_in
|
|
||||||
objects = get_objects_from_referenced_objects(object_class.relations[option].class_name.constantize, objects, "#{option}_id")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if @filter
|
|
||||||
@filter.each do |key, value|
|
|
||||||
case key
|
|
||||||
when 'status'
|
|
||||||
a = Array.new
|
|
||||||
objects.each do |object|
|
|
||||||
value.each do |v|
|
|
||||||
a << object if object[v]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
objects = a.uniq
|
|
||||||
when 'categories'
|
|
||||||
a = Array.new
|
|
||||||
objects.each do |object|
|
|
||||||
a << object if (value.include?(object.send("#{object.class.to_s.underscore}_category").id.to_s) rescue nil)
|
|
||||||
end
|
|
||||||
objects = a.uniq
|
|
||||||
when 'tags'
|
|
||||||
a = Array.new
|
|
||||||
objects.each do |object|
|
|
||||||
object.tags.each do |tag|
|
|
||||||
a << object if value.include?(tag.id.to_s)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
objects = a.uniq
|
|
||||||
end if value.size > 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Kaminari.paginate_array(filter_authorized_objects(objects)).page(params[:page]).per(10)
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_string_value_from_object(object)
|
|
||||||
s = object.name_translations[I18n.locale.to_s] unless s rescue nil
|
|
||||||
s = object.title_translations[I18n.locale.to_s] unless s rescue nil
|
|
||||||
s = object.name unless s rescue nil
|
|
||||||
s = object.title unless s rescue nil
|
|
||||||
s.downcase rescue ''
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_objects_from_referenced_objects(object_class, objects, option)
|
|
||||||
referer_ids = objects.distinct(option)
|
|
||||||
referenced_objects = object_class.find(referer_ids) rescue nil
|
|
||||||
if referenced_objects
|
|
||||||
a = Array.new
|
|
||||||
referenced_objects.to_a.each { |referer| a << [get_string_value_from_object(referer), referer.id] }
|
|
||||||
sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse!
|
|
||||||
sorted_objects = sorted.collect {|x| objects.where(option => x[1]).entries }
|
|
||||||
sorted_objects.flatten!
|
|
||||||
sorted_objects.uniq!
|
|
||||||
get_with_nil(objects, option, sorted_objects)
|
|
||||||
else
|
|
||||||
objects
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_objects_from_self(object_class, objects, option)
|
|
||||||
referenced_class = object_class.relations[option].class_name.constantize
|
|
||||||
referenced_objects = referenced_class.all rescue nil
|
|
||||||
if referenced_objects
|
|
||||||
reverse_relation = nil
|
|
||||||
referenced_class.relations.each { |relation| reverse_relation = relation[1].name.to_s if relation[1].class_name.eql?(object_class.to_s) }
|
|
||||||
a = Array.new
|
|
||||||
referenced_objects.each { |referenced_object| a << [get_string_value_from_object(referenced_object), referenced_object] }
|
|
||||||
a.compact!
|
|
||||||
sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse!
|
|
||||||
sorted_objects = Array.new
|
|
||||||
sorted.each {|x| sorted_objects << x[1].send(reverse_relation) }
|
|
||||||
sorted_objects.flatten!
|
|
||||||
sorted_objects.uniq!
|
|
||||||
get_with_nil(objects, option, sorted_objects)
|
|
||||||
else
|
|
||||||
objects
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_with_nil(objects, option, sorted_objects)
|
|
||||||
tmp = Array.new
|
|
||||||
objects.each { |object| tmp << [get_string_value_from_object(object), object] if (object.send(option).blank? || (object.send(option).size == 0 rescue nil)) }
|
|
||||||
sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse!
|
|
||||||
sorted_tmp = sorted.collect {|a| a[1] }
|
|
||||||
a = params[:direction].eql?('asc') ? (sorted_tmp + sorted_objects) : (sorted_objects + sorted_tmp)
|
|
||||||
a.flatten
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
def get_viewable(object_class, query=nil)
|
|
||||||
objects = get_objects(object_class,query).order_by(:created_at, :desc)
|
|
||||||
Kaminari.paginate_array(objects).page(params[:page]).per(10)
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_objects(object_class, query=nil)
|
|
||||||
object_class = object_class.classify.constantize
|
|
||||||
# debugger
|
|
||||||
# a=1
|
|
||||||
if query
|
|
||||||
objects = object_class.where(query)
|
|
||||||
else
|
|
||||||
objects = object_class.all
|
|
||||||
end
|
|
||||||
objects
|
|
||||||
end
|
|
||||||
|
|
||||||
def filter_authorized_objects(objects)
|
|
||||||
if(!is_admin? || !is_manager?)
|
|
||||||
objects.delete_if{ |object|
|
|
||||||
if object.is_pending == true
|
|
||||||
if check_permission(:manager)
|
|
||||||
object.create_user_id != current_user.id
|
|
||||||
else
|
|
||||||
!object.send("#{object.class.to_s.underscore}_category").authed_users('fact_check').include?(current_user) rescue false
|
|
||||||
end
|
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
|
||||||
}
|
|
||||||
end
|
|
||||||
objects
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,4 +1,9 @@
|
|||||||
class OrbitWidgetController< OrbitFrontendComponentController
|
class OrbitWidgetController< OrbitFrontendComponentController
|
||||||
|
include FrontEndArrayParamsHelper
|
||||||
|
before_filter {get_tags_and_cates(params)}
|
||||||
|
|
||||||
|
def get_tags_and_cates(params)
|
||||||
|
params = tags_and_cates(params)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -5,7 +5,7 @@ class PagesController < ApplicationController
|
|||||||
# caches_page :index
|
# caches_page :index
|
||||||
|
|
||||||
def check_frontend_open
|
def check_frontend_open
|
||||||
if Me.frontend_closed
|
if Me.frontend_closed and current_user.nil? #Need to be change
|
||||||
redirect_to '/admin/dashboards'
|
redirect_to '/admin/dashboards'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -14,10 +14,11 @@ class PagesController < ApplicationController
|
|||||||
@item = Page.find_by_name('home')
|
@item = Page.find_by_name('home')
|
||||||
|
|
||||||
if @item
|
if @item
|
||||||
impressionist(@item)
|
delayed_impressionist(@item)
|
||||||
render_page
|
render_page
|
||||||
else
|
else
|
||||||
render :text => t(:need_home)
|
redirect_to '/admin/dashboards',:notice=>t(:need_home)
|
||||||
|
# render :text => t(:need_home)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -25,13 +26,13 @@ class PagesController < ApplicationController
|
|||||||
#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))
|
||||||
impressionist(@item)
|
delayed_impressionist(@item)
|
||||||
case @item.class.to_s
|
case @item.class.to_s
|
||||||
when 'Page'
|
when 'Page'
|
||||||
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 unless save_from_no_lang_for_page
|
render_page(params) 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
|
||||||
@@ -44,12 +45,28 @@ class PagesController < ApplicationController
|
|||||||
#end
|
#end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def convert_array_param(key,array)
|
||||||
|
array.collect{|t| "#{key}[]=#{t}"}.join("&")
|
||||||
|
end
|
||||||
|
|
||||||
def index_from_link
|
def index_from_link
|
||||||
url = "/#{@item.path}"
|
url = "/#{@item.path}"
|
||||||
options = ''
|
options = ''
|
||||||
options << "#{options.blank? ? '?' : '&'}page_main=#{params[:page_main]}" unless params[:page_main].blank?
|
options << "#{options.blank? ? '?' : '&'}page_main=#{params[:page_main]}" unless params[:page_main].blank?
|
||||||
options << "#{options.blank? ? '?' : '&'}category_id=#{params[:category_id]}" unless params[:category_id].blank?
|
|
||||||
options << "#{options.blank? ? '?' : '&'}tag_id=#{params[:tag_id]}" unless params[:tag_id].blank?
|
if params[:category_id].is_a? Array
|
||||||
|
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('category_id',params[:category_id])}" unless params[:category_id].blank?
|
||||||
|
elsif params[:category_id].is_a? String
|
||||||
|
options << "#{options.blank? ? '?' : '&'}category_id=#{params[:category_id]}" unless params[:category_id].blank?
|
||||||
|
end
|
||||||
|
|
||||||
|
if params[:tag_id].is_a? Array
|
||||||
|
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('tag_id',params[:tag_id])}" unless params[:tag_id].blank?
|
||||||
|
elsif params[:category_id].is_a? String
|
||||||
|
options << "#{options.blank? ? '?' : '&'}tag_id=#{params[:tag_id]}" unless params[:tag_id].blank?
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
options << "#{options.blank? ? '?' : '&'}search_query=#{params[:search_query]}" unless params[:search_query].blank?
|
options << "#{options.blank? ? '?' : '&'}search_query=#{params[:search_query]}" unless params[:search_query].blank?
|
||||||
options << "#{options.blank? ? '?' : '&'}name=#{params[:name]}" unless params[:name].blank?
|
options << "#{options.blank? ? '?' : '&'}name=#{params[:name]}" unless params[:name].blank?
|
||||||
uri = URI::escape(url + options)
|
uri = URI::escape(url + options)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ protected
|
|||||||
def get_categories_and_tags
|
def get_categories_and_tags
|
||||||
unless @selected[:module_app].nil?
|
unless @selected[:module_app].nil?
|
||||||
@categories = @selected[:module_app].get_categories
|
@categories = @selected[:module_app].get_categories
|
||||||
@tags = @selected[:module_app].get_tags
|
@tags = @selected[:module_app].tags
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -55,4 +55,4 @@ protected
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1,9 +1,20 @@
|
|||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
|
|
||||||
FLASH_NOTICE_KEYS = [:error, :notice, :warning]
|
FLASH_NOTICE_KEYS = [:error, :notice, :warning]
|
||||||
|
|
||||||
|
|
||||||
|
def current_path(param_hash)
|
||||||
|
request.referer.include?('?') ? [request.referer,param_hash.to_param].join('&') : [request.referer,param_hash.to_param].join('?')
|
||||||
|
end
|
||||||
|
|
||||||
|
def delayed_impressionist(object)
|
||||||
|
# Resque.enqueue_at(1.minute.from_now,DelayedImpressionist,object)
|
||||||
|
end
|
||||||
|
|
||||||
def check_user_role_enable(attribute_fields)
|
def check_user_role_enable(attribute_fields)
|
||||||
@user.attribute_values.collect{|t| attribute_fields.include?(t.attribute_field) }.include?(true) rescue false
|
@user.attribute_values.collect{|t| attribute_fields.include?(t.attribute_field) }.include?(true) rescue false
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_attribute_value(value)
|
def show_attribute_value(value)
|
||||||
if value.kind_of? Hash
|
if value.kind_of? Hash
|
||||||
result = []
|
result = []
|
||||||
@@ -18,7 +29,7 @@ module ApplicationHelper
|
|||||||
u = nil
|
u = nil
|
||||||
User.without_callback(:create, :before, :initialize_desktop) do
|
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
|
end
|
||||||
u.admin = false
|
u.admin = false
|
||||||
u.save(:validate => false)
|
u.save(:validate => false)
|
||||||
u
|
u
|
||||||
@@ -46,24 +57,24 @@ module ApplicationHelper
|
|||||||
|
|
||||||
def flash_messages
|
def flash_messages
|
||||||
return unless messages = flash.keys.select{|k| FLASH_NOTICE_KEYS.include?(k)}
|
return unless messages = flash.keys.select{|k| FLASH_NOTICE_KEYS.include?(k)}
|
||||||
formatted_messages = messages.map do |type|
|
formatted_messages = messages.map do |type|
|
||||||
content_tag :div, :class => type.to_s do
|
content_tag :div, :class => type.to_s do
|
||||||
message_for_item(flash[type], flash["#{type}_item".to_sym])
|
message_for_item(flash[type], flash["#{type}_item".to_sym])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
raw(formatted_messages.join)
|
raw(formatted_messages.join)
|
||||||
end
|
end
|
||||||
|
|
||||||
def link_back(custom_class=nil)
|
def link_back(custom_class=nil)
|
||||||
case custom_class
|
case custom_class
|
||||||
when nil
|
when nil
|
||||||
link_to t('back'), get_go_back, :class => 'nav'
|
link_to t('back'), get_go_back, :class => 'nav'
|
||||||
else
|
else
|
||||||
link_to t('back'), get_go_back, :class => custom_class
|
link_to t('back'), get_go_back, :class => custom_class
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Clean the link back
|
# Clean the link back
|
||||||
def get_go_back
|
def get_go_back
|
||||||
begin
|
begin
|
||||||
@@ -104,28 +115,28 @@ module ApplicationHelper
|
|||||||
message % item
|
message % item
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_attribute(partial, f, attribute)
|
def add_attribute(partial, f, attribute)
|
||||||
new_object = f.object.send(attribute).build
|
new_object = f.object.send(attribute).build
|
||||||
fields = f.fields_for(attribute, new_object, :child_index => "new_#{attribute}") do |f|
|
fields = f.fields_for(attribute, new_object, :child_index => "new_#{attribute}") do |f|
|
||||||
render :partial => partial, :object => new_object, :locals => {:f => f}
|
render :partial => partial, :object => new_object, :locals => {:f => f}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def active_for_ob_auths_object(object_class,field = :object_auth_id)
|
def active_for_ob_auths_object(object_class,field = :object_auth_id)
|
||||||
unless active_for_action("object_auths_new_interface","setting").nil?
|
unless active_for_action("object_auths_new_interface","setting").nil?
|
||||||
ob_auth = ObjectAuth.find params[field]
|
ob_auth = ObjectAuth.find params[field]
|
||||||
ob_auth.obj_authable_type == object_class.to_s ? 'active' : nil
|
ob_auth.obj_authable_type == object_class.to_s ? 'active' : nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def active_for_ob_auth(ob_auth_title,field = :object_auth_id)
|
def active_for_ob_auth(ob_auth_title,field = :object_auth_id)
|
||||||
unless active_for_action("module_apps_new_interface","setting").nil?
|
unless active_for_action("module_apps_new_interface","setting").nil?
|
||||||
oa_auth = ObjectAuth.find params[field]
|
oa_auth = ObjectAuth.find params[field]
|
||||||
oa_auth.title == ob_auth_title ? 'active' : nil
|
oa_auth.title == ob_auth_title ? 'active' : nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def active_for_app_auth(app_title ='', opt={:controller_name => 'module_apps_new_interface',:action_name=>'setting',:field => :module_app_id})
|
def active_for_app_auth(app_title ='', opt={:controller_name => 'module_apps_new_interface',:action_name=>'setting',:field => :module_app_id})
|
||||||
unless active_for_action(opt[:controller_name],opt[:action_name]).nil?
|
unless active_for_action(opt[:controller_name],opt[:action_name]).nil?
|
||||||
app = ModuleApp.find params[opt[:field]]
|
app = ModuleApp.find params[opt[:field]]
|
||||||
@@ -134,7 +145,7 @@ module ApplicationHelper
|
|||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def active_for_controllers(*controller_names)
|
def active_for_controllers(*controller_names)
|
||||||
(controller_names.include?(controller.controller_name) || controller_names.include?(request.fullpath)) ? 'active' : nil
|
(controller_names.include?(controller.controller_name) || controller_names.include?(request.fullpath)) ? 'active' : nil
|
||||||
end
|
end
|
||||||
@@ -142,11 +153,11 @@ module ApplicationHelper
|
|||||||
def visible_for_controllers(*controller_names)
|
def visible_for_controllers(*controller_names)
|
||||||
(controller_names.include?(controller.controller_name) || controller_names.include?(request.fullpath)) ? '' : 'hide'
|
(controller_names.include?(controller.controller_name) || controller_names.include?(request.fullpath)) ? '' : 'hide'
|
||||||
end
|
end
|
||||||
|
|
||||||
def active_for_action(controller_name, action_name)
|
def active_for_action(controller_name, action_name)
|
||||||
((controller.controller_name.eql?(controller_name) || request.fullpath.eql?(controller_name)) && controller.action_name.eql?(action_name)) ? 'active' : nil
|
((controller.controller_name.eql?(controller_name) || request.fullpath.eql?(controller_name)) && controller.action_name.eql?(action_name)) ? 'active' : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def page_metas(page)
|
def page_metas(page)
|
||||||
tmp_meta = {}
|
tmp_meta = {}
|
||||||
metas = ''
|
metas = ''
|
||||||
@@ -175,11 +186,11 @@ module ApplicationHelper
|
|||||||
res << page_title
|
res << page_title
|
||||||
end
|
end
|
||||||
res << "</title>\n"
|
res << "</title>\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
def page_stylesheets(page, edit=nil)
|
def page_stylesheets(page, edit=nil)
|
||||||
stylesheets = ''
|
stylesheets = ''
|
||||||
unless edit
|
unless edit
|
||||||
stylesheets << "<link href='/assets/bootstrap-orbit.css' rel='stylesheet' type='text/css' />\n"
|
stylesheets << "<link href='/assets/bootstrap-orbit.css' rel='stylesheet' type='text/css' />\n"
|
||||||
stylesheets << "<link href='/assets/style.css' rel='stylesheet' type='text/css' />\n"
|
stylesheets << "<link href='/assets/style.css' rel='stylesheet' type='text/css' />\n"
|
||||||
stylesheets << "<link href='/assets/icons.css' rel='stylesheet' type='text/css' />\n"
|
stylesheets << "<link href='/assets/icons.css' rel='stylesheet' type='text/css' />\n"
|
||||||
@@ -188,9 +199,9 @@ module ApplicationHelper
|
|||||||
stylesheets << "<link href='/assets/bootstrap.css' rel='stylesheet' type='text/css' />\n"
|
stylesheets << "<link href='/assets/bootstrap.css' rel='stylesheet' type='text/css' />\n"
|
||||||
stylesheets << "<link href='/assets/font-awesome.css' rel='stylesheet' type='text/css' />\n"
|
stylesheets << "<link href='/assets/font-awesome.css' rel='stylesheet' type='text/css' />\n"
|
||||||
stylesheets << "<link href='/assets/orbit-bar.css' rel='stylesheet' type='text/css' />\n"
|
stylesheets << "<link href='/assets/orbit-bar.css' rel='stylesheet' type='text/css' />\n"
|
||||||
stylesheets << "<link href='/assets/social-share-button.css' rel='stylesheet' type='text/css' />\n"
|
stylesheets << "<link href='/assets/social-share-button.css' rel='stylesheet' type='text/css' />\n"
|
||||||
stylesheets << "<link href='#{asset_path 'banner_nav.css'}' rel='stylesheet' type='text/css' />\n"
|
stylesheets << "<link href='#{asset_path 'banner_nav.css'}' rel='stylesheet' type='text/css' />\n"
|
||||||
stylesheets << "<link href='#{asset_path 'default_widget.css'}' rel='stylesheet' type='text/css' />\n"
|
stylesheets << "<link href='#{asset_path 'default_widget.css'}' rel='stylesheet' type='text/css' />\n"
|
||||||
stylesheets << "<link href='#{page.design.css_default.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.css_default
|
stylesheets << "<link href='#{page.design.css_default.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.css_default
|
||||||
theme = page.design.themes.detect{ |d| d.id == page.theme_id }
|
theme = page.design.themes.detect{ |d| d.id == page.theme_id }
|
||||||
stylesheets << "<link href='#{theme.file.url}' rel='stylesheet' type='text/css' />\n" if theme
|
stylesheets << "<link href='#{theme.file.url}' rel='stylesheet' type='text/css' />\n" if theme
|
||||||
@@ -224,9 +235,9 @@ module ApplicationHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def at_least_module_manager
|
def at_least_module_manager
|
||||||
is_manager? || is_admin?
|
is_manager? || is_admin?
|
||||||
end
|
end
|
||||||
|
|
||||||
def dislpay_view_count(object)
|
def dislpay_view_count(object)
|
||||||
"#{t(:view_count)}: #{object.view_count}"
|
"#{t(:view_count)}: #{object.view_count}"
|
||||||
end
|
end
|
||||||
@@ -292,4 +303,12 @@ module ApplicationHelper
|
|||||||
"http://#{request.host}:2#{site_number}00"
|
"http://#{request.host}:2#{site_number}00"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def sortable(column, title = nil, options = {})
|
||||||
|
options[:remote] ||= true
|
||||||
|
title ||= column.titleize
|
||||||
|
css_class = column.to_s == params[:sort] ? "current #{params[:direction]}" : 'asc'
|
||||||
|
direction = column.to_s == params[:sort] && params[:direction] == 'asc' ? 'desc' : 'asc'
|
||||||
|
link_to title, params.merge({direction: direction, sort: column, sort_options: column}), {:class => "#{css_class} sortable", :remote => options[:remote]}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -8,7 +8,7 @@ module OrbitFormHelper
|
|||||||
options[:icon_date] ||= 'icons-calendar'
|
options[:icon_date] ||= 'icons-calendar'
|
||||||
options[:icon_clear] ||= 'icons-cross-3'
|
options[:icon_clear] ||= 'icons-cross-3'
|
||||||
options[:input_class] ||= 'input-large'
|
options[:input_class] ||= 'input-large'
|
||||||
options[:value] ||= options[:object][method] if options[:object] && options[:object][method]
|
options[:value] ||= options[:object].send(method) if options[:object] && options[:object][method]
|
||||||
case options[:picker_type]
|
case options[:picker_type]
|
||||||
when 'date'
|
when 'date'
|
||||||
content_tag :div, :id => options[:id], :class => options[:class] do
|
content_tag :div, :id => options[:id], :class => options[:class] do
|
||||||
@@ -22,7 +22,7 @@ module OrbitFormHelper
|
|||||||
options[:label] ||= I18n.t('datetime_picker.separated.label')
|
options[:label] ||= I18n.t('datetime_picker.separated.label')
|
||||||
content_tag :div, :id => options[:id], :class => "separated_picker #{options[:class]}" do
|
content_tag :div, :id => options[:id], :class => "separated_picker #{options[:class]}" do
|
||||||
concat label_tag options[:label] unless options[:no_label]
|
concat label_tag options[:label] unless options[:no_label]
|
||||||
concat hidden_field(object_name, method)
|
concat hidden_field(object_name, method, :value => options[:value])
|
||||||
concat separated_picker(object_name, method, options)
|
concat separated_picker(object_name, method, options)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class BackupServer
|
|||||||
|
|
||||||
%x[rm #{archive_db_list_path}]
|
%x[rm #{archive_db_list_path}]
|
||||||
%x[ls #{Rails.root}/tmp/#{dbname}* | du -h --max-depth=1 --block-size=1M |sort -h >> #{archive_db_list_path}]
|
%x[ls #{Rails.root}/tmp/#{dbname}* | du -h --max-depth=1 --block-size=1M |sort -h >> #{archive_db_list_path}]
|
||||||
OrbitJobLogger.info "DB backup done Path:#{dbdirectory}"
|
OrbitLogger.info "DB backup done Path:#{dbdirectory}"
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -8,7 +8,7 @@ class DashboardCounter < Resque::Plugins::RestrictionJob
|
|||||||
site.dashboard_counter[:visitors_this_month] = obj.display_visitors_this_month
|
site.dashboard_counter[:visitors_this_month] = obj.display_visitors_this_month
|
||||||
site.dashboard_counter[:visitors_this_year] = obj.display_visitors_this_year
|
site.dashboard_counter[:visitors_this_year] = obj.display_visitors_this_year
|
||||||
site.save
|
site.save
|
||||||
OrbitJobLogger.info "DashboardCounter done #{site.dashboard_counter.to_s}"
|
OrbitLogger.info "DashboardCounter done #{site.dashboard_counter.to_s}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
class DelayedImpressionist
|
||||||
|
@queue = :low
|
||||||
|
def self.perform(object)
|
||||||
|
impressionist(object)
|
||||||
|
true
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -5,6 +5,6 @@ class UpdateTagCloud
|
|||||||
Tag.all.each do |tag|
|
Tag.all.each do |tag|
|
||||||
tag.update_attribute(:cloud_view_count, tag.impressionist_count(:created_at.gte => 14.days.ago, :created_at.lte => Time.now))
|
tag.update_attribute(:cloud_view_count, tag.impressionist_count(:created_at.gte => 14.days.ago, :created_at.lte => Time.now))
|
||||||
end
|
end
|
||||||
OrbitJobLogger.info "UpdateTagCloud Done"
|
OrbitLogger.info "UpdateTagCloud Done"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
class UserActionRecoder
|
||||||
|
@queue = :low
|
||||||
|
def self.perform(user,params)
|
||||||
|
UserAction.create!(:user=>user,:params=>params,:page=>"#{params['controller']}##{params['action']}")
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
+4
-6
@@ -2,6 +2,8 @@ class Asset
|
|||||||
|
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
|
include OrbitTag::Taggable
|
||||||
|
taggable
|
||||||
|
|
||||||
mount_uploader :data, FileAssetUploader
|
mount_uploader :data, FileAssetUploader
|
||||||
|
|
||||||
@@ -16,18 +18,14 @@ class Asset
|
|||||||
|
|
||||||
belongs_to :asset_category
|
belongs_to :asset_category
|
||||||
belongs_to :assetable, polymorphic: true
|
belongs_to :assetable, polymorphic: true
|
||||||
has_and_belongs_to_many :tags, :class_name => "AssetTag"
|
# has_and_belongs_to_many :tags, :class_name => "AssetTag"
|
||||||
|
|
||||||
before_save :clean_tags
|
before_save :clean_tags
|
||||||
|
|
||||||
def sorted_tags
|
|
||||||
tags.order_by(I18n.locale, :asc)
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def clean_tags
|
def clean_tags
|
||||||
self.tag_ids.delete('')
|
self.tagged_ids.delete('')
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
+13
-1
@@ -26,7 +26,7 @@ class Item
|
|||||||
after_save :rebuild_children_path, :if => "path_changed?"
|
after_save :rebuild_children_path, :if => "path_changed?"
|
||||||
|
|
||||||
def enabled_for_lang(lang)
|
def enabled_for_lang(lang)
|
||||||
enabled_for.include?(lang)
|
enabled_for.include?(lang) rescue false
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.find_by_name(item_name)
|
def self.find_by_name(item_name)
|
||||||
@@ -64,6 +64,10 @@ class Item
|
|||||||
true
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.structure_ordered_items
|
||||||
|
self.get_children(Item.root, [])
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
@@ -87,5 +91,13 @@ class Item
|
|||||||
def validates_presence_of_parent_id?
|
def validates_presence_of_parent_id?
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.get_children(item, tree)
|
||||||
|
tree << item
|
||||||
|
item.children.each do |child|
|
||||||
|
self.get_children(child, tree)
|
||||||
|
end
|
||||||
|
tree
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -8,6 +8,8 @@ class ModuleApp
|
|||||||
field :title
|
field :title
|
||||||
field :sidebar_order,type: Integer,default: 0
|
field :sidebar_order,type: Integer,default: 0
|
||||||
|
|
||||||
|
has_many :tags, as: :module_tag, dependent: :destroy
|
||||||
|
|
||||||
def refetch_setting!(reg)
|
def refetch_setting!(reg)
|
||||||
# %w{module_label category base_url version organization author intro update_info create_date}.each do |field|
|
# %w{module_label category base_url version organization author intro update_info create_date}.each do |field|
|
||||||
# self[field.to_sym] = reg.send field
|
# self[field.to_sym] = reg.send field
|
||||||
@@ -17,6 +19,7 @@ class ModuleApp
|
|||||||
self[:get_widget_style] = reg.get_widgets
|
self[:get_widget_style] = reg.get_widgets
|
||||||
self[:using_default_widget] = !reg.get_default_widget.blank?
|
self[:using_default_widget] = !reg.get_default_widget.blank?
|
||||||
self[:widgets] = reg.get_widgets
|
self[:widgets] = reg.get_widgets
|
||||||
|
self[:has_tag] = reg.get_has_tags
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -118,10 +121,6 @@ class ModuleApp
|
|||||||
|
|
||||||
has_one :app_auth,dependent: :delete
|
has_one :app_auth,dependent: :delete
|
||||||
|
|
||||||
def get_tags
|
|
||||||
get_registration.get_tags
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_categories
|
def get_categories
|
||||||
get_registration.get_categories
|
get_registration.get_categories
|
||||||
end
|
end
|
||||||
@@ -133,5 +132,31 @@ class ModuleApp
|
|||||||
def get_registration
|
def get_registration
|
||||||
OrbitApp::Module::Registration.find_by_key(key)
|
OrbitApp::Module::Registration.find_by_key(key)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.find_by_key(key)
|
||||||
|
self.where(key: key)[0] rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def sorted_tags_for_cloud
|
||||||
|
temp_tags = {}
|
||||||
|
self.tags.each{ |tag|
|
||||||
|
temp_tags.merge!({tag => Tag.get_impressionist(tag)})
|
||||||
|
}
|
||||||
|
if !temp_tags.blank?
|
||||||
|
sorted_tags = temp_tags.sort{|a,b| a[1]<=>b[1]}.reverse
|
||||||
|
sorted_tags[0][1] = :hot1
|
||||||
|
offset = (sorted_tags.size - 1) / 3
|
||||||
|
i = 1
|
||||||
|
class_i = 2
|
||||||
|
sorted_tags[1..-1].collect!{ |x|
|
||||||
|
x[1] = "hot#{class_i}"
|
||||||
|
i == offset ? i = 1 : i += 1 if class_i < 4
|
||||||
|
class_i += 1 if i == offset && class_i < 4
|
||||||
|
}
|
||||||
|
sorted_tags
|
||||||
|
else
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
module Mongoid
|
||||||
|
module Sortable
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
included do
|
||||||
|
field :sort_number, type: Integer
|
||||||
|
|
||||||
|
after_initialize :set_sort_number
|
||||||
|
end
|
||||||
|
|
||||||
|
module ClassMethods
|
||||||
|
def default_sort(sorted = true)
|
||||||
|
if !sorted
|
||||||
|
asc(:sort_number)
|
||||||
|
else
|
||||||
|
asc
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_sort_number
|
||||||
|
if self.new? && self.sort_number.nil?
|
||||||
|
last_record = self.class.desc(:sort_number).first
|
||||||
|
if last_record.sort_number
|
||||||
|
self.sort_number = (last_record.sort_number + 10) / 10 * 10
|
||||||
|
else
|
||||||
|
self.sort_number = 10
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
class SubRoleTag < ProtoTag
|
class SubRoleTag < ProtoTag
|
||||||
has_and_belongs_to_many :sub_roles
|
has_and_belongs_to_many :sub_roles
|
||||||
|
|
||||||
end
|
end
|
||||||
+25
-22
@@ -10,33 +10,36 @@ class Tag
|
|||||||
|
|
||||||
is_impressionable :counter_cache => { :column_name => :view_count }
|
is_impressionable :counter_cache => { :column_name => :view_count }
|
||||||
|
|
||||||
field :key
|
field :name, localize: true
|
||||||
field :view_count, :type => Integer, :default => 0
|
field :view_count, :type => Integer, :default => 0
|
||||||
field :cloud_view_count, :type => Integer, :default => 0
|
field :cloud_view_count, :type => Integer, :default => 0
|
||||||
|
|
||||||
|
belongs_to :module_tag, polymorphic: true
|
||||||
|
has_many :taggings, dependent: :destroy
|
||||||
|
|
||||||
#field :cloud_amper,:type: Integer,:default=> 0
|
#field :cloud_amper,:type: Integer,:default=> 0
|
||||||
|
|
||||||
def self.sorted_for_cloud
|
# def self.sorted_for_cloud
|
||||||
tags = {}
|
# tags = {}
|
||||||
self.all.each{ |tag|
|
# self.all.each{ |tag|
|
||||||
tags.merge!({tag => self.get_impressionist(tag)})
|
# tags.merge!({tag => self.get_impressionist(tag)})
|
||||||
}
|
# }
|
||||||
if !tags.blank?
|
# if !tags.blank?
|
||||||
sorted_tags = tags.sort{|a,b| a[1]<=>b[1]}.reverse
|
# sorted_tags = tags.sort{|a,b| a[1]<=>b[1]}.reverse
|
||||||
sorted_tags[0][1] = :hot1
|
# sorted_tags[0][1] = :hot1
|
||||||
offset = (sorted_tags.size - 1) / 3
|
# offset = (sorted_tags.size - 1) / 3
|
||||||
i = 1
|
# i = 1
|
||||||
class_i = 2
|
# class_i = 2
|
||||||
sorted_tags[1..-1].collect!{ |x|
|
# sorted_tags[1..-1].collect!{ |x|
|
||||||
x[1] = "hot#{class_i}"
|
# x[1] = "hot#{class_i}"
|
||||||
i == offset ? i = 1 : i += 1 if class_i < 4
|
# i == offset ? i = 1 : i += 1 if class_i < 4
|
||||||
class_i += 1 if i == offset && class_i < 4
|
# class_i += 1 if i == offset && class_i < 4
|
||||||
}
|
# }
|
||||||
sorted_tags
|
# sorted_tags
|
||||||
else
|
# else
|
||||||
[]
|
# []
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
class Tagging
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :to_destroy, default: false
|
||||||
|
|
||||||
|
belongs_to :tag
|
||||||
|
belongs_to :taggable, polymorphic: true
|
||||||
|
|
||||||
|
before_destroy :update_taggable_tag_ids
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def update_taggable_tag_ids
|
||||||
|
self.taggable.remove_id(self.tag.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
+10
-1
@@ -31,6 +31,8 @@ class User
|
|||||||
# has_many :papers, :autosave => true, :dependent => :destroy
|
# has_many :papers, :autosave => true, :dependent => :destroy
|
||||||
has_and_belongs_to_many :sub_role_tags
|
has_and_belongs_to_many :sub_role_tags
|
||||||
|
|
||||||
|
has_many :user_actions, :dependent => :destroy
|
||||||
|
|
||||||
# has_and_belongs_to_many :statuses
|
# has_and_belongs_to_many :statuses
|
||||||
has_and_belongs_to_many :roles
|
has_and_belongs_to_many :roles
|
||||||
has_and_belongs_to_many :sub_roles
|
has_and_belongs_to_many :sub_roles
|
||||||
@@ -181,7 +183,14 @@ class User
|
|||||||
def self.get_member_list_attribute_value(user_id,role_type,field_key)
|
def self.get_member_list_attribute_value(user_id,role_type,field_key)
|
||||||
@attribute = ::Attribute.where(:key => role_type).first
|
@attribute = ::Attribute.where(:key => role_type).first
|
||||||
@AttributeField = ::AttributeField.where(:key => field_key, :attribute_id => @attribute.id).first
|
@AttributeField = ::AttributeField.where(:key => field_key, :attribute_id => @attribute.id).first
|
||||||
return ::AttributeValue.where(attribute_field_id: @AttributeField.id, :user_id => user_id).first[I18n.locale.to_s]
|
return ::AttributeValue.where(attribute_field_id: @AttributeField.id, :user_id => user_id).first
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.get_role_member_data_by_sort(role_status_id)
|
||||||
|
a = Array.new
|
||||||
|
where(:role_status_ids=>role_status_id).desc(:_id).collect{|t| a << [ get_member_list_attribute_value(t.id,"staff","job_title")['val'].to_i, t ] }
|
||||||
|
member_data = a.sort
|
||||||
|
member_data_tmp = member_data.collect {|v| v[1] }
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_dept_cache
|
def create_dept_cache
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
class UserAction
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
belongs_to :user
|
||||||
|
field :params,:type => Hash
|
||||||
|
|
||||||
|
field :page
|
||||||
|
|
||||||
|
end
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
<div class="label-group">
|
<div class="label-group">
|
||||||
<div class="label-td">
|
<div class="label-td">
|
||||||
<% asset.sorted_tags.each do |tag| %>
|
<% asset.sorted_tags.each do |tag| %>
|
||||||
<span class="label label-tags"><%= tag[I18n.locale] %></span>
|
<span class="label label-tags"><%= tag.name %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
<% @tags.each do |tag| %>
|
<% @tags.each do |tag| %>
|
||||||
<%= content_tag :label, :class => "checkbox inline" do -%>
|
<%= content_tag :label, :class => "checkbox inline" do -%>
|
||||||
<%= check_box_tag 'asset[tag_ids][]', tag.id, @asset.tag_ids.include?(tag.id) %>
|
<%= check_box_tag 'asset[tag_ids][]', tag.id, @asset.tag_ids.include?(tag.id) %>
|
||||||
<%= tag[I18n.locale] %>
|
<%= tag.name %>
|
||||||
<%= hidden_field_tag 'asset[tag_ids][]', '' %>
|
<%= hidden_field_tag 'asset[tag_ids][]', '' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= form_for @attribute,:url => eval("admin_#{@attribute_type}_path(@attribute)") ,:class=> "form-horizontal" do |f| %>
|
<%= form_for @attribute,:url => eval("admin_#{@attribute_type}_path(@attribute)") ,:class=> "form-horizontal" do |f| %>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="item element">
|
<!-- <div class="item element">
|
||||||
<h3><i class="icons-"></i><a href=""><%= t(:member) %></a></h3>
|
<h3><i class="icons-"></i><a href=""><%= t(:member_) %></a></h3>
|
||||||
<div class="detail w-a h-a">
|
<div class="detail w-a h-a">
|
||||||
<p class="totle"><span><%= t(:all_member) %></span>2,217</p>
|
<p class="totle"><span><%= t(:all_member) %></span>2,217</p>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
|
|||||||
@@ -9,4 +9,5 @@
|
|||||||
|
|
||||||
<div class="form-actions form-fixed pagination-right">
|
<div class="form-actions form-fixed pagination-right">
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:add), new_admin_design_path, :class => 'btn btn-primary pull-right' %>
|
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:add), new_admin_design_path, :class => 'btn btn-primary pull-right' %>
|
||||||
|
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:upload), upload_package_admin_designs_path, :class => 'btn btn-primary pull-right' %>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render 'admin/sites/side_bar' %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :side_bar_content => 'admin/sites/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
<div class="main2">
|
<div class="main2">
|
||||||
<%= form_tag '',:multipart => true,:action=>"post" do |f| %>
|
<%= form_tag '',:multipart => true,:action=>"post" do |f| %>
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<%= nil_checkbox_button(object,:tag) %>
|
<%= nil_checkbox_button(object,:tag) %>
|
||||||
<%= content_tag_for(:label, @tags,:class=>"radio inline") do |tag|%>
|
<%= content_tag_for(:label, @tags,:class=>"radio inline") do |tag|%>
|
||||||
<%= check_box_tag("#{field_name}[tag][]", tag.id, tag_checked_value(object,tag.id),:class=>'select_option' ) %>
|
<%= check_box_tag("#{field_name}[tag][]", tag.id, tag_checked_value(object,tag.id),:class=>'select_option' ) %>
|
||||||
<%= tag[I18n.locale]%>
|
<%= tag.name%>
|
||||||
<% end if @tags%>
|
<% end if @tags%>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class="subnav">
|
<div class="subnav">
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= form_for @attribute,:url => eval("admin_#{@attribute_type}_path(@attribute)") ,:class=> "form-horizontal" do |f| %>
|
<%= form_for @attribute,:url => eval("admin_#{@attribute_type}_path(@attribute)") ,:class=> "form-horizontal" do |f| %>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<% # encoding: utf-8 %>
|
<% # encoding: utf-8 %>
|
||||||
|
|
||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= form_for @attribute,:url => eval("admin_#{@attribute_type}_path(@attribute)") ,:class=> "form-horizontal" do |f| %>
|
<%= form_for @attribute,:url => eval("admin_#{@attribute_type}_path(@attribute)") ,:class=> "form-horizontal" do |f| %>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div class="tab-pane active in" id="summary">
|
<div class="tab-pane active in" id="summary">
|
||||||
<h2><%= I18n.t("site.system_preference_.summary.disk_space") %>:</h2>
|
<h2><%= I18n.t("site.system_preference_.summary.disk_space") %>:</h2>
|
||||||
<%= content_tag :p,@site.disk_space %>
|
<%= content_tag :p,@site.disk_space.gsub(/\n/,"<br />").html_safe if @site.disk_space %>
|
||||||
<h2><%= I18n.t("site.system_preference_.summary.code_update_at") %>: </h2>
|
<h2><%= I18n.t("site.system_preference_.summary.code_update_at") %>: </h2>
|
||||||
<% @site.system_package_info.each do |index,value| %>
|
<% @site.system_package_info.each do |index,value| %>
|
||||||
<h2><%= index.titleize %> <%= I18n.t("site.system_preference_.summary.version") %>:</h2>
|
<h2><%= index.titleize %> <%= I18n.t("site.system_preference_.summary.version") %>:</h2>
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<div class="tab-pane" id="commits">
|
<div class="tab-pane" id="commits">
|
||||||
<% if @git_commit_list_file %>
|
<% if @git_commit_list_file %>
|
||||||
<% @git_commit_list_file.lines do |line|%>
|
<% @git_commit_list_file.lines do |line|%>
|
||||||
<%= (line + "<br/>").html_safe %>
|
<%= line %><br/>
|
||||||
<% end%>
|
<% end%>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="well"><%= I18n.t("site.system_preference_.summary.no_data") %></div>
|
<div class="well"><%= I18n.t("site.system_preference_.summary.no_data") %></div>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
<div class="tab-pane" id="backups">
|
<div class="tab-pane" id="backups">
|
||||||
<%if @db_backup_list_file %>
|
<%if @db_backup_list_file %>
|
||||||
<% @db_backup_list_file.lines do |line|%>
|
<% @db_backup_list_file.lines do |line|%>
|
||||||
<%=(line + "<br/>").html_safe %>
|
<%=line %><br/>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="well"><%= I18n.t("site.system_preference_.summary.no_data") %></div>
|
<div class="well"><%= I18n.t("site.system_preference_.summary.no_data") %></div>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
<div class="tab-pane" id="resque_logs">
|
<div class="tab-pane" id="resque_logs">
|
||||||
<%if @db_backup_list_file %>
|
<%if @db_backup_list_file %>
|
||||||
<% @resque_logs_file.lines do |line|%>
|
<% @resque_logs_file.lines do |line|%>
|
||||||
<%=(line + "<br/>").html_safe %>
|
<%=line %><br/>
|
||||||
<% end if @resque_logs_file%>
|
<% end if @resque_logs_file%>
|
||||||
<%else %>
|
<%else %>
|
||||||
<div class="well"><%= I18n.t("site.system_preference_.summary.no_data") %></div>
|
<div class="well"><%= I18n.t("site.system_preference_.summary.no_data") %></div>
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
<%= form_for :tag, :url => admin_tags_path, :remote => true, :html => {:id => 'tag_form'} do |f| %>
|
<%= form_for :tag, :url => admin_tags_path, :remote => true, :html => {:id => 'tag_form'} do |f| %>
|
||||||
<% @site_valid_locales.each do |locale| %>
|
<%= f.fields_for :name_translations do |f| %>
|
||||||
<%= I18nVariable.from_locale(locale) %>:<%= f.text_field locale %>
|
<% @site_valid_locales.each do |locale| %>
|
||||||
<% end %>
|
<%= I18nVariable.from_locale(locale) %>:<%= f.text_field locale %>
|
||||||
<%= f.hidden_field :module_app_id, :value => @module_app_id %>
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<%= hidden_field_tag :module_app_id, @module_app_id %>
|
||||||
<%= f.submit t(:add) %>
|
<%= f.submit t(:add) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
<%= form_for :tag, :url => admin_tag_path(tag), :method => :put, :remote => true do |f| %>
|
<%= form_for :tag, :url => admin_tag_path(tag), :method => :put, :remote => true do |f| %>
|
||||||
<% @site_valid_locales.each do |locale| %>
|
<%= f.fields_for :name_translations do |f| %>
|
||||||
<%= I18nVariable.from_locale(locale) %>:<%= f.text_field locale %>
|
<% @site_valid_locales.each do |locale| %>
|
||||||
<% end %>
|
<%= I18nVariable.from_locale(locale) %>:<%= f.text_field locale, value: @tag.name_translations[locale] %>
|
||||||
<%= f.hidden_field :module_app_id, :value => tag.module_app_id %>
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<%= hidden_field_tag :module_app_id, @module_app_id %>
|
||||||
<%= f.submit t(:update_) %>
|
<%= f.submit t(:update_) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -3,11 +3,11 @@
|
|||||||
<i class="icons-tag"></i>
|
<i class="icons-tag"></i>
|
||||||
<% @site_valid_locales.each do |locale| %>
|
<% @site_valid_locales.each do |locale| %>
|
||||||
<%#= I18nVariable.from_locale(locale) %>
|
<%#= I18nVariable.from_locale(locale) %>
|
||||||
<%= tag[locale] %>
|
<%= tag.name_translations[locale] %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="action">
|
<div class="action">
|
||||||
<%= link_to t(:edit), edit_admin_tag_path(tag), :remote => true %>
|
<%= link_to t(:edit), edit_admin_tag_path(tag, :module_app_id => @module_app_id), :remote => true %>
|
||||||
<%= link_to t(:delete_), admin_tag_path(tag), :confirm => t('sure?'), :method => :delete, :remote => true %>
|
<%= link_to t(:delete_), admin_tag_path(tag), :confirm => t('sure?'), :method => :delete, :remote => true %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<table class="table">
|
||||||
|
<tr>
|
||||||
|
<th><%= I18n.t 'user_action.time' %></th>
|
||||||
|
<th><%= I18n.t 'user_action.name' %></th>
|
||||||
|
<th><%= I18n.t 'user_action.page' %></th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% @user_actions.each do |user_action| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= user_action.created_at %></td>
|
||||||
|
<td><%= user_action.user.name %></td>
|
||||||
|
<td><%= user_action.page %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
<%= content_tag :li, :class => active_for_controllers('users_new_interface') do -%>
|
<%= content_tag :li, :class => active_for_controllers('users_new_interface') do -%>
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icons-user')+ content_tag(:span, t(:member)), admin_users_new_interface_index_path %>
|
<%= link_to content_tag(:i, nil, :class => 'icons-user')+ content_tag(:span, t(:member_)), admin_users_new_interface_index_path %>
|
||||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('users_new_interface')) do -%>
|
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('users_new_interface')) do -%>
|
||||||
<%= content_tag :li, link_to((t(:all_member) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, admin_users_new_interface_index_path), :class => active_for_action('users_new_interface', 'index') %>
|
<%= content_tag :li, link_to((t(:all_member) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, admin_users_new_interface_index_path), :class => active_for_action('users_new_interface', 'index') %>
|
||||||
<%= content_tag :li, link_to((t(:add_member) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_admin_users_new_interface_path), :class => active_for_action('users_new_interface', 'new') if (is_admin? rescue nil) %>
|
<%= content_tag :li, link_to((t(:add_member) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_admin_users_new_interface_path), :class => active_for_action('users_new_interface', 'new') if (is_admin? rescue nil) %>
|
||||||
<%= content_tag :li, link_to((t(:member_authorization) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, '#'), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %>
|
<%= content_tag :li, link_to((t(:member_authorization) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, '#'), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %>
|
||||||
<%= content_tag :li, link_to((t(:member_registration) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, '#'), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %>
|
<%= content_tag :li, link_to((t(:member_registration) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, '#'), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %>
|
||||||
<%= content_tag :li, link_to((t(:member_role) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe,admin_roles_path ), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %>
|
<%= content_tag :li, link_to((t(:member_role) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe,admin_roles_path ), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %>
|
||||||
<%= content_tag :li, link_to((t(:member_info) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, edit_admin_info_path(Info.first.id.to_s)), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %>
|
<%= content_tag :li, link_to((t(:member_info) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, edit_admin_info_path(Info.first.id.to_s)), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) and Info.first %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :page_specific_css do -%>
|
<% content_for :page_specific_css do -%>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :page_specific_css do -%>
|
<% content_for :page_specific_css do -%>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render :partial => "js_and_css"%>
|
<%= render :partial => "js_and_css"%>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render :partial => "js_and_css"%>
|
<%= render :partial => "js_and_css"%>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render :partial => "js_and_css"%>
|
<%= render :partial => "js_and_css"%>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :page_specific_css do -%>
|
<% content_for :page_specific_css do -%>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class="member-plugin">
|
<div class="member-plugin">
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render :partial => "js_and_css"%>
|
<%= render :partial => "js_and_css"%>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :page_specific_css do -%>
|
<% content_for :page_specific_css do -%>
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
|
<%= render :partial => 'shared/search_header',:locals=>{:items=>@data} %>
|
||||||
|
|
||||||
<%= render @partial %>
|
<%= render @partial %>
|
||||||
<% if @paginate %>
|
<% if @paginate and !@data.blank? %>
|
||||||
<%= 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) %>
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
<p class="alert hide">You need to sign in or sign up before continuing.</p>
|
<p class="alert hide">You need to sign in or sign up before continuing.</p>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<div class="control-group clear">
|
<div class="control-group clear">
|
||||||
<%= f.label :user_id ,t(:user_id)%>
|
<%= f.label :user_id ,t("users.user_id")%>
|
||||||
<%= f.text_field :user_id, :placeholder => t(:email), :style => "width: 330px;" %>
|
<%= f.text_field :user_id, :placeholder => t("users.user_id"), :style => "width: 330px;" %>
|
||||||
<span class="help-inline">Please correct the error</span>
|
<span class="help-inline">Please correct the error</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group clear">
|
<div class="control-group clear">
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<% unless @tags.blank? %>
|
||||||
|
<div class="tag_cloud">
|
||||||
|
<h3 class="h3"><%= t(:tag_cloud) %></h3>
|
||||||
|
<div class="cloud">
|
||||||
|
<% @tags.each do |tag| %>
|
||||||
|
<%= link_to tag[0].name, current_path({:tag_id => tag[0].id, :category_id => params[:category_id]}), :class => "#{tag[1]} #{tag[0].id.to_s.eql?(params[:tag_id]) ? 'active' : nil} " %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
@@ -4,6 +4,6 @@
|
|||||||
<li><%= link_to t(:template), admin_designs_path, :class => 'orblink' %></li>
|
<li><%= link_to t(:template), admin_designs_path, :class => 'orblink' %></li>
|
||||||
<li><%= link_to t(:purchase), admin_purchases_path, :class => 'orblink' %></li>
|
<li><%= link_to t(:purchase), admin_purchases_path, :class => 'orblink' %></li>
|
||||||
<li><%= link_to t(:asset), admin_assets_path, :class => 'orblink' %></li>
|
<li><%= link_to t(:asset), admin_assets_path, :class => 'orblink' %></li>
|
||||||
<li><%= link_to t(:member), admin_users_path, :class => 'orblink' %></li>
|
<li><%= link_to t(:member_), admin_users_path, :class => 'orblink' %></li>
|
||||||
<li><%= link_to t(:site_), admin_sites_path, :class => 'orblink' %></li>
|
<li><%= link_to t(:site_), admin_sites_path, :class => 'orblink' %></li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<% if Me.backend_openness_on %>
|
<% if Me.backend_openness_on %>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><%= link_to content_tag(:i, nil, :class => 'icons-gauge') + t(:dashboard_), admin_dashboards_path %></li>
|
<li><%= link_to content_tag(:i, nil, :class => 'icons-gauge') + t(:dashboard_), admin_dashboards_path %></li>
|
||||||
<li><%= link_to content_tag(:i, nil, :class => 'icons-users') + t(:member), admin_users_new_interface_index_path %></li>
|
<li><%= link_to content_tag(:i, nil, :class => 'icons-users') + t(:member_), admin_users_new_interface_index_path %></li>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
<a class="brand dropdown-toggle" data-toggle="dropdown" href="#">Orbit</a>
|
<a class="brand dropdown-toggle" data-toggle="dropdown" href="#">Orbit</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><%= link_to content_tag(:i, nil, :class => 'icons-gauge') + t(:dashboard_), admin_dashboards_path %></li>
|
<li><%= link_to content_tag(:i, nil, :class => 'icons-gauge') + t(:dashboard_), admin_dashboards_path %></li>
|
||||||
<li><%= link_to content_tag(:i, nil, :class => 'icons-users') + t(:member), admin_users_new_interface_index_path %></li>
|
<li><%= link_to content_tag(:i, nil, :class => 'icons-users') + t(:member_), admin_users_new_interface_index_path %></li>
|
||||||
|
|
||||||
<li><%#= link_to content_tag(:i, nil, :class => 'icons-content') + t(:content) %></li>
|
<li><%#= link_to content_tag(:i, nil, :class => 'icons-content') + t(:content) %></li>
|
||||||
<li><%#= link_to content_tag(:i, nil, :class => 'icons-member') + t(:member), admin_users_path %></li>
|
<li><%#= link_to content_tag(:i, nil, :class => 'icons-member') + t(:member_), admin_users_path %></li>
|
||||||
<li><%#= link_to content_tag(:i, nil, :class => 'icons-asset') + t(:asset), admin_assets_path %></li>
|
<li><%#= link_to content_tag(:i, nil, :class => 'icons-asset') + t(:asset), admin_assets_path %></li>
|
||||||
<%if (is_admin? rescue false)%>
|
<%if (is_admin? rescue false)%>
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<div class="input-prepend">
|
<div class="input-prepend">
|
||||||
<span class="add-on"><i class="icon-user"></i></span>
|
<span class="add-on"><i class="icon-user"></i></span>
|
||||||
<%= f.text_field :user_id, :class => 'span2', :placeholder => t(:email), :size => 16 %>
|
<%= f.text_field :user_id, :class => 'span2', :placeholder => t("users.user_id"), :size => 16 %>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
@@ -2,24 +2,16 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<title>R4</title>
|
<title><%= @title || APP_CONFIG['orbit'] %></title>
|
||||||
<link rel="shortcut icon" href="/favicon.ico">
|
<link rel="shortcut icon" href="<%= asset_path "ncculogo.ico" %>">
|
||||||
<%= yield :page_specific_link %>
|
<%= yield :page_specific_link %>
|
||||||
<%= stylesheet_link_tag "application" %>
|
<%= stylesheet_link_tag "new_admin" %>
|
||||||
<%= javascript_include_tag "application" %>
|
<%= javascript_include_tag "new_admin" %>
|
||||||
<%= csrf_meta_tag %>
|
<%= csrf_meta_tag %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="folded">
|
||||||
|
<%= render 'layouts/orbit_bar' %>
|
||||||
<div id="container">
|
<div id="container">
|
||||||
<ul class="hmenu">
|
|
||||||
<%= render 'devise/menu/registration_items' %>
|
|
||||||
<%= render 'devise/menu/login_items' %>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div id="header">
|
|
||||||
<h1>RulingSite</h1>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<p class="notice"><%= notice %></p>
|
<p class="notice"><%= notice %></p>
|
||||||
<p class="alert"><%= alert %></p>
|
<p class="alert"><%= alert %></p>
|
||||||
@@ -27,10 +19,6 @@
|
|||||||
<div class="secondary"><%= yield :secondary %></div>
|
<div class="secondary"><%= yield :secondary %></div>
|
||||||
<div class="tertiary"><%= yield :tertiary %></div>
|
<div class="tertiary"><%= yield :tertiary %></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="footer">
|
|
||||||
<p>Rulingcom</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<%= yield :page_specific_javascript %>
|
<%= yield :page_specific_javascript %>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html class="<%= I18n.locale.to_s %>">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<%= page_title(@item).html_safe %>
|
||||||
|
<link rel="shortcut icon" href="<%= asset_path "ncculogo.ico" %>">
|
||||||
|
<%= page_metas(@item).html_safe %>
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<%= javascript_include_tag "html5" %>
|
||||||
|
<![endif]-->
|
||||||
|
<%= page_stylesheets(@item).html_safe %>
|
||||||
|
<link href='/assets/standalone.css' rel='stylesheet' type='text/css' />
|
||||||
|
<%= yield :page_stylesheets %>
|
||||||
|
<%= page_javascripts(@item).html_safe %>
|
||||||
|
<%= csrf_meta_tag %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="wrapper">
|
||||||
|
<%= yield %>
|
||||||
|
</div>
|
||||||
|
<% if flash[:error] %>
|
||||||
|
<div class="modal alert alert-error hide" id="myModal">
|
||||||
|
<p type="button" class="close" data-dismiss="modal">×</p>
|
||||||
|
<%= "<strong>#{flash[:error]}</strong><br/>".html_safe%>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$('#myModal').modal('show')
|
||||||
|
</script>
|
||||||
|
<% end -%>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<% if items.blank? and !params[:search_query].blank? %>
|
||||||
|
<%=render :partial => 'shared/search_not_found' %>
|
||||||
|
<% elsif !params[:search_query].blank? %>
|
||||||
|
<%= t("search.result_get",:search_word => params[:search_query],:item_num=>items.count) unless (items.count == 30) %>
|
||||||
|
<%= t("search.too_many",:search_word => params[:search_query],:exceed_num=>items.count) if (items.count ==30) %>
|
||||||
|
<% end %>
|
||||||
@@ -6,4 +6,4 @@ YAML::ENGINE.yamler = 'syck'
|
|||||||
# Initialize the rails application
|
# Initialize the rails application
|
||||||
Orbit::Application.initialize!
|
Orbit::Application.initialize!
|
||||||
Me = Site.first
|
Me = Site.first
|
||||||
OrbitJobLogger = OrbitJobLog.new
|
OrbitLogger = Logger::Syslog.new
|
||||||
@@ -19,6 +19,7 @@ Orbit::Application.configure do
|
|||||||
|
|
||||||
# Generate digests for assets URLs
|
# Generate digests for assets URLs
|
||||||
config.assets.digest = true
|
config.assets.digest = true
|
||||||
|
config.logger = Logger::Syslog.new
|
||||||
|
|
||||||
# Defaults to Rails.root.join("public/assets")
|
# Defaults to Rails.root.join("public/assets")
|
||||||
# config.assets.manifest = YOUR_PATH
|
# config.assets.manifest = YOUR_PATH
|
||||||
@@ -58,4 +59,17 @@ Orbit::Application.configure do
|
|||||||
|
|
||||||
# Send deprecation notices to registered listeners
|
# Send deprecation notices to registered listeners
|
||||||
config.active_support.deprecation = :notify
|
config.active_support.deprecation = :notify
|
||||||
|
|
||||||
|
|
||||||
|
config.action_mailer.delivery_method = :smtp
|
||||||
|
config.action_mailer.smtp_settings = {
|
||||||
|
:enable_starttls_auto => true,
|
||||||
|
:address => "smtp.gmail.com",
|
||||||
|
:port => '587',
|
||||||
|
:domain => "smtp.gmail.com",
|
||||||
|
:authentication => "plain",
|
||||||
|
:user_name => "redmine@rulingcom.com",
|
||||||
|
:password => "rulingredmine"
|
||||||
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -7,7 +7,7 @@ module OrbitSystemPreference
|
|||||||
DefaultDiskSpaceLimit = 3 #in GB
|
DefaultDiskSpaceLimit = 3 #in GB
|
||||||
module SystemPackage
|
module SystemPackage
|
||||||
MongodbVersion = "mongod --version"
|
MongodbVersion = "mongod --version"
|
||||||
NginxVersion = "nginx -V"
|
NginxVersion = "nginx -V 2>&1"
|
||||||
SystemVersion = "uname -a"
|
SystemVersion = "uname -a"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -43,6 +43,7 @@ public_r_tags:
|
|||||||
- sub_menu
|
- sub_menu
|
||||||
- sitemap
|
- sitemap
|
||||||
- breadcrumb
|
- breadcrumb
|
||||||
|
- tag_cloud
|
||||||
|
|
||||||
page_part_kinds:
|
page_part_kinds:
|
||||||
- text
|
- text
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ en:
|
|||||||
ldap_connection_failed: 'LDAP connection failed'
|
ldap_connection_failed: 'LDAP connection failed'
|
||||||
ldap_pass_but_account_not_in_orbit: 'LDAP account is not supported to sign up this site.'
|
ldap_pass_but_account_not_in_orbit: 'LDAP account is not supported to sign up this site.'
|
||||||
locked: 'Your account is locked.'
|
locked: 'Your account is locked.'
|
||||||
invalid: 'Invalid email or password.'
|
invalid: 'Invalid user account or password.'
|
||||||
invalid_token: 'Invalid authentication token.'
|
invalid_token: 'Invalid authentication token.'
|
||||||
timeout: 'Your session expired, please sign in again to continue.'
|
timeout: 'Your session expired, please sign in again to continue.'
|
||||||
inactive: 'Your account was not activated yet.'
|
inactive: 'Your account was not activated yet.'
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ zh_tw:
|
|||||||
failure:
|
failure:
|
||||||
already_authenticated: 你已經登入。
|
already_authenticated: 你已經登入。
|
||||||
inactive: 您的帳號尚未被啟用。
|
inactive: 您的帳號尚未被啟用。
|
||||||
invalid: Email 或密碼是無效的。
|
invalid: 帳號或密碼是無效的。
|
||||||
invalid_token: 無效的認證代碼。
|
invalid_token: 無效的認證代碼。
|
||||||
locked: 您的帳號已被鎖定。
|
locked: 您的帳號已被鎖定。
|
||||||
timeout: 您的登入時效過期,請重新登入,才能繼續。
|
timeout: 您的登入時效過期,請重新登入,才能繼續。
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ en:
|
|||||||
markup_options: Markup options
|
markup_options: Markup options
|
||||||
markup_value: Markup value
|
markup_value: Markup value
|
||||||
me: Me
|
me: Me
|
||||||
member: Member
|
member_: Member
|
||||||
member_authorization: Authorizations
|
member_authorization: Authorizations
|
||||||
member_info: Profile Form
|
member_info: Profile Form
|
||||||
member_registration: Registration Approval
|
member_registration: Registration Approval
|
||||||
@@ -428,7 +428,7 @@ en:
|
|||||||
module_page_lang_not_support: "We are sorry, this page is not available for English"
|
module_page_lang_not_support: "We are sorry, this page is not available for English"
|
||||||
not_previewable: "Preview not support"
|
not_previewable: "Preview not support"
|
||||||
preview_only_for_img: "Preview only supprt with file type: jpg, png, gif, bmp"
|
preview_only_for_img: "Preview only supprt with file type: jpg, png, gif, bmp"
|
||||||
sys_basic_form: System Default Basic Field
|
sys_basic_form: System Required Info.
|
||||||
sys_basic_id_form: System Account Info.
|
sys_basic_id_form: System Account Info.
|
||||||
system_info: System information
|
system_info: System information
|
||||||
tag_cloud: Tag cloud
|
tag_cloud: Tag cloud
|
||||||
@@ -461,9 +461,14 @@ en:
|
|||||||
success_: Successfully updated
|
success_: Successfully updated
|
||||||
update_: Update
|
update_: Update
|
||||||
update_at: Update at
|
update_at: Update at
|
||||||
|
upload: Upload
|
||||||
url: URL
|
url: URL
|
||||||
use_status: Use Statue
|
use_status: Use Statue
|
||||||
user: User
|
user: User
|
||||||
|
user_action:
|
||||||
|
time: Time
|
||||||
|
name: Account
|
||||||
|
page: Access Page and Action
|
||||||
users:
|
users:
|
||||||
admin_change_password: You cannot change your own password here!
|
admin_change_password: You cannot change your own password here!
|
||||||
avatar: Profile Picture
|
avatar: Profile Picture
|
||||||
|
|||||||
@@ -10,4 +10,4 @@ zh_tw:
|
|||||||
language: 語言
|
language: 語言
|
||||||
location: 地理位置
|
location: 地理位置
|
||||||
location_description: '<h3>本大學</h3>302新竹縣竹北市嘉豐南路二段101號'
|
location_description: '<h3>本大學</h3>302新竹縣竹北市嘉豐南路二段101號'
|
||||||
page: 頁面
|
page: 頁面
|
||||||
@@ -133,7 +133,7 @@ zh_tw:
|
|||||||
date:
|
date:
|
||||||
calendar: 紀年法
|
calendar: 紀年法
|
||||||
format: 格式
|
format: 格式
|
||||||
minguo_calendar:
|
minguo_calendar:
|
||||||
after: 民國
|
after: 民國
|
||||||
before: 民前
|
before: 民前
|
||||||
first_year: 民國元年
|
first_year: 民國元年
|
||||||
@@ -200,7 +200,7 @@ zh_tw:
|
|||||||
errors:
|
errors:
|
||||||
at_least_one: 至少擁有一個值
|
at_least_one: 至少擁有一個值
|
||||||
field: 欄位
|
field: 欄位
|
||||||
file:
|
file:
|
||||||
size: 檔案大小
|
size: 檔案大小
|
||||||
type: 檔案類型
|
type: 檔案類型
|
||||||
upload: F上傳檔案
|
upload: F上傳檔案
|
||||||
@@ -277,7 +277,8 @@ zh_tw:
|
|||||||
markup_options: 標註選項
|
markup_options: 標註選項
|
||||||
markup_value: 標註值
|
markup_value: 標註值
|
||||||
me: 我
|
me: 我
|
||||||
member: 成員
|
# member: 成員
|
||||||
|
member_: 成員
|
||||||
member_authorization: 成員權限
|
member_authorization: 成員權限
|
||||||
member_info: 基本資料表
|
member_info: 基本資料表
|
||||||
member_registration: 註冊審核
|
member_registration: 註冊審核
|
||||||
@@ -343,7 +344,7 @@ zh_tw:
|
|||||||
registered: 已註冊
|
registered: 已註冊
|
||||||
rejected: 拒絕
|
rejected: 拒絕
|
||||||
rejected_reason: 拒絕原因:'
|
rejected_reason: 拒絕原因:'
|
||||||
rejected_reason_empty: "拒絕核准, 沒有參考資訊"
|
rejected_reason_empty: "拒絕核准, 沒有參考資訊"
|
||||||
related_links: 相關連結
|
related_links: 相關連結
|
||||||
role: 身份
|
role: 身份
|
||||||
role_field: 身份欄位
|
role_field: 身份欄位
|
||||||
@@ -395,7 +396,7 @@ zh_tw:
|
|||||||
tab_backups: 備份記錄
|
tab_backups: 備份記錄
|
||||||
tab_commits: 程式版本
|
tab_commits: 程式版本
|
||||||
tab_summary: 總覽
|
tab_summary: 總覽
|
||||||
tab_logs: 登錄檔
|
tab_logs: 排程工作日誌
|
||||||
summary:
|
summary:
|
||||||
code_update_at: 程式更新紀錄
|
code_update_at: 程式更新紀錄
|
||||||
disk_space: 硬碟空間
|
disk_space: 硬碟空間
|
||||||
@@ -461,9 +462,14 @@ zh_tw:
|
|||||||
success_: 使用者已更新成功
|
success_: 使用者已更新成功
|
||||||
update_: 更新
|
update_: 更新
|
||||||
update_at: 最後更新時間
|
update_at: 最後更新時間
|
||||||
|
upload: 上傳
|
||||||
url: 網址
|
url: 網址
|
||||||
use_status: 使用狀態
|
use_status: 使用狀態
|
||||||
user: 使用者
|
user: 使用者
|
||||||
|
user_action:
|
||||||
|
time: 時間
|
||||||
|
name: 使用帳號
|
||||||
|
page: 頁面
|
||||||
users:
|
users:
|
||||||
admin_change_password: 您不能在此處修改自己的密碼!
|
admin_change_password: 您不能在此處修改自己的密碼!
|
||||||
avatar: 大頭貼照
|
avatar: 大頭貼照
|
||||||
@@ -478,7 +484,7 @@ zh_tw:
|
|||||||
female: 女性
|
female: 女性
|
||||||
unknown: 未知
|
unknown: 未知
|
||||||
last_name: 姓氏
|
last_name: 姓氏
|
||||||
office_tel: 辦公室電話
|
office_tel: 辦公室電話
|
||||||
office_tel_note: 將公開於網頁
|
office_tel_note: 將公開於網頁
|
||||||
sid: 編號
|
sid: 編號
|
||||||
sid_note: 教職員工編號或學生學號
|
sid_note: 教職員工編號或學生學號
|
||||||
@@ -497,3 +503,4 @@ zh_tw:
|
|||||||
visitors_this_year: 今年造訪人次
|
visitors_this_year: 今年造訪人次
|
||||||
visitors_today: 今日造訪人次
|
visitors_today: 今日造訪人次
|
||||||
yes_: "是"
|
yes_: "是"
|
||||||
|
sort_number: 排序數
|
||||||
+1
-1
@@ -8,7 +8,7 @@ defaults: &defaults
|
|||||||
|
|
||||||
development:
|
development:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
database: test_site
|
database: production_7
|
||||||
test:
|
test:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
database: test_site
|
database: test_site
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ num_workers.times do |num|
|
|||||||
end
|
end
|
||||||
|
|
||||||
w.env = {"QUEUE"=>queue, "RAILS_ENV"=>rails_env}
|
w.env = {"QUEUE"=>queue, "RAILS_ENV"=>rails_env}
|
||||||
w.start = "HOME=#{user_home} QUEUE=* RAILS_ENV=#{rails_env}" rake -f #{rails_root}/Rakefile resque:work
|
w.start = "HOME=#{user_home} QUEUE=* RAILS_ENV=#{rails_env} rake -f #{rails_root}/Rakefile resque:work"
|
||||||
|
|
||||||
w.uid = (rails_env == 'production' )? "root" : development_uid
|
w.uid = (rails_env == 'production' )? "root" : development_uid
|
||||||
w.gid = (rails_env == 'production' )? "root" : development_gid
|
w.gid = (rails_env == 'production' )? "root" : development_gid
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ development_gid = ''
|
|||||||
w.group = 'resque'
|
w.group = 'resque'
|
||||||
w.interval = 30.seconds
|
w.interval = 30.seconds
|
||||||
w.env = {"QUEUE"=>"critical,high,low", "RAILS_ENV"=>rails_env}
|
w.env = {"QUEUE"=>"critical,high,low", "RAILS_ENV"=>rails_env}
|
||||||
w.start = "HOME= #{user_home} QUEUE=* RAILS_ENV=#{rails_env}" rake -f #{rails_root}/Rakefile resque:scheduler
|
w.start = "HOME= #{user_home} QUEUE=* RAILS_ENV=#{rails_env} rake -f #{rails_root}/Rakefile resque:scheduler"
|
||||||
|
|
||||||
w.uid = (rails_env == 'production' )? "root" : development_uid
|
w.uid = (rails_env == 'production' )? "root" : development_uid
|
||||||
w.gid = (rails_env == 'production' )? "root" : development_gid
|
w.gid = (rails_env == 'production' )? "root" : development_gid
|
||||||
|
|||||||
+6
-3
@@ -1,6 +1,8 @@
|
|||||||
Orbit::Application.routes.draw do
|
Orbit::Application.routes.draw do
|
||||||
# get "robots.txt" => 'robots#index'
|
# get "robots.txt" => 'robots#index'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
devise_for :users do
|
devise_for :users do
|
||||||
match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put
|
match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put
|
||||||
end
|
end
|
||||||
@@ -18,6 +20,7 @@ Orbit::Application.routes.draw do
|
|||||||
|
|
||||||
# routes for admin
|
# routes for admin
|
||||||
namespace :admin do
|
namespace :admin do
|
||||||
|
match 'user_actions' => 'user_actions#index'
|
||||||
match 'system_preference' => "sites#show_system_preference",:as=>"system_preference"
|
match 'system_preference' => "sites#show_system_preference",:as=>"system_preference"
|
||||||
mount Resque::Server.new, :at => "/resque"
|
mount Resque::Server.new, :at => "/resque"
|
||||||
resources :assets do
|
resources :assets do
|
||||||
@@ -259,7 +262,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]
|
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 :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
|
||||||
@@ -285,11 +288,11 @@ Orbit::Application.routes.draw do
|
|||||||
|
|
||||||
|
|
||||||
match '/panel/:app_name/front_end/:app_action/:id(/:controller_action)' => 'pages#show_from_link', :constraints => lambda { |request|
|
match '/panel/:app_name/front_end/:app_action/:id(/:controller_action)' => 'pages#show_from_link', :constraints => lambda { |request|
|
||||||
!request.query_string.include?("inner=true")
|
!request.query_string.include?("inner=true") && !request.query_string.include?("standalone=true")
|
||||||
}
|
}
|
||||||
|
|
||||||
match '/panel/:app_name/front_end/:app_action' => 'pages#index_from_link', :constraints => lambda { |request|
|
match '/panel/:app_name/front_end/:app_action' => 'pages#index_from_link', :constraints => lambda { |request|
|
||||||
!request.query_string.include?("inner=true")
|
!request.query_string.include?("inner=true") && !request.query_string.include?("standalone=true")
|
||||||
}
|
}
|
||||||
|
|
||||||
match '/share/:model/:id' => 'application#render_share'
|
match '/share/:model/:id' => 'application#render_share'
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ require "orbit_app/helper/renderer"
|
|||||||
require "orbit_app/helper/side_bar_renderer"
|
require "orbit_app/helper/side_bar_renderer"
|
||||||
require "orbit_app/helper/context_link_renderer"
|
require "orbit_app/helper/context_link_renderer"
|
||||||
require "orbit_app/helper/default_widget_tag_helper"
|
require "orbit_app/helper/default_widget_tag_helper"
|
||||||
|
require "orbit_app/helper/front_end_array_params_helper"
|
||||||
require "orbit_app/module/side_bar"
|
require "orbit_app/module/side_bar"
|
||||||
require "orbit_app/module/widget"
|
require "orbit_app/module/widget"
|
||||||
require "orbit_app/module/front_end"
|
require "orbit_app/module/front_end"
|
||||||
|
|||||||
@@ -4,9 +4,20 @@ module DefaultWidgetTagHelper
|
|||||||
|
|
||||||
def link_to_more_tag(req,params)
|
def link_to_more_tag(req,params)
|
||||||
@request = req
|
@request = req
|
||||||
@params =params
|
params.delete :inner
|
||||||
|
@params = params
|
||||||
|
|
||||||
|
params_str ="?"
|
||||||
|
params.each do |index,param|
|
||||||
|
if param.is_a?(Array) and !param.blank?
|
||||||
|
params_str << param.collect{|t| "#{index}[]=#{t}"}.join("&")
|
||||||
|
params.delete index
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
params_str = params_str + (params_str.eql?("?") ? params.to_param : "&#{params.to_param}" )
|
||||||
content_tag :div,:class=> 'more' do
|
content_tag :div,:class=> 'more' do
|
||||||
link_to I18n.t(@more_link[:label_i18n]),eval(@more_link[:path_method])
|
link_to I18n.t(@more_link[:label_i18n]),[eval("#{@more_link[:path_method]}"),params_str].join()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
module FrontEndArrayParamsHelper
|
||||||
|
|
||||||
|
#Deal with multi tags and cates that could be sat at both from setting or passed by views like tag cloud.
|
||||||
|
#Take Tag as example: Those tags which be sat at setting will be pass as params 'tag_ext',and the rest will be pass as 'tag'
|
||||||
|
#But when the showing process goes to fronend or default widget itself the controller will need to know what data it should use exactly.
|
||||||
|
#That's why we need tags_and_cates
|
||||||
|
|
||||||
|
def tags_and_cates(params)
|
||||||
|
params["category_id"] = params["category_id"].collect{|t| t.gsub(/\"|\[|\]/,'').split(",").each(&:strip!)}.flatten if params["category_id"].is_a? Array
|
||||||
|
params["tag_id"] = params["tag_id"].collect{|t| t.gsub(/\"|\[|\]/,'').split(",").each(&:strip!)}.flatten if params["tag_id"].is_a? Array
|
||||||
|
|
||||||
|
params["category_id"] = [ params["base_category_id"],params["category_id"]].flatten.reject(&:nil?).reject(&:empty?)
|
||||||
|
params.delete :base_category_id
|
||||||
|
params["tag_id"] = [ params["base_tag_id"],params["tag_id"]].flatten.reject(&:nil?).reject(&:empty?)
|
||||||
|
params.delete :base_tag_id
|
||||||
|
|
||||||
|
return params
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -28,7 +28,7 @@ module OrbitApp
|
|||||||
end
|
end
|
||||||
|
|
||||||
class DataSheet
|
class DataSheet
|
||||||
attr_reader :name,:key,:base_path,:module_label,:data_count
|
attr_reader :name,:key,:base_path,:module_label,:data_count, :has_tag
|
||||||
|
|
||||||
def initialize(name, &block)
|
def initialize(name, &block)
|
||||||
@name = name
|
@name = name
|
||||||
@@ -37,6 +37,7 @@ module OrbitApp
|
|||||||
@front_end_app_pages = nil
|
@front_end_app_pages = nil
|
||||||
@module_label = 'rulingcom.errors.init.module_app_noname'
|
@module_label = 'rulingcom.errors.init.module_app_noname'
|
||||||
@data_count = 1..15 # as default
|
@data_count = 1..15 # as default
|
||||||
|
@has_tag = nil
|
||||||
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
||||||
setup_module_app
|
setup_module_app
|
||||||
end
|
end
|
||||||
@@ -144,6 +145,14 @@ module OrbitApp
|
|||||||
define_method(field){|var| instance_variable_set( "@" + field, var)}
|
define_method(field){|var| instance_variable_set( "@" + field, var)}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def taggable
|
||||||
|
@has_tag = true
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_has_tags
|
||||||
|
@has_tag.nil? ? false : true
|
||||||
|
end
|
||||||
|
|
||||||
end # of class DataSheet
|
end # of class DataSheet
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
class OrbitJobLog < Logger
|
|
||||||
FORMAT = "%m/%d/%Y %H:%M%p: "
|
|
||||||
def initialize
|
|
||||||
case Rails.env
|
|
||||||
when 'production'
|
|
||||||
# Logger::Syslog.new("orbit_routine", Syslog::LOG_LOCAL5)
|
|
||||||
super(Orbit::Application.config.root.to_s+'/log/orbit_job.log','daily')
|
|
||||||
when 'development'
|
|
||||||
super(Orbit::Application.config.root.to_s+'/log/orbit_job.dev.log','daily')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def debug(msg)
|
|
||||||
super(Time.now.strftime()+msg)
|
|
||||||
end
|
|
||||||
|
|
||||||
def info(msg)
|
|
||||||
super(Time.now.strftime(FORMAT)+msg)
|
|
||||||
end
|
|
||||||
|
|
||||||
def warn(msg)
|
|
||||||
super(Time.now.strftime(FORMAT)+msg)
|
|
||||||
end
|
|
||||||
|
|
||||||
def error(msg)
|
|
||||||
super(Time.now.strftime(FORMAT)+msg)
|
|
||||||
end
|
|
||||||
|
|
||||||
def fatal(msg)
|
|
||||||
super(Time.now.strftime(FORMAT)+msg)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# require "action_view"
|
||||||
|
|
||||||
|
require "orbit_tag/taggable"
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
module OrbitTag
|
||||||
|
module Taggable
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
module ClassMethods
|
||||||
|
|
||||||
|
def taggable
|
||||||
|
init_tag
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def init_tag
|
||||||
|
class_eval do
|
||||||
|
field :tags_to_destroy, type: Array, default: []
|
||||||
|
field :tagged_ids, type: Array, default: []
|
||||||
|
|
||||||
|
has_many :taggings, as: :taggable, autosave: true, dependent: :destroy
|
||||||
|
accepts_nested_attributes_for :taggings, allow_destroy: true
|
||||||
|
after_save :remove_taggings, unless: Proc.new{self.tags_to_destroy.blank?}
|
||||||
|
|
||||||
|
def remove_id(id)
|
||||||
|
self.class.without_callback(:save, :after, :remove_taggings) do
|
||||||
|
self.update_attribute(:tagged_ids, self.tagged_ids - [id.to_s])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def sorted_tags
|
||||||
|
if tags.blank?
|
||||||
|
[]
|
||||||
|
else
|
||||||
|
tag_array = tags.inject([]){ |result, value|
|
||||||
|
result << [value.name, value]
|
||||||
|
}
|
||||||
|
tag_array.sort.map{|x| x[1] }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def tags
|
||||||
|
self.taggings.blank? ? [] : self.taggings.map{|t| t.tag}.compact
|
||||||
|
end
|
||||||
|
|
||||||
|
def tags=(tag_ids)
|
||||||
|
ids = [tag_ids].flatten
|
||||||
|
tag_ids.delete('')
|
||||||
|
ids = self.taggings.blank? ? [] : self.taggings.map{|t| t.tag.id}
|
||||||
|
tag_ids.each do |tag_id|
|
||||||
|
unless ids.include? tag_id
|
||||||
|
self.taggings.build(tag_id: tag_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.tags_to_destroy = self.taggings.where(:tag_id.in => (ids - tag_ids)).map{|t| t.id}
|
||||||
|
end
|
||||||
|
|
||||||
|
def tag_ids
|
||||||
|
self.taggings.blank? ? [] : self.taggings.map{|t| t.tag.id}
|
||||||
|
end
|
||||||
|
|
||||||
|
def tag_ids=(ids)
|
||||||
|
self.tags = ids
|
||||||
|
ids = [ids].flatten
|
||||||
|
ids.delete('')
|
||||||
|
self.tagged_ids = ids
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def remove_taggings
|
||||||
|
self.taggings.where(:_id.in => self.tags_to_destroy).destroy
|
||||||
|
self.class.without_callback(:save, :after, :remove_taggings) do
|
||||||
|
self.update_attribute(:tags_to_destroy, [])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
module Tagging
|
||||||
|
extend OrbitCoreLib::AppBackendUtility
|
||||||
|
def get_tags
|
||||||
|
@module_app ? @module_app.tags : Tag.all
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
module ParserCommon
|
module ParserCommon
|
||||||
include ActionView::Helpers::TagHelper
|
include ActionView::Helpers::TagHelper
|
||||||
|
# include ActionView::Helpers::UrlHelper
|
||||||
|
|
||||||
def menu_level(page, current_page, current, menu, edit = false)
|
def menu_level(page, current_page, current, menu, edit = false)
|
||||||
res = ''
|
res = ''
|
||||||
@@ -170,6 +171,30 @@ module ParserCommon
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# tag_cloud
|
||||||
|
def parse_tag_clouds_edit(body = nil, page = nil, edit=nil)
|
||||||
|
body.css('tag_cloud').each do |tag_cloud|
|
||||||
|
module_app = ModuleApp.find(tag_cloud["id"]) rescue nil
|
||||||
|
res = ''
|
||||||
|
if module_app
|
||||||
|
res << "<div class='tag_cloud'>"
|
||||||
|
res << "<h3 class='h3'>#{t(:tag_cloud)}</h3>"
|
||||||
|
res << "<div class='cloud'>"
|
||||||
|
|
||||||
|
module_app.sorted_tags_for_cloud.each do |tag|
|
||||||
|
# res << link_to(tag[0].name, ('/' + {:tag_id => tag[0].id, :category_id => params[:category_id]}.to_param), :class => "#{tag[1]} #{tag[0].id.to_s.eql?(params[:tag_id]) ? 'active' : nil} ")
|
||||||
|
res << "<span class='#{tag[1]} #{tag[0].id.to_s.eql?(params[:tag_id]) ? 'active' : nil}'>"
|
||||||
|
res << tag[0].name
|
||||||
|
res << "</span>"
|
||||||
|
end
|
||||||
|
res << "</div>"
|
||||||
|
res << "</div>"
|
||||||
|
end
|
||||||
|
fragment = Nokogiri::HTML::DocumentFragment.new(body, res)
|
||||||
|
tag_cloud.swap(fragment)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# page_footer
|
# page_footer
|
||||||
def parse_footer_edit(body, page)
|
def parse_footer_edit(body, page)
|
||||||
page_footer = body.css('.page_footer').first
|
page_footer = body.css('.page_footer').first
|
||||||
|
|||||||
@@ -18,9 +18,12 @@ module ParserFrontEnd
|
|||||||
i18n
|
i18n
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_page_content(page,args=nil)
|
def parse_page_content(page,args={})
|
||||||
tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id]
|
args["category_id"] = args["category_id"].gsub(/\"|\[|\]/,'').split(",").each(&:strip!) if !args["category_id"].blank? and args["category_id"].is_a?(String)
|
||||||
category = params[:category_id].blank? ? page[:category] : params[:category_id]
|
args["tag_id"] = args["tag_id"].gsub(/\"|\[|\]/,'').split(",").each(&:strip!) if !args["tag_id"].blank? and args["tag_id"].is_a? String
|
||||||
|
# tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id]
|
||||||
|
# category = params[:category_id].blank? ? page[:category] : params[:category_id]
|
||||||
|
|
||||||
body = Nokogiri::HTML(page.content)
|
body = Nokogiri::HTML(page.content)
|
||||||
body.css('orbit_front').each do |front|
|
body.css('orbit_front').each do |front|
|
||||||
if front['value']
|
if front['value']
|
||||||
@@ -29,9 +32,12 @@ module ParserFrontEnd
|
|||||||
ret = ''
|
ret = ''
|
||||||
part = PagePart.find(front['part_id']) if front['part_id']
|
part = PagePart.find(front['part_id']) if front['part_id']
|
||||||
ret << eval("\"#{front['path']}\"") rescue ''
|
ret << eval("\"#{front['path']}\"") rescue ''
|
||||||
|
|
||||||
args.each do |index,arg|
|
args.each do |index,arg|
|
||||||
ret << (ret.include?("?") ? "&#{index}=#{arg}": "?#{index}=#{arg}" )
|
if index=="tag_id" || index=="category_id"
|
||||||
|
ret << (ret.include?("?") ? "&#{index}[]=#{arg}": "?#{index}[]=#{arg}" )
|
||||||
|
else
|
||||||
|
ret << (ret.include?("?") ? "&#{index}=#{arg}": "?#{index}=#{arg}" )
|
||||||
|
end
|
||||||
end if args
|
end if args
|
||||||
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load widget' path='#{ret}'></div>")
|
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load widget' path='#{ret}'></div>")
|
||||||
end
|
end
|
||||||
@@ -124,8 +130,8 @@ module ParserFrontEnd
|
|||||||
url = "/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}\#{(\"/\" + params[:id]) if params[:id] && !params[:id].eql?(page.id.to_s)}\#{(\"/\" + params[:controller_action]) if params[:controller_action] && params[:id]}?inner=true"
|
url = "/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}\#{(\"/\" + params[:id]) if params[:id] && !params[:id].eql?(page.id.to_s)}\#{(\"/\" + params[:controller_action]) if params[:controller_action] && params[:id]}?inner=true"
|
||||||
end
|
end
|
||||||
|
|
||||||
categories_str=category.collect{|t| "category_id[]=#{t}"}.join('&')
|
categories_str=category.collect{|t| "base_category_id[]=#{t}"}.join('&')
|
||||||
tags_str=tag.collect{|t| "tag_id[]=#{t}"}.join('&')
|
tags_str=tag.collect{|t| "base_tag_id[]=#{t}"}.join('&')
|
||||||
categories_str = "&#{categories_str}" unless categories_str.blank?
|
categories_str = "&#{categories_str}" unless categories_str.blank?
|
||||||
tags_str = "&#{tags_str}" unless tags_str.blank?
|
tags_str = "&#{tags_str}" unless tags_str.blank?
|
||||||
|
|
||||||
@@ -147,12 +153,13 @@ module ParserFrontEnd
|
|||||||
"/panel/\#{part.module_app.key}/widget/\#{part.widget_path}?inner=true"
|
"/panel/\#{part.module_app.key}/widget/\#{part.widget_path}?inner=true"
|
||||||
end
|
end
|
||||||
|
|
||||||
categories_str=part[:category].collect{|t| "category_id[]=#{t}"}.join('&')
|
categories_str=part[:category].collect{|t| "base_category_id[]=#{t}"}.join('&')
|
||||||
tags_str=part[:tag].collect{|t| "tag_id[]=#{t}"}.join('&')
|
tags_str=part[:tag].collect{|t| "base_tag_id[]=#{t}"}.join('&')
|
||||||
categories_str = "&#{categories_str}" unless categories_str.blank?
|
categories_str = "&#{categories_str}" unless categories_str.blank?
|
||||||
tags_str = "&#{tags_str}" unless tags_str.blank?
|
tags_str = "&#{tags_str}" unless tags_str.blank?
|
||||||
|
|
||||||
options = "&part_id=\#{part.id}#{categories_str}#{tags_str}&page=\#{params[:page]}&search_query=\#{params[:search_query]}&clicked_field_name=\#{params[:clicked_field_name]}&part_title=\#{Rack::Utils.escape(part_title).gsub(\"\+\", \"\%20\") rescue nil}&item_type=page_part"
|
options = "&part_id=\#{part.id}#{categories_str}#{tags_str}&page=\#{params[:page]}&search_query=\#{params[:search_query]}&clicked_field_name=\#{params[:clicked_field_name]}&part_title=\#{Rack::Utils.escape(part_title).gsub(\"\+\", \"\%20\") rescue nil}&item_type=page_part&tag_id=\#{params[:tag_id]}&category_id=\#{params[:category_id]}"
|
||||||
|
|
||||||
ret << "<orbit_front path='#{url + options}' part_id=#{part.id} class='dymanic_load widget'></orbit_front>"
|
ret << "<orbit_front path='#{url + options}' part_id=#{part.id} class='dymanic_load widget'></orbit_front>"
|
||||||
|
|
||||||
when 'public_r_tag'
|
when 'public_r_tag'
|
||||||
@@ -210,4 +217,9 @@ module ParserFrontEnd
|
|||||||
def generate_breadcrumbs(*args)
|
def generate_breadcrumbs(*args)
|
||||||
"<div class='dymanic_load' path='#{front_show_breadcrumb_path(args[1])}'></div>"
|
"<div class='dymanic_load' path='#{front_show_breadcrumb_path(args[1])}'></div>"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# tag_cloud
|
||||||
|
def generate_tag_clouds(*args)
|
||||||
|
"<div class='dymanic_load' path='#{front_show_tag_cloud_path(args[0])}'></div>"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
+25
-3
@@ -3,12 +3,34 @@
|
|||||||
namespace :site do
|
namespace :site do
|
||||||
|
|
||||||
task :build => :environment do
|
task :build => :environment do
|
||||||
|
|
||||||
Site.destroy_all
|
Site.destroy_all
|
||||||
Purchase.destroy_all
|
Purchase.destroy_all
|
||||||
|
|
||||||
Site.create( :school => 'RulingDigital University', :department => 'Computer Science', :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ])
|
Site.create( :school => 'RulingDigital University', :department => 'Computer Science', :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ])
|
||||||
|
User.create!(:email=>'chris@rulingcom.com',:admin=>true,:user_id=>'chris',:password=>'password')
|
||||||
|
`mongo #{Mongoid.config.database.name} --eval "db.fs.chunks.ensureIndex({files_id: 1, n: 1})"`
|
||||||
|
puts "Congres you can now login within url"
|
||||||
|
puts 'Please upload design package (/admin/designs/upload_package ) and run rake site:necessary_data'
|
||||||
|
I18nVariable.create!( :document_class => 'language', :key => 'en', :en => 'English', :zh_tw => '英文' )
|
||||||
|
I18nVariable.create!( :document_class => 'language', :key => 'zh_tw', :en => 'Chinese', :zh_tw => '中文' )
|
||||||
|
Info.create!(key: "profile", built_in: true, disabled: false, title: {"zh_tw"=>"基本欄位", "en"=>"Basic Info"}, to_search: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
task :necessary_data => :environment do
|
||||||
|
site = Site.first
|
||||||
|
site.title = 'RulingOrbit Demo Site'
|
||||||
|
site.save
|
||||||
|
|
||||||
|
# home_trans = I18nVariable.create!( :document_class => 'Home', :key => 'home', :en => 'Homepage', :zh_tw => '首頁')
|
||||||
|
design = Design.first
|
||||||
|
site = Site.first
|
||||||
|
site.design = design
|
||||||
|
site.save
|
||||||
|
theme = design.themes.first
|
||||||
|
home = Page.new( :design_id => design.id, :name => 'home', :is_published => true, :theme_id => theme.id )
|
||||||
|
|
||||||
|
home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"}
|
||||||
|
home.save
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
Loaded 100 of 345 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user