Merge branch 'master' into ldap
Conflicts: Gemfile Gemfile.lock app/views/admin/attributes/_app_selector.html.erb app/views/admin/module_apps/_app_selector.html.erb app/views/admin/pages/_app_selector.html.erb vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb
This commit is contained in:
commit
198825a309
1
Gemfile
1
Gemfile
|
@ -18,6 +18,7 @@ gem 'mongoid'
|
||||||
gem "mongo_session_store-rails3"
|
gem "mongo_session_store-rails3"
|
||||||
gem 'mysql2'
|
gem 'mysql2'
|
||||||
gem "net-ldap", "~> 0.3.1"
|
gem "net-ldap", "~> 0.3.1"
|
||||||
|
gem 'nokogiri'
|
||||||
gem 'radius'
|
gem 'radius'
|
||||||
gem 'rake'
|
gem 'rake'
|
||||||
gem 'ruby-debug19'
|
gem 'ruby-debug19'
|
||||||
|
|
|
@ -41,6 +41,7 @@ GEM
|
||||||
archive-tar-minitar (0.5.2)
|
archive-tar-minitar (0.5.2)
|
||||||
arel (2.2.3)
|
arel (2.2.3)
|
||||||
bcrypt-ruby (3.0.1)
|
bcrypt-ruby (3.0.1)
|
||||||
|
bcrypt-ruby (3.0.1-x86-mingw32)
|
||||||
brakeman (1.5.1)
|
brakeman (1.5.1)
|
||||||
activesupport
|
activesupport
|
||||||
erubis (~> 2.6)
|
erubis (~> 2.6)
|
||||||
|
@ -118,6 +119,8 @@ GEM
|
||||||
mysql2 (0.3.11)
|
mysql2 (0.3.11)
|
||||||
mysql2 (0.3.11-x86-mingw32)
|
mysql2 (0.3.11-x86-mingw32)
|
||||||
net-ldap (0.3.1)
|
net-ldap (0.3.1)
|
||||||
|
nokogiri (1.5.2)
|
||||||
|
nokogiri (1.5.2-x86-mingw32)
|
||||||
orm_adapter (0.0.6)
|
orm_adapter (0.0.6)
|
||||||
pdf-writer (1.1.8)
|
pdf-writer (1.1.8)
|
||||||
color (>= 1.4.0)
|
color (>= 1.4.0)
|
||||||
|
@ -259,6 +262,7 @@ DEPENDENCIES
|
||||||
mongoid
|
mongoid
|
||||||
mysql2
|
mysql2
|
||||||
net-ldap (~> 0.3.1)
|
net-ldap (~> 0.3.1)
|
||||||
|
nokogiri
|
||||||
radius
|
radius
|
||||||
rails (>= 3.1.0, < 3.2.0)
|
rails (>= 3.1.0, < 3.2.0)
|
||||||
rake
|
rake
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
}
|
}
|
||||||
.select-role {
|
.select-role {
|
||||||
display:none;
|
display:none;
|
||||||
overflow:hidden;
|
padding: 10px 0 0;
|
||||||
}
|
}
|
||||||
.file-upload {
|
.file-upload {
|
||||||
position:relative;
|
position:relative;
|
||||||
|
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
|
@ -69,7 +69,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
* ========================================================= */
|
* ========================================================= */
|
||||||
|
|
||||||
|
|
||||||
!function( $ ){
|
!function( $ ){
|
||||||
|
|
||||||
"use strict"
|
"use strict"
|
||||||
|
@ -130,6 +129,7 @@
|
||||||
|
|
||||||
var that = this
|
var that = this
|
||||||
this.isShown = false
|
this.isShown = false
|
||||||
|
//alert(this.isShown+":"+this.$element.attr('class'))
|
||||||
|
|
||||||
$('body').removeClass('modal-open')
|
$('body').removeClass('modal-open')
|
||||||
|
|
||||||
|
@ -146,7 +146,6 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* MODAL PRIVATE METHODS
|
/* MODAL PRIVATE METHODS
|
||||||
* ===================== */
|
* ===================== */
|
||||||
|
|
||||||
|
@ -1252,6 +1251,7 @@
|
||||||
, complete = function () {
|
, complete = function () {
|
||||||
if (startEvent == 'show') that.reset()
|
if (startEvent == 'show') that.reset()
|
||||||
that.$element.trigger(completeEvent)
|
that.$element.trigger(completeEvent)
|
||||||
|
mainTablePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$element
|
this.$element
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
$('.bulletin_links_block a.remove_existing_record').live('click', function(){
|
$('.bulletin_links_block a.delete').live('click', function(){
|
||||||
//$(this).parents('.list_item').remove();
|
$(this).parents('.list_item').remove();
|
||||||
$(this).parents('tr.list_item').remove();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.bulletin_files_block a.remove_existing_record').live('click', function(){
|
$('.bulletin_files_block a.delete').live('click', function(){
|
||||||
//$(this).parents('.list_item').remove();
|
$(this).parents('.list_item').remove();
|
||||||
$(this).parents('tr.list_item').remove();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.action a.remove_existing_record').live('click', function(){
|
$('.action a.remove_existing_record').live('click', function(){
|
||||||
|
@ -13,3 +11,18 @@ $('.action a.remove_existing_record').live('click', function(){
|
||||||
//$("#bulletin_" + $(this).prev().attr('value')).hide();
|
//$("#bulletin_" + $(this).prev().attr('value')).hide();
|
||||||
$("tr#bulletin_" + $(this).prev().attr('value')).hide();
|
$("tr#bulletin_" + $(this).prev().attr('value')).hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.quick_edit_cancel').live('click', function(){
|
||||||
|
tr = $(this).attr('rel');
|
||||||
|
$('#' + tr).hide();
|
||||||
|
$("tr#bulletin_file_" + $(this).prev().attr('value')).hide();
|
||||||
|
$("tr#bulletin_link_" + $(this).prev().attr('value')).hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.list-remove', function(){
|
||||||
|
$('#delete_bulletins').submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '#check_all_bulletins', function(){
|
||||||
|
$('.checkbox_in_list').attr("checked", this.checked);
|
||||||
|
});
|
|
@ -0,0 +1,3 @@
|
||||||
|
/*! HTML5 Shiv pre3.5 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||||
|
Uncompressed source: https://github.com/aFarkas/html5shiv */
|
||||||
|
(function(a,b){function h(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function i(){var a=l.elements;return typeof a=="string"?a.split(" "):a}function j(a){var b={},c=a.createElement,f=a.createDocumentFragment,g=f();a.createElement=function(a){l.shivMethods||c(a);var f;return b[a]?f=b[a].cloneNode():e.test(a)?f=(b[a]=c(a)).cloneNode():f=c(a),f.canHaveChildren&&!d.test(a)?g.appendChild(f):f},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+i().join().replace(/\w+/g,function(a){return b[a]=c(a),g.createElement(a),'c("'+a+'")'})+");return n}")(l,g)}function k(a){var b;return a.documentShived?a:(l.shivCSS&&!f&&(b=!!h(a,"article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio{display:none}canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}mark{background:#FF0;color:#000}")),g||(b=!j(a)),b&&(a.documentShived=b),a)}function p(a){var b,c=a.getElementsByTagName("*"),d=c.length,e=RegExp("^(?:"+i().join("|")+")$","i"),f=[];while(d--)b=c[d],e.test(b.nodeName)&&f.push(b.applyElement(q(b)));return f}function q(a){var b,c=a.attributes,d=c.length,e=a.ownerDocument.createElement(n+":"+a.nodeName);while(d--)b=c[d],b.specified&&e.setAttribute(b.nodeName,b.nodeValue);return e.style.cssText=a.style.cssText,e}function r(a){var b,c=a.split("{"),d=c.length,e=RegExp("(^|[\\s,>+~])("+i().join("|")+")(?=[[\\s,>+~#.:]|$)","gi"),f="$1"+n+"\\:$2";while(d--)b=c[d]=c[d].split("}"),b[b.length-1]=b[b.length-1].replace(e,f),c[d]=b.join("}");return c.join("{")}function s(a){var b=a.length;while(b--)a[b].removeNode()}function t(a){var b,c,d=a.namespaces,e=a.parentWindow;return!o||a.printShived?a:(typeof d[n]=="undefined"&&d.add(n),e.attachEvent("onbeforeprint",function(){var d,e,f,g=a.styleSheets,i=[],j=g.length,k=Array(j);while(j--)k[j]=g[j];while(f=k.pop())if(!f.disabled&&m.test(f.media)){for(d=f.imports,j=0,e=d.length;j<e;j++)k.push(d[j]);try{i.push(f.cssText)}catch(l){}}i=r(i.reverse().join("")),c=p(a),b=h(a,i)}),e.attachEvent("onafterprint",function(){s(c),b.removeNode(!0)}),a.printShived=!0,a)}var c=a.html5||{},d=/^<|^(?:button|form|map|select|textarea|object|iframe)$/i,e=/^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i,f,g;(function(){var c=b.createElement("a");c.innerHTML="<xyz></xyz>",f="hidden"in c,f&&typeof injectElementWithStyles=="function"&&injectElementWithStyles("#modernizr{}",function(b){b.hidden=!0,f=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle).display=="none"}),g=c.childNodes.length==1||function(){try{b.createElement("a")}catch(a){return!0}var c=b.createDocumentFragment();return typeof c.cloneNode=="undefined"||typeof c.createDocumentFragment=="undefined"||typeof c.createElement=="undefined"}()})();var l={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:k};a.html5=l,k(b);var m=/^$|\b(?:all|print)\b/,n="html5shiv",o=!g&&function(){var c=b.documentElement;return typeof b.namespaces!="undefined"&&typeof b.parentWindow!="undefined"&&typeof c.applyElement!="undefined"&&typeof c.removeNode!="undefined"&&typeof a.attachEvent!="undefined"}();l.type+=" print",l.shivPrint=t,t(b)})(this,document)
|
|
@ -0,0 +1,19 @@
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.check[checked="checked"]').parents(".checkbox").addClass("checked")
|
||||||
|
$(".checkbox").click(function(){
|
||||||
|
if($(this).children(".check").attr("checked")){
|
||||||
|
// uncheck
|
||||||
|
$(this).children(".check").attr('checked', false);
|
||||||
|
$(this).removeClass("checked");
|
||||||
|
}else{
|
||||||
|
// check
|
||||||
|
$(this).children(".check").attr({checked: "checked"});
|
||||||
|
$(this).addClass("checked");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$(".checkbox").popover({
|
||||||
|
trigger: 'hover',
|
||||||
|
placement: 'bottom',
|
||||||
|
delay: { show: 100, hide: 300 },
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,31 @@
|
||||||
|
// JavaScript Document
|
||||||
|
|
||||||
|
// can copy code to any of ur desired javascsript
|
||||||
|
|
||||||
|
//extended jquery to search fast.
|
||||||
|
$.extend($.expr[':'], {
|
||||||
|
'containsi': function (elem, i, match, array) {
|
||||||
|
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$(document).ready(function(){
|
||||||
|
$("#user_filter").keyup(function(){
|
||||||
|
if($(this).val()){
|
||||||
|
var totalfoundbyname = $("div#users_checkbox_ary label.member-name:containsi("+$(this).val()+")").length
|
||||||
|
if(totalfoundbyname!=0){
|
||||||
|
$("div#users_checkbox_ary label.member-name:not(:containsi("+$(this).val()+"))").parent().parent().slideUp();
|
||||||
|
//$("div#users_checkbox_ary label.member-name:not(:containsi("+$(this).val()+"))").parent().popover('hide');
|
||||||
|
$("div#users_checkbox_ary label.member-name:containsi("+$(this).val()+")").parent().parent().slideDown();
|
||||||
|
$("div#users_checkbox_ary label.member-name:containsi("+$(this).val()+")").parent().popover('toggle');
|
||||||
|
}else if(totalfoundbyname==0){
|
||||||
|
$("div#users_checkbox_ary div.for_unit:not(:containsi("+$(this).val()+"))").parent().slideUp();
|
||||||
|
//$("div#users_checkbox_ary div.for_unit:not(:containsi("+$(this).val()+"))").popover('hide');
|
||||||
|
$("div#users_checkbox_ary div.for_unit:containsi("+$(this).val()+")").parent().slideDown();
|
||||||
|
$("div#users_checkbox_ary div.for_unit:containsi("+$(this).val()+")").popover('toggle');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$(".checkbox").popover('hide');
|
||||||
|
$("div.checkblock").slideDown();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
|
@ -0,0 +1,126 @@
|
||||||
|
/*
|
||||||
|
* Date Format 1.2.3
|
||||||
|
* (c) 2007-2009 Steven Levithan <stevenlevithan.com>
|
||||||
|
* MIT license
|
||||||
|
*
|
||||||
|
* Includes enhancements by Scott Trenda <scott.trenda.net>
|
||||||
|
* and Kris Kowal <cixar.com/~kris.kowal/>
|
||||||
|
*
|
||||||
|
* Accepts a date, a mask, or a date and a mask.
|
||||||
|
* Returns a formatted version of the given date.
|
||||||
|
* The date defaults to the current date/time.
|
||||||
|
* The mask defaults to dateFormat.masks.default.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var dateFormat = function () {
|
||||||
|
var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
|
||||||
|
timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
|
||||||
|
timezoneClip = /[^-+\dA-Z]/g,
|
||||||
|
pad = function (val, len) {
|
||||||
|
val = String(val);
|
||||||
|
len = len || 2;
|
||||||
|
while (val.length < len) val = "0" + val;
|
||||||
|
return val;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Regexes and supporting functions are cached through closure
|
||||||
|
return function (date, mask, utc) {
|
||||||
|
var dF = dateFormat;
|
||||||
|
|
||||||
|
// You can't provide utc if you skip other args (use the "UTC:" mask prefix)
|
||||||
|
if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) {
|
||||||
|
mask = date;
|
||||||
|
date = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Passing date through Date applies Date.parse, if necessary
|
||||||
|
date = date ? new Date(date) : new Date;
|
||||||
|
if (isNaN(date)) throw SyntaxError("invalid date");
|
||||||
|
|
||||||
|
mask = String(dF.masks[mask] || mask || dF.masks["default"]);
|
||||||
|
|
||||||
|
// Allow setting the utc argument via the mask
|
||||||
|
if (mask.slice(0, 4) == "UTC:") {
|
||||||
|
mask = mask.slice(4);
|
||||||
|
utc = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ = utc ? "getUTC" : "get",
|
||||||
|
d = date[_ + "Date"](),
|
||||||
|
D = date[_ + "Day"](),
|
||||||
|
m = date[_ + "Month"](),
|
||||||
|
y = date[_ + "FullYear"](),
|
||||||
|
H = date[_ + "Hours"](),
|
||||||
|
M = date[_ + "Minutes"](),
|
||||||
|
s = date[_ + "Seconds"](),
|
||||||
|
L = date[_ + "Milliseconds"](),
|
||||||
|
o = utc ? 0 : date.getTimezoneOffset(),
|
||||||
|
flags = {
|
||||||
|
d: d,
|
||||||
|
dd: pad(d),
|
||||||
|
ddd: dF.i18n.dayNames[D],
|
||||||
|
dddd: dF.i18n.dayNames[D + 7],
|
||||||
|
m: m + 1,
|
||||||
|
mm: pad(m + 1),
|
||||||
|
mmm: dF.i18n.monthNames[m],
|
||||||
|
mmmm: dF.i18n.monthNames[m + 12],
|
||||||
|
yy: String(y).slice(2),
|
||||||
|
yyyy: y,
|
||||||
|
h: H % 12 || 12,
|
||||||
|
hh: pad(H % 12 || 12),
|
||||||
|
H: H,
|
||||||
|
HH: pad(H),
|
||||||
|
M: M,
|
||||||
|
MM: pad(M),
|
||||||
|
s: s,
|
||||||
|
ss: pad(s),
|
||||||
|
l: pad(L, 3),
|
||||||
|
L: pad(L > 99 ? Math.round(L / 10) : L),
|
||||||
|
t: H < 12 ? "a" : "p",
|
||||||
|
tt: H < 12 ? "am" : "pm",
|
||||||
|
T: H < 12 ? "A" : "P",
|
||||||
|
TT: H < 12 ? "AM" : "PM",
|
||||||
|
Z: utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
|
||||||
|
o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
|
||||||
|
S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
|
||||||
|
};
|
||||||
|
|
||||||
|
return mask.replace(token, function ($0) {
|
||||||
|
return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}();
|
||||||
|
|
||||||
|
// Some common format strings
|
||||||
|
dateFormat.masks = {
|
||||||
|
"default": "ddd mmm dd yyyy HH:MM:ss",
|
||||||
|
shortDate: "m/d/yy",
|
||||||
|
mediumDate: "mmm d, yyyy",
|
||||||
|
longDate: "mmmm d, yyyy",
|
||||||
|
fullDate: "dddd, mmmm d, yyyy",
|
||||||
|
shortTime: "h:MM TT",
|
||||||
|
mediumTime: "h:MM:ss TT",
|
||||||
|
longTime: "h:MM:ss TT Z",
|
||||||
|
isoDate: "yyyy / mm / dd",
|
||||||
|
isoTime: "HH:MM:ss",
|
||||||
|
isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
|
||||||
|
isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
|
||||||
|
};
|
||||||
|
|
||||||
|
// Internationalization strings
|
||||||
|
dateFormat.i18n = {
|
||||||
|
dayNames: [
|
||||||
|
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
|
||||||
|
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
|
||||||
|
],
|
||||||
|
monthNames: [
|
||||||
|
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
|
||||||
|
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
// For convenience...
|
||||||
|
Date.prototype.format = function (mask, utc) {
|
||||||
|
return dateFormat(this, mask, utc);
|
||||||
|
};
|
||||||
|
|
|
@ -0,0 +1,891 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Date picker
|
||||||
|
* Author: Stefan Petre www.eyecon.ro
|
||||||
|
*
|
||||||
|
* Dual licensed under the MIT and GPL licenses
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
(function ($) {
|
||||||
|
var DatePicker = function () {
|
||||||
|
var ids = {},
|
||||||
|
views = {
|
||||||
|
years: 'datepickerViewYears',
|
||||||
|
moths: 'datepickerViewMonths',
|
||||||
|
days: 'datepickerViewDays'
|
||||||
|
},
|
||||||
|
tpl = {
|
||||||
|
wrapper: '<div class="datepicker"><div class="datepickerContainer"><table cellspacing="0" cellpadding="0"><tbody><tr></tr></tbody></table></div></div>',
|
||||||
|
head: [
|
||||||
|
'<td>',
|
||||||
|
'<table cellspacing="0" cellpadding="0">',
|
||||||
|
'<thead>',
|
||||||
|
'<tr>',
|
||||||
|
'<th class="datepickerGoPrev"><a href="#"><span><%=prev%></span></a></th>',
|
||||||
|
'<th colspan="6" class="datepickerMonth"><a href="#"><span></span></a></th>',
|
||||||
|
'<th class="datepickerGoNext"><a href="#"><span><%=next%></span></a></th>',
|
||||||
|
'</tr>',
|
||||||
|
'<tr class="datepickerDoW">',
|
||||||
|
'<th><span><%=week%></span></th>',
|
||||||
|
'<th><span><%=day1%></span></th>',
|
||||||
|
'<th><span><%=day2%></span></th>',
|
||||||
|
'<th><span><%=day3%></span></th>',
|
||||||
|
'<th><span><%=day4%></span></th>',
|
||||||
|
'<th><span><%=day5%></span></th>',
|
||||||
|
'<th><span><%=day6%></span></th>',
|
||||||
|
'<th><span><%=day7%></span></th>',
|
||||||
|
'</tr>',
|
||||||
|
'</thead>',
|
||||||
|
'</table></td>'
|
||||||
|
],
|
||||||
|
space : '<td class="datepickerSpace"><div></div></td>',
|
||||||
|
days: [
|
||||||
|
'<tbody class="datepickerDays">',
|
||||||
|
'<tr>',
|
||||||
|
'<th class="datepickerWeek"><a href="#"><span><%=weeks[0].week%></span></a></th>',
|
||||||
|
'<td class="<%=weeks[0].days[0].classname%>"><a href="#"><span><%=weeks[0].days[0].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[0].days[1].classname%>"><a href="#"><span><%=weeks[0].days[1].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[0].days[2].classname%>"><a href="#"><span><%=weeks[0].days[2].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[0].days[3].classname%>"><a href="#"><span><%=weeks[0].days[3].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[0].days[4].classname%>"><a href="#"><span><%=weeks[0].days[4].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[0].days[5].classname%>"><a href="#"><span><%=weeks[0].days[5].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[0].days[6].classname%>"><a href="#"><span><%=weeks[0].days[6].text%></span></a></td>',
|
||||||
|
'</tr>',
|
||||||
|
'<tr>',
|
||||||
|
'<th class="datepickerWeek"><a href="#"><span><%=weeks[1].week%></span></a></th>',
|
||||||
|
'<td class="<%=weeks[1].days[0].classname%>"><a href="#"><span><%=weeks[1].days[0].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[1].days[1].classname%>"><a href="#"><span><%=weeks[1].days[1].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[1].days[2].classname%>"><a href="#"><span><%=weeks[1].days[2].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[1].days[3].classname%>"><a href="#"><span><%=weeks[1].days[3].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[1].days[4].classname%>"><a href="#"><span><%=weeks[1].days[4].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[1].days[5].classname%>"><a href="#"><span><%=weeks[1].days[5].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[1].days[6].classname%>"><a href="#"><span><%=weeks[1].days[6].text%></span></a></td>',
|
||||||
|
'</tr>',
|
||||||
|
'<tr>',
|
||||||
|
'<th class="datepickerWeek"><a href="#"><span><%=weeks[2].week%></span></a></th>',
|
||||||
|
'<td class="<%=weeks[2].days[0].classname%>"><a href="#"><span><%=weeks[2].days[0].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[2].days[1].classname%>"><a href="#"><span><%=weeks[2].days[1].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[2].days[2].classname%>"><a href="#"><span><%=weeks[2].days[2].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[2].days[3].classname%>"><a href="#"><span><%=weeks[2].days[3].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[2].days[4].classname%>"><a href="#"><span><%=weeks[2].days[4].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[2].days[5].classname%>"><a href="#"><span><%=weeks[2].days[5].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[2].days[6].classname%>"><a href="#"><span><%=weeks[2].days[6].text%></span></a></td>',
|
||||||
|
'</tr>',
|
||||||
|
'<tr>',
|
||||||
|
'<th class="datepickerWeek"><a href="#"><span><%=weeks[3].week%></span></a></th>',
|
||||||
|
'<td class="<%=weeks[3].days[0].classname%>"><a href="#"><span><%=weeks[3].days[0].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[3].days[1].classname%>"><a href="#"><span><%=weeks[3].days[1].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[3].days[2].classname%>"><a href="#"><span><%=weeks[3].days[2].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[3].days[3].classname%>"><a href="#"><span><%=weeks[3].days[3].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[3].days[4].classname%>"><a href="#"><span><%=weeks[3].days[4].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[3].days[5].classname%>"><a href="#"><span><%=weeks[3].days[5].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[3].days[6].classname%>"><a href="#"><span><%=weeks[3].days[6].text%></span></a></td>',
|
||||||
|
'</tr>',
|
||||||
|
'<tr>',
|
||||||
|
'<th class="datepickerWeek"><a href="#"><span><%=weeks[4].week%></span></a></th>',
|
||||||
|
'<td class="<%=weeks[4].days[0].classname%>"><a href="#"><span><%=weeks[4].days[0].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[4].days[1].classname%>"><a href="#"><span><%=weeks[4].days[1].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[4].days[2].classname%>"><a href="#"><span><%=weeks[4].days[2].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[4].days[3].classname%>"><a href="#"><span><%=weeks[4].days[3].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[4].days[4].classname%>"><a href="#"><span><%=weeks[4].days[4].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[4].days[5].classname%>"><a href="#"><span><%=weeks[4].days[5].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[4].days[6].classname%>"><a href="#"><span><%=weeks[4].days[6].text%></span></a></td>',
|
||||||
|
'</tr>',
|
||||||
|
'<tr>',
|
||||||
|
'<th class="datepickerWeek"><a href="#"><span><%=weeks[5].week%></span></a></th>',
|
||||||
|
'<td class="<%=weeks[5].days[0].classname%>"><a href="#"><span><%=weeks[5].days[0].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[5].days[1].classname%>"><a href="#"><span><%=weeks[5].days[1].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[5].days[2].classname%>"><a href="#"><span><%=weeks[5].days[2].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[5].days[3].classname%>"><a href="#"><span><%=weeks[5].days[3].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[5].days[4].classname%>"><a href="#"><span><%=weeks[5].days[4].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[5].days[5].classname%>"><a href="#"><span><%=weeks[5].days[5].text%></span></a></td>',
|
||||||
|
'<td class="<%=weeks[5].days[6].classname%>"><a href="#"><span><%=weeks[5].days[6].text%></span></a></td>',
|
||||||
|
'</tr>',
|
||||||
|
'</tbody>'
|
||||||
|
],
|
||||||
|
months: [
|
||||||
|
'<tbody class="<%=className%>">',
|
||||||
|
'<tr>',
|
||||||
|
'<td colspan="2"><a href="#"><span><%=data[0]%></span></a></td>',
|
||||||
|
'<td colspan="2"><a href="#"><span><%=data[1]%></span></a></td>',
|
||||||
|
'<td colspan="2"><a href="#"><span><%=data[2]%></span></a></td>',
|
||||||
|
'<td colspan="2"><a href="#"><span><%=data[3]%></span></a></td>',
|
||||||
|
'</tr>',
|
||||||
|
'<tr>',
|
||||||
|
'<td colspan="2"><a href="#"><span><%=data[4]%></span></a></td>',
|
||||||
|
'<td colspan="2"><a href="#"><span><%=data[5]%></span></a></td>',
|
||||||
|
'<td colspan="2"><a href="#"><span><%=data[6]%></span></a></td>',
|
||||||
|
'<td colspan="2"><a href="#"><span><%=data[7]%></span></a></td>',
|
||||||
|
'</tr>',
|
||||||
|
'<tr>',
|
||||||
|
'<td colspan="2"><a href="#"><span><%=data[8]%></span></a></td>',
|
||||||
|
'<td colspan="2"><a href="#"><span><%=data[9]%></span></a></td>',
|
||||||
|
'<td colspan="2"><a href="#"><span><%=data[10]%></span></a></td>',
|
||||||
|
'<td colspan="2"><a href="#"><span><%=data[11]%></span></a></td>',
|
||||||
|
'</tr>',
|
||||||
|
'</tbody>'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
defaults = {
|
||||||
|
flat: false,
|
||||||
|
starts: 1,
|
||||||
|
prev: '◀',
|
||||||
|
next: '▶',
|
||||||
|
lastSel: false,
|
||||||
|
mode: 'single',
|
||||||
|
view: 'days',
|
||||||
|
calendars: 1,
|
||||||
|
format: 'Y-m-d',
|
||||||
|
position: 'bottom',
|
||||||
|
eventName: 'click',
|
||||||
|
onRender: function(){return {};},
|
||||||
|
onChange: function(){return true;},
|
||||||
|
onShow: function(){return true;},
|
||||||
|
onBeforeShow: function(){return true;},
|
||||||
|
onHide: function(){return true;},
|
||||||
|
locale: {
|
||||||
|
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
|
||||||
|
daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
|
||||||
|
daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
|
||||||
|
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
||||||
|
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
||||||
|
weekMin: 'wk'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fill = function(el) {
|
||||||
|
var options = $(el).data('datepicker');
|
||||||
|
var cal = $(el);
|
||||||
|
var currentCal = Math.floor(options.calendars/2), date, data, dow, month, cnt = 0, week, days, indic, indic2, html, tblCal;
|
||||||
|
cal.find('td>table tbody').remove();
|
||||||
|
for (var i = 0; i < options.calendars; i++) {
|
||||||
|
date = new Date(options.current);
|
||||||
|
date.addMonths(-currentCal + i);
|
||||||
|
tblCal = cal.find('table').eq(i+1);
|
||||||
|
switch (tblCal[0].className) {
|
||||||
|
case 'datepickerViewDays':
|
||||||
|
dow = formatDate(date, 'B, Y');
|
||||||
|
break;
|
||||||
|
case 'datepickerViewMonths':
|
||||||
|
dow = date.getFullYear();
|
||||||
|
break;
|
||||||
|
case 'datepickerViewYears':
|
||||||
|
dow = (date.getFullYear()-6) + ' - ' + (date.getFullYear()+5);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
tblCal.find('thead tr:first th:eq(1) span').text(dow);
|
||||||
|
dow = date.getFullYear()-6;
|
||||||
|
data = {
|
||||||
|
data: [],
|
||||||
|
className: 'datepickerYears'
|
||||||
|
}
|
||||||
|
for ( var j = 0; j < 12; j++) {
|
||||||
|
data.data.push(dow + j);
|
||||||
|
}
|
||||||
|
html = tmpl(tpl.months.join(''), data);
|
||||||
|
date.setDate(1);
|
||||||
|
data = {weeks:[], test: 10};
|
||||||
|
month = date.getMonth();
|
||||||
|
var dow = (date.getDay() - options.starts) % 7;
|
||||||
|
date.addDays(-(dow + (dow < 0 ? 7 : 0)));
|
||||||
|
week = -1;
|
||||||
|
cnt = 0;
|
||||||
|
while (cnt < 42) {
|
||||||
|
indic = parseInt(cnt/7,10);
|
||||||
|
indic2 = cnt%7;
|
||||||
|
if (!data.weeks[indic]) {
|
||||||
|
week = date.getWeekNumber();
|
||||||
|
data.weeks[indic] = {
|
||||||
|
week: week,
|
||||||
|
days: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
data.weeks[indic].days[indic2] = {
|
||||||
|
text: date.getDate(),
|
||||||
|
classname: []
|
||||||
|
};
|
||||||
|
if (month != date.getMonth()) {
|
||||||
|
data.weeks[indic].days[indic2].classname.push('datepickerNotInMonth');
|
||||||
|
}
|
||||||
|
if (date.getDay() == 0) {
|
||||||
|
data.weeks[indic].days[indic2].classname.push('datepickerSunday');
|
||||||
|
}
|
||||||
|
if (date.getDay() == 6) {
|
||||||
|
data.weeks[indic].days[indic2].classname.push('datepickerSaturday');
|
||||||
|
}
|
||||||
|
var fromUser = options.onRender(date);
|
||||||
|
var val = date.valueOf();
|
||||||
|
if (fromUser.selected || options.date == val || $.inArray(val, options.date) > -1 || (options.mode == 'range' && val >= options.date[0] && val <= options.date[1])) {
|
||||||
|
data.weeks[indic].days[indic2].classname.push('datepickerSelected');
|
||||||
|
}
|
||||||
|
if (fromUser.disabled) {
|
||||||
|
data.weeks[indic].days[indic2].classname.push('datepickerDisabled');
|
||||||
|
}
|
||||||
|
if (fromUser.className) {
|
||||||
|
data.weeks[indic].days[indic2].classname.push(fromUser.className);
|
||||||
|
}
|
||||||
|
data.weeks[indic].days[indic2].classname = data.weeks[indic].days[indic2].classname.join(' ');
|
||||||
|
cnt++;
|
||||||
|
date.addDays(1);
|
||||||
|
}
|
||||||
|
html = tmpl(tpl.days.join(''), data) + html;
|
||||||
|
data = {
|
||||||
|
data: options.locale.monthsShort,
|
||||||
|
className: 'datepickerMonths'
|
||||||
|
};
|
||||||
|
html = tmpl(tpl.months.join(''), data) + html;
|
||||||
|
tblCal.append(html);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
parseDate = function (date, format) {
|
||||||
|
if (date.constructor == Date) {
|
||||||
|
return new Date(date);
|
||||||
|
}
|
||||||
|
var parts = date.split(/\W+/);
|
||||||
|
var against = format.split(/\W+/), d, m, y, h, min, now = new Date();
|
||||||
|
for (var i = 0; i < parts.length; i++) {
|
||||||
|
switch (against[i]) {
|
||||||
|
case 'd':
|
||||||
|
case 'e':
|
||||||
|
d = parseInt(parts[i],10);
|
||||||
|
break;
|
||||||
|
case 'm':
|
||||||
|
m = parseInt(parts[i], 10)-1;
|
||||||
|
break;
|
||||||
|
case 'Y':
|
||||||
|
case 'y':
|
||||||
|
y = parseInt(parts[i], 10);
|
||||||
|
y += y > 100 ? 0 : (y < 29 ? 2000 : 1900);
|
||||||
|
break;
|
||||||
|
case 'H':
|
||||||
|
case 'I':
|
||||||
|
case 'k':
|
||||||
|
case 'l':
|
||||||
|
h = parseInt(parts[i], 10);
|
||||||
|
break;
|
||||||
|
case 'P':
|
||||||
|
case 'p':
|
||||||
|
if (/pm/i.test(parts[i]) && h < 12) {
|
||||||
|
h += 12;
|
||||||
|
} else if (/am/i.test(parts[i]) && h >= 12) {
|
||||||
|
h -= 12;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'M':
|
||||||
|
min = parseInt(parts[i], 10);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Date(
|
||||||
|
y === undefined ? now.getFullYear() : y,
|
||||||
|
m === undefined ? now.getMonth() : m,
|
||||||
|
d === undefined ? now.getDate() : d,
|
||||||
|
h === undefined ? now.getHours() : h,
|
||||||
|
min === undefined ? now.getMinutes() : min,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
},
|
||||||
|
formatDate = function(date, format) {
|
||||||
|
var m = date.getMonth();
|
||||||
|
var d = date.getDate();
|
||||||
|
var y = date.getFullYear();
|
||||||
|
var wn = date.getWeekNumber();
|
||||||
|
var w = date.getDay();
|
||||||
|
var s = {};
|
||||||
|
var hr = date.getHours();
|
||||||
|
var pm = (hr >= 12);
|
||||||
|
var ir = (pm) ? (hr - 12) : hr;
|
||||||
|
var dy = date.getDayOfYear();
|
||||||
|
if (ir == 0) {
|
||||||
|
ir = 12;
|
||||||
|
}
|
||||||
|
var min = date.getMinutes();
|
||||||
|
var sec = date.getSeconds();
|
||||||
|
var parts = format.split(''), part;
|
||||||
|
for ( var i = 0; i < parts.length; i++ ) {
|
||||||
|
part = parts[i];
|
||||||
|
switch (parts[i]) {
|
||||||
|
case 'a':
|
||||||
|
part = date.getDayName();
|
||||||
|
break;
|
||||||
|
case 'A':
|
||||||
|
part = date.getDayName(true);
|
||||||
|
break;
|
||||||
|
case 'b':
|
||||||
|
part = date.getMonthName();
|
||||||
|
break;
|
||||||
|
case 'B':
|
||||||
|
part = date.getMonthName(true);
|
||||||
|
break;
|
||||||
|
case 'C':
|
||||||
|
part = 1 + Math.floor(y / 100);
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
part = (d < 10) ? ("0" + d) : d;
|
||||||
|
break;
|
||||||
|
case 'e':
|
||||||
|
part = d;
|
||||||
|
break;
|
||||||
|
case 'H':
|
||||||
|
part = (hr < 10) ? ("0" + hr) : hr;
|
||||||
|
break;
|
||||||
|
case 'I':
|
||||||
|
part = (ir < 10) ? ("0" + ir) : ir;
|
||||||
|
break;
|
||||||
|
case 'j':
|
||||||
|
part = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy;
|
||||||
|
break;
|
||||||
|
case 'k':
|
||||||
|
part = hr;
|
||||||
|
break;
|
||||||
|
case 'l':
|
||||||
|
part = ir;
|
||||||
|
break;
|
||||||
|
case 'm':
|
||||||
|
part = (m < 9) ? ("0" + (1+m)) : (1+m);
|
||||||
|
break;
|
||||||
|
case 'M':
|
||||||
|
part = (min < 10) ? ("0" + min) : min;
|
||||||
|
break;
|
||||||
|
case 'p':
|
||||||
|
case 'P':
|
||||||
|
part = pm ? "PM" : "AM";
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
part = Math.floor(date.getTime() / 1000);
|
||||||
|
break;
|
||||||
|
case 'S':
|
||||||
|
part = (sec < 10) ? ("0" + sec) : sec;
|
||||||
|
break;
|
||||||
|
case 'u':
|
||||||
|
part = w + 1;
|
||||||
|
break;
|
||||||
|
case 'w':
|
||||||
|
part = w;
|
||||||
|
break;
|
||||||
|
case 'y':
|
||||||
|
part = ('' + y).substr(2, 2);
|
||||||
|
break;
|
||||||
|
case 'Y':
|
||||||
|
part = y;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
parts[i] = part;
|
||||||
|
}
|
||||||
|
return parts.join('');
|
||||||
|
},
|
||||||
|
extendDate = function(options) {
|
||||||
|
if (Date.prototype.tempDate) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Date.prototype.tempDate = null;
|
||||||
|
Date.prototype.months = options.months;
|
||||||
|
Date.prototype.monthsShort = options.monthsShort;
|
||||||
|
Date.prototype.days = options.days;
|
||||||
|
Date.prototype.daysShort = options.daysShort;
|
||||||
|
Date.prototype.getMonthName = function(fullName) {
|
||||||
|
return this[fullName ? 'months' : 'monthsShort'][this.getMonth()];
|
||||||
|
};
|
||||||
|
Date.prototype.getDayName = function(fullName) {
|
||||||
|
return this[fullName ? 'days' : 'daysShort'][this.getDay()];
|
||||||
|
};
|
||||||
|
Date.prototype.addDays = function (n) {
|
||||||
|
this.setDate(this.getDate() + n);
|
||||||
|
this.tempDate = this.getDate();
|
||||||
|
};
|
||||||
|
Date.prototype.addMonths = function (n) {
|
||||||
|
if (this.tempDate == null) {
|
||||||
|
this.tempDate = this.getDate();
|
||||||
|
}
|
||||||
|
this.setDate(1);
|
||||||
|
this.setMonth(this.getMonth() + n);
|
||||||
|
this.setDate(Math.min(this.tempDate, this.getMaxDays()));
|
||||||
|
};
|
||||||
|
Date.prototype.addYears = function (n) {
|
||||||
|
if (this.tempDate == null) {
|
||||||
|
this.tempDate = this.getDate();
|
||||||
|
}
|
||||||
|
this.setDate(1);
|
||||||
|
this.setFullYear(this.getFullYear() + n);
|
||||||
|
this.setDate(Math.min(this.tempDate, this.getMaxDays()));
|
||||||
|
};
|
||||||
|
Date.prototype.getMaxDays = function() {
|
||||||
|
var tmpDate = new Date(Date.parse(this)),
|
||||||
|
d = 28, m;
|
||||||
|
m = tmpDate.getMonth();
|
||||||
|
d = 28;
|
||||||
|
while (tmpDate.getMonth() == m) {
|
||||||
|
d ++;
|
||||||
|
tmpDate.setDate(d);
|
||||||
|
}
|
||||||
|
return d - 1;
|
||||||
|
};
|
||||||
|
Date.prototype.getFirstDay = function() {
|
||||||
|
var tmpDate = new Date(Date.parse(this));
|
||||||
|
tmpDate.setDate(1);
|
||||||
|
return tmpDate.getDay();
|
||||||
|
};
|
||||||
|
Date.prototype.getWeekNumber = function() {
|
||||||
|
var tempDate = new Date(this);
|
||||||
|
tempDate.setDate(tempDate.getDate() - (tempDate.getDay() + 6) % 7 + 3);
|
||||||
|
var dms = tempDate.valueOf();
|
||||||
|
tempDate.setMonth(0);
|
||||||
|
tempDate.setDate(4);
|
||||||
|
return Math.round((dms - tempDate.valueOf()) / (604800000)) + 1;
|
||||||
|
};
|
||||||
|
Date.prototype.getDayOfYear = function() {
|
||||||
|
var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
|
||||||
|
var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0);
|
||||||
|
var time = now - then;
|
||||||
|
return Math.floor(time / 24*60*60*1000);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
layout = function (el) {
|
||||||
|
var options = $(el).data('datepicker');
|
||||||
|
var cal = $('#' + options.id);
|
||||||
|
if (!options.extraHeight) {
|
||||||
|
var divs = $(el).find('div');
|
||||||
|
//options.extraHeight = divs.get(0).offsetHeight + divs.get(1).offsetHeight;
|
||||||
|
//options.extraWidth = divs.get(2).offsetWidth + divs.get(3).offsetWidth;
|
||||||
|
}
|
||||||
|
var tbl = cal.find('table:first').get(0);
|
||||||
|
var width = tbl.offsetWidth;
|
||||||
|
var height = tbl.offsetHeight;
|
||||||
|
cal.css({
|
||||||
|
width: width + options.extraWidth + 'px',
|
||||||
|
height: height + options.extraHeight + 'px'
|
||||||
|
}).find('div.datepickerContainer').css({
|
||||||
|
width: width + 'px',
|
||||||
|
height: height + 'px'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
click = function(ev) {
|
||||||
|
if ($(ev.target).is('span')) {
|
||||||
|
ev.target = ev.target.parentNode;
|
||||||
|
}
|
||||||
|
var el = $(ev.target);
|
||||||
|
if (el.is('a')) {
|
||||||
|
ev.target.blur();
|
||||||
|
if (el.hasClass('datepickerDisabled')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var options = $(this).data('datepicker');
|
||||||
|
var parentEl = el.parent();
|
||||||
|
var tblEl = parentEl.parent().parent().parent();
|
||||||
|
var tblIndex = $('table', this).index(tblEl.get(0)) - 1;
|
||||||
|
var tmp = new Date(options.current);
|
||||||
|
var changed = false;
|
||||||
|
var fillIt = false;
|
||||||
|
if (parentEl.is('th')) {
|
||||||
|
if (parentEl.hasClass('datepickerWeek') && options.mode == 'range' && !parentEl.next().hasClass('datepickerDisabled')) {
|
||||||
|
var val = parseInt(parentEl.next().text(), 10);
|
||||||
|
tmp.addMonths(tblIndex - Math.floor(options.calendars/2));
|
||||||
|
if (parentEl.next().hasClass('datepickerNotInMonth')) {
|
||||||
|
tmp.addMonths(val > 15 ? -1 : 1);
|
||||||
|
}
|
||||||
|
tmp.setDate(val);
|
||||||
|
options.date[0] = (tmp.setHours(0,0,0,0)).valueOf();
|
||||||
|
tmp.setHours(23,59,59,0);
|
||||||
|
tmp.addDays(6);
|
||||||
|
options.date[1] = tmp.valueOf();
|
||||||
|
fillIt = true;
|
||||||
|
changed = true;
|
||||||
|
options.lastSel = false;
|
||||||
|
} else if (parentEl.hasClass('datepickerMonth')) {
|
||||||
|
tmp.addMonths(tblIndex - Math.floor(options.calendars/2));
|
||||||
|
switch (tblEl.get(0).className) {
|
||||||
|
case 'datepickerViewDays':
|
||||||
|
tblEl.get(0).className = 'datepickerViewMonths';
|
||||||
|
el.find('span').text(tmp.getFullYear());
|
||||||
|
break;
|
||||||
|
case 'datepickerViewMonths':
|
||||||
|
tblEl.get(0).className = 'datepickerViewYears';
|
||||||
|
el.find('span').text((tmp.getFullYear()-6) + ' - ' + (tmp.getFullYear()+5));
|
||||||
|
break;
|
||||||
|
case 'datepickerViewYears':
|
||||||
|
tblEl.get(0).className = 'datepickerViewDays';
|
||||||
|
el.find('span').text(formatDate(tmp, 'B, Y'));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (parentEl.parent().parent().is('thead')) {
|
||||||
|
switch (tblEl.get(0).className) {
|
||||||
|
case 'datepickerViewDays':
|
||||||
|
options.current.addMonths(parentEl.hasClass('datepickerGoPrev') ? -1 : 1);
|
||||||
|
break;
|
||||||
|
case 'datepickerViewMonths':
|
||||||
|
options.current.addYears(parentEl.hasClass('datepickerGoPrev') ? -1 : 1);
|
||||||
|
break;
|
||||||
|
case 'datepickerViewYears':
|
||||||
|
options.current.addYears(parentEl.hasClass('datepickerGoPrev') ? -12 : 12);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fillIt = true;
|
||||||
|
}
|
||||||
|
} else if (parentEl.is('td') && !parentEl.hasClass('datepickerDisabled')) {
|
||||||
|
switch (tblEl.get(0).className) {
|
||||||
|
case 'datepickerViewMonths':
|
||||||
|
options.current.setMonth(tblEl.find('tbody.datepickerMonths td').index(parentEl));
|
||||||
|
options.current.setFullYear(parseInt(tblEl.find('thead th.datepickerMonth span').text(), 10));
|
||||||
|
options.current.addMonths(Math.floor(options.calendars/2) - tblIndex);
|
||||||
|
tblEl.get(0).className = 'datepickerViewDays';
|
||||||
|
break;
|
||||||
|
case 'datepickerViewYears':
|
||||||
|
options.current.setFullYear(parseInt(el.text(), 10));
|
||||||
|
tblEl.get(0).className = 'datepickerViewMonths';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
var val = parseInt(el.text(), 10);
|
||||||
|
tmp.addMonths(tblIndex - Math.floor(options.calendars/2));
|
||||||
|
if (parentEl.hasClass('datepickerNotInMonth')) {
|
||||||
|
tmp.addMonths(val > 15 ? -1 : 1);
|
||||||
|
}
|
||||||
|
tmp.setDate(val);
|
||||||
|
switch (options.mode) {
|
||||||
|
case 'multiple':
|
||||||
|
val = (tmp.setHours(0,0,0,0)).valueOf();
|
||||||
|
if ($.inArray(val, options.date) > -1) {
|
||||||
|
$.each(options.date, function(nr, dat){
|
||||||
|
if (dat == val) {
|
||||||
|
options.date.splice(nr,1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
options.date.push(val);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'range':
|
||||||
|
if (!options.lastSel) {
|
||||||
|
options.date[0] = (tmp.setHours(0,0,0,0)).valueOf();
|
||||||
|
}
|
||||||
|
val = (tmp.setHours(23,59,59,0)).valueOf();
|
||||||
|
if (val < options.date[0]) {
|
||||||
|
options.date[1] = options.date[0] + 86399000;
|
||||||
|
options.date[0] = val - 86399000;
|
||||||
|
} else {
|
||||||
|
options.date[1] = val;
|
||||||
|
}
|
||||||
|
options.lastSel = !options.lastSel;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
options.date = tmp.valueOf();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fillIt = true;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
if (fillIt) {
|
||||||
|
fill(this);
|
||||||
|
}
|
||||||
|
if (changed) {
|
||||||
|
options.onChange.apply(this, prepareDate(options));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
prepareDate = function (options) {
|
||||||
|
var tmp;
|
||||||
|
if (options.mode == 'single') {
|
||||||
|
tmp = new Date(options.date);
|
||||||
|
return [formatDate(tmp, options.format), tmp, options.el];
|
||||||
|
} else {
|
||||||
|
tmp = [[],[], options.el];
|
||||||
|
$.each(options.date, function(nr, val){
|
||||||
|
var date = new Date(val);
|
||||||
|
tmp[0].push(formatDate(date, options.format));
|
||||||
|
tmp[1].push(date);
|
||||||
|
});
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getViewport = function () {
|
||||||
|
var m = document.compatMode == 'CSS1Compat';
|
||||||
|
return {
|
||||||
|
l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
|
||||||
|
t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
|
||||||
|
w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
|
||||||
|
h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
|
||||||
|
};
|
||||||
|
},
|
||||||
|
isChildOf = function(parentEl, el, container) {
|
||||||
|
if (parentEl == el) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (parentEl.contains) {
|
||||||
|
return parentEl.contains(el);
|
||||||
|
}
|
||||||
|
if ( parentEl.compareDocumentPosition ) {
|
||||||
|
return !!(parentEl.compareDocumentPosition(el) & 16);
|
||||||
|
}
|
||||||
|
var prEl = el.parentNode;
|
||||||
|
while(prEl && prEl != container) {
|
||||||
|
if (prEl == parentEl)
|
||||||
|
return true;
|
||||||
|
prEl = prEl.parentNode;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
show = function (ev) {
|
||||||
|
var cal = $('#' + $(this).data('datepickerId'));
|
||||||
|
if (!cal.is(':visible')) {
|
||||||
|
var calEl = cal.get(0);
|
||||||
|
fill(calEl);
|
||||||
|
var options = cal.data('datepicker');
|
||||||
|
options.onBeforeShow.apply(this, [cal.get(0)]);
|
||||||
|
var pos = $(this).offset();
|
||||||
|
var viewPort = getViewport();
|
||||||
|
var top = pos.top;
|
||||||
|
var left = pos.left;
|
||||||
|
var oldDisplay = $.curCSS(calEl, 'display');
|
||||||
|
cal.css({
|
||||||
|
visibility: 'hidden',
|
||||||
|
display: 'block'
|
||||||
|
});
|
||||||
|
layout(calEl);
|
||||||
|
switch (options.position){
|
||||||
|
case 'top':
|
||||||
|
top -= calEl.offsetHeight;
|
||||||
|
break;
|
||||||
|
case 'left':
|
||||||
|
left -= calEl.offsetWidth;
|
||||||
|
break;
|
||||||
|
case 'right':
|
||||||
|
left += this.offsetWidth;
|
||||||
|
break;
|
||||||
|
case 'bottom':
|
||||||
|
top += this.offsetHeight;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (top + calEl.offsetHeight > viewPort.t + viewPort.h) {
|
||||||
|
top = pos.top - calEl.offsetHeight;
|
||||||
|
}
|
||||||
|
if (top < viewPort.t) {
|
||||||
|
top = pos.top + this.offsetHeight + calEl.offsetHeight;
|
||||||
|
}
|
||||||
|
if (left + calEl.offsetWidth > viewPort.l + viewPort.w) {
|
||||||
|
left = pos.left - calEl.offsetWidth;
|
||||||
|
}
|
||||||
|
if (left < viewPort.l) {
|
||||||
|
left = pos.left + this.offsetWidth
|
||||||
|
}
|
||||||
|
cal.css({
|
||||||
|
visibility: 'visible',
|
||||||
|
display: 'block',
|
||||||
|
top: top + 'px',
|
||||||
|
left: left + 'px'
|
||||||
|
});
|
||||||
|
if (options.onShow.apply(this, [cal.get(0)]) != false) {
|
||||||
|
cal.show();
|
||||||
|
}
|
||||||
|
$(document).bind('mousedown', {cal: cal, trigger: this}, hide);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
hide = function (ev) {
|
||||||
|
if (ev.target != ev.data.trigger && !isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
|
||||||
|
if (ev.data.cal.data('datepicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
|
||||||
|
ev.data.cal.hide();
|
||||||
|
}
|
||||||
|
$(document).unbind('mousedown', hide);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
init: function(options){
|
||||||
|
options = $.extend({}, defaults, options||{});
|
||||||
|
extendDate(options.locale);
|
||||||
|
options.calendars = Math.max(1, parseInt(options.calendars,10)||1);
|
||||||
|
options.mode = /single|multiple|range/.test(options.mode) ? options.mode : 'single';
|
||||||
|
return this.each(function(){
|
||||||
|
if (!$(this).data('datepicker')) {
|
||||||
|
options.el = this;
|
||||||
|
if (options.date.constructor == String) {
|
||||||
|
options.date = parseDate(options.date, options.format);
|
||||||
|
options.date.setHours(0,0,0,0);
|
||||||
|
}
|
||||||
|
if (options.mode != 'single') {
|
||||||
|
if (options.date.constructor != Array) {
|
||||||
|
options.date = [options.date.valueOf()];
|
||||||
|
if (options.mode == 'range') {
|
||||||
|
options.date.push(((new Date(options.date[0])).setHours(23,59,59,0)).valueOf());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (var i = 0; i < options.date.length; i++) {
|
||||||
|
options.date[i] = (parseDate(options.date[i], options.format).setHours(0,0,0,0)).valueOf();
|
||||||
|
}
|
||||||
|
if (options.mode == 'range') {
|
||||||
|
options.date[1] = ((new Date(options.date[1])).setHours(23,59,59,0)).valueOf();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
options.date = options.date.valueOf();
|
||||||
|
}
|
||||||
|
if (!options.current) {
|
||||||
|
options.current = new Date();
|
||||||
|
} else {
|
||||||
|
options.current = parseDate(options.current, options.format);
|
||||||
|
}
|
||||||
|
options.current.setDate(1);
|
||||||
|
options.current.setHours(0,0,0,0);
|
||||||
|
var id = 'datepicker_' + parseInt(Math.random() * 1000), cnt;
|
||||||
|
options.id = id;
|
||||||
|
$(this).data('datepickerId', options.id);
|
||||||
|
var cal = $(tpl.wrapper).attr('id', id).bind('click', click).data('datepicker', options);
|
||||||
|
if (options.className) {
|
||||||
|
cal.addClass(options.className);
|
||||||
|
}
|
||||||
|
var html = '';
|
||||||
|
for (var i = 0; i < options.calendars; i++) {
|
||||||
|
cnt = options.starts;
|
||||||
|
if (i > 0) {
|
||||||
|
html += tpl.space;
|
||||||
|
}
|
||||||
|
html += tmpl(tpl.head.join(''), {
|
||||||
|
week: options.locale.weekMin,
|
||||||
|
prev: options.prev,
|
||||||
|
next: options.next,
|
||||||
|
day1: options.locale.daysMin[(cnt++)%7],
|
||||||
|
day2: options.locale.daysMin[(cnt++)%7],
|
||||||
|
day3: options.locale.daysMin[(cnt++)%7],
|
||||||
|
day4: options.locale.daysMin[(cnt++)%7],
|
||||||
|
day5: options.locale.daysMin[(cnt++)%7],
|
||||||
|
day6: options.locale.daysMin[(cnt++)%7],
|
||||||
|
day7: options.locale.daysMin[(cnt++)%7]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
cal
|
||||||
|
.find('tr:first').append(html)
|
||||||
|
.find('table').addClass(views[options.view]);
|
||||||
|
fill(cal.get(0));
|
||||||
|
if (options.flat) {
|
||||||
|
cal.appendTo(this).show().css('position', 'relative');
|
||||||
|
layout(cal.get(0));
|
||||||
|
} else {
|
||||||
|
cal.appendTo(document.body);
|
||||||
|
$(this).bind(options.eventName, show);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
showPicker: function() {
|
||||||
|
return this.each( function () {
|
||||||
|
if ($(this).data('datepickerId')) {
|
||||||
|
show.apply(this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
hidePicker: function() {
|
||||||
|
return this.each( function () {
|
||||||
|
if ($(this).data('datepickerId')) {
|
||||||
|
$('#' + $(this).data('datepickerId')).hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
setDate: function(date, shiftTo){
|
||||||
|
return this.each(function(){
|
||||||
|
if ($(this).data('datepickerId')) {
|
||||||
|
var cal = $('#' + $(this).data('datepickerId'));
|
||||||
|
var options = cal.data('datepicker');
|
||||||
|
options.date = date;
|
||||||
|
if (options.date.constructor == String) {
|
||||||
|
options.date = parseDate(options.date, options.format);
|
||||||
|
options.date.setHours(0,0,0,0);
|
||||||
|
}
|
||||||
|
if (options.mode != 'single') {
|
||||||
|
if (options.date.constructor != Array) {
|
||||||
|
options.date = [options.date.valueOf()];
|
||||||
|
if (options.mode == 'range') {
|
||||||
|
options.date.push(((new Date(options.date[0])).setHours(23,59,59,0)).valueOf());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (var i = 0; i < options.date.length; i++) {
|
||||||
|
options.date[i] = (parseDate(options.date[i], options.format).setHours(0,0,0,0)).valueOf();
|
||||||
|
}
|
||||||
|
if (options.mode == 'range') {
|
||||||
|
options.date[1] = ((new Date(options.date[1])).setHours(23,59,59,0)).valueOf();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
options.date = options.date.valueOf();
|
||||||
|
}
|
||||||
|
if (shiftTo) {
|
||||||
|
options.current = new Date (options.mode != 'single' ? options.date[0] : options.date);
|
||||||
|
}
|
||||||
|
fill(cal.get(0));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getDate: function(formated) {
|
||||||
|
if (this.size() > 0) {
|
||||||
|
return prepareDate($('#' + $(this).data('datepickerId')).data('datepicker'))[formated ? 0 : 1];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
clear: function(){
|
||||||
|
return this.each(function(){
|
||||||
|
if ($(this).data('datepickerId')) {
|
||||||
|
var cal = $('#' + $(this).data('datepickerId'));
|
||||||
|
var options = cal.data('datepicker');
|
||||||
|
if (options.mode != 'single') {
|
||||||
|
options.date = [];
|
||||||
|
fill(cal.get(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fixLayout: function(){
|
||||||
|
return this.each(function(){
|
||||||
|
if ($(this).data('datepickerId')) {
|
||||||
|
var cal = $('#' + $(this).data('datepickerId'));
|
||||||
|
var options = cal.data('datepicker');
|
||||||
|
if (options.flat) {
|
||||||
|
layout(cal.get(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}();
|
||||||
|
$.fn.extend({
|
||||||
|
DatePicker: DatePicker.init,
|
||||||
|
DatePickerHide: DatePicker.hidePicker,
|
||||||
|
DatePickerShow: DatePicker.showPicker,
|
||||||
|
DatePickerSetDate: DatePicker.setDate,
|
||||||
|
DatePickerGetDate: DatePicker.getDate,
|
||||||
|
DatePickerClear: DatePicker.clear,
|
||||||
|
DatePickerLayout: DatePicker.fixLayout
|
||||||
|
});
|
||||||
|
})(jQuery);
|
||||||
|
|
||||||
|
(function(){
|
||||||
|
var cache = {};
|
||||||
|
|
||||||
|
this.tmpl = function tmpl(str, data){
|
||||||
|
// Figure out if we're getting a template, or if we need to
|
||||||
|
// load the template - and be sure to cache the result.
|
||||||
|
var fn = !/\W/.test(str) ?
|
||||||
|
cache[str] = cache[str] ||
|
||||||
|
tmpl(document.getElementById(str).innerHTML) :
|
||||||
|
|
||||||
|
// Generate a reusable function that will serve as a template
|
||||||
|
// generator (and which will be cached).
|
||||||
|
new Function("obj",
|
||||||
|
"var p=[],print=function(){p.push.apply(p,arguments);};" +
|
||||||
|
|
||||||
|
// Introduce the data as local variables using with(){}
|
||||||
|
"with(obj){p.push('" +
|
||||||
|
|
||||||
|
// Convert the template into pure JavaScript
|
||||||
|
str
|
||||||
|
.replace(/[\r\t\n]/g, " ")
|
||||||
|
.split("<%").join("\t")
|
||||||
|
.replace(/((^|%>)[^\t]*)'/g, "$1\r")
|
||||||
|
.replace(/\t=(.*?)%>/g, "',$1,'")
|
||||||
|
.split("\t").join("');")
|
||||||
|
.split("%>").join("p.push('")
|
||||||
|
.split("\r").join("\\'")
|
||||||
|
+ "');}return p.join('');");
|
||||||
|
|
||||||
|
// Provide some basic currying to the user
|
||||||
|
return data ? fn( data ) : fn;
|
||||||
|
};
|
||||||
|
})();
|
|
@ -12,3 +12,5 @@
|
||||||
//= require orbit-1.0
|
//= require orbit-1.0
|
||||||
//= require tinymce-jquery
|
//= require tinymce-jquery
|
||||||
//= require tinymce_orbit
|
//= require tinymce_orbit
|
||||||
|
//= require orbit-bar-search
|
||||||
|
//= require side_bar_history
|
|
@ -9,27 +9,14 @@ function resize() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$(document).on('click', '.orbit-bar-member', function(){
|
|
||||||
$(this).hasClass('open') ? $(this).removeClass('open') : $(this).addClass('open');
|
|
||||||
$('.bar-login .dropdown-menu').toggle();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).click(function() {
|
|
||||||
$('.orbit-bar-member').removeClass("open");
|
|
||||||
$('.bar-login .dropdown-menu').hide();
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).on('click', '.bar-login .dropdown-menu', function(e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
$('.bar-login .dropdown-menu').show();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.tip').tooltip({
|
$('.tip').tooltip({
|
||||||
placement: "left"
|
placement: "left"
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.privacy', function() {
|
$(document).on('click', '.privacy', function() {
|
||||||
|
|
||||||
|
console.log($(this).val());
|
||||||
switch ($(this).val()) {
|
switch ($(this).val()) {
|
||||||
case 'true':
|
case 'true':
|
||||||
$(this).parents('.controls').children('.select-role').slideUp(300);
|
$(this).parents('.controls').children('.select-role').slideUp(300);
|
||||||
|
@ -40,14 +27,22 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.toggle-tr-edit', function() {
|
var $role = $('.select-role');
|
||||||
$(this).parents('tr').next('.qe-block').removeClass('hide');
|
var method =$('.privacy:eq(1)').attr('checked');
|
||||||
$(this).parents('tr').next('.qe-block').find('.qe-edit-div').addClass('hide');
|
if(method == 'checked'){
|
||||||
$(this).parents('tr').next('.qe-block').find('#qe-' + $(this).attr('rel')).toggleClass('hide');
|
$role.slideDown(0);
|
||||||
|
}
|
||||||
|
$('.privacy').each(function($i) {
|
||||||
|
$(this).click(function() {
|
||||||
|
switch ($i) {
|
||||||
|
case 0:
|
||||||
|
$role.slideUp(300);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
$role.slideDown(300);
|
||||||
|
break;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.sort-header > .sort', function() {
|
|
||||||
$.getScript($(this).attr('rel'));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/*tinyscrollbar&windows-Size*/
|
/*tinyscrollbar&windows-Size*/
|
||||||
|
@ -56,11 +51,11 @@ $(document).ready(function(){
|
||||||
$('#main-sidebar').css("height", viewportheight-30);
|
$('#main-sidebar').css("height", viewportheight-30);
|
||||||
$('#main-sidebar .viewport').css("height", viewportheight-30);
|
$('#main-sidebar .viewport').css("height", viewportheight-30);
|
||||||
$('.post-title').css("width", viewportwidth-495);
|
$('.post-title').css("width", viewportwidth-495);
|
||||||
$('#main-wrap > .subnav').css("width", viewportwidth-$mainWrapMarginLeft)
|
$('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft);
|
||||||
$('#main-sidebar').tinyscrollbar();
|
$('#main-sidebar').tinyscrollbar();
|
||||||
$('.detal-list').tinyscrollbar();
|
$('.detal-list').tinyscrollbar();
|
||||||
$('#main-sidebar').tinyscrollbar({size:(viewportheight-34)});
|
$('#main-sidebar').tinyscrollbar({size:(viewportheight-34)});
|
||||||
mainTablePosition()
|
mainTablePosition();
|
||||||
|
|
||||||
/*isotope*/
|
/*isotope*/
|
||||||
var $container = $('#isotope');
|
var $container = $('#isotope');
|
||||||
|
@ -77,18 +72,28 @@ $(window).resize(function(){
|
||||||
$('#main-sidebar').css("height", viewportheight-30);
|
$('#main-sidebar').css("height", viewportheight-30);
|
||||||
$('#main-sidebar .viewport').css("height", viewportheight-30);
|
$('#main-sidebar .viewport').css("height", viewportheight-30);
|
||||||
$('.post-title').css("width", viewportwidth-495);
|
$('.post-title').css("width", viewportwidth-495);
|
||||||
$('#main-wrap > .subnav').css("width", viewportwidth-$mainWrapMarginLeft)
|
$('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft)
|
||||||
$('#main-sidebar').tinyscrollbar({size:(viewportheight-34)});
|
$('#main-sidebar').tinyscrollbar({size:(viewportheight-34)});
|
||||||
mainTablePosition()
|
mainTablePosition();
|
||||||
});
|
});
|
||||||
/*main-table position*/
|
/*main-table position*/
|
||||||
function mainTablePosition() {
|
function mainTablePosition() {
|
||||||
var $height = $('#main-wrap > .subnav').height()
|
var $height = $('#main-wrap .subnav').length && $('#main-wrap .subnav').height();
|
||||||
var $table = $('#main-wrap > .table')
|
var $table = $('.main-list').length && $('.main-list:last');
|
||||||
//alert ($table.height())
|
if($table && $table==0){
|
||||||
$table.stop().animate({marginTop:$height},500)
|
$table.css({marginTop:$height});
|
||||||
//$table.css({marginTop : $height})
|
}
|
||||||
}
|
else if($table){
|
||||||
|
if($height>0){
|
||||||
|
$height = $height-17;
|
||||||
|
}
|
||||||
|
$table.stop().animate({marginTop:$height},500);
|
||||||
|
}
|
||||||
|
else if($('#main-wrap .subnav')){
|
||||||
|
var $object = $('#main-wrap .subnav').next();
|
||||||
|
$object.css({marginTop:$height});
|
||||||
|
};
|
||||||
|
};
|
||||||
$(window).scroll(function () {
|
$(window).scroll(function () {
|
||||||
//var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-1;
|
//var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-1;
|
||||||
//var $subnavWidth = parseInt($('#main-wrap > .subnav').css("width"));
|
//var $subnavWidth = parseInt($('#main-wrap > .subnav').css("width"));
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
$(document).on('click', '.orbit-bar-member', function(){
|
||||||
|
$(this).hasClass('open') ? $(this).removeClass('open') : $(this).addClass('open');
|
||||||
|
$('.bar-login .dropdown-menu').toggle();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).click(function() {
|
||||||
|
$('.orbit-bar-member').removeClass("open");
|
||||||
|
$('.bar-login .dropdown-menu').hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.bar-login .dropdown-menu', function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
$('.bar-login .dropdown-menu').show();
|
||||||
|
});
|
|
@ -0,0 +1,20 @@
|
||||||
|
$(document).on('click', '.orbit-bar-search', function (){
|
||||||
|
if ($(this).parents('.search').hasClass('visible')){
|
||||||
|
$(this).parents('.search').stop().animate({
|
||||||
|
'width':'28px',
|
||||||
|
});
|
||||||
|
$(this).parents('.search').css({
|
||||||
|
'background-color': 'transparent',
|
||||||
|
});
|
||||||
|
$(this).parents('.search').removeClass('visible');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$(this).parents('.search').stop().animate({
|
||||||
|
'width':'265px',
|
||||||
|
});
|
||||||
|
$(this).parents('.search').css({
|
||||||
|
'background-color': 'rgba(0, 0, 0, 0.5)',
|
||||||
|
});
|
||||||
|
$(this).parents('.search').addClass('visible');
|
||||||
|
}
|
||||||
|
});
|
|
@ -1,31 +1,49 @@
|
||||||
$(function () {
|
var history_edited = false;
|
||||||
$('#back_sidebar a, #back_main a.nav').live('click',
|
|
||||||
|
$('#back_sidebar a, #back_main a.nav').live('click',
|
||||||
function () {
|
function () {
|
||||||
$.getScript(this.href);
|
$.getScript(this.href);
|
||||||
history.pushState(null, document.title, this.href);
|
history.pushState(null, document.title, this.href);
|
||||||
history_edited = true;
|
history_edited = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$('#back_main a.reload').live('click',
|
$('#back_main a.reload').live('click',
|
||||||
function () {
|
function () {
|
||||||
$.getScript(this.href);
|
$.getScript(this.href);
|
||||||
history.replaceState(null, document.title, this.href);
|
history.replaceState(null, document.title, this.href);
|
||||||
history_edited = true;
|
history_edited = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$('.form').live('submit', function () {
|
$('.form').live('submit', function () {
|
||||||
$.post(this.action, $(this).serialize(), null, 'script');
|
$.post(this.action, $(this).serialize(), null, 'script');
|
||||||
history_edited = true;
|
history_edited = true;
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window).bind("popstate", function () {
|
$(document).on('click', '.js_history',
|
||||||
|
function () {
|
||||||
|
$.getScript(this.href);
|
||||||
|
history.pushState(null, document.title, this.href);
|
||||||
|
history_edited = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
$(document).on('click', '.pagination a',
|
||||||
|
function () {
|
||||||
|
$.getScript(this.href);
|
||||||
|
history.pushState(null, document.title, this.href);
|
||||||
|
history_edited = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
$(window).bind("popstate", function () {
|
||||||
if (history_edited) {
|
if (history_edited) {
|
||||||
$.getScript(location.href);
|
$.getScript(location.href);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
});
|
|
@ -4,14 +4,13 @@ $(function() {
|
||||||
plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
|
plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
|
||||||
|
|
||||||
// Theme options
|
// Theme options
|
||||||
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
|
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect",
|
||||||
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
|
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,forecolor,backcolor",
|
||||||
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
|
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,fullscreen",
|
||||||
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
|
|
||||||
theme_advanced_toolbar_location : "top",
|
theme_advanced_toolbar_location : "top",
|
||||||
theme_advanced_toolbar_align : "left",
|
theme_advanced_toolbar_align : "left",
|
||||||
theme_advanced_statusbar_location : "bottom",
|
theme_advanced_statusbar_location : "bottom",
|
||||||
theme_advanced_resizing : false,
|
theme_advanced_resizing : true,
|
||||||
|
|
||||||
// Skin options
|
// Skin options
|
||||||
skin : "o2k7",
|
skin : "o2k7",
|
||||||
|
|
|
@ -98,10 +98,18 @@ h1, h2, h3, h4, h5, h6 {
|
||||||
border-radius: 0 0 4px 4px;
|
border-radius: 0 0 4px 4px;
|
||||||
}
|
}
|
||||||
table .span1-2 {
|
table .span1-2 {
|
||||||
width: 94px;
|
min-width: 85px;
|
||||||
|
float: none;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
table .span1-3 {
|
||||||
|
min-width: 200px;
|
||||||
float: none;
|
float: none;
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
.qe-block .form-horizontal .form-actions {
|
.qe-block .form-horizontal .form-actions {
|
||||||
text-align:right;
|
text-align:right;
|
||||||
}
|
}
|
||||||
|
.modal.fade {
|
||||||
|
top: -50%;
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
.checkblock {
|
||||||
|
display: inline-block;
|
||||||
|
float: left;
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
.check[type="checkbox"]{
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
.checkbox{
|
||||||
|
padding: 5px;
|
||||||
|
margin: 5px 5px 10px;
|
||||||
|
display: inline-block;
|
||||||
|
color:#777777;
|
||||||
|
text-shadow: 0 1px 0px rgba(255,255,255,.4);
|
||||||
|
border-radius: 3px;
|
||||||
|
-moz-border-radius: 3px;
|
||||||
|
-webkit-border-radius: 3px;
|
||||||
|
height: 30px;
|
||||||
|
position: relative;
|
||||||
|
cursor: pointer;
|
||||||
|
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) );
|
||||||
|
background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% );
|
||||||
|
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf');
|
||||||
|
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||||
|
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||||
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
.checkbox .check-icon {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
width: 26px;
|
||||||
|
height: 26px;
|
||||||
|
background: url('img/check.png') no-repeat left top;
|
||||||
|
right: -10px;
|
||||||
|
top: -5px;
|
||||||
|
}
|
||||||
|
.checkbox .member-name {
|
||||||
|
cursor: pointer;
|
||||||
|
font-family: helvetica;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 30px;
|
||||||
|
padding: 0 10px 0 40px;
|
||||||
|
color: #333333;
|
||||||
|
display: inline-block;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.member-avatar {
|
||||||
|
position: absolute;
|
||||||
|
width: 34px;
|
||||||
|
height: 34px;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-top: -2px;
|
||||||
|
}
|
||||||
|
img.member-img {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
.checked .check-icon {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.popover-inner {
|
||||||
|
width: auto;
|
||||||
|
display: inline-block;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.popover-title {
|
||||||
|
display: block;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: normal;
|
||||||
|
padding: 3px 10px;
|
||||||
|
}
|
||||||
|
.popover-content {
|
||||||
|
padding: 3px 10px;
|
||||||
|
color: #898989;
|
||||||
|
}
|
||||||
|
.popover-content p {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
|
@ -0,0 +1,205 @@
|
||||||
|
div.datepicker {
|
||||||
|
position: relative;
|
||||||
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
height: 147px;
|
||||||
|
cursor: default;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.datepickerContainer {
|
||||||
|
padding: 10px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
.datepickerBorderT {
|
||||||
|
position: absolute;
|
||||||
|
left: 10px;
|
||||||
|
top: 0;
|
||||||
|
right: 10px;
|
||||||
|
height: 10px;
|
||||||
|
background: url(../images/datepicker_t.png);
|
||||||
|
}
|
||||||
|
.datepickerBorderB {
|
||||||
|
position: absolute;
|
||||||
|
left: 10px;
|
||||||
|
bottom: 0;
|
||||||
|
right: 10px;
|
||||||
|
height: 10px;
|
||||||
|
background: url(../images/datepicker_b.png);
|
||||||
|
}
|
||||||
|
.datepickerBorderL {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
bottom: 10px;
|
||||||
|
top: 10px;
|
||||||
|
width: 10px;
|
||||||
|
background: url(../images/datepicker_l.png);
|
||||||
|
}
|
||||||
|
.datepickerBorderR {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
bottom: 10px;
|
||||||
|
top: 10px;
|
||||||
|
width: 10px;
|
||||||
|
background: url(../images/datepicker_r.png);
|
||||||
|
}
|
||||||
|
.datepickerBorderTL {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
background: url(../images/datepicker_tl.png);
|
||||||
|
}
|
||||||
|
.datepickerBorderTR {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
background: url(../images/datepicker_tr.png);
|
||||||
|
}
|
||||||
|
.datepickerBorderBL {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
background: url(../images/datepicker_bl.png);
|
||||||
|
}
|
||||||
|
.datepickerBorderBR {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
background: url(../images/datepicker_br.png);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
.datepickerHidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
div.datepicker table {
|
||||||
|
width: 260px;
|
||||||
|
border-collapse:collapse;
|
||||||
|
}
|
||||||
|
div.datepicker a {
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: default;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
div.datepicker table td {
|
||||||
|
text-align: right;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
div.datepicker th {
|
||||||
|
text-align: center;
|
||||||
|
color: #999;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
div.datepicker tbody th {
|
||||||
|
/*text-align: left;*/
|
||||||
|
}
|
||||||
|
div.datepicker tbody a {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.datepickerWeek a {
|
||||||
|
color: #F60;
|
||||||
|
}
|
||||||
|
.datepickerWeek a:hover {
|
||||||
|
color: #FC0 !important;
|
||||||
|
}
|
||||||
|
.datepickerDays a {
|
||||||
|
width: 20px;
|
||||||
|
line-height: 16px;
|
||||||
|
height: 16px;
|
||||||
|
padding-right: 2px;
|
||||||
|
}
|
||||||
|
.datepickerYears a,
|
||||||
|
.datepickerMonths a{
|
||||||
|
width: 44px;
|
||||||
|
line-height: 36px;
|
||||||
|
height: 36px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
td.datepickerNotInMonth a {
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
tbody.datepickerDays td.datepickerSelected{
|
||||||
|
background: #0088CC;
|
||||||
|
}
|
||||||
|
tbody.datepickerDays td.datepickerSelected a{
|
||||||
|
color: #FFF;
|
||||||
|
}
|
||||||
|
tbody.datepickerDays td.datepickerNotInMonth.datepickerSelected {
|
||||||
|
background: #17384d;
|
||||||
|
}
|
||||||
|
tbody.datepickerYears td.datepickerSelected,
|
||||||
|
tbody.datepickerMonths td.datepickerSelected{
|
||||||
|
background: #17384d;
|
||||||
|
}
|
||||||
|
div.datepicker a:hover,
|
||||||
|
div.datepicker a:hover {
|
||||||
|
color: #88c5eb;
|
||||||
|
}
|
||||||
|
div.datepicker td.datepickerNotInMonth a:hover {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
div.datepicker tbody th {
|
||||||
|
/*text-align: left;*/
|
||||||
|
}
|
||||||
|
.datepickerSpace div {
|
||||||
|
width: 20px;
|
||||||
|
}
|
||||||
|
.datepickerGoNext a,
|
||||||
|
.datepickerGoPrev a,
|
||||||
|
.datepickerMonth a {
|
||||||
|
text-align: center;
|
||||||
|
height: 20px;
|
||||||
|
line-height: 20px;
|
||||||
|
}
|
||||||
|
.datepickerGoNext a {
|
||||||
|
float: right;
|
||||||
|
width: 20px;
|
||||||
|
}
|
||||||
|
.datepickerGoPrev a {
|
||||||
|
float: left;
|
||||||
|
width: 20px;
|
||||||
|
}
|
||||||
|
table.datepickerViewDays tbody.datepickerMonths,
|
||||||
|
table.datepickerViewDays tbody.datepickerYears {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
table.datepickerViewMonths tbody.datepickerDays,
|
||||||
|
table.datepickerViewMonths tbody.datepickerYears,
|
||||||
|
table.datepickerViewMonths tr.datepickerDoW {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
table.datepickerViewYears tbody.datepickerDays,
|
||||||
|
table.datepickerViewYears tbody.datepickerMonths,
|
||||||
|
table.datepickerViewYears tr.datepickerDoW {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
td.datepickerDisabled a,
|
||||||
|
td.datepickerDisabled.datepickerNotInMonth a{
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
td.datepickerDisabled a:hover {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
td.datepickerSpecial a {
|
||||||
|
background: #700;
|
||||||
|
}
|
||||||
|
td.datepickerSpecial.datepickerSelected a {
|
||||||
|
background: #a00;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Layout*/
|
||||||
|
#widgetCalendar {
|
||||||
|
height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
}
|
|
@ -9,9 +9,9 @@
|
||||||
.main-list {
|
.main-list {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
.main-list thead th {
|
.main-wrap>.main-list thead th {
|
||||||
background-color: rgba(0,0,0,0.05);
|
background-color: transparent;
|
||||||
border-right: 1px solid #ddd;
|
border-right: medium none;
|
||||||
}
|
}
|
||||||
.main-list thead th:last-child {
|
.main-list thead th:last-child {
|
||||||
border-right: none;
|
border-right: none;
|
||||||
|
@ -29,19 +29,22 @@
|
||||||
}
|
}
|
||||||
.main-list tbody .quick-edit {
|
.main-list tbody .quick-edit {
|
||||||
position:relative;
|
position:relative;
|
||||||
height:40px;
|
height:20px;
|
||||||
}
|
}
|
||||||
.main-list tbody .quick-edit .nav {
|
.main-list tbody .quick-edit .nav {
|
||||||
/*left: -55px;*/
|
/*left: -55px;*/
|
||||||
position: absolute;
|
position: absolute;
|
||||||
/*top: -3px;*/
|
/*top: -3px;*/
|
||||||
width: 350px;
|
width: 350px;
|
||||||
|
left: -8px;
|
||||||
}
|
}
|
||||||
.main-list td {
|
.main-list td {
|
||||||
/*height:80px;*/
|
background-color: #FFFFFF;
|
||||||
|
border-bottom: 1px solid #DDDDDD;
|
||||||
|
border-top: medium none;
|
||||||
}
|
}
|
||||||
.main-list .nav {
|
.main-list .nav {
|
||||||
margin-top: 15px;
|
margin-top: 0;
|
||||||
margin-bottom: 3px;
|
margin-bottom: 3px;
|
||||||
}
|
}
|
||||||
.main-list tr.with_action:hover .hide {
|
.main-list tr.with_action:hover .hide {
|
||||||
|
@ -53,7 +56,7 @@
|
||||||
}
|
}
|
||||||
.main-list .label-td {
|
.main-list .label-td {
|
||||||
background-color: rgba(255, 255, 255, 1);
|
background-color: rgba(255, 255, 255, 1);
|
||||||
height: 60px;
|
height: 40px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -75,6 +78,15 @@
|
||||||
-moz-border-radius: 3px;
|
-moz-border-radius: 3px;
|
||||||
z-index: 5;
|
z-index: 5;
|
||||||
}
|
}
|
||||||
|
.table-label {
|
||||||
|
background-color: #F2F2F2;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.table-label .main-list thead th {
|
||||||
|
background-color: #F2F2F2;
|
||||||
|
border-right: 1px solid #DDDDDD;
|
||||||
|
border-top: 1px solid #DDDDDD !important;
|
||||||
|
}
|
||||||
.route-group .route {
|
.route-group .route {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
@ -109,6 +121,9 @@ legend {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
border-left: none;
|
border-left: none;
|
||||||
border-right: none;
|
border-right: none;
|
||||||
|
position: fixed;
|
||||||
|
top: 30px;
|
||||||
|
z-index: 50;
|
||||||
}
|
}
|
||||||
.subnav .nav > li:first-child > a, .subnav .nav > li:first-child > a:hover {
|
.subnav .nav > li:first-child > a, .subnav .nav > li:first-child > a:hover {
|
||||||
-moz-border-radius: 0;
|
-moz-border-radius: 0;
|
||||||
|
|
|
@ -2,7 +2,6 @@ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockq
|
||||||
-webkit-text-size-adjust:none;
|
-webkit-text-size-adjust:none;
|
||||||
}
|
}
|
||||||
html, body{
|
html, body{
|
||||||
background: url(<%= asset_path 'background.jpg' %>) repeat left top;
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
/*自定*/
|
/*自定*/
|
||||||
|
|
|
@ -49,18 +49,21 @@
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
#orbit-bar .navbar-search {
|
#orbit-bar .navbar-search {
|
||||||
float: none;
|
left: 28px;
|
||||||
margin: 0 auto;
|
margin: 0;
|
||||||
text-align: center;
|
position: absolute;
|
||||||
|
text-align: right;
|
||||||
|
top: -1px;
|
||||||
}
|
}
|
||||||
#orbit-bar .nav.pull-right {
|
#orbit-bar .nav.pull-right {
|
||||||
margin-right: -20px;
|
margin-right: -20px;
|
||||||
}
|
}
|
||||||
#orbit-bar .search-query {
|
#orbit-bar .search-query {
|
||||||
background-image: url(<%= asset_path 'main-search.png' %>);
|
padding: 4px 9px;
|
||||||
background-repeat: no-repeat;
|
height: 12px;
|
||||||
background-position: 5px 6px;
|
margin-top: 3px;
|
||||||
padding-left: 25px;
|
border: 1px solid #333333;
|
||||||
|
font-size: 11px;
|
||||||
/*background-color: rgba(255, 255, 255, 0.8);
|
/*background-color: rgba(255, 255, 255, 0.8);
|
||||||
color: #333;
|
color: #333;
|
||||||
text-shadow: 0px 1px 0px #FFF;*/
|
text-shadow: 0px 1px 0px #FFF;*/
|
||||||
|
@ -69,7 +72,7 @@
|
||||||
#orbit-bar .search-query:focus {
|
#orbit-bar .search-query:focus {
|
||||||
/*background-color: rgba(255, 255, 255, 0.9);
|
/*background-color: rgba(255, 255, 255, 0.9);
|
||||||
text-shadow: 0px 1px 0px #FFF;*/
|
text-shadow: 0px 1px 0px #FFF;*/
|
||||||
background-position: 6px 7px;
|
background-position: 5px 2px;
|
||||||
}
|
}
|
||||||
#orbit-bar .container {
|
#orbit-bar .container {
|
||||||
width:100%;
|
width:100%;
|
||||||
|
@ -104,11 +107,16 @@
|
||||||
text-indent: -9999px;
|
text-indent: -9999px;
|
||||||
padding:6px;
|
padding:6px;
|
||||||
}
|
}
|
||||||
|
#orbit-bar .nav > li.search {
|
||||||
|
overflow: hidden;
|
||||||
|
width: 28px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
#orbit-bar .nav > li > a.orbit-bar-home {
|
#orbit-bar .nav > li > a.orbit-bar-home {
|
||||||
background-position: -10px -10px;
|
background-position: -10px -10px;
|
||||||
}
|
}
|
||||||
#orbit-bar .nav > li > a.orbit-bar-desktop {
|
#orbit-bar .nav > li > a.orbit-bar-desktop {
|
||||||
background-position: -100px -4px;
|
background-position: -106px -9px;
|
||||||
}
|
}
|
||||||
#orbit-bar .nav > li > a.orbit-bar-member {
|
#orbit-bar .nav > li > a.orbit-bar-member {
|
||||||
background-position: -4px -37px;
|
background-position: -4px -37px;
|
||||||
|
@ -119,6 +127,10 @@
|
||||||
#orbit-bar .nav > li > a.orbit-bar-language {
|
#orbit-bar .nav > li > a.orbit-bar-language {
|
||||||
background-position: -42px -42px;
|
background-position: -42px -42px;
|
||||||
}
|
}
|
||||||
|
#orbit-bar .nav > li > a.orbit-bar-search {
|
||||||
|
background-position: -75px -10px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
.language-menu .active {
|
.language-menu .active {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
@ -143,6 +155,9 @@
|
||||||
float: left;
|
float: left;
|
||||||
max-width: 22px;
|
max-width: 22px;
|
||||||
}
|
}
|
||||||
|
#orbit-bar .clear {
|
||||||
|
clear: none;
|
||||||
|
}
|
||||||
#orbit-bar .account-menu {
|
#orbit-bar .account-menu {
|
||||||
right: 5px;
|
right: 5px;
|
||||||
}
|
}
|
||||||
|
@ -350,10 +365,6 @@
|
||||||
border-top: none;
|
border-top: none;
|
||||||
}
|
}
|
||||||
#post-body .editor {
|
#post-body .editor {
|
||||||
background-color: #333333;
|
|
||||||
height: 20px;
|
|
||||||
margin: 8px 0;
|
|
||||||
width: 100%;
|
|
||||||
}
|
}
|
||||||
#post-body-content {
|
#post-body-content {
|
||||||
margin-right: 320px;
|
margin-right: 320px;
|
||||||
|
@ -391,6 +402,9 @@
|
||||||
.filter .active a {
|
.filter .active a {
|
||||||
color: #FFF;
|
color: #FFF;
|
||||||
}
|
}
|
||||||
|
.filter form {
|
||||||
|
margin: 5px 10px;
|
||||||
|
}
|
||||||
.filters {
|
.filters {
|
||||||
background-color: rgba(0,0,0,0.075);
|
background-color: rgba(0,0,0,0.075);
|
||||||
-webkit-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2);
|
-webkit-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2);
|
||||||
|
@ -511,6 +525,26 @@
|
||||||
.active .web-symbol:after {
|
.active .web-symbol:after {
|
||||||
content: "}";
|
content: "}";
|
||||||
}
|
}
|
||||||
|
.img-peview {
|
||||||
|
margin-left: 12px;
|
||||||
|
}
|
||||||
|
.popover img {
|
||||||
|
max-height: 120px;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
.popover-inner {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
.popover-title {
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
.popover-content {
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
.popover-title {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
/*icons*/
|
/*icons*/
|
||||||
.the-icons i:after {
|
.the-icons i:after {
|
||||||
content: attr(class);
|
content: attr(class);
|
||||||
|
@ -629,6 +663,12 @@
|
||||||
.icons-unlock {
|
.icons-unlock {
|
||||||
background-position: -192px -32px;
|
background-position: -192px -32px;
|
||||||
}
|
}
|
||||||
|
.icons-time {
|
||||||
|
background-position: -448px -32px;
|
||||||
|
}
|
||||||
|
.icons-banner {
|
||||||
|
background-position: -608px -32px;
|
||||||
|
}
|
||||||
/*3*/
|
/*3*/
|
||||||
.icons-content {
|
.icons-content {
|
||||||
background-position: -160px -66px;
|
background-position: -160px -66px;
|
||||||
|
@ -777,6 +817,9 @@
|
||||||
background-position: -224px -320px;
|
background-position: -224px -320px;
|
||||||
}
|
}
|
||||||
/*12*/
|
/*12*/
|
||||||
|
.icons-check-2 {
|
||||||
|
background-position: -288px -352px;
|
||||||
|
}
|
||||||
.icons-star-thin {
|
.icons-star-thin {
|
||||||
background-position: -416px -352px;
|
background-position: -416px -352px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,32 +59,90 @@
|
||||||
}
|
}
|
||||||
.select-role {
|
.select-role {
|
||||||
display:none;
|
display:none;
|
||||||
overflow:hidden;
|
padding: 10px 0;
|
||||||
}
|
}
|
||||||
.file-upload {
|
.file-upload {
|
||||||
position:relative;
|
position:relative;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.file-upload .file-name {
|
.file-upload .file-name {
|
||||||
display: inline-block;
|
|
||||||
margin: 0 0 5px 5px;
|
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
width: 140px;
|
overflow: hidden;
|
||||||
|
border-style: solid;
|
||||||
|
border-width: 1px 1px 1px 0;
|
||||||
|
border-color: #CCC;
|
||||||
|
display: inline-block;
|
||||||
|
float: left;
|
||||||
|
padding: 4px 10px;
|
||||||
|
height: 18px;
|
||||||
|
line-height: 18px;
|
||||||
|
-webkit-border-radius: 0 3px 3px 0;
|
||||||
|
-moz-border-radius: 0 3px 3px 0;
|
||||||
|
border-radius: 0 3px 3px 0;
|
||||||
|
text-align: left;
|
||||||
|
margin: 0;
|
||||||
|
width: 182px;
|
||||||
}
|
}
|
||||||
.file-upload .upload {
|
.file-upload .upload {
|
||||||
margin:0;
|
margin:0;
|
||||||
padding:0;
|
padding:0;
|
||||||
position:absolute;
|
position:absolute;
|
||||||
top:0;
|
top: 0;
|
||||||
left:0;
|
left:0;
|
||||||
opacity:.0;
|
opacity:.0;
|
||||||
filter: alpha(opacity=100);
|
font-size: 60px;
|
||||||
|
left: -595px/9;
|
||||||
|
filter: alpha(opacity: 0);
|
||||||
|
outline: none;
|
||||||
}
|
}
|
||||||
.file-upload .upload:focus {
|
.file-upload .upload:focus {
|
||||||
position:absolute;
|
position:absolute;
|
||||||
}
|
}
|
||||||
.upload-picture {
|
.upload-picture {
|
||||||
margin-right: 5px;
|
margin-bottom: 5px;
|
||||||
|
text-align: center;
|
||||||
|
width: 276px;
|
||||||
|
overflow: hidden;
|
||||||
|
height: 90px;
|
||||||
|
}
|
||||||
|
.upload-picture img {
|
||||||
|
left: 0;
|
||||||
|
margin-top: -15%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.widget-box .widgetInfo {
|
||||||
|
display: inline-block;
|
||||||
|
text-align: center;
|
||||||
|
width: 255px;
|
||||||
|
margin : 0px 0 5px;
|
||||||
|
padding: 5px 10px;
|
||||||
|
}
|
||||||
|
.file-upload .input-medium {
|
||||||
|
border-radius: 3px 3px 3px 3px !important;
|
||||||
|
width: 267px;
|
||||||
|
position: relative;
|
||||||
|
z-index: 5;
|
||||||
}
|
}
|
||||||
#widget-link table {
|
#widget-link table {
|
||||||
margin-bottom:0
|
margin-bottom:0
|
||||||
}
|
}
|
||||||
|
/*Date*/
|
||||||
|
.showDate {
|
||||||
|
border-style: solid;
|
||||||
|
border-width: 1px 0 1px 1px;
|
||||||
|
border-color: #CCC;
|
||||||
|
display: inline-block;
|
||||||
|
float: left;
|
||||||
|
padding: 4px 10px;
|
||||||
|
height: 18px;
|
||||||
|
line-height: 18px;
|
||||||
|
-webkit-border-radius: 3px 0 0 3px;
|
||||||
|
-moz-border-radius: 3px 0 0 3px;
|
||||||
|
border-radius: 3px 0 0 3px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.calendarInput {
|
||||||
|
position: absolute;
|
||||||
|
visibility: hidden;
|
||||||
|
left: 11px;
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
class Admin::AdBannersController < ApplicationController
|
class Admin::AdBannersController < ApplicationController
|
||||||
layout "admin"
|
layout "new_admin"
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
before_filter :is_admin?
|
before_filter :is_admin?
|
||||||
|
|
||||||
|
@ -10,11 +10,14 @@ class Admin::AdBannersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@ad_banner = AdBanner.find(params[:id])
|
@ad_banners = AdBanner.all
|
||||||
|
@active = AdBanner.find(params[:id])
|
||||||
|
render :action => 'index'
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@ad_banner = AdBanner.new
|
@ad_banners = AdBanner.all
|
||||||
|
render :action => 'index',:params => 'new'
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
@ -36,8 +39,13 @@ class Admin::AdBannersController < ApplicationController
|
||||||
redirect_to admin_ad_banners_url
|
redirect_to admin_ad_banners_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def destroy_ad_image
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@ad_banners = AdBanner.all
|
@ad_banners = AdBanner.all
|
||||||
|
@active = @ad_banners.first
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -0,0 +1,47 @@
|
||||||
|
class Admin::AdImagesController < ApplicationController
|
||||||
|
layout 'new_admin'
|
||||||
|
before_filter :authenticate_user!
|
||||||
|
before_filter :is_admin?
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@ad_banner = AdBanner.find params[:ad_banner_id]
|
||||||
|
@ad_image = @ad_banner.ad_images.find params[:id]
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@ad_banner = AdBanner.find params[:ad_banner_id]
|
||||||
|
@ad_image = AdImage.find params[:id]
|
||||||
|
@ad_image.update_attributes(params[:ad_image])
|
||||||
|
@ad_image.to_save = true
|
||||||
|
@ad_image.save!
|
||||||
|
redirect_to admin_ad_banner_path @ad_banner
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@ad_image =AdImage.new
|
||||||
|
#render :action => 'new',:url=> {:ad_banner_id => params.has_key?(:ad_banner_id)? params[:ad_banner_id],nil}
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@ad_banner = AdBanner.find params[:ad_banner][:id]
|
||||||
|
ad_image = AdImage.new params[:ad_image]
|
||||||
|
ad_image.to_save = true
|
||||||
|
@ad_banner.ad_images << ad_image
|
||||||
|
|
||||||
|
if @ad_banner.save!
|
||||||
|
redirect_to admin_ad_banner_path @ad_banner
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@ad_banner = AdBanner.find params[:ad_banner_id]
|
||||||
|
@ad_image = @ad_banner.ad_images.find params[:id]
|
||||||
|
if @ad_image.destroy
|
||||||
|
flash[:notice] = t('admin.success_destroy_ad_image')
|
||||||
|
redirect_to admin_ad_banner_path @ad_banner
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
|
@ -47,7 +47,7 @@ class ApplicationController < ActionController::Base
|
||||||
# Render the page
|
# Render the page
|
||||||
def render_page(id = nil)
|
def render_page(id = nil)
|
||||||
if @item
|
if @item
|
||||||
render :text => parse_page(@item, id)
|
render :text => process_page(@item, id), :layout => 'page_layout'
|
||||||
else
|
else
|
||||||
render :text => '404 Not Found'
|
render :text => '404 Not Found'
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@ require 'mongo'
|
||||||
class GridfsController < ActionController::Metal
|
class GridfsController < ActionController::Metal
|
||||||
|
|
||||||
def serve
|
def serve
|
||||||
gridfs_path = env["PATH_INFO"].gsub("/gridfs/", "")
|
gridfs_path = env["PATH_INFO"].gsub("/gridfs/", "").force_encoding("UTF-8")
|
||||||
begin
|
begin
|
||||||
gridfs_file = Mongo::GridFileSystem.new(Mongoid.database).open(gridfs_path, 'r')
|
gridfs_file = Mongo::GridFileSystem.new(Mongoid.database).open(gridfs_path, 'r')
|
||||||
self.response_body = gridfs_file.read
|
self.response_body = gridfs_file.read
|
||||||
|
|
|
@ -6,7 +6,7 @@ class OrbitBackendController< ApplicationController
|
||||||
include OrbitCoreLib::PermissionUnility
|
include OrbitCoreLib::PermissionUnility
|
||||||
include AdminHelper
|
include AdminHelper
|
||||||
|
|
||||||
layout 'admin'
|
layout 'new_admin'
|
||||||
|
|
||||||
def setup_vars
|
def setup_vars
|
||||||
@app_title = request.fullpath.split('/')[2]
|
@app_title = request.fullpath.split('/')[2]
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
class PagesController < ApplicationController
|
class PagesController < ApplicationController
|
||||||
|
|
||||||
|
include ApplicationHelper
|
||||||
|
|
||||||
before_filter :get_item, :only => [:index_from_link, :show_from_link]
|
before_filter :get_item, :only => [:index_from_link, :show_from_link]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -1,2 +1,16 @@
|
||||||
module Admin::AdBannerHelper
|
module Admin::AdBannerHelper
|
||||||
|
def preview_block_ad_images_helper(ad_banner)
|
||||||
|
printable_ad_images = []
|
||||||
|
ad_banner.ad_images.each do |ad_image|
|
||||||
|
if ad_image.display?
|
||||||
|
ad_image.weight.times do
|
||||||
|
printable_ad_images << ad_image
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
printable_ad_images.shuffle!
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
|
@ -0,0 +1,7 @@
|
||||||
|
module Admin::AdImagesHelper
|
||||||
|
|
||||||
|
def active_when_default_locale_eq locale
|
||||||
|
locale.to_sym == I18n.default_locale ? 'active': ''
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -2,6 +2,12 @@ module ApplicationHelper
|
||||||
|
|
||||||
FLASH_NOTICE_KEYS = [:error, :notice, :warning]
|
FLASH_NOTICE_KEYS = [:error, :notice, :warning]
|
||||||
|
|
||||||
|
def site_valid_locales_default_head
|
||||||
|
index = @site_valid_locales.rindex I18n.default_locale.to_s
|
||||||
|
shift_out = @site_valid_locales.shift(index)
|
||||||
|
@site_valid_locales += shift_out
|
||||||
|
end
|
||||||
|
|
||||||
def colorize_in_use_locale(locale)
|
def colorize_in_use_locale(locale)
|
||||||
@site_in_use_locales.include?(locale)? 'green' : 'red'
|
@site_in_use_locales.include?(locale)? 'green' : 'red'
|
||||||
end
|
end
|
||||||
|
@ -77,7 +83,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def active_for_action(controller_name, action_name)
|
def active_for_action(controller_name, action_name)
|
||||||
(controller.controller_name.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 sortable(column)
|
def sortable(column)
|
||||||
|
@ -96,15 +102,55 @@ module ApplicationHelper
|
||||||
' web-symbol' if params[:sort].eql?(name)
|
' web-symbol' if params[:sort].eql?(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_filter(param_name, value)
|
def is_filter_active?(type, id)
|
||||||
filter = params[:filter] rescue nil
|
' active' if (@filter[type].include?(id.to_s) rescue nil)
|
||||||
if filter && filter.has_key(param_name)
|
|
||||||
filter[param_name] << value
|
|
||||||
elsif filter
|
|
||||||
filter.merge({param_name => [value]})
|
|
||||||
else
|
|
||||||
{param_name => [value]}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def process_page(page, id)
|
||||||
|
parse_page_noko(page, id)
|
||||||
|
end
|
||||||
|
|
||||||
|
def page_metas(page)
|
||||||
|
metas = ''
|
||||||
|
@site.page_metas.each do |meta|
|
||||||
|
name, content = meta.get_name_content
|
||||||
|
metas << "<meta name=#{name} content=#{content} />\n"
|
||||||
|
end rescue nil
|
||||||
|
return metas
|
||||||
|
end
|
||||||
|
|
||||||
|
def page_title(page)
|
||||||
|
"<title>#{page.title ? page.title[I18n.locale] : page.i18n_variable[I18n.locale]}</title>\n"
|
||||||
|
end
|
||||||
|
|
||||||
|
def page_stylesheets(page)
|
||||||
|
stylesheets = ''
|
||||||
|
stylesheets << "<link href='/assets/bootstrap.css.erb' 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.erb' rel='stylesheet' type='text/css' />\n"
|
||||||
|
stylesheets << "<link href='#{page.design.reset_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.reset_css
|
||||||
|
stylesheets << "<link href='#{page.design.default_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.default_css
|
||||||
|
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
|
||||||
|
end
|
||||||
|
|
||||||
|
def page_javascripts(page)
|
||||||
|
javascripts = ''
|
||||||
|
javascripts << "<script type='text/javascript' src='/static/jquery.js'></script>\n"
|
||||||
|
javascripts << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>\n"
|
||||||
|
javascripts << "<script type='text/javascript' src='/static/kernel.js'></script>\n"
|
||||||
|
javascripts << "<script type='text/javascript' src='/assets/bootstrap.js'></script>\n"
|
||||||
|
javascripts << "<script type='text/javascript' src='/assets/jquery.tinyscrollbar.min.js'></script>\n"
|
||||||
|
javascripts << "<script type='text/javascript' src='/assets/jquery.isotope.min.js'></script>\n"
|
||||||
|
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-member.js'></script>\n"
|
||||||
|
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-search.js'></script>\n"
|
||||||
|
javascripts << "<script type='text/javascript' src='/assets/orbit_bar.js'></script>\n"
|
||||||
|
javascripts << "<script type='text/javascript' src='/assets/event.js'></script>\n"
|
||||||
|
page.design.javascripts.each do |js|
|
||||||
|
# javascripts << "<script type='text/javascript' src='#{js.file.url}'></script>"
|
||||||
|
end
|
||||||
|
javascripts
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,41 +4,32 @@ class AdBanner
|
||||||
include Mongoid::MultiParameterAttributes
|
include Mongoid::MultiParameterAttributes
|
||||||
|
|
||||||
field :title
|
field :title
|
||||||
field :picture_position
|
field :transition_sec,type: Integer
|
||||||
field :post_date,type: Date
|
|
||||||
field :unpost_date,type: Date
|
|
||||||
field :context
|
|
||||||
field :direct_to_after_click,type: Boolean
|
|
||||||
field :ad_fx #TODO Design should explain
|
field :ad_fx #TODO Design should explain
|
||||||
|
|
||||||
|
|
||||||
before_save :save_or_destroy
|
before_save :save_or_destroy
|
||||||
|
validates_uniqueness_of :title
|
||||||
embeds_many :ad_images, :cascade_callbacks => true
|
has_many :ad_images , dependent: :delete
|
||||||
|
|
||||||
FX_TYPES = ["blindX","blindY","blindZ","cover","curtainX","curtainY","fade","fadeZoom","growX","growY","scrollUp","scrollDown","scrollLeft","scrollRight","scrollHorz","scrollVert","shuffle","slideX","slideY","toss","turnUp","turnDown","turnLeft","turnRight","uncover","wipe","zoom"]
|
FX_TYPES = ["blindX","blindY","blindZ","cover","curtainX","curtainY","fade","fadeZoom","growX","growY","scrollUp","scrollDown","scrollLeft","scrollRight","scrollHorz","scrollVert","shuffle","slideX","slideY","toss","turnUp","turnDown","turnLeft","turnRight","uncover","wipe","zoom"]
|
||||||
|
|
||||||
def display?
|
|
||||||
if (self.post_date <= Date.today && (self.unpost_date.nil? || self.unpost_date>= Date.today))
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
def new_ad_images=(*attrs)
|
# def new_ad_images(*attrs)
|
||||||
attrs[0].each do |attr| #Loop by JSs,Themes,Imgs
|
# debugger
|
||||||
unless attr[:file].nil?
|
# a=1
|
||||||
self.ad_images << AdImage.new(attr)
|
# attrs[0].each do |attr| #Loop by JSs,Themes,Imgs
|
||||||
end
|
# unless attr[:file].nil?
|
||||||
end
|
# self.ad_images << AdImage.new(attr)
|
||||||
end
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
def existing_ad_images=(*attrs)
|
# def existing_ad_images=(*attrs)
|
||||||
attrs[0].each do |attr| #Loop by JSs,Themes,Imgs
|
# attrs[0].each do |attr| #Loop by JSs,Themes,Imgs
|
||||||
ad_image = self.ad_images.find attr[0]
|
# ad_image = self.ad_images.find attr[0]
|
||||||
ad_image.update_attributes(attr[1])
|
# ad_image.update_attributes(attr[1])
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
|
|
||||||
def save_or_destroy
|
def save_or_destroy
|
||||||
self.ad_images.each do |ad_image|
|
self.ad_images.each do |ad_image|
|
||||||
|
|
|
@ -4,18 +4,45 @@ class AdImage
|
||||||
|
|
||||||
mount_uploader :file, ImageUploader
|
mount_uploader :file, ImageUploader
|
||||||
|
|
||||||
field :time_to_next #Weight
|
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
field :picture_intro
|
has_one :context, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
field :out_link
|
|
||||||
field :link_open
|
field :direct_to_after_click,type: Boolean
|
||||||
|
|
||||||
|
field :weight ,type: Integer ,default: 1
|
||||||
|
field :out_link #the link itself
|
||||||
|
field :link_open #how will the link be opened
|
||||||
|
LINK_OPEN_TYPES = ["new_window","local"]
|
||||||
|
|
||||||
|
field :post_date,type: Date
|
||||||
|
field :unpost_date,type: Date
|
||||||
|
|
||||||
field :to_save, :type => Boolean
|
field :to_save, :type => Boolean
|
||||||
field :to_destroy, :type => Boolean
|
field :to_destroy, :type => Boolean
|
||||||
|
|
||||||
LINK_OPEN_TYPES = ["new_window","local"]
|
belongs_to :ad_banner
|
||||||
|
|
||||||
|
# validates_numericality_of :weight, greater_than_or_equal_to: 1,less_than_or_equal_to: 10
|
||||||
|
# validates_format_of :out_link, with: /(http:\/\/.*|)/ ,:message => 'Need a valid URL'
|
||||||
|
# validates_presence_of :post_date,:message => 'Need a valid post date'
|
||||||
|
attr_reader :parse_post_date,:parse_unpost_date
|
||||||
|
|
||||||
|
def parse_post_date=(att)
|
||||||
|
self.post_date = (Date.parse att rescue nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
embedded_in :ad_banner
|
def parse_unpost_date=(att)
|
||||||
|
self.unpost_date = (Date.parse att rescue nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
def display?
|
||||||
|
if (self.post_date <= Date.today && (self.unpost_date.nil? || self.unpost_date>= Date.today) rescue false)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
def get_delay_time
|
def get_delay_time
|
||||||
time = ''
|
time = ''
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
class Design
|
class Design
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
|
include ParserLayout
|
||||||
|
|
||||||
field :title
|
field :title
|
||||||
field :author
|
field :author
|
||||||
|
@ -14,7 +15,7 @@ class Design
|
||||||
embeds_one :reset_css, :class_name => "Stylesheet", :cascade_callbacks => true
|
embeds_one :reset_css, :class_name => "Stylesheet", :cascade_callbacks => true
|
||||||
embeds_many :themes, :cascade_callbacks => true
|
embeds_many :themes, :cascade_callbacks => true
|
||||||
embeds_many :javascripts, :cascade_callbacks => true
|
embeds_many :javascripts, :cascade_callbacks => true
|
||||||
embeds_many :images, :cascade_callbacks => true
|
embeds_many :images, :as => :design_image, :cascade_callbacks => true
|
||||||
# embeds_many :custom_images, :class_name => 'Image', :cascade_callbacks => true
|
# embeds_many :custom_images, :class_name => 'Image', :cascade_callbacks => true
|
||||||
|
|
||||||
validates_presence_of :title
|
validates_presence_of :title
|
||||||
|
@ -65,9 +66,6 @@ class Design
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def parse_css_for_images
|
def parse_css_for_images
|
||||||
self.images.each do |image|
|
|
||||||
image.save
|
|
||||||
end
|
|
||||||
if (self.default_css && self.default_css.changed)
|
if (self.default_css && self.default_css.changed)
|
||||||
self.default_css.parse_urls
|
self.default_css.parse_urls
|
||||||
end
|
end
|
||||||
|
@ -76,6 +74,7 @@ class Design
|
||||||
theme.parse_urls
|
theme.parse_urls
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
parse_body_for_images(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,6 +3,8 @@ class Layout < DesignFile
|
||||||
|
|
||||||
attr_reader :content
|
attr_reader :content
|
||||||
|
|
||||||
|
field :body
|
||||||
|
|
||||||
embeds_one :menu
|
embeds_one :menu
|
||||||
embedded_in :design
|
embedded_in :design
|
||||||
embeds_many :layout_parts
|
embeds_many :layout_parts
|
||||||
|
@ -18,7 +20,9 @@ class Layout < DesignFile
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_layout
|
def parse_layout
|
||||||
parse_layout_contents(self)
|
html = Nokogiri::HTML(self.file.read)
|
||||||
|
self.body = html.at_css("body").inner_html
|
||||||
|
parse_body(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,6 +27,7 @@ class Stylesheet < DesignFile
|
||||||
temp_file = File.new(dir + '/' + orig_file_name, 'w+')
|
temp_file = File.new(dir + '/' + orig_file_name, 'w+')
|
||||||
temp_file.write content.force_encoding("UTF-8")
|
temp_file.write content.force_encoding("UTF-8")
|
||||||
self.file = temp_file
|
self.file = temp_file
|
||||||
|
self.save
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
class Meta
|
||||||
|
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :key
|
||||||
|
field :value, :default => nil
|
||||||
|
|
||||||
|
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
|
|
||||||
|
def get_name_content
|
||||||
|
[self.key, self.value ? self.value : self.i18n_variable[I18n.locale]]
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,11 @@
|
||||||
|
class Meta
|
||||||
|
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :key
|
||||||
|
field :value, :default => nil
|
||||||
|
|
||||||
|
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
class PageMeta < Meta
|
||||||
|
|
||||||
|
belongs_to :page
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
class SiteMeta < Meta
|
||||||
|
|
||||||
|
belongs_to :site
|
||||||
|
|
||||||
|
end
|
|
@ -1,6 +1,6 @@
|
||||||
class ObjectAuth < PrototypeAuth
|
class ObjectAuth < PrototypeAuth
|
||||||
include OrbitCoreLib::ObjectTokenUnility
|
include OrbitCoreLib::ObjectTokenUnility
|
||||||
validates_uniqueness_of :obj_authable_type,:scope => :title #{ |c| }
|
validates_uniqueness_of :title ,:scope => [:obj_authable_type,:obj_authable_id] #{ |c| }
|
||||||
belongs_to :obj_authable, polymorphic: true
|
belongs_to :obj_authable, polymorphic: true
|
||||||
# > - Something.find_with_auth(query)
|
# > - Something.find_with_auth(query)
|
||||||
# > - or Something.find(query).auth
|
# > - or Something.find(query).auth
|
||||||
|
|
|
@ -6,11 +6,13 @@ class Page < Item
|
||||||
|
|
||||||
belongs_to :design
|
belongs_to :design
|
||||||
belongs_to :module_app
|
belongs_to :module_app
|
||||||
|
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
has_many :page_parts, :autosave => true, :dependent => :destroy
|
has_many :page_parts, :autosave => true, :dependent => :destroy
|
||||||
has_many :page_contexts, :autosave => true, :dependent => :destroy
|
has_many :page_contexts, :autosave => true, :dependent => :destroy
|
||||||
|
has_many :page_metas, :autosave => true, :dependent => :destroy
|
||||||
accepts_nested_attributes_for :page_parts, :allow_destroy => true
|
accepts_nested_attributes_for :page_parts, :allow_destroy => true
|
||||||
|
|
||||||
before_save :create_parts
|
before_save :create_parts, :set_key
|
||||||
|
|
||||||
# embeds_many :custom_images, :class_name => 'Image', as: :design_image
|
# embeds_many :custom_images, :class_name => 'Image', as: :design_image
|
||||||
|
|
||||||
|
@ -18,6 +20,10 @@ class Page < Item
|
||||||
self.parent ? false : true
|
self.parent ? false : true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def title
|
||||||
|
@title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def create_parts
|
def create_parts
|
||||||
|
@ -27,4 +33,10 @@ class Page < Item
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_key
|
||||||
|
if title && title.new_record?
|
||||||
|
title.key = 'title'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,6 +13,8 @@ class Site
|
||||||
field :school
|
field :school
|
||||||
field :department
|
field :department
|
||||||
|
|
||||||
|
has_many :site_metas, :autosave => true, :dependent => :destroy
|
||||||
|
|
||||||
def generate_keys
|
def generate_keys
|
||||||
private_key = OpenSSL::PKey::RSA.generate(2048)
|
private_key = OpenSSL::PKey::RSA.generate(2048)
|
||||||
self.public_key = private_key.public_key.to_s
|
self.public_key = private_key.public_key.to_s
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<script type="text/javascript" src="/static/jquery.cycle.all.latest.js"></script>
|
||||||
|
<div class="tab-pane <%= "active" if ad_banner_tab==@active %>" id=<%= ad_banner_tab.title %>>
|
||||||
|
<p>尺寸:</p>
|
||||||
|
|
||||||
|
<%= form_for ad_banner_tab,:url=> admin_ad_banner_path(ad_banner_tab),:method => :put,:class=>"input-medium" do |f| -%>
|
||||||
|
<%= f.label :ad_fx, t('admin.ad.ab_fx') %>
|
||||||
|
<%= f.select :ad_fx ,AdBanner::FX_TYPES %>
|
||||||
|
<%= f.label :transition_sec, t('admin.ad.transition_sec') %>
|
||||||
|
<%= f.text_field :transition_sec,:placeholder=>"3秒請輸入3000",:class=> "span3" %> <%= t("admin.ad.trans_unit_sec") %>
|
||||||
|
<%= f.submit %>
|
||||||
|
<%= f.submit 'Cancel',:type=>'reset' %>
|
||||||
|
<div>
|
||||||
|
<%= render :partial => "ad_image_update", :collection => ad_banner_tab.ad_images,:as => :ad_image,:locals=>{:ad_banner => ad_banner_tab} %>
|
||||||
|
<%#= render :partial => 'new_add_banner_file', :object => ad_banner_tab.ad_images.build, :locals => { :field_name => "new_ad_images[]", :f => f, :classes => "r_destroy" } %>
|
||||||
|
<%= link_to 'Add AdImage',new_admin_ad_banner_ad_image_path(ad_banner_tab) %>
|
||||||
|
</div>
|
||||||
|
<% end -%>
|
||||||
|
<%= render :partial => 'preview_block',:locals=> {:ad_banner =>ad_banner_tab} %>
|
||||||
|
</div>
|
|
@ -1,8 +0,0 @@
|
||||||
<div id="basic_block" class="roles_block">
|
|
||||||
<%= image_tag ad_image.file %>
|
|
||||||
<p>
|
|
||||||
Time to next: <%= ad_image.time_to_next %>
|
|
||||||
Intro: <%= ad_image.picture_intro %>
|
|
||||||
Out Link <%= link_to ad_image.out_link %> by <%= ad_image.link_open %>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
|
@ -1,5 +0,0 @@
|
||||||
Time: <%= f.text_field :time_to_next ,:class=> 'ad_time'%>
|
|
||||||
Link:<%= f.text_field :out_link ,:class=> 'ad_out_link'%>
|
|
||||||
Open Type <%= f.select :link_open ,AdImage::LINK_OPEN_TYPES %>
|
|
||||||
|
|
||||||
<%= f.hidden_field :to_save %>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<div id="basic_block" class="roles_block">
|
|
||||||
<%= image_tag ad_image.file %>
|
|
||||||
<p>
|
|
||||||
Time to next: <%= ad_image.time_to_next %>
|
|
||||||
Intro: <%= ad_image.picture_intro %>
|
|
||||||
Out Link <%= link_to ad_image.out_link %> by <%= ad_image.link_open %>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
|
@ -1,9 +1,12 @@
|
||||||
<%= fields_for "ad_banner[existing_ad_images][#{ad_image.id}]", ad_image do |f| %>
|
<li class="span3" id = 'asd'>
|
||||||
<%= image_tag ad_image.file %>
|
<%= image_tag ad_image.file %>
|
||||||
<div>
|
<p>
|
||||||
Destroy?<%= f.check_box :to_destroy %>
|
<%= ad_image.display? ? '[Showing]' : '[NotShawing]' %>
|
||||||
<%= render :partial => "ad_image_form", :locals => { :f => f } %>
|
<%= "#{ad_image.post_date ||'NeedReset' }~#{ad_image.unpost_date || 'NeedReset'}" %>
|
||||||
</div>
|
</p>
|
||||||
<% end %>
|
<p>
|
||||||
|
<%= link_to 'Edit',edit_admin_ad_banner_ad_image_path(ad_banner,ad_image),:class => 'btn btn-primary' %>
|
||||||
|
<%= link_to 'Del',admin_ad_banner_ad_image_path(ad_banner,ad_image),:class => 'btn',:method => :delete,:confirm => t('sure?') %>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
<% content_for :page_specific_css do %>
|
|
||||||
<%#= javascript_include_tag "ad_banner" #this line wont work %>
|
|
||||||
<script type="text/javascript" src="<%= asset_path 'ad_banner' %>"></script>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<%= f.label :title, t('admin.title') %>
|
|
||||||
<%= f.text_field :title, :class => 'text' %>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<%= f.label :picture_position, t('admin.picture_position') %>
|
|
||||||
<%= f.text_field :picture_position, :class => 'text' %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<%= f.label :post_date, t('admin.post_date') %>
|
|
||||||
<%= f.date_select :post_date, :order => [:year, :month, :day], :use_month_numbers => true %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<%= f.label :unpost_date, t('admin.unpost_date') %>
|
|
||||||
<%= f.date_select :unpost_date, :order => [:year, :month, :day], :use_month_numbers => true,:prompt => { :day => t('form.date_unlimited'), :month => t('form.date_unlimited'), :year => t('form.date_unlimited') } %>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<%= f.label :context, t('admin.context') %>
|
|
||||||
<%= f.text_field :context, :class => 'text' %>
|
|
||||||
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<%= f.label :direct_to_after_click, t('admin.direct_to_after_click') %>
|
|
||||||
<%= f.check_box :direct_to_after_click %>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<%= f.label :ad_fx, t('admin.ad_fx') %>
|
|
||||||
<%= f.select :ad_fx ,AdBanner::FX_TYPES %>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<%#= f.label :ad_images, t('admin.ad_images') %>
|
|
||||||
|
|
||||||
<%# @ad_banner.ad_images.each do |ad_image| %>
|
|
||||||
<%#= render :partial => 'ad_image_update', :object => ad_image, :locals => { :field_name => "ad_images", :f => f, :classes => "r_destroy, r_edit" } %>
|
|
||||||
<%# end %>
|
|
||||||
<%= render :partial => "ad_image_update", :collection => @ad_banner.ad_images,:as => :ad_image, %>
|
|
||||||
<ul id="new_add_banner_file_holder"></ul>
|
|
||||||
<%= render :partial => 'new_add_banner_file', :object => @ad_banner.ad_images.build, :locals => { :field_name => "new_ad_images[]", :f => f, :classes => "r_destroy" } %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
|
|
||||||
|
|
||||||
<%#= render :partial => 'new_design_file', :object => @design.themes.build, :locals => { :field_name => "themes", :f => f, :classes => "r_destroy" } %>
|
|
||||||
</p>
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
|
||||||
|
<div id="new-a-banner" class="modal fade in tab-pane <%= 'active' if @active.nil? %>">
|
||||||
|
<%= form_for(:ad_banner,:remote => true, :url => admin_ad_banners_path) do |f| %>
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<a class="close" data-dismiss="modal">×</a>
|
||||||
|
<h3>Add AdBanner</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-body form-horizontal">
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :title,t('admin.ad.title'),:class => "control-label" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :title %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :transition_sec, t('admin.ad.transition_sec'),:class => "control-label" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :transition_sec %> <%= t("admin.ad.trans_unit_sec") %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :ad_fx, t('admin.ad.ab_fx') %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.select :ad_fx ,AdBanner::FX_TYPES %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
||||||
|
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript" charset="utf-8">
|
||||||
|
if(window.location.pathname == "/admin/ad_banners/new"){
|
||||||
|
$('#new-a-banner').modal({show: true});
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#new_ad_banner_tab_but').on('shown', function (e) {
|
||||||
|
$('#new-a-banner').modal({show: true});
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#new-a-banner').on('shown', function (e) {
|
||||||
|
alert('show!');
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#new-a-banner').on('hidden', function (e) {
|
||||||
|
$(".nav.nav-tabs a[id!='new_ad_banner_tab_but']:last").tab('show');
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<%= f.fields_for field_name, new_add_banner_file do |f| %>
|
<%= f.fields_for field_name, new_add_banner_file do |f| %>
|
||||||
<p class="new_file">
|
<p class="new_file">
|
||||||
<%= f.file_field :file %>
|
<%= f.file_field :file %>
|
||||||
<%= render :partial => "ad_image_form", :locals => { :f => f } %>
|
<%#= render :partial => "ad_image_form", :locals => { :f => f } %>
|
||||||
<%= button_tag '+', :class => "multi_files"%>
|
<%= button_tag '+', :class => "multi_files"%>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
|
@ -0,0 +1,29 @@
|
||||||
|
<% if ad_banner -%>
|
||||||
|
<%= link_to 'Preview',"#slideshow-#{ad_banner.title.dehumanize}",:class=>"btn btn-primary btn-large",:data=>{:toggle=>'modal'} %>
|
||||||
|
|
||||||
|
<div class="modal hide fade in" id='slideshow-<%=ad_banner.title.dehumanize%>'>
|
||||||
|
<div class="modal-header">
|
||||||
|
<a class="close" data-dismiss="modal">×</a>
|
||||||
|
<h3>Modal header</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p class="ad_banner_slideshow">
|
||||||
|
<% preview_block_ad_images_helper(ad_banner).each do |ad_image| -%>
|
||||||
|
<%= image_tag ad_image.file,:alt => (ad_image.title[locale] || ' '),:time_to_next => ad_banner.transition_sec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || ' ')) %>
|
||||||
|
<% end -%>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<a href="#" class="btn" data-dismiss="modal">Close</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
|
<script type='text/javascript' src='/static/kernel.js'></script>
|
||||||
|
<script type='text/javascript'>
|
||||||
|
$('#slideshow-<%=ad_banner.title.dehumanize%>').on('show', function () {
|
||||||
|
$('#slideshow-banner_1').find(".ad_banner_slideshow").cycle({delay: -1000, fx: '<%= ad_banner.ad_fx.nil?? 'fade': ad_banner.ad_fx %>', timeoutFn: getTimeout });
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
|
@ -1,11 +0,0 @@
|
||||||
<div id="search">
|
|
||||||
<input id="user_search" name="user[username]" size="30" type="text" />
|
|
||||||
</div>
|
|
||||||
<div class="member_setup <%= @class %>">
|
|
||||||
<h1><%= t('admin.setup_member') %></h1>
|
|
||||||
<ul class="list">
|
|
||||||
<li class="set_1"><%= link_to content_tag(:span, t('admin.list_users')), admin_users_path %></li>
|
|
||||||
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_roles')), admin_roles_path %></li>
|
|
||||||
<li class="set_3"><%= link_to content_tag(:span, t('admin.list_infos')), admin_infos_path %></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<h1><%= t('admin.editing_ad_banner') %></h1>
|
|
||||||
|
|
||||||
<%= form_for @ad_banner, :url => admin_ad_banner_path(@ad_banner),:html => {:multipart => true} do |f| %>
|
|
||||||
<%= f.error_messages %>
|
|
||||||
<%= render :partial => "form", :locals => { :f => f } %>
|
|
||||||
<p>
|
|
||||||
<%= f.submit t('update') %> <%= link_back %>
|
|
||||||
</p>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<br /><br/>
|
|
|
@ -1,48 +1,15 @@
|
||||||
<% content_for :secondary do %>
|
<div id="post-body-content" class="clear">
|
||||||
<div class="ad_banners_setup">
|
<ul class="nav nav-tabs">
|
||||||
<h1><%= t('admin.setup_ad_banners') %></h1>
|
<% @ad_banners.each do |ab| %>
|
||||||
<ul class="list">
|
<%= content_tag :li,link_to(ab.title,"##{ab.title}",:data=>{:toggle=>"tab"}),:class => (ab == @active ? 'active' : nil ) %>
|
||||||
<li><%= link_to content_tag(:span, t('admin.new_ad_banner')), new_admin_ad_banner_path, :class => 'seclink1' %></li>
|
<% end -%>
|
||||||
|
<%= content_tag :li,link_to('New',"#new-a-banner",:data=>{:toggle=>"tab"}),:id=>'new_ad_banner_tab_but',:class => (@active.nil? ? 'active' : nil ) %>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
<%= flash_messages %>
|
<div class="tab-content">
|
||||||
<div class="main2">
|
<%= render :partial => 'ad_banner_tab',:collection => @ad_banners %>
|
||||||
<h1><%= t('admin.list_ad_banners') %></h1>
|
<%= render :partial => "modal_ad_banner_form"%>
|
||||||
|
</div>
|
||||||
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td><%= t('admin.title') %></td>
|
|
||||||
<td><%= t('admin.picture_position') %></td>
|
|
||||||
<td><%= t('admin.post_date') %></td>
|
|
||||||
<td><%= t('admin.unpost_date') %></td>
|
|
||||||
<td><%= t('admin.context') %></td>
|
|
||||||
<td><%= t('admin.direct_to_after_click') %></td>
|
|
||||||
<td><%= t('admin.now_display?') %></td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<% @ad_banners.each do |ad_banner| %>
|
|
||||||
<tr class="have">
|
|
||||||
<td><%= ad_banner.title %></td>
|
|
||||||
<td><%= ad_banner.picture_position %></td>
|
|
||||||
<td><%= ad_banner.post_date %></td>
|
|
||||||
<td><%= ad_banner.unpost_date.nil?? t('form.date_unlimited'): ad_banner.unpost_date %></td>
|
|
||||||
<td><%= ad_banner.context %></td>
|
|
||||||
<td><%= ad_banner.direct_to_after_click %></td>
|
|
||||||
<td><%= ad_banner.display? %></td>
|
|
||||||
<td class="action">
|
|
||||||
<%= link_to t(:show), admin_ad_banner_path(ad_banner), :class => 'show' %>
|
|
||||||
<%= link_to t(:edit), edit_admin_ad_banner_path(ad_banner), :class => 'edit' %>
|
|
||||||
<%= link_to t(:delete), admin_ad_banner_path(ad_banner), :confirm => t('sure?'), :method => :delete, :class => 'delete' %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr></tr>
|
|
||||||
<% end %>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="button_bar">
|
|
||||||
<%= link_to t('admin.new_ad_banner'), new_admin_ad_banner_path, :class => 'new' %>
|
|
||||||
</div>
|
</div>
|
|
@ -1,13 +0,0 @@
|
||||||
<div class="main2">
|
|
||||||
<h1><%= t('admin.new_ad_banner') %></h1>
|
|
||||||
|
|
||||||
<%= form_for :ad_banner, :url => admin_ad_banners_path, :html => {:multipart => true} do |f| %>
|
|
||||||
<%= f.error_messages %>
|
|
||||||
<%= render :partial => "form", :locals => { :f => f } %>
|
|
||||||
|
|
||||||
<div class="button_bar">
|
|
||||||
<%= link_back %>
|
|
||||||
<%= f.submit t('create') %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
|
@ -1,17 +0,0 @@
|
||||||
<% content_for :secondary do %>
|
|
||||||
<%= render 'side_bar' %>
|
|
||||||
<% end %>
|
|
||||||
<br /><br /><br /><br />
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li><%=t('admin.ad_banner.title') %> <%= @ad_banner.title %></li>
|
|
||||||
<li><%=t('admin.ad_banner.picture_position') %> <%= @ad_banner.picture_position %></li>
|
|
||||||
<li><%=t('admin.ad_banner.post_date') %> <%= @ad_banner.post_date %></li>
|
|
||||||
<li><%=t('admin.ad_banner.unpost_date') %> <%= @ad_banner.unpost_date %></li>
|
|
||||||
<li><%=t('admin.ad_banner.context') %> <%= @ad_banner.context %></li>
|
|
||||||
<li><%=t('admin.ad_banner.direct_to_after_click') %> <%= @ad_banner.direct_to_after_click %></li>
|
|
||||||
<li><%=t('admin.ad_banner.ad_fx') %> <%= @ad_banner.ad_fx %></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<%= render :partial => "admin/ad_banners/ad_image_show", :collection => @ad_banner.ad_images,:as => :ad_image %>
|
|
||||||
|
|
|
@ -0,0 +1,186 @@
|
||||||
|
<% content_for :page_specific_css do %>
|
||||||
|
<%= stylesheet_link_tag "lib/datepicker" %>
|
||||||
|
<% end %>
|
||||||
|
<% content_for :page_specific_javascript do %>
|
||||||
|
<%= javascript_include_tag "lib/datepicker" %>
|
||||||
|
<%= javascript_include_tag "lib/date.format" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="poststuff">
|
||||||
|
<form class="clear">
|
||||||
|
<!--Widget start-->
|
||||||
|
<div id="sub-wiget">
|
||||||
|
<div id="widget-date" class="widget-box">
|
||||||
|
<div class="widget-action clear">
|
||||||
|
<a href="#" class="action"><i title="Set the announcement to start and end dates" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||||
|
</div>
|
||||||
|
<h3 class="widget-title"><i class="icons-calendar icons-white"></i> Date</h3>
|
||||||
|
<div class="widget-content clear">
|
||||||
|
<div id="calendarRange">
|
||||||
|
<div class="input-append">
|
||||||
|
<span class="showDate"></span><span class="add-on btn">▼</span>
|
||||||
|
<%= f.hidden_field :parse_post_date %>
|
||||||
|
<%= f.hidden_field :parse_unpost_date%>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div id="widgetCalendar">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var today = new Date();
|
||||||
|
today = today.format('isoDate');
|
||||||
|
var state = false;
|
||||||
|
var arr = state ? "▼" : "▲"
|
||||||
|
//calendarRange
|
||||||
|
$('#calendarRange .showDate').html(today+" - "+today)
|
||||||
|
$('#calendarRange .calendarInput').val(today+" - "+today);
|
||||||
|
$('#calendarRange #widgetCalendar').DatePicker({
|
||||||
|
flat: true,
|
||||||
|
format: 'Y / m / d',
|
||||||
|
date: today,
|
||||||
|
calendars: 1,
|
||||||
|
mode: 'range',
|
||||||
|
starts: 1,
|
||||||
|
onChange: function(formated) {
|
||||||
|
$('#calendarRange .showDate').get(0).innerHTML = formated.join(' - ');
|
||||||
|
$('#calendarRange .calendarInput').val(formated.join(' - '));
|
||||||
|
start_date = formated[0].replace(/\s/g, "");
|
||||||
|
end_date = formated[1].replace(/\s/g, "");
|
||||||
|
$('#ad_image_parse_post_date').val(start_date);
|
||||||
|
$('#ad_image_parse_unpost_date').val(end_date);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#calendarRange .input-append').bind('click', function(){
|
||||||
|
var arr = state ? "▼" : "▲"
|
||||||
|
$('#calendarRange .add-on').html(arr);
|
||||||
|
$('#calendarRange #widgetCalendar').stop().animate({height: state ? 0 : $('#calendarRange #widgetCalendar div.datepicker').get(0).offsetHeight}, 500);
|
||||||
|
state = !state;
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$('#calendarRange #widgetCalendar div.datepicker').css('position', 'absolute');
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="widget-picture" class="widget-box">
|
||||||
|
<div class="widget-action clear">
|
||||||
|
<a class="action"><i title="Upload pictures" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||||
|
</div>
|
||||||
|
<h3 class="widget-title"><i class="icons-picture icons-white"></i>Picture</h3>
|
||||||
|
<div class="widget-content clear">
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="upload-picture">
|
||||||
|
<!--請程式務必將圖片尺寸加入到行內裡-->
|
||||||
|
<%= image_tag @ad_image.file,:width=> "456",:height=>'700' rescue ''%>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var picH = $('.upload-picture').width()/$('.upload-picture').find('img').attr("width")*$('.upload-picture').find('img').attr("height")
|
||||||
|
var imgMarginTop = ($('.upload-picture').height()-picH)/2;
|
||||||
|
var d = $('.upload-picture').height();
|
||||||
|
if(imgMarginTop>0){
|
||||||
|
imgMarginTop = 0;
|
||||||
|
d = picH;
|
||||||
|
$('.upload-picture').css({height:d})
|
||||||
|
}
|
||||||
|
$('.upload-picture').find('img').css({marginTop:imgMarginTop})
|
||||||
|
$('.upload-picture').each(function (i){
|
||||||
|
$(this).mouseenter(function(){
|
||||||
|
var h= picH;
|
||||||
|
$(this).stop().animate({height:h}, 500);
|
||||||
|
$(this).find('img').stop().animate({marginTop:0}, 500);
|
||||||
|
});
|
||||||
|
$(this).mouseleave(function(){
|
||||||
|
$(this).stop().animate({height:d}, 500);
|
||||||
|
$(this).find('img').stop().animate({marginTop:imgMarginTop}, 500);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<span class="alert widgetInfo">此區塊圖片尺寸請使用580px × 225px</span>
|
||||||
|
<div class="controls file-upload input-prepend">
|
||||||
|
<label class="control-label add-on btn" for="input-upload">
|
||||||
|
Choose file
|
||||||
|
|
||||||
|
<%= f.file_field :file,:id=>"input-upload",:class => "upload", :onchange=> "document.getElementById('fu1').innerHTML = this.form.fu1.value = this.value;" %>
|
||||||
|
</label>
|
||||||
|
<span id="fu1" class="file-name"></span>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
|
||||||
|
<input name="fu1" class="input-medium" type="text">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="widget-type" class="widget-box">
|
||||||
|
<div class="widget-action clear">
|
||||||
|
<a class="action"><i class="icon-exclamation-sign icon-white tip" data-original-title="Upload pictures"></i></a>
|
||||||
|
</div>
|
||||||
|
<h3 class="widget-title"><i class="icons-star-thin icons-white"></i>Type</h3>
|
||||||
|
<div class="widget-content clear">
|
||||||
|
<%= f.select :link_open ,AdImage::LINK_OPEN_TYPES%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="widget-time" class="widget-box widget-size-300">
|
||||||
|
<div class="widget-action clear">
|
||||||
|
<a class="action"><i class="icon-exclamation-sign icon-white tip" data-original-title="Set the range time"></i></a>
|
||||||
|
</div>
|
||||||
|
<h3 class="widget-title"><i class="icons-time icons-white"></i>FEQ</h3>
|
||||||
|
<div class="widget-content clear">
|
||||||
|
<%= f.text_field :weight ,:class=> 'span3',:placeholder=>"在套圖中出現次數 1次請輸入1" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="widget-link" class="widget-box widget-size-300">
|
||||||
|
<div class="widget-action clear">
|
||||||
|
<a class="action"><i class="icon-exclamation-sign icon-white tip" data-original-title="Add a reference link"></i></a>
|
||||||
|
</div>
|
||||||
|
<h3 class="widget-title"><i class="icons-link icons-white"></i>Link</h3>
|
||||||
|
<div class="widget-content clear">
|
||||||
|
<%= f.text_field :out_link ,:class=> 'span3',:placeholder => "輸入連結"%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!--Wiget End-->
|
||||||
|
<!--Post Start-->
|
||||||
|
<div id="post-body">
|
||||||
|
<div id="post-body-content" class="clear">
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
<% site_valid_locales_default_head.each do |locale|%>
|
||||||
|
<%= content_tag :li,link_to(I18nVariable.from_locale(locale),"##{locale}",:data=>{:toggle => "tab"}),:class=> (active_when_default_locale_eq locale) %>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<div class="tab-content">
|
||||||
|
<%= select_tag 'ad_banner[id]',options_from_collection_for_select(AdBanner.all, "id", "title",params[:ad_banner_id]) , :class=>"input-medium", %>
|
||||||
|
<% site_valid_locales_default_head.each do |locale|%>
|
||||||
|
<%= content_tag :div,:class => "tab-pane #{active_when_default_locale_eq locale}",:id=>"#{locale}" do%>
|
||||||
|
<div class="title">
|
||||||
|
<%= f.fields_for :title,@ad_image.title do |f| %>
|
||||||
|
<%= f.text_field locale,:class=>"ad_image-title",:placeholder => "輸入標題"%>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="context editor">
|
||||||
|
<%= f.fields_for :context, @ad_image.context do |f| %>
|
||||||
|
<%= f.text_area locale,:style => "width:100%", :class => "asd_tinymce_textarea" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--Post End-->
|
||||||
|
<div class="form-actions">
|
||||||
|
<button class="btn btn-success" type="submit">Preview/預覽</button>
|
||||||
|
<button class="btn btn-primary" type="submit">Submit/送出</button>
|
||||||
|
<button class="btn" type="reset">Cancel/取消</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<%= flash_messages %>
|
||||||
|
|
||||||
|
<%= form_for @ad_image, :url => admin_ad_banner_ad_image_path, :html => { :class => 'form' } do |f| %>
|
||||||
|
|
||||||
|
<%= render :partial => "form", :locals => { :f => f } %>
|
||||||
|
|
||||||
|
|
||||||
|
<% end %>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<%= flash_messages %>
|
||||||
|
|
||||||
|
<%= form_for @ad_image, :url => create_ad_image_admin_ad_banners_path, :html => { :class => 'form' ,:multipart => true} do |f| %>
|
||||||
|
|
||||||
|
<%= render :partial => "form", :locals => { :f => f } %>
|
||||||
|
|
||||||
|
|
||||||
|
<% end %>
|
|
@ -25,7 +25,7 @@
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<%= t('admin.module_app') %>
|
<%= t('admin.module_app') %>
|
||||||
<%= render :partial => "admin/module_apps/app_selector", :locals => { :f => f } %>
|
<%= render :partial => "app_selector", :locals => { :f => f } %>
|
||||||
<span id="app_page_url"><%= select('page','app_frontend_url', @app_frontend_urls, :selected => @item.app_frontend_url ) rescue ''%> </span>
|
<span id="app_page_url"><%= select('page','app_frontend_url', @app_frontend_urls, :selected => @item.app_frontend_url ) rescue ''%> </span>
|
||||||
<span id="app_page_category"><%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category] ) rescue ''%> </span>
|
<span id="app_page_category"><%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category] ) rescue ''%> </span>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
<%= flash_messages %>
|
<%= flash_messages %>
|
||||||
|
|
||||||
<%= parse_page_edit(@item).html_safe %>
|
|
||||||
|
<%= page_stylesheets(@item).html_safe %>
|
||||||
|
<%= page_javascripts(@item).html_safe %>
|
||||||
|
|
||||||
|
<%= parse_page_edit_noko(@item).html_safe %>
|
|
@ -1,8 +1,13 @@
|
||||||
<div id="<%= dom_id tag %>" >
|
<div id="<%= dom_id tag %>" class="tag clear">
|
||||||
|
<div class="tagitem">
|
||||||
|
<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[locale] %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="action">
|
||||||
<%= link_to t(:edit), edit_admin_tag_path(tag), :remote => true %>
|
<%= link_to t(:edit), edit_admin_tag_path(tag), :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>
|
|
@ -1,6 +1,16 @@
|
||||||
<div id='tags'>
|
<div class="subnav">
|
||||||
|
<ul class="nav nav-pills filter">
|
||||||
|
<li class="accordion-group">
|
||||||
|
<form class="form-search">
|
||||||
|
<input type="text" class="input-medium search-query">
|
||||||
|
<button type="submit" class="btn">Search</button>
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div id='tags' class="clear">
|
||||||
<%= render :partial => 'tag', :collection => @tags %>
|
<%= render :partial => 'tag', :collection => @tags %>
|
||||||
</div>
|
</div>
|
||||||
-------------------------
|
<div class="form-actions">
|
||||||
<br/>
|
<%= render 'add' %>
|
||||||
<%= render 'add' %>
|
</div>
|
|
@ -1 +1 @@
|
||||||
$('#<%= dom_id @tag %>').html("<%= j render :partial => 'tag', :object => @tag %>")
|
$('#<%= dom_id @tag %>').replaceWith("<%= j render :partial => 'tag', :object => @tag %>")
|
|
@ -7,18 +7,4 @@
|
||||||
<li><%= link_to t('admin.member'), admin_users_path, :class => 'orblink' %></li>
|
<li><%= link_to t('admin.member'), admin_users_path, :class => 'orblink' %></li>
|
||||||
<li><%= link_to t('admin.translation'), admin_translations_path, :class => 'orblink' %></li>
|
<li><%= link_to t('admin.translation'), admin_translations_path, :class => 'orblink' %></li>
|
||||||
<li><%= link_to t('admin.site'), admin_sites_path, :class => 'orblink' %></li>
|
<li><%= link_to t('admin.site'), admin_sites_path, :class => 'orblink' %></li>
|
||||||
|
|
||||||
<!-- <li><%= link_to t('admin.purchase'), admin_purchases_path, :class => 'orblink' %></li>
|
|
||||||
<li><%= link_to t('admin.site_setting'), admin_sites_path, :class => 'orblink' %></li>
|
|
||||||
<li><%= link_to t('admin.design'), admin_designs_path, :class => 'orblink' %></li>
|
|
||||||
<li><%= link_to t('admin.announcement'), panel_announcement_back_end_root_path, :class => 'orblink' %></li>
|
|
||||||
<li><%= link_to t('admin.super_pages'), '', :class => 'orblink' %></li>
|
|
||||||
<li><%= link_to t('admin.links'), '', :class => 'orblink' %></li>
|
|
||||||
<li><%= link_to t('admin.ad_banner'), admin_ad_banners_path, :class => 'orblink' %></li>
|
|
||||||
<li><%= link_to t('admin.calendar'), '', :class => 'orblink' %></li>
|
|
||||||
<li><%= link_to t('admin.nccu'), '', :class => 'orblink' %></li>
|
|
||||||
t('admin.dashbroad')
|
|
||||||
t('admin.content'
|
|
||||||
t('admin.add_drop_down_item')
|
|
||||||
-->
|
|
||||||
</ul>
|
</ul>
|
|
@ -15,6 +15,7 @@
|
||||||
</div>
|
</div>
|
||||||
<ul class="nav">
|
<ul class="nav">
|
||||||
<li><%= link_to t(:homepage), root_path, :class => 'orbit-bar-home' %></li>
|
<li><%= link_to t(:homepage), root_path, :class => 'orbit-bar-home' %></li>
|
||||||
|
<li><a class="orbit-bar-desktop" href="#">Desktop</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav pull-right">
|
<ul class="nav pull-right">
|
||||||
<li class="dropdown language">
|
<li class="dropdown language">
|
||||||
|
@ -25,6 +26,13 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li class="search clear">
|
||||||
|
<a class="orbit-bar-search" href="#">search</a>
|
||||||
|
<form class="navbar-search" action="">
|
||||||
|
<input class="search-query span3" type="text" placeholder="<%= t(:search_nccu) %>">
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
<% if user_signed_in? %>
|
<% if user_signed_in? %>
|
||||||
<li class="dropdown active">
|
<li class="dropdown active">
|
||||||
<a class="orbit-bar-account" href="#" data-toggle="dropdown">
|
<a class="orbit-bar-account" href="#" data-toggle="dropdown">
|
||||||
|
@ -94,9 +102,6 @@
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
<form class="navbar-search span6" action="">
|
|
||||||
<input class="search-query span4" type="text" placeholder="<%= t(:search_nccu) %>">
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
|
@ -2,15 +2,16 @@
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icons-purchase') + t('admin.purchase'), admin_purchases_path %>
|
<%= link_to content_tag(:i, nil, :class => 'icons-purchase') + t('admin.purchase'), admin_purchases_path %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<%= content_tag :li, :class => active_for_controllers('bulletins', 'tags', 'bulletin_categorys') do -%>
|
<%= content_tag :li, :class => active_for_controllers('bulletins', 'tags', 'bulletin_categorys', 'fact_checks') do -%>
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %>
|
<%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %>
|
||||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', 'tags', 'bulletin_categorys')) do -%>
|
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', 'tags', 'bulletin_categorys', 'fact_checks')) do -%>
|
||||||
<%= content_tag :li, link_to(t('admin.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %>
|
<%= content_tag :li, link_to(t('admin.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %>
|
||||||
<%= content_tag :li, link_to(t('admin.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %>
|
<%= content_tag :li, link_to(t('admin.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %>
|
||||||
<%= content_tag :li, link_to(t('admin.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %>
|
<%= content_tag :li, link_to(t('admin.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %>
|
||||||
<%= content_tag :li, link_to(t('admin.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('tags', 'index') %>
|
<%= content_tag :li, link_to(t('admin.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('panel/bulletin/back_end/tags', 'index') %>
|
||||||
<%= content_tag :li, link_to(t('announcement.bulletin.fact_check_setting'), panel_announcement_back_end_fact_checks_setting_path), :class => active_for_action('tags', 'index') %>
|
<%= content_tag :li, link_to(t('announcement.bulletin.fact_check_setting'), panel_announcement_back_end_fact_checks_setting_path), :class => active_for_action('fact_checks', 'setting') if (is_manager? rescue nil) %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<%= content_tag :li, :class => active_for_controllers('users') do -%>
|
<%= content_tag :li, :class => active_for_controllers('users') do -%>
|
||||||
|
@ -28,13 +29,22 @@
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icons-window-block') + t('admin.design'), admin_designs_path %>
|
<%= link_to content_tag(:i, nil, :class => 'icons-window-block') + t('admin.design'), admin_designs_path %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
|
<%= content_tag :li, :class => active_for_controllers('ad_banners', 'ad_images') do -%>
|
||||||
|
<%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.ad_banner'), admin_ad_banners_path %>
|
||||||
|
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('ad_banners', 'ad_images')) do -%>
|
||||||
|
<%= content_tag :li, link_to(t('admin.all_ad_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %>
|
||||||
|
<%= content_tag :li, link_to(t('admin.new_ad_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %>
|
||||||
|
<%= content_tag :li, link_to(t('admin.new_ad_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= content_tag :li, :class => active_for_controllers('web_links', 'tags', 'web_link_categorys') do -%>
|
<%= content_tag :li, :class => active_for_controllers('web_links', 'tags', 'web_link_categorys') do -%>
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), panel_web_resource_back_end_web_links_path %>
|
<%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), panel_web_resource_back_end_web_links_path %>
|
||||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('web_links', 'tags', 'web_link_categorys')) do -%>
|
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('web_links', 'tags', 'web_link_categorys')) do -%>
|
||||||
<%= content_tag :li, link_to(t('admin.all_articles'), panel_web_resource_back_end_web_links_path), :class => active_for_action('web_link', 'index') %>
|
<%= content_tag :li, link_to(t('admin.all_articles'), panel_web_resource_back_end_web_links_path), :class => active_for_action('web_link', 'index') %>
|
||||||
<%= content_tag :li, link_to(t('admin.add_new'), new_panel_web_resource_back_end_web_link_path), :class => active_for_action('web_link', 'new') %>
|
<%= content_tag :li, link_to(t('admin.add_new'), new_panel_web_resource_back_end_web_link_path), :class => active_for_action('web_link', 'new') %>
|
||||||
<%= content_tag :li, link_to(t('admin.categories'), panel_web_resource_back_end_web_link_categorys_path), :class => active_for_action('web_link_categorys', 'index') %>
|
<%= content_tag :li, link_to(t('admin.categories'), panel_web_resource_back_end_web_link_categorys_path), :class => active_for_action('web_link_categorys', 'index') %>
|
||||||
<%= content_tag :li, link_to(t('admin.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('tags', 'index') %>
|
<%= content_tag :li, link_to(t('admin.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('panel/web_resource/back_end/tags', 'index') %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<title><%= @title || APP_CONFIG['orbit'] %></title>
|
<title><%= @title || APP_CONFIG['orbit'] %></title>
|
||||||
<link rel="shortcut icon" href="/favicon.ico">
|
<link rel="shortcut icon" href="/favicon.ico">
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
<%= javascript_include_tag "html5" %>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<%= stylesheet_link_tag "admin" %>
|
<%= stylesheet_link_tag "admin" %>
|
||||||
<%= javascript_include_tag "admin" %>
|
<%= javascript_include_tag "admin" %>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title><%= @title || APP_CONFIG['orbit'] %></title>
|
<title><%= @title || APP_CONFIG['orbit'] %></title>
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
<%= javascript_include_tag "html5" %>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<%= stylesheet_link_tag "devise" %>
|
<%= stylesheet_link_tag "devise" %>
|
||||||
<%= javascript_include_tag "devise" %>
|
<%= javascript_include_tag "devise" %>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
<%= javascript_include_tag "html5" %>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<%#= stylesheet_link_tag "module_widget" %>
|
<%#= stylesheet_link_tag "module_widget" %>
|
||||||
<%= javascript_include_tag "module_widget" %>
|
<%= javascript_include_tag "module_widget" %>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title><%= @title || APP_CONFIG['orbit'] %></title>
|
<title><%= @title || APP_CONFIG['orbit'] %></title>
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
<%= javascript_include_tag "html5" %>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<%= stylesheet_link_tag "new_admin" %>
|
<%= stylesheet_link_tag "new_admin" %>
|
||||||
<%= javascript_include_tag "new_admin" %>
|
<%= javascript_include_tag "new_admin" %>
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<%= page_title(@item).html_safe %>
|
||||||
|
<%= page_metas(@item).html_safe %>
|
||||||
|
<%= @metas %>
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<%= javascript_include_tag "html5" %>
|
||||||
|
<![endif]-->
|
||||||
|
<%= page_stylesheets(@item).html_safe %>
|
||||||
|
<%= page_javascripts(@item).html_safe %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<%= yield %>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -5,7 +5,7 @@
|
||||||
<title><%= @title || APP_CONFIG['orbit'] %></title>
|
<title><%= @title || APP_CONFIG['orbit'] %></title>
|
||||||
<link rel="shortcut icon" href="/favicon.ico">
|
<link rel="shortcut icon" href="/favicon.ico">
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
<%= javascript_include_tag "html5" %>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<%= stylesheet_link_tag "site_editor" %>
|
<%= stylesheet_link_tag "site_editor" %>
|
||||||
<%= javascript_include_tag "site_editor" %>
|
<%= javascript_include_tag "site_editor" %>
|
||||||
|
|
|
@ -30,6 +30,7 @@ module Orbit
|
||||||
config.autoload_paths += %W(#{config.root}/lib)
|
config.autoload_paths += %W(#{config.root}/lib)
|
||||||
config.autoload_paths += %W(#{config.root}/lib/parsers)
|
config.autoload_paths += %W(#{config.root}/lib/parsers)
|
||||||
config.autoload_paths += %W(#{config.root}/app/models/design)
|
config.autoload_paths += %W(#{config.root}/app/models/design)
|
||||||
|
config.autoload_paths += %W(#{config.root}/app/models/meta)
|
||||||
config.autoload_paths += %W(#{config.root}/app/models/purchase)
|
config.autoload_paths += %W(#{config.root}/app/models/purchase)
|
||||||
config.autoload_paths += %W(#{config.root}/app/models/user)
|
config.autoload_paths += %W(#{config.root}/app/models/user)
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,14 @@ zh_tw:
|
||||||
admin:
|
admin:
|
||||||
action: 操作
|
action: 操作
|
||||||
ad_banner: 廣告輪播
|
ad_banner: 廣告輪播
|
||||||
|
ad:
|
||||||
|
ab_fx: 轉場特效
|
||||||
|
all_banners: 輪播清單
|
||||||
|
new_banner: 新增輪播
|
||||||
|
new_image: 新增橫幅
|
||||||
|
title: 標題
|
||||||
|
transition_sec: 轉場單位時間
|
||||||
|
trans_unit_sec: 秒
|
||||||
add: 新增
|
add: 新增
|
||||||
add_item: 新增項目
|
add_item: 新增項目
|
||||||
add_language: 新增語言
|
add_language: 新增語言
|
||||||
|
|
|
@ -24,7 +24,14 @@ Orbit::Application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :ad_banners
|
|
||||||
|
resources :ad_banners do
|
||||||
|
collection do
|
||||||
|
match 'new_ad_image' => 'ad_images#new',:as => :new_ad_image,:via => :get
|
||||||
|
match 'new_ad_image' => 'ad_images#create',:as => :create_ad_image,:via => :post
|
||||||
|
end
|
||||||
|
resources :ad_images ,:except => [:show,:index]
|
||||||
|
end
|
||||||
resources :dashboards
|
resources :dashboards
|
||||||
resources :designs do
|
resources :designs do
|
||||||
collection do
|
collection do
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,184 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<title>RulingSite</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="themes/ini.css" media="all" style=""/>
|
||||||
|
<link rel="stylesheet" type="text/css" href="themes/comp.css" media="all" style=""/>
|
||||||
|
<link rel="stylesheet" type="text/css" href="default.css" media="all" style=""/>
|
||||||
|
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
|
||||||
|
<script type="text/javascript" src="javascript/jquery.tinyscrollbar.min.js"></script>
|
||||||
|
<script type="text/javascript" src="javascript/rc.js"></script>
|
||||||
|
<script type="text/javascript" src="javascript/ccu.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="wrapper">
|
||||||
|
<div id="header" class="header">
|
||||||
|
|
||||||
|
<h1 id="logo" class="ini_heading"><a href="">國立政治大學</a><span>National Chengchi University</span></h1>
|
||||||
|
|
||||||
|
<div id="nav" class="header_nav">
|
||||||
|
<ul class="nav_1">
|
||||||
|
<li><a href="#" class="nav1">在校學生</a></li><span class="line"> | </span>
|
||||||
|
<li><a href="#" class="nav2">校友</a></li><span class="line"> | </span>
|
||||||
|
<li><a href="#" class="nav3">教職員工</a></li><span class="line"> | </span>
|
||||||
|
<li><a href="#" class="nav4">訪客</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="nav_2">
|
||||||
|
<li><a href="#">網站地圖</a></li><span class="line"> | </span>
|
||||||
|
<li><a href="#">iNCCU 愛政大</a></li><span class="line"> | </span>
|
||||||
|
<li>
|
||||||
|
<a href="#" class="mail">郵件信箱</a>
|
||||||
|
<ul class="nav_menu2">
|
||||||
|
<li class="mail">郵件信箱</li>
|
||||||
|
<li><a href="">教職員生</a></li>
|
||||||
|
<li><a href="">校友</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<nav id="nav2" class="site_menu menu">
|
||||||
|
<ul class="nav ini_list page_menu" level='1' id='nav' class='nav ini_list' home='true' li_class='nav' li_incremental='true'>
|
||||||
|
<li><a href=""><span>關於政大</span></a></li>
|
||||||
|
<li>
|
||||||
|
<a href=""><span>學術單位</span></a>
|
||||||
|
<span class="dot"></span>
|
||||||
|
<ul class="site_menu2 page_menu" level='2' id='navi' li_class='navi'>
|
||||||
|
<li><a href=""><span>文學院</span></a></li>
|
||||||
|
<li><a href=""><span>理學院</span></a></li>
|
||||||
|
<li><a href=""><span>社會科學學院</span></a></li>
|
||||||
|
<li><a href=""><span>法學院</span></a></li>
|
||||||
|
<li><a href=""><span>商學院</span></a></li>
|
||||||
|
<li><a href=""><span>外國語文學院</span></a></li>
|
||||||
|
<li><a href=""><span>傳播學院</span></a></li>
|
||||||
|
<li><a href=""><span>國際事務學院</span></a></li>
|
||||||
|
<li><a href=""><span>教育學院</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href=""><span>研究單位</span></a>
|
||||||
|
<span class="dot"></span>
|
||||||
|
<ul class="site_menu2 ini_list">
|
||||||
|
<li><a href=""><span>國際關係研究中心</span></a></li>
|
||||||
|
<li><a href=""><span>選舉研究中心</span></a></li>
|
||||||
|
<li><a href=""><span>第三部門研究中心</span></a></li>
|
||||||
|
<li><a href=""><span>創新與創造力研究中心</span></a></li>
|
||||||
|
<li><a href=""><span>台灣研究中心</span></a></li>
|
||||||
|
<li><a href=""><span>中國大陸研究中心</span></a></li>
|
||||||
|
<li><a href=""><span>人文研究中心</span></a></li>
|
||||||
|
<li><a href=""><span>心智、大腦與學習研究中心</span></a></li>
|
||||||
|
<li><a href=""><span>原住民族研究中心</span></a></li>
|
||||||
|
<li><a href=""><span>附屬研究中心</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href=""><span>行政組織</span></a>
|
||||||
|
<span class="dot"></span>
|
||||||
|
<ul class="site_menu2">
|
||||||
|
<li><a href=""><span>教務處</span></a></li>
|
||||||
|
<li><a href=""><span>學生事務處</span></a></li>
|
||||||
|
<li><a href=""><span>總務處</span></a></li>
|
||||||
|
<li><a href=""><span>研究發展處</span></a></li>
|
||||||
|
<li><a href=""><span>國際合作事務處</span></a></li>
|
||||||
|
<li><a href=""><span>秘書處</span></a></li>
|
||||||
|
<li><a href=""><span>會計室</span></a></li>
|
||||||
|
<li><a href=""><span>人事室</span></a></li>
|
||||||
|
<li><a href=""><span>圖書館</span></a></li>
|
||||||
|
<li><a href=""><span>體育室</span></a></li>
|
||||||
|
<li><a href=""><span>公共行政及企業管理教育中心</span></a></li>
|
||||||
|
<li><a href=""><span>社會科學資料中心</span></a></li>
|
||||||
|
<li><a href=""><span>電子計算機中心</span></a></li>
|
||||||
|
<li><a href=""><span>附設公務人員教育中心</span></a></li>
|
||||||
|
<li><a href=""><span>教學發展中心</span></a></li>
|
||||||
|
<li><a href=""><span>華語文教學中心</span></a></li>
|
||||||
|
<li><a href=""><span>創新育成中心</span></a></li>
|
||||||
|
<li><a href=""><span>附設實驗國民小學</span></a></li>
|
||||||
|
<li><a href=""><span>附屬高級中學</span></a></li>
|
||||||
|
<li><a href=""><span>性別平等教育委員會</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><a href=""><span>招生入學</span></a></li>
|
||||||
|
<li>
|
||||||
|
<a href=""><span>資訊服務</span></a>
|
||||||
|
<ul class="site_menu2">
|
||||||
|
<li><a href=""><span>校務系統</span></a></li>
|
||||||
|
<li><a href=""><span>校園授權軟體</span></a></li>
|
||||||
|
<li><a href=""><span>校園網路</span></a></li>
|
||||||
|
<li><a href=""><span>校園資訊服務</span></a></li>
|
||||||
|
<li><a href=""><span>教學軟硬體資源</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><a href=""><span>聯絡我們</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div id="banner_box">
|
||||||
|
<div id="banner" name='content_1' class="banner page_content">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="main_content" class="content">
|
||||||
|
<div class="content2">
|
||||||
|
<div class="topic_news">
|
||||||
|
<div class="topic_news2">
|
||||||
|
<div class="main_content page_content" name='content_2'>
|
||||||
|
</div>
|
||||||
|
<div class="news_content page_content" name='content_2' main='true'>
|
||||||
|
</div>
|
||||||
|
<div class="sidebar page_content" name='content_7'>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="clear"></div>
|
||||||
|
|
||||||
|
<div class="post_panel">
|
||||||
|
<div class="post_panel2">
|
||||||
|
<div class="announcements page_content" name='content_3'>
|
||||||
|
</div>
|
||||||
|
<div class="events page_content" name='content_4'>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clear"></div>
|
||||||
|
|
||||||
|
<div class="links_panel">
|
||||||
|
<div class="links_panel2">
|
||||||
|
<div class="adbanner1 page_content" name='content_5'>
|
||||||
|
</div>
|
||||||
|
<div class="quicklinks page_content" name='content_6'>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="footer" class="footer">
|
||||||
|
<div class="copyright">
|
||||||
|
<p>
|
||||||
|
本網站著作權屬於國立政治大學,請詳見使用規則。
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
總機電話:02-29393091<br/>
|
||||||
|
傳真:02-29379611<br/>
|
||||||
|
地址:11605 台北市文山區指南路二段64號<br/>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="notice">
|
||||||
|
校園安全緊急通報 | 著作權 | 個人資料保護宣告 | 資訊安全宣告 | 聯絡我們
|
||||||
|
</div>
|
||||||
|
<div class="ruling">
|
||||||
|
<a href="">
|
||||||
|
<img src="images/ruling.png" alt="Rulingdigital" name="ruling_pic" id="ruling_pic" class="ruling_pic page_image" />
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -21,11 +21,19 @@ module OrbitCoreLib
|
||||||
|
|
||||||
def authed_users(title=nil)
|
def authed_users(title=nil)
|
||||||
users = []
|
users = []
|
||||||
unless title.nil?
|
users = case title
|
||||||
users = self.object_auths.where(title: title )[0].auth_users_after_block_list rescue []
|
when :all
|
||||||
|
ary = self.object_auths.collect{|t| t.auth_users}
|
||||||
|
ary.flatten!
|
||||||
|
when nil
|
||||||
|
if self.object_auths.count ==1
|
||||||
|
self.object_auths.first.auth_users_after_block_list rescue []
|
||||||
else
|
else
|
||||||
users = self.object_auths.collect{|t| t.auth_users_after_block_list} rescue []
|
logger.info "Warning calling a auth commend without specificed value( has multi-auths ), return empty"
|
||||||
users.flatten!.uniq!
|
[]
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self.object_auths.where(title: title).first.auth_users rescue []
|
||||||
end
|
end
|
||||||
users
|
users
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,112 +1,55 @@
|
||||||
module ParserBackEnd
|
module ParserBackEnd
|
||||||
require 'radius'
|
|
||||||
include ParserCommon
|
include ParserCommon
|
||||||
|
|
||||||
def parse_page_edit(page)
|
require 'nokogiri'
|
||||||
if page._type == 'Page'
|
|
||||||
layout_content = page.design.layout.content.force_encoding('UTF-8') rescue ''
|
# c.define_tag 'language_bar' do
|
||||||
context = parser_context_edit(page)
|
# @site.in_use_locales.map{ |locale|
|
||||||
parser = Radius::Parser.new(context, :tag_prefix => 'r')
|
# lang = I18nVariable.first(:conditions => {:key => locale})[locale]
|
||||||
parser.parse(parser.parse(layout_content))
|
# if I18n.locale.to_s.eql?(locale)
|
||||||
end
|
# lang
|
||||||
|
# else
|
||||||
|
# "<a href='?locale=#{locale}'>#{lang}</a>"
|
||||||
|
# end
|
||||||
|
# }.join(' | ')
|
||||||
|
# end
|
||||||
|
# c.define_tag 'link' do |tag|
|
||||||
|
# item = Item.first(:conditions => { :full_name => tag.attr['name'] })
|
||||||
|
# ret = ''
|
||||||
|
# ret << "<a href='"
|
||||||
|
# ret << eval("admin_#{item._type.downcase}_path(item.id)")
|
||||||
|
# ret << "' class='nav'>"
|
||||||
|
# ret << item.i18n_variable[I18n.locale]
|
||||||
|
# ret << "</a>"
|
||||||
|
# end
|
||||||
|
|
||||||
|
def parse_page_edit_noko(page, id = nil)
|
||||||
|
body = Nokogiri::HTML(page.design.layout.body)
|
||||||
|
parse_menu(body, page, true)
|
||||||
|
public_r_tags = parse_content_edits(body, page, id)
|
||||||
|
parse_images(body, page)
|
||||||
|
|
||||||
|
public_r_tags.each do |tag|
|
||||||
|
send("parse_#{tag}s", body, page,id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def parser_context_edit(page, attributes = {})
|
body.to_html
|
||||||
Radius::Context.new do |c|
|
|
||||||
c.define_tag 'snippet' do |tag|
|
|
||||||
snippet = Snippet.first(:conditions => {:name => tag.attr['name']})
|
|
||||||
if snippet
|
|
||||||
snippet.content
|
|
||||||
else
|
|
||||||
t('nothing')
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
c.define_tag 'language_bar' do
|
# page_contents
|
||||||
@site.in_use_locales.map{ |locale|
|
def parse_content_edits(body, page, id)
|
||||||
lang = I18nVariable.first(:conditions => {:key => locale})[locale]
|
public_r_tags = []
|
||||||
if I18n.locale.to_s.eql?(locale)
|
body.css('.page_content').each do |content|
|
||||||
lang
|
|
||||||
else
|
|
||||||
"<a href='?locale=#{locale}'>#{lang}</a>"
|
|
||||||
end
|
|
||||||
}.join(' | ')
|
|
||||||
end
|
|
||||||
c.define_tag 'css' do |tag|
|
|
||||||
assets = Asset.any_in(:filename => tag.attr['name'].split(',').map(&:strip))
|
|
||||||
res = ''
|
|
||||||
assets.each do |asset|
|
|
||||||
res << "<link href='#{asset.data.file.url}' rel='stylesheet' type='text/css' /> " if asset.data.file.content_type.eql?('text/css')
|
|
||||||
end
|
|
||||||
res
|
|
||||||
end
|
|
||||||
c.define_tag 'image' do |tag|
|
|
||||||
# image = page.custom_images.detect{|image| image.name.eql?(tag.attr['name']) }
|
|
||||||
# image = page.design.custom_images.detect{|image| image.name.eql?(tag.attr['name']) } unless image
|
|
||||||
image = page.design.images.detect{|image| image.name.eql?(tag.attr['name']) } unless image
|
|
||||||
if image
|
|
||||||
res = "<img src=#{image.file.url} "
|
|
||||||
tag.attr.each do |l|
|
|
||||||
res << "#{l[0]}='#{l[1]}' "
|
|
||||||
end
|
|
||||||
res << '>'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
c.define_tag 'stylesheets' do |tag|
|
|
||||||
res = ''
|
|
||||||
res << "<link href='#{page.design.reset_css.file.url}' rel='stylesheet' type='text/css' />" if page.design.reset_css
|
|
||||||
res << "<link href='#{page.design.default_css.file.url}' rel='stylesheet' type='text/css' />" if page.design.default_css
|
|
||||||
theme = page.design.themes.detect{ |d| d.id == page.theme_id }
|
|
||||||
res << "<link href='#{theme.file.url}' rel='stylesheet' type='text/css' />" if theme
|
|
||||||
res
|
|
||||||
end
|
|
||||||
c.define_tag 'javascripts' do |tag|
|
|
||||||
res = ''
|
|
||||||
res << "<script type='text/javascript' src='/static/jquery.js'></script>"
|
|
||||||
res << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>"
|
|
||||||
res << "<script type='text/javascript' src='/static/kernel.js'></script>"
|
|
||||||
res << "<script type='text/javascript' src='/assets/event.js'></script>"
|
|
||||||
page.design.javascripts.each do |js|
|
|
||||||
res << "<script type='text/javascript' src='#{js.file.url}'></script>"
|
|
||||||
end
|
|
||||||
res
|
|
||||||
end
|
|
||||||
c.define_tag 'ad_banner' do |tag|
|
|
||||||
res = ''
|
|
||||||
ad_banner = AdBanner.find(tag.attr["id"]) rescue nil
|
|
||||||
if ad_banner
|
|
||||||
res << "<script type='text/javascript'>
|
|
||||||
$(document).ready(function(){ $('#slideshow-#{ad_banner.title.dehumanize}').cycle({delay: -1000, fx: '#{ad_banner.ad_fx.nil?? 'fade': ad_banner.ad_fx}', timeoutFn: getTimeout }); });
|
|
||||||
</script>"
|
|
||||||
res << "<div id='slideshow-#{ad_banner.title.dehumanize}'>"
|
|
||||||
ad_banner.ad_images.each do |ad_image|
|
|
||||||
res << "<img src='#{ad_image.file}' "
|
|
||||||
res << "alt='#{ad_image.picture_intro || ' '}' "
|
|
||||||
res << "time_to_next='#{ad_image.get_delay_time}' "
|
|
||||||
res << "link_open='#{ad_image.link_open}' "
|
|
||||||
res << "link_url='#{(ad_banner.direct_to_after_click?? ad_image.out_link : ad_banner.context) || ' '}' "
|
|
||||||
res << "/>"
|
|
||||||
end
|
|
||||||
res << "</div>"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
c.define_tag 'layout_part' do |tag|
|
|
||||||
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s }
|
|
||||||
ret = ''
|
ret = ''
|
||||||
ret << "<div id='#{tag.attr['name']}' part_id='#{part.id}'>"
|
if (content["main"] == "true" && !page.module_app.nil?)
|
||||||
ret << tag.expand
|
|
||||||
ret << '</div>'
|
|
||||||
end
|
|
||||||
c.define_tag 'content' do |tag|
|
|
||||||
ret = ''
|
|
||||||
if (tag.attributes["main"] == "true" && !page.module_app.nil?)
|
|
||||||
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}?inner=true&page_id=#{page.id}"
|
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}?inner=true&page_id=#{page.id}"
|
||||||
ret << "&category_id=#{page.category}" if page[:category]
|
ret << "&category_id=#{page.category}" if page[:category]
|
||||||
ret << "'></div>"
|
ret << "'></div>"
|
||||||
else
|
else
|
||||||
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s }
|
part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil
|
||||||
ret << "<div id='#{tag.attr['name']}' part_id='#{part.id}' class='editable' style='border:solid 1px; margin:5px; padding:5px;'>"
|
ret << "<div id='#{content['name']}' part_id='#{part.id}' class='editable' style='border:solid 1px; margin:5px; padding:5px;'>" if part
|
||||||
ret << "<div class='edit_link' style='display:none'>"
|
ret << "<div class='edit_link' style='display:none'>"
|
||||||
ret << " <a href='#{edit_admin_page_part_path(part.id)}' class='nav'>#{t(:edit)}</a>"
|
ret << " <a href='#{edit_admin_page_part_path(part.id)}' class='nav'>#{t(:edit)}</a>" if part
|
||||||
ret << '</div>'
|
ret << '</div>'
|
||||||
case part.kind
|
case part.kind
|
||||||
when 'text'
|
when 'text'
|
||||||
|
@ -119,31 +62,25 @@ module ParserBackEnd
|
||||||
end
|
end
|
||||||
when 'public_r_tag'
|
when 'public_r_tag'
|
||||||
ret << "<r:#{part.public_r_tag} id='#{part.public_r_tag_object_id}'/>"
|
ret << "<r:#{part.public_r_tag} id='#{part.public_r_tag_object_id}'/>"
|
||||||
|
public_r_tags << part.public_r_tag
|
||||||
else
|
else
|
||||||
''
|
''
|
||||||
|
end if part
|
||||||
end
|
end
|
||||||
ret << '</div>'
|
scope = "<#{content.name}"
|
||||||
end
|
content.attributes.each_pair do |key, value|
|
||||||
end
|
scope << " #{key}='#{value}'"
|
||||||
c.define_tag 'link' do |tag|
|
|
||||||
item = Item.first(:conditions => { :full_name => tag.attr['name'] })
|
|
||||||
ret = ''
|
|
||||||
ret << "<a href='"
|
|
||||||
ret << eval("admin_#{item._type.downcase}_path(item.id)")
|
|
||||||
ret << "' class='nav'>"
|
|
||||||
ret << item.i18n_variable[I18n.locale]
|
|
||||||
ret << "</a>"
|
|
||||||
end
|
|
||||||
c.define_tag 'menu' do |tag|
|
|
||||||
home = get_homepage
|
|
||||||
menu = page.design.layout.menu
|
|
||||||
menu_level(home, 0, menu, true)
|
|
||||||
end
|
end
|
||||||
|
scope << ">#{ret}</#{content.name}>"
|
||||||
|
fragment = Nokogiri::HTML::DocumentFragment.new(body, scope)
|
||||||
|
content.swap(fragment)
|
||||||
end
|
end
|
||||||
|
public_r_tags.uniq
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def self.included(base)
|
def self.included(base)
|
||||||
base.send :helper_method, :parse_page_edit if base.respond_to? :helper_method
|
base.send :helper_method, :parse_page_edit_noko if base.respond_to? :helper_method
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@ module ParserCommon
|
||||||
|
|
||||||
def menu_level(page, current, menu, edit = false)
|
def menu_level(page, current, menu, edit = false)
|
||||||
res = ''
|
res = ''
|
||||||
if current <= menu.levels
|
if menu.levels > 0 && current <= menu.levels
|
||||||
if current != 0
|
if current != 0
|
||||||
res << "<div class='rc_dm'>"
|
res << "<div class='rc_dm'>"
|
||||||
item = rand(100000)
|
item = rand(100000)
|
||||||
|
@ -44,4 +44,66 @@ module ParserCommon
|
||||||
res << "</li>"
|
res << "</li>"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# ad_banners
|
||||||
|
def parse_ad_banners(body = nil, page = nil, id = nil)
|
||||||
|
body.css('ad_banner').each do |banner|
|
||||||
|
res = ''
|
||||||
|
ad_banner = AdBanner.find(banner["id"]) rescue nil
|
||||||
|
if ad_banner
|
||||||
|
res << "<script type='text/javascript'>
|
||||||
|
$(document).ready(function(){ $('#slideshow-#{ad_banner.title.dehumanize}').cycle({delay: -1000, fx: '#{ad_banner.ad_fx.nil?? 'fade': ad_banner.ad_fx}', timeoutFn: getTimeout }); });
|
||||||
|
</script>"
|
||||||
|
res << "<div id='slideshow-#{ad_banner.title.dehumanize}'>"
|
||||||
|
printable_ad_images = []
|
||||||
|
ad_banner.ad_images.each do |ad_image|
|
||||||
|
if ad_image.display?
|
||||||
|
ad_image.weight.times do
|
||||||
|
printable_ad_images << ad_image
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
printable_ad_images.shuffle!
|
||||||
|
printable_ad_images.each do |ad_image| #TODO Need Reflact
|
||||||
|
res << "<img src='#{ad_image.file}' "
|
||||||
|
res << "alt='#{ad_image.title || ' '}' "
|
||||||
|
res << "time_to_next='#{ad_banner.transition_sec}' "
|
||||||
|
res << "link_open='#{ad_image.link_open}' "
|
||||||
|
# res << "link_url='#{(ad_image.direct_to_after_click?? ad_image.out_link : ad_banner.context) || ' '}' "
|
||||||
|
res << "link_url='#{(ad_image.out_link || ad_banner.context || ' ')}' "
|
||||||
|
res << "/>"
|
||||||
|
end
|
||||||
|
res << "</div>"
|
||||||
|
end
|
||||||
|
fragment = Nokogiri::HTML::DocumentFragment.new(body, res)
|
||||||
|
banner.swap(fragment)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# page_images
|
||||||
|
def parse_images(body, page)
|
||||||
|
body.css('.page_image').each do |page_image|
|
||||||
|
# image = page.custom_images.detect{|image| image.name.eql?(tag.attr['name']) }
|
||||||
|
# image = page.design.custom_images.detect{|image| image.name.eql?(tag.attr['name']) } unless image
|
||||||
|
image = page.design.images.detect{|image| image.name.eql?(File.basename(page_image['src'])) } unless image
|
||||||
|
if image
|
||||||
|
res = "<img src=#{image.file.url} "
|
||||||
|
page_image.attributes.each do |l|
|
||||||
|
res << "#{l[0]}='#{l[1]}' "
|
||||||
|
end
|
||||||
|
res << '>'
|
||||||
|
end
|
||||||
|
fragment = Nokogiri::HTML::DocumentFragment.new(body, res)
|
||||||
|
page_image.swap(fragment)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# page_menu
|
||||||
|
def parse_menu(body, page, edit=nil)
|
||||||
|
page_menu = body.css('.page_menu').first
|
||||||
|
home = get_homepage
|
||||||
|
menu = page.design.layout.menu
|
||||||
|
fragment = Nokogiri::HTML::DocumentFragment.new(body, menu_level(home, 0, menu, edit))
|
||||||
|
page_menu.swap(fragment)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,137 +1,52 @@
|
||||||
module ParserFrontEnd
|
module ParserFrontEnd
|
||||||
require 'radius'
|
|
||||||
include ParserCommon
|
include ParserCommon
|
||||||
|
# c.define_tag 'language_bar' do
|
||||||
|
# @site.in_use_locales.map{ |locale|
|
||||||
|
# lang = I18nVariable.first(:conditions => {:key => locale})[locale]
|
||||||
|
# if I18n.locale.to_s.eql?(locale)
|
||||||
|
# lang
|
||||||
|
# else
|
||||||
|
# "<a href='?locale=#{locale}'>#{lang}</a>"
|
||||||
|
# end
|
||||||
|
# }.join(' | ')
|
||||||
|
# end
|
||||||
|
# c.define_tag 'link' do |tag|
|
||||||
|
# item = Item.first(:conditions => { :full_name => tag.attr['name'] })
|
||||||
|
# ret = ''
|
||||||
|
# ret << "<a href='#{tag.attr['name']}'>"
|
||||||
|
# ret << item.i18n_variable[I18n.locale]
|
||||||
|
# ret << '</a>'
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
def parser_context(page, attributes = {}, id = nil)
|
require 'nokogiri'
|
||||||
Radius::Context.new do |c|
|
|
||||||
c.define_tag 'snippet' do |tag|
|
def parse_page_noko(page, id = nil)
|
||||||
snippet = Snippet.first(:conditions => {:name => tag.attr['name']})
|
body = Nokogiri::HTML(page.design.layout.body)
|
||||||
if snippet
|
parse_menu(body, page)
|
||||||
snippet.content
|
public_r_tags = parse_contents(body, page, id)
|
||||||
else
|
parse_images(body, page)
|
||||||
t('nothing')
|
|
||||||
|
public_r_tags.each do |tag|
|
||||||
|
send("parse_#{tag}s", body, page,id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
body.to_html
|
||||||
end
|
end
|
||||||
c.define_tag 'language_bar' do
|
|
||||||
@site.in_use_locales.map{ |locale|
|
# page_contents
|
||||||
lang = I18nVariable.first(:conditions => {:key => locale})[locale]
|
def parse_contents(body, page, id)
|
||||||
if I18n.locale.to_s.eql?(locale)
|
public_r_tags = []
|
||||||
lang
|
body.css('.page_content').each do |content|
|
||||||
else
|
|
||||||
"<a href='?locale=#{locale}'>#{lang}</a>"
|
|
||||||
end
|
|
||||||
}.join(' | ')
|
|
||||||
end
|
|
||||||
c.define_tag 'locale' do |tag|
|
|
||||||
case attributes[:locale]
|
|
||||||
when 'create'
|
|
||||||
var = I18nVariable.new(:key => (tag.attr['name'] rescue nil), :document_class => 'Text')
|
|
||||||
@site.valid_locales.each do |locale|
|
|
||||||
var[locale] = tag.attr[locale] rescue nil
|
|
||||||
end
|
|
||||||
var.save!
|
|
||||||
res = ''
|
|
||||||
res << "<r:locale id='#{var.id}' "
|
|
||||||
res << "name='#{var.key}' " if var.key
|
|
||||||
@site.valid_locales.each do |locale|
|
|
||||||
res << "#{locale}='#{var[locale]}' "
|
|
||||||
end
|
|
||||||
res << '/>'
|
|
||||||
when 'show'
|
|
||||||
var = I18nVariable.find(tag.attr['id'])
|
|
||||||
res = ''
|
|
||||||
res << "<r:locale "
|
|
||||||
res << "name='#{var.key}' " if var.key
|
|
||||||
@site.valid_locales.each do |locale|
|
|
||||||
res << "#{locale}='#{var[locale]}' "
|
|
||||||
end
|
|
||||||
res << '/>'
|
|
||||||
when 'destroy'
|
|
||||||
var = I18nVariable.find(tag.attr['id'])
|
|
||||||
var.destroy
|
|
||||||
end
|
|
||||||
end
|
|
||||||
c.define_tag 'css' do |tag|
|
|
||||||
assets = Asset.any_in(:filename => tag.attr['name'].split(',').map(&:strip))
|
|
||||||
res = ''
|
|
||||||
assets.each do |asset|
|
|
||||||
res << "<link href='#{asset.data.file.url}' rel='stylesheet' type='text/css' /> " if asset.data.file.content_type.eql?('text/css')
|
|
||||||
end
|
|
||||||
res
|
|
||||||
end
|
|
||||||
c.define_tag 'stylesheets' do |tag|
|
|
||||||
res = ''
|
|
||||||
res << "<link href='/assets/bootstrap.css.erb' rel='stylesheet' type='text/css'/>"
|
|
||||||
res << "<link href='/assets/bootstrap-orbit.css' rel='stylesheet' type='text/css'/>"
|
|
||||||
res << "<link href='/assets/style.css.erb' rel='stylesheet' type='text/css'/>"
|
|
||||||
res << "<link href='#{page.design.reset_css.file.url}' rel='stylesheet' type='text/css' />" if page.design.reset_css
|
|
||||||
res << "<link href='#{page.design.default_css.file.url}' rel='stylesheet' type='text/css' /> " if page.design.default_css
|
|
||||||
theme = page.design.themes.detect{ |d| d.id == page.theme_id }
|
|
||||||
res << "<link href='#{theme.file.url}' rel='stylesheet' type='text/css' />" if theme
|
|
||||||
res
|
|
||||||
end
|
|
||||||
c.define_tag 'javascripts' do |tag|
|
|
||||||
res = ''
|
|
||||||
res << "<script type='text/javascript' src='/static/jquery.js'></script>"
|
|
||||||
res << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>"
|
|
||||||
res << "<script type='text/javascript' src='/static/kernel.js'></script>"
|
|
||||||
res << "<script type='text/javascript' src='/assets/bootstrap.js'></script>"
|
|
||||||
res << "<script type='text/javascript' src='/assets/jquery.tinyscrollbar.min.js'></script>"
|
|
||||||
res << "<script type='text/javascript' src='/assets/jquery.isotope.min.js'></script>"
|
|
||||||
res << "<script type='text/javascript' src='/assets/orbit-1.0.js'></script>"
|
|
||||||
res << "<script type='text/javascript' src='/assets/orbit_bar.js'></script>"
|
|
||||||
res << "<script type='text/javascript' src='/assets/event.js'></script>"
|
|
||||||
page.design.javascripts.each do |js|
|
|
||||||
# res << "<script type='text/javascript' src='#{js.file.url}'></script>"
|
|
||||||
end
|
|
||||||
res
|
|
||||||
end
|
|
||||||
c.define_tag 'ad_banner' do |tag|
|
|
||||||
res = ''
|
|
||||||
ad_banner = AdBanner.find(tag.attr["id"]) rescue nil
|
|
||||||
if ad_banner && ad_banner.display?
|
|
||||||
res << "<script type='text/javascript'>
|
|
||||||
$(document).ready(function(){ $('#slideshow-#{ad_banner.title.dehumanize}').cycle({delay: -1000, fx: '#{ad_banner.ad_fx.nil?? 'fade': ad_banner.ad_fx}', timeoutFn: getTimeout }); });
|
|
||||||
</script>"
|
|
||||||
res << "<div id='slideshow-#{ad_banner.title.dehumanize}'>"
|
|
||||||
ad_banner.ad_images.each do |ad_image|
|
|
||||||
res << "<img src='#{ad_image.file}' "
|
|
||||||
res << "alt='#{ad_image.picture_intro || ' '}' "
|
|
||||||
res << "time_to_next='#{ad_image.get_delay_time}' "
|
|
||||||
res << "link_open='#{ad_image.link_open}' "
|
|
||||||
res << "link_url='#{(ad_banner.direct_to_after_click?? ad_image.out_link : ad_banner.context) || ' '}' "
|
|
||||||
res << "/>"
|
|
||||||
end
|
|
||||||
res << "</div>"
|
|
||||||
end
|
|
||||||
res
|
|
||||||
end
|
|
||||||
c.define_tag 'image' do |tag|
|
|
||||||
# image = page.custom_images.detect{|image| image.name.eql?(tag.attr['name']) }
|
|
||||||
# image = page.design.custom_images.detect{|image| image.name.eql?(tag.attr['name']) } unless image
|
|
||||||
image = page.design.images.detect{|image| image.name.eql?(tag.attr['name']) } unless image
|
|
||||||
if image
|
|
||||||
res = "<img src=#{image.file.url} "
|
|
||||||
tag.attr.each do |l|
|
|
||||||
res << "#{l[0]}='#{l[1]}' "
|
|
||||||
end
|
|
||||||
res << '>'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
c.define_tag 'layout_part' do |tag|
|
|
||||||
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s } rescue nil
|
|
||||||
part.content
|
|
||||||
end
|
|
||||||
c.define_tag 'content' do |tag|
|
|
||||||
ret = ''
|
ret = ''
|
||||||
if (tag.attributes["main"] == "true" && !page.module_app.nil?)
|
if (content["main"] == "true" && !page.module_app.nil?)
|
||||||
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}"
|
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}"
|
||||||
ret << "/#{id}" if id
|
ret << "/#{id}" if id
|
||||||
ret << "?inner=true&page_id=#{page.id}"
|
ret << "?inner=true&page_id=#{page.id}"
|
||||||
ret << "&category_id=#{page.category}" if page[:category]
|
ret << "&category_id=#{page.category}" if page[:category]
|
||||||
ret << "'></div>"
|
ret << "'></div>"
|
||||||
else
|
else
|
||||||
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s } rescue nil
|
part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil
|
||||||
case part.kind
|
case part.kind
|
||||||
when 'text'
|
when 'text'
|
||||||
ret << part.i18n_variable[I18n.locale] rescue ''
|
ret << part.i18n_variable[I18n.locale] rescue ''
|
||||||
|
@ -143,38 +58,20 @@ module ParserFrontEnd
|
||||||
end
|
end
|
||||||
when 'public_r_tag'
|
when 'public_r_tag'
|
||||||
ret << "<r:#{part.public_r_tag} id='#{part.public_r_tag_object_id}'/>"
|
ret << "<r:#{part.public_r_tag} id='#{part.public_r_tag_object_id}'/>"
|
||||||
|
public_r_tags << part.public_r_tag
|
||||||
else
|
else
|
||||||
''
|
''
|
||||||
|
end if part
|
||||||
end
|
end
|
||||||
|
scope = "<#{content.name}"
|
||||||
|
content.attributes.each_pair do |key, value|
|
||||||
|
scope << " #{key}='#{value}'"
|
||||||
end
|
end
|
||||||
ret
|
scope << ">#{ret}</#{content.name}>"
|
||||||
|
fragment = Nokogiri::HTML::DocumentFragment.new(body, scope)
|
||||||
|
content.swap(fragment)
|
||||||
end
|
end
|
||||||
c.define_tag 'link' do |tag|
|
public_r_tags.uniq
|
||||||
item = Item.first(:conditions => { :full_name => tag.attr['name'] })
|
|
||||||
ret = ''
|
|
||||||
ret << "<a href='#{tag.attr['name']}'>"
|
|
||||||
ret << item.i18n_variable[I18n.locale]
|
|
||||||
ret << '</a>'
|
|
||||||
end
|
|
||||||
c.define_tag 'menu' do |tag|
|
|
||||||
home = get_homepage
|
|
||||||
menu = page.design.layout.menu
|
|
||||||
menu_level(home, 0, menu)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def parse_page(page, id = nil)
|
|
||||||
if page._type == 'Page'
|
|
||||||
layout_content = page.design.layout.content.force_encoding('UTF-8') rescue ''
|
|
||||||
context = parser_context(page, {}, id)
|
|
||||||
parser = Radius::Parser.new(context, :tag_prefix => 'r')
|
|
||||||
parser.parse(parser.parse(layout_content))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.included(base)
|
|
||||||
base.send :helper_method, :parse_page if base.respond_to? :helper_method
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,44 +1,31 @@
|
||||||
module ParserLayout
|
module ParserLayout
|
||||||
require 'radius'
|
require 'nokogiri'
|
||||||
include ParserCommon
|
|
||||||
|
|
||||||
def parse_layout_contents(layout)
|
def parse_body(layout)
|
||||||
content = layout.content.force_encoding('UTF-8')
|
body = Nokogiri::HTML(layout.body)
|
||||||
context = parser_layout_contents(layout)
|
|
||||||
parser = Radius::Parser.new(context, :tag_prefix => 'r')
|
body.css('.page_content').each do |content|
|
||||||
parser.parse(content)
|
layout.layout_parts.build(:name => content['name'])
|
||||||
end
|
end
|
||||||
|
|
||||||
def parser_layout_contents(layout)
|
body.css('.page_menu').each do |menu|
|
||||||
Radius::Context.new do |c|
|
|
||||||
c.define_tag 'javascripts' do |tag|
|
|
||||||
end
|
|
||||||
c.define_tag 'stylesheets' do |tag|
|
|
||||||
end
|
|
||||||
c.define_tag 'ad_banner' do |tag|
|
|
||||||
end
|
|
||||||
c.define_tag 'menu' do |tag|
|
|
||||||
layout.build_menu(:levels => 0, :values => {}) unless layout.menu
|
layout.build_menu(:levels => 0, :values => {}) unless layout.menu
|
||||||
layout.menu.levels = i = tag.attr['level'].to_i
|
layout.menu.levels = i = menu['level'].to_i
|
||||||
layout.menu.values.merge!({'home' => tag.attr['home']}) if i == 1
|
layout.menu.values.merge!({'home' => menu['home']}) if i == 1
|
||||||
layout.menu.values.merge!({"id_#{i}" => tag.attr['id'], "class_#{i}" => tag.attr['class'], "li_class_#{i}" => tag.attr['li_class'], "li_incremental_#{i}" => tag.attr['li_incremental']})
|
layout.menu.values.merge!({"id_#{i}" => menu['id'], "class_#{i}" => menu['class'], "li_class_#{i}" => menu['li_class'], "li_incremental_#{i}" => menu['li_incremental']})
|
||||||
tag.expand
|
|
||||||
end
|
|
||||||
c.define_tag 'content' do |tag|
|
|
||||||
layout.layout_parts.new(:name => tag.attr['name'])
|
|
||||||
end
|
|
||||||
c.define_tag 'image' do |tag|
|
|
||||||
image = layout.design.images.detect{ |i| i.file_identifier.eql?(parse_html_image(tag.expand)) }
|
|
||||||
image.update_attributes(:name => tag.attr['name'], :html_id => tag.attr['id'], :html_class => tag.attr['class']) if image
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_html_image(html)
|
|
||||||
html.scan(/(?<=\<img)(.*?)(?=\/\>)/){
|
|
||||||
$1.gsub(' ','').scan(/(?<=src=\")(.*?)(?=\")/){
|
|
||||||
return File.basename($1).gsub(/[\\\"]/, '')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def parse_body_for_images(design)
|
||||||
|
body = Nokogiri::HTML(design.layout.body)
|
||||||
|
|
||||||
|
body.css('.page_image').each do |page_image|
|
||||||
|
image = design.images.where( file: File.basename(page_image['src']))[0]
|
||||||
|
image.update_attributes(:name => File.basename(page_image['src']), :html_id => page_image['id'], :html_class => page_image['class']) if image
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
|
||||||
|
namespace :nokogiri do
|
||||||
|
task :layout => :environment do
|
||||||
|
l = Design.first(:conditions => {:title => 'CCU'}).layout
|
||||||
|
l.layout_parts.destroy rescue nil
|
||||||
|
l.menu.destroy rescue nil
|
||||||
|
l.design.save
|
||||||
|
l = Design.first(:conditions => {:title => 'CCU'}).layout
|
||||||
|
l.file = File.open("#{Rails.root}/lib/noko/layout.html")
|
||||||
|
l.design.save
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,5 +1,4 @@
|
||||||
class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendController
|
class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendController
|
||||||
layout 'new_admin'
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@bulletin_categorys = BulletinCategory.all
|
@bulletin_categorys = BulletinCategory.all
|
||||||
|
@ -93,7 +92,7 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendCo
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @bulletin_category.update_attributes(params[:bulletin_category])
|
if @bulletin_category.update_attributes(params[:bulletin_category])
|
||||||
# format.html { redirect_to(panel_announcement_back_end_bulletin_category_url(@bulletin_category), :notice => t('bulletin_category.update_bulletin_category_success')) }
|
# format.html { redirect_to(panel_announcement_back_end_bulletin_category_url(@bulletin_category), :notice => t('bulletin_category.update_bulletin_category_success')) }
|
||||||
format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url, :notice => t('bulletin_category.update_bulletin_category_success')) }
|
# format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url, :notice => t('bulletin_category.update_bulletin_category_success')) }
|
||||||
# format.xml { head :ok }
|
# format.xml { head :ok }
|
||||||
format.js
|
format.js
|
||||||
else
|
else
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
class Panel::Announcement::BackEnd::BulletinFilesController < ApplicationController
|
||||||
|
|
||||||
|
layout 'new_admin'
|
||||||
|
|
||||||
|
def index
|
||||||
|
@bulletin_files = BulletinFile.all
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # index.html.erb
|
||||||
|
# format.xml { render :xml => @bulletins }
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /bulletins
|
||||||
|
# POST /bulletins.xml
|
||||||
|
def create
|
||||||
|
@bulletin_file = BulletinFile.new(params[:bulletin_file])
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @bulletin_file.save
|
||||||
|
format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||||
|
format.js
|
||||||
|
else
|
||||||
|
format.html { render :action => "new" }
|
||||||
|
format.js { render action: "new" }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# PUT /bulletins/1
|
||||||
|
# PUT /bulletins/1.xml
|
||||||
|
def update
|
||||||
|
@bulletin_file = BulletinFile.find(params[:id])
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @bulletin_file.update_attributes(params[:bulletin_file])
|
||||||
|
format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||||
|
format.js
|
||||||
|
else
|
||||||
|
format.html { render :action => "edit" }
|
||||||
|
format.js { render :action => "edit" }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -1,14 +0,0 @@
|
||||||
class Panel::Announcement::BackEnd::BulletinLinksController < ApplicationController
|
|
||||||
|
|
||||||
layout 'new_admin'
|
|
||||||
|
|
||||||
def index
|
|
||||||
@bulletin_links = BulletinLink.all
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # index.html.erb
|
|
||||||
# format.xml { render :xml => @bulletins }
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
class Panel::Announcement::BackEnd::BulletinLinksController < ApplicationController
|
||||||
|
|
||||||
|
layout 'new_admin'
|
||||||
|
|
||||||
|
def index
|
||||||
|
@bulletin_links = BulletinLink.all
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # index.html.erb
|
||||||
|
# format.xml { render :xml => @bulletins }
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /bulletins
|
||||||
|
# POST /bulletins.xml
|
||||||
|
def create
|
||||||
|
@bulletin_link = BulletinLink.new(params[:bulletin_link])
|
||||||
|
# @bulletin_link.bulletin_id = params[:bulletin_link][:bulletin_id]
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @bulletin_link.save
|
||||||
|
format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||||
|
format.js
|
||||||
|
else
|
||||||
|
format.html { render :action => "new" }
|
||||||
|
format.js { render action: "new" }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# PUT /bulletins/1
|
||||||
|
# PUT /bulletins/1.xml
|
||||||
|
def update
|
||||||
|
@bulletin_link = BulletinLink.find(params[:id])
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @bulletin_link.update_attributes(params[:bulletin_link])
|
||||||
|
format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||||
|
format.js
|
||||||
|
else
|
||||||
|
format.html { render :action => "edit" }
|
||||||
|
format.js { render :action => "edit" }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -1,5 +1,4 @@
|
||||||
class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
layout 'new_admin'
|
|
||||||
|
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
before_filter :is_admin?
|
before_filter :is_admin?
|
||||||
|
@ -10,16 +9,39 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
get_categorys(params[:bulletin_category_id])
|
get_categorys(params[:bulletin_category_id])
|
||||||
get_tags
|
get_tags
|
||||||
|
|
||||||
|
@filter = params[:filter]
|
||||||
|
new_filter = params[:new_filter]
|
||||||
|
|
||||||
|
if @filter && params[:clear]
|
||||||
|
@filter.delete(params[:type])
|
||||||
|
elsif @filter && new_filter
|
||||||
|
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
|
||||||
|
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
|
||||||
|
elsif @filter.has_key?(new_filter[:type])
|
||||||
|
@filter[new_filter[:type]] << new_filter[:id].to_s
|
||||||
|
else
|
||||||
|
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
|
||||||
|
end
|
||||||
|
elsif new_filter
|
||||||
|
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
|
||||||
|
end
|
||||||
|
|
||||||
# @bulletins = Bulletin.where("bulletin_category_id" => params[:bulletin_category_id]).desc("postdate") if params[:bulletin_category_id]
|
# @bulletins = Bulletin.where("bulletin_category_id" => params[:bulletin_category_id]).desc("postdate") if params[:bulletin_category_id]
|
||||||
|
|
||||||
# @bulletins = Bulletin.search(params[:search], params[:category_id])
|
# @bulletins = Bulletin.search(params[:search], params[:category_id])
|
||||||
# @bulletins = Bulletin.all.order_by([params[:sort], params[:direction]])
|
# @bulletins = Bulletin.all.order_by([params[:sort], params[:direction]])
|
||||||
@bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all
|
@bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered_bulletins : Bulletin.all.page(params[:page]).per(10)
|
||||||
@bulletin_categories = BulletinCategory.all
|
@bulletin_categories = BulletinCategory.all
|
||||||
|
|
||||||
|
@bulletin_link = BulletinLink.new
|
||||||
|
@link_url = panel_announcement_back_end_bulletins_path
|
||||||
|
|
||||||
|
@bulletin_file = BulletinFile.new
|
||||||
|
@file_url = panel_announcement_back_end_bulletins_path
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # index.html.erb
|
format.html # index.html.erb
|
||||||
format.js
|
format.js { }
|
||||||
format.xml { render :xml => @bulletins }
|
format.xml { render :xml => @bulletins }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -78,6 +100,29 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
# POST /bulletins
|
# POST /bulletins
|
||||||
# POST /bulletins.xml
|
# POST /bulletins.xml
|
||||||
def create
|
def create
|
||||||
|
|
||||||
|
if params[:bulletin_link]
|
||||||
|
|
||||||
|
@bulletin_link = BulletinLink.new(params[:bulletin_link])
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @bulletin_link.save
|
||||||
|
format.js { render 'create_bulletin_link' }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
elsif params[:bulletin_file]
|
||||||
|
|
||||||
|
@bulletin_file = BulletinFile.new(params[:bulletin_file])
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @bulletin_file.save
|
||||||
|
format.js { render 'create_bulletin_file' }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
@bulletin = Bulletin.new(params[:bulletin])
|
@bulletin = Bulletin.new(params[:bulletin])
|
||||||
|
|
||||||
@bulletin.create_user_id = current_user.id
|
@bulletin.create_user_id = current_user.id
|
||||||
|
@ -88,20 +133,25 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
# format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('announcement.create_bulletin_success')) }
|
# format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('announcement.create_bulletin_success')) }
|
||||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('announcement.create_bulletin_success')) }
|
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('announcement.create_bulletin_success')) }
|
||||||
format.xml { render :xml => @bulletin, :status => :created, :location => @bulletin }
|
format.xml { render :xml => @bulletin, :status => :created, :location => @bulletin }
|
||||||
|
format.js
|
||||||
else
|
else
|
||||||
format.html { render :action => "new" }
|
format.html { render :action => "new" }
|
||||||
format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity }
|
format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def link_quick_add
|
def link_quick_add
|
||||||
# debugger
|
# debugger
|
||||||
|
|
||||||
@bulletin = Bulletin.find(params[:bulletin_id])
|
@bulletin_link = BulletinLink.new
|
||||||
|
|
||||||
@link_url = panel_announcement_back_end_bulletins_path
|
@link_url = panel_announcement_back_end_bulletins_path
|
||||||
|
|
||||||
|
@bulletin_link.bulletin_id = params[:bulletin_id]
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
|
@ -110,10 +160,13 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
|
|
||||||
def link_quick_edit
|
def link_quick_edit
|
||||||
# debugger
|
# debugger
|
||||||
|
@bulletin_link = BulletinLink.find(params[:bulletin_id])
|
||||||
|
|
||||||
@bulletin = Bulletin.find(params[:bulletin_id])
|
@link_url = panel_announcement_back_end_bulletin_path(@bulletin_link)
|
||||||
|
|
||||||
@link_url = panel_announcement_back_end_bulletin_path(@bulletin)
|
# @bulletin = Bulletin.find(params[:bulletin_id])
|
||||||
|
|
||||||
|
# @link_url = panel_announcement_back_end_bulletin_path(@bulletin)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
|
@ -121,9 +174,63 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def file_quick_add
|
||||||
|
# debugger
|
||||||
|
|
||||||
|
@bulletin_file = BulletinFile.new
|
||||||
|
@file_url = panel_announcement_back_end_bulletins_path
|
||||||
|
|
||||||
|
@bulletin_file.bulletin_id = params[:bulletin_id]
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def file_quick_edit
|
||||||
|
# debugger
|
||||||
|
@bulletin_file = BulletinFile.find(params[:bulletin_id])
|
||||||
|
|
||||||
|
@file_url = panel_announcement_back_end_bulletin_path(@bulletin_file)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# PUT /bulletins/1
|
# PUT /bulletins/1
|
||||||
# PUT /bulletins/1.xml
|
# PUT /bulletins/1.xml
|
||||||
def update
|
def update
|
||||||
|
|
||||||
|
if params[:bulletin_link]
|
||||||
|
|
||||||
|
@bulletin_link = BulletinLink.find(params[:id])
|
||||||
|
|
||||||
|
@link_url = panel_announcement_back_end_bulletin_path(@bulletin_link)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @bulletin_link.update_attributes(params[:bulletin_link])
|
||||||
|
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||||
|
format.js { render 'update_bulletin_link' }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
elsif params[:bulletin_file]
|
||||||
|
|
||||||
|
@bulletin_file = BulletinFile.find(params[:id])
|
||||||
|
|
||||||
|
@file_url = panel_announcement_back_end_bulletin_path(@bulletin_file)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @bulletin_file.update_attributes(params[:bulletin_file])
|
||||||
|
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||||
|
format.js { render 'update_bulletin_file' }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
@bulletin = Bulletin.find(params[:id])
|
@bulletin = Bulletin.find(params[:id])
|
||||||
|
|
||||||
@bulletin.update_user_id = current_user.id
|
@bulletin.update_user_id = current_user.id
|
||||||
|
@ -146,6 +253,9 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity }
|
format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# DELETE /bulletins/1
|
# DELETE /bulletins/1
|
||||||
|
@ -173,6 +283,21 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
|
||||||
|
def load_quick_edit
|
||||||
|
@bulletin = Bulletin.find(params[:id])
|
||||||
|
@type = params[:type]
|
||||||
|
@bulletin_categories = BulletinCategory.all
|
||||||
|
get_tags
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete
|
||||||
|
if params[:to_delete]
|
||||||
|
bulletins = Bulletin.any_in(:_id => params[:to_delete]).delete_all
|
||||||
|
end
|
||||||
|
redirect_to panel_announcement_back_end_bulletins_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def get_categorys(id = nil)
|
def get_categorys(id = nil)
|
||||||
|
@ -189,16 +314,11 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
|
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_tags
|
def get_sorted_and_filtered_bulletins
|
||||||
module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
|
|
||||||
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_sorted_bulletins
|
|
||||||
bulletins = Bulletin.all
|
bulletins = Bulletin.all
|
||||||
case params[:sort]
|
case params[:sort]
|
||||||
when 'postdate', 'deadline'
|
when 'postdate', 'deadline'
|
||||||
bulletins.order_by([params[:sort], params[:direction]])
|
bulletins = bulletins.order_by([params[:sort], params[:direction]])
|
||||||
when 'category'
|
when 'category'
|
||||||
category_ids = bulletins.distinct(:bulletin_category_id)
|
category_ids = bulletins.distinct(:bulletin_category_id)
|
||||||
categories = BulletinCategory.find(category_ids) rescue nil
|
categories = BulletinCategory.find(category_ids) rescue nil
|
||||||
|
@ -207,36 +327,66 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
categories.each { |category| h[category.i18n_variable[I18n.locale]] = category.id }
|
categories.each { |category| h[category.i18n_variable[I18n.locale]] = category.id }
|
||||||
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
|
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
|
||||||
sorted_categorys = sorted.collect {|a| bulletins.where(:bulletin_category_id => a[1]).entries }
|
sorted_categorys = sorted.collect {|a| bulletins.where(:bulletin_category_id => a[1]).entries }
|
||||||
sorted_categorys.flatten
|
bulletins = sorted_categorys.flatten!
|
||||||
else
|
|
||||||
nil
|
|
||||||
end
|
end
|
||||||
when 'title'
|
when 'title'
|
||||||
h = Hash.new
|
h = Array.new
|
||||||
bulletins.each { |bulletin| h[bulletin.title[I18n.locale]] = bulletin }
|
bulletins.each { |bulletin| h << [bulletin.title[I18n.locale].downcase, bulletin] }
|
||||||
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
|
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
|
||||||
sorted.collect {|a| a[1] }
|
bulletins = sorted.collect {|a| a[1] }
|
||||||
when 'status'
|
when 'status'
|
||||||
bulletins.order_by(:is_top, params[:direction]).order_by(:is_hot, params[:direction]).order_by(:is_hidden, params[:direction])
|
bulletins = bulletins.order_by(:is_top, params[:direction]).order_by(:is_hot, params[:direction]).order_by(:is_hidden, params[:direction])
|
||||||
when 'update_user_id'
|
when 'update_user_id'
|
||||||
user_ids = bulletins.distinct(:update_user_id)
|
user_ids = bulletins.distinct(:update_user_id)
|
||||||
users = User.find(user_ids) rescue nil
|
users = User.find(user_ids) rescue nil
|
||||||
if users
|
if users
|
||||||
h = Hash.new
|
h = Array.new
|
||||||
users.each { |user| h[user.name] = user.id }
|
users.each { |user| h << [user.name, user.id] }
|
||||||
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
|
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
|
||||||
sorted_users = sorted.collect {|a| bulletins.where(:update_user_id => a[1]).entries }
|
sorted_users = sorted.collect {|a| bulletins.where(:update_user_id => a[1]).entries }
|
||||||
sorted_users.flatten
|
bulletins = sorted_users.flatten
|
||||||
else
|
|
||||||
nil
|
|
||||||
end
|
end
|
||||||
when 'tags'
|
when 'tags'
|
||||||
a = Array.new
|
a = Array.new
|
||||||
AnnouncementTag.all.order_by(I18n.locale, params[:direction]).each { |tag| a << tag.bulletins }
|
AnnouncementTag.all.order_by(I18n.locale, params[:direction]).each { |tag| a << tag.bulletins }
|
||||||
a.flatten!
|
a.flatten!
|
||||||
a.uniq
|
a.uniq!
|
||||||
|
tmp = Array.new
|
||||||
|
bulletins.where(:tag_ids => []).each { |bulletin| tmp << [bulletin.title[I18n.locale].downcase, bulletin] }
|
||||||
|
sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse!
|
||||||
|
sorted_titles = sorted.collect {|a| a[1] }
|
||||||
|
a = params[:direction].eql?('asc') ? (sorted_titles + a) : (a + sorted_titles)
|
||||||
|
bulletins = a.flatten
|
||||||
|
end
|
||||||
|
if @filter
|
||||||
|
@filter.each do |key, value|
|
||||||
|
case key
|
||||||
|
when 'status'
|
||||||
|
a = Array.new
|
||||||
|
bulletins.each do |bulletin|
|
||||||
|
value.each do |v|
|
||||||
|
a << bulletin if bulletin[v]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
bulletins = a
|
||||||
|
when 'categories'
|
||||||
|
a = Array.new
|
||||||
|
bulletins.each do |bulletin|
|
||||||
|
a << bulletin if value.include?(bulletin.bulletin_category.id.to_s)
|
||||||
|
end
|
||||||
|
bulletins = a
|
||||||
|
when 'tags'
|
||||||
|
a = Array.new
|
||||||
|
bulletins.each do |bulletin|
|
||||||
|
bulletin.tags.each do |tag|
|
||||||
|
a << bulletin if value.include?(tag.id.to_s)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
bulletins = a
|
||||||
|
end if value.size > 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Kaminari.paginate_array(bulletins).page(params[:page]).per(10)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,6 @@ class Panel::Announcement::BackEnd::FactChecksController < OrbitBackendControll
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
include AdminHelper
|
include AdminHelper
|
||||||
# layout 'admin'
|
# layout 'admin'
|
||||||
layout 'new_admin'
|
|
||||||
|
|
||||||
def setting
|
def setting
|
||||||
@bulletin_categorys = BulletinCategory.all
|
@bulletin_categorys = BulletinCategory.all
|
||||||
|
@ -18,7 +17,7 @@ class Panel::Announcement::BackEnd::FactChecksController < OrbitBackendControll
|
||||||
else
|
else
|
||||||
first_category = @bulletin_categorys.first
|
first_category = @bulletin_categorys.first
|
||||||
end
|
end
|
||||||
preload_object_auth = first_category.object_auths.where(title: 'fact_check') || (first_category.object_auths.create :title=> 'fact_check')
|
preload_object_auth = first_category.object_auths.where(title: 'fact_check').empty?? (first_category.object_auths.create! :title=> 'fact_check') : first_category.object_auths.where(title: 'fact_check')
|
||||||
@users_array = preload_object_auth.first.privilege_users rescue []
|
@users_array = preload_object_auth.first.privilege_users rescue []
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
|
|
|
@ -2,7 +2,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
super
|
super
|
||||||
@app_title = NewBlog::MOUDLEAPP_TITLE
|
@app_title = 'announcement'
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /bulletins
|
# GET /bulletins
|
||||||
|
@ -12,9 +12,9 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
||||||
|
|
||||||
date_now = Time.now
|
date_now = Time.now
|
||||||
if params[:category_id]
|
if params[:category_id]
|
||||||
@bulletins = Bulletin.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
|
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
|
||||||
else
|
else
|
||||||
@bulletins = Bulletin.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
|
@bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
get_categorys
|
get_categorys
|
||||||
|
@ -23,7 +23,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@bulletin = Bulletin.find(params[:id])
|
@bulletin = Bulletin.can_display.where.where(_id: params[:id])
|
||||||
get_categorys
|
get_categorys
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
super
|
super
|
||||||
@app_title = NewBlog::MOUDLEAPP_TITLE
|
@app_title = 'announcement'
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /bulletins
|
# GET /bulletins
|
||||||
|
@ -14,9 +14,9 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
||||||
# @bulletin_categorys = BulletinCategory.first;
|
# @bulletin_categorys = BulletinCategory.first;
|
||||||
# @bulletins = Bulletin.widget_datas(@bulletin_categorys.id).limit(9)
|
# @bulletins = Bulletin.widget_datas(@bulletin_categorys.id).limit(9)
|
||||||
if params[:category_id]
|
if params[:category_id]
|
||||||
@bulletins = Bulletin.where(:bulletin_category_id => params[:category_id]).widget_datas.limit(9)
|
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).widget_datas.limit(9)
|
||||||
else
|
else
|
||||||
@bulletins = Bulletin.widget_datas.limit(9)
|
@bulletins = Bulletin.can_display.widget_datas.limit(9)
|
||||||
end
|
end
|
||||||
|
|
||||||
get_categorys
|
get_categorys
|
||||||
|
@ -26,14 +26,14 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
||||||
def bulletins_and_web_links
|
def bulletins_and_web_links
|
||||||
@tags = AnnouncementTag.all
|
@tags = AnnouncementTag.all
|
||||||
@selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0]
|
@selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0]
|
||||||
@bulletins = @selected_tag.get_visible_bulletins.page(params[:page]).per(5) rescue nil
|
@bulletins = @selected_tag.get_visible_bulletins.can_display.page(params[:page]).per(5) rescue nil
|
||||||
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil
|
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil
|
||||||
render :layout => 'module_widget'
|
render :layout => 'module_widget'
|
||||||
end
|
end
|
||||||
|
|
||||||
def reload_bulletins
|
def reload_bulletins
|
||||||
@selected_tag = AnnouncementTag.find(params[:tag_id])
|
@selected_tag = AnnouncementTag.find(params[:tag_id])
|
||||||
@bulletins = @selected_tag.get_visible_bulletins.page(params[:page]).per(5) rescue nil
|
@bulletins = @selected_tag.get_visible_bulletins.can_display.page(params[:page]).per(5) rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def reload_web_links
|
def reload_web_links
|
||||||
|
|
|
@ -1,101 +0,0 @@
|
||||||
# encoding: utf-8
|
|
||||||
|
|
||||||
class Bulletin
|
|
||||||
include Mongoid::Document
|
|
||||||
include Mongoid::Timestamps
|
|
||||||
include Mongoid::MultiParameterAttributes
|
|
||||||
|
|
||||||
# field :category_id, :type => Integer
|
|
||||||
field :title
|
|
||||||
# has_one :title_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
|
||||||
# has_one :subtitle_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
|
||||||
# has_one :text_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
|
||||||
field :subtitle
|
|
||||||
field :text
|
|
||||||
field :postdate , :type => Date
|
|
||||||
field :deadline , :type => Date
|
|
||||||
# field :url
|
|
||||||
field :create_user_id
|
|
||||||
field :update_user_id
|
|
||||||
|
|
||||||
field :is_top, :type => Boolean, :default => false
|
|
||||||
|
|
||||||
mount_uploader :image, ImageUploader
|
|
||||||
|
|
||||||
belongs_to :bulletin_category
|
|
||||||
|
|
||||||
embeds_many :bulletin_links, :cascade_callbacks => true
|
|
||||||
embeds_many :bulletin_files, :cascade_callbacks => true
|
|
||||||
|
|
||||||
# has_many :bulletin_files, :autosave => true, :dependent => :destroy
|
|
||||||
|
|
||||||
accepts_nested_attributes_for :bulletin_files, :allow_destroy => true
|
|
||||||
accepts_nested_attributes_for :bulletin_links, :allow_destroy => true
|
|
||||||
|
|
||||||
# validates_presence_of :title_variable
|
|
||||||
validates_presence_of :title
|
|
||||||
|
|
||||||
after_save :save_bulletin_links
|
|
||||||
after_save :save_bulletin_files
|
|
||||||
|
|
||||||
|
|
||||||
def self.search( search = nil, category_id = nil )
|
|
||||||
|
|
||||||
if category_id.to_s.size > 0 and search.to_s.size > 0
|
|
||||||
|
|
||||||
key = /#{search}/
|
|
||||||
|
|
||||||
find(:all, :conditions => {title: key, bulletin_category_id: category_id}).desc( :is_top, :postdate )
|
|
||||||
|
|
||||||
elsif category_id.to_s.size > 0 and search.to_s.size < 1
|
|
||||||
|
|
||||||
find(:all, :conditions => {bulletin_category_id: category_id}).desc( :is_top, :postdate )
|
|
||||||
|
|
||||||
elsif search.to_s.size > 0 and category_id.to_s.size < 1
|
|
||||||
|
|
||||||
key = /#{search}/
|
|
||||||
|
|
||||||
find(:all, :conditions => {title: key}).desc( :is_top, :postdate )
|
|
||||||
else
|
|
||||||
|
|
||||||
find(:all).desc( :is_top, :postdate)
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
def self.widget_datas
|
|
||||||
|
|
||||||
date_now = Time.now
|
|
||||||
|
|
||||||
# find(:all, :conditions => {:postdate => {"$lte" => Date.today}, deadline: nil} ).desc( :is_top, :postdate)
|
|
||||||
# where( :postdate.lte => date_now ).where( :deadline => nil ).desc(:is_top, :postdate)
|
|
||||||
# any_of({ :title => "test" },{:deadline => nil, :title => "123"})
|
|
||||||
any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).limit(5)
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
def is_top?
|
|
||||||
self.is_top
|
|
||||||
end
|
|
||||||
|
|
||||||
def save_bulletin_links
|
|
||||||
self.bulletin_links.each do |t|
|
|
||||||
if t.should_destroy
|
|
||||||
t.destroy
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def save_bulletin_files
|
|
||||||
self.bulletin_files.each do |t|
|
|
||||||
if t.should_destroy
|
|
||||||
t.destroy
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,101 +0,0 @@
|
||||||
# encoding: utf-8
|
|
||||||
|
|
||||||
class Bulletin
|
|
||||||
include Mongoid::Document
|
|
||||||
include Mongoid::Timestamps
|
|
||||||
include Mongoid::MultiParameterAttributes
|
|
||||||
|
|
||||||
# field :category_id, :type => Integer
|
|
||||||
field :title
|
|
||||||
# has_one :title_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
|
||||||
# has_one :subtitle_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
|
||||||
# has_one :text_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
|
||||||
field :subtitle
|
|
||||||
field :text
|
|
||||||
field :postdate , :type => Date
|
|
||||||
field :deadline , :type => Date
|
|
||||||
# field :url
|
|
||||||
field :create_user_id
|
|
||||||
field :update_user_id
|
|
||||||
|
|
||||||
field :is_top, :type => Boolean, :default => false
|
|
||||||
|
|
||||||
mount_uploader :image, ImageUploader
|
|
||||||
|
|
||||||
belongs_to :bulletin_category
|
|
||||||
|
|
||||||
embeds_many :bulletin_links, :cascade_callbacks => true
|
|
||||||
embeds_many :bulletin_files, :cascade_callbacks => true
|
|
||||||
|
|
||||||
# has_many :bulletin_files, :autosave => true, :dependent => :destroy
|
|
||||||
|
|
||||||
accepts_nested_attributes_for :bulletin_files, :allow_destroy => true
|
|
||||||
accepts_nested_attributes_for :bulletin_links, :allow_destroy => true
|
|
||||||
|
|
||||||
# validates_presence_of :title_variable
|
|
||||||
validates_presence_of :title
|
|
||||||
|
|
||||||
after_save :save_bulletin_links
|
|
||||||
after_save :save_bulletin_files
|
|
||||||
|
|
||||||
|
|
||||||
def self.search( search = nil, category_id = nil )
|
|
||||||
|
|
||||||
if category_id.to_s.size > 0 and search.to_s.size > 0
|
|
||||||
|
|
||||||
key = /#{search}/
|
|
||||||
|
|
||||||
find(:all, :conditions => {title: key, bulletin_category_id: category_id}).desc( :is_top, :postdate )
|
|
||||||
|
|
||||||
elsif category_id.to_s.size > 0 and search.to_s.size < 1
|
|
||||||
|
|
||||||
find(:all, :conditions => {bulletin_category_id: category_id}).desc( :is_top, :postdate )
|
|
||||||
|
|
||||||
elsif search.to_s.size > 0 and category_id.to_s.size < 1
|
|
||||||
|
|
||||||
key = /#{search}/
|
|
||||||
|
|
||||||
find(:all, :conditions => {title: key}).desc( :is_top, :postdate )
|
|
||||||
else
|
|
||||||
|
|
||||||
find(:all).desc( :is_top, :postdate)
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
def self.widget_datas
|
|
||||||
|
|
||||||
date_now = Time.now
|
|
||||||
|
|
||||||
# find(:all, :conditions => {:postdate => {"$lte" => Date.today}, deadline: nil} ).desc( :is_top, :postdate)
|
|
||||||
# where( :postdate.lte => date_now ).where( :deadline => nil ).desc(:is_top, :postdate)
|
|
||||||
# any_of({ :title => "test" },{:deadline => nil, :title => "123"})
|
|
||||||
any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).limit(5)
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
def is_top?
|
|
||||||
self.is_top
|
|
||||||
end
|
|
||||||
|
|
||||||
def save_bulletin_links
|
|
||||||
self.bulletin_links.each do |t|
|
|
||||||
if t.should_destroy
|
|
||||||
t.destroy
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def save_bulletin_files
|
|
||||||
self.bulletin_files.each do |t|
|
|
||||||
if t.should_destroy
|
|
||||||
t.destroy
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue