diff --git a/Gemfile b/Gemfile index 662a0b09..de2c262d 100644 --- a/Gemfile +++ b/Gemfile @@ -18,6 +18,7 @@ gem 'mongoid' gem "mongo_session_store-rails3" gem 'mysql2' gem "net-ldap", "~> 0.3.1" +gem 'nokogiri' gem 'radius' gem 'rake' gem 'ruby-debug19' diff --git a/Gemfile.lock b/Gemfile.lock index c3076a2e..7f9697fa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -41,6 +41,7 @@ GEM archive-tar-minitar (0.5.2) arel (2.2.3) bcrypt-ruby (3.0.1) + bcrypt-ruby (3.0.1-x86-mingw32) brakeman (1.5.1) activesupport erubis (~> 2.6) @@ -118,6 +119,8 @@ GEM mysql2 (0.3.11) mysql2 (0.3.11-x86-mingw32) net-ldap (0.3.1) + nokogiri (1.5.2) + nokogiri (1.5.2-x86-mingw32) orm_adapter (0.0.6) pdf-writer (1.1.8) color (>= 1.4.0) @@ -259,6 +262,7 @@ DEPENDENCIES mongoid mysql2 net-ldap (~> 0.3.1) + nokogiri radius rails (>= 3.1.0, < 3.2.0) rake diff --git a/app/assets/fonts/widget.css b/app/assets/fonts/widget.css index 0c596876..fe83b22d 100644 --- a/app/assets/fonts/widget.css +++ b/app/assets/fonts/widget.css @@ -45,10 +45,10 @@ opacity: 1; filter: alpha(opacity=100); cursor: pointer; -} -.select-role { - display:none; - overflow:hidden; +} +.select-role { + display:none; + padding: 10px 0 0; } .file-upload { position:relative; diff --git a/app/assets/images/Thumbs.db b/app/assets/images/Thumbs.db deleted file mode 100644 index f9d32b5f..00000000 Binary files a/app/assets/images/Thumbs.db and /dev/null differ diff --git a/app/assets/images/check.png b/app/assets/images/check.png new file mode 100644 index 00000000..e415c89b Binary files /dev/null and b/app/assets/images/check.png differ diff --git a/app/assets/javascripts/.DS_Store b/app/assets/javascripts/.DS_Store index 5008ddfc..51582ef8 100644 Binary files a/app/assets/javascripts/.DS_Store and b/app/assets/javascripts/.DS_Store differ diff --git a/app/assets/javascripts/bootstrap.js b/app/assets/javascripts/bootstrap.js index b822d62b..af3bc727 100644 --- a/app/assets/javascripts/bootstrap.js +++ b/app/assets/javascripts/bootstrap.js @@ -68,8 +68,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ========================================================= */ - - + !function( $ ){ "use strict" @@ -130,6 +129,7 @@ var that = this this.isShown = false + //alert(this.isShown+":"+this.$element.attr('class')) $('body').removeClass('modal-open') @@ -138,7 +138,7 @@ this.$element .trigger('hide') .removeClass('in') - + $.support.transition && this.$element.hasClass('fade') ? hideWithTransition.call(this) : hideModal.call(this) @@ -146,7 +146,6 @@ } - /* MODAL PRIVATE METHODS * ===================== */ @@ -1251,7 +1250,8 @@ var that = this , complete = function () { if (startEvent == 'show') that.reset() - that.$element.trigger(completeEvent) + that.$element.trigger(completeEvent) + mainTablePosition(); } this.$element diff --git a/app/assets/javascripts/bulletin_form.js.erb b/app/assets/javascripts/bulletin_form.js.erb index a427667d..abb908b4 100644 --- a/app/assets/javascripts/bulletin_form.js.erb +++ b/app/assets/javascripts/bulletin_form.js.erb @@ -1,15 +1,28 @@ -$('.bulletin_links_block a.remove_existing_record').live('click', function(){ - //$(this).parents('.list_item').remove(); - $(this).parents('tr.list_item').remove(); +$('.bulletin_links_block a.delete').live('click', function(){ + $(this).parents('.list_item').remove(); }); -$('.bulletin_files_block a.remove_existing_record').live('click', function(){ - //$(this).parents('.list_item').remove(); - $(this).parents('tr.list_item').remove(); +$('.bulletin_files_block a.delete').live('click', function(){ + $(this).parents('.list_item').remove(); }); $('.action a.remove_existing_record').live('click', function(){ $(this).next('.should_destroy').attr('value', 1); //$("#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); }); \ No newline at end of file diff --git a/app/assets/javascripts/html5.js b/app/assets/javascripts/html5.js new file mode 100644 index 00000000..5c92911e --- /dev/null +++ b/app/assets/javascripts/html5.js @@ -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",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",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) \ No newline at end of file diff --git a/app/assets/javascripts/inc/permission-checkbox.js b/app/assets/javascripts/inc/permission-checkbox.js new file mode 100644 index 00000000..fc91b857 --- /dev/null +++ b/app/assets/javascripts/inc/permission-checkbox.js @@ -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 }, + }); +}); \ No newline at end of file diff --git a/app/assets/javascripts/inc/search.js b/app/assets/javascripts/inc/search.js new file mode 100644 index 00000000..979b5621 --- /dev/null +++ b/app/assets/javascripts/inc/search.js @@ -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(); + } + }) +}) \ No newline at end of file diff --git a/app/assets/javascripts/lib/date.format.js b/app/assets/javascripts/lib/date.format.js new file mode 100644 index 00000000..3eb3d1cc --- /dev/null +++ b/app/assets/javascripts/lib/date.format.js @@ -0,0 +1,126 @@ +/* + * Date Format 1.2.3 + * (c) 2007-2009 Steven Levithan + * MIT license + * + * Includes enhancements by Scott Trenda + * and 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); +}; + diff --git a/app/assets/javascripts/lib/datepicker.js b/app/assets/javascripts/lib/datepicker.js new file mode 100644 index 00000000..7c8d4b03 --- /dev/null +++ b/app/assets/javascripts/lib/datepicker.js @@ -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: '
', + head: [ + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '
<%=prev%><%=next%>
<%=week%><%=day1%><%=day2%><%=day3%><%=day4%><%=day5%><%=day6%><%=day7%>
' + ], + space : '
', + days: [ + '', + '', + '<%=weeks[0].week%>', + '<%=weeks[0].days[0].text%>', + '<%=weeks[0].days[1].text%>', + '<%=weeks[0].days[2].text%>', + '<%=weeks[0].days[3].text%>', + '<%=weeks[0].days[4].text%>', + '<%=weeks[0].days[5].text%>', + '<%=weeks[0].days[6].text%>', + '', + '', + '<%=weeks[1].week%>', + '<%=weeks[1].days[0].text%>', + '<%=weeks[1].days[1].text%>', + '<%=weeks[1].days[2].text%>', + '<%=weeks[1].days[3].text%>', + '<%=weeks[1].days[4].text%>', + '<%=weeks[1].days[5].text%>', + '<%=weeks[1].days[6].text%>', + '', + '', + '<%=weeks[2].week%>', + '<%=weeks[2].days[0].text%>', + '<%=weeks[2].days[1].text%>', + '<%=weeks[2].days[2].text%>', + '<%=weeks[2].days[3].text%>', + '<%=weeks[2].days[4].text%>', + '<%=weeks[2].days[5].text%>', + '<%=weeks[2].days[6].text%>', + '', + '', + '<%=weeks[3].week%>', + '<%=weeks[3].days[0].text%>', + '<%=weeks[3].days[1].text%>', + '<%=weeks[3].days[2].text%>', + '<%=weeks[3].days[3].text%>', + '<%=weeks[3].days[4].text%>', + '<%=weeks[3].days[5].text%>', + '<%=weeks[3].days[6].text%>', + '', + '', + '<%=weeks[4].week%>', + '<%=weeks[4].days[0].text%>', + '<%=weeks[4].days[1].text%>', + '<%=weeks[4].days[2].text%>', + '<%=weeks[4].days[3].text%>', + '<%=weeks[4].days[4].text%>', + '<%=weeks[4].days[5].text%>', + '<%=weeks[4].days[6].text%>', + '', + '', + '<%=weeks[5].week%>', + '<%=weeks[5].days[0].text%>', + '<%=weeks[5].days[1].text%>', + '<%=weeks[5].days[2].text%>', + '<%=weeks[5].days[3].text%>', + '<%=weeks[5].days[4].text%>', + '<%=weeks[5].days[5].text%>', + '<%=weeks[5].days[6].text%>', + '', + '' + ], + months: [ + '', + '', + '<%=data[0]%>', + '<%=data[1]%>', + '<%=data[2]%>', + '<%=data[3]%>', + '', + '', + '<%=data[4]%>', + '<%=data[5]%>', + '<%=data[6]%>', + '<%=data[7]%>', + '', + '', + '<%=data[8]%>', + '<%=data[9]%>', + '<%=data[10]%>', + '<%=data[11]%>', + '', + '' + ] + }, + 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; + }; +})(); \ No newline at end of file diff --git a/app/assets/javascripts/new_admin.js b/app/assets/javascripts/new_admin.js index 3ec6f22f..45bfcbbc 100644 --- a/app/assets/javascripts/new_admin.js +++ b/app/assets/javascripts/new_admin.js @@ -11,4 +11,6 @@ //= require jquery.tinyscrollbar.min //= require orbit-1.0 //= require tinymce-jquery -//= require tinymce_orbit \ No newline at end of file +//= require tinymce_orbit +//= require orbit-bar-search +//= require side_bar_history \ No newline at end of file diff --git a/app/assets/javascripts/orbit-1.0.js b/app/assets/javascripts/orbit-1.0.js index f8daaecd..5f69b297 100644 --- a/app/assets/javascripts/orbit-1.0.js +++ b/app/assets/javascripts/orbit-1.0.js @@ -9,27 +9,14 @@ function resize() { } } $(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({ placement: "left" }); $(document).on('click', '.privacy', function() { + + console.log($(this).val()); switch ($(this).val()) { case 'true': $(this).parents('.controls').children('.select-role').slideUp(300); @@ -40,14 +27,22 @@ $(document).ready(function(){ } }); - $(document).on('click', '.toggle-tr-edit', function() { - $(this).parents('tr').next('.qe-block').removeClass('hide'); - $(this).parents('tr').next('.qe-block').find('.qe-edit-div').addClass('hide'); - $(this).parents('tr').next('.qe-block').find('#qe-' + $(this).attr('rel')).toggleClass('hide'); - }); - - $(document).on('click', '.sort-header > .sort', function() { - $.getScript($(this).attr('rel')); + var $role = $('.select-role'); + var method =$('.privacy:eq(1)').attr('checked'); + if(method == 'checked'){ + $role.slideDown(0); + } + $('.privacy').each(function($i) { + $(this).click(function() { + switch ($i) { + case 0: + $role.slideUp(300); + break; + case 1: + $role.slideDown(300); + break; + } + }); }); /*tinyscrollbar&windows-Size*/ @@ -56,11 +51,11 @@ $(document).ready(function(){ $('#main-sidebar').css("height", viewportheight-30); $('#main-sidebar .viewport').css("height", viewportheight-30); $('.post-title').css("width", viewportwidth-495); - $('#main-wrap > .subnav').css("width", viewportwidth-$mainWrapMarginLeft) + $('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft); $('#main-sidebar').tinyscrollbar(); $('.detal-list').tinyscrollbar(); $('#main-sidebar').tinyscrollbar({size:(viewportheight-34)}); - mainTablePosition() + mainTablePosition(); /*isotope*/ var $container = $('#isotope'); @@ -77,18 +72,28 @@ $(window).resize(function(){ $('#main-sidebar').css("height", viewportheight-30); $('#main-sidebar .viewport').css("height", viewportheight-30); $('.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)}); - mainTablePosition() + mainTablePosition(); }); /*main-table position*/ function mainTablePosition() { - var $height = $('#main-wrap > .subnav').height() - var $table = $('#main-wrap > .table') - //alert ($table.height()) - $table.stop().animate({marginTop:$height},500) - //$table.css({marginTop : $height}) -} + var $height = $('#main-wrap .subnav').length && $('#main-wrap .subnav').height(); + var $table = $('.main-list').length && $('.main-list:last'); + if($table && $table==0){ + $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 () { //var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-1; //var $subnavWidth = parseInt($('#main-wrap > .subnav').css("width")); diff --git a/app/assets/javascripts/orbit-bar-member.js b/app/assets/javascripts/orbit-bar-member.js new file mode 100644 index 00000000..5e65d4a3 --- /dev/null +++ b/app/assets/javascripts/orbit-bar-member.js @@ -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(); +}); \ No newline at end of file diff --git a/app/assets/javascripts/orbit-bar-search.js b/app/assets/javascripts/orbit-bar-search.js new file mode 100644 index 00000000..26f44d84 --- /dev/null +++ b/app/assets/javascripts/orbit-bar-search.js @@ -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'); + } +}); \ No newline at end of file diff --git a/app/assets/javascripts/side_bar_history.js b/app/assets/javascripts/side_bar_history.js index 036c63d4..e9505aa1 100644 --- a/app/assets/javascripts/side_bar_history.js +++ b/app/assets/javascripts/side_bar_history.js @@ -1,31 +1,49 @@ -$(function () { - $('#back_sidebar a, #back_main a.nav').live('click', - function () { - $.getScript(this.href); - history.pushState(null, document.title, this.href); - history_edited = true; - return false; - } - ); +var history_edited = false; - $('#back_main a.reload').live('click', - function () { - $.getScript(this.href); - history.replaceState(null, document.title, this.href); - history_edited = true; - return false; - } - ); - - $('.form').live('submit', function () { - $.post(this.action, $(this).serialize(), null, 'script'); +$('#back_sidebar a, #back_main a.nav').live('click', + function () { + $.getScript(this.href); + history.pushState(null, document.title, this.href); history_edited = true; return false; - }); + } +); - $(window).bind("popstate", function () { - if (history_edited) { - $.getScript(location.href); - } - }); +$('#back_main a.reload').live('click', + function () { + $.getScript(this.href); + history.replaceState(null, document.title, this.href); + history_edited = true; + return false; + } +); + +$('.form').live('submit', function () { + $.post(this.action, $(this).serialize(), null, 'script'); + history_edited = true; + return false; +}); + +$(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) { + $.getScript(location.href); + } }); \ No newline at end of file diff --git a/app/assets/javascripts/tinymce_orbit.js b/app/assets/javascripts/tinymce_orbit.js index 89fb9390..60492914 100644 --- a/app/assets/javascripts/tinymce_orbit.js +++ b/app/assets/javascripts/tinymce_orbit.js @@ -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", // Theme options - theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,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_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,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_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect", + 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,|,fullscreen", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", - theme_advanced_resizing : false, + theme_advanced_resizing : true, // Skin options skin : "o2k7", diff --git a/app/assets/stylesheets/bootstrap-orbit.css b/app/assets/stylesheets/bootstrap-orbit.css index 88bca1b3..34425d50 100644 --- a/app/assets/stylesheets/bootstrap-orbit.css +++ b/app/assets/stylesheets/bootstrap-orbit.css @@ -98,10 +98,18 @@ h1, h2, h3, h4, h5, h6 { border-radius: 0 0 4px 4px; } table .span1-2 { - width: 94px; + min-width: 85px; + float: none; + margin-left: 0; +} +table .span1-3 { + min-width: 200px; float: none; margin-left: 0; } .qe-block .form-horizontal .form-actions { text-align:right; +} +.modal.fade { + top: -50%; } \ No newline at end of file diff --git a/app/assets/stylesheets/inc/permission-checkbox.css b/app/assets/stylesheets/inc/permission-checkbox.css new file mode 100644 index 00000000..0adf7225 --- /dev/null +++ b/app/assets/stylesheets/inc/permission-checkbox.css @@ -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; +} \ No newline at end of file diff --git a/app/assets/stylesheets/lib/datepicker.css b/app/assets/stylesheets/lib/datepicker.css new file mode 100644 index 00000000..2487c921 --- /dev/null +++ b/app/assets/stylesheets/lib/datepicker.css @@ -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; +} \ No newline at end of file diff --git a/app/assets/stylesheets/list.css b/app/assets/stylesheets/list.css index ccf35f24..11f17a55 100644 --- a/app/assets/stylesheets/list.css +++ b/app/assets/stylesheets/list.css @@ -9,9 +9,9 @@ .main-list { margin-bottom: 0; } -.main-list thead th { - background-color: rgba(0,0,0,0.05); - border-right: 1px solid #ddd; +.main-wrap>.main-list thead th { + background-color: transparent; + border-right: medium none; } .main-list thead th:last-child { border-right: none; @@ -29,19 +29,22 @@ } .main-list tbody .quick-edit { position:relative; - height:40px; + height:20px; } .main-list tbody .quick-edit .nav { /*left: -55px;*/ position: absolute; /*top: -3px;*/ width: 350px; + left: -8px; } .main-list td { - /*height:80px;*/ + background-color: #FFFFFF; + border-bottom: 1px solid #DDDDDD; + border-top: medium none; } .main-list .nav { - margin-top: 15px; + margin-top: 0; margin-bottom: 3px; } .main-list tr.with_action:hover .hide { @@ -53,7 +56,7 @@ } .main-list .label-td { background-color: rgba(255, 255, 255, 1); - height: 60px; + height: 40px; overflow: hidden; position: absolute; width: 100%; @@ -75,6 +78,15 @@ -moz-border-radius: 3px; 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 { padding: 0; } @@ -109,6 +121,9 @@ legend { border-radius: 0; border-left: none; border-right: none; + position: fixed; + top: 30px; + z-index: 50; } .subnav .nav > li:first-child > a, .subnav .nav > li:first-child > a:hover { -moz-border-radius: 0; diff --git a/app/assets/stylesheets/reset.css.erb b/app/assets/stylesheets/reset.css.erb index 0d91f32a..5c0a9cd5 100644 --- a/app/assets/stylesheets/reset.css.erb +++ b/app/assets/stylesheets/reset.css.erb @@ -2,7 +2,6 @@ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockq -webkit-text-size-adjust:none; } html, body{ - background: url(<%= asset_path 'background.jpg' %>) repeat left top; height: 100%; } /*自定*/ diff --git a/app/assets/stylesheets/style.css.erb b/app/assets/stylesheets/style.css.erb index beae5a8e..d2e33b04 100644 --- a/app/assets/stylesheets/style.css.erb +++ b/app/assets/stylesheets/style.css.erb @@ -1,830 +1,873 @@ -@font-face{ - font-family: 'WebSymbolsRegular'; - src: url(<%= asset_path 'websymbols-regular-webfont.eot' %>); - src: url(<%= asset_path 'websymbols-regular-webfont.eot?#iefix' %>) format('embedded-opentype'), - url(<%= asset_path 'websymbols-regular-webfont.woff' %>) format('woff'), - url(<%= asset_path 'websymbols-regular-webfont.ttf' %>) format('truetype'), - url(<%= asset_path 'websymbols-regular-webfont.svg#WebSymbolsRegular' %>) format('svg'); -} -.login-logo { - text-indent: -9999px; - background: url(<%= asset_path 'sign-in-logo.png' %>) no-repeat center 40px; - padding-top: 40px; - height: 160px; -} -#orbit-bar { - margin-bottom: 0; - position:fixed; - width:100%; - z-index: 99; - top: 0; - left: 0; -} -#orbit-bar .navbar-inner { - height: 28px; - -moz-border-radius: 0px; - -webkit-border-radius: 0px; - border-radius: 0px; - padding-top: 2px; - padding-bottom: 1px; - -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; - -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; - box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; - - background-image: -moz-linear-gradient(top, #5282A6, #133757); - background-image: -ms-linear-gradient(top, #5282A6, #133757); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5282A6), to(#133757)); - background-image: -webkit-linear-gradient(top, #5282A6, #133757); - background-image: -o-linear-gradient(top, #5282A6, #133757); - background-image: linear-gradient(top, #5282A6, #133757); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5282A6', endColorstr='#133757', GradientType=0); - /* - background-image: -moz-linear-gradient(top, #545b60, #191a1c); - background-image: -ms-linear-gradient(top, #545b60, #191a1c); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#545b60), to(#191a1c)); - background-image: -webkit-linear-gradient(top, #545b60, #191a1c); - background-image: -o-linear-gradient(top, #545b60, #191a1c); - background-image: linear-gradient(top, #545b60, #191a1c); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#545b60', endColorstr='#191a1c', GradientType=0); - */ -} -#orbit-bar .navbar-search { - float: none; - margin: 0 auto; - text-align: center; -} -#orbit-bar .nav.pull-right { - margin-right: -20px; -} -#orbit-bar .search-query { - background-image: url(<%= asset_path 'main-search.png' %>); - background-repeat: no-repeat; - background-position: 5px 6px; - padding-left: 25px; - /*background-color: rgba(255, 255, 255, 0.8); - color: #333; - text-shadow: 0px 1px 0px #FFF;*/ - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3) inset, 0 1px 0 rgba(255, 255, 255, 0.15); -} -#orbit-bar .search-query:focus { - /*background-color: rgba(255, 255, 255, 0.9); - text-shadow: 0px 1px 0px #FFF;*/ - background-position: 6px 7px; -} -#orbit-bar .container { - width:100%; -} -#orbit-bar .orbit-logo .brand { - /* background: url(<%= asset_path 'orbit-bar.png' %>) no-repeat -162px -5px; */ - background: url(<%= asset_path 'nccu_logo.png' %>) no-repeat 6px 0px; - text-indent:-9999px; - padding: 5px 20px 4px; -} -#orbit-bar .orbit-logo .brand:hover { - background-color: rgba(0,157,220,1); -} -#orbit-bar .orbit-logo.open .brand { - background-color: rgba(0,157,220,1); -} -#orbit-bar .orbit-logo .dropdown-menu { - left: -15px; -} -#orbit-bar .nav > li { - height: 28px; -} -#orbit-bar .nav > li > a:hover { - background-color: rgba(0,157,220,1); -} -#orbit-bar .nav > li > a { - background-image: url(<%= asset_path 'orbit-bar.png' %>); - background-repeat:no-repeat; - display: inline-block; - width: 16px; - height: 16px; - text-indent: -9999px; - padding:6px; -} -#orbit-bar .nav > li > a.orbit-bar-home { - background-position: -10px -10px; -} -#orbit-bar .nav > li > a.orbit-bar-desktop { - background-position: -100px -4px; -} -#orbit-bar .nav > li > a.orbit-bar-member { - background-position: -4px -37px; -} -#orbit-bar .nav > li > a.orbit-bar-member { - background-position: -10px -43px; -} -#orbit-bar .nav > li > a.orbit-bar-language { - background-position: -42px -42px; -} -.language-menu .active { - color: #ffffff; - text-decoration: none; - background-color: #0088cc; -} -#orbit-bar .nav > li > a.orbit-bar-account { - background-image: none; - height: 22px; - padding: 3px; - text-indent: inherit; - min-width: 110px; - width: auto !important; - text-align: left; -} -#orbit-bar .nav span.member-name { - display: inline-block; - line-height: 22px; - padding: 0 10px; -} -#orbit-bar .nav img.member-img { - display: inline-block; - float: left; - max-width: 22px; -} -#orbit-bar .account-menu { - right: 5px; -} -#orbit-bar .bar-login { - -} -#orbit-bar .bar-login .open, #orbit-bar .open .orbit-bar-account { - background-color: #009DDC; -} -#orbit-bar .bar-login .dropdown-menu { - padding: 0 0 10px; - max-width: 260px; -} -#orbit-bar .bar-login .dropdown-menu .log { - margin: 10px 15px 0; - list-style: none outside none; -} -#orbit-bar .bar-login .dropdown-menu .log .title { - background: url(<%= asset_path 'sign-in-logo2.png' %>) no-repeat center center; - height: 70px; -} -#orbit-bar .bar-login .dropdown-menu .log form { - margin: 0 0 8px; -} -#orbit-bar .bar-login .dropdown-menu .log input { - display: inline-block; - margin: 0; -} -#orbit-bar .bar-login .dropdown-menu .log .span2 { - width: 183px; -} -#orbit-bar .bar-login .dropdown-menu .log .forgot { - margin-bottom: 20px; - padding: 3px 0 0; - float: right; - display: inline-block; - color: #0088CC; -} -#orbit-bar .bar-login .dropdown-menu .log .input-prepend { - margin-top: 20px; -} -#orbit-bar .bar-login .dropdown-menu .log .remember { - margin-top: 5px; -} -#orbit-bar .bar-login .dropdown-menu .log .forgot:hover { - padding: 3px 0 0; - float: right; - display: inline-block; - color: #005580; - text-decoration: underline; - background-color: transparent; -} -#orbit-bar .bar-login .dropdown-menu .log .btn { - width: 220px; -} -#orbit-bar .bar-login .dropdown-menu .log .divider { - position:relative; - overflow: inherit; - margin: 20px 0; -} -#orbit-bar .bar-login .dropdown-menu .log .divider span { - position: absolute; - width: 20px; - height: 20px; - background-color: #FFF; - color: #666; - top: -9px; - left: 100px; - font-size:16px; - text-align: center; -} -#orbit-bar .bar-login .dropdown-menu .register { - color: #FFFFFF; - margin: 0 15px; - width: 188px; -} -#main-sidebar { - background: url(<%= asset_path 'background.jpg' %>) repeat left top; - width: 155px; - padding-right: 4px; - border-right: 1px solid rgba(0,0,0,.2); - position:fixed; - top: 32px; - z-index: 88; -} -#main-sidebar .nav { - padding-top: 5px; -} -#main-sidebar .nav > li.active > a [class^="icons-"] { - background-image: url(<%= asset_path 'icons_pack_white.png' %>); -} -#main-sidebar .nav > li > .nav { - margin-left: -14px; - margin-bottom: 5px; - width: 155px; - padding: 0; - background-color: #FFF; - /*border-radius: 0px 0px 8px 0px; - -webkit-border-radius: 0px 0px 8px 0px; - -moz-border-radius: 0px 0px 8px 0px;*/ - box-shadow: 0px 2px 1px rgba(0,0,0,0.1); - -moz-box-shadow: 0px 2px 1px rgba(0,0,0,0.1); - -webkit-box-shadow: 0px 2px 1px rgba(0,0,0,0.1); -} -#main-sidebar .nav > li > .nav > li > a { - margin-left: 0; - padding-left: 19px; - color: #999; -} -#main-sidebar .nav > li > .nav > li > a:hover { - color: #000; - background-color: #d7eeff; -} -#main-sidebar .nav > li > .nav > li.active > a { - background-color: #b7b7b7; - color: #fff; -} -#main-wrap { - background-color: #FFF; - margin-left:160px; - padding-top: 32px; - padding-bottom: 18px; - position: relative; - min-height: 100%; -} -#main-wrap > .form-actions { - background-color: #FFF; - text-align: center; - padding: 17px 20px 0; - margin: 0; - border-top: none; -} -#main-wrap .subnav { - height: auto; - min-height: 36px; -} -#main-wrap .pagination { - margin: 18px 0 0; - text-align: center; -} -.main-list .route-group td { - border: none; -} -#main-wrap .route-group .breadcrumb { - background-image: none; - border-radius: 0; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-width: 0 0 1px 0; - box-shadow: none; - -webkit-box-shadow: none; - -moz-box-shadow: none; - margin-bottom: 0px; - padding: 7px 8px 5px; -} -#main-wrap .breadcrumb li { - font-size: 12px; - color: #999; -} -#sub-wiget { - clear: right; - float: right; - padding-right: 10px; - padding-top: 8px; - position: relative; - margin-bottom: 13px; - width: 304px; -} -.main-wiget .widget-box { - margin: 5px 0; - width: 100%; -} -#poststuff .form-actions { - background-color: transparent; - text-align: right; - padding-left: 10px; - padding-right: 10px; - margin-bottom: 0; - clear: both; -} -#poststuff form { - margin-bottom: 0; -} -#post-body { - float: left; - clear: left; - width: 100%; - margin-right: -340px; -} -#post-body .title input[type=text] { - margin-bottom: 0; - width: 100%; - height: 30px; -} -#post-body .btn-group { - margin-left: 5px; -} -#post-body .well { - margin: 0; - border-radius: 0px; - -moz-border-radius: 0px; - box-shadow: none; - -moz-box-shadow: none; - -webkit-box-shadow: none; - border-top: none; -} -#post-body .editor { - background-color: #333333; - height: 20px; - margin: 8px 0; - width: 100%; -} -#post-body-content { - margin-right: 320px; - padding: 8px 0 8px 6px; -} -.filter .accordion-heading > a:hover { - text-decoration: none; -} -.filter .accordion-group { - border-bottom: none; - border-top: none; - border-left: 1px solid rgba(0,0,0,0.07); - border-right: none; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; - margin-bottom: -1px; - position: relative; - left: 0; - top: 0; -} -.filter .accordion-group:last-child { - border-right: 1px solid rgba(0,0,0,0.07); -} -.filter .accordion-heading .accordion-toggle { - padding: 9px 15px; -} -.accordion-group .accordion-toggle .caret { - border-top-color: #0088CC; - margin-top: 6px; -} -.filter .active { - background-color: #0088CC; -} -.filter .active a { - color: #FFF; -} -.filters { - background-color: rgba(0,0,0,0.075); - -webkit-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); - -moz-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); - box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); -} -.filters > div { - background-color: #dadada; -} -.filters .btn { - margin-bottom: 5px; -} -.filters .accordion-inner { - border-top: none; - padding: 9px 15px 4px; -} -.filters .filter-clear { - padding: 5px 5px 0; - border-top: 1px solid rgba(0,0,0,0.1); - text-align: right; - margin: 0 5px; - -webkit-box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); - -moz-box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); - box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); -} -.filters .in { - /*border-bottom: 1px solid rgba(0,0,0,0.07)*/ -} -.sign-in { - width: 360px; - margin: 0 auto 70px; - background-color: #FFF; - -moz-border-radius: 0 0 5px 5px; - -webkit-border-radius: 0 0 5px 5px; - border-radius: 0 0 5px 5px; - -moz-box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); - -webkit-box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); - box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); - border-width: 0px 1px 1px 1px; - border-style: none solid solid solid; - border-color: transparent #c6c6c6 #c6c6c6 #c6c6c6; -} -#signin-header { - width: 340px; - margin: 30px auto 0; - line-height: 25px; - padding: 5px 10px; - border-width: 1px 1px 0px 1px; - border-style: solid solid none solid; - border-color: #c6c6c6 #c6c6c6 transparent #c6c6c6; - background-color: #006dcc; - background-image: -moz-linear-gradient(top, #dadada, #c0c0c0); - background-image: -ms-linear-gradient(top, #dadada, #c0c0c0); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#dadada), to(#c0c0c0)); - background-image: -webkit-linear-gradient(top, #dadada, #c0c0c0); - background-image: -o-linear-gradient(top, #dadada, #c0c0c0); - background-image: linear-gradient(top, #dadada, #c0c0c0); - -moz-border-radius: 5px 5px 0px 0px ; - -webkit-border-radius: 5px 5px 0px 0px; - border-radius: 5px 5px 0px 0px; - -moz-box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); - -webkit-box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); - box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); -} -#signin-header h3 { - color: #848484; - text-shadow: 0 1px 0 #e9e9e9; -} -#sign-footer { - width: 100%; - position:fixed; - bottom: 0; - height: 40px; - background-color: #dadada; - color: #7a7a7a; - box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); - -moz-box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); - -webkit-box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); -} -#sign-footer p { - line-height: 40px; - padding: 0 10px; - text-align: right; -} -.sign-in .control-group label { - text-align: left; - width: auto; - font-size: 15px; -} -.sign-in .forgot { - padding-top: 5px; -} -.sign-in .content { - padding: 10px; -} -.sign-in .form-actions { - padding: 17px 10px 18px; - margin: 0; - -moz-border-radius: 0px 0px 5px 5px; - -webkit-border-radius: 0px 0px 5px 5px; - border-radius: 0px 0px 5px 5px; -} -.sign-in form { - margin: 0; -} -.sign-in .control-group .help-inline { - display:none; -} -.sign-in .error .help-inline { - display:inline-block; -} -.web-symbol:after { - font-family: 'WebSymbolsRegular'; - content: "{"; - margin-left: 2px; - margin-top: 8px; -} -.active .web-symbol:after { - content: "}"; -} -/*icons*/ -.the-icons i:after { - content: attr(class); - display: block; - font-style: normal; - margin-left: 20px; - width: 140px; -} -.the-icons i { - display: block; - margin-bottom: 5px; -} -[class^="text-"] { - font-size: 15px !important; -} -.text-blue { - color: #0088CC !important; -} -.text-red { - color: #CC3300 !important; -} -.text-yellow { - color: #ffcc00 !important; -} -.text-orange { - color: #f7941d !important; -} -.text-purple { - color: #a864a8 !important; -} -.text-palm { - color: #a67c52 !important; -} -.text-green { - color: #39b54a !important; -} -[class^="icons-"] { - display: inline-block; - width: 16px; - height: 16px; - vertical-align: text-top; - background-image: url(<%= asset_path 'icons_pack.png' %>); - background-position: 16px 16px; - background-repeat: no-repeat; - *margin-right: .3em; - margin-right:10px; -} -[class^="icons-"]:last-child { - *margin-left: 0; -} -.icons-white { - background-image: url(<%= asset_path 'icons_pack_white.png' %>); -} -/*1*/ -.icons-pencil { - background-position: 0 0; -} -.icons-brush { - background-position: -32px 0; -} -.icons-pen { - background-position: -64px 0; -} -.icons-brush-large { - background-position: -128px 0; -} -.icons-pen-small { - background-position: -96px 0; -} -.icons-bucket { - background-position: -160px 0; -} -.icons-eye { - background-position: -192px 0; -} -.icons-ban { - background-position: -224px 0; -} -.icons-trash { - background-position: -256px 0; -} -.icons-zoom { - background-position: -288px 0; -} -.icons-zoom-out { - background-position: -320px 0; -} -.icons-zoom-in { - background-position: -352px 0; -} -.icons-magic { - background-position: -384px 0; -} -.icons-aim { - background-position: -416px 0; -} -/*2*/ -.icons-flag { - background-position: 0 -32px; -} -.icons-paperclip { - background-position: -32px -32px; -} -.icons-share { - background-position: -64px -32px; -} -.icons-link { - background-position: -96px -32px; -} -.icons-tag { - background-position: -128px -32px; -} -.icons-lock { - background-position: -160px -32px; -} -.icons-unlock { - background-position: -192px -32px; -} -/*3*/ -.icons-content { - background-position: -160px -66px; -} -.icons-announcement { - background-position: -576px -64px; -} -/*4*/ -.icons-contact { - background-position: 0 -96px; -} -.icons-roll { - background-position: -32px -96px; -} -.icons-member { - background-position: -288px -96px; -} -.icons-member-user { - background-position: -64px -96px; -} -.icons-member-admin { - background-position: -96px -96px; -} -.icons-member-manager{ - background-position: -128px -96px; -} -.icons-member-plus{ - background-position: -160px -96px; -} -.icons-member-minus{ - background-position: -192px -96px; -} -.icons-member-blockade{ - background-position: -224px -96px; -} -.icons-carte { - background-position: -256px -96px; -} -.icons-building { - background-position: -320px -96px; -} -.icons-calendar { - background-position: -352px -96px; -} -.icons-calendars { - background-position: -384px -96px; -} -.icons-out { - background-position: -416px -96px; -} -.icons-desktop { - background-position: -448px -96px; -} -/*5*/ -.icons-page-blank { - background-position: 0px -128px; -} -.icons-page { - background-position: -32px -128px; -} -.icons-page-copy { - background-position: -64px -128px; -} -.icons- { - background-position: -0px -128px; -} -/*6*/ -.icons-globe { - background-position: -96px -160px; -} -.icons-structure { - background-position: -352px -160px; -} -/*7*/ -.icons-purchase { - background-position: -64px -192px; -} -/*8*/ -.icons-dashboard { - background-position: 0 -224px; -} -.icons-cog { - background-position: -32px -224px; -} -.icons-cogs { - background-position: -64px -224px; -} -.icons-tool { - background-position: -96px -224px; -} -.icons-screwdriver { - background-position: -128px -224px; -} -.icons-wrench { - background-position: -160px -224px; -} -.icons-toolbox { - background-position: -192px -224px; -} -.icons-switch { - background-position: -224px -224px; -} -.icons-valve { - background-position: -256px -224px; -} -/*9*/ -.icons-picture { - background-position: -256px -256px; -} -.icons-asset { - background-position: -384px -256px; -} -.icons-asset-upload { - background-position: -448px -256px; -} -.icons-asset-download { - background-position: -416px -256px; -} -/*10*/ -.icons- { - background-position: -0px -288px; -} -/*11*/ -.icons-pie { - background-position: 0px -320px; -} -.icons-histogram { - background-position: -32px -320px; -} -.icons-window { - background-position: -64px -320px; -} -.icons-window-line{ - background-position: -96px -320px; -} -.icons-window-command{ - background-position: -128px -320px; -} -.icons-window-list{ - background-position: -160px -320px; -} -.icons-window-block{ - background-position: -192px -320px; -} -.icons-terminal{ - background-position: -224px -320px; -} -/*12*/ -.icons-star-thin { - background-position: -416px -352px; -} -.icons- { - background-position: -0px -352px; -} -/*13*/ -.icons- { - background-position: -0px -384px; -} -/*14*/ -.icons- { - background-position: -0px -416px; -} -/*15*/ -.icons- { - background-position: -0px -448px; -} -/*16*/ -.icons- { - background-position: -0px -480px; -} -/*17*/ -.icons- { - background-position: -0px -512px; -} -/*18*/ -.icons-help { - background-position: -160px -544px; -} -.icons- { - background-position: -0px -544px; -} -/*19*/ -.icons-plus-cube { - background-position: -192px -576px; -} -.icons-plus { - background-position: -288px -576px; -} -.icons-power { - background-position: -0px -608px; -} -/*20*/ -.icons- { - background-position: -0px -608px; -} -/*21*/ -.icons- { - background-position: -0px -640px; +@font-face{ + font-family: 'WebSymbolsRegular'; + src: url(<%= asset_path 'websymbols-regular-webfont.eot' %>); + src: url(<%= asset_path 'websymbols-regular-webfont.eot?#iefix' %>) format('embedded-opentype'), + url(<%= asset_path 'websymbols-regular-webfont.woff' %>) format('woff'), + url(<%= asset_path 'websymbols-regular-webfont.ttf' %>) format('truetype'), + url(<%= asset_path 'websymbols-regular-webfont.svg#WebSymbolsRegular' %>) format('svg'); +} +.login-logo { + text-indent: -9999px; + background: url(<%= asset_path 'sign-in-logo.png' %>) no-repeat center 40px; + padding-top: 40px; + height: 160px; +} +#orbit-bar { + margin-bottom: 0; + position:fixed; + width:100%; + z-index: 99; + top: 0; + left: 0; +} +#orbit-bar .navbar-inner { + height: 28px; + -moz-border-radius: 0px; + -webkit-border-radius: 0px; + border-radius: 0px; + padding-top: 2px; + padding-bottom: 1px; + -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; + -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; + + background-image: -moz-linear-gradient(top, #5282A6, #133757); + background-image: -ms-linear-gradient(top, #5282A6, #133757); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5282A6), to(#133757)); + background-image: -webkit-linear-gradient(top, #5282A6, #133757); + background-image: -o-linear-gradient(top, #5282A6, #133757); + background-image: linear-gradient(top, #5282A6, #133757); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5282A6', endColorstr='#133757', GradientType=0); + /* + background-image: -moz-linear-gradient(top, #545b60, #191a1c); + background-image: -ms-linear-gradient(top, #545b60, #191a1c); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#545b60), to(#191a1c)); + background-image: -webkit-linear-gradient(top, #545b60, #191a1c); + background-image: -o-linear-gradient(top, #545b60, #191a1c); + background-image: linear-gradient(top, #545b60, #191a1c); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#545b60', endColorstr='#191a1c', GradientType=0); + */ +} +#orbit-bar .navbar-search { + left: 28px; + margin: 0; + position: absolute; + text-align: right; + top: -1px; +} +#orbit-bar .nav.pull-right { + margin-right: -20px; +} +#orbit-bar .search-query { + padding: 4px 9px; + height: 12px; + margin-top: 3px; + border: 1px solid #333333; + font-size: 11px; + /*background-color: rgba(255, 255, 255, 0.8); + color: #333; + text-shadow: 0px 1px 0px #FFF;*/ + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3) inset, 0 1px 0 rgba(255, 255, 255, 0.15); +} +#orbit-bar .search-query:focus { + /*background-color: rgba(255, 255, 255, 0.9); + text-shadow: 0px 1px 0px #FFF;*/ + background-position: 5px 2px; +} +#orbit-bar .container { + width:100%; +} +#orbit-bar .orbit-logo .brand { + /* background: url(<%= asset_path 'orbit-bar.png' %>) no-repeat -162px -5px; */ + background: url(<%= asset_path 'nccu_logo.png' %>) no-repeat 6px 0px; + text-indent:-9999px; + padding: 5px 20px 4px; +} +#orbit-bar .orbit-logo .brand:hover { + background-color: rgba(0,157,220,1); +} +#orbit-bar .orbit-logo.open .brand { + background-color: rgba(0,157,220,1); +} +#orbit-bar .orbit-logo .dropdown-menu { + left: -15px; +} +#orbit-bar .nav > li { + height: 28px; +} +#orbit-bar .nav > li > a:hover { + background-color: rgba(0,157,220,1); +} +#orbit-bar .nav > li > a { + background-image: url(<%= asset_path 'orbit-bar.png' %>); + background-repeat:no-repeat; + display: inline-block; + width: 16px; + height: 16px; + text-indent: -9999px; + padding:6px; +} +#orbit-bar .nav > li.search { + overflow: hidden; + width: 28px; + position: relative; +} +#orbit-bar .nav > li > a.orbit-bar-home { + background-position: -10px -10px; +} +#orbit-bar .nav > li > a.orbit-bar-desktop { + background-position: -106px -9px; +} +#orbit-bar .nav > li > a.orbit-bar-member { + background-position: -4px -37px; +} +#orbit-bar .nav > li > a.orbit-bar-member { + background-position: -10px -43px; +} +#orbit-bar .nav > li > a.orbit-bar-language { + background-position: -42px -42px; +} +#orbit-bar .nav > li > a.orbit-bar-search { + background-position: -75px -10px; + overflow: hidden; +} +.language-menu .active { + color: #ffffff; + text-decoration: none; + background-color: #0088cc; +} +#orbit-bar .nav > li > a.orbit-bar-account { + background-image: none; + height: 22px; + padding: 3px; + text-indent: inherit; + min-width: 110px; + width: auto !important; + text-align: left; +} +#orbit-bar .nav span.member-name { + display: inline-block; + line-height: 22px; + padding: 0 10px; +} +#orbit-bar .nav img.member-img { + display: inline-block; + float: left; + max-width: 22px; +} +#orbit-bar .clear { + clear: none; +} +#orbit-bar .account-menu { + right: 5px; +} +#orbit-bar .bar-login { + +} +#orbit-bar .bar-login .open, #orbit-bar .open .orbit-bar-account { + background-color: #009DDC; +} +#orbit-bar .bar-login .dropdown-menu { + padding: 0 0 10px; + max-width: 260px; +} +#orbit-bar .bar-login .dropdown-menu .log { + margin: 10px 15px 0; + list-style: none outside none; +} +#orbit-bar .bar-login .dropdown-menu .log .title { + background: url(<%= asset_path 'sign-in-logo2.png' %>) no-repeat center center; + height: 70px; +} +#orbit-bar .bar-login .dropdown-menu .log form { + margin: 0 0 8px; +} +#orbit-bar .bar-login .dropdown-menu .log input { + display: inline-block; + margin: 0; +} +#orbit-bar .bar-login .dropdown-menu .log .span2 { + width: 183px; +} +#orbit-bar .bar-login .dropdown-menu .log .forgot { + margin-bottom: 20px; + padding: 3px 0 0; + float: right; + display: inline-block; + color: #0088CC; +} +#orbit-bar .bar-login .dropdown-menu .log .input-prepend { + margin-top: 20px; +} +#orbit-bar .bar-login .dropdown-menu .log .remember { + margin-top: 5px; +} +#orbit-bar .bar-login .dropdown-menu .log .forgot:hover { + padding: 3px 0 0; + float: right; + display: inline-block; + color: #005580; + text-decoration: underline; + background-color: transparent; +} +#orbit-bar .bar-login .dropdown-menu .log .btn { + width: 220px; +} +#orbit-bar .bar-login .dropdown-menu .log .divider { + position:relative; + overflow: inherit; + margin: 20px 0; +} +#orbit-bar .bar-login .dropdown-menu .log .divider span { + position: absolute; + width: 20px; + height: 20px; + background-color: #FFF; + color: #666; + top: -9px; + left: 100px; + font-size:16px; + text-align: center; +} +#orbit-bar .bar-login .dropdown-menu .register { + color: #FFFFFF; + margin: 0 15px; + width: 188px; +} +#main-sidebar { + background: url(<%= asset_path 'background.jpg' %>) repeat left top; + width: 155px; + padding-right: 4px; + border-right: 1px solid rgba(0,0,0,.2); + position:fixed; + top: 32px; + z-index: 88; +} +#main-sidebar .nav { + padding-top: 5px; +} +#main-sidebar .nav > li.active > a [class^="icons-"] { + background-image: url(<%= asset_path 'icons_pack_white.png' %>); +} +#main-sidebar .nav > li > .nav { + margin-left: -14px; + margin-bottom: 5px; + width: 155px; + padding: 0; + background-color: #FFF; + /*border-radius: 0px 0px 8px 0px; + -webkit-border-radius: 0px 0px 8px 0px; + -moz-border-radius: 0px 0px 8px 0px;*/ + box-shadow: 0px 2px 1px rgba(0,0,0,0.1); + -moz-box-shadow: 0px 2px 1px rgba(0,0,0,0.1); + -webkit-box-shadow: 0px 2px 1px rgba(0,0,0,0.1); +} +#main-sidebar .nav > li > .nav > li > a { + margin-left: 0; + padding-left: 19px; + color: #999; +} +#main-sidebar .nav > li > .nav > li > a:hover { + color: #000; + background-color: #d7eeff; +} +#main-sidebar .nav > li > .nav > li.active > a { + background-color: #b7b7b7; + color: #fff; +} +#main-wrap { + background-color: #FFF; + margin-left:160px; + padding-top: 32px; + padding-bottom: 18px; + position: relative; + min-height: 100%; +} +#main-wrap > .form-actions { + background-color: #FFF; + text-align: center; + padding: 17px 20px 0; + margin: 0; + border-top: none; +} +#main-wrap .subnav { + height: auto; + min-height: 36px; +} +#main-wrap .pagination { + margin: 18px 0 0; + text-align: center; +} +.main-list .route-group td { + border: none; +} +#main-wrap .route-group .breadcrumb { + background-image: none; + border-radius: 0; + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-width: 0 0 1px 0; + box-shadow: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + margin-bottom: 0px; + padding: 7px 8px 5px; +} +#main-wrap .breadcrumb li { + font-size: 12px; + color: #999; +} +#sub-wiget { + clear: right; + float: right; + padding-right: 10px; + padding-top: 8px; + position: relative; + margin-bottom: 13px; + width: 304px; +} +.main-wiget .widget-box { + margin: 5px 0; + width: 100%; +} +#poststuff .form-actions { + background-color: transparent; + text-align: right; + padding-left: 10px; + padding-right: 10px; + margin-bottom: 0; + clear: both; +} +#poststuff form { + margin-bottom: 0; +} +#post-body { + float: left; + clear: left; + width: 100%; + margin-right: -340px; +} +#post-body .title input[type=text] { + margin-bottom: 0; + width: 100%; + height: 30px; +} +#post-body .btn-group { + margin-left: 5px; +} +#post-body .well { + margin: 0; + border-radius: 0px; + -moz-border-radius: 0px; + box-shadow: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; + border-top: none; +} +#post-body .editor { +} +#post-body-content { + margin-right: 320px; + padding: 8px 0 8px 6px; +} +.filter .accordion-heading > a:hover { + text-decoration: none; +} +.filter .accordion-group { + border-bottom: none; + border-top: none; + border-left: 1px solid rgba(0,0,0,0.07); + border-right: none; + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0; + margin-bottom: -1px; + position: relative; + left: 0; + top: 0; +} +.filter .accordion-group:last-child { + border-right: 1px solid rgba(0,0,0,0.07); +} +.filter .accordion-heading .accordion-toggle { + padding: 9px 15px; +} +.accordion-group .accordion-toggle .caret { + border-top-color: #0088CC; + margin-top: 6px; +} +.filter .active { + background-color: #0088CC; +} +.filter .active a { + color: #FFF; +} +.filter form { + margin: 5px 10px; +} +.filters { + background-color: rgba(0,0,0,0.075); + -webkit-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); + -moz-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); + box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); +} +.filters > div { + background-color: #dadada; +} +.filters .btn { + margin-bottom: 5px; +} +.filters .accordion-inner { + border-top: none; + padding: 9px 15px 4px; +} +.filters .filter-clear { + padding: 5px 5px 0; + border-top: 1px solid rgba(0,0,0,0.1); + text-align: right; + margin: 0 5px; + -webkit-box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); + -moz-box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); + box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); +} +.filters .in { + /*border-bottom: 1px solid rgba(0,0,0,0.07)*/ +} +.sign-in { + width: 360px; + margin: 0 auto 70px; + background-color: #FFF; + -moz-border-radius: 0 0 5px 5px; + -webkit-border-radius: 0 0 5px 5px; + border-radius: 0 0 5px 5px; + -moz-box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); + -webkit-box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); + box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); + border-width: 0px 1px 1px 1px; + border-style: none solid solid solid; + border-color: transparent #c6c6c6 #c6c6c6 #c6c6c6; +} +#signin-header { + width: 340px; + margin: 30px auto 0; + line-height: 25px; + padding: 5px 10px; + border-width: 1px 1px 0px 1px; + border-style: solid solid none solid; + border-color: #c6c6c6 #c6c6c6 transparent #c6c6c6; + background-color: #006dcc; + background-image: -moz-linear-gradient(top, #dadada, #c0c0c0); + background-image: -ms-linear-gradient(top, #dadada, #c0c0c0); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#dadada), to(#c0c0c0)); + background-image: -webkit-linear-gradient(top, #dadada, #c0c0c0); + background-image: -o-linear-gradient(top, #dadada, #c0c0c0); + background-image: linear-gradient(top, #dadada, #c0c0c0); + -moz-border-radius: 5px 5px 0px 0px ; + -webkit-border-radius: 5px 5px 0px 0px; + border-radius: 5px 5px 0px 0px; + -moz-box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); + -webkit-box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); + box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); +} +#signin-header h3 { + color: #848484; + text-shadow: 0 1px 0 #e9e9e9; +} +#sign-footer { + width: 100%; + position:fixed; + bottom: 0; + height: 40px; + background-color: #dadada; + color: #7a7a7a; + box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); + -moz-box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); + -webkit-box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); +} +#sign-footer p { + line-height: 40px; + padding: 0 10px; + text-align: right; +} +.sign-in .control-group label { + text-align: left; + width: auto; + font-size: 15px; +} +.sign-in .forgot { + padding-top: 5px; +} +.sign-in .content { + padding: 10px; +} +.sign-in .form-actions { + padding: 17px 10px 18px; + margin: 0; + -moz-border-radius: 0px 0px 5px 5px; + -webkit-border-radius: 0px 0px 5px 5px; + border-radius: 0px 0px 5px 5px; +} +.sign-in form { + margin: 0; +} +.sign-in .control-group .help-inline { + display:none; +} +.sign-in .error .help-inline { + display:inline-block; +} +.web-symbol:after { + font-family: 'WebSymbolsRegular'; + content: "{"; + margin-left: 2px; + margin-top: 8px; +} +.active .web-symbol:after { + 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*/ +.the-icons i:after { + content: attr(class); + display: block; + font-style: normal; + margin-left: 20px; + width: 140px; +} +.the-icons i { + display: block; + margin-bottom: 5px; +} +[class^="text-"] { + font-size: 15px !important; +} +.text-blue { + color: #0088CC !important; +} +.text-red { + color: #CC3300 !important; +} +.text-yellow { + color: #ffcc00 !important; +} +.text-orange { + color: #f7941d !important; +} +.text-purple { + color: #a864a8 !important; +} +.text-palm { + color: #a67c52 !important; +} +.text-green { + color: #39b54a !important; +} +[class^="icons-"] { + display: inline-block; + width: 16px; + height: 16px; + vertical-align: text-top; + background-image: url(<%= asset_path 'icons_pack.png' %>); + background-position: 16px 16px; + background-repeat: no-repeat; + *margin-right: .3em; + margin-right:10px; +} +[class^="icons-"]:last-child { + *margin-left: 0; +} +.icons-white { + background-image: url(<%= asset_path 'icons_pack_white.png' %>); +} +/*1*/ +.icons-pencil { + background-position: 0 0; +} +.icons-brush { + background-position: -32px 0; +} +.icons-pen { + background-position: -64px 0; +} +.icons-brush-large { + background-position: -128px 0; +} +.icons-pen-small { + background-position: -96px 0; +} +.icons-bucket { + background-position: -160px 0; +} +.icons-eye { + background-position: -192px 0; +} +.icons-ban { + background-position: -224px 0; +} +.icons-trash { + background-position: -256px 0; +} +.icons-zoom { + background-position: -288px 0; +} +.icons-zoom-out { + background-position: -320px 0; +} +.icons-zoom-in { + background-position: -352px 0; +} +.icons-magic { + background-position: -384px 0; +} +.icons-aim { + background-position: -416px 0; +} +/*2*/ +.icons-flag { + background-position: 0 -32px; +} +.icons-paperclip { + background-position: -32px -32px; +} +.icons-share { + background-position: -64px -32px; +} +.icons-link { + background-position: -96px -32px; +} +.icons-tag { + background-position: -128px -32px; +} +.icons-lock { + background-position: -160px -32px; +} +.icons-unlock { + background-position: -192px -32px; +} +.icons-time { + background-position: -448px -32px; +} +.icons-banner { + background-position: -608px -32px; +} +/*3*/ +.icons-content { + background-position: -160px -66px; +} +.icons-announcement { + background-position: -576px -64px; +} +/*4*/ +.icons-contact { + background-position: 0 -96px; +} +.icons-roll { + background-position: -32px -96px; +} +.icons-member { + background-position: -288px -96px; +} +.icons-member-user { + background-position: -64px -96px; +} +.icons-member-admin { + background-position: -96px -96px; +} +.icons-member-manager{ + background-position: -128px -96px; +} +.icons-member-plus{ + background-position: -160px -96px; +} +.icons-member-minus{ + background-position: -192px -96px; +} +.icons-member-blockade{ + background-position: -224px -96px; +} +.icons-carte { + background-position: -256px -96px; +} +.icons-building { + background-position: -320px -96px; +} +.icons-calendar { + background-position: -352px -96px; +} +.icons-calendars { + background-position: -384px -96px; +} +.icons-out { + background-position: -416px -96px; +} +.icons-desktop { + background-position: -448px -96px; +} +/*5*/ +.icons-page-blank { + background-position: 0px -128px; +} +.icons-page { + background-position: -32px -128px; +} +.icons-page-copy { + background-position: -64px -128px; +} +.icons- { + background-position: -0px -128px; +} +/*6*/ +.icons-globe { + background-position: -96px -160px; +} +.icons-structure { + background-position: -352px -160px; +} +/*7*/ +.icons-purchase { + background-position: -64px -192px; +} +/*8*/ +.icons-dashboard { + background-position: 0 -224px; +} +.icons-cog { + background-position: -32px -224px; +} +.icons-cogs { + background-position: -64px -224px; +} +.icons-tool { + background-position: -96px -224px; +} +.icons-screwdriver { + background-position: -128px -224px; +} +.icons-wrench { + background-position: -160px -224px; +} +.icons-toolbox { + background-position: -192px -224px; +} +.icons-switch { + background-position: -224px -224px; +} +.icons-valve { + background-position: -256px -224px; +} +/*9*/ +.icons-picture { + background-position: -256px -256px; +} +.icons-asset { + background-position: -384px -256px; +} +.icons-asset-upload { + background-position: -448px -256px; +} +.icons-asset-download { + background-position: -416px -256px; +} +/*10*/ +.icons- { + background-position: -0px -288px; +} +/*11*/ +.icons-pie { + background-position: 0px -320px; +} +.icons-histogram { + background-position: -32px -320px; +} +.icons-window { + background-position: -64px -320px; +} +.icons-window-line{ + background-position: -96px -320px; +} +.icons-window-command{ + background-position: -128px -320px; +} +.icons-window-list{ + background-position: -160px -320px; +} +.icons-window-block{ + background-position: -192px -320px; +} +.icons-terminal{ + background-position: -224px -320px; +} +/*12*/ +.icons-check-2 { + background-position: -288px -352px; +} +.icons-star-thin { + background-position: -416px -352px; +} +.icons- { + background-position: -0px -352px; +} +/*13*/ +.icons- { + background-position: -0px -384px; +} +/*14*/ +.icons- { + background-position: -0px -416px; +} +/*15*/ +.icons- { + background-position: -0px -448px; +} +/*16*/ +.icons- { + background-position: -0px -480px; +} +/*17*/ +.icons- { + background-position: -0px -512px; +} +/*18*/ +.icons-help { + background-position: -160px -544px; +} +.icons- { + background-position: -0px -544px; +} +/*19*/ +.icons-plus-cube { + background-position: -192px -576px; +} +.icons-plus { + background-position: -288px -576px; +} +.icons-power { + background-position: -0px -608px; +} +/*20*/ +.icons- { + background-position: -0px -608px; +} +/*21*/ +.icons- { + background-position: -0px -640px; } \ No newline at end of file diff --git a/app/assets/stylesheets/widget.css b/app/assets/stylesheets/widget.css index b66a6074..f1c4d615 100644 --- a/app/assets/stylesheets/widget.css +++ b/app/assets/stylesheets/widget.css @@ -58,33 +58,91 @@ cursor: pointer; } .select-role { - display:none; - overflow:hidden; + display:none; + padding: 10px 0; } .file-upload { position:relative; + overflow: hidden; } .file-upload .file-name { - display: inline-block; - margin: 0 0 5px 5px; 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 { margin:0; padding:0; position:absolute; - top:0; + top: 0; left:0; opacity:.0; - filter: alpha(opacity=100); + font-size: 60px; + left: -595px/9; + filter: alpha(opacity: 0); + outline: none; } .file-upload .upload:focus { position:absolute; } .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 { 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; } \ No newline at end of file diff --git a/app/controllers/admin/ad_banners_controller.rb b/app/controllers/admin/ad_banners_controller.rb index 19d81057..95ce7e7c 100644 --- a/app/controllers/admin/ad_banners_controller.rb +++ b/app/controllers/admin/ad_banners_controller.rb @@ -1,5 +1,5 @@ class Admin::AdBannersController < ApplicationController - layout "admin" + layout "new_admin" before_filter :authenticate_user! before_filter :is_admin? @@ -10,11 +10,14 @@ class Admin::AdBannersController < ApplicationController end def show - @ad_banner = AdBanner.find(params[:id]) + @ad_banners = AdBanner.all + @active = AdBanner.find(params[:id]) + render :action => 'index' end def new - @ad_banner = AdBanner.new + @ad_banners = AdBanner.all + render :action => 'index',:params => 'new' end def create @@ -36,8 +39,13 @@ class Admin::AdBannersController < ApplicationController redirect_to admin_ad_banners_url end + def destroy_ad_image + + end + def index @ad_banners = AdBanner.all + @active = @ad_banners.first end end \ No newline at end of file diff --git a/app/controllers/admin/ad_images_controller.rb b/app/controllers/admin/ad_images_controller.rb new file mode 100644 index 00000000..3fb681da --- /dev/null +++ b/app/controllers/admin/ad_images_controller.rb @@ -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 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4b433777..fb82774e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -47,7 +47,7 @@ class ApplicationController < ActionController::Base # Render the page def render_page(id = nil) if @item - render :text => parse_page(@item, id) + render :text => process_page(@item, id), :layout => 'page_layout' else render :text => '404 Not Found' end diff --git a/app/controllers/gridfs_controller.rb b/app/controllers/gridfs_controller.rb index 8a95a581..4be7ec17 100644 --- a/app/controllers/gridfs_controller.rb +++ b/app/controllers/gridfs_controller.rb @@ -3,7 +3,7 @@ require 'mongo' class GridfsController < ActionController::Metal def serve - gridfs_path = env["PATH_INFO"].gsub("/gridfs/", "") + gridfs_path = env["PATH_INFO"].gsub("/gridfs/", "").force_encoding("UTF-8") begin gridfs_file = Mongo::GridFileSystem.new(Mongoid.database).open(gridfs_path, 'r') self.response_body = gridfs_file.read diff --git a/app/controllers/orbit_backend_controller.rb b/app/controllers/orbit_backend_controller.rb index c71bbf15..fe37db82 100644 --- a/app/controllers/orbit_backend_controller.rb +++ b/app/controllers/orbit_backend_controller.rb @@ -6,7 +6,7 @@ class OrbitBackendController< ApplicationController include OrbitCoreLib::PermissionUnility include AdminHelper - layout 'admin' + layout 'new_admin' def setup_vars @app_title = request.fullpath.split('/')[2] diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 8ea35391..4860ea2e 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -1,5 +1,7 @@ class PagesController < ApplicationController + include ApplicationHelper + before_filter :get_item, :only => [:index_from_link, :show_from_link] def index diff --git a/app/helpers/admin/ad_banner_helper.rb b/app/helpers/admin/ad_banner_helper.rb index 0621df38..eff12427 100644 --- a/app/helpers/admin/ad_banner_helper.rb +++ b/app/helpers/admin/ad_banner_helper.rb @@ -1,2 +1,16 @@ 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 \ No newline at end of file diff --git a/app/helpers/admin/ad_images_helper.rb b/app/helpers/admin/ad_images_helper.rb new file mode 100644 index 00000000..1f2422fc --- /dev/null +++ b/app/helpers/admin/ad_images_helper.rb @@ -0,0 +1,7 @@ +module Admin::AdImagesHelper + + def active_when_default_locale_eq locale + locale.to_sym == I18n.default_locale ? 'active': '' + end + +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 50510e3c..e45fa4d6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2,6 +2,12 @@ module ApplicationHelper 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) @site_in_use_locales.include?(locale)? 'green' : 'red' end @@ -77,7 +83,7 @@ module ApplicationHelper end 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 def sortable(column) @@ -96,15 +102,55 @@ module ApplicationHelper ' web-symbol' if params[:sort].eql?(name) end - def add_filter(param_name, value) - filter = params[:filter] rescue nil - if filter && filter.has_key(param_name) - filter[param_name] << value - elsif filter - filter.merge({param_name => [value]}) - else - {param_name => [value]} + def is_filter_active?(type, id) + ' active' if (@filter[type].include?(id.to_s) rescue nil) + 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 << "\n" + end rescue nil + return metas + end + + def page_title(page) + "#{page.title ? page.title[I18n.locale] : page.i18n_variable[I18n.locale]}\n" + end + + def page_stylesheets(page) + stylesheets = '' + stylesheets << "\n" + stylesheets << "\n" + stylesheets << "\n" + stylesheets << "\n" if page.design.reset_css + stylesheets << "\n" if page.design.default_css + theme = page.design.themes.detect{ |d| d.id == page.theme_id } + stylesheets << "\n" if theme + stylesheets + end + + def page_javascripts(page) + javascripts = '' + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + page.design.javascripts.each do |js| + # javascripts << "" end + javascripts end end diff --git a/app/models/ad_banner.rb b/app/models/ad_banner.rb index 0a2928b3..3e09280f 100644 --- a/app/models/ad_banner.rb +++ b/app/models/ad_banner.rb @@ -4,41 +4,32 @@ class AdBanner include Mongoid::MultiParameterAttributes field :title - field :picture_position - field :post_date,type: Date - field :unpost_date,type: Date - field :context - field :direct_to_after_click,type: Boolean + field :transition_sec,type: Integer field :ad_fx #TODO Design should explain - - + before_save :save_or_destroy - - embeds_many :ad_images, :cascade_callbacks => true + validates_uniqueness_of :title + 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"] - 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) + # debugger + # a=1 + # attrs[0].each do |attr| #Loop by JSs,Themes,Imgs + # unless attr[:file].nil? + # self.ad_images << AdImage.new(attr) + # end + # end + # end - def new_ad_images=(*attrs) - attrs[0].each do |attr| #Loop by JSs,Themes,Imgs - unless attr[:file].nil? - self.ad_images << AdImage.new(attr) - end - end - end - - def existing_ad_images=(*attrs) - attrs[0].each do |attr| #Loop by JSs,Themes,Imgs - ad_image = self.ad_images.find attr[0] - ad_image.update_attributes(attr[1]) - end - end + # def existing_ad_images=(*attrs) + # attrs[0].each do |attr| #Loop by JSs,Themes,Imgs + # ad_image = self.ad_images.find attr[0] + # ad_image.update_attributes(attr[1]) + # end + # end def save_or_destroy self.ad_images.each do |ad_image| diff --git a/app/models/ad_image.rb b/app/models/ad_image.rb index 5d06d798..3eb63511 100644 --- a/app/models/ad_image.rb +++ b/app/models/ad_image.rb @@ -3,19 +3,46 @@ class AdImage include Mongoid::Timestamps mount_uploader :file, ImageUploader + + has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy + has_one :context, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy - field :time_to_next #Weight - field :picture_intro - 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_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 time = '' diff --git a/app/models/design/design.rb b/app/models/design/design.rb index 7fbacedc..2a25dd11 100644 --- a/app/models/design/design.rb +++ b/app/models/design/design.rb @@ -1,6 +1,7 @@ class Design include Mongoid::Document include Mongoid::Timestamps + include ParserLayout field :title field :author @@ -14,7 +15,7 @@ class Design embeds_one :reset_css, :class_name => "Stylesheet", :cascade_callbacks => true embeds_many :themes, :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 validates_presence_of :title @@ -65,9 +66,6 @@ class Design protected def parse_css_for_images - self.images.each do |image| - image.save - end if (self.default_css && self.default_css.changed) self.default_css.parse_urls end @@ -76,6 +74,7 @@ class Design theme.parse_urls end end + parse_body_for_images(self) end end diff --git a/app/models/design/layout.rb b/app/models/design/layout.rb index e13498f3..bf48415c 100644 --- a/app/models/design/layout.rb +++ b/app/models/design/layout.rb @@ -2,6 +2,8 @@ class Layout < DesignFile include ParserLayout attr_reader :content + + field :body embeds_one :menu embedded_in :design @@ -17,8 +19,10 @@ class Layout < DesignFile Layout.count > 0 end - def parse_layout - parse_layout_contents(self) + def parse_layout + html = Nokogiri::HTML(self.file.read) + self.body = html.at_css("body").inner_html + parse_body(self) end end diff --git a/app/models/design/stylesheet.rb b/app/models/design/stylesheet.rb index 4b908122..bb2ec85e 100644 --- a/app/models/design/stylesheet.rb +++ b/app/models/design/stylesheet.rb @@ -27,6 +27,7 @@ class Stylesheet < DesignFile temp_file = File.new(dir + '/' + orig_file_name, 'w+') temp_file.write content.force_encoding("UTF-8") self.file = temp_file + self.save } end diff --git a/app/models/meta.rb b/app/models/meta.rb new file mode 100644 index 00000000..dbeac167 --- /dev/null +++ b/app/models/meta.rb @@ -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 diff --git a/app/models/meta/meta.rb b/app/models/meta/meta.rb new file mode 100644 index 00000000..411a4f0c --- /dev/null +++ b/app/models/meta/meta.rb @@ -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 diff --git a/app/models/meta/page_meta.rb b/app/models/meta/page_meta.rb new file mode 100644 index 00000000..9b3ded99 --- /dev/null +++ b/app/models/meta/page_meta.rb @@ -0,0 +1,5 @@ +class PageMeta < Meta + + belongs_to :page + +end diff --git a/app/models/meta/site_meta.rb b/app/models/meta/site_meta.rb new file mode 100644 index 00000000..9a17c4fa --- /dev/null +++ b/app/models/meta/site_meta.rb @@ -0,0 +1,5 @@ +class SiteMeta < Meta + + belongs_to :site + +end diff --git a/app/models/object_auth.rb b/app/models/object_auth.rb index 8932bb76..ae3fd701 100644 --- a/app/models/object_auth.rb +++ b/app/models/object_auth.rb @@ -1,6 +1,6 @@ class ObjectAuth < PrototypeAuth 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 # > - Something.find_with_auth(query) # > - or Something.find(query).auth diff --git a/app/models/page.rb b/app/models/page.rb index ceead525..d98f3a4e 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -6,17 +6,23 @@ class Page < Item belongs_to :design 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_contexts, :autosave => true, :dependent => :destroy + has_many :page_metas, :autosave => true, :dependent => :destroy 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 def is_home? self.parent ? false : true end + + def title + @title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil + end protected @@ -27,4 +33,10 @@ class Page < Item end end + def set_key + if title && title.new_record? + title.key = 'title' + end + end + end diff --git a/app/models/site.rb b/app/models/site.rb index 065a6f79..8f367c0a 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -12,6 +12,8 @@ class Site field :school field :department + + has_many :site_metas, :autosave => true, :dependent => :destroy def generate_keys private_key = OpenSSL::PKey::RSA.generate(2048) diff --git a/app/views/admin/ad_banners/_ad_banner_tab.html.erb b/app/views/admin/ad_banners/_ad_banner_tab.html.erb new file mode 100644 index 00000000..d9b1b902 --- /dev/null +++ b/app/views/admin/ad_banners/_ad_banner_tab.html.erb @@ -0,0 +1,19 @@ + +
" id=<%= ad_banner_tab.title %>> +

尺寸:

+ + <%= 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' %> +
+ <%= 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) %> +
+ <% end -%> + <%= render :partial => 'preview_block',:locals=> {:ad_banner =>ad_banner_tab} %> +
diff --git a/app/views/admin/ad_banners/_ad_image.html.erb b/app/views/admin/ad_banners/_ad_image.html.erb deleted file mode 100644 index e724a47f..00000000 --- a/app/views/admin/ad_banners/_ad_image.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -
- <%= image_tag ad_image.file %> -

- 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 %> -

-
diff --git a/app/views/admin/ad_banners/_ad_image_form.html.erb b/app/views/admin/ad_banners/_ad_image_form.html.erb deleted file mode 100644 index 3a153d47..00000000 --- a/app/views/admin/ad_banners/_ad_image_form.html.erb +++ /dev/null @@ -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 %> \ No newline at end of file diff --git a/app/views/admin/ad_banners/_ad_image_show.html.erb b/app/views/admin/ad_banners/_ad_image_show.html.erb deleted file mode 100644 index e724a47f..00000000 --- a/app/views/admin/ad_banners/_ad_image_show.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -
- <%= image_tag ad_image.file %> -

- 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 %> -

-
diff --git a/app/views/admin/ad_banners/_ad_image_update.html.erb b/app/views/admin/ad_banners/_ad_image_update.html.erb index e3d53b15..366d370d 100644 --- a/app/views/admin/ad_banners/_ad_image_update.html.erb +++ b/app/views/admin/ad_banners/_ad_image_update.html.erb @@ -1,9 +1,12 @@ -<%= fields_for "ad_banner[existing_ad_images][#{ad_image.id}]", ad_image do |f| %> - <%= image_tag ad_image.file %> -
- Destroy?<%= f.check_box :to_destroy %> - <%= render :partial => "ad_image_form", :locals => { :f => f } %> -
-<% end %> - +
  • + <%= image_tag ad_image.file %> +

    + <%= ad_image.display? ? '[Showing]' : '[NotShawing]' %> + <%= "#{ad_image.post_date ||'NeedReset' }~#{ad_image.unpost_date || 'NeedReset'}" %> +

    +

    + <%= 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?') %> +

    +
  • diff --git a/app/views/admin/ad_banners/_form.html.erb b/app/views/admin/ad_banners/_form.html.erb deleted file mode 100644 index c29d9aef..00000000 --- a/app/views/admin/ad_banners/_form.html.erb +++ /dev/null @@ -1,53 +0,0 @@ -<% content_for :page_specific_css do %> - <%#= javascript_include_tag "ad_banner" #this line wont work %> - -<% end %> - - -

    - <%= f.label :title, t('admin.title') %> - <%= f.text_field :title, :class => 'text' %> -

    -

    - <%= f.label :picture_position, t('admin.picture_position') %> - <%= f.text_field :picture_position, :class => 'text' %> -

    - -

    - <%= f.label :post_date, t('admin.post_date') %> - <%= f.date_select :post_date, :order => [:year, :month, :day], :use_month_numbers => true %> -

    - -

    - <%= 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') } %> -

    -

    - <%= f.label :context, t('admin.context') %> - <%= f.text_field :context, :class => 'text' %> - -

    -

    - <%= f.label :direct_to_after_click, t('admin.direct_to_after_click') %> - <%= f.check_box :direct_to_after_click %> -

    -

    - <%= f.label :ad_fx, t('admin.ad_fx') %> - <%= f.select :ad_fx ,AdBanner::FX_TYPES %> -

    -

    - <%#= 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, %> -

      - <%= render :partial => 'new_add_banner_file', :object => @ad_banner.ad_images.build, :locals => { :field_name => "new_ad_images[]", :f => f, :classes => "r_destroy" } %> -

      - -

      - - - <%#= render :partial => 'new_design_file', :object => @design.themes.build, :locals => { :field_name => "themes", :f => f, :classes => "r_destroy" } %> -

      diff --git a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb new file mode 100644 index 00000000..8e8de1d9 --- /dev/null +++ b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb @@ -0,0 +1,55 @@ + +
      + +
      +
      +
      +
      +
      +
      +
      +
      + +
      +
      +
      + +
      +
      +
      +
      +
      +
      +
      +
      + +
      + + +
      +
      + + +
      + + diff --git a/lib/orbit_core_lib.rb b/lib/orbit_core_lib.rb index 561fceba..bcde17e0 100644 --- a/lib/orbit_core_lib.rb +++ b/lib/orbit_core_lib.rb @@ -21,11 +21,19 @@ module OrbitCoreLib def authed_users(title=nil) users = [] - unless title.nil? - users = self.object_auths.where(title: title )[0].auth_users_after_block_list rescue [] + users = case title + 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 + logger.info "Warning calling a auth commend without specificed value( has multi-auths ), return empty" + [] + end else - users = self.object_auths.collect{|t| t.auth_users_after_block_list} rescue [] - users.flatten!.uniq! + self.object_auths.where(title: title).first.auth_users rescue [] end users end diff --git a/lib/parsers/parser_back_end.rb b/lib/parsers/parser_back_end.rb index 37c22ed1..24b6c59f 100644 --- a/lib/parsers/parser_back_end.rb +++ b/lib/parsers/parser_back_end.rb @@ -1,149 +1,86 @@ module ParserBackEnd - require 'radius' include ParserCommon - - def parse_page_edit(page) - if page._type == 'Page' - layout_content = page.design.layout.content.force_encoding('UTF-8') rescue '' - context = parser_context_edit(page) - parser = Radius::Parser.new(context, :tag_prefix => 'r') - parser.parse(parser.parse(layout_content)) + + require 'nokogiri' + + # 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 + # "#{lang}" + # end + # }.join(' | ') + # end + # c.define_tag 'link' do |tag| + # item = Item.first(:conditions => { :full_name => tag.attr['name'] }) + # ret = '' + # ret << "" + # ret << item.i18n_variable[I18n.locale] + # ret << "" + # 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 + + body.to_html end - - def parser_context_edit(page, attributes = {}) - 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 - 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 - "#{lang}" - 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 << " " 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 = "' - end - end - c.define_tag 'stylesheets' do |tag| - res = '' - res << "" if page.design.reset_css - res << "" if page.design.default_css - theme = page.design.themes.detect{ |d| d.id == page.theme_id } - res << "" if theme - res - end - c.define_tag 'javascripts' do |tag| - res = '' - res << "" - res << "" - res << "" - res << "" - page.design.javascripts.each do |js| - res << "" - end - res - end - c.define_tag 'ad_banner' do |tag| - res = '' - ad_banner = AdBanner.find(tag.attr["id"]) rescue nil - if ad_banner - res << "" - res << "
      " - ad_banner.ad_images.each do |ad_image| - res << "" - 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 } - ret = '' - ret << "
      " - ret << tag.expand + + # page_contents + def parse_content_edits(body, page, id) + public_r_tags = [] + body.css('.page_content').each do |content| + ret = '' + if (content["main"] == "true" && !page.module_app.nil?) + ret << "
      " + else + part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil + ret << "
      " if part + ret << "' - end - c.define_tag 'content' do |tag| - ret = '' - if (tag.attributes["main"] == "true" && !page.module_app.nil?) - ret << "
      " - else - part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s } - ret << "
      " - ret << "' - case part.kind - when 'text' - ret << part.i18n_variable[I18n.locale] rescue '' - when 'module_widget' - if part[:category] - ret << "
      " - else - ret << "
      " - end - when 'public_r_tag' - ret << "" - else - '' + case part.kind + when 'text' + ret << part.i18n_variable[I18n.locale] rescue '' + when 'module_widget' + if part[:category] + ret << "
      " + else + ret << "
      " end - ret << '
      ' - end + when 'public_r_tag' + ret << "" + public_r_tags << part.public_r_tag + else + '' + end if part end - c.define_tag 'link' do |tag| - item = Item.first(:conditions => { :full_name => tag.attr['name'] }) - ret = '' - ret << "" - ret << item.i18n_variable[I18n.locale] - ret << "" - end - c.define_tag 'menu' do |tag| - home = get_homepage - menu = page.design.layout.menu - menu_level(home, 0, menu, true) + scope = "<#{content.name}" + content.attributes.each_pair do |key, value| + scope << " #{key}='#{value}'" end + scope << ">#{ret}" + fragment = Nokogiri::HTML::DocumentFragment.new(body, scope) + content.swap(fragment) end + public_r_tags.uniq end - + + 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 diff --git a/lib/parsers/parser_common.rb b/lib/parsers/parser_common.rb index 8d43c070..93ea2608 100644 --- a/lib/parsers/parser_common.rb +++ b/lib/parsers/parser_common.rb @@ -2,7 +2,7 @@ module ParserCommon def menu_level(page, current, menu, edit = false) res = '' - if current <= menu.levels + if menu.levels > 0 && current <= menu.levels if current != 0 res << "
      " item = rand(100000) @@ -44,4 +44,66 @@ module ParserCommon res << "" 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 << "" + res << "
      " + 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 << "" + end + res << "
      " + 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 = "' + 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 diff --git a/lib/parsers/parser_front_end.rb b/lib/parsers/parser_front_end.rb index 99353cc1..dfec0dd9 100644 --- a/lib/parsers/parser_front_end.rb +++ b/lib/parsers/parser_front_end.rb @@ -1,180 +1,77 @@ module ParserFrontEnd - require 'radius' 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 + # "#{lang}" + # end + # }.join(' | ') + # end + # c.define_tag 'link' do |tag| + # item = Item.first(:conditions => { :full_name => tag.attr['name'] }) + # ret = '' + # ret << "" + # ret << item.i18n_variable[I18n.locale] + # ret << '' + # end + # end - def parser_context(page, attributes = {}, id = nil) - 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 - 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 - "#{lang}" - 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 << "' - when 'show' - var = I18nVariable.find(tag.attr['id']) - res = '' - 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 << " " if asset.data.file.content_type.eql?('text/css') - end - res - end - c.define_tag 'stylesheets' do |tag| - res = '' - res << "" - res << "" - res << "" - res << "" if page.design.reset_css - res << " " if page.design.default_css - theme = page.design.themes.detect{ |d| d.id == page.theme_id } - res << "" if theme - res - end - c.define_tag 'javascripts' do |tag| - res = '' - res << "" - res << "" - res << "" - res << "" - res << "" - res << "" - res << "" - res << "" - res << "" - page.design.javascripts.each do |js| - # res << "" - 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 << "" - res << "
      " - ad_banner.ad_images.each do |ad_image| - res << "" - end - res << "
      " - 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 = "' - 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 = '' - if (tag.attributes["main"] == "true" && !page.module_app.nil?) - ret << "
      " - else - part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s } rescue nil - case part.kind - when 'text' - ret << part.i18n_variable[I18n.locale] rescue '' - when 'module_widget' - if part[:category] - ret << "
      " - else - ret << "
      " - end - when 'public_r_tag' - ret << "" - else - '' - end - end - ret - end - c.define_tag 'link' do |tag| - item = Item.first(:conditions => { :full_name => tag.attr['name'] }) - ret = '' - ret << "" - ret << item.i18n_variable[I18n.locale] - ret << '' - end - c.define_tag 'menu' do |tag| - home = get_homepage - menu = page.design.layout.menu - menu_level(home, 0, menu) - end + require 'nokogiri' + + def parse_page_noko(page, id = nil) + body = Nokogiri::HTML(page.design.layout.body) + parse_menu(body, page) + public_r_tags = parse_contents(body, page, id) + parse_images(body, page) + + public_r_tags.each do |tag| + send("parse_#{tag}s", body, page,id) end + + body.to_html 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)) + + # page_contents + def parse_contents(body, page, id) + public_r_tags = [] + body.css('.page_content').each do |content| + ret = '' + if (content["main"] == "true" && !page.module_app.nil?) + ret << "
      " + else + part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil + case part.kind + when 'text' + ret << part.i18n_variable[I18n.locale] rescue '' + when 'module_widget' + if part[:category] + ret << "
      " + else + ret << "
      " + end + when 'public_r_tag' + ret << "" + public_r_tags << part.public_r_tag + else + '' + end if part + end + scope = "<#{content.name}" + content.attributes.each_pair do |key, value| + scope << " #{key}='#{value}'" + end + scope << ">#{ret}" + fragment = Nokogiri::HTML::DocumentFragment.new(body, scope) + content.swap(fragment) end - end - - def self.included(base) - base.send :helper_method, :parse_page if base.respond_to? :helper_method + public_r_tags.uniq end end diff --git a/lib/parsers/parser_layout.rb b/lib/parsers/parser_layout.rb index 4a0232c6..3379c487 100644 --- a/lib/parsers/parser_layout.rb +++ b/lib/parsers/parser_layout.rb @@ -1,44 +1,31 @@ module ParserLayout - require 'radius' - include ParserCommon + require 'nokogiri' - def parse_layout_contents(layout) - content = layout.content.force_encoding('UTF-8') - context = parser_layout_contents(layout) - parser = Radius::Parser.new(context, :tag_prefix => 'r') - parser.parse(content) - end + def parse_body(layout) + body = Nokogiri::HTML(layout.body) - def parser_layout_contents(layout) - 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.menu.levels = i = tag.attr['level'].to_i - layout.menu.values.merge!({'home' => tag.attr['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']}) - 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 + body.css('.page_content').each do |content| + layout.layout_parts.build(:name => content['name']) end + + body.css('.page_menu').each do |menu| + layout.build_menu(:levels => 0, :values => {}) unless layout.menu + layout.menu.levels = i = menu['level'].to_i + layout.menu.values.merge!({'home' => menu['home']}) if i == 1 + layout.menu.values.merge!({"id_#{i}" => menu['id'], "class_#{i}" => menu['class'], "li_class_#{i}" => menu['li_class'], "li_incremental_#{i}" => menu['li_incremental']}) + end + end - - def parse_html_image(html) - html.scan(/(?<=\)/){ - $1.gsub(' ','').scan(/(?<=src=\")(.*?)(?=\")/){ - return File.basename($1).gsub(/[\\\"]/, '') - } - } + + 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 diff --git a/lib/tasks/noko.rake b/lib/tasks/noko.rake new file mode 100644 index 00000000..b411fa30 --- /dev/null +++ b/lib/tasks/noko.rake @@ -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 \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb index d648e2a2..0e3894b9 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb @@ -1,5 +1,4 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendController - layout 'new_admin' def index @bulletin_categorys = BulletinCategory.all @@ -93,7 +92,7 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendCo respond_to do |format| 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_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.js else diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_files_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_files_controller.rb new file mode 100644 index 00000000..223e2ba5 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_files_controller.rb @@ -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 diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_links_controller-ƻs.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_links_controller-ƻs.rb deleted file mode 100644 index 04a75fa6..00000000 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_links_controller-ƻs.rb +++ /dev/null @@ -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 diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_links_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_links_controller.rb new file mode 100644 index 00000000..59f164d9 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_links_controller.rb @@ -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 diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index 0eda0723..e66c51a4 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -1,5 +1,4 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController - layout 'new_admin' before_filter :authenticate_user! before_filter :is_admin? @@ -9,17 +8,40 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # @bulletins = Bulletin.desc("postdate desc") get_categorys(params[:bulletin_category_id]) 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.search(params[:search], params[:category_id]) # @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_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| format.html # index.html.erb - format.js + format.js { } format.xml { render :xml => @bulletins } end end @@ -78,30 +100,58 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # POST /bulletins # POST /bulletins.xml def create - @bulletin = Bulletin.new(params[:bulletin]) - @bulletin.create_user_id = current_user.id - @bulletin.update_user_id = current_user.id + if params[:bulletin_link] + + @bulletin_link = BulletinLink.new(params[:bulletin_link]) - respond_to do |format| - if @bulletin.save - # 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.xml { render :xml => @bulletin, :status => :created, :location => @bulletin } - else - format.html { render :action => "new" } - format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity } - end - end + 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.create_user_id = current_user.id + @bulletin.update_user_id = current_user.id + + respond_to do |format| + if @bulletin.save + # 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.xml { render :xml => @bulletin, :status => :created, :location => @bulletin } + format.js + else + format.html { render :action => "new" } + format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity } + end + end + + end + end def link_quick_add # debugger - - @bulletin = Bulletin.find(params[:bulletin_id]) - + + @bulletin_link = BulletinLink.new @link_url = panel_announcement_back_end_bulletins_path + @bulletin_link.bulletin_id = params[:bulletin_id] + respond_to do |format| format.js end @@ -110,10 +160,13 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController def link_quick_edit # 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| format.js @@ -121,31 +174,88 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController 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.xml def update - @bulletin = Bulletin.find(params[:id]) - @bulletin.update_user_id = current_user.id - - # @bulletin.image.clear if params[:bulletin][:image_del] == '1' - # if params[:bulletin][:image_del] == '1' - # @bulletin.remove_image! - # @bulletin.image_del = nil - # params[:bulletin][:image_del] = nil - # end + 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.update_attributes(params[:bulletin]) && @bulletin.save - # format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('bulletin.update_bulletin_success')) } - format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) } - format.js { render 'toggle_enable' } - format.xml { head :ok } - else - format.html { render :action => "edit" } - format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity } - end + 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.update_user_id = current_user.id + + # @bulletin.image.clear if params[:bulletin][:image_del] == '1' + # if params[:bulletin][:image_del] == '1' + # @bulletin.remove_image! + # @bulletin.image_del = nil + # params[:bulletin][:image_del] = nil + # end + + respond_to do |format| + if @bulletin.update_attributes(params[:bulletin]) && @bulletin.save + # format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('bulletin.update_bulletin_success')) } + format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) } + format.js { render 'toggle_enable' } + format.xml { head :ok } + else + format.html { render :action => "edit" } + format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity } + end + end + end + end # DELETE /bulletins/1 @@ -172,6 +282,21 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # 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 @@ -184,21 +309,16 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController end end - def get_tags - 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_tags 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 + def get_sorted_and_filtered_bulletins bulletins = Bulletin.all case params[:sort] when 'postdate', 'deadline' - bulletins.order_by([params[:sort], params[:direction]]) + bulletins = bulletins.order_by([params[:sort], params[:direction]]) when 'category' category_ids = bulletins.distinct(:bulletin_category_id) 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 } 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.flatten - else - nil + bulletins = sorted_categorys.flatten! end when 'title' - h = Hash.new - bulletins.each { |bulletin| h[bulletin.title[I18n.locale]] = bulletin } + h = Array.new + bulletins.each { |bulletin| h << [bulletin.title[I18n.locale].downcase, bulletin] } sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse! - sorted.collect {|a| a[1] } + bulletins = sorted.collect {|a| a[1] } 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' user_ids = bulletins.distinct(:update_user_id) users = User.find(user_ids) rescue nil if users - h = Hash.new - users.each { |user| h[user.name] = user.id } + h = Array.new + users.each { |user| h << [user.name, user.id] } 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.flatten - else - nil + bulletins = sorted_users.flatten end when 'tags' a = Array.new AnnouncementTag.all.order_by(I18n.locale, params[:direction]).each { |tag| a << tag.bulletins } 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 + 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 diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb index c47e91fb..606225e9 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb @@ -2,7 +2,6 @@ class Panel::Announcement::BackEnd::FactChecksController < OrbitBackendControll before_filter :authenticate_user! include AdminHelper # layout 'admin' - layout 'new_admin' def setting @bulletin_categorys = BulletinCategory.all @@ -18,7 +17,7 @@ class Panel::Announcement::BackEnd::FactChecksController < OrbitBackendControll else first_category = @bulletin_categorys.first 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 [] respond_to do |format| format.html diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb index ff3cbdc9..3ba0e666 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb @@ -2,7 +2,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController def initialize super - @app_title = NewBlog::MOUDLEAPP_TITLE + @app_title = 'announcement' end # GET /bulletins @@ -12,9 +12,9 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController date_now = Time.now 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 - @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 get_categorys @@ -23,7 +23,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController end def show - @bulletin = Bulletin.find(params[:id]) + @bulletin = Bulletin.can_display.where.where(_id: params[:id]) get_categorys end diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb index 60aad3d9..96277c5e 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb @@ -2,7 +2,7 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController def initialize super - @app_title = NewBlog::MOUDLEAPP_TITLE + @app_title = 'announcement' end # GET /bulletins @@ -14,9 +14,9 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController # @bulletin_categorys = BulletinCategory.first; # @bulletins = Bulletin.widget_datas(@bulletin_categorys.id).limit(9) 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 - @bulletins = Bulletin.widget_datas.limit(9) + @bulletins = Bulletin.can_display.widget_datas.limit(9) end get_categorys @@ -26,14 +26,14 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController def bulletins_and_web_links @tags = AnnouncementTag.all @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 render :layout => 'module_widget' end def reload_bulletins @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 def reload_web_links diff --git a/vendor/built_in_modules/announcement/app/models/bulletin - %BDƻs.rb b/vendor/built_in_modules/announcement/app/models/bulletin - %BDƻs.rb deleted file mode 100644 index c65e65f7..00000000 --- a/vendor/built_in_modules/announcement/app/models/bulletin - %BDƻs.rb +++ /dev/null @@ -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 \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/models/bulletin - ƻs.rb b/vendor/built_in_modules/announcement/app/models/bulletin - ƻs.rb deleted file mode 100644 index c65e65f7..00000000 --- a/vendor/built_in_modules/announcement/app/models/bulletin - ƻs.rb +++ /dev/null @@ -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 \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index d1b7f3c5..4808b3a9 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -19,12 +19,14 @@ class Bulletin field :is_top, :type => Boolean, :default => false field :is_hot, :type => Boolean, :default => false field :is_hidden, :type => Boolean, :default => false - field :is_checked, :type => Boolean, :default => false + field :is_checked, :type => Boolean, :default => nil field :not_checked_reason field :public, :type => Boolean, :default => true + scope :can_display,where(is_checked: true) + mount_uploader :image, ImageUploader belongs_to :bulletin_category @@ -47,28 +49,17 @@ class Bulletin def self.search( search = nil, category_id = nil ) - - if category_id.to_s.size > 0 and search.to_s.size > 0 - + 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 - + 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 - + find(:all, :conditions => {title: key}).desc( :is_top, :postdate ) + else + find(:all).desc( :is_top, :postdate) + end end @@ -87,7 +78,22 @@ class Bulletin end end - + + def status + case self.is_checked + when nil + I18n.t('announcement.bulletin.fact_check_pending') + when true + I18n.t('announcement.bulletin.fact_check_pass') + when false + I18n.t('announcement.bulletin.fact_check_not_pass') + end + end + + def is_expired? + Date.today > self.deadline ? true : false rescue false + #some dates might sat as nil so rescue false + end def is_top? self.is_top @@ -101,6 +107,15 @@ class Bulletin self.is_hidden end + def is_checked? + self.is_checked + end + + def is_check_rejected? + self.is_checked == false + end + + def save_bulletin_links self.bulletin_links.each do |t| if t.should_destroy diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_file.rb b/vendor/built_in_modules/announcement/app/models/bulletin_file.rb index 05894515..c4d60b9b 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin_file.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin_file.rb @@ -16,6 +16,15 @@ class BulletinFile belongs_to :bulletin # embedded_in :bulletin + before_save :set_key + + def filetitle + @filetitle ||= I18nVariable.first(:conditions => {:key => 'filetitle', :language_value_id => self.id, :language_value_type => self.class}) rescue nil + end + + def description + @description ||= I18nVariable.first(:conditions => {:key => 'description', :language_value_id => self.id, :language_value_type => self.class}) rescue nil + end protected diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb index bf02b054..7f1b5626 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb @@ -5,7 +5,6 @@
      diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_form.html.erb index 1ce7f629..df0dc38c 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_form.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_form.html.erb @@ -23,14 +23,14 @@
      - <%= f.label :display %> - <%= f.radio_button :display, "List" %>List - <%= f.radio_button :display, "Picture" %>Picture -
      顯示方式是設定在前台頁面時,資訊所呈現的樣式 + <%#= f.label :display %> + <%#= f.radio_button :display, "List" List%> + <%#= f.radio_button :display, "Picture" Picture%> + <%#
      顯示方式是設定在前台頁面時,資訊所呈現的樣式 %>
      - <%= f.submit 'Submit/送出', :class=>'btn btn-primary' %> + <%= f.submit t('submit'), :class=>'btn btn-primary' %>
      <% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit.html.erb deleted file mode 100644 index 14a72951..00000000 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit.html.erb +++ /dev/null @@ -1,13 +0,0 @@ - - - - <%= t(:quick_edit) %> - <%= form_for bulletin_category, :url => panel_announcement_back_end_bulletin_category_path(bulletin_category), :html => {:class => 'form-horizontal'} do |f| %> - <%= render :partial => "quick_edit_qe", :locals => { :f => f, :bulletin_category => bulletin_category } %> -
      - <%= f.submit t(:submit), :class => 'btn btn-primary' %> - <%= f.submit t(:cancel), :class => 'btn', :type => 'reset' %> -
      - <% end %> - - diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/quick_edit.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/quick_edit.js.erb deleted file mode 100644 index 7db1d0f8..00000000 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/quick_edit.js.erb +++ /dev/null @@ -1,3 +0,0 @@ -$.each($(".quick_edit"),function(obj){ $(this).remove(); }); -$("#<%= dom_id @bulletin_category %>").append("
      <%= j render "form" %>
      "); -//$("#form > form").replaceWith("<%= j render "form" %>"); diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb index ebd8f098..ca80512e 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb @@ -1,5 +1,5 @@ - + <%= check_box_tag 'to_delete[]', bulletin.id, false, :class => "checkbox_in_list" %> <% if bulletin.is_top? %> <%= t(:top) %> @@ -10,40 +10,46 @@ <% if bulletin.is_hidden? %> <%= t(:hidden) %> <% end %> + <%= bulletin.status %> + + <%= bulletin.bulletin_category.i18n_variable[I18n.locale] %> + + <%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue ''%>
      - <%= bulletin.bulletin_category.i18n_variable[I18n.locale] %> - <%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue ''%> <%= bulletin.postdate %> <%= (bulletin.deadline) ? bulletin.deadline : t('bulletin.no_deadline') %> - <% bulletin.sorted_tags.each do |tag| %> - <%= tag[I18n.locale] %> - <% end %> +
      +
      + <% bulletin.sorted_tags.each do |tag| %> + <%= tag[I18n.locale] %> + <% end %> +
      +
      <%= User.from_id(bulletin.update_user_id).name rescue ''%> - -<%= render :partial => 'quick_edit', :locals => {:bulletin => bulletin} %> - -<% content_for :page_specific_javascript do %> - -<% end %> \ No newline at end of file + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file.html.erb deleted file mode 100644 index ef2d4bc7..00000000 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file.html.erb +++ /dev/null @@ -1,47 +0,0 @@ - - " class='list_item'> - -
      -
      - <%= f.file_field :file %> -
      -
      - - - <%= f.fields_for :filetitle, (bulletin_file.new_record? ? bulletin_file.build_filetitle : bulletin_file.filetitle ) do |f| %> - <% @site_valid_locales.each do |locale| %> -
      - -
      - <%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %> -
      -
      - <% end %> - <% end %> - - - <%= f.fields_for :description, (bulletin_file.new_record? ? bulletin_file.build_description : bulletin_file.description ) do |f| %> - <% @site_valid_locales.each do |locale| %> -
      - -
      - <%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %> -
      -
      - <% end %> - <% end %> - - - - <% if bulletin_file.new_record? %> - - <% else %> - <%= f.hidden_field :id %> - - <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> - <% end %> - - - - - diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file_qe.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file_qe.html.erb new file mode 100644 index 00000000..4e47024c --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file_qe.html.erb @@ -0,0 +1,51 @@ +<% # encoding: utf-8 %> + + <%= form_for(@bulletin_file, :remote => true, :url => @file_url) do |f| %> + + + + + + + + <% end %> + + + \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html - %BDƻs.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html - %BDƻs.erb deleted file mode 100644 index 33d1ba1e..00000000 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html - %BDƻs.erb +++ /dev/null @@ -1,27 +0,0 @@ - -
      " class='list_item'> -
      - - <%= f.label :link_url %> - <%= f.text_field :url %> - - <%= f.label :link_name %> - <%#= f.text_field :name %> - <%= f.fields_for :i18n_variable, (bulletin_link.new_record? ? bulletin_link.build_i18n_variable : bulletin_link.i18n_variable) do |f| %> - <% @site_valid_locales.each do |locale| %> - <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %> - <%= f.text_field locale, :style => "width:130px" %> - <% end %> - <% end %> - - - <% if bulletin_link.new_record? %> - <%= t(:delete) %> - <% else %> - <%= f.hidden_field :id %> - <%= t(:delete) %> - <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> - <% end %> - -
      -
      diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html - ƻs.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html - ƻs.erb deleted file mode 100644 index 33d1ba1e..00000000 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html - ƻs.erb +++ /dev/null @@ -1,27 +0,0 @@ - -
      " class='list_item'> -
      - - <%= f.label :link_url %> - <%= f.text_field :url %> - - <%= f.label :link_name %> - <%#= f.text_field :name %> - <%= f.fields_for :i18n_variable, (bulletin_link.new_record? ? bulletin_link.build_i18n_variable : bulletin_link.i18n_variable) do |f| %> - <% @site_valid_locales.each do |locale| %> - <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %> - <%= f.text_field locale, :style => "width:130px" %> - <% end %> - <% end %> - - - <% if bulletin_link.new_record? %> - <%= t(:delete) %> - <% else %> - <%= f.hidden_field :id %> - <%= t(:delete) %> - <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> - <% end %> - -
      -
      diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html.erb deleted file mode 100644 index c8503083..00000000 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html.erb +++ /dev/null @@ -1,37 +0,0 @@ - - " class='list_item'> - - -
      -
      - <%= f.text_field :url %> -
      -
      - - - <%= f.fields_for :i18n_variable, (bulletin_link.new_record? ? bulletin_link.build_i18n_variable : bulletin_link.i18n_variable) do |f| %> - <% @site_valid_locales.each do |locale| %> -
      -
      - <%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %> -
      -
      - - - - <% end %> - <% end %> - - - - - <% if bulletin_link.new_record? %> - - <% else %> - <%= f.hidden_field :id %> - - <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> - <% end %> - - - diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html - %BDƻs.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html - %BDƻs.erb deleted file mode 100644 index c44b5c92..00000000 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html - %BDƻs.erb +++ /dev/null @@ -1,16 +0,0 @@ - - "> - <%= link_to bulletin_link2.i18n_variable.zh_tw, bulletin_link2.url, :target => '_blank' %> - <%= link_to bulletin_link2.i18n_variable.en, bulletin_link2.url, :target => '_blank' %> - - - <%= f.hidden_field :id %> - - <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> - - - - - - - \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html - ƻs.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html - ƻs.erb deleted file mode 100644 index c44b5c92..00000000 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html - ƻs.erb +++ /dev/null @@ -1,16 +0,0 @@ - - "> - <%= link_to bulletin_link2.i18n_variable.zh_tw, bulletin_link2.url, :target => '_blank' %> - <%= link_to bulletin_link2.i18n_variable.en, bulletin_link2.url, :target => '_blank' %> - - - <%= f.hidden_field :id %> - - <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> - - - - - - - \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html.erb deleted file mode 100644 index a3bc5243..00000000 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html.erb +++ /dev/null @@ -1,17 +0,0 @@ - - "> - <%= link_to bulletin_link2.i18n_variable.zh_tw, bulletin_link2.url, :target => '_blank' %> - <%= link_to bulletin_link2.i18n_variable.en, bulletin_link2.url, :target => '_blank' %> - - - - <%= f.hidden_field :id %> - - <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> - - - - - - - \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link_qe.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link_qe.html.erb index 7208f73c..c146da48 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link_qe.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link_qe.html.erb @@ -1,41 +1,37 @@ <% # encoding: utf-8 %> - <%= form_for(@bulletin.bulletin_links, :remote => true, :url => @link_url) do |f| %> - - @@ -277,13 +286,13 @@ var new_id = $(this).prev().attr('value'); var old_id = new RegExp("new_bulletin_links", "g"); $(this).prev().attr('value', parseInt(new_id) + 1); - $(this).parents('table').append(("<%= escape_javascript(add_attribute 'bulletin_link', f, :bulletin_links) %>").replace(old_id, new_id)); + $(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_bulletin_link', f, :bulletin_links) %>").replace(old_id, new_id)); }); $('#add_bulletin_file a.add').live('click', function(){ var new_id = $(this).prev().attr('value'); var old_id = new RegExp("new_bulletin_files", "g"); $(this).prev().attr('value', parseInt(new_id) + 1); - $(this).parents('table').append(("<%= escape_javascript(add_attribute 'bulletin_file', f, :bulletin_files) %>").replace(old_id, new_id)); + $(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_bulletin_file', f, :bulletin_files) %>").replace(old_id, new_id)); }); <% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_file.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_file.html.erb new file mode 100644 index 00000000..0f332069 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_file.html.erb @@ -0,0 +1,71 @@ + + " class='list_item'> + +
      +
      + <%= f.file_field :file %> +
      +
      + + + +
      + + <% @site_valid_locales.each_with_index do |locale, i| %> + +
      "> + + <%= f.fields_for :filetitle, (form_bulletin_file.new_record? ? form_bulletin_file.build_filetitle : form_bulletin_file.filetitle ) do |f| %> +
      + +
      + <%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %> +
      +
      + <% end %> + +
      + + <% end %> + +
      + + + + +
      + + <% @site_valid_locales.each_with_index do |locale, i| %> + +
      "> + + <%= f.fields_for :description, (form_bulletin_file.new_record? ? form_bulletin_file.build_description : form_bulletin_file.description ) do |f| %> +
      + +
      + <%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %> +
      +
      + <% end %> + +
      + + <% end %> + +
      + + + + + <% if form_bulletin_file.new_record? %> + + <% else %> + <%= f.hidden_field :id %> + + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> + <% end %> + + + + + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_link.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_link.html.erb new file mode 100644 index 00000000..cfd91358 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_link.html.erb @@ -0,0 +1,47 @@ + + " class='list_item'> + + +
      +
      + <%= f.text_field :url %> +
      +
      + + + + +
      + + <% @site_valid_locales.each_with_index do |locale, i| %> + +
      "> + + <%= f.fields_for :i18n_variable, (form_bulletin_link.new_record? ? form_bulletin_link.build_i18n_variable : form_bulletin_link.i18n_variable) do |f| %> +
      + +
      + <%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %> +
      +
      + <% end %> + +
      + + <% end %> + +
      + + + + + <% if form_bulletin_link.new_record? %> + + <% else %> + <%= f.hidden_field :id %> + + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> + <% end %> + + + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_file.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_file.html.erb new file mode 100644 index 00000000..c884d0ad --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_file.html.erb @@ -0,0 +1,21 @@ + + + <%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.filetitle.zh_tw, list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description.zh_tw} ) : list_bulletin_file.filetitle.zh_tw %> + <%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.filetitle.en, list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description.en} ) : list_bulletin_file.filetitle.en %> + + + + <%= fields_for "bulletin[bulletin_files_attributes][]", list_bulletin_file, :index => list_bulletin_file_counter do |f| %> + <%= f.hidden_field :id %> + + <%= f.hidden_field :should_destroy, :value => nil , :class => 'should_destroy' %> + <% end %> + + + + + + + + + \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_link.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_link.html.erb new file mode 100644 index 00000000..33cb9498 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_link.html.erb @@ -0,0 +1,19 @@ + + + <%= link_to list_bulletin_link.i18n_variable.zh_tw, list_bulletin_link.url, :target => '_blank' %> + <%= link_to list_bulletin_link.i18n_variable.en, list_bulletin_link.url, :target => '_blank' %> + + + + <%= fields_for "bulletin[bulletin_links_attributes][]", list_bulletin_link, :index => list_bulletin_link_counter do |f| %> + <%= f.hidden_field :id %> + + <%= f.hidden_field :should_destroy, :value => nil , :class => 'should_destroy' %> + <% end %> + + + + + + + \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit.html.erb index 96e8237c..7c303b23 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit.html.erb @@ -1,17 +1,10 @@ - - - - <%= t(:quick_edit) %> - Basic / Picture / Tags / Link / File - <%= form_for bulletin, :url => panel_announcement_back_end_bulletin_path(bulletin), :html => {:class => 'form-horizontal'} do |f| %> - <%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_basic", :locals => { :f => f, :bulletin => bulletin } %> - <%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_picture", :locals => { :f => f, :bulletin => bulletin } %> - <%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_tags", :locals => { :f => f, :bulletin => bulletin } %> - <%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_links", :locals => { :f => f, :bulletin => bulletin } %> - <%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_files", :locals => { :f => f, :bulletin => bulletin } %> -
      - <%= f.submit t(:submit), :class => 'btn btn-primary' %> - <%= f.submit t(:cancel), :class => 'btn', :type => 'reset' %> -
      - <% end %> - - + + <%= t(:quick_edit) %> - <%= t(type) %> + <%= form_for @bulletin, :url => panel_announcement_back_end_bulletin_path(@bulletin), :html => {:class => 'form-horizontal'} do |f| %> + <%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_#{@type}", :locals => { :f => f, :bulletin => @bulletin } %> +
      + <%= f.submit t(:submit), :class => 'btn btn-primary' %> + <%= f.submit t(:cancel), :class => 'btn quick_edit_cancel', :type => 'reset', :rel => dom_id(@bulletin, :edit) %> +
      + <% end %> + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_basic.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_basic.html.erb index ce96acdc..9fc911ff 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_basic.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_basic.html.erb @@ -1,4 +1,4 @@ -
      +
      diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_files.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_files.html.erb index d517e00d..8360ad42 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_files.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_files.html.erb @@ -1,4 +1,4 @@ -
      +
      @@ -11,52 +11,16 @@ - - - - - - - + + <%= render :partial => 'list_bulletin_file', :collection => bulletin.bulletin_files %>
      - ADD/新增 + + <%= t('add')%>
      - +
      diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_links.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_links.html.erb index affd717c..5fea2ded 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_links.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_links.html.erb @@ -1,7 +1,7 @@ -