diff --git a/Gemfile b/Gemfile index c77cc5cd..d8585cec 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,14 @@ source 'http://rubygems.org' gem 'rails', '>=3.1.0', '<3.2.0' +gem "brakeman" + gem 'bson_ext' gem 'carrierwave' gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid' gem 'devise' gem "net-ldap", "~> 0.3.1" +gem 'devise', '1.5.3' gem 'exception_notification' # Send error trace gem 'execjs' gem 'jquery-rails' @@ -15,6 +18,8 @@ gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git' gem 'mini_magick' gem 'mongoid' gem 'mysql2' +gem "mongo_session_store-rails3" +gem 'nokogiri' gem 'radius' gem 'rake' gem 'ruby-debug19' @@ -22,7 +27,7 @@ gem 'rubyzip' gem 'sinatra' gem 'sprockets' gem 'tinymce-rails' -gem 'therubyracer' +gem 'therubyracer' if RUBY_PLATFORM.downcase.include?("linux") diff --git a/Gemfile.lock b/Gemfile.lock index 8011bf97..bd8b4082 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,48 +10,56 @@ GIT GEM remote: http://rubygems.org/ specs: - actionmailer (3.1.3) - actionpack (= 3.1.3) + actionmailer (3.1.4) + actionpack (= 3.1.4) mail (~> 2.3.0) - actionpack (3.1.3) - activemodel (= 3.1.3) - activesupport (= 3.1.3) + actionpack (3.1.4) + activemodel (= 3.1.4) + activesupport (= 3.1.4) builder (~> 3.0.0) erubis (~> 2.7.0) i18n (~> 0.6) - rack (~> 1.3.5) + rack (~> 1.3.6) rack-cache (~> 1.1) rack-mount (~> 0.8.2) rack-test (~> 0.6.1) sprockets (~> 2.0.3) - activemodel (3.1.3) - activesupport (= 3.1.3) + activemodel (3.1.4) + activesupport (= 3.1.4) builder (~> 3.0.0) i18n (~> 0.6) - activerecord (3.1.3) - activemodel (= 3.1.3) - activesupport (= 3.1.3) - arel (~> 2.2.1) + activerecord (3.1.4) + activemodel (= 3.1.4) + activesupport (= 3.1.4) + arel (~> 2.2.3) tzinfo (~> 0.3.29) - activeresource (3.1.3) - activemodel (= 3.1.3) - activesupport (= 3.1.3) - activesupport (3.1.3) + activeresource (3.1.4) + activemodel (= 3.1.4) + activesupport (= 3.1.4) + activesupport (3.1.4) multi_json (~> 1.0) archive-tar-minitar (0.5.2) - arel (2.2.1) + arel (2.2.3) bcrypt-ruby (3.0.1) bcrypt-ruby (3.0.1-x86-mingw32) - bson (1.5.2) - bson_ext (1.5.2) - bson (= 1.5.2) + brakeman (1.5.1) + activesupport + erubis (~> 2.6) + haml (~> 3.0) + i18n + ruby2ruby (~> 1.2) + ruport (~> 1.6) + sass (~> 3.0) + bson (1.6.1) + bson_ext (1.6.1) + bson (~> 1.6.1) builder (3.0.0) carrierwave (0.5.8) activesupport (~> 3.0) carrierwave-mongoid (0.1.3) carrierwave (>= 0.5.6) mongoid (~> 2.1) - chronic (0.6.6) + chronic (0.6.7) coffee-rails (3.1.1) coffee-script (>= 2.2.0) railties (~> 3.1.0) @@ -59,6 +67,7 @@ GEM coffee-script-source execjs coffee-script-source (1.2.0) + color (1.4.1) columnize (0.3.6) database_cleaner (0.7.1) delorean (1.2.0) @@ -73,41 +82,50 @@ GEM actionmailer (>= 3.0.4) execjs (1.3.0) multi_json (~> 1.0) - factory_girl (2.5.0) - activesupport - factory_girl_rails (1.6.0) - factory_girl (~> 2.5.0) + factory_girl (2.6.3) + activesupport (>= 2.3.9) + factory_girl_rails (1.7.0) + factory_girl (~> 2.6.0) railties (>= 3.0.0) + fastercsv (1.5.4) + haml (3.1.4) hike (1.2.1) + hoe (2.16.1) + rake (~> 0.8) i18n (0.6.0) jquery-rails (1.0.19) railties (~> 3.0) thor (~> 0.14) json (1.6.5) - libv8 (3.3.10.4) linecache19 (0.5.12) ruby_core_source (>= 0.1.4) - mail (2.3.0) + mail (2.3.3) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.17.2) mini_magick (3.4) subexec (~> 0.2.1) - mongo (1.5.2) - bson (= 1.5.2) - mongoid (2.4.2) + mongo (1.6.1) + bson (~> 1.6.1) + mongo_session_store-rails3 (3.0.5) + actionpack (>= 3.0) + mongo + mongoid (2.4.6) activemodel (~> 3.1) mongo (~> 1.3) tzinfo (~> 0.3.22) - multi_json (1.0.4) mysql2 (0.3.11) - mysql2 (0.3.11-x86-mingw32) net-ldap (0.3.1) + multi_json (1.1.0) + nokogiri (1.5.2) orm_adapter (0.0.6) + pdf-writer (1.1.8) + color (>= 1.4.0) + transaction-simple (~> 1.3) polyglot (0.3.3) rack (1.3.6) - rack-cache (1.1) + rack-cache (1.2) rack (>= 0.4) rack-mount (0.8.3) rack (>= 1.0.0) @@ -117,18 +135,18 @@ GEM rack rack-test (0.6.1) rack (>= 1.0) - radius (0.7.1) - rails (3.1.3) - actionmailer (= 3.1.3) - actionpack (= 3.1.3) - activerecord (= 3.1.3) - activeresource (= 3.1.3) - activesupport (= 3.1.3) + radius (0.7.3) + rails (3.1.4) + actionmailer (= 3.1.4) + actionpack (= 3.1.4) + activerecord (= 3.1.4) + activeresource (= 3.1.4) + activesupport (= 3.1.4) bundler (~> 1.0) - railties (= 3.1.3) - railties (3.1.3) - actionpack (= 3.1.3) - activesupport (= 3.1.3) + railties (= 3.1.4) + railties (3.1.4) + actionpack (= 3.1.4) + activesupport (= 3.1.4) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) @@ -157,18 +175,27 @@ GEM columnize (>= 0.3.1) linecache19 (>= 0.5.11) ruby-debug-base19 (>= 0.11.19) + ruby2ruby (1.3.1) + ruby_parser (~> 2.0) + sexp_processor (~> 3.0) ruby_core_source (0.1.5) archive-tar-minitar (>= 0.5.2) - rubyzip (0.9.5) - sass (3.1.12) + ruby_parser (2.3.1) + sexp_processor (~> 3.0) + rubyzip (0.9.6.1) + ruport (1.6.3) + fastercsv + pdf-writer (= 1.1.8) + sass (3.1.15) sass-rails (3.1.5) actionpack (~> 3.1.0) railties (~> 3.1.0) sass (~> 3.1.10) tilt (~> 1.3.2) + sexp_processor (3.1.0) shoulda-matchers (1.0.0) - simplecov (0.5.4) - multi_json (~> 1.0.3) + simplecov (0.6.1) + multi_json (~> 1.0) simplecov-html (~> 0.5.3) simplecov-html (0.5.3) sinatra (1.3.2) @@ -183,26 +210,26 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) subexec (0.2.1) - therubyracer (0.9.9) - libv8 (~> 3.3.10) thor (0.14.6) tilt (1.3.3) tinymce-rails (3.4.8) railties (>= 3.1) + transaction-simple (1.4.0) + hoe (>= 1.1.7) treetop (1.4.10) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.31) - uglifier (1.2.2) + tzinfo (0.3.32) + uglifier (1.2.3) execjs (>= 0.3.0) multi_json (>= 1.0.2) - warden (1.1.0) + warden (1.1.1) rack (>= 1.0) watchr (0.7) win32-api (1.4.8-x86-mingw32) win32-process (0.6.5) windows-pr (>= 1.1.2) - windows-api (0.4.0) + windows-api (0.4.1) win32-api (>= 1.4.5) windows-pr (1.2.1) win32-api (>= 1.4.5) @@ -213,22 +240,25 @@ PLATFORMS x86-mingw32 DEPENDENCIES + brakeman bson_ext carrierwave carrierwave-mongoid coffee-rails database_cleaner delorean - devise + devise (= 1.5.3) exception_notification execjs factory_girl_rails jquery-rails kaminari! mini_magick + mongo_session_store-rails3 mongoid mysql2 net-ldap (~> 0.3.1) + nokogiri radius rails (>= 3.1.0, < 3.2.0) rake @@ -242,7 +272,6 @@ DEPENDENCIES sinatra spork sprockets - therubyracer tinymce-rails uglifier watchr diff --git a/Rakefile b/Rakefile index 2036d04c..9a495de7 100644 --- a/Rakefile +++ b/Rakefile @@ -5,4 +5,4 @@ require File.expand_path('../config/application', __FILE__) require 'rake/dsl_definition' require 'rake' -PrototypeR4::Application.load_tasks +Orbit::Application.load_tasks 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 5002cfae..abb908b4 100644 --- a/app/assets/javascripts/bulletin_form.js.erb +++ b/app/assets/javascripts/bulletin_form.js.erb @@ -1,4 +1,4 @@ -$('.bulletin_urls_block a.delete').live('click', function(){ +$('.bulletin_links_block a.delete').live('click', function(){ $(this).parents('.list_item').remove(); }); @@ -8,5 +8,21 @@ $('.bulletin_files_block a.delete').live('click', function(){ $('.action a.remove_existing_record').live('click', function(){ $(this).next('.should_destroy').attr('value', 1); - $("#bulletin_" + $(this).prev().attr('value')).hide(); + //$("#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 cd15fc39..45bfcbbc 100644 --- a/app/assets/javascripts/new_admin.js +++ b/app/assets/javascripts/new_admin.js @@ -10,4 +10,7 @@ //= require jquery.isotope.min //= require jquery.tinyscrollbar.min //= require orbit-1.0 -//= require tinymce-jquery \ No newline at end of file +//= require tinymce-jquery +//= 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 efb7042e..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,24 +27,35 @@ $(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*/ resize(); - $('#main-sidebar').css("height", viewportheight-40); - $('#main-sidebar .viewport').css("height", viewportheight-40); + var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2; + $('#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-sidebar').tinyscrollbar(); $('.detal-list').tinyscrollbar(); - $('#main-sidebar').tinyscrollbar({size:(viewportheight-44)}); + $('#main-sidebar').tinyscrollbar({size:(viewportheight-34)}); + mainTablePosition(); /*isotope*/ var $container = $('#isotope'); @@ -74,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..4b5da1d4 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; - } - ); +// $('#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; +// } +// ); - $('.form').live('submit', function () { - $.post(this.action, $(this).serialize(), null, 'script'); - history_edited = true; +// $('#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; - }); + } +); - $(window).bind("popstate", function () { - if (history_edited) { - $.getScript(location.href); - } - }); +$(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 new file mode 100644 index 00000000..60492914 --- /dev/null +++ b/app/assets/javascripts/tinymce_orbit.js @@ -0,0 +1,25 @@ +$(function() { + $('.tinymce_textarea').tinymce({ + theme: 'advanced', + 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 : "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 : true, + + // Skin options + skin : "o2k7", + skin_variant : "silver", + + // Drop lists for link/image/media/template dialogs + template_external_list_url : "js/template_list.js", + external_link_list_url : "js/link_list.js", + external_image_list_url : "js/image_list.js", + media_external_list_url : "js/media_list.js" + }); +}); \ No newline at end of file diff --git a/app/assets/stylesheets/admin/ad_banner_preview.css.erb b/app/assets/stylesheets/admin/ad_banner_preview.css.erb new file mode 100644 index 00000000..f46be689 --- /dev/null +++ b/app/assets/stylesheets/admin/ad_banner_preview.css.erb @@ -0,0 +1,4 @@ +.banner-preview { + width: auto; + left: 35%; +} \ No newline at end of file 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/inc/permission-checkbox.css.erb.css b/app/assets/stylesheets/inc/permission-checkbox.css.erb.css new file mode 100644 index 00000000..5a2deb60 --- /dev/null +++ b/app/assets/stylesheets/inc/permission-checkbox.css.erb.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(<%= asset_path "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/site_items.css.erb b/app/assets/stylesheets/site_items.css.erb index 38b0a185..4e23bd4c 100644 --- a/app/assets/stylesheets/site_items.css.erb +++ b/app/assets/stylesheets/site_items.css.erb @@ -1,482 +1,483 @@ -html, body{ - height: 100%; - margin: 0; - padding: 0; -} -html{ - background: url(<%= asset_path "body.jpg" %>) no-repeat fixed 0 0 transparent; - background-size: cover; -} - -body{ - color: #000000; - font-family: Helvetica, '微軟正黑體'; -} -#back_banner_link{ - background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #787e82), color-stop(0.05, #61676c), color-stop(1, #292c2d) ); - background:-moz-linear-gradient( center top -90deg, #787e82 0%, #61676c 5%, #292c2d 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#61676c', endColorstr='#292c2d'); - -moz-box-shadow: 0px 1px 5px 0px rgba(0,0,0,.7); - -webkit-box-shadow: 0px 1px 5px 0px rgba(0,0,0,.7); - box-shadow: 0px 1px 5px 0px rgba(0,0,0,.7); - border-top: 1px solid #474a4c; - border-bottom: 1px solid #1d2020; - height: 41px; - width: 100%; - behavior: url(<%= asset_path "PIE.htc" %>); -} -.hmenu{ - float: right; - height: 41px; -} -#back_orbit{ - background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #70787d), color-stop(1, #3b4043) ); - background:-moz-linear-gradient( center top -90deg, #70787d 0%, #3b4043 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#70787d', endColorstr='#3b4043'); - -webkit-border-radius: 0px 0px 5px 5px; - -moz-border-radius: 0px 0px 5px 5px; - border-radius: 0px 0px 5px 5px; - -moz-box-shadow: 0px 1px 1px 0px rgba(0,0,0,.7); - -webkit-box-shadow: 0px 1px 1px 0px rgba(0,0,0,.7); - box-shadow: 0px 1px 1px 0px rgba(0,0,0,.7); - cursor: pointer; - float: left; - height: 43px; - margin-left: 10px; - width: 41px; - behavior: url(<%= asset_path "PIE.htc" %>); -} -#back_orbit span{ - text-indent: -9999px; - background: url(<%= asset_path "bar_orbit.png" %>) no-repeat scroll 0 0 transparent; - display: block; - height: 43px; - width: 100%; -} -#back_orbit:hover{ - background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #fefefe), color-stop(1, #e4e4e4) ); - background:-moz-linear-gradient( center top -90deg, #fefefe 0%, #e4e4e4 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fefefe', endColorstr='#e4e4e4'); - -webkit-border-radius: 0px; - -moz-border-radius: 0px; - border-radius: 0px; -} -#back_orbit:hover span{ - background-position: 0 -44px; -} -#back_orbit:hover #orblist{ - display:block; -} -#orblist{ - background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #e4e4e4), color-stop(1, #FFFFFF) ); - background:-moz-linear-gradient( center top -90deg, #e4e4e4 0%, #FFFFFF 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#e4e4e4', endColorstr='#FFFFFF'); - -webkit-border-radius: 0px 3px 3px 3px; - -moz-border-radius: 0px 3px 3px 3px; - border-radius: 0px 3px 3px 3px; - -webkit-box-shadow: 0 3px 3px #000000; - -moz-box-shadow: 0 3px 3px #000000; - box-shadow: 0 3px 3px #000000; - display: none; - margin: 0; - padding: 10px; - position: absolute; - top: 43px; - width: 130px; -} -#orblist li{ - border-bottom:1px solid #aaa; - list-style:none; -} -.orblink{ - color: #333333; - display: block; - font: 12px/100% arial,sans-serif; - padding: 5px; - text-decoration: none; -} -.orblink:hover{ - background:#eee; - color:#333; -} -#log_out{ - -moz-box-shadow:inset 1px 0px 0px 0px #73777b; - -webkit-box-shadow:inset 1px 0px 0px 0px #73777b; - box-shadow:inset 1px 0px 0px 0px #73777b; - border-right:1px solid #41474c; - border-left:1px solid #41474c; - float:right; - width:41px; - height:41px; -} -#log_out:hover{ - background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #01afde), color-stop(1, #007ec6) ); - background:-moz-linear-gradient( center top -90deg, #01afde 0%, #007ec6 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#01afde', endColorstr='#007ec6'); -} -#log_out a{ - background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right 0 transparent; - display: block; - height: 41px; - text-indent: -9999px; - width: 41px; -} -#log_out a:hover{ - background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right bottom transparent !important; -} -.lang{ - color: #FFFFFF; - float: right; - font-size: 15px; - line-height: 40px; - margin-right: 10px; -} -.lang a{ - color:#fff; - text-decoration:none; -} -.lang a:hover{ - text-decoration:underline; -} -#back_content{ - height: 100%; -} -#back_footer{ - background-color: #101010; - bottom: 0; - color: #FFFFFF; - font-size: 11px; - padding: 10px; - position: fixed; - width: 100%; - left: 0; - box-shadow: 0 -3px 4px #000; -} -.items_setup{ - padding:42px 0 0 0; -} -#back_sidebar .items_setup .list li{ - padding: 6px 0 7px 5px; -} -#back_sidebar .items_setup .list li a{ - display: inline; - font-size: 0.9em; - padding: 0; -} -#back_sidebar .items_setup .list li a span{ - background:none; - padding:0; - text-shadow:none; -} -.main { - background: none repeat scroll 0 0 #FFFFFF; - height: 100%; - margin-left: 220px; - padding: 0 40px; - position: relative; -} -.main_list { - padding-top: 70px; -} -.main_list ul { - clear:both; -} -#porfile { - padding-top: 100px; -} -/*add_buttom*/ -.button_bar { - float: right; - -moz-box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black; - -webkit-box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black; - box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black; - background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #4f4f4f), color-stop(1, #000000) ); - background:-moz-linear-gradient( center top, #4f4f4f 5%, #000000 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#4f4f4f', endColorstr='#000000'); - background-color:#4f4f4f; - -moz-border-radius:5px; - -webkit-border-radius:5px; - border-radius:5px; - display:inline-block; - padding:0; - margin:10px 0 60px; -} -.button_bar a { - text-decoration:none; - text-shadow:0px -1px 0px #000000; - font-size:12px; - color:#EDEDED; - border-right:1px solid #555; - -moz-box-shadow:1px 0px 0px black; - -webkit-box-shadow:1px 0px 0px black; - box-shadow:1px 0px 0px black; - padding: 6px 10px 4px; - display: inline-block; - float: left; -} -.button_bar a:active { - padding: 7px 10px 3px !important; - text-shadow:0px 1px 0px #000000; - background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #000000), color-stop(1, #4f4f4f) ); - background:-moz-linear-gradient( center top, #000000 5%, #4f4f4f 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#000000', endColorstr='#4f4f4f'); -} -.button_bar a:last-child { - border-right:none; - -moz-box-shadow:none; - -webkit-box-shadow:none; - box-shadow:none; - -moz-border-radius:0px 5px 5px 0px; - -webkit-border-radius:0px 5px 5px 0px; - border-radius:0px 5px 5px 0px; -} -.button_bar a:first-child { - -moz-border-radius:5px 0px 0px 5px; - -webkit-border-radius:5px 0px 0px 5px; - border-radius:5px 0px 0px 5px; -} -.button_bar a.new { - padding: 5px 10px; - -moz-border-radius:5px; - -webkit-border-radius:5px; - border-radius:5px; -} -.button_bar a:hover { - color:#FFFFFF; -} -.up { - margin:10px 0; -} -#person { - left: 245px; - position: fixed; - text-align: center; - top: 75px; - width: 140px; - background-color:#FFF; - padding:15px; - border-radius: 5px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - -moz-box-shadow: 0px 0px 4px #180902; /* Firefox */ - -webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */ - box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */ -} -#file { - display:none; -} -#person img { -} -.user_mail { - border: medium none; - border:1px solid #DDDDDD; - color: #666666; - font-size: 12px; - width: 140px; -} -#person label { - display: block; - margin: 15px 0 0; -} -#person label input { -} -#person label #user_admin { - float:right; - margin: 0; -} -#person label span { - text-align:left; - font-size:11px; - color:#888; - display:block; -} -#person select { - border: 1px solid #DDDDDD; - padding: 0; - width: 140px; -} -#porfile .users{ - margin-left: 180px; -} -.roles_block { - background: url(<%= asset_path "75.png" %>) repeat left top; - min-width:710px; - margin-bottom:50px; - position:relative; - padding-bottom: 20px; - border-radius: 5px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - -moz-box-shadow: 0px 0px 4px #180902; /* Firefox */ - -webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */ - box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */ -} -.roles_block h2 { - color: #FFFFFF; - font-weight: normal; - margin: 0; - padding: 0; - position: absolute; - text-shadow: 0 3px 2px #000000; - top: -30px; -} -.main hr { - height:8px; - border:none; - margin:0; - border-radius: 5px 5px 0px 0px; - -moz-border-radius: 5px 5px 0px 0px; - -webkit-border-radius: 5px 5px 0px 0px; - border-bottom:1px solid #000; -} -.main2{ - padding:70px 0 0; -} -#basic_block hr { - background-color: #666666; -} -#teacher_block hr { - background-color: #0071A9; -} -#student_block hr { - background-color: #AF0045; -} -.info_input { - padding:10px 20px; -} -.info_input table { - color:#fff; - width:100%; - font-size:14px; -} -.info_input table td { - padding:5px 10px 5px 0; - width: 10%; -} -.info_input .list_head { - background:url(<%= asset_path "line.png" %>) left bottom repeat-x; -} -.info_input .list_head td { -} -.info_input .list_item { - color:#AEAEAE; -} -.info_input .add { - display:block; - padding-left:22px; - font-size:12px; - line-height:21px; - height:19px; - background:url(<%= asset_path "icon.png" %>) no-repeat -59px 0; - margin-top: 10px; - color: #DDDDDD; -} - -.main table { - width:100%; -} -.main td { - padding-left:20px; - color:#fff; - font-size:14px; - line-height:40px; -} -.main tr.have td{ - background: url(<%= asset_path "75.png" %>) repeat left top; -} -.main tr.have td:first-child{ - border-radius: 5px 0 0 5px; - -moz-border-radius: 5px 0 0 5px; - -webkit-border-radius: 5px 0 0 5px; -} -.main tr.have td:last-child{ - border-radius: 0 5px 5px 0; - -moz-border-radius: 0 5px 5px 0; - -webkit-border-radius: 0 5px 5px 0; -} -.main thead td { - line-height:40px; - font-size:16px; - text-shadow: 0px 1px 1px #3e2914; -} -.main thead td.action { - width:140px; -} -.main tbody td.roles { - background-image: url(<%= asset_path "roles_type.jpg" %>); - background-repeat: repeat-x; -} -.main tbody td.teacher { - background-position: 0 -54px; -} -.main tbody td.student { - background-position: 0 -5px; -} -.main tbody td.action a { - background-image: url(<%= asset_path "icon.png" %>); - display: inline-block; - height: 19px; - margin-right: 10px; - top: 8px; - text-indent: -9999px; - width: 19px; - position: relative; -} -.main tbody td.action a.show { - background-position: left top; -} -.main tbody td.action a.show:hover { - background-position: left -19px; -} -.main tbody td.action a.edit { - background-position: -19px top; -} -.main tbody td.action a.edit:hover { - background-position: -19px -19px; -} -.main tbody td.action a.delete { - background-position: -38px top; -} -.main tbody td.action a.delete:hover { - background-position: -38px -19px; -} -.main tbody td.action a.switch { - background: url(<%= asset_path "switch.png" %>) no-repeat left 3px; - width: 40px; -} -.main tbody tr.disable td.action a.switch { - background-position:left bottom; -} -.main tbody td.action a.delete:hover { - background-position: -38px -19px; -} -.main tbody tr.have { -} -.main tbody tr.disable { - opacity: 0.7; -} -.main tbody tr { - background:none; - height:15px; -} -h1{ - margin:0 0 20px; -} -p{ - margin:0 0 10px; -} - -#back_sidebar .items_setup .list li{ - background:url(<%= asset_path "sidebar_li2.jpg" %>) repeat left top; - border:none; - padding: 0 0 0 5px; -} -#back_sidebar .items_setup .list li a{ - line-height:31px; -} -#back_sidebar .items_setup .list li:hover{ - background:url(<%= asset_path "sidebar_li2.jpg" %>) repeat left top; - border:none; -} -#back_sidebar .items_setup ul .list { +html, body{ + height: 100%; + margin: 0; + padding: 0; +} +html{ + background: url(<%= asset_path "body.jpg" %>) no-repeat fixed 0 0 transparent; + background-size: cover; +} + +body{ + color: #000000; + font-family: Helvetica, '微軟正黑體'; +} +#back_banner_link{ + background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #787e82), color-stop(0.05, #61676c), color-stop(1, #292c2d) ); + background:-moz-linear-gradient( center top -90deg, #787e82 0%, #61676c 5%, #292c2d 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#61676c', endColorstr='#292c2d'); + -moz-box-shadow: 0px 1px 5px 0px rgba(0,0,0,.7); + -webkit-box-shadow: 0px 1px 5px 0px rgba(0,0,0,.7); + box-shadow: 0px 1px 5px 0px rgba(0,0,0,.7); + border-top: 1px solid #474a4c; + border-bottom: 1px solid #1d2020; + height: 41px; + width: 100%; + behavior: url(<%= asset_path "PIE.htc" %>); +} +.hmenu{ + float: right; + height: 41px; +} +#back_orbit{ + background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #70787d), color-stop(1, #3b4043) ); + background:-moz-linear-gradient( center top -90deg, #70787d 0%, #3b4043 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#70787d', endColorstr='#3b4043'); + -webkit-border-radius: 0px 0px 5px 5px; + -moz-border-radius: 0px 0px 5px 5px; + border-radius: 0px 0px 5px 5px; + -moz-box-shadow: 0px 1px 1px 0px rgba(0,0,0,.7); + -webkit-box-shadow: 0px 1px 1px 0px rgba(0,0,0,.7); + box-shadow: 0px 1px 1px 0px rgba(0,0,0,.7); + cursor: pointer; + float: left; + height: 43px; + margin-left: 10px; + width: 41px; + behavior: url(<%= asset_path "PIE.htc" %>); +} +#back_orbit span{ + text-indent: -9999px; + background: url(<%= asset_path "bar_orbit.png" %>) no-repeat scroll 0 0 transparent; + display: block; + height: 43px; + width: 100%; +} +#back_orbit:hover{ + background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #fefefe), color-stop(1, #e4e4e4) ); + background:-moz-linear-gradient( center top -90deg, #fefefe 0%, #e4e4e4 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fefefe', endColorstr='#e4e4e4'); + -webkit-border-radius: 0px; + -moz-border-radius: 0px; + border-radius: 0px; +} +#back_orbit:hover span{ + background-position: 0 -44px; +} +#back_orbit:hover #orblist{ + display:block; +} +#orblist{ + background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #e4e4e4), color-stop(1, #FFFFFF) ); + background:-moz-linear-gradient( center top -90deg, #e4e4e4 0%, #FFFFFF 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#e4e4e4', endColorstr='#FFFFFF'); + -webkit-border-radius: 0px 3px 3px 3px; + -moz-border-radius: 0px 3px 3px 3px; + border-radius: 0px 3px 3px 3px; + -webkit-box-shadow: 0 3px 3px #000000; + -moz-box-shadow: 0 3px 3px #000000; + box-shadow: 0 3px 3px #000000; + display: none; + margin: 0; + padding: 10px; + position: absolute; + top: 43px; + width: 130px; +} +#orblist li{ + border-bottom:1px solid #aaa; + list-style:none; +} +.orblink{ + color: #333333; + display: block; + font: 12px/100% arial,sans-serif; + padding: 5px; + text-decoration: none; +} +.orblink:hover{ + background:#eee; + color:#333; +} +#log_out{ + -moz-box-shadow:inset 1px 0px 0px 0px #73777b; + -webkit-box-shadow:inset 1px 0px 0px 0px #73777b; + box-shadow:inset 1px 0px 0px 0px #73777b; + border-right:1px solid #41474c; + border-left:1px solid #41474c; + float:right; + width:41px; + height:41px; +} +#log_out:hover{ + background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #01afde), color-stop(1, #007ec6) ); + background:-moz-linear-gradient( center top -90deg, #01afde 0%, #007ec6 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#01afde', endColorstr='#007ec6'); +} +#log_out a{ + background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right 0 transparent; + display: block; + height: 41px; + text-indent: -9999px; + width: 41px; +} +#log_out a:hover{ + background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right bottom transparent !important; +} +.lang{ + color: #FFFFFF; + float: right; + font-size: 15px; + line-height: 40px; + margin-right: 10px; +} +.lang a{ + color:#fff; + text-decoration:none; +} +.lang a:hover{ + text-decoration:underline; +} +#back_content{ + height: 100%; +} +#back_footer{ + background-color: #101010; + bottom: 0; + color: #FFFFFF; + display:none; + font-size: 11px; + padding: 10px; + position: fixed; + width: 100%; + left: 0; + box-shadow: 0 -3px 4px #000; +} +.items_setup{ + padding:42px 0 0 0; +} +#back_sidebar .items_setup .list li{ + padding: 6px 0 7px 5px; +} +#back_sidebar .items_setup .list li a{ + display: inline; + font-size: 0.9em; + padding: 0; +} +#back_sidebar .items_setup .list li a span{ + background:none; + padding:0; + text-shadow:none; +} +.main { + background: none repeat scroll 0 0 #FFFFFF; + height: 100%; + margin-left: 220px; + padding: 0 40px; + position: relative; +} +.main_list { + padding-top: 70px; +} +.main_list ul { + clear:both; +} +#porfile { + padding-top: 100px; +} +/*add_buttom*/ +.button_bar { + float: right; + -moz-box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black; + -webkit-box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black; + box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black; + background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #4f4f4f), color-stop(1, #000000) ); + background:-moz-linear-gradient( center top, #4f4f4f 5%, #000000 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#4f4f4f', endColorstr='#000000'); + background-color:#4f4f4f; + -moz-border-radius:5px; + -webkit-border-radius:5px; + border-radius:5px; + display:inline-block; + padding:0; + margin:10px 0 60px; +} +.button_bar a { + text-decoration:none; + text-shadow:0px -1px 0px #000000; + font-size:12px; + color:#EDEDED; + border-right:1px solid #555; + -moz-box-shadow:1px 0px 0px black; + -webkit-box-shadow:1px 0px 0px black; + box-shadow:1px 0px 0px black; + padding: 6px 10px 4px; + display: inline-block; + float: left; +} +.button_bar a:active { + padding: 7px 10px 3px !important; + text-shadow:0px 1px 0px #000000; + background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #000000), color-stop(1, #4f4f4f) ); + background:-moz-linear-gradient( center top, #000000 5%, #4f4f4f 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#000000', endColorstr='#4f4f4f'); +} +.button_bar a:last-child { + border-right:none; + -moz-box-shadow:none; + -webkit-box-shadow:none; + box-shadow:none; + -moz-border-radius:0px 5px 5px 0px; + -webkit-border-radius:0px 5px 5px 0px; + border-radius:0px 5px 5px 0px; +} +.button_bar a:first-child { + -moz-border-radius:5px 0px 0px 5px; + -webkit-border-radius:5px 0px 0px 5px; + border-radius:5px 0px 0px 5px; +} +.button_bar a.new { + padding: 5px 10px; + -moz-border-radius:5px; + -webkit-border-radius:5px; + border-radius:5px; +} +.button_bar a:hover { + color:#FFFFFF; +} +.up { + margin:10px 0; +} +#person { + left: 245px; + position: fixed; + text-align: center; + top: 75px; + width: 140px; + background-color:#FFF; + padding:15px; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + -moz-box-shadow: 0px 0px 4px #180902; /* Firefox */ + -webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */ + box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */ +} +#file { + display:none; +} +#person img { +} +.user_mail { + border: medium none; + border:1px solid #DDDDDD; + color: #666666; + font-size: 12px; + width: 140px; +} +#person label { + display: block; + margin: 15px 0 0; +} +#person label input { +} +#person label #user_admin { + float:right; + margin: 0; +} +#person label span { + text-align:left; + font-size:11px; + color:#888; + display:block; +} +#person select { + border: 1px solid #DDDDDD; + padding: 0; + width: 140px; +} +#porfile .users{ + margin-left: 180px; +} +.roles_block { + background: url(<%= asset_path "75.png" %>) repeat left top; + min-width:710px; + margin-bottom:50px; + position:relative; + padding-bottom: 20px; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + -moz-box-shadow: 0px 0px 4px #180902; /* Firefox */ + -webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */ + box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */ +} +.roles_block h2 { + color: #FFFFFF; + font-weight: normal; + margin: 0; + padding: 0; + position: absolute; + text-shadow: 0 3px 2px #000000; + top: -30px; +} +.main hr { + height:8px; + border:none; + margin:0; + border-radius: 5px 5px 0px 0px; + -moz-border-radius: 5px 5px 0px 0px; + -webkit-border-radius: 5px 5px 0px 0px; + border-bottom:1px solid #000; +} +.main2{ + padding:70px 0 0; +} +#basic_block hr { + background-color: #666666; +} +#teacher_block hr { + background-color: #0071A9; +} +#student_block hr { + background-color: #AF0045; +} +.info_input { + padding:10px 20px; +} +.info_input table { + color:#fff; + width:100%; + font-size:14px; +} +.info_input table td { + padding:5px 10px 5px 0; + width: 10%; +} +.info_input .list_head { + background:url(<%= asset_path "line.png" %>) left bottom repeat-x; +} +.info_input .list_head td { +} +.info_input .list_item { + color:#AEAEAE; +} +.info_input .add { + display:block; + padding-left:22px; + font-size:12px; + line-height:21px; + height:19px; + background:url(<%= asset_path "icon.png" %>) no-repeat -59px 0; + margin-top: 10px; + color: #DDDDDD; +} + +.main table { + width:100%; +} +.main td { + padding-left:20px; + color:#fff; + font-size:14px; + line-height:40px; +} +.main tr.have td{ + background: url(<%= asset_path "75.png" %>) repeat left top; +} +.main tr.have td:first-child{ + border-radius: 5px 0 0 5px; + -moz-border-radius: 5px 0 0 5px; + -webkit-border-radius: 5px 0 0 5px; +} +.main tr.have td:last-child{ + border-radius: 0 5px 5px 0; + -moz-border-radius: 0 5px 5px 0; + -webkit-border-radius: 0 5px 5px 0; +} +.main thead td { + line-height:40px; + font-size:16px; + text-shadow: 0px 1px 1px #3e2914; +} +.main thead td.action { + width:140px; +} +.main tbody td.roles { + background-image: url(<%= asset_path "roles_type.jpg" %>); + background-repeat: repeat-x; +} +.main tbody td.teacher { + background-position: 0 -54px; +} +.main tbody td.student { + background-position: 0 -5px; +} +.main tbody td.action a { + background-image: url(<%= asset_path "icon.png" %>); + display: inline-block; + height: 19px; + margin-right: 10px; + top: 8px; + text-indent: -9999px; + width: 19px; + position: relative; +} +.main tbody td.action a.show { + background-position: left top; +} +.main tbody td.action a.show:hover { + background-position: left -19px; +} +.main tbody td.action a.edit { + background-position: -19px top; +} +.main tbody td.action a.edit:hover { + background-position: -19px -19px; +} +.main tbody td.action a.delete { + background-position: -38px top; +} +.main tbody td.action a.delete:hover { + background-position: -38px -19px; +} +.main tbody td.action a.switch { + background: url(<%= asset_path "switch.png" %>) no-repeat left 3px; + width: 40px; +} +.main tbody tr.disable td.action a.switch { + background-position:left bottom; +} +.main tbody td.action a.delete:hover { + background-position: -38px -19px; +} +.main tbody tr.have { +} +.main tbody tr.disable { + opacity: 0.7; +} +.main tbody tr { + background:none; + height:15px; +} +h1{ + margin:0 0 20px; +} +p{ + margin:0 0 10px; +} + +#back_sidebar .items_setup .list li{ + background:url(<%= asset_path "sidebar_li2.jpg" %>) repeat left top; + border:none; + padding: 0 0 0 5px; +} +#back_sidebar .items_setup .list li a{ + line-height:31px; +} +#back_sidebar .items_setup .list li:hover{ + background:url(<%= asset_path "sidebar_li2.jpg" %>) repeat left top; + border:none; +} +#back_sidebar .items_setup ul .list { } \ No newline at end of file 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..7a658f36 100644 --- a/app/assets/stylesheets/widget.css +++ b/app/assets/stylesheets/widget.css @@ -59,32 +59,90 @@ } .select-role { display:none; - overflow:hidden; + 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/admin/object_auths_controller.rb b/app/controllers/admin/object_auths_controller.rb index 58219acf..e8779dc4 100644 --- a/app/controllers/admin/object_auths_controller.rb +++ b/app/controllers/admin/object_auths_controller.rb @@ -1,8 +1,7 @@ class Admin::ObjectAuthsController < ApplicationController include OrbitCoreLib::PermissionUnility layout "admin" - before_filter :authenticate_user! - before_filter :check_if_user_can_do_object_auth + before_filter :force_order # before_filter :is_admin? ,:only => :index @@ -84,6 +83,12 @@ class Admin::ObjectAuthsController < ApplicationController end private + + def force_order + authenticate_user! + check_if_user_can_do_object_auth + end + def check_if_user_can_do_object_auth unless check_permission(:manager) render :nothing => true, :status => 403 diff --git a/app/controllers/admin/sessions_controller.rb b/app/controllers/admin/sessions_controller.rb new file mode 100644 index 00000000..00649580 --- /dev/null +++ b/app/controllers/admin/sessions_controller.rb @@ -0,0 +1,8 @@ +class SessionsController < Devise::SessionsController + + def create + super + reset_session + end + +end \ No newline at end of file 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 d3639ebe..fe37db82 100644 --- a/app/controllers/orbit_backend_controller.rb +++ b/app/controllers/orbit_backend_controller.rb @@ -1,11 +1,12 @@ class OrbitBackendController< ApplicationController - before_filter :authenticate_user! + before_filter :force_order,:except => [:public] before_filter :setup_vars # before_filter {|c| c.front_end_available(@app_title)} - before_filter :check_user_can_use,:except => [:public] + # before_filter :check_user_can_use include OrbitCoreLib::PermissionUnility + include AdminHelper - layout 'admin' + layout 'new_admin' def setup_vars @app_title = request.fullpath.split('/')[2] @@ -14,6 +15,11 @@ class OrbitBackendController< ApplicationController private + def force_order + authenticate_user! + check_user_can_use + end + def check_user_can_use unless check_permission redirect_to polymorphic_path(['panel',@app_title,'back_end','public']) diff --git a/app/controllers/orbit_frontend_component_controller.rb b/app/controllers/orbit_frontend_component_controller.rb index 12695040..185dbce6 100644 --- a/app/controllers/orbit_frontend_component_controller.rb +++ b/app/controllers/orbit_frontend_component_controller.rb @@ -1,7 +1,7 @@ class OrbitFrontendComponentController< ApplicationController before_filter :setup_vars before_filter {|c| c.front_end_available(@app_title)} - layout 'module_widget' + layout :false def setup_vars @app_title = request.fullpath.split('/')[2] diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index aa66238d..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 @@ -30,7 +32,11 @@ class PagesController < ApplicationController end def index_from_link - redirect_to "/#{@item.full_name}" + if params[:page] + redirect_to "/#{@item.full_name}?page=#{params[:page]}" + else + redirect_to "/#{@item.full_name}" + end end def show_from_link 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/session.rb b/app/models/session.rb new file mode 100644 index 00000000..3c6deb54 --- /dev/null +++ b/app/models/session.rb @@ -0,0 +1,12 @@ +class Session + include Mongoid::Document + include Mongoid::Timestamps + + def self.sweep(time = 1.hour) + if time.is_a?(String) + time = time.split.inject { |count, unit| count.to_i.send(unit) } + end + + delete_all "updated_at < '#{time.ago.to_s(:db)}' OR created_at < '#{2.days.ago.to_s(:db)}'" + end +end \ No newline at end of file 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..34723b7e 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 rescue nil%> +

    + <%= 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 @@ + + \ No newline at end of file diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index 33e41597..f74f24f6 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -2,30 +2,50 @@ <%= link_to content_tag(:i, nil, :class => 'icons-purchase') + t('admin.purchase'), admin_purchases_path %> <% end -%> -<%= content_tag :li, :class => active_for_controllers('bulletins', 'tags', 'bulletin_categorys') do -%> +<%= content_tag :li, :class => active_for_controllers('bulletins', 'tags', 'bulletin_categorys', 'fact_checks') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %> - <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', 'tags', 'bulletin_categorys')) do -%> + <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', 'tags', 'bulletin_categorys', 'fact_checks')) do -%> <%= content_tag :li, link_to(t('admin.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %> <%= content_tag :li, link_to(t('admin.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %> <%= content_tag :li, link_to(t('admin.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %> - <%= content_tag :li, link_to(t('admin.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('tags', 'index') %> + <%= content_tag :li, link_to(t('admin.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('panel/bulletin/back_end/tags', 'index') %> + <%= content_tag :li, link_to(t('announcement.bulletin.fact_check_setting'), panel_announcement_back_end_fact_checks_setting_path), :class => active_for_action('fact_checks', 'setting') if (is_manager? rescue nil) %> <% end -%> + <% end -%> <%= content_tag :li, :class => active_for_controllers('users') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %> <% end -%> -<%= content_tag :li, :class => active_for_controllers(nil) do -%> +<%= content_tag :li, :class => active_for_controllers('page_contexts') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-page') + t('admin.page'), panel_page_content_back_end_page_contexts_path %> + <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('page_contexts')) do -%> + <%= content_tag :li, link_to(t('admin.all_articles'), panel_page_content_back_end_page_contexts_path), :class => active_for_action('page_context', 'index') %> + <% end -%> <% end -%> <%= content_tag :li, :class => active_for_controllers('designs') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-window-block') + t('admin.design'), admin_designs_path %> <% end -%> -<%= content_tag :li, :class => active_for_controllers(nil) do -%> +<%= content_tag :li, :class => active_for_controllers('ad_banners', 'ad_images') do -%> + <%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.ad_banner'), admin_ad_banners_path %> + <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('ad_banners', 'ad_images')) do -%> + <%= content_tag :li, link_to(t('admin.all_ad_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %> + <%= content_tag :li, link_to(t('admin.new_ad_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %> + <%= content_tag :li, link_to(t('admin.new_ad_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %> + <% end %> +<% end %> + +<%= content_tag :li, :class => active_for_controllers('web_links', 'tags', 'web_link_categorys') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), panel_web_resource_back_end_web_links_path %> + <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('web_links', 'tags', 'web_link_categorys')) do -%> + <%= content_tag :li, link_to(t('admin.all_articles'), panel_web_resource_back_end_web_links_path), :class => active_for_action('web_link', 'index') %> + <%= content_tag :li, link_to(t('admin.add_new'), new_panel_web_resource_back_end_web_link_path), :class => active_for_action('web_link', 'new') %> + <%= content_tag :li, link_to(t('admin.categories'), panel_web_resource_back_end_web_link_categorys_path), :class => active_for_action('web_link_categorys', 'index') %> + <%= content_tag :li, link_to(t('admin.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('panel/web_resource/back_end/tags', 'index') %> + <% end -%> <% end -%> <%= content_tag :li, :class => active_for_controllers(nil) do -%> diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index d800ab5d..4adce7a5 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -5,7 +5,7 @@ <%= @title || APP_CONFIG['orbit'] %> <%= stylesheet_link_tag "admin" %> <%= javascript_include_tag "admin" %> diff --git a/app/views/layouts/devise.html.erb b/app/views/layouts/devise.html.erb index 976b5422..d1a3512c 100644 --- a/app/views/layouts/devise.html.erb +++ b/app/views/layouts/devise.html.erb @@ -4,7 +4,7 @@ <%= @title || APP_CONFIG['orbit'] %> <%= stylesheet_link_tag "devise" %> <%= javascript_include_tag "devise" %> diff --git a/app/views/layouts/module_widget.html.erb b/app/views/layouts/module_widget.html.erb index 254ac4e9..44a2be85 100644 --- a/app/views/layouts/module_widget.html.erb +++ b/app/views/layouts/module_widget.html.erb @@ -2,7 +2,7 @@ <%#= stylesheet_link_tag "module_widget" %> <%= javascript_include_tag "module_widget" %> diff --git a/app/views/layouts/new_admin.html.erb b/app/views/layouts/new_admin.html.erb index 3ae7a2a2..b6156c5d 100644 --- a/app/views/layouts/new_admin.html.erb +++ b/app/views/layouts/new_admin.html.erb @@ -4,7 +4,7 @@ <%= @title || APP_CONFIG['orbit'] %> <%= stylesheet_link_tag "new_admin" %> <%= javascript_include_tag "new_admin" %> diff --git a/app/views/layouts/page_layout.html.erb b/app/views/layouts/page_layout.html.erb new file mode 100644 index 00000000..8fb884b0 --- /dev/null +++ b/app/views/layouts/page_layout.html.erb @@ -0,0 +1,17 @@ + + + + + <%= page_title(@item).html_safe %> + <%= page_metas(@item).html_safe %> + <%= @metas %> + + <%= page_stylesheets(@item).html_safe %> + <%= page_javascripts(@item).html_safe %> + + + <%= yield %> + + diff --git a/app/views/layouts/site_editor.html.erb b/app/views/layouts/site_editor.html.erb index f4df75c4..efcc54ca 100644 --- a/app/views/layouts/site_editor.html.erb +++ b/app/views/layouts/site_editor.html.erb @@ -5,7 +5,7 @@ <%= @title || APP_CONFIG['orbit'] %> <%= stylesheet_link_tag "site_editor" %> <%= javascript_include_tag "site_editor" %> diff --git a/config.ru b/config.ru index 20d6bd1f..6a593e4a 100644 --- a/config.ru +++ b/config.ru @@ -1,4 +1,4 @@ # This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) -run PrototypeR4::Application +run Orbit::Application diff --git a/config/application.rb b/config/application.rb index 0fc2b91d..cef8c446 100644 --- a/config/application.rb +++ b/config/application.rb @@ -13,13 +13,14 @@ require 'sprockets/railtie' # or test environments. Bundler.require *Rails.groups(:assets) if defined?(Bundler) -module PrototypeR4 +module Orbit class Application < Rails::Application # Add directories for plugins config.paths["vendor/plugins"] += %W(#{config.root}/vendor/built_in_modules) config.paths["vendor/plugins"] += %W(#{config.root}/vendor/downloaded_modules) - config.paths.app.views << "app/views/devise" + config.paths["app/views"] += %W(#{config.root}/app/views/devise) + # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers @@ -30,6 +31,7 @@ module PrototypeR4 config.autoload_paths += %W(#{config.root}/lib) config.autoload_paths += %W(#{config.root}/lib/parsers) config.autoload_paths += %W(#{config.root}/app/models/design) + config.autoload_paths += %W(#{config.root}/app/models/meta) config.autoload_paths += %W(#{config.root}/app/models/purchase) config.autoload_paths += %W(#{config.root}/app/models/user) diff --git a/config/environment.rb b/config/environment.rb index efd38a40..3538bc87 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -4,4 +4,4 @@ require 'yaml' YAML::ENGINE.yamler = 'syck' # Initialize the rails application -PrototypeR4::Application.initialize! +Orbit::Application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 7ca12a8d..afcf736e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,4 +1,4 @@ -PrototypeR4::Application.configure do +Orbit::Application.configure do # Settings specified here will take precedence over those in config/application.rb # In the development environment your application's code is reloaded on diff --git a/config/environments/production.rb b/config/environments/production.rb index f52ead13..001ff2c6 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,4 +1,4 @@ -PrototypeR4::Application.configure do +Orbit::Application.configure do # Settings specified here will take precedence over those in config/application.rb # The production environment is meant for finished, "live" apps. diff --git a/config/environments/test.rb b/config/environments/test.rb index 6d22bb12..e55cc24b 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,4 +1,4 @@ -PrototypeR4::Application.configure do +Orbit::Application.configure do # Settings specified here will take precedence over those in config/application.rb # The test environment is used exclusively to run your application's diff --git a/config/initializers/cookie_verification_secret.rb b/config/initializers/cookie_verification_secret.rb index 5a8601a7..694e666d 100644 --- a/config/initializers/cookie_verification_secret.rb +++ b/config/initializers/cookie_verification_secret.rb @@ -4,4 +4,4 @@ # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. -PrototypeR4::Application.config.secret_token = 'cbf6409102b30cb9f4da455ee08c3a7e9d8b2a3d32a0e5b59a354dad03f469d363a8127ef4b7bc3b1afa632d7cf947a1e59e09022d2d4cd8df1f4fa521d7ec07' +Orbit::Application.config.secret_token = 'cbf6409102b30cb9f4da455ee08c3a7e9d8b2a3d32a0e5b59a354dad03f469d363a8127ef4b7bc3b1afa632d7cf947a1e59e09022d2d4cd8df1f4fa521d7ec07' diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index 67abf723..ae9a444a 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -4,4 +4,4 @@ # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. -PrototypeR4::Application.config.secret_token = 'b8d78ecaf3086ebfc1ba42e912acba60d85cf3d789d933e117770e1a045a12911f121ff012a234982abb446c8b8c768052eea4bf8b2d5d336be821e2c25d8cdb' +Orbit::Application.config.secret_token = 'b8d78ecaf3086ebfc1ba42e912acba60d85cf3d789d933e117770e1a045a12911f121ff012a234982abb446c8b8c768052eea4bf8b2d5d336be821e2c25d8cdb' diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index e6387adb..b1a4a2c1 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,8 +1,3 @@ # Be sure to restart your server when you modify this file. -PrototypeR4::Application.config.session_store :cookie_store, :key => '_prototype_R4_session' - -# Use the database for sessions instead of the cookie-based default, -# which shouldn't be used to store highly confidential information -# (create the session table with "rails generate session_migration") -# PrototypeR4::Application.config.session_store :active_record_store +Orbit::Application.config.session_store :mongoid_store diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 8999162d..ce2d39c2 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -39,6 +39,14 @@ zh_tw: admin: action: 操作 ad_banner: 廣告輪播 + ad: + ab_fx: 轉場特效 + all_banners: 輪播清單 + new_banner: 新增輪播 + new_image: 新增橫幅 + title: 標題 + transition_sec: 轉場單位時間 + trans_unit_sec: 秒 add: 新增 add_item: 新增項目 add_language: 新增語言 diff --git a/config/routes.rb b/config/routes.rb index 24dd9e95..a86f6118 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,4 @@ -PrototypeR4::Application.routes.draw do +Orbit::Application.routes.draw do devise_for :users,:controllers => {:sessions => 'sessions'} @@ -24,7 +24,14 @@ PrototypeR4::Application.routes.draw do end end - resources :ad_banners + + resources :ad_banners do + collection do + match 'new_ad_image' => 'ad_images#new',:as => :new_ad_image,:via => :get + match 'new_ad_image' => 'ad_images#create',:as => :create_ad_image,:via => :post + end + resources :ad_images ,:except => [:show,:index] + end resources :dashboards resources :designs do collection do diff --git a/lib/fraisier/images/Thumbs.db b/lib/fraisier/images/Thumbs.db deleted file mode 100755 index 5275e13b..00000000 Binary files a/lib/fraisier/images/Thumbs.db and /dev/null differ diff --git a/lib/noko/layout.html b/lib/noko/layout.html new file mode 100755 index 00000000..8723d6a7 --- /dev/null +++ b/lib/noko/layout.html @@ -0,0 +1,184 @@ + + + + + + RulingSite + + + + + + + + + + +
      + + +
      +
      +
      +
      +
      +
      +
      +
      + +
      +
      +
      + +
      +
      +
      +
      +
      +
      +
      +
      + +
      + + +
      +
      + + +
      + + 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 dea65b6a..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 305596ed..dfec0dd9 100644 --- a/lib/parsers/parser_front_end.rb +++ b/lib/parsers/parser_front_end.rb @@ -1,179 +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 << "" 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/anc_tasks.rake b/lib/tasks/anc_tasks.rake index 3145d119..cd534b93 100644 --- a/lib/tasks/anc_tasks.rake +++ b/lib/tasks/anc_tasks.rake @@ -11,12 +11,12 @@ namespace :anc do bulletin_category_3.create_i18n_variable(:en => "MattCheckChrisPreview", :zh_tw => 'MattCheckChrisPreview') - bulletin_1 = Bulletin.create(:title => "C1P1",:status => nil,:subtitle => "",:text => "value",:postadate => Time.now,:deadline => nil,:bulletin_category => bulletin_category_1 ) - bulletin_2 = Bulletin.create(:title => "C1P2",:status => nil,:subtitle => "",:text => "value",:postadate => Time.now,:deadline => nil,:bulletin_category => bulletin_category_1 ) - bulletin_3 = Bulletin.create(:title => "C2P1",:status => nil,:subtitle => "",:text => "value",:postadate => Time.now,:deadline => nil,:bulletin_category => bulletin_category_2 ) - bulletin_4 = Bulletin.create(:title => "C2P2",:status => nil,:subtitle => "",:text => "value",:postadate => Time.now,:deadline => nil,:bulletin_category => bulletin_category_2 ) - bulletin_5 = Bulletin.create(:title => "C3P1",:status => nil,:subtitle => "",:text => "value",:postadate => Time.now,:deadline => nil,:bulletin_category => bulletin_category_3 ) - bulletin_6 = Bulletin.create(:title => "C3P2",:status => nil,:subtitle => "",:text => "value",:postadate => Time.now,:deadline => nil,:bulletin_category => bulletin_category_3 ) + bulletin_1 = Bulletin.create(:title => "C1P1",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_1 ) + bulletin_2 = Bulletin.create(:title => "C1P2",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_1 ) + bulletin_3 = Bulletin.create(:title => "C2P1",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_2 ) + bulletin_4 = Bulletin.create(:title => "C2P2",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_2 ) + bulletin_5 = Bulletin.create(:title => "C3P1",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_3 ) + bulletin_6 = Bulletin.create(:title => "C3P2",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_3 ) end end \ No newline at end of file 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..841dedf0 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 @@ -93,7 +93,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.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 a0cf8d96..a13e8308 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 @@ -9,20 +9,41 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # @bulletins = Bulletin.all # @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 - - module_app = ModuleApp.first(:conditions => {:key => 'announcement'}) - @tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc) + @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 @@ -31,6 +52,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # GET /bulletins/1.xml def show @bulletin = Bulletin.find(params[:id]) + get_tags # get_categorys # @bulletin_categorys = BulletinCategory.where("_id" => params[:id]) @@ -51,11 +73,14 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # GET /bulletins/new.xml def new @bulletin = Bulletin.new + + @link_url = panel_announcement_back_end_bulletins_path # @bulletin.bulletin_files.build # @bulletin.bulletin_files.new get_categorys + get_tags respond_to do |format| format.html # new.html.erb @@ -67,52 +92,168 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController def edit @bulletin = Bulletin.find(params[:id]) # @summary_variable = @bulletin.summary_variable + + @link_url = panel_announcement_back_end_bulletin_path(@bulletin) + get_categorys + get_tags end # 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_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_link = BulletinLink.new + @link_url = panel_announcement_back_end_bulletins_path + + @bulletin_link.bulletin_id = params[:bulletin_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 } - else - format.html { render :action => "new" } - format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity } - end + format.js + end + + end + + def link_quick_edit + # debugger + @bulletin_link = BulletinLink.find(params[:bulletin_id]) + + @link_url = panel_announcement_back_end_bulletin_path(@bulletin_link) + + # @bulletin = Bulletin.find(params[:bulletin_id]) + + # @link_url = panel_announcement_back_end_bulletin_path(@bulletin) + + respond_to do |format| + format.js + end + + end + + def file_quick_add + # debugger + + @bulletin_file = BulletinFile.new + @file_url = panel_announcement_back_end_bulletins_path + + @bulletin_file.bulletin_id = params[:bulletin_id] + + respond_to do |format| + format.js + end + + end + + def file_quick_edit + # debugger + @bulletin_file = BulletinFile.find(params[:bulletin_id]) + + @file_url = panel_announcement_back_end_bulletin_path(@bulletin_file) + + respond_to do |format| + format.js end end # PUT /bulletins/1 # PUT /bulletins/1.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 - 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 } + if params[:bulletin_link] + + @bulletin_link = BulletinLink.find(params[:id]) + + @link_url = panel_announcement_back_end_bulletin_path(@bulletin_link) + + respond_to do |format| + if @bulletin_link.update_attributes(params[:bulletin_link]) + # format.html { redirect_to(panel_announcement_back_end_bulletins_url) } + format.js { render 'update_bulletin_link' } + end + end + + elsif params[:bulletin_file] + + @bulletin_file = BulletinFile.find(params[:id]) + + @file_url = panel_announcement_back_end_bulletin_path(@bulletin_file) + + respond_to do |format| + if @bulletin_file.update_attributes(params[:bulletin_file]) + # format.html { redirect_to(panel_announcement_back_end_bulletins_url) } + format.js { render 'update_bulletin_file' } + end + end + + else + + @bulletin = Bulletin.find(params[:id]) + + @bulletin.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 @@ -141,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 @@ -152,12 +308,17 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController @bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new') 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_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 @@ -166,37 +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 dd471958..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 @@ -1,38 +1,75 @@ class Panel::Announcement::BackEnd::FactChecksController < OrbitBackendController before_filter :authenticate_user! include AdminHelper - layout 'admin' + # layout 'admin' - def index - @bulletin_categorys_submit_new = [] - @bulletin_categorys_check =[] - if is_admin? || is_manager? - #@bulletin_categorys_submit_new = BulletinCategory.all - @bulletin_categorys_check = BulletinCategory.all - # elsif is_sub_manager? - # @bulletin_categorys_submit_new = BulletinCategory.authed_for_user(current_user,'submit_new') - # @bulletin_categorys_check = BulletinCategory.authed_for_user(current_user,'fact_check') + def setting + @bulletin_categorys = BulletinCategory.all + if params.has_key?(:category_id) + first_category = BulletinCategory.find params[:category_id] + if params[:commit] == 'Update' + privilege_users = params[:users].collect{|key,value| User.find key } rescue [] + preload_object_auth_ary = first_category.object_auths.where(title: 'fact_check') || (first_category.object_auths.create :title=> 'fact_check') + preload_object_auth = preload_object_auth_ary.first + preload_object_auth.privilege_users = privilege_users + preload_object_auth.save! + end + else + first_category = @bulletin_categorys.first + end + 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 + format.js end end - def new + def update_setting end - - def create - + # def index + # get_categorys(params[:bulletin_category_id]) + # + # @bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all + # @bulletin_categories = BulletinCategory.all + # + # module_app = ModuleApp.first(:conditions => {:key => 'announcement'}) + # @tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc) + # + # respond_to do |format| + # format.html # index.html.erb + # format.js + # format.xml { render :xml => @bulletins } + # end + # end + # + # def new + # + # end + # + # def create + # + # end + # + # def update + # + # end + # + # def edit + # + # end + # + # def destroy + # + # end + protected + def get_categorys(id = nil) + @bulletin_categorys = [] + if(is_manager? || is_admin?) + @bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true)) + elsif is_sub_manager? + @bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new') + end end - - def update - - end - - def edit - - end - - def destroy - - end - end 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 c0be3639..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 @@ -11,19 +11,19 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController def index date_now = Time.now - if params[:bulletin_category_id] - @bulletins = Bulletin.where(:bulletin_category_id => params[:bulletin_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) + if params[:category_id] + @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 - @current_category = BulletinCategory.from_id(params[:bulletin_category_id]) rescue nil + @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil 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 cb18fa23..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,13 +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 - ƻ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 188142ea..4808b3a9 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -19,17 +19,23 @@ 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 => 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 - embeds_many :bulletin_links, :cascade_callbacks => true - embeds_many :bulletin_files, :cascade_callbacks => true + # embeds_many :bulletin_links, :cascade_callbacks => true + # embeds_many :bulletin_files, :cascade_callbacks => true - # has_many :bulletin_files, :autosave => true, :dependent => :destroy + has_many :bulletin_links, :autosave => true, :dependent => :destroy + 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 @@ -38,30 +44,22 @@ class Bulletin before_save :set_key + 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 - + 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 @@ -80,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 @@ -94,6 +107,31 @@ 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 + t.destroy + end + end + end + + def save_bulletin_files + self.bulletin_files.each do |t| + if t.should_destroy + t.destroy + end + end + end + def title @title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil 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 28062d40..c4d60b9b 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin_file.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin_file.rb @@ -5,13 +5,36 @@ class BulletinFile mount_uploader :file, AssetUploader - field :filetitle - field :description + # field :filetitle + # field :description + has_one :filetitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy + has_one :description, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy # field :to_save, :type => Boolean field :should_destroy, :type => Boolean - # belongs_to :bulletin - embedded_in :bulletin + 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 + + def set_key + if filetitle.new_record? + filetitle.key = 'filetitle' + end + if description.new_record? + description.key = 'description' + end + end end diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_link.rb b/vendor/built_in_modules/announcement/app/models/bulletin_link.rb index a999d45d..30363182 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin_link.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin_link.rb @@ -4,10 +4,12 @@ class BulletinLink include Mongoid::Timestamps field :url - field :name + # field :name + + has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy field :should_destroy, :type => Boolean - embedded_in :bulletin - + # embedded_in :bulletin + belongs_to :bulletin end 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 e834ec60..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 @@ -1,21 +1,16 @@ - - <%= bulletin_category.key %> - <% @site_valid_locales.each do |locale| %> - <%= bulletin_category.i18n_variable[locale] rescue nil %> - <% end %> - <%= bulletin_category.display %> - <% if is_manager? %> + - <%= link_to t('blog.new_auth'), init_admin_object_auths_path("BulletinCategory",bulletin_category,:token => @module_app.token) %>
      - <% bulletin_category.object_auths.each do |obj_auth| %> - <%= link_to obj_auth.title,edit_admin_object_auth_url(obj_auth,:token => @module_app.token) %>
      - <% end %> + <%= bulletin_category.key %> +
      + +
      - - <% end %> - <%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %> | - <%= link_to t('bulletin_category.quick_edit'), panel_announcement_back_end_bulletin_category_quick_edit_path(bulletin_category), :remote => true %> | - <%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %> - - \ No newline at end of file + <% @site_valid_locales.each do |locale| %> + <%= bulletin_category.i18n_variable[locale] rescue nil %> + <% end %> + <%= bulletin_category.display %> + 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 d7bfac7b..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 @@ -1,36 +1,36 @@ <% # encoding: utf-8 %> <%= form_for(@bulletin_category, :remote => true, :url => @url) do |f| %> -<%#= form_for(@bulletin_category, :remote => true, :url => panel_announcement_back_end_bulletin_category_path(@bulletin_category)) do |f| %> -
      - <%= f.label :key %>
      - <%= f.text_field :key %> -
      - -
      - <%= f.label :name %>
      - <%= f.fields_for :i18n_variable, (@bulletin_category.new_record? ? @bulletin_category.build_i18n_variable : @bulletin_category.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 %> -
      - -
      - <%= f.label :display %>
      - <%#= f.select :display, BulletinCategory::PAYMENT_TYPES, :prompt => 'Select a display method' %> +

      <%= (@bulletin_category.new_record? ? 'Add' : 'Edit') %>

      - <%= f.radio_button :display, "List" %>List - <%#= f.label :display, 'list', :value => '1', :checked => @a %> - <%= f.radio_button :display, "Picture" %>Picture - <%#= f.label :display, 'picture', :value => '2', :checked => @b %> -
      顯示方式是設定在前台頁面時,資訊所呈現的樣式 -
      +
      + <%= f.label :key %> + <%= f.text_field :key %> +
      + +
      + <%= f.fields_for :i18n_variable, (@bulletin_category.new_record? ? @bulletin_category.build_i18n_variable : @bulletin_category.i18n_variable) do |f| %> + <% @site_valid_locales.each do |locale| %> +
      + <%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %> +
      + <%= f.text_field locale, :class => 'input-xxlarge' %> +
      +
      + <% end %> + <% end %> +
      + +
      + <%#= f.label :display %> + <%#= f.radio_button :display, "List" List%> + <%#= f.radio_button :display, "Picture" Picture%> + <%#
      顯示方式是設定在前台頁面時,資訊所呈現的樣式 %> +
      -
      - <%= f.submit %> +
      + <%= 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/_form1.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_form1.html.erb deleted file mode 100644 index 1499192b..00000000 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_form1.html.erb +++ /dev/null @@ -1,35 +0,0 @@ -<% # encoding: utf-8 %> - - - -
      - <%= f.label :key %>
      - <%= f.text_field :key %> -
      - -
      - <%= f.label :name %>
      - <%= f.fields_for :i18n_variable, (@bulletin_category.new_record? ? @bulletin_category.build_i18n_variable : @bulletin_category.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 %> -
      - -
      - <%= f.label :display %>
      - <%#= f.select :display, BulletinCategory::PAYMENT_TYPES, :prompt => 'Select a display method' %> - - <%= f.radio_button :display, "List" %>List - <%#= f.label :display, 'list', :value => '1', :checked => @a %> - <%= f.radio_button :display, "Picture" %>Picture - <%#= f.label :display, 'picture', :value => '2', :checked => @b %> -
      顯示方式是設定在前台頁面時,資訊所呈現的樣式 -
      - -
      - <%= f.submit %> -
      - - \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit_qe.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit_qe.html.erb new file mode 100644 index 00000000..cb32d861 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit_qe.html.erb @@ -0,0 +1,28 @@ +<% # encoding: utf-8 %> + +
      + +
      + <%= f.label :key %> + <%= f.text_field :key %> +
      +
      + <%= f.fields_for :i18n_variable, bulletin_category.i18n_variable do |f| %> + <% @site_valid_locales.each do |locale| %> +
      + <%= label_tag "title-#{locale}", "Title-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %> +
      + <%= f.text_field locale, :class => 'input-xxlarge' %> +
      +
      + <% end %> + <% end %> +
      + +
      + <%= f.label :display %> + <%= f.radio_button :display, "List" %>List + <%= f.radio_button :display, "Picture" %>Picture +
      顯示方式是設定在前台頁面時,資訊所呈現的樣式 +
      +
      diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb index 87b30a04..0a6e7f83 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb @@ -1,38 +1,23 @@ -<% content_for :secondary do %> -<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %> -<% end -%> <%= flash_messages %> -
      -
      -
      -
      -
      + + + + + <% @site_valid_locales.each do |locale| %> + + <% end %> + + + + -

      <%= t('bulletin_category.list_announcement_class') %>

      - -
      <%= t('bulletin_category.key') %><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %><%= t('bulletin_category.display') %>
      - - - <% @site_valid_locales.each do |locale| %> - - <% end %> - - - - -<%# @bulletin_categorys.each do |post| %> <%= render :partial => 'bulletin_category', :collection => @bulletin_categorys %> -<%# end %> + +
      <%= t('bulletin_category.key') %><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %><%= t('bulletin_category.display') %><%= t('bulletin.action') %>
      -
      -
      -
      -
      - -

      Add New

      <%= render :partial => "form" %>
      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 3f6f50e1..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,39 +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_back_end_bulletin_path(bulletin) %> <%= 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 %> + <%= 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 86785ee0..00000000 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file.html.erb +++ /dev/null @@ -1,24 +0,0 @@ - -
      " class='list_item'> -
      - <%= f.label :file %> - <%#= file_field_tag 'bulletin[file]' %> - <%= f.file_field :file %> - - <%= f.label :file_title %> - <%= f.text_field :filetitle %> - - <%= f.label :file_description %> - <%= f.text_field :description %> - - - <% if bulletin_file.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_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.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html.erb deleted file mode 100644 index 44c7ab75..00000000 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html.erb +++ /dev/null @@ -1,21 +0,0 @@ - -
      " class='list_item'> -
      - - <%= f.label :link_url %> - <%= f.text_field :url %> - - <%= f.label :link_name %> - <%= f.text_field :name %> - - - <% 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_qe.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link_qe.html.erb new file mode 100644 index 00000000..c146da48 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link_qe.html.erb @@ -0,0 +1,37 @@ +<% # encoding: utf-8 %> + +<%= form_for(@bulletin_link, :remote => true, :url => @link_url) do |f| %> + + +