diff --git a/app/assets/images/no-image.jpg b/app/assets/images/no-image.jpg new file mode 100644 index 0000000..a47918f Binary files /dev/null and b/app/assets/images/no-image.jpg differ diff --git a/app/assets/javascripts/group.js b/app/assets/javascripts/group.js new file mode 100644 index 0000000..8cb3f76 --- /dev/null +++ b/app/assets/javascripts/group.js @@ -0,0 +1,53 @@ +(function() { + "use strict"; + + // Commonly use variables + var doc = document; + + var group = { + // Detect and change the top position of the cycle navs + cycleFix: function() { + if( doc.querySelectorAll( ".group-post-banner-image").length >= 1 ) { + var imgs = doc.querySelectorAll( ".group-post-banner-image" ), + cycleNav = doc.querySelectorAll( ".cycle-nav" ), + len = cycleNav.length, + i = -1; + + // Hide the navs when there's noly one slide + if( imgs.length <= 1 ) { + for( i = 0; i < len; i++ ) { + cycleNav[ i ].classList.add( "hide" ); + } + } + + } else if ( doc.querySelectorAll( ".group-post-banner-image").length === 0 && doc.querySelector( ".group-post-image-wrap" ) ) { + doc.querySelector( ".group-post-image-wrap").classList.add( "hide" ); + } + }, + // Create scroll effect (with css) + scrollEffect: function() { + if( doc.querySelector( ".group-page") ) { + var page = doc.querySelector( ".group-page" ), + wrap = doc.querySelector( ".group-page-banner-image-wrap" ), + scrollClass = "scroll"; + + // Use pageYOffset to get the Y positoin and add scroll on it, the animation + // is done by css transition + window.addEventListener( "scroll", function() { + if( window.pageYOffset !== 0 ) { + page.classList.add( scrollClass ); + } else { + page.classList.remove( scrollClass ); + } + }, false); + } + } + } + + // When DOM is completely loaded, execute these functions + document.addEventListener( "DOMContentLoaded", function( event ) { + group.cycleFix(); + group.scrollEffect(); + }); + +})(); diff --git a/app/assets/javascripts/lib/dropzone.css b/app/assets/javascripts/lib/dropzone.css new file mode 100644 index 0000000..0494d1c --- /dev/null +++ b/app/assets/javascripts/lib/dropzone.css @@ -0,0 +1,388 @@ +/* + * The MIT License + * Copyright (c) 2012 Matias Meno + */ +@-webkit-keyframes passing-through { + 0% { + opacity: 0; + -webkit-transform: translateY(40px); + -moz-transform: translateY(40px); + -ms-transform: translateY(40px); + -o-transform: translateY(40px); + transform: translateY(40px); } + 30%, 70% { + opacity: 1; + -webkit-transform: translateY(0px); + -moz-transform: translateY(0px); + -ms-transform: translateY(0px); + -o-transform: translateY(0px); + transform: translateY(0px); } + 100% { + opacity: 0; + -webkit-transform: translateY(-40px); + -moz-transform: translateY(-40px); + -ms-transform: translateY(-40px); + -o-transform: translateY(-40px); + transform: translateY(-40px); } } +@-moz-keyframes passing-through { + 0% { + opacity: 0; + -webkit-transform: translateY(40px); + -moz-transform: translateY(40px); + -ms-transform: translateY(40px); + -o-transform: translateY(40px); + transform: translateY(40px); } + 30%, 70% { + opacity: 1; + -webkit-transform: translateY(0px); + -moz-transform: translateY(0px); + -ms-transform: translateY(0px); + -o-transform: translateY(0px); + transform: translateY(0px); } + 100% { + opacity: 0; + -webkit-transform: translateY(-40px); + -moz-transform: translateY(-40px); + -ms-transform: translateY(-40px); + -o-transform: translateY(-40px); + transform: translateY(-40px); } } +@keyframes passing-through { + 0% { + opacity: 0; + -webkit-transform: translateY(40px); + -moz-transform: translateY(40px); + -ms-transform: translateY(40px); + -o-transform: translateY(40px); + transform: translateY(40px); } + 30%, 70% { + opacity: 1; + -webkit-transform: translateY(0px); + -moz-transform: translateY(0px); + -ms-transform: translateY(0px); + -o-transform: translateY(0px); + transform: translateY(0px); } + 100% { + opacity: 0; + -webkit-transform: translateY(-40px); + -moz-transform: translateY(-40px); + -ms-transform: translateY(-40px); + -o-transform: translateY(-40px); + transform: translateY(-40px); } } +@-webkit-keyframes slide-in { + 0% { + opacity: 0; + -webkit-transform: translateY(40px); + -moz-transform: translateY(40px); + -ms-transform: translateY(40px); + -o-transform: translateY(40px); + transform: translateY(40px); } + 30% { + opacity: 1; + -webkit-transform: translateY(0px); + -moz-transform: translateY(0px); + -ms-transform: translateY(0px); + -o-transform: translateY(0px); + transform: translateY(0px); } } +@-moz-keyframes slide-in { + 0% { + opacity: 0; + -webkit-transform: translateY(40px); + -moz-transform: translateY(40px); + -ms-transform: translateY(40px); + -o-transform: translateY(40px); + transform: translateY(40px); } + 30% { + opacity: 1; + -webkit-transform: translateY(0px); + -moz-transform: translateY(0px); + -ms-transform: translateY(0px); + -o-transform: translateY(0px); + transform: translateY(0px); } } +@keyframes slide-in { + 0% { + opacity: 0; + -webkit-transform: translateY(40px); + -moz-transform: translateY(40px); + -ms-transform: translateY(40px); + -o-transform: translateY(40px); + transform: translateY(40px); } + 30% { + opacity: 1; + -webkit-transform: translateY(0px); + -moz-transform: translateY(0px); + -ms-transform: translateY(0px); + -o-transform: translateY(0px); + transform: translateY(0px); } } +@-webkit-keyframes pulse { + 0% { + -webkit-transform: scale(1); + -moz-transform: scale(1); + -ms-transform: scale(1); + -o-transform: scale(1); + transform: scale(1); } + 10% { + -webkit-transform: scale(1.1); + -moz-transform: scale(1.1); + -ms-transform: scale(1.1); + -o-transform: scale(1.1); + transform: scale(1.1); } + 20% { + -webkit-transform: scale(1); + -moz-transform: scale(1); + -ms-transform: scale(1); + -o-transform: scale(1); + transform: scale(1); } } +@-moz-keyframes pulse { + 0% { + -webkit-transform: scale(1); + -moz-transform: scale(1); + -ms-transform: scale(1); + -o-transform: scale(1); + transform: scale(1); } + 10% { + -webkit-transform: scale(1.1); + -moz-transform: scale(1.1); + -ms-transform: scale(1.1); + -o-transform: scale(1.1); + transform: scale(1.1); } + 20% { + -webkit-transform: scale(1); + -moz-transform: scale(1); + -ms-transform: scale(1); + -o-transform: scale(1); + transform: scale(1); } } +@keyframes pulse { + 0% { + -webkit-transform: scale(1); + -moz-transform: scale(1); + -ms-transform: scale(1); + -o-transform: scale(1); + transform: scale(1); } + 10% { + -webkit-transform: scale(1.1); + -moz-transform: scale(1.1); + -ms-transform: scale(1.1); + -o-transform: scale(1.1); + transform: scale(1.1); } + 20% { + -webkit-transform: scale(1); + -moz-transform: scale(1); + -ms-transform: scale(1); + -o-transform: scale(1); + transform: scale(1); } } +.dropzone, .dropzone * { + box-sizing: border-box; } + +.dropzone { + min-height: 150px; + border: 2px solid rgba(0, 0, 0, 0.3); + background: white; + padding: 20px 20px; } + .dropzone.dz-clickable { + cursor: pointer; } + .dropzone.dz-clickable * { + cursor: default; } + .dropzone.dz-clickable .dz-message, .dropzone.dz-clickable .dz-message * { + cursor: pointer; } + .dropzone.dz-started .dz-message { + display: none; } + .dropzone.dz-drag-hover { + border-style: solid; } + .dropzone.dz-drag-hover .dz-message { + opacity: 0.5; } + .dropzone .dz-message { + text-align: center; + margin: 2em 0; } + .dropzone .dz-preview { + position: relative; + display: inline-block; + vertical-align: top; + margin: 16px; + min-height: 100px; } + .dropzone .dz-preview:hover { + z-index: 1000; } + .dropzone .dz-preview:hover .dz-details { + opacity: 1; } + .dropzone .dz-preview.dz-file-preview .dz-image { + border-radius: 20px; + background: #999; + background: linear-gradient(to bottom, #eee, #ddd); } + .dropzone .dz-preview.dz-file-preview .dz-details { + opacity: 1; } + .dropzone .dz-preview.dz-image-preview { + background: white; } + .dropzone .dz-preview.dz-image-preview .dz-details { + -webkit-transition: opacity 0.2s linear; + -moz-transition: opacity 0.2s linear; + -ms-transition: opacity 0.2s linear; + -o-transition: opacity 0.2s linear; + transition: opacity 0.2s linear; } + .dropzone .dz-preview .dz-remove { + font-size: 14px; + text-align: center; + display: block; + cursor: pointer; + border: none; } + .dropzone .dz-preview .dz-remove:hover { + text-decoration: underline; } + .dropzone .dz-preview:hover .dz-details { + opacity: 1; } + .dropzone .dz-preview .dz-details { + z-index: 20; + position: absolute; + top: 0; + left: 0; + opacity: 0; + font-size: 13px; + min-width: 100%; + max-width: 100%; + padding: 2em 1em; + text-align: center; + color: rgba(0, 0, 0, 0.9); + line-height: 150%; } + .dropzone .dz-preview .dz-details .dz-size { + margin-bottom: 1em; + font-size: 16px; } + .dropzone .dz-preview .dz-details .dz-filename { + white-space: nowrap; } + .dropzone .dz-preview .dz-details .dz-filename:hover span { + border: 1px solid rgba(200, 200, 200, 0.8); + background-color: rgba(255, 255, 255, 0.8); } + .dropzone .dz-preview .dz-details .dz-filename:not(:hover) { + overflow: hidden; + text-overflow: ellipsis; } + .dropzone .dz-preview .dz-details .dz-filename:not(:hover) span { + border: 1px solid transparent; } + .dropzone .dz-preview .dz-details .dz-filename span, .dropzone .dz-preview .dz-details .dz-size span { + background-color: rgba(255, 255, 255, 0.4); + padding: 0 0.4em; + border-radius: 3px; } + .dropzone .dz-preview:hover .dz-image img { + -webkit-transform: scale(1.05, 1.05); + -moz-transform: scale(1.05, 1.05); + -ms-transform: scale(1.05, 1.05); + -o-transform: scale(1.05, 1.05); + transform: scale(1.05, 1.05); + -webkit-filter: blur(8px); + filter: blur(8px); } + .dropzone .dz-preview .dz-image { + border-radius: 20px; + overflow: hidden; + width: 120px; + height: 120px; + position: relative; + display: block; + z-index: 10; } + .dropzone .dz-preview .dz-image img { + display: block; } + .dropzone .dz-preview.dz-success .dz-success-mark { + -webkit-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); + -moz-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); + -ms-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); + -o-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); + animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); } + .dropzone .dz-preview.dz-error .dz-error-mark { + opacity: 1; + -webkit-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); + -moz-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); + -ms-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); + -o-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); + animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); } + .dropzone .dz-preview .dz-success-mark, .dropzone .dz-preview .dz-error-mark { + pointer-events: none; + opacity: 0; + z-index: 500; + position: absolute; + display: block; + top: 50%; + left: 50%; + margin-left: -27px; + margin-top: -27px; } + .dropzone .dz-preview .dz-success-mark svg, .dropzone .dz-preview .dz-error-mark svg { + display: block; + width: 54px; + height: 54px; } + .dropzone .dz-preview.dz-processing .dz-progress { + opacity: 1; + -webkit-transition: all 0.2s linear; + -moz-transition: all 0.2s linear; + -ms-transition: all 0.2s linear; + -o-transition: all 0.2s linear; + transition: all 0.2s linear; } + .dropzone .dz-preview.dz-complete .dz-progress { + opacity: 0; + -webkit-transition: opacity 0.4s ease-in; + -moz-transition: opacity 0.4s ease-in; + -ms-transition: opacity 0.4s ease-in; + -o-transition: opacity 0.4s ease-in; + transition: opacity 0.4s ease-in; } + .dropzone .dz-preview:not(.dz-processing) .dz-progress { + -webkit-animation: pulse 6s ease infinite; + -moz-animation: pulse 6s ease infinite; + -ms-animation: pulse 6s ease infinite; + -o-animation: pulse 6s ease infinite; + animation: pulse 6s ease infinite; } + .dropzone .dz-preview .dz-progress { + opacity: 1; + z-index: 1000; + pointer-events: none; + position: absolute; + height: 16px; + left: 50%; + top: 50%; + margin-top: -8px; + width: 80px; + margin-left: -40px; + background: rgba(255, 255, 255, 0.9); + -webkit-transform: scale(1); + border-radius: 8px; + overflow: hidden; } + .dropzone .dz-preview .dz-progress .dz-upload { + background: #333; + background: linear-gradient(to bottom, #666, #444); + position: absolute; + top: 0; + left: 0; + bottom: 0; + width: 0; + -webkit-transition: width 300ms ease-in-out; + -moz-transition: width 300ms ease-in-out; + -ms-transition: width 300ms ease-in-out; + -o-transition: width 300ms ease-in-out; + transition: width 300ms ease-in-out; } + .dropzone .dz-preview.dz-error .dz-error-message { + display: block; } + .dropzone .dz-preview.dz-error:hover .dz-error-message { + opacity: 1; + pointer-events: auto; } + .dropzone .dz-preview .dz-error-message { + pointer-events: none; + z-index: 1000; + position: absolute; + display: block; + display: none; + opacity: 0; + -webkit-transition: opacity 0.3s ease; + -moz-transition: opacity 0.3s ease; + -ms-transition: opacity 0.3s ease; + -o-transition: opacity 0.3s ease; + transition: opacity 0.3s ease; + border-radius: 8px; + font-size: 13px; + top: 130px; + left: -10px; + width: 140px; + background: #be2626; + background: linear-gradient(to bottom, #be2626, #a92222); + padding: 0.5em 1.2em; + color: white; } + .dropzone .dz-preview .dz-error-message:after { + content: ''; + position: absolute; + top: -6px; + left: 64px; + width: 0; + height: 0; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #be2626; } diff --git a/app/assets/javascripts/lib/dropzone.js b/app/assets/javascripts/lib/dropzone.js new file mode 100644 index 0000000..babbdd4 --- /dev/null +++ b/app/assets/javascripts/lib/dropzone.js @@ -0,0 +1,1728 @@ + +/* + * + * More info at [www.dropzonejs.com](http://www.dropzonejs.com) + * + * Copyright (c) 2012, Matias Meno + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +(function() { + var Dropzone, Emitter, camelize, contentLoaded, detectVerticalSquash, drawImageIOSFix, noop, without, + __slice = [].slice, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + noop = function() {}; + + Emitter = (function() { + function Emitter() {} + + Emitter.prototype.addEventListener = Emitter.prototype.on; + + Emitter.prototype.on = function(event, fn) { + this._callbacks = this._callbacks || {}; + if (!this._callbacks[event]) { + this._callbacks[event] = []; + } + this._callbacks[event].push(fn); + return this; + }; + + Emitter.prototype.emit = function() { + var args, callback, callbacks, event, _i, _len; + event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + this._callbacks = this._callbacks || {}; + callbacks = this._callbacks[event]; + if (callbacks) { + for (_i = 0, _len = callbacks.length; _i < _len; _i++) { + callback = callbacks[_i]; + callback.apply(this, args); + } + } + return this; + }; + + Emitter.prototype.removeListener = Emitter.prototype.off; + + Emitter.prototype.removeAllListeners = Emitter.prototype.off; + + Emitter.prototype.removeEventListener = Emitter.prototype.off; + + Emitter.prototype.off = function(event, fn) { + var callback, callbacks, i, _i, _len; + if (!this._callbacks || arguments.length === 0) { + this._callbacks = {}; + return this; + } + callbacks = this._callbacks[event]; + if (!callbacks) { + return this; + } + if (arguments.length === 1) { + delete this._callbacks[event]; + return this; + } + for (i = _i = 0, _len = callbacks.length; _i < _len; i = ++_i) { + callback = callbacks[i]; + if (callback === fn) { + callbacks.splice(i, 1); + break; + } + } + return this; + }; + + return Emitter; + + })(); + + Dropzone = (function(_super) { + var extend, resolveOption; + + __extends(Dropzone, _super); + + Dropzone.prototype.Emitter = Emitter; + + + /* + This is a list of all available events you can register on a dropzone object. + + You can register an event handler like this: + + dropzone.on("dragEnter", function() { }); + */ + + Dropzone.prototype.events = ["drop", "dragstart", "dragend", "dragenter", "dragover", "dragleave", "addedfile", "removedfile", "thumbnail", "error", "errormultiple", "processing", "processingmultiple", "uploadprogress", "totaluploadprogress", "sending", "sendingmultiple", "success", "successmultiple", "canceled", "canceledmultiple", "complete", "completemultiple", "reset", "maxfilesexceeded", "maxfilesreached", "queuecomplete"]; + + Dropzone.prototype.defaultOptions = { + url: null, + method: "post", + withCredentials: false, + parallelUploads: 2, + uploadMultiple: false, + maxFilesize: 256, + paramName: "file", + createImageThumbnails: true, + maxThumbnailFilesize: 10, + thumbnailWidth: 120, + thumbnailHeight: 120, + filesizeBase: 1000, + maxFiles: null, + filesizeBase: 1000, + params: {}, + clickable: true, + ignoreHiddenFiles: true, + acceptedFiles: null, + acceptedMimeTypes: null, + autoProcessQueue: true, + autoQueue: true, + addRemoveLinks: false, + previewsContainer: null, + capture: null, + dictDefaultMessage: "Drop files here to upload", + dictFallbackMessage: "Your browser does not support drag'n'drop file uploads.", + dictFallbackText: "Please use the fallback form below to upload your files like in the olden days.", + dictFileTooBig: "File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.", + dictInvalidFileType: "You can't upload files of this type.", + dictResponseError: "Server responded with {{statusCode}} code.", + dictCancelUpload: "Cancel upload", + dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?", + dictRemoveFile: "Remove file", + dictRemoveFileConfirmation: null, + dictMaxFilesExceeded: "You can not upload any more files.", + accept: function(file, done) { + return done(); + }, + init: function() { + return noop; + }, + forceFallback: false, + fallback: function() { + var child, messageElement, span, _i, _len, _ref; + this.element.className = "" + this.element.className + " dz-browser-not-supported"; + _ref = this.element.getElementsByTagName("div"); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + child = _ref[_i]; + if (/(^| )dz-message($| )/.test(child.className)) { + messageElement = child; + child.className = "dz-message"; + continue; + } + } + if (!messageElement) { + messageElement = Dropzone.createElement("
"); + this.element.appendChild(messageElement); + } + span = messageElement.getElementsByTagName("span")[0]; + if (span) { + span.textContent = this.options.dictFallbackMessage; + } + return this.element.appendChild(this.getFallbackForm()); + }, + resize: function(file) { + var info, srcRatio, trgRatio; + info = { + srcX: 0, + srcY: 0, + srcWidth: file.width, + srcHeight: file.height + }; + srcRatio = file.width / file.height; + info.optWidth = this.options.thumbnailWidth; + info.optHeight = this.options.thumbnailHeight; + if ((info.optWidth == null) && (info.optHeight == null)) { + info.optWidth = info.srcWidth; + info.optHeight = info.srcHeight; + } else if (info.optWidth == null) { + info.optWidth = srcRatio * info.optHeight; + } else if (info.optHeight == null) { + info.optHeight = (1 / srcRatio) * info.optWidth; + } + trgRatio = info.optWidth / info.optHeight; + if (file.height < info.optHeight || file.width < info.optWidth) { + info.trgHeight = info.srcHeight; + info.trgWidth = info.srcWidth; + } else { + if (srcRatio > trgRatio) { + info.srcHeight = file.height; + info.srcWidth = info.srcHeight * trgRatio; + } else { + info.srcWidth = file.width; + info.srcHeight = info.srcWidth / trgRatio; + } + } + info.srcX = (file.width - info.srcWidth) / 2; + info.srcY = (file.height - info.srcHeight) / 2; + return info; + }, + + /* + Those functions register themselves to the events on init and handle all + the user interface specific stuff. Overwriting them won't break the upload + but can break the way it's displayed. + You can overwrite them if you don't like the default behavior. If you just + want to add an additional event handler, register it on the dropzone object + and don't overwrite those options. + */ + drop: function(e) { + return this.element.classList.remove("dz-drag-hover"); + }, + dragstart: noop, + dragend: function(e) { + return this.element.classList.remove("dz-drag-hover"); + }, + dragenter: function(e) { + return this.element.classList.add("dz-drag-hover"); + }, + dragover: function(e) { + return this.element.classList.add("dz-drag-hover"); + }, + dragleave: function(e) { + return this.element.classList.remove("dz-drag-hover"); + }, + paste: noop, + reset: function() { + return this.element.classList.remove("dz-started"); + }, + addedfile: function(file) { + var node, removeFileEvent, removeLink, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _results; + if (this.element === this.previewsContainer) { + this.element.classList.add("dz-started"); + } + if (this.previewsContainer) { + file.previewElement = Dropzone.createElement(this.options.previewTemplate.trim()); + file.previewTemplate = file.previewElement; + this.previewsContainer.appendChild(file.previewElement); + _ref = file.previewElement.querySelectorAll("[data-dz-name]"); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + node = _ref[_i]; + node.textContent = file.name; + } + _ref1 = file.previewElement.querySelectorAll("[data-dz-size]"); + for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { + node = _ref1[_j]; + node.innerHTML = this.filesize(file.size); + } + if (this.options.addRemoveLinks) { + file._removeLink = Dropzone.createElement("" + this.options.dictRemoveFile + ""); + file.previewElement.appendChild(file._removeLink); + } + removeFileEvent = (function(_this) { + return function(e) { + e.preventDefault(); + e.stopPropagation(); + if (file.status === Dropzone.UPLOADING) { + return Dropzone.confirm(_this.options.dictCancelUploadConfirmation, function() { + return _this.removeFile(file); + }); + } else { + if (_this.options.dictRemoveFileConfirmation) { + return Dropzone.confirm(_this.options.dictRemoveFileConfirmation, function() { + return _this.removeFile(file); + }); + } else { + return _this.removeFile(file); + } + } + }; + })(this); + _ref2 = file.previewElement.querySelectorAll("[data-dz-remove]"); + _results = []; + for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { + removeLink = _ref2[_k]; + _results.push(removeLink.addEventListener("click", removeFileEvent)); + } + return _results; + } + }, + removedfile: function(file) { + var _ref; + if (file.previewElement) { + if ((_ref = file.previewElement) != null) { + _ref.parentNode.removeChild(file.previewElement); + } + } + return this._updateMaxFilesReachedClass(); + }, + thumbnail: function(file, dataUrl) { + var thumbnailElement, _i, _len, _ref; + if (file.previewElement) { + file.previewElement.classList.remove("dz-file-preview"); + _ref = file.previewElement.querySelectorAll("[data-dz-thumbnail]"); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + thumbnailElement = _ref[_i]; + thumbnailElement.alt = file.name; + thumbnailElement.src = dataUrl; + } + return setTimeout(((function(_this) { + return function() { + return file.previewElement.classList.add("dz-image-preview"); + }; + })(this)), 1); + } + }, + error: function(file, message) { + var node, _i, _len, _ref, _results; + if (file.previewElement) { + file.previewElement.classList.add("dz-error"); + if (typeof message !== "String" && message.error) { + message = message.error; + } + _ref = file.previewElement.querySelectorAll("[data-dz-errormessage]"); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + node = _ref[_i]; + _results.push(node.textContent = message); + } + return _results; + } + }, + errormultiple: noop, + processing: function(file) { + if (file.previewElement) { + file.previewElement.classList.add("dz-processing"); + if (file._removeLink) { + return file._removeLink.textContent = this.options.dictCancelUpload; + } + } + }, + processingmultiple: noop, + uploadprogress: function(file, progress, bytesSent) { + var node, _i, _len, _ref, _results; + if (file.previewElement) { + _ref = file.previewElement.querySelectorAll("[data-dz-uploadprogress]"); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + node = _ref[_i]; + if (node.nodeName === 'PROGRESS') { + _results.push(node.value = progress); + } else { + _results.push(node.style.width = "" + progress + "%"); + } + } + return _results; + } + }, + totaluploadprogress: noop, + sending: noop, + sendingmultiple: noop, + success: function(file) { + if (file.previewElement) { + return file.previewElement.classList.add("dz-success"); + } + }, + successmultiple: noop, + canceled: function(file) { + return this.emit("error", file, "Upload canceled."); + }, + canceledmultiple: noop, + complete: function(file) { + if (file._removeLink) { + file._removeLink.textContent = this.options.dictRemoveFile; + } + if (file.previewElement) { + return file.previewElement.classList.add("dz-complete"); + } + }, + completemultiple: noop, + maxfilesexceeded: noop, + maxfilesreached: noop, + queuecomplete: noop, + previewTemplate: "
\n
\n
\n
\n
\n
\n
\n
\n
\n \n Check\n \n \n \n \n \n
\n
\n \n Error\n \n \n \n \n \n \n \n
\n
" + }; + + extend = function() { + var key, object, objects, target, val, _i, _len; + target = arguments[0], objects = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + for (_i = 0, _len = objects.length; _i < _len; _i++) { + object = objects[_i]; + for (key in object) { + val = object[key]; + target[key] = val; + } + } + return target; + }; + + function Dropzone(element, options) { + var elementOptions, fallback, _ref; + this.element = element; + this.version = Dropzone.version; + this.defaultOptions.previewTemplate = this.defaultOptions.previewTemplate.replace(/\n*/g, ""); + this.clickableElements = []; + this.listeners = []; + this.files = []; + if (typeof this.element === "string") { + this.element = document.querySelector(this.element); + } + if (!(this.element && (this.element.nodeType != null))) { + throw new Error("Invalid dropzone element."); + } + if (this.element.dropzone) { + throw new Error("Dropzone already attached."); + } + Dropzone.instances.push(this); + this.element.dropzone = this; + elementOptions = (_ref = Dropzone.optionsForElement(this.element)) != null ? _ref : {}; + this.options = extend({}, this.defaultOptions, elementOptions, options != null ? options : {}); + if (this.options.forceFallback || !Dropzone.isBrowserSupported()) { + return this.options.fallback.call(this); + } + if (this.options.url == null) { + this.options.url = this.element.getAttribute("action"); + } + if (!this.options.url) { + throw new Error("No URL provided."); + } + if (this.options.acceptedFiles && this.options.acceptedMimeTypes) { + throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated."); + } + if (this.options.acceptedMimeTypes) { + this.options.acceptedFiles = this.options.acceptedMimeTypes; + delete this.options.acceptedMimeTypes; + } + this.options.method = this.options.method.toUpperCase(); + if ((fallback = this.getExistingFallback()) && fallback.parentNode) { + fallback.parentNode.removeChild(fallback); + } + if (this.options.previewsContainer !== false) { + if (this.options.previewsContainer) { + this.previewsContainer = Dropzone.getElement(this.options.previewsContainer, "previewsContainer"); + } else { + this.previewsContainer = this.element; + } + } + if (this.options.clickable) { + if (this.options.clickable === true) { + this.clickableElements = [this.element]; + } else { + this.clickableElements = Dropzone.getElements(this.options.clickable, "clickable"); + } + } + this.init(); + } + + Dropzone.prototype.getAcceptedFiles = function() { + var file, _i, _len, _ref, _results; + _ref = this.files; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + file = _ref[_i]; + if (file.accepted) { + _results.push(file); + } + } + return _results; + }; + + Dropzone.prototype.getRejectedFiles = function() { + var file, _i, _len, _ref, _results; + _ref = this.files; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + file = _ref[_i]; + if (!file.accepted) { + _results.push(file); + } + } + return _results; + }; + + Dropzone.prototype.getFilesWithStatus = function(status) { + var file, _i, _len, _ref, _results; + _ref = this.files; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + file = _ref[_i]; + if (file.status === status) { + _results.push(file); + } + } + return _results; + }; + + Dropzone.prototype.getQueuedFiles = function() { + return this.getFilesWithStatus(Dropzone.QUEUED); + }; + + Dropzone.prototype.getUploadingFiles = function() { + return this.getFilesWithStatus(Dropzone.UPLOADING); + }; + + Dropzone.prototype.getActiveFiles = function() { + var file, _i, _len, _ref, _results; + _ref = this.files; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + file = _ref[_i]; + if (file.status === Dropzone.UPLOADING || file.status === Dropzone.QUEUED) { + _results.push(file); + } + } + return _results; + }; + + Dropzone.prototype.init = function() { + var eventName, noPropagation, setupHiddenFileInput, _i, _len, _ref, _ref1; + if (this.element.tagName === "form") { + this.element.setAttribute("enctype", "multipart/form-data"); + } + if (this.element.classList.contains("dropzone") && !this.element.querySelector(".dz-message")) { + this.element.appendChild(Dropzone.createElement("
" + this.options.dictDefaultMessage + "
")); + } + if (this.clickableElements.length) { + setupHiddenFileInput = (function(_this) { + return function() { + if (_this.hiddenFileInput) { + document.body.removeChild(_this.hiddenFileInput); + } + _this.hiddenFileInput = document.createElement("input"); + _this.hiddenFileInput.setAttribute("type", "file"); + if ((_this.options.maxFiles == null) || _this.options.maxFiles > 1) { + _this.hiddenFileInput.setAttribute("multiple", "multiple"); + } + _this.hiddenFileInput.className = "dz-hidden-input"; + if (_this.options.acceptedFiles != null) { + _this.hiddenFileInput.setAttribute("accept", _this.options.acceptedFiles); + } + if (_this.options.capture != null) { + _this.hiddenFileInput.setAttribute("capture", _this.options.capture); + } + _this.hiddenFileInput.style.visibility = "hidden"; + _this.hiddenFileInput.style.position = "absolute"; + _this.hiddenFileInput.style.top = "0"; + _this.hiddenFileInput.style.left = "0"; + _this.hiddenFileInput.style.height = "0"; + _this.hiddenFileInput.style.width = "0"; + document.body.appendChild(_this.hiddenFileInput); + return _this.hiddenFileInput.addEventListener("change", function() { + var file, files, _i, _len; + files = _this.hiddenFileInput.files; + if (files.length) { + for (_i = 0, _len = files.length; _i < _len; _i++) { + file = files[_i]; + _this.addFile(file); + } + } + return setupHiddenFileInput(); + }); + }; + })(this); + setupHiddenFileInput(); + } + this.URL = (_ref = window.URL) != null ? _ref : window.webkitURL; + _ref1 = this.events; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + eventName = _ref1[_i]; + this.on(eventName, this.options[eventName]); + } + this.on("uploadprogress", (function(_this) { + return function() { + return _this.updateTotalUploadProgress(); + }; + })(this)); + this.on("removedfile", (function(_this) { + return function() { + return _this.updateTotalUploadProgress(); + }; + })(this)); + this.on("canceled", (function(_this) { + return function(file) { + return _this.emit("complete", file); + }; + })(this)); + this.on("complete", (function(_this) { + return function(file) { + if (_this.getUploadingFiles().length === 0 && _this.getQueuedFiles().length === 0) { + return setTimeout((function() { + return _this.emit("queuecomplete"); + }), 0); + } + }; + })(this)); + noPropagation = function(e) { + e.stopPropagation(); + if (e.preventDefault) { + return e.preventDefault(); + } else { + return e.returnValue = false; + } + }; + this.listeners = [ + { + element: this.element, + events: { + "dragstart": (function(_this) { + return function(e) { + return _this.emit("dragstart", e); + }; + })(this), + "dragenter": (function(_this) { + return function(e) { + noPropagation(e); + return _this.emit("dragenter", e); + }; + })(this), + "dragover": (function(_this) { + return function(e) { + var efct; + try { + efct = e.dataTransfer.effectAllowed; + } catch (_error) {} + e.dataTransfer.dropEffect = 'move' === efct || 'linkMove' === efct ? 'move' : 'copy'; + noPropagation(e); + return _this.emit("dragover", e); + }; + })(this), + "dragleave": (function(_this) { + return function(e) { + return _this.emit("dragleave", e); + }; + })(this), + "drop": (function(_this) { + return function(e) { + noPropagation(e); + return _this.drop(e); + }; + })(this), + "dragend": (function(_this) { + return function(e) { + return _this.emit("dragend", e); + }; + })(this) + } + } + ]; + this.clickableElements.forEach((function(_this) { + return function(clickableElement) { + return _this.listeners.push({ + element: clickableElement, + events: { + "click": function(evt) { + if ((clickableElement !== _this.element) || (evt.target === _this.element || Dropzone.elementInside(evt.target, _this.element.querySelector(".dz-message")))) { + return _this.hiddenFileInput.click(); + } + } + } + }); + }; + })(this)); + this.enable(); + return this.options.init.call(this); + }; + + Dropzone.prototype.destroy = function() { + var _ref; + this.disable(); + this.removeAllFiles(true); + if ((_ref = this.hiddenFileInput) != null ? _ref.parentNode : void 0) { + this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput); + this.hiddenFileInput = null; + } + delete this.element.dropzone; + return Dropzone.instances.splice(Dropzone.instances.indexOf(this), 1); + }; + + Dropzone.prototype.updateTotalUploadProgress = function() { + var activeFiles, file, totalBytes, totalBytesSent, totalUploadProgress, _i, _len, _ref; + totalBytesSent = 0; + totalBytes = 0; + activeFiles = this.getActiveFiles(); + if (activeFiles.length) { + _ref = this.getActiveFiles(); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + file = _ref[_i]; + totalBytesSent += file.upload.bytesSent; + totalBytes += file.upload.total; + } + totalUploadProgress = 100 * totalBytesSent / totalBytes; + } else { + totalUploadProgress = 100; + } + return this.emit("totaluploadprogress", totalUploadProgress, totalBytes, totalBytesSent); + }; + + Dropzone.prototype._getParamName = function(n) { + if (typeof this.options.paramName === "function") { + return this.options.paramName(n); + } else { + return "" + this.options.paramName + (this.options.uploadMultiple ? "[" + n + "]" : ""); + } + }; + + Dropzone.prototype.getFallbackForm = function() { + var existingFallback, fields, fieldsString, form; + if (existingFallback = this.getExistingFallback()) { + return existingFallback; + } + fieldsString = "
"; + if (this.options.dictFallbackText) { + fieldsString += "

" + this.options.dictFallbackText + "

"; + } + fieldsString += "
"; + fields = Dropzone.createElement(fieldsString); + if (this.element.tagName !== "FORM") { + form = Dropzone.createElement("
"); + form.appendChild(fields); + } else { + this.element.setAttribute("enctype", "multipart/form-data"); + this.element.setAttribute("method", this.options.method); + } + return form != null ? form : fields; + }; + + Dropzone.prototype.getExistingFallback = function() { + var fallback, getFallback, tagName, _i, _len, _ref; + getFallback = function(elements) { + var el, _i, _len; + for (_i = 0, _len = elements.length; _i < _len; _i++) { + el = elements[_i]; + if (/(^| )fallback($| )/.test(el.className)) { + return el; + } + } + }; + _ref = ["div", "form"]; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + tagName = _ref[_i]; + if (fallback = getFallback(this.element.getElementsByTagName(tagName))) { + return fallback; + } + } + }; + + Dropzone.prototype.setupEventListeners = function() { + var elementListeners, event, listener, _i, _len, _ref, _results; + _ref = this.listeners; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + elementListeners = _ref[_i]; + _results.push((function() { + var _ref1, _results1; + _ref1 = elementListeners.events; + _results1 = []; + for (event in _ref1) { + listener = _ref1[event]; + _results1.push(elementListeners.element.addEventListener(event, listener, false)); + } + return _results1; + })()); + } + return _results; + }; + + Dropzone.prototype.removeEventListeners = function() { + var elementListeners, event, listener, _i, _len, _ref, _results; + _ref = this.listeners; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + elementListeners = _ref[_i]; + _results.push((function() { + var _ref1, _results1; + _ref1 = elementListeners.events; + _results1 = []; + for (event in _ref1) { + listener = _ref1[event]; + _results1.push(elementListeners.element.removeEventListener(event, listener, false)); + } + return _results1; + })()); + } + return _results; + }; + + Dropzone.prototype.disable = function() { + var file, _i, _len, _ref, _results; + this.clickableElements.forEach(function(element) { + return element.classList.remove("dz-clickable"); + }); + this.removeEventListeners(); + _ref = this.files; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + file = _ref[_i]; + _results.push(this.cancelUpload(file)); + } + return _results; + }; + + Dropzone.prototype.enable = function() { + this.clickableElements.forEach(function(element) { + return element.classList.add("dz-clickable"); + }); + return this.setupEventListeners(); + }; + + Dropzone.prototype.filesize = function(size) { + var cutoff, i, selectedSize, selectedUnit, unit, units, _i, _len; + units = ['TB', 'GB', 'MB', 'KB', 'b']; + selectedSize = selectedUnit = null; + for (i = _i = 0, _len = units.length; _i < _len; i = ++_i) { + unit = units[i]; + cutoff = Math.pow(this.options.filesizeBase, 4 - i) / 10; + if (size >= cutoff) { + selectedSize = size / Math.pow(this.options.filesizeBase, 4 - i); + selectedUnit = unit; + break; + } + } + selectedSize = Math.round(10 * selectedSize) / 10; + return "" + selectedSize + " " + selectedUnit; + }; + + Dropzone.prototype._updateMaxFilesReachedClass = function() { + if ((this.options.maxFiles != null) && this.getAcceptedFiles().length >= this.options.maxFiles) { + if (this.getAcceptedFiles().length === this.options.maxFiles) { + this.emit('maxfilesreached', this.files); + } + return this.element.classList.add("dz-max-files-reached"); + } else { + return this.element.classList.remove("dz-max-files-reached"); + } + }; + + Dropzone.prototype.drop = function(e) { + var files, items; + if (!e.dataTransfer) { + return; + } + this.emit("drop", e); + files = e.dataTransfer.files; + if (files.length) { + items = e.dataTransfer.items; + if (items && items.length && (items[0].webkitGetAsEntry != null)) { + this._addFilesFromItems(items); + } else { + this.handleFiles(files); + } + } + }; + + Dropzone.prototype.paste = function(e) { + var items, _ref; + if ((e != null ? (_ref = e.clipboardData) != null ? _ref.items : void 0 : void 0) == null) { + return; + } + this.emit("paste", e); + items = e.clipboardData.items; + if (items.length) { + return this._addFilesFromItems(items); + } + }; + + Dropzone.prototype.handleFiles = function(files) { + var file, _i, _len, _results; + _results = []; + for (_i = 0, _len = files.length; _i < _len; _i++) { + file = files[_i]; + _results.push(this.addFile(file)); + } + return _results; + }; + + Dropzone.prototype._addFilesFromItems = function(items) { + var entry, item, _i, _len, _results; + _results = []; + for (_i = 0, _len = items.length; _i < _len; _i++) { + item = items[_i]; + if ((item.webkitGetAsEntry != null) && (entry = item.webkitGetAsEntry())) { + if (entry.isFile) { + _results.push(this.addFile(item.getAsFile())); + } else if (entry.isDirectory) { + _results.push(this._addFilesFromDirectory(entry, entry.name)); + } else { + _results.push(void 0); + } + } else if (item.getAsFile != null) { + if ((item.kind == null) || item.kind === "file") { + _results.push(this.addFile(item.getAsFile())); + } else { + _results.push(void 0); + } + } else { + _results.push(void 0); + } + } + return _results; + }; + + Dropzone.prototype._addFilesFromDirectory = function(directory, path) { + var dirReader, entriesReader; + dirReader = directory.createReader(); + entriesReader = (function(_this) { + return function(entries) { + var entry, _i, _len; + for (_i = 0, _len = entries.length; _i < _len; _i++) { + entry = entries[_i]; + if (entry.isFile) { + entry.file(function(file) { + if (_this.options.ignoreHiddenFiles && file.name.substring(0, 1) === '.') { + return; + } + file.fullPath = "" + path + "/" + file.name; + return _this.addFile(file); + }); + } else if (entry.isDirectory) { + _this._addFilesFromDirectory(entry, "" + path + "/" + entry.name); + } + } + }; + })(this); + return dirReader.readEntries(entriesReader, function(error) { + return typeof console !== "undefined" && console !== null ? typeof console.log === "function" ? console.log(error) : void 0 : void 0; + }); + }; + + Dropzone.prototype.accept = function(file, done) { + if (file.size > this.options.maxFilesize * 1024 * 1024) { + return done(this.options.dictFileTooBig.replace("{{filesize}}", Math.round(file.size / 1024 / 10.24) / 100).replace("{{maxFilesize}}", this.options.maxFilesize)); + } else if (!Dropzone.isValidFile(file, this.options.acceptedFiles)) { + return done(this.options.dictInvalidFileType); + } else if ((this.options.maxFiles != null) && this.getAcceptedFiles().length >= this.options.maxFiles) { + done(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}", this.options.maxFiles)); + return this.emit("maxfilesexceeded", file); + } else { + return this.options.accept.call(this, file, done); + } + }; + + Dropzone.prototype.addFile = function(file) { + file.upload = { + progress: 0, + total: file.size, + bytesSent: 0 + }; + this.files.push(file); + file.status = Dropzone.ADDED; + this.emit("addedfile", file); + this._enqueueThumbnail(file); + return this.accept(file, (function(_this) { + return function(error) { + if (error) { + file.accepted = false; + _this._errorProcessing([file], error); + } else { + file.accepted = true; + if (_this.options.autoQueue) { + _this.enqueueFile(file); + } + } + return _this._updateMaxFilesReachedClass(); + }; + })(this)); + }; + + Dropzone.prototype.enqueueFiles = function(files) { + var file, _i, _len; + for (_i = 0, _len = files.length; _i < _len; _i++) { + file = files[_i]; + this.enqueueFile(file); + } + return null; + }; + + Dropzone.prototype.enqueueFile = function(file) { + if (file.status === Dropzone.ADDED && file.accepted === true) { + file.status = Dropzone.QUEUED; + if (this.options.autoProcessQueue) { + return setTimeout(((function(_this) { + return function() { + return _this.processQueue(); + }; + })(this)), 0); + } + } else { + throw new Error("This file can't be queued because it has already been processed or was rejected."); + } + }; + + Dropzone.prototype._thumbnailQueue = []; + + Dropzone.prototype._processingThumbnail = false; + + Dropzone.prototype._enqueueThumbnail = function(file) { + if (this.options.createImageThumbnails && file.type.match(/image.*/) && file.size <= this.options.maxThumbnailFilesize * 1024 * 1024) { + this._thumbnailQueue.push(file); + return setTimeout(((function(_this) { + return function() { + return _this._processThumbnailQueue(); + }; + })(this)), 0); + } + }; + + Dropzone.prototype._processThumbnailQueue = function() { + if (this._processingThumbnail || this._thumbnailQueue.length === 0) { + return; + } + this._processingThumbnail = true; + return this.createThumbnail(this._thumbnailQueue.shift(), (function(_this) { + return function() { + _this._processingThumbnail = false; + return _this._processThumbnailQueue(); + }; + })(this)); + }; + + Dropzone.prototype.removeFile = function(file) { + if (file.status === Dropzone.UPLOADING) { + this.cancelUpload(file); + } + this.files = without(this.files, file); + this.emit("removedfile", file); + if (this.files.length === 0) { + return this.emit("reset"); + } + }; + + Dropzone.prototype.removeAllFiles = function(cancelIfNecessary) { + var file, _i, _len, _ref; + if (cancelIfNecessary == null) { + cancelIfNecessary = false; + } + _ref = this.files.slice(); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + file = _ref[_i]; + if (file.status !== Dropzone.UPLOADING || cancelIfNecessary) { + this.removeFile(file); + } + } + return null; + }; + + Dropzone.prototype.createThumbnail = function(file, callback) { + var fileReader; + fileReader = new FileReader; + fileReader.onload = (function(_this) { + return function() { + if (file.type === "image/svg+xml") { + _this.emit("thumbnail", file, fileReader.result); + if (callback != null) { + callback(); + } + return; + } + return _this.createThumbnailFromUrl(file, fileReader.result, callback); + }; + })(this); + return fileReader.readAsDataURL(file); + }; + + Dropzone.prototype.createThumbnailFromUrl = function(file, imageUrl, callback) { + var img; + img = document.createElement("img"); + img.onload = (function(_this) { + return function() { + var canvas, ctx, resizeInfo, thumbnail, _ref, _ref1, _ref2, _ref3; + file.width = img.width; + file.height = img.height; + resizeInfo = _this.options.resize.call(_this, file); + if (resizeInfo.trgWidth == null) { + resizeInfo.trgWidth = resizeInfo.optWidth; + } + if (resizeInfo.trgHeight == null) { + resizeInfo.trgHeight = resizeInfo.optHeight; + } + canvas = document.createElement("canvas"); + ctx = canvas.getContext("2d"); + canvas.width = resizeInfo.trgWidth; + canvas.height = resizeInfo.trgHeight; + drawImageIOSFix(ctx, img, (_ref = resizeInfo.srcX) != null ? _ref : 0, (_ref1 = resizeInfo.srcY) != null ? _ref1 : 0, resizeInfo.srcWidth, resizeInfo.srcHeight, (_ref2 = resizeInfo.trgX) != null ? _ref2 : 0, (_ref3 = resizeInfo.trgY) != null ? _ref3 : 0, resizeInfo.trgWidth, resizeInfo.trgHeight); + thumbnail = canvas.toDataURL("image/png"); + _this.emit("thumbnail", file, thumbnail); + if (callback != null) { + return callback(); + } + }; + })(this); + if (callback != null) { + img.onerror = callback; + } + return img.src = imageUrl; + }; + + Dropzone.prototype.processQueue = function() { + var i, parallelUploads, processingLength, queuedFiles; + parallelUploads = this.options.parallelUploads; + processingLength = this.getUploadingFiles().length; + i = processingLength; + if (processingLength >= parallelUploads) { + return; + } + queuedFiles = this.getQueuedFiles(); + if (!(queuedFiles.length > 0)) { + return; + } + if (this.options.uploadMultiple) { + return this.processFiles(queuedFiles.slice(0, parallelUploads - processingLength)); + } else { + while (i < parallelUploads) { + if (!queuedFiles.length) { + return; + } + this.processFile(queuedFiles.shift()); + i++; + } + } + }; + + Dropzone.prototype.processFile = function(file) { + return this.processFiles([file]); + }; + + Dropzone.prototype.processFiles = function(files) { + var file, _i, _len; + for (_i = 0, _len = files.length; _i < _len; _i++) { + file = files[_i]; + file.processing = true; + file.status = Dropzone.UPLOADING; + this.emit("processing", file); + } + if (this.options.uploadMultiple) { + this.emit("processingmultiple", files); + } + return this.uploadFiles(files); + }; + + Dropzone.prototype._getFilesWithXhr = function(xhr) { + var file, files; + return files = (function() { + var _i, _len, _ref, _results; + _ref = this.files; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + file = _ref[_i]; + if (file.xhr === xhr) { + _results.push(file); + } + } + return _results; + }).call(this); + }; + + Dropzone.prototype.cancelUpload = function(file) { + var groupedFile, groupedFiles, _i, _j, _len, _len1, _ref; + if (file.status === Dropzone.UPLOADING) { + groupedFiles = this._getFilesWithXhr(file.xhr); + for (_i = 0, _len = groupedFiles.length; _i < _len; _i++) { + groupedFile = groupedFiles[_i]; + groupedFile.status = Dropzone.CANCELED; + } + file.xhr.abort(); + for (_j = 0, _len1 = groupedFiles.length; _j < _len1; _j++) { + groupedFile = groupedFiles[_j]; + this.emit("canceled", groupedFile); + } + if (this.options.uploadMultiple) { + this.emit("canceledmultiple", groupedFiles); + } + } else if ((_ref = file.status) === Dropzone.ADDED || _ref === Dropzone.QUEUED) { + file.status = Dropzone.CANCELED; + this.emit("canceled", file); + if (this.options.uploadMultiple) { + this.emit("canceledmultiple", [file]); + } + } + if (this.options.autoProcessQueue) { + return this.processQueue(); + } + }; + + resolveOption = function() { + var args, option; + option = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + if (typeof option === 'function') { + return option.apply(this, args); + } + return option; + }; + + Dropzone.prototype.uploadFile = function(file) { + return this.uploadFiles([file]); + }; + + Dropzone.prototype.uploadFiles = function(files) { + var file, formData, handleError, headerName, headerValue, headers, i, input, inputName, inputType, key, method, option, progressObj, response, updateProgress, url, value, xhr, _i, _j, _k, _l, _len, _len1, _len2, _len3, _m, _ref, _ref1, _ref2, _ref3, _ref4, _ref5; + xhr = new XMLHttpRequest(); + for (_i = 0, _len = files.length; _i < _len; _i++) { + file = files[_i]; + file.xhr = xhr; + } + method = resolveOption(this.options.method, files); + url = resolveOption(this.options.url, files); + xhr.open(method, url, true); + xhr.withCredentials = !!this.options.withCredentials; + response = null; + handleError = (function(_this) { + return function() { + var _j, _len1, _results; + _results = []; + for (_j = 0, _len1 = files.length; _j < _len1; _j++) { + file = files[_j]; + _results.push(_this._errorProcessing(files, response || _this.options.dictResponseError.replace("{{statusCode}}", xhr.status), xhr)); + } + return _results; + }; + })(this); + updateProgress = (function(_this) { + return function(e) { + var allFilesFinished, progress, _j, _k, _l, _len1, _len2, _len3, _results; + if (e != null) { + progress = 100 * e.loaded / e.total; + for (_j = 0, _len1 = files.length; _j < _len1; _j++) { + file = files[_j]; + file.upload = { + progress: progress, + total: e.total, + bytesSent: e.loaded + }; + } + } else { + allFilesFinished = true; + progress = 100; + for (_k = 0, _len2 = files.length; _k < _len2; _k++) { + file = files[_k]; + if (!(file.upload.progress === 100 && file.upload.bytesSent === file.upload.total)) { + allFilesFinished = false; + } + file.upload.progress = progress; + file.upload.bytesSent = file.upload.total; + } + if (allFilesFinished) { + return; + } + } + _results = []; + for (_l = 0, _len3 = files.length; _l < _len3; _l++) { + file = files[_l]; + _results.push(_this.emit("uploadprogress", file, progress, file.upload.bytesSent)); + } + return _results; + }; + })(this); + xhr.onload = (function(_this) { + return function(e) { + var _ref; + if (files[0].status === Dropzone.CANCELED) { + return; + } + if (xhr.readyState !== 4) { + return; + } + response = xhr.responseText; + if (xhr.getResponseHeader("content-type") && ~xhr.getResponseHeader("content-type").indexOf("application/json")) { + try { + response = JSON.parse(response); + } catch (_error) { + e = _error; + response = "Invalid JSON response from server."; + } + } + updateProgress(); + if (!((200 <= (_ref = xhr.status) && _ref < 300))) { + return handleError(); + } else { + return _this._finished(files, response, e); + } + }; + })(this); + xhr.onerror = (function(_this) { + return function() { + if (files[0].status === Dropzone.CANCELED) { + return; + } + return handleError(); + }; + })(this); + progressObj = (_ref = xhr.upload) != null ? _ref : xhr; + progressObj.onprogress = updateProgress; + headers = { + "Accept": "application/json", + "Cache-Control": "no-cache", + "X-Requested-With": "XMLHttpRequest" + }; + if (this.options.headers) { + extend(headers, this.options.headers); + } + for (headerName in headers) { + headerValue = headers[headerName]; + xhr.setRequestHeader(headerName, headerValue); + } + formData = new FormData(); + if (this.options.params) { + _ref1 = this.options.params; + for (key in _ref1) { + value = _ref1[key]; + formData.append(key, value); + } + } + for (_j = 0, _len1 = files.length; _j < _len1; _j++) { + file = files[_j]; + this.emit("sending", file, xhr, formData); + } + if (this.options.uploadMultiple) { + this.emit("sendingmultiple", files, xhr, formData); + } + if (this.element.tagName === "FORM") { + _ref2 = this.element.querySelectorAll("input, textarea, select, button"); + for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { + input = _ref2[_k]; + inputName = input.getAttribute("name"); + inputType = input.getAttribute("type"); + if (input.tagName === "SELECT" && input.hasAttribute("multiple")) { + _ref3 = input.options; + for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) { + option = _ref3[_l]; + if (option.selected) { + formData.append(inputName, option.value); + } + } + } else if (!inputType || ((_ref4 = inputType.toLowerCase()) !== "checkbox" && _ref4 !== "radio") || input.checked) { + formData.append(inputName, input.value); + } + } + } + for (i = _m = 0, _ref5 = files.length - 1; 0 <= _ref5 ? _m <= _ref5 : _m >= _ref5; i = 0 <= _ref5 ? ++_m : --_m) { + formData.append(this._getParamName(i), files[i], files[i].name); + } + return xhr.send(formData); + }; + + Dropzone.prototype._finished = function(files, responseText, e) { + var file, _i, _len; + for (_i = 0, _len = files.length; _i < _len; _i++) { + file = files[_i]; + file.status = Dropzone.SUCCESS; + this.emit("success", file, responseText, e); + this.emit("complete", file); + } + if (this.options.uploadMultiple) { + this.emit("successmultiple", files, responseText, e); + this.emit("completemultiple", files); + } + if (this.options.autoProcessQueue) { + return this.processQueue(); + } + }; + + Dropzone.prototype._errorProcessing = function(files, message, xhr) { + var file, _i, _len; + for (_i = 0, _len = files.length; _i < _len; _i++) { + file = files[_i]; + file.status = Dropzone.ERROR; + this.emit("error", file, message, xhr); + this.emit("complete", file); + } + if (this.options.uploadMultiple) { + this.emit("errormultiple", files, message, xhr); + this.emit("completemultiple", files); + } + if (this.options.autoProcessQueue) { + return this.processQueue(); + } + }; + + return Dropzone; + + })(Emitter); + + Dropzone.version = "4.0.1"; + + Dropzone.options = {}; + + Dropzone.optionsForElement = function(element) { + if (element.getAttribute("id")) { + return Dropzone.options[camelize(element.getAttribute("id"))]; + } else { + return void 0; + } + }; + + Dropzone.instances = []; + + Dropzone.forElement = function(element) { + if (typeof element === "string") { + element = document.querySelector(element); + } + if ((element != null ? element.dropzone : void 0) == null) { + throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone."); + } + return element.dropzone; + }; + + Dropzone.autoDiscover = true; + + Dropzone.discover = function() { + var checkElements, dropzone, dropzones, _i, _len, _results; + if (document.querySelectorAll) { + dropzones = document.querySelectorAll(".dropzone"); + } else { + dropzones = []; + checkElements = function(elements) { + var el, _i, _len, _results; + _results = []; + for (_i = 0, _len = elements.length; _i < _len; _i++) { + el = elements[_i]; + if (/(^| )dropzone($| )/.test(el.className)) { + _results.push(dropzones.push(el)); + } else { + _results.push(void 0); + } + } + return _results; + }; + checkElements(document.getElementsByTagName("div")); + checkElements(document.getElementsByTagName("form")); + } + _results = []; + for (_i = 0, _len = dropzones.length; _i < _len; _i++) { + dropzone = dropzones[_i]; + if (Dropzone.optionsForElement(dropzone) !== false) { + _results.push(new Dropzone(dropzone)); + } else { + _results.push(void 0); + } + } + return _results; + }; + + Dropzone.blacklistedBrowsers = [/opera.*Macintosh.*version\/12/i]; + + Dropzone.isBrowserSupported = function() { + var capableBrowser, regex, _i, _len, _ref; + capableBrowser = true; + if (window.File && window.FileReader && window.FileList && window.Blob && window.FormData && document.querySelector) { + if (!("classList" in document.createElement("a"))) { + capableBrowser = false; + } else { + _ref = Dropzone.blacklistedBrowsers; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + regex = _ref[_i]; + if (regex.test(navigator.userAgent)) { + capableBrowser = false; + continue; + } + } + } + } else { + capableBrowser = false; + } + return capableBrowser; + }; + + without = function(list, rejectedItem) { + var item, _i, _len, _results; + _results = []; + for (_i = 0, _len = list.length; _i < _len; _i++) { + item = list[_i]; + if (item !== rejectedItem) { + _results.push(item); + } + } + return _results; + }; + + camelize = function(str) { + return str.replace(/[\-_](\w)/g, function(match) { + return match.charAt(1).toUpperCase(); + }); + }; + + Dropzone.createElement = function(string) { + var div; + div = document.createElement("div"); + div.innerHTML = string; + return div.childNodes[0]; + }; + + Dropzone.elementInside = function(element, container) { + if (element === container) { + return true; + } + while (element = element.parentNode) { + if (element === container) { + return true; + } + } + return false; + }; + + Dropzone.getElement = function(el, name) { + var element; + if (typeof el === "string") { + element = document.querySelector(el); + } else if (el.nodeType != null) { + element = el; + } + if (element == null) { + throw new Error("Invalid `" + name + "` option provided. Please provide a CSS selector or a plain HTML element."); + } + return element; + }; + + Dropzone.getElements = function(els, name) { + var e, el, elements, _i, _j, _len, _len1, _ref; + if (els instanceof Array) { + elements = []; + try { + for (_i = 0, _len = els.length; _i < _len; _i++) { + el = els[_i]; + elements.push(this.getElement(el, name)); + } + } catch (_error) { + e = _error; + elements = null; + } + } else if (typeof els === "string") { + elements = []; + _ref = document.querySelectorAll(els); + for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { + el = _ref[_j]; + elements.push(el); + } + } else if (els.nodeType != null) { + elements = [els]; + } + if (!((elements != null) && elements.length)) { + throw new Error("Invalid `" + name + "` option provided. Please provide a CSS selector, a plain HTML element or a list of those."); + } + return elements; + }; + + Dropzone.confirm = function(question, accepted, rejected) { + if (window.confirm(question)) { + return accepted(); + } else if (rejected != null) { + return rejected(); + } + }; + + Dropzone.isValidFile = function(file, acceptedFiles) { + var baseMimeType, mimeType, validType, _i, _len; + if (!acceptedFiles) { + return true; + } + acceptedFiles = acceptedFiles.split(","); + mimeType = file.type; + baseMimeType = mimeType.replace(/\/.*$/, ""); + for (_i = 0, _len = acceptedFiles.length; _i < _len; _i++) { + validType = acceptedFiles[_i]; + validType = validType.trim(); + if (validType.charAt(0) === ".") { + if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) { + return true; + } + } else if (/\/\*$/.test(validType)) { + if (baseMimeType === validType.replace(/\/.*$/, "")) { + return true; + } + } else { + if (mimeType === validType) { + return true; + } + } + } + return false; + }; + + if (typeof jQuery !== "undefined" && jQuery !== null) { + jQuery.fn.dropzone = function(options) { + return this.each(function() { + return new Dropzone(this, options); + }); + }; + } + + if (typeof module !== "undefined" && module !== null) { + module.exports = Dropzone; + } else { + window.Dropzone = Dropzone; + } + + Dropzone.ADDED = "added"; + + Dropzone.QUEUED = "queued"; + + Dropzone.ACCEPTED = Dropzone.QUEUED; + + Dropzone.UPLOADING = "uploading"; + + Dropzone.PROCESSING = Dropzone.UPLOADING; + + Dropzone.CANCELED = "canceled"; + + Dropzone.ERROR = "error"; + + Dropzone.SUCCESS = "success"; + + + /* + + Bugfix for iOS 6 and 7 + Source: http://stackoverflow.com/questions/11929099/html5-canvas-drawimage-ratio-bug-ios + based on the work of https://github.com/stomita/ios-imagefile-megapixel + */ + + detectVerticalSquash = function(img) { + var alpha, canvas, ctx, data, ey, ih, iw, py, ratio, sy; + iw = img.naturalWidth; + ih = img.naturalHeight; + canvas = document.createElement("canvas"); + canvas.width = 1; + canvas.height = ih; + ctx = canvas.getContext("2d"); + ctx.drawImage(img, 0, 0); + data = ctx.getImageData(0, 0, 1, ih).data; + sy = 0; + ey = ih; + py = ih; + while (py > sy) { + alpha = data[(py - 1) * 4 + 3]; + if (alpha === 0) { + ey = py; + } else { + sy = py; + } + py = (ey + sy) >> 1; + } + ratio = py / ih; + if (ratio === 0) { + return 1; + } else { + return ratio; + } + }; + + drawImageIOSFix = function(ctx, img, sx, sy, sw, sh, dx, dy, dw, dh) { + var vertSquashRatio; + vertSquashRatio = detectVerticalSquash(img); + return ctx.drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh / vertSquashRatio); + }; + + + /* + * contentloaded.js + * + * Author: Diego Perini (diego.perini at gmail.com) + * Summary: cross-browser wrapper for DOMContentLoaded + * Updated: 20101020 + * License: MIT + * Version: 1.2 + * + * URL: + * http://javascript.nwbox.com/ContentLoaded/ + * http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE + */ + + contentLoaded = function(win, fn) { + var add, doc, done, init, poll, pre, rem, root, top; + done = false; + top = true; + doc = win.document; + root = doc.documentElement; + add = (doc.addEventListener ? "addEventListener" : "attachEvent"); + rem = (doc.addEventListener ? "removeEventListener" : "detachEvent"); + pre = (doc.addEventListener ? "" : "on"); + init = function(e) { + if (e.type === "readystatechange" && doc.readyState !== "complete") { + return; + } + (e.type === "load" ? win : doc)[rem](pre + e.type, init, false); + if (!done && (done = true)) { + return fn.call(win, e.type || e); + } + }; + poll = function() { + var e; + try { + root.doScroll("left"); + } catch (_error) { + e = _error; + setTimeout(poll, 50); + return; + } + return init("poll"); + }; + if (doc.readyState !== "complete") { + if (doc.createEventObject && root.doScroll) { + try { + top = !win.frameElement; + } catch (_error) {} + if (top) { + poll(); + } + } + doc[add](pre + "DOMContentLoaded", init, false); + doc[add](pre + "readystatechange", init, false); + return win[add](pre + "load", init, false); + } + }; + + Dropzone._autoDiscoverFunction = function() { + if (Dropzone.autoDiscover) { + return Dropzone.discover(); + } + }; + + contentLoaded(window, Dropzone._autoDiscoverFunction); + +}).call(this); diff --git a/app/assets/javascripts/plugin/jquery.cycle2.video.min.js b/app/assets/javascripts/plugin/jquery.cycle2.video.min.js new file mode 100644 index 0000000..c47c840 --- /dev/null +++ b/app/assets/javascripts/plugin/jquery.cycle2.video.min.js @@ -0,0 +1,2 @@ +/* Plugin for Cycle2; Copyright (c) 2012 M. Alsup; v20141007 */ +!function(a){"use strict";function b(){try{this.playVideo()}catch(a){}}function c(){try{this.pauseVideo()}catch(a){}}var d='
';a.extend(a.fn.cycle.defaults,{youtubeAllowFullScreen:!0,youtubeAutostart:!1,youtubeAutostop:!0}),a(document).on("cycle-bootstrap",function(e,f){f.youtube&&(f.hideNonActive=!1,f.container.find(f.slides).each(function(b){if(void 0!==a(this).attr("href")){var c,e=a(this),g=e.attr("href"),h=f.youtubeAllowFullScreen?"true":"false";g+=(/\?/.test(g)?"&":"?")+"enablejsapi=1",f.youtubeAutostart&&f.startingSlide===b&&(g+="&autoplay=1"),c=f.API.tmpl(d,{url:g,allowFullScreen:h}),e.replaceWith(c)}}),f.slides=f.slides.replace(/(\b>?a\b)/,"div.cycle-youtube"),f.youtubeAutostart&&f.container.on("cycle-initialized cycle-after",function(c,d){var e="cycle-initialized"==c.type?d.currSlide:d.nextSlide;a(d.slides[e]).find("object,embed").each(b)}),f.youtubeAutostop&&f.container.on("cycle-before",function(b,d){a(d.slides[d.currSlide]).find("object,embed").each(c)}))})}(jQuery); \ No newline at end of file diff --git a/app/assets/stylesheets/back_end.css b/app/assets/stylesheets/back_end.css index 96f6f3b..4280267 100644 --- a/app/assets/stylesheets/back_end.css +++ b/app/assets/stylesheets/back_end.css @@ -14,3 +14,8 @@ *= require lib/filter *= require lib/pageslide */ + +/* Hide ckeditor text, it's breaking the layout but we need to keep them for future use */ +.ui-helper-hidden-accessible { + display: none; +} diff --git a/app/assets/stylesheets/basic/orbit_bar.css.erb b/app/assets/stylesheets/basic/orbit_bar.css.erb index 4842867..7ce707a 100644 --- a/app/assets/stylesheets/basic/orbit_bar.css.erb +++ b/app/assets/stylesheets/basic/orbit_bar.css.erb @@ -318,6 +318,12 @@ } } +@media (max-width: 540px) { + #orbit-bar .orbit-bar-search-sign-language #search input[type="search"] { + width: 130px; + } +} + @media (max-width: 430px) { #orbit-bar #search{ display: none; diff --git a/app/assets/stylesheets/group_admin.css.scss b/app/assets/stylesheets/group_admin.css.scss new file mode 100644 index 0000000..4beb145 --- /dev/null +++ b/app/assets/stylesheets/group_admin.css.scss @@ -0,0 +1,107 @@ +@charset "utf-8"; + +@import url(http://fonts.googleapis.com/css?family=Maven+Pro); + +@import url(http://fonts.googleapis.com/css?family=Roboto); + +// Font stacks +$main-font: "Maven Pro", "微軟正黑體" sans-serif; +$paragraph-font: "Roboto", "微軟正黑體", sans-serif; +$gray: #f3f3f3; +$dark-gray: #aaaaaa; +$light-gray: #cdcdcd; +$white: white; +$light-black: #353535; +$black: black; +$green: #4ad976; +$blue: #4171d5; +$red: #c71932; +$blue-green: #00acee; +$group-page-bar-color: #171717; + +// Transition units +$fast: 0.3s; +$normal: 0.6s; +$slow: 1s; + +// Border radius units +$general: 0.25rem; + +// General style +body { + background: $gray; + font-family: $main-font; +} + +// Override and resolve the conflict with main-form.css for that I need RWD support for this page +.main-forms fieldset .input-area .controls textarea { + max-width: none; +} + +// Override select2 styles, I need this evil power +#main-wrap { + .select2-container-multi { + margin-right: 0.9375rem; + min-width: 200px; + .select2-choices { + padding: 8px 0.5rem 6px; + border-radius: $general; + } + .select2-search-choice { + padding: 10px 1.75rem 10px 0.7rem; + border-color: lighten($light-gray, 5%); + background: $white; + > div { + &:before { + content: "\F007"; + font-family: FontAwesome; + display: inline-block; + font-size: 0.9375rem; + color: $blue; + margin: 0 0.5rem 0 0; + } + } + } + .select2-search-choice-close { + right: 15px; + left: auto; + &:before { + content: "\f057"; + font-family: FontAwesome; + position: absolute; + cursor: pointer; + left: 6px; + top: 6px; + font-size: 0.9375rem; + color: $dark-gray; + } + &:hover { + &:before { + color: $red; + } + } + } + } +} + +.wrap-inner { + .upload-status-notice { + position: fixed; + right: 1rem; + top: 4rem; + color: $white; + padding: 16px 1.375rem; + background-color: $blue; + border-radius: $general; + font-size: 0.8125rem; + box-shadow: 0px 0px 16px 3px rgba(0, 0, 0, 0.2); + -webkit-animation-duration: .3s; + animation-duration: .3s; + z-index: 3000; + } +} + +.img-avatar { + width: 50px; + height: 50px; +} \ No newline at end of file diff --git a/app/assets/stylesheets/group_page.css b/app/assets/stylesheets/group_page.css deleted file mode 100644 index 358927f..0000000 --- a/app/assets/stylesheets/group_page.css +++ /dev/null @@ -1,249 +0,0 @@ -@charset "utf-8"; -body { - background: #f3f3f3; -} - -#main-wrap { - padding-top: 0; -} - -*, -*:before, -*:after { - box-sizing: border-box; -} - -.group-page {} - -.group-page-banner-image-wrap { - position: relative; - max-height: 280px; - overflow: hidden; -} - -.group-page-view-switch { - position: absolute; - right: 2rem; - top: 2rem; -} - -.group-page-banner-image { - max-width: 100%; - width: 100%; - height: auto; -} - -.group-page-bar { - overflow: hidden; - background: #171717; - padding: 20px 2rem; - text-align: center; -} - -.group-page-title { - padding: 6px 0; - color: #fff; - margin-bottom: 12px; -} - -.group-page-setion { - padding: 30px 2rem; - overflow: hidden; - max-width: 1350px; - margin: auto; -} - -.gorup-page-info-wrap { - display: block; - font-size: .9rem; - float: right; - padding: 5px .5rem; - border: 2px solid #cdcdcd; - cursor: pointer; -} - -.group-page-description-wrap { - clear: both; -} - -.gorup-page-info-wrap { - text-align: right; - margin-bottom: 10px; -} - -.group-page-status-wrap { - float: right; - font-size: 0.75rem; - color: #fff; - background: #1d9e20; - padding: 2px .4rem; - border-radius: .2rem; - margin-bottom: 10px; -} -.group-page-status-wrap.close-eye{ - background: #c71932; - margin-left: 5px; -} - -.group-page-description-wrap { - padding: 16px 1.2rem 16px; - margin-bottom: 15px; - box-shadow: inset 0 0 8px #aaa; - border-radius: .2rem; -} - -.group-page-description { - clear: both; - text-align: justify; -} - -.group-page-post { - clear: both; - text-align: center; - overflow: hidden; - margin-bottom: 40px; - background: #fff; - padding: 28px 1.5rem; - border-radius: .2rem; - box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .2); -} - -.group-page-post-link{ - text-decoration: none; - color: #000; -} - -.group-page-post:hover { - box-shadow: 0 1px 25px 0 rgba(0, 0, 0, .2); -} - -.group-page-post-link:hover { - color: #000; - text-decoration: none; -} - -.group-page-post-image-wrap { - display: inline-block; - margin-bottom: 12px; -} - -.group-page-post-image { - max-width: 100%; - width: 100%; - margin-top: 12px; - /*border-radius: 50%;*/ - height: auto; -} - -.group-page-post-content { - margin-bottom: .5rem; -} - -.group-page-post-title { - font-weight: normal; - font-size: 1.5rem; - line-height: 1; - margin-bottom: 12px; -} - -.group-page-post-meta-wrap { - color: #aaa; -} - -.group-page-post-author, -.group-page-post-postdate { - margin-right: .5rem; -} -/* scroll view */ -.group-page.scroll { - padding-top: 7rem; -} -.group-page.scroll .group-page-banner-image-wrap { - height: 70px; - overflow: hidden; - position: fixed; - top: 0; -} - -.group-page.scroll .group-page-title { - margin-bottom: 0; -} - -.group-page.scroll .group-page-title { - font-size: 18px; -} - -.group-page.scroll .group-page-new-post { - margin-top: 6px; -} - -.group-page.scroll .group-page-new-post { - display: inline-block; - vertical-align: top; -} - -.group-page.scroll .group-page-view-switch { - position: static; - display: inline-block; - margin: 6px .5rem 0 0; -} - -.group-page.scroll .btn { - padding: 2px 5px; -} - -.group-page li a { - text-decoration: none; -} - -.group-page .group-page-feed-view .active { - color: #fff; -} -/* 600px */ - -@media screen and (min-width: 37.5rem) { - .group-page-post { - text-align: left; - margin-bottom: 15px; - } - .group-page-post-image-wrap { - float: left; - width: 12%; - margin-right: 4%; - min-width: 100px; - } - .group-page-post-content-wrap { - float: left; - width: 72%; - } - .group-page.scroll .group-page-view-switch { - margin: 6px .5rem 0 0; - } - .group-page.scroll .group-page-bar { - padding: 0 5rem 0 2rem; - position: fixed; - top: 70px; - width: 100%; - } -} -/* 760px */ - -@media screen and (min-width: 47.5rem) { - .group-page-post-content-wrap { - width: 80%; - } - .group-page-bar { - text-align: left; - } - .group-page-title { - float: left; - margin: 0; - padding: 0; - } - .group-page-new-post { - float: right; - } - .group-page-view-switch { - float: right; - } -} diff --git a/app/assets/stylesheets/group_show.css.scss b/app/assets/stylesheets/group_show.css.scss new file mode 100644 index 0000000..dad398e --- /dev/null +++ b/app/assets/stylesheets/group_show.css.scss @@ -0,0 +1,765 @@ +@charset "utf-8"; + +@import url(http://fonts.googleapis.com/css?family=Maven+Pro); + +@import url(http://fonts.googleapis.com/css?family=Roboto); + +// Font stacks + +$main-font: "Maven Pro", "微軟正黑體" sans-serif; +$paragraph-font: "Roboto", "微軟正黑體", sans-serif; +$gray: #f3f3f3; +$dark-gray: #aaaaaa; +$light-gray: #cdcdcd; +$white: white; +$light-black: #353535; +$black: black; +$green: #4ad976; +$blue: #4171d5; +$red: #c71932; +$blue-green: #00acee; +$group-page-bar-color: #171717; + +// Transition units +$fast: 0.3s; +$normal: 0.6s; +$slow: 1s; + +// Border radius units +$general: 0.25rem; + +// General style +body { + background: $gray; + font-family: $main-font; +} + +*, +*:before, +*:after { + box-sizing: border-box; +} + +h1, h2, h3, h4, h5, h6, label, legend { + font-family: $main-font; +} + +img { + width: 100%; + max-width: 100%; + height: auto; +} + +a { + text-decoration: none; +} + +a:hover, a:visited { + text-decoration: none; +} + +// General classes + +.screen-reader { + position: absolute; + top: -9999px; + left: -9999px; +} + +// Buttons +.button { + padding: 8px .75rem; + color: $black; + border: none; + border-radius: 15rem; + background: $gray; +} + +.button-default { + color: $blue; + background-color: transparent; + border: 2px solid $blue; + transition: $fast all; + &:hover { + color: $white; + background-color: $blue; + } +} + +.button-activated { + color: #fff; + background-color: $green; +} + +.button-primary { + color: $white; + background-color: $blue; + transition: $fast all; + &:hover { + color: $white; + background-color: darken($blue, 15%); + } +} + +// Button group +.button-group { + display: inline-block; + list-style: none; + > .button-group-common { + display: inline-block; + } + > .button:first-child { + border-radius: 15rem 0 0 15rem; + margin-right: -4px; + } + > .button:last-child { + border-radius: 0 15rem 15rem 0; + } + li { + color: $blue; + background-color: rgba($white, 0.2); + &:hover { + a { + color: $white; + } + } + } + > .active { + color: $white; + background-color: $blue; + a { + color: $white; + } + } +} + +// Tool Tip +.tool-tip-parent { + position: relative; + &:hover { + .tool-tip { + display: block; + } + } +} + +.tool-tip { + padding: 10px 0.75rem; + border-radius: .2rem; + color: $white; + background: rgba($black, 0.85); + position: absolute; + left: 0; + bottom: 100%; + z-index: 150; + display: none; + &:after { + border: 5px solid transparent; + border-top-color: rgba($black, 0.85); + content: ""; + position: absolute; + left: 10px; + bottom: -10px; + } + &.right { + left: auto; + right: 0; + &:after { + left: auto; + right: 10px; + } + } +} + +.topnav { + display: none; +} + +// breadcrumb +.breadcrumb { + padding-left: 0; + margin: 0; + background: none; + > li { + text-shadow: none; + font-size: 13px; + } +} + +// dropzone + +.dropzone-pool { + border: 2px dashed $blue; + margin-bottom: 16px; + font-family: $paragraph-font; + font-size: 0.9375rem; + color: $dark-gray; + margin-right: 1rem; + border-radius: $general; +} + +// overriding member css +#main-wrap {} + +// Group page +#main-wrap { + padding-top: 0; +} + +.group-page-banner-wrap { + height: 280px; + overflow: hidden; + position: fixed; + top: 0; + left: 0; + width: 100%; + transition: $fast all; + z-index: 500; + background: $black; +} + +.group-page-banner-image-wrap { + background-color: $black; + text-align: center; +} + +.group-page-view-switch { + position: absolute; + top: 4rem; + right: 2rem; +} + +.group-page-banner-image { + width: auto; + max-width: 100%; + height: auto; +} + +.group-page-bar { + padding: 0 2rem 20px 6rem; + text-align: center; + background: rgba($group-page-bar-color, 0.95); + width: 100%; + position: absolute; + left: 0; + bottom: 0; +} + +.group-page-view-switch-in-bar { + display: none; + .button { + padding: 3px .75rem; + } +} + +.group-page-title { + margin-bottom: 12px; + padding: 6px 0; + color: $white; + font-family: $main-font; + font-weight: normal; +} + +.group-page-section { + overflow: hidden; + max-width: 1150px; + margin: auto; + padding: 300px 2rem 30px; +} + +.gorup-page-info-wrap { + font-size: .9rem; + padding: 6px 1rem; + display: block; + float: right; + cursor: pointer; +} + +.group-page-description-wrap { + clear: both; +} + +.gorup-page-info-wrap { + margin-bottom: 10px; + text-align: right; +} + +.group-page-status-wrap { + font-size: .75rem; + float: right; + padding: 2px 0.5rem; + margin-bottom: 10px; +} + +.group-page-status-wrap.close-eye { + margin-left: 5px; + background: $red; +} + +.group-page-description-wrap { + margin-bottom: 15px; + padding: 16px 1.2rem 16px; + border-radius: .2rem; + box-shadow: inset 0 0 8px $dark-gray; +} + +.group-page-description { + clear: both; + text-align: justify; +} + +.group-page-post { + clear: both; + margin-bottom: 40px; + padding: 28px 1.5rem; + text-align: center; + border-radius: $general; + background: $white; + box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2); + transition: $normal box-shadow; +} + +.group-page-post-link { + text-decoration: none; + color: $black; +} + +.group-page-post:hover { + box-shadow: 0 1px 25px 0 rgba(0, 0, 0, 0.2); +} + +.group-page-post-link:hover { + text-decoration: none; + color: $black; +} + +.group-page-post-image-wrap { + display: inline-block; + margin-bottom: 12px; +} + +.group-page-post-image { + width: 100%; + max-width: 100%; + height: auto; + margin-top: 12px; + border: 2px solid $gray; + border-radius: $general; +} + +.group-page-post-content { + margin-bottom: .5rem; + color: $dark-gray; + overflow: hidden; +} + +.group-page-post-title { + font-size: 1.5rem; + font-weight: normal; + line-height: 1; + margin-bottom: 12px; + color: $light-black; + font-family: $paragraph-font; +} + +.group-page-post-sub-wrap { + display: inline-block; +} + +.group-page-post-meta-wrap { + color: $dark-gray; +} + +.group-page-post-author, +.group-page-post-sub-wrap { + margin-right: .5rem; +} + +.group-page-seen-by { + display: inline-block; +} + +.group-page-seen-by-lead { + font-style: normal; +} + +// scroll view + +.group-page.scroll { + padding-top: 7rem; + .group-page-banner-wrap { + height: 120px; + } + .group-page-title { + margin-bottom: 0; + font-size: 1.625rem; + line-height: 50px; + } + .group-page-new-post { + margin-top: 18px; + padding: 6px 10px; + } + .group-page-new-post { + display: inline-block; + vertical-align: top; + } + .group-page-view-switch { + position: static; + display: inline-block; + margin: 6px .5rem 0 0; + display: none; + } + .group-page-view-switch-in-bar { + display: inline-block; + margin-top: 18px; + .button { + padding: 4px .75rem; + } + } + .group-page-section { + padding-top: 60px; + } + .btn { + padding: 2px 5px; + } + +} + +.group-page li a { + text-decoration: none; +} + +.group-page-switch-btn { + color: $blue; + &:hover { + color: $white; + } +} + +// 400px +@media screen and (min-width: 25rem) { + .group-page-new-post { + margin: 0 0.625rem 16px; + float: none; + display: inline-block; + } + .group-page-view-switch-in-bar { + float: none; + margin: 0; + .button { + padding: 6px .75rem; + } + } +} + +// 600px + +@media screen and (min-width: 37.5rem) { + .group-page-post { + margin-bottom: 35px; + text-align: left; + } + .group-page-post-image-wrap { + float: left; + width: 12%; + min-width: 100px; + margin-right: 4%; + max-height: 140px; + overflow: hidden; + } + .group-page-post-content-wrap { + float: left; + width: 70%; + font-family: $paragraph-font; + } +} + +/* 760px */ + +@media screen and (min-width: 47.5rem) { + .group-page-post-content-wrap { + width: 70%; + } + .group-page-bar { + text-align: left; + } + .group-page-title { + display: inline-block; + margin: 0; + padding: 0; + line-height: 70px; + transition: .6s all; + } + .group-page-new-post { + float: right; + margin: 18px 0 0 0; + } + .group-page-view-switch-in-bar { + margin: 18px 8px 0 0; + float: right; + li { + padding: 8px .75rem; + } + } + .group-page-view-switch { + float: right; + } +} + +// 900px +@media screen and (min-width: 56.25rem) { + .group-page-post-content-wrap { + width: 80%; + } +} + +// Group post +.group-post { + padding: 50px 2rem 30px; + max-width: 1150px; + margin: auto; +} + +.group-post-meta { + margin-bottom: 15px; +} + +.group-post-title { + font-family: $main-font; + float: left; + width: 90%; + font-weight: normal; + line-height: 1; +} + +.group-post-avatar-wrap { + float: right; + padding: 0 0.375rem 0 0; +} + +.group-post-avatar-username-toggle { + display: block; +} + +.group-post-avatar { + width: 60px; + height: 60px; + border-radius: 50%; +} + +.group-post-username { + display: none; + top: 100%; + padding-bottom: 30px; + right: 0; + left: auto; + white-space: nowrap; + font-size: 0.75rem; + &:after { + border-top-color: transparent; + border-bottom-color: rgba(0, 0, 0, 0.85); + top: -10px; + left: auto; + right: 20px; + bottom: auto; + } +} + +.group-post-postdate { + display: inline-block; + clear: both; +} + +.group-post-image-wrap { + position: relative; + background: $black; + &:hover { + .cycle-nav { + opacity: 1; + } + .group-post-cycle-prev { + left: 2rem; + } + .group-post-cycle-next { + right: 2rem; + } + } +} + +.group-post-image-list { + margin: 0; + padding: 0; + list-style: none; +} + +.cycle-nav { + font-size: 1.2rem; + position: absolute; + top: 50%; + margin-top: -1.25rem; + line-height: 1.5rem; + color: $white; + z-index: 500; + width: 2.5rem; + height: 2.5rem; + cursor: pointer; + -webkit-transition: $normal all; + transition: $normal all; + text-align: center; + background-color: rgba($black, 0.8); + border-radius: 50%; + opacity: 0; + &:hover { + background-color: $blue; + } + .group-post-cycle-nav-icon { + line-height: 2.6rem; + } +} + +.group-post-cycle-prev { + left: 0; +} + +.group-post-cycle-next { + right: 0; +} + +.group-post-content { + font-family: $main-font; + font-size: .8125rem; + margin: 15px 0; +} + +.group-post-attachment-wrap { + float: left; + width: 80%; + margin: 10px 0 25px; +} + +.group-post-attachments { + a { + margin-bottom: 10px; + } +} + +.group-post-attachment-file-format { + margin-right: 8px; +} + +.group-post-seen-by { + float: right; + cursor: pointer; + &:hover { + .group-post-seen-by-names { + display: block; + white-space: nowrap; + } + } + .group-post-seen-by-name { + display: block; + color: #fff; + white-space: nowrap; + } +} + +.group-post-seen-by-lead { + margin-right: 4px; + font-style: normal; +} + +.group-post-seen-by-names { + display: none; +} + +.group-post-seen-by-count { + border-radius: 50%; + background: $gray; + display: inline-block; +} + +// Comment section +.comments { + clear: both; +} + +.comments .group-post-respond-comment { + width: 100%; + height: 60px; + padding: 0 1rem; + box-shadow: none; +} + +.group-post-respond-submit { + font-size: 0.75rem; +} + +.group-post-comment-list { + margin: 0; + padding: 0; + list-style: none; +} + +.group-post-comment-wrap { + overflow: hidden; + margin-bottom: 25px; + padding-bottom: 8px; + border-bottom: 1px solid lighten($light-gray, 12%); +} + +.group-post-no-comment { + font-size: 0.8125rem; +} + +.group-post-comment-avatar { + float: left; + width: 60px; + margin-right: 1rem; + img { + width: 60px; + height: 60px; + border-radius: 50%; + } +} + +.group-post-comment-author { + font-size: .9375rem; + float: left; +} + +.group-post-comment-time { + float: right; +} + +.group-post-comment-content { + clear: both; +} + +.group-post-comment-body { + float: left; + width: 80%; +} + +// 260px +@media screen and (min-width: 16.25rem) { + .group-post-attachments { + a { + display: inline-block; + text-overflow: ellipsis; + } + } + .group-post-attachments-file-name { + display: inline-block; + text-overflow: ellipsis; + overflow: hidden; + vertical-align: middle; + } +} + +@media screen and (min-width: 370px) { + .group-post-comment-body { + width: 60%; + } +} + +// group new \ No newline at end of file diff --git a/app/assets/stylesheets/lib/main-forms.css b/app/assets/stylesheets/lib/main-forms.css index dbff9fb..64316d7 100644 --- a/app/assets/stylesheets/lib/main-forms.css +++ b/app/assets/stylesheets/lib/main-forms.css @@ -1,582 +1,664 @@ .main-forms > h3 { - margin: 5px 0 10px; - color: #333; - text-shadow: 0 1px 0 #ffffff; - font-family: 'Playfair Display SC', sans-serif; + margin: 5px 0 10px; + color: #333; + text-shadow: 0 1px 0 #ffffff; + font-family: 'Playfair Display SC', sans-serif; } + .main-forms fieldset { - background-color: #FFFFFF; - border: 1px solid #EDEDED; - margin-bottom: 20px; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; + background-color: #FFFFFF; + border: 1px solid #EDEDED; + margin-bottom: 20px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; } + .main-forms fieldset .input-area { - padding: 20px 20px 0; + padding: 20px 20px 0; } + .main-forms fieldset .input-area:after { - content: ""; - clear: both; - display: block; - height: 0; - visibility: hidden; + content: ""; + clear: both; + display: block; + height: 0; + visibility: hidden; } + .main-forms fieldset .input-area .nav-name { - float: left; - width: 100px; - padding-top: 5px; - text-align: right; - display: block; - margin-bottom: 5px; - font-size: 14px; - font-weight: normal; - line-height: 20px; + float: left; + width: 100px; + padding-top: 5px; + text-align: right; + display: block; + margin-bottom: 5px; + font-size: 14px; + font-weight: normal; + line-height: 20px; } -/*.main-forms fieldset .input-area .control-label { - width: 100px; -} -.main-forms fieldset .input-area .controls { - margin-left: 120px; -}*/ + .main-forms fieldset .input-area .controls textarea { - max-width: 500px; - max-height: 300px; - min-height: 86px; + max-width: 500px; + max-height: 300px; + min-height: 86px; } + .main-forms fieldset .input-area .controls textarea.cke_source { - max-width: 100%; - max-height: 100%; + max-width: 100%; + max-height: 100%; } + .main-forms fieldset .input-area .controls hr { - margin: 5px 0 10px; + margin: 5px 0 10px; } + .main-forms fieldset .input-area .controls h5 { - margin: 5px 0; + margin: 5px 0; } + .main-forms fieldset .input-area .controls .file-link { - margin-right: 10px; - display: inline-block; - width: 177px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; + margin-right: 10px; + display: inline-block; + width: 177px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } + .main-forms fieldset .input-area .controls .input-prepend { - margin-bottom: 5px; + margin-bottom: 5px; } + .main-forms fieldset .input-area .controls .input-prepend .btn-group { - padding: 4px 12px; + padding: 4px 12px; } + .main-forms fieldset .input-area .controls .input-prepend .btn-group { - padding: 4px 12px; + padding: 4px 12px; } + .main-forms fieldset .input-area .controls .input-prepend .btn-group .radio input[type="radio"], .main-forms fieldset .input-area .controls .input-prepend .btn-group .checkbox input[type="checkbox"] { - margin: 5px 5px 0 0; + margin: 5px 5px 0 0; } + .main-forms fieldset .input-area .controls .input-prepend .btn-group li { - text-align: left; - padding: 3px 10px; + text-align: left; + padding: 3px 10px; } + .main-forms fieldset .input-area .controls .input-prepend .btn-group li label { - padding-left: 5px; - display: block; + padding-left: 5px; + display: block; } -.main-forms fieldset .input-area .controls .exist .input-prepend .btn-group:hover .dropdown-menu , -.main-forms fieldset .input-area .controls .add-target .input-prepend .btn-group:hover .dropdown-menu { - display: block; + +.main-forms fieldset .input-area .controls .exist .input-prepend .btn-group:hover .dropdown-menu, +.main-forms fieldset .input-area .controls .add-target .input-prepend .btn-group:hover .dropdown-menu { + display: block; } + .main-forms fieldset .input-area .controls .exist .input-prepend, .main-forms fieldset .input-area .controls .add-target .input-prepend { - margin-bottom: 10px; - display: inline-block; + margin-bottom: 10px; + display: inline-block; } + .main-forms fieldset .input-area .controls .exist .fileupload-new { - display: block; + display: block; } + .main-forms fieldset .input-area .controls .exist .fileupload-new .input-prepend { - display: inline-block; + display: inline-block; } + .main-forms fieldset .input-area .controls .input-prepend a { - text-decoration: none; - color: #333333; + text-decoration: none; + color: #333333; } + .main-forms fieldset .input-area .controls .input-prepend .tab-content > .active { - display: inline-block; + display: inline-block; } + .main-forms fieldset .input-area .controls .add-btn { - margin: 3px 0; + margin: 3px 0; } + .main-forms fieldset .input-area .fileupload { - margin-right: 15px; - margin-bottom: 0; + margin-right: 15px; + margin-bottom: 0; } + .main-forms fieldset .input-area .datetimepick { - margin-right: 5px; - margin-bottom: 5px; + margin-right: 5px; + margin-bottom: 5px; } + .main-forms fieldset .input-area .datetimepick .add-on { - line-height: 24px; - cursor: pointer; + line-height: 24px; + cursor: pointer; } + .main-forms fieldset .input-area .language-area .input-content .mceLayout { - width: 100%!important; + width: 100%!important; } + .main-forms fieldset .input-area .module-nav, .main-forms fieldset .input-area .language-nav { - margin: 0 0 20px; - padding: 0 0 15px 120px; - border-bottom: 1px solid #ddd; + margin: 0 0 20px; + padding: 0 0 15px 120px; + border-bottom: 1px solid #ddd; } + .main-forms fieldset .input-area .module-nav li, .main-forms fieldset .input-area .language-nav li { - position: relative; + position: relative; } .main-forms fieldset .input-area .module-nav li.active:before, .main-forms fieldset .input-area .module-nav li.active:after, .main-forms fieldset .input-area .language-nav li.active:before, .main-forms fieldset .input-area .language-nav li.active:after { - display: block; - height: 0px; - width: 0px; - position: absolute; - bottom: -15px; - left: 50%; - margin-left: -5px; - content: ""; - border-style: solid; - border-width: 0 6px 6px 6px; - border-color: transparent transparent #EDEDED transparent; - z-index: 5 + display: block; + height: 0px; + width: 0px; + position: absolute; + bottom: -15px; + left: 50%; + margin-left: -5px; + content: ""; + border-style: solid; + border-width: 0 6px 6px 6px; + border-color: transparent transparent #EDEDED transparent; + z-index: 5 } + .main-forms fieldset .input-area .module-nav li.active:after { - display: none; + display: none; } + .main-forms fieldset .input-area .language-nav li.active:after { - bottom: -16px; - margin-left: -4px; - border-width: 0 5px 5px 5px; - border-color: transparent transparent #FFFFFF transparent; + bottom: -16px; + margin-left: -4px; + border-width: 0 5px 5px 5px; + border-color: transparent transparent #FFFFFF transparent; } + .main-forms fieldset .input-area .module-nav { - margin-bottom: 0; - border-bottom: none; + margin-bottom: 0; + border-bottom: none; } + .main-forms fieldset .input-area .language-area, .main-forms fieldset .input-area .module-area { - overflow: visible; + overflow: visible; } + .main-forms fieldset .input-area .module-area { - padding-top: 20px; - margin-bottom: 40px; - background-color: #EDEDED; - border-radius: 5px; - overflow: hidden; + padding-top: 20px; + margin-bottom: 40px; + background-color: #EDEDED; + border-radius: 5px; + overflow: hidden; } + .main-forms fieldset .form-actions { - /*padding-left: 140px;*/ - padding-left: 200px; - margin: 0px; - -webkit-border-radius: 0 0 4px 4px; - -moz-border-radius: 0 0 4px 4px; - border-radius: 0 0 4px 4px; + /*padding-left: 140px;*/ + + padding-left: 200px; + margin: 0px; + -webkit-border-radius: 0 0 4px 4px; + -moz-border-radius: 0 0 4px 4px; + border-radius: 0 0 4px 4px; } + .main-forms fieldset .input-area .nav-scroll { - margin-left: 120px; - width:800px; - position:relative; - z-index:1; - overflow:hidden; + margin-left: 120px; + width: 800px; + position: relative; + z-index: 1; + overflow: hidden; } + .main-forms fieldset .input-area .nav-scroll .scroller { - width: 1000px; - height:100%; - float:left; - padding:0; + width: 1000px; + height: 100%; + float: left; + padding: 0; } + .main-forms fieldset .input-area .controls[data-toggle^="buttons-"] label { - position: relative; - margin: 0 0 5px; + position: relative; + margin: 0 0 5px; } + .main-forms fieldset .input-area .controls[data-toggle^="buttons-"] input[type="radio"], .main-forms fieldset .input-area .controls[data-toggle^="buttons-"] input[type="checkbox"] { - margin-left: 0; - margin-top: 0; - position: absolute; - left: 0; - top: 0; - width: 100%; - height: 100%; - display: block; - opacity: 0; - filter: alpha(opacity=0); - -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + margin-left: 0; + margin-top: 0; + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + display: block; + opacity: 0; + filter: alpha(opacity=0); + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; } + .main-forms fieldset .input-area .question { - margin-top: 5px; + margin-top: 5px; } - - /* User Role Forms */ + #attributes-area.clickHere { - min-height: 150px; - position: relative; + min-height: 150px; + position: relative; } + #attributes-area.clickHere:before { - font-family: 'entypo'; - content: '\e0be'; - position: absolute; - font-size: 8em; - display: block; - bottom: 50px; - left: 175px; - color: #51a351; - opacity: .4; - filter: alpha(opacity=40); + font-family: 'entypo'; + content: '\e0be'; + position: absolute; + font-size: 8em; + display: block; + bottom: 50px; + left: 175px; + color: #51a351; + opacity: .4; + filter: alpha(opacity=40); } + .main-forms .input-append .tab-content { - display: inline-block; - overflow: inherit; + display: inline-block; + overflow: inherit; } + .main-forms .input-append .tab-content .active { - display: inline-block; - background-color: transparent; + display: inline-block; + background-color: transparent; } + .main-forms .input-append .active { - border-color: #c5c5c5; - border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); + border-color: #c5c5c5; + border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); } + .main-forms .input-append > .btn-group > .btn:first-child { - margin-left: -1px; - -webkit-border-bottom-left-radius: 0px; - border-bottom-left-radius: 0px; - -webkit-border-top-left-radius: 0px; - border-top-left-radius: 0px; - -moz-border-radius-bottomleft: 0px; - -moz-border-radius-topleft: 0px; + margin-left: -1px; + -webkit-border-bottom-left-radius: 0px; + border-bottom-left-radius: 0px; + -webkit-border-top-left-radius: 0px; + border-top-left-radius: 0px; + -moz-border-radius-bottomleft: 0px; + -moz-border-radius-topleft: 0px; } + .main-forms .attributes { - padding-bottom: 20px; + padding-bottom: 20px; } + .main-forms .attributes .tab-content { - overflow: inherit; + overflow: inherit; } + .main-forms .attributes.disabled label, .main-forms .attributes.disabled h4 { - color: #e6e6e6; + color: #e6e6e6; } + .main-forms .attributes-header { - border-bottom: 1px solid #ddd; - margin-bottom: 20px; - padding-bottom: 10px; + border-bottom: 1px solid #ddd; + margin-bottom: 20px; + padding-bottom: 10px; } + .main-forms .attributes-header .btn { - margin-left: 5px; + margin-left: 5px; } + .main-forms .attributes-header h4 { - font-family: 'Chivo'; - line-height: 26px; - margin: 0; + font-family: 'Chivo'; + line-height: 26px; + margin: 0; } + .main-forms .attributes-header h4 b { - padding: 0 1px; - border-style: dotted; - border-width: 0 2px; - border-color: #AAA; - margin-right: 5px; - cursor: move; + padding: 0 1px; + border-style: dotted; + border-width: 0 2px; + border-color: #AAA; + margin-right: 5px; + cursor: move; } + .main-forms .attributes-header h4 i { - cursor: pointer; + cursor: pointer; } + .main-forms .field-type { - background-color: #f5f5f5; - border-radius: 5px; - margin-bottom: 20px; - padding: 10px; + background-color: #f5f5f5; + border-radius: 5px; + margin-bottom: 20px; + padding: 10px; } + .main-forms .field-type.fade { - padding: 0px 10px; - -webkit-transition: all 0.15s linear; - -moz-transition: all 0.15s linear; - -o-transition: all 0.15s linear; - transition: all 0.15s linear; + padding: 0px 10px; + -webkit-transition: all 0.15s linear; + -moz-transition: all 0.15s linear; + -o-transition: all 0.15s linear; + transition: all 0.15s linear; } + .main-forms .field-type.in { - padding: 20px 10px; - -webkit-transition: all 0.15s linear; - -moz-transition: all 0.15s linear; - -o-transition: all 0.15s linear; - transition: all 0.15s linear; + padding: 20px 10px; + -webkit-transition: all 0.15s linear; + -moz-transition: all 0.15s linear; + -o-transition: all 0.15s linear; + transition: all 0.15s linear; } + .main-forms .field-type .control-group { - margin-bottom: 20px; - margin-top: 0px; + margin-bottom: 20px; + margin-top: 0px; } + .main-forms .field-type .control-group:last-child { - margin-bottom: 10px; + margin-bottom: 10px; } + #user-forms .control-group .add-target .input-append, .main-forms .field-type .control-group .add-target .input-append { - display: block; - margin-bottom: 10px; + display: block; + margin-bottom: 10px; } + .main-forms .field-type .control-group .add-target .input-append:first-child { - margin-top: 0px; + margin-top: 0px; } + .main-forms .field-type .control-group .add-target .input-append input + input { - border-radius: 0; - margin-left: -1px; + border-radius: 0; + margin-left: -1px; } + .main-forms .field-type .control-group .add-target.single .input-append input.last, .main-forms .control-group .add-target .btn-group .btn.last { - border-radius: 0 4px 4px 0; + border-radius: 0 4px 4px 0; } + .main-forms .parts-none { - width: 100%; - text-align: center; - padding: 50px 0 70px; - font-size: 2em; + width: 100%; + text-align: center; + padding: 50px 0 70px; + font-size: 2em; } + .main-forms .display-mode .typesetting { - margin: 0 0 10px 0; + margin: 0 0 10px 0; } + .main-forms .display-mode table td:last-child { - text-align: right; + text-align: right; } + .main-forms .display-mode .typesetting li { - display: inline-block; - float: left; - width: 120px; - position: relative; - padding: 2px; - text-align: center; + display: inline-block; + float: left; + width: 120px; + position: relative; + padding: 2px; + text-align: center; } + .main-forms .display-mode .typesetting li + li { - margin-left: 10px; + margin-left: 10px; } + .main-forms .display-mode .typesetting li.active { - padding: 0; - width: 124px; + padding: 0; + width: 124px; } + .main-forms .display-mode .typesetting li.active:after { - font-family: FontAwesome; - content: "\f00c"; - font-size: 12px; - text-indent: 15px; - line-height: 18px; - color: #FFF; - position: absolute; - top: 2px; - right: 2px; - width: 0px; - height: 0px; - border-style: solid; - border-width: 0 30px 30px 0; - border-color: transparent #FFA307 transparent transparent; - z-index: 1; + font-family: FontAwesome; + content: "\f00c"; + font-size: 12px; + text-indent: 15px; + line-height: 18px; + color: #FFF; + position: absolute; + top: 2px; + right: 2px; + width: 0px; + height: 0px; + border-style: solid; + border-width: 0 30px 30px 0; + border-color: transparent #FFA307 transparent transparent; + z-index: 1; } + .main-forms .display-mode .typesetting li.active img { - border-radius: 5px; - background-color: #FFA307; - padding: 2px; + border-radius: 5px; + background-color: #FFA307; + padding: 2px; } + .main-forms .display-mode .typesetting img { - width: 120px; - height: 120px; + width: 120px; + height: 120px; } + .main-forms .display-mode .typesetting input[type="radio"] { - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0)0; - opacity: 0; - position: absolute; - width: 100%; - height: 100%; - margin: 0; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=0)0; + opacity: 0; + position: absolute; + width: 100%; + height: 100%; + margin: 0; } + .main-forms .display-mode .typesetting .style_description { - display: block; - line-height: 1.2em; - font-size: 12px; - color: #686868; - padding-top: 10px; + display: block; + line-height: 1.2em; + font-size: 12px; + color: #686868; + padding-top: 10px; } #user-forms .control-group .add-target .input-append input.last { - border-radius: 4px; + border-radius: 4px; } .textarea-lang { - display: inline-block; - position: relative; + display: inline-block; + position: relative; } + .textarea-lang .ui-wrapper { - padding-bottom: 0!important; + padding-bottom: 0!important; } + .textarea-lang .ui-resizable-handle { - position: absolute; - font-size: 0.1px; - display: block; + position: absolute; + font-size: 0.1px; + display: block; } + .textarea-lang .ui-resizable-se { - cursor: se-resize; - right: 1px; - bottom: 1px; - width: 0px; - height: 0px; - border-style: solid; - border-width: 0 0 8px 8px; - border-color: transparent transparent #bcbcbc transparent; + cursor: se-resize; + right: 1px; + bottom: 1px; + width: 0px; + height: 0px; + border-style: solid; + border-width: 0 0 8px 8px; + border-color: transparent transparent #bcbcbc transparent; } + .textarea-lang .tab-pane textarea { - border-radius: 0 0 4px 4px; + border-radius: 0 0 4px 4px; } + .textarea-lang .btn-group { - display: table; - width: 100%; + display: table; + width: 100%; } + .textarea-lang .btn-group .btn { - display: table-cell; + display: table-cell; } + .textarea-lang .btn-group > .btn:first-child { - border-radius: 4px 0 0 0; + border-radius: 4px 0 0 0; } + .textarea-lang .btn-group > .btn:last-child { - border-radius: 0 4px 0 0; + border-radius: 0 4px 0 0; } #address-field .control-label { - width: 120px; + width: 120px; } + #address-field .controls { - margin-left: 140px; + margin-left: 140px; } - - #sideset ul.mobile-themes, #sideset ul.orbitbar-themes { - list-style: none; - margin: 0; + list-style: none; + margin: 0; } + #sideset ul.mobile-themes:after { - content: ""; - clear: both; - display: block; - visibility: hidden; + content: ""; + clear: both; + display: block; + visibility: hidden; } + #sideset ul.mobile-themes li, #sideset ul.orbitbar-themes li { - position: relative; - margin-right: 10px; - margin-bottom: 10px; - overflow: hidden; - padding: 5px; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=70); - opacity: .7; + position: relative; + margin-right: 10px; + margin-bottom: 10px; + overflow: hidden; + padding: 5px; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; + filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=70); + opacity: .7; } + #sideset ul.mobile-themes li { - float: left; - display: inline-block; - width: 160px; - height: 240px; + float: left; + display: inline-block; + width: 160px; + height: 240px; } + #sideset ul.orbitbar-themes li { - width: 500px; - height: 40px; + width: 500px; + height: 40px; } + #sideset ul.mobile-themes li.active, #sideset ul.orbitbar-themes li.active { - border: 5px solid #0088cc; - border-radius: 5px; - padding: 0px; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); - opacity: 1; + border: 5px solid #0088cc; + border-radius: 5px; + padding: 0px; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=100); + opacity: 1; } + #sideset ul.mobile-themes li.active:after, #sideset ul.orbitbar-themes li.active:after { - font-family: FontAwesome; - content: "\f00c"; - font-size: 15px; - text-indent: 20px; - line-height: 25px; - color: #FFF; - position: absolute; - top: 0; - right: 0; - width: 0px; - height: 0px; - border-style: solid; - border-width: 0 40px 40px 0; - border-color: transparent #0088cc transparent transparent; - z-index: 1; + font-family: FontAwesome; + content: "\f00c"; + font-size: 15px; + text-indent: 20px; + line-height: 25px; + color: #FFF; + position: absolute; + top: 0; + right: 0; + width: 0px; + height: 0px; + border-style: solid; + border-width: 0 40px 40px 0; + border-color: transparent #0088cc transparent transparent; + z-index: 1; } + #sideset ul.mobile-themes li img { - width: 160px; - height: 240px; + width: 160px; + height: 240px; } + #sideset ul.mobile-themes li input[type="radio"], #sideset ul.orbitbar-themes li input[type="radio"] { - margin-top: 0px; - position: absolute; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); - opacity: 0; - display: block; + margin-top: 0px; + position: absolute; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=0); + opacity: 0; + display: block; } + #sideset ul.mobile-themes li input[type="radio"] { - width: 160px; - height: 240px; + width: 160px; + height: 240px; } + #sideset ul.orbitbar-themes li input[type="radio"] { - width: 500px; - height: 40px; + width: 500px; + height: 40px; } + #sideset blockquote { - margin-bottom: 30px; + margin-bottom: 30px; } -.downloaded_times{ + +.downloaded_times { display: inline-block; font-size: 14px; height: 30px; line-height: 30px; padding-left: 10px; - vertical-align: top; + vertical-align: top; } - /* Responsive */ -@media (min-width: 768px) and (max-width: 979px) { -} @media (max-width: 480px) { - .main-forms fieldset .input-area .nav-name { - float: none; - width: auto; - padding-top: 0; - text-align: left; - } - .main-forms fieldset .input-area .module-area { - padding: 20px; - } - .main-forms fieldset .input-area .module-nav, - .main-forms fieldset .input-area .language-nav { - padding: 0 0 15px 0px; - } - .main-forms fieldset .form-actions { - padding-right: 20px; - padding-left: 20px; - } - .main-forms fieldset .input-area .control-label { - width: auto; - } - .main-forms fieldset .input-area .controls { - margin-left: 0; - } - .main-forms fieldset .form-actions { - padding-left: 20px; - } -} \ No newline at end of file + .main-forms fieldset .input-area .nav-name { + float: none; + width: auto; + padding-top: 0; + text-align: left; + } + .main-forms fieldset .input-area .module-area { + padding: 20px; + } + .main-forms fieldset .input-area .module-nav, + .main-forms fieldset .input-area .language-nav { + padding: 0 0 15px 0px; + } + .main-forms fieldset .form-actions { + padding-right: 20px; + padding-left: 20px; + } + .main-forms fieldset .input-area .control-label { + width: auto; + } + .main-forms fieldset .input-area .controls { + margin-left: 0; + } + .main-forms fieldset .form-actions { + padding-left: 20px; + } +} diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index c0b9381..3bec795 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -1,5 +1,5 @@ -class Admin::GroupsController < OrbitMemberController - +class Admin::GroupsController < OrbitGroupController + include Admin::GroupsHelper def index @groups = current_user.groups end @@ -13,30 +13,37 @@ class Admin::GroupsController < OrbitMemberController end def newpost + render_401 and return if !user_can_write? @no_breadcrumb = true - uid = params[:group_id].split("-").last - @group = Group.find_by(:uid => uid) @grouppost = GroupPost.new end def createpost - uid = params[:group_id].split("-").last - group = Group.find_by(:uid => uid) gp = GroupPost.new(post_params) - gp.group = group + gp.group = @group gp.save - redirect_to admin_group_path(group) + redirect_to admin_group_path(@group) end def showpost - + render_401 and return if !user_can_read? + if (current_user.id.to_s != @post.author.to_s) && (!@post.read_by.include?(current_user.id.to_s)) + @post.read_by << current_user.id.to_s + @post.save + end + @read_by_names = @post.read_by.collect{|rb| + user = User.find(rb) rescue nil + author = (user.member_profile.name == nil ? user.user_name : user.member_profile.name rescue "") if !user.nil? + author + } end def show @no_breadcrumb = true @no_filter = true - uid = params[:id].split("-").last - @group = Group.find_by(:uid => uid) + if !user_can_read? + render_401 and return + end end def create_category @@ -46,6 +53,28 @@ class Admin::GroupsController < OrbitMemberController render :partial => "group_categories" end + def upload_photo + photo = GroupPostImage.new(post_image_params) + photo.save + render :json => {"success" => true,"id" => photo.id.to_s}.to_json + end + + + def upload_file + file = GroupPostFile.new(post_file_params) + file.save + render :json => {"success" => true,"id" => file.id.to_s}.to_json + end + + def download_file + file_id = params[:id] + file = GroupPostFile.find(file_id) rescue nil + if !file.nil? + redirect_to file.file.url and return + end + render :nothing => true + end + def create group = Group.new(group_params) group.save @@ -70,20 +99,55 @@ class Admin::GroupsController < OrbitMemberController end end + def new_comment + gpc = GroupPostComment.new(comment_params) + gpc.save + render :partial => "post_comment", :collection => [gpc] + end + private def category_params params.require(:category).permit! end + def comment_params + params.require(:group_post_comment).permit! + end + def post_params p = params.require(:group_post).permit! p["author"] = current_user.id + images = [] + p[:group_post_images].each do |id| + gpi = GroupPostImage.find(id) rescue nil + if !gpi.nil? + images << gpi + end + end if !p[:group_post_images].nil? + files = [] + p[:group_post_files].each do |id| + gpf = GroupPostFile.find(id) rescue nil + if !gpf.nil? + files << gpf + end + end if !p[:group_post_files].nil? + p[:group_post_images] = images + p[:group_post_files] = files p end + def post_image_params + params.require(:group_post_image).permit! + end + + def post_file_params + params.require(:group_post_file).permit! + end + def group_params p = params.require(:group).permit! + p["user_ids"] = [] if p["user_ids"].nil? p["user_ids"] << current_user.id.to_s p["admins"] = [] p["admins"] << current_user.id.to_s diff --git a/app/controllers/orbit_group_controller.rb b/app/controllers/orbit_group_controller.rb new file mode 100644 index 0000000..9a91144 --- /dev/null +++ b/app/controllers/orbit_group_controller.rb @@ -0,0 +1,43 @@ +class OrbitGroupController < ApplicationController + layout "member" + before_action :authenticate_user, :get_group, :set_access_rights + + def get_group + case params[:action] + when "show" + uid = params[:id].split("-").last + @group = Group.find_by(:uid => uid) + when "newpost", "createpost" + uid = params[:group_id].split("-").last + @group = Group.find_by(:uid => uid) + when "showpost" + uid = params[:id].split("-").last + @post = GroupPost.find_by(:uid => uid) + @group = @post.group + end + end + + def set_access_rights + @access_right_level = "none" + read_or_write = @group.permission rescue "read" + case params[:action] + when "show", "showpost", "newpost" + is_member = @group.users.include?(current_user) + if @group.admins.include?(current_user.id.to_s) + @access_right_level = "admin" + elsif is_member + if read_or_write == "write" + @access_right_level = "write" + elsif read_or_write == "read" + @access_right_level = "read" + end + elsif !is_member && @group.privacy == "open" + @access_right_level = "read" + end + end + end + + def render_401 + render "public/401" + end +end \ No newline at end of file diff --git a/app/controllers/page_parts_controller.rb b/app/controllers/page_parts_controller.rb index 032d7ef..b587268 100644 --- a/app/controllers/page_parts_controller.rb +++ b/app/controllers/page_parts_controller.rb @@ -35,7 +35,7 @@ class PagePartsController < ApplicationController def edit_sub_part @part = part_model.find(params[:part_id]) @subpart = SubPart.find(params[:sub_part_id]) - @select_number = @part.sub_parts.index(@subpart) + @select_number = @part.sub_parts.index{|sp| sp.id.to_s == @subpart.id.to_s} @child_page_count = 0 @kind = @subpart.kind @modules = ModuleApp.widget_enabled diff --git a/app/helpers/admin/groups_helper.rb b/app/helpers/admin/groups_helper.rb new file mode 100644 index 0000000..783bc6e --- /dev/null +++ b/app/helpers/admin/groups_helper.rb @@ -0,0 +1,35 @@ +module Admin::GroupsHelper + def remote_file_exists?(url) + url = URI.parse(url) + Net::HTTP.start(url.host, url.port) do |http| + return http.head(url.request_uri)['Content-Type'].start_with? 'image' + end + end + + def parse_for_images(content) + urls = URI.extract(content) + images = [] + urls.each do |url| + images << url if !url.nil? && remote_file_exists?(url) + end if !urls.empty? + + image_content = "
" + images.each do |img| + content = content.sub(img,"") + image_content = image_content + "
" + end if !images.empty? + return [content, image_content] + end + + def is_user_group_admin? + return (@access_right_level == "admin" ? true : false) + end + + def user_can_write? + return (@access_right_level == "admin" || @access_right_level == "write" ? true : false) + end + + def user_can_read? + return (@access_right_level == "admin" || @access_right_level == "write" || @access_right_level == "read" ? true : false) + end +end \ No newline at end of file diff --git a/app/models/attribute_value.rb b/app/models/attribute_value.rb index 5bb74b5..38316eb 100644 --- a/app/models/attribute_value.rb +++ b/app/models/attribute_value.rb @@ -80,7 +80,7 @@ class AttributeValue { "key" => self.attribute_field.key, "title" => self.attribute_field.title, - "value" => "", + "value" => " ", "val" => field_value = self.value } end diff --git a/app/models/group.rb b/app/models/group.rb index 426f0ad..dbe344f 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -1,20 +1,24 @@ class Group include Mongoid::Document - include Mongoid::Timestamps - include Slug + include Mongoid::Timestamps + include Slug - field :title, as: :slug_title, type: String, localize: true - field :description, localize: true - field :admins, type: Array, default: [] - field :privacy, default: "closed" - mount_uploader :image, ImageUploader + field :title, as: :slug_title, type: String, localize: true + field :description, localize: true + field :admins, type: Array, default: [] + field :privacy, default: "closed" + field :permission, default: "write" + field :archive, type: Boolean, default: false + mount_uploader :image, ImageUploader - belongs_to :group_category - has_and_belongs_to_many :users - has_many :group_posts - - scope :closed, ->{ where(privacy: "closed") } - scope :open, ->{ where(privacy: "open") } + belongs_to :group_category + has_and_belongs_to_many :users + has_many :group_posts + + scope :closed, ->{ where(privacy: "closed") } + scope :open, ->{ where(privacy: "open") } + scope :archived, ->{ where(archive: true) } + scope :not_archived, ->{ where(archive: false) } end \ No newline at end of file diff --git a/app/models/group_post.rb b/app/models/group_post.rb index 4177b46..1681258 100644 --- a/app/models/group_post.rb +++ b/app/models/group_post.rb @@ -7,8 +7,10 @@ class GroupPost field :content field :read_by, type: Array, default: [] field :author, type: BSON::ObjectId - mount_uploader :image, ImageUploader belongs_to :group + has_many :group_post_images, :autosave => true, :dependent => :destroy + has_many :group_post_files, :autosave => true, :dependent => :destroy + has_many :group_post_comments, :autosave => true, :dependent => :destroy end \ No newline at end of file diff --git a/app/models/group_post_comment.rb b/app/models/group_post_comment.rb new file mode 100644 index 0000000..c64e85e --- /dev/null +++ b/app/models/group_post_comment.rb @@ -0,0 +1,9 @@ +class GroupPostComment + include Mongoid::Document + include Mongoid::Timestamps + + field :comment + + belongs_to :user + belongs_to :group_post +end \ No newline at end of file diff --git a/app/models/group_post_file.rb b/app/models/group_post_file.rb new file mode 100644 index 0000000..5060119 --- /dev/null +++ b/app/models/group_post_file.rb @@ -0,0 +1,9 @@ +class GroupPostFile + include Mongoid::Document + include Mongoid::Timestamps + + mount_uploader :file, AssetUploader + + belongs_to :group_post + +end \ No newline at end of file diff --git a/app/models/group_post_image.rb b/app/models/group_post_image.rb new file mode 100644 index 0000000..dd35f0e --- /dev/null +++ b/app/models/group_post_image.rb @@ -0,0 +1,9 @@ +class GroupPostImage + include Mongoid::Document + include Mongoid::Timestamps + + mount_uploader :image, ImageUploader + + belongs_to :group_post + +end \ No newline at end of file diff --git a/app/models/member_profile.rb b/app/models/member_profile.rb index 324f19b..a5310d5 100644 --- a/app/models/member_profile.rb +++ b/app/models/member_profile.rb @@ -47,7 +47,7 @@ class MemberProfile def name - if self.first_name || self.last_name + if self.first_name != "" || self.last_name != "" I18n.locale.eql?(:zh_tw) ? "#{self.last_name} #{self.first_name}" : "#{self.first_name} #{self.last_name}" end end @@ -135,7 +135,7 @@ class MemberProfile data = self.send(field["key"]) rescue "" data = (data =~ /\A#{URI::regexp(['http', 'https'])}\z/) ? "#{data}" : data data = (data =~ /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i) ? "#{data}" : data - field_data = data.blank? ? {} : {"key" => field["key"],"title" => I18n.t("users."+field["key"]), "value" =>data} + field_data = data.blank? ? {"key" => field["key"],"title" => I18n.t("users."+field["key"]), "value" => " "} : {"key" => field["key"],"title" => I18n.t("users."+field["key"]), "value" =>data} field_data end diff --git a/app/models/member_profile_field_value.rb b/app/models/member_profile_field_value.rb index 5e5874f..4ae345f 100644 --- a/app/models/member_profile_field_value.rb +++ b/app/models/member_profile_field_value.rb @@ -151,7 +151,7 @@ class MemberProfileFieldValue { "key" => self.member_profile_field.key, "title" => self.member_profile_field.title, - "value" => (field_value.blank? ? "" : field_value), + "value" => (field_value.blank? ? " " : field_value), "val" => field_value = self.value } end diff --git a/app/models/user.rb b/app/models/user.rb index fc44c65..a0e3c0c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -21,6 +21,7 @@ class User has_many :authorizations belongs_to :member_profile has_and_belongs_to_many :groups + has_many :group_post_comments has_one :facebook, :autosave => true, :dependent => :destroy has_one :google, :autosave => true, :dependent => :destroy # has_one :desktop, :dependent => :destroy diff --git a/app/templates/orbit_bootstrap/assets/javascripts/app.js b/app/templates/orbit_bootstrap/assets/javascripts/app.js index 139e974..15ab1ad 100644 --- a/app/templates/orbit_bootstrap/assets/javascripts/app.js +++ b/app/templates/orbit_bootstrap/assets/javascripts/app.js @@ -1,10 +1,11 @@ (function( $ ) { - "use strict" + "use strict"; function init() { var doc = document, - lang = doc.documentElement.lang; + lang = doc.documentElement.lang, + pageModule = doc.body.getAttribute( "data-module" ); var orbit = { @@ -68,7 +69,7 @@ i = -1, elsLen = els.length; - for( i = 0; i < elsLen; i ++ ) { + for ( i = 0; i < elsLen; i ++ ) { if ( els[ i ].firstChild !== null ) { if( els[ i ].firstChild.length > maxLen ) { newTitle = els[ i ].firstChild.textContent; @@ -79,6 +80,20 @@ } }, + member: { + equalHeight: function() { + var bigbrother = -1; + + $( ".i-member-item" ).each( function() { + bigbrother = bigbrother > $( ".i-member-item" ).height() ? bigbrother : $( ".i-member-item" ).height(); + }); + + $( ".i-member-item" ).each( function() { + $( ".i-member-item" ).height( bigbrother ); + }); + } + }, + // Add link and cursor class name on element that has data-link attribute addLinkOnADBanner: function( els ) { $.each( els, function() { @@ -112,10 +127,10 @@ } } } - } + }; // Specific functions that will be running on homepage - if ( doc.body.getAttribute( "data-module" ) === "home" ) { + if ( pageModule === "home" ) { } diff --git a/app/templates/orbit_bootstrap/assets/stylesheets/template/base/_global.scss b/app/templates/orbit_bootstrap/assets/stylesheets/template/base/_global.scss index 3e6534b..15b6b42 100644 --- a/app/templates/orbit_bootstrap/assets/stylesheets/template/base/_global.scss +++ b/app/templates/orbit_bootstrap/assets/stylesheets/template/base/_global.scss @@ -8,7 +8,7 @@ html { body { font-family: $sub-font; font-size: inherit; - margin-top: 40px; // needed for Orbit bar + margin-top: 40px; } a:hover, a:focus { @@ -26,3 +26,12 @@ th, td { padding: 8px .5rem; } + +.borderless>tbody>tr>td, +.borderless>tbody>tr>th, +.borderless>tfoot>tr>td, +.borderless>tfoot>tr>th, +.borderless>thead>tr>td, +.borderless>thead>tr>th { + border: none !important; +} \ No newline at end of file diff --git a/app/templates/orbit_bootstrap/assets/stylesheets/template/base/_variables.scss b/app/templates/orbit_bootstrap/assets/stylesheets/template/base/_variables.scss index 3064767..7e86c90 100644 --- a/app/templates/orbit_bootstrap/assets/stylesheets/template/base/_variables.scss +++ b/app/templates/orbit_bootstrap/assets/stylesheets/template/base/_variables.scss @@ -1,8 +1,5 @@ @charset "utf-8"; -// Google fonts -@import url(http://fonts.googleapis.com/css?family=Roboto); - // Base Color $theme-gray: #495054; $theme-gray-light: #cecece; @@ -17,11 +14,13 @@ $theme-color-main: #47bab5; $theme-color-second: #5bc0de; $theme-color-third: #ed4c43; - // Font stacks $main-font: 'Roboto', "微軟正黑體", "Helvetica Neue", Helvetica, sans-serif; $sub-font: 'Roboto', "新細明體", "Helvetica Neue", Helvetica, sans-serif; +// Font sizes +$font-15: 0.9375rem; +$font-13: 0.8125rem; // // Modules @@ -71,3 +70,10 @@ $table-th-bgcolor: $theme-color-main; // Font sizes $w-item-heading-font-size: 0.85rem; + + +// +// Member Module +// -------------------------------------------------- + +$border-width: 4px; \ No newline at end of file diff --git a/app/templates/orbit_bootstrap/assets/stylesheets/template/init.scss b/app/templates/orbit_bootstrap/assets/stylesheets/template/init.scss deleted file mode 100644 index ba687b7..0000000 --- a/app/templates/orbit_bootstrap/assets/stylesheets/template/init.scss +++ /dev/null @@ -1,4 +0,0 @@ -@import "bootstrap/mixins"; -@import "bootstrap/variables"; -@import "base/mixins"; -@import "base/variables"; diff --git a/app/templates/orbit_bootstrap/assets/stylesheets/template/initial.scss b/app/templates/orbit_bootstrap/assets/stylesheets/template/initial.scss index 694cb99..493bbbb 100644 --- a/app/templates/orbit_bootstrap/assets/stylesheets/template/initial.scss +++ b/app/templates/orbit_bootstrap/assets/stylesheets/template/initial.scss @@ -1,4 +1,3 @@ -@import url("http://fonts.googleapis.com/css?family=Droid+Sans:400,700"); @import "bootstrap/mixins"; @import "bootstrap/variables"; @import "base/mixins"; diff --git a/app/templates/orbit_bootstrap/assets/stylesheets/template/modules/ad_banner.scss b/app/templates/orbit_bootstrap/assets/stylesheets/template/modules/ad_banner.scss index 9bef0ac..35b53e3 100644 --- a/app/templates/orbit_bootstrap/assets/stylesheets/template/modules/ad_banner.scss +++ b/app/templates/orbit_bootstrap/assets/stylesheets/template/modules/ad_banner.scss @@ -1,9 +1,10 @@ @charset "utf-8"; + @import "../initial"; // // Widget -// +// // Widget // ## gerenral styles @@ -15,19 +16,46 @@ } } +.w-ad-banner__wrap { + width: 100%; +} -// Widget 1 +.w-ad-banner__slide { + width: 100%; +} + +.banner-pager { + @include list-reset; + position: absolute; + right: 1em; + top: 1em; + z-index: 200; + + li { + display: inline-block; + } + + a { + background: $theme-color-main; + display: inline-block; + margin-right: 0.25em; + width: 0.8em; + height: 0.8em; + border-radius: 50%; + opacity: .5; + } + + .active-slide a { + opacity: 1; + } +} + +.banner-responsive { + width: 100%; +} + +// Widget 1 .ad-banner-widget-1 { - .w-ad-banner__wrap { - width: 100%; - } - .w-ad-banner__slide { - width: 100%; - } - .w-ad-banner__image { - width: 100%; - height: auto; - } .w-ad-banner__caption { background: $theme-color-main; color: $theme-white; @@ -44,123 +72,50 @@ font-family: $main-font; font-size: $w-caption-desc; } - - } - .w-ad-banner__pager { - @include list-reset(); - position: absolute; - right: 1em; - top: 1em; - z-index: 200; - - li { - display: inline-block; - } - - a { - background: $theme-color-main; - display: inline-block; - margin-right: 0.25em; - width: 0.8em; - height: 0.8em; - border-radius: 50%; - opacity: 0.5; - } - - .active-slide a{ - opacity: 1; - } } } -// Widget 2 +// Widget 2 .ad-banner-widget-2 { - .w-ad-banner__wrap { - width: 100%; - } - .w-ad-banner__slide { - width: 100%; - } .w-ad-banner__image { width: 100%; height: auto; } - .youtube { - } + .youtube, .cycle-youtube { width: 100%; height: 100%; } - object, embed{ - width: 100%; - height: 100%; + + object, embed { + width: 100%; + height: 100%; } - .w-ad-banner__pager { - @include list-reset(); - position: absolute; + + .banner-pager { right: 1em; bottom: 1em; z-index: 102; - - li { - display: inline-block; - } - - a { - background: $theme-color-main; - display: inline-block; - margin-right: 0.25em; - width: 0.8em; - height: 0.8em; - border-radius: 50%; - opacity: 0.5; - } - - .active-slide a{ - opacity: 1; - } } } - // Widget 3 .ad-banner-widget-3 { - .w-ad-banner__wrap { + .w-ad-banner__wrap { width: 100%; } + .w-ad-banner__slide { width: 100%; } - .w-ad-banner__image { - width: 100%; - height: auto; - } - .w-ad-banner__pager { - @include list-reset(); - position: absolute; + + .banner-pager { + top: auto; right: 1em; bottom: 1em; - z-index: 200; - - li { - display: inline-block; - } - - a { - background: $theme-color-main; - display: inline-block; - margin-right: 0.25em; - width: 0.8em; - height: 0.8em; - border-radius: 50%; - opacity: 0.5; - } - .active-slide a{ - opacity: 1; - } } } -.cycle-slide-active{ +.cycle-slide-active { z-index: 101 !important; } \ No newline at end of file diff --git a/app/templates/orbit_bootstrap/assets/stylesheets/template/modules/announcement.scss b/app/templates/orbit_bootstrap/assets/stylesheets/template/modules/announcement.scss index a5918d0..e9eeebb 100644 --- a/app/templates/orbit_bootstrap/assets/stylesheets/template/modules/announcement.scss +++ b/app/templates/orbit_bootstrap/assets/stylesheets/template/modules/announcement.scss @@ -1,380 +1,500 @@ @charset "utf-8"; + @import "../initial"; // // Widget -// +// // Announcement widget // ## Gerneral styles for widgets .w-annc { - .w-annc__widget-title { - @extend .unity-title; + .w-annc__widget-title { + @extend .unity-title; + } + + .w-annc__list { + margin: 0; + padding: 0; + list-style: none; + } + + .w-annc__item { + margin-bottom: 30px; + } + + .label { + font-size: 0.75rem; + font-weight: normal; + } + + .w-annc__meta { + .w-annc__status-wrap, + .w-annc__postdate-wrap, + .w-annc__category-wrap { + display: inline-block; + margin-right: 0.2em; + font-size: 0.8125em; + color: $theme-gray; + font-weight: normal; } - .w-annc__list { - margin: 0; - padding: 0; - list-style: none; + + i { + color: $theme-gray; } - .w-annc__item { - margin-bottom: 30px; - } - .label { - font-size: 0.75rem; - font-weight: normal; - } - .w-annc__meta { - .w-annc__status-wrap, - .w-annc__postdate-wrap, - .w-annc__category-wrap { - display: inline-block; - margin-right: 0.2em; - font-size: 0.8125em; - color: $theme-gray; - font-weight: normal; - } - i { - color: $theme-gray; - } - } - .status-top { - background: $theme-color-second; - } - .status-hot { - background: $theme-color-third; - } - .w-annc__subtitle { - font-size: 0.8125em; - color: $theme-gray; - } - .w-annc__entry-title { - margin-bottom: 10px; - } - .w-annc__title { - font-family: $sub-font; - color: $theme-color-main; - text-decoration: none; - font-size: 0.8125rem; - &:hover { - color: darken($theme-color-main, 10%); - } + } + + .status-top { + background: $theme-color-second; + } + + .status-hot { + background: $theme-color-third; + } + + .w-annc__subtitle { + font-size: 0.8125em; + color: $theme-gray; + } + + .w-annc__entry-title { + margin-bottom: 10px; + } + + .w-annc__title { + font-family: $sub-font; + color: $theme-color-main; + text-decoration: none; + font-size: 0.8125rem; + + &:hover { + color: darken($theme-color-main, 10%); } + } } // Widget-1 .widget-announcement-1 { - .w-annc__img-wrap { - height: 200px; - margin: 0 0 1em 0; - } - .w-annc__title { - font-family: $main-font; - line-height: 1.3; - font-size: 1.2rem; - } + .w-annc__img-wrap { + height: 200px; + margin: 0 0 1em 0; + } + + .w-annc__title { + font-family: $main-font; + line-height: 1.3; + font-size: 1.2rem; + } } // Widget-2 .widget-announcement-2 { - .w-annc__img-wrap { - height: 200px; - margin: 0 0 1em 0; - } - .w-annc__title { - font-family: $main-font; - line-height: 1.3; - font-size: 1.2rem; - } + .w-annc__img-wrap { + height: 200px; + margin: 0 0 1em 0; + } + + .w-annc__title { + font-family: $main-font; + line-height: 1.3; + font-size: 1.2rem; + } } // Widget-3 .widget-announcement-3 { - .w-annc__img-wrap { - height: 200px; - margin: 0 0 1em 0; - } - .w-annc__title { - font-family: $main-font; - line-height: 1.3; - font-size: 1.2rem; - } + .w-annc__img-wrap { + height: 200px; + margin: 0 0 1em 0; + } + + .w-annc__title { + font-family: $main-font; + line-height: 1.3; + font-size: 1.2rem; + } } // Widget-4 .widget-announcement-4 { - .w-annc__title { - font-family: $main-font; - line-height: 1.3; - font-size: 1.2rem; - } - .w-annc__list > .w-annc__item:nth-child(3n+1) { - clear: both; - } - .w-annc__img-wrap { - height: 200px; - margin: 0 0 1em 0; - } + .w-annc__title { + font-family: $main-font; + line-height: 1.3; + font-size: 1.2rem; + } + + .w-annc__list > .w-annc__item:nth-child(3n+1) { + clear: both; + } + + .w-annc__img-wrap { + height: 200px; + margin: 0 0 1em 0; + } } // Widget-5 .widget-announcement-5 { - .w-annc__title { - font-family: $main-font; - line-height: 1.3; - font-size: 1.2rem; - } - .w-annc__item { - border-bottom: 1px dashed lighten($theme-gray, 65%); - padding-bottom: 1em; - margin-bottom: 1em; - } + .w-annc__title { + font-family: $main-font; + line-height: 1.3; + font-size: 1.2rem; + } + + .w-annc__item { + border-bottom: 1px dashed lighten($theme-gray, 65%); + padding-bottom: 1em; + margin-bottom: 1em; + } } // Widget-6 .widget-announcement-6 { - .w-annc__item { - margin-bottom: 0.8em; - padding-bottom: 0.8em; - border-bottom: 1px dashed lighten($theme-gray, 65%); - } - .w-annc__entry-title { - margin: 0; - } - .w-annc__category-wrap, - .w-annc__status, - .w-annc__title, - .w-annc__postdate-wrap { - font-size: 0.8125rem; - } - .w-annc__status { - display: inline-block; - } + .w-annc__item { + margin-bottom: 0.8em; + padding-bottom: 0.8em; + border-bottom: 1px dashed lighten($theme-gray, 65%); + } + + .w-annc__entry-title { + margin: 0; + } + + .w-annc__category-wrap, + .w-annc__status, + .w-annc__title, + .w-annc__postdate-wrap { + font-size: 0.8125rem; + } + + .w-annc__status { + display: inline-block; + } } // Widget-7 .widget-announcement-7 { - .w-annc__item { - margin-bottom: 0.8em; - padding-bottom: 0.8em; - border-bottom: 1px dashed lighten($theme-gray, 65%); - } - .w-annc__entry-title { - margin: 0; - } - .w-annc__category-wrap, - .w-annc__status, - .w-annc__title, - .w-annc__postdate-wrap { - font-size: 0.75rem; - } - .w-annc__status { - display: inline-block; - } + .w-annc__item { + margin-bottom: 0.8em; + padding-bottom: 0.8em; + border-bottom: 1px dashed lighten($theme-gray, 65%); + } + + .w-annc__entry-title { + margin: 0; + } + + .w-annc__category-wrap, + .w-annc__status, + .w-annc__title, + .w-annc__postdate-wrap { + font-size: 0.75rem; + } + + .w-annc__status { + display: inline-block; + } } // Widget-8 // ## Table .widget-announcement-8 { - .w-annc__th { - color: #fff; - background: $theme-color-main; - font-size: 0.8125em; - border: none; - } - .w-annc__status { - display: inline-block; - font-size: 0.75rem; - } - td { - font-size: 0.8125em; - } - a:hover { - text-decoration: none; - } + .w-annc__th { + color: #fff; + background: $theme-color-main; + font-size: 0.8125em; + border: none; + } + + .w-annc__status { + display: inline-block; + font-size: 0.75rem; + } + + td { + font-size: 0.8125em; + } + + a:hover { + text-decoration: none; + } } // Widget-9 // ## Table .widget-announcement-9 { - .w-annc__th { - color: #fff; - background: $theme-color-main; - font-size: 0.8125em; - border: none; - } - .w-annc__status { - display: inline-block; - font-size: 0.75rem; - } - td { - font-size: 0.8125em; - } - a:hover { - text-decoration: none; - } + .w-annc__th { + color: #fff; + background: $theme-color-main; + font-size: 0.8125em; + border: none; + } + + .w-annc__status { + display: inline-block; + font-size: 0.75rem; + } + + td { + font-size: 0.8125em; + } + + a:hover { + text-decoration: none; + } } // Widget-10 .widget-announcement-10 { - .w-annc__item { - margin-bottom: 0.8em; - padding-bottom: 0.8em; - border-bottom: 1px dashed lighten($theme-gray, 65%); - } - .w-annc__entry-title { - margin: 0; - } - .w-annc__postdate-wrap { - font-size: 0.8125em; - } - .w-annc__status { - display: inline-block; - font-size: 0.75rem; - } + .w-annc__item { + margin-bottom: 0.8em; + padding-bottom: 0.8em; + border-bottom: 1px dashed lighten($theme-gray, 65%); + } + + .w-annc__entry-title { + margin: 0; + } + + .w-annc__postdate-wrap { + font-size: 0.8125em; + } + + .w-annc__status { + display: inline-block; + font-size: 0.75rem; + } } // Widget-11 -// ## Table .widget-announcement-11 { - .w-annc__th { - color: #fff; - background: $theme-color-main; - font-size: 0.8125em; - border: none; - } - .w-annc__status { - display: inline-block; - font-size: 0.75rem; - } - td { - font-size: 0.8125em; - } - a:hover { - text-decoration: none; - } + .w-annc__item { + margin-bottom: 0.8em; + padding-bottom: 0.8em; + border-bottom: 1px dashed lighten($theme-gray, 65%); + } + + .w-annc__entry-title { + margin: 0; + } + + .w-annc__postdate-wrap { + font-size: 0.8125em; + } + + .w-annc__status { + display: inline-block; + font-size: 0.75rem; + } } // Widget-12 +// ## Table .widget-announcement-12 { - .w-annc__list { - padding: 0 15px; + .w-annc__th { + color: #fff; + background: $theme-color-main; + font-size: 0.8125em; + border: none; + } + + .w-annc__status { + display: inline-block; + font-size: 0.75rem; + } + + td { + font-size: 0.8125em; + } + + a:hover { + text-decoration: none; + } +} + +// Widget-13 +// ## Table +.widget-announcement-13 { + .w-annc__th { + color: #fff; + background: $theme-color-main; + font-size: 0.8125em; + border: none; + } + + .w-annc__status { + display: inline-block; + font-size: 0.75rem; + } + + td { + font-size: 0.8125em; + } + + a:hover { + text-decoration: none; + } +} + +// Widget-14 +.widget-announcement-14 { + .w-annc__list { + padding: 0 15px; + } + + .w-annc__img-wrap { + height: 300px; + margin-bottom: 15px; + + @media (min-width: $screen-md) { + height: 200px; + margin-bottom: 0; } - .w-annc__img-wrap { - height: 300px; - margin-bottom: 15px; - @media (min-width: $screen-md) { - height: 200px; - margin-bottom: 0; - } - } - .w-annc__item { - margin-bottom: 0.8em; - padding-bottom: 0.8em; - border-bottom: 1px dashed lighten($theme-gray, 65%); - } - .w-annc__entry-title { - margin: 0 0 10px 0; - @media (min-width: $screen-md) { - margin-bottom: 0; - } - } - .w-annc__postdate-wrap { - font-size: 0.8125em; - } - .w-annc__status { - display: inline-block; - } - .w-annc__postdate { - font-size: 0.8125rem; + } + + .w-annc__item { + margin-bottom: 0.8em; + padding-bottom: 0.8em; + border-bottom: 1px dashed lighten($theme-gray, 65%); + } + + .w-annc__entry-title { + margin: 0 0 10px 0; + + @media (min-width: $screen-md) { + margin-bottom: 0; } + } + + .w-annc__postdate-wrap { + font-size: 0.8125em; + } + + .w-annc__status { + display: inline-block; + } + + .w-annc__postdate { + font-size: 0.8125rem; + } } // Announcement index // ## General style for index pages .i-annc { - .i-annc__page-title { - @extend .unity-title; + .i-annc__page-title { + @extend .unity-title; + } + + .i-annc__list { + margin: 0; + padding: 0; + list-style: none; + } + + .status-top { + background: $theme-color-second; + } + + .status-hot { + background: $theme-color-third; + } + + .i-annc__widget-title { + @extend .unity-title; + } + + .i-annc__item { + margin-bottom: 30px; + } + + .i-annc__img { + width: 100%; + max-width: 100%; + height: auto; + } + + .i-annc__th { + color: #fff; + background: $theme-color-main; + font-size: 0.8125em; + border: none; + white-space: nowrap; + } + + .i-annc__status-wrap { + span { + display: inline-block; + padding: .2em .6em .3em; + + &:last-child { + margin: 0 5px 3px 0; + display: inline-block; + } } - .i-annc__list { - margin: 0; - padding: 0; - list-style: none; + } + + td { + font-size: 0.8125rem; + } + + .i-annc__title:hover { + text-decoration: none; + } + + .label { + font-size: 0.75rem; + font-weight: normal; + } + + .i-annc__meta { + .i-annc__status-wrap, + .i-annc__postdate-wrap, + .i-annc__category-wrap { + display: inline-block; + margin-right: 0.2em; + font-size: 0.8125em; + color: $theme-gray; + font-weight: normal; } - .status-top { - background: $theme-color-second; + + i { + color: $theme-gray; } - .status-hot { - background: $theme-color-third; - } - .w-annc__widget-title { - @extend .unity-title; - } - .i-annc__item { - margin-bottom: 30px; - } - .i-annc__img { - width: 100%; - max-width: 100%; - height: auto; - } - .label { - font-size: 0.75rem; - font-weight: normal; - } - .i-annc__meta { - .i-annc__status-wrap, - .i-annc__postdate-wrap, - .i-annc__category-wrap { - display: inline-block; - margin-right: 0.2em; - font-size: 0.8125em; - color: $theme-gray; - font-weight: normal; - } - i { - color: $theme-gray; - } - } - .i-annc__subtitle { - font-size: 0.8125em; - color: $theme-gray; - } - .i-annc__entry-title { - margin-bottom: 10px; - } - .i-annc__title { - font-family: $sub-font; - color: $theme-color-main; - text-decoration: none; - font-size: 0.8125rem; - &:hover { - color: darken($theme-color-main, 10%); - } + } + + .i-annc__subtitle { + font-size: 0.8125em; + color: $theme-gray; + } + + .i-annc__entry-title { + margin-bottom: 10px; + } + + .i-annc__title { + font-family: $sub-font; + color: $theme-color-main; + text-decoration: none; + font-size: 0.8125rem; + + &:hover { + color: darken($theme-color-main, 10%); } + } } // Index-1 -.index-announcement-1 { - .i-annc__th { - color: #fff; - background: $theme-color-main; - font-size: 0.8125em; - border: none; - } - td { - font-size: 0.8125rem; - } - .i-annc__title:hover { - text-decoration: none; - } -} +.index-announcement-1 {} -// Index-2 -.index-announcement-2, -.index-announcement-3 { +// Index-5 +// Index-6 +.index-announcement-5, +.index-announcement-6 { .i-annc__img-wrap { margin: 0 0 1em; } + .i-annc__title { font-family: $main-font; font-size: 1.2rem; @@ -382,73 +502,177 @@ } } +// Index-7 +.index-announcement-7 { + .i-annc__title { + font-family: $main-font; + line-height: 1.3; + font-size: 1.2rem; + } + + .i-annc__list > .i-annc__item:nth-child(3n+1) { + clear: both; + } + + .i-annc__img-wrap { + height: 200px; + margin: 0 0 1em 0; + } +} + +// Index-8 +.index-announcement-8 { + .i-annc__title { + font-family: $main-font; + line-height: 1.3; + font-size: 1.2rem; + } + + .i-annc__item { + border-bottom: 1px dashed lighten($theme-gray, 65%); + padding-bottom: 1em; + margin-bottom: 1em; + } +} + +// Index-9 +// Index-10 +.index-announcement-9, +.index-announcement-10 { + .i-annc__item { + margin-bottom: 0.8em; + padding-bottom: 0.8em; + border-bottom: 1px dashed lighten($theme-gray, 65%); + } + + .i-annc__entry-title { + margin: 0; + } + + .i-annc__category-wrap, + .i-annc__status, + .i-annc__title, + .i-annc__postdate-wrap { + font-size: 0.8125rem; + } + + .i-annc__status { + display: inline-block; + } +} + + +// Index-11 +// Index-12 +.index-announcement-11, +.index-announcement-12 { + .i-annc__item { + margin-bottom: 0.8em; + padding-bottom: 0.8em; + border-bottom: 1px dashed lighten($theme-gray, 65%); + } + + .i-annc__entry-title { + margin: 0; + } + + .i-annc__postdate-wrap { + font-size: 0.8125em; + } + + .i-annc__status { + display: inline-block; + font-size: 0.75rem; + } +} + +// Index-16 +.index-announcement-16 { + td ul { + margin: 0; + padding: 0; + list-style: none; + } +} + // Announcement show .s-annc { - .s-annc__show-title { - @extend .unity-title; - } - .s-annc__meta-wrap { - border-bottom: 1px solid $theme-gray-light; - @include clearfix; - .s-annc__meta--item { - font-size: 0.875rem; - margin-right: 1em; - margin-bottom: 0.6em; - float: left; - i { - color: darken($theme-gray-light, 10%); - } - } - .s-annc__tag-wrap { - position: relative; - margin-right: 0; - padding-left: 1.6em; - clear: both; - float: none; - i { - position: absolute; - top: 7px; - left: 0; - } - } - .s-annc__tag-wrap { - .s-annc__tag { - font-weight: normal; - } - } - } - .s-annc__post-wrap { - @include clearfix; - margin-bottom: 2em; - } - .s-annc__related-wrap { - padding-top: 1em; - border-top: 1px dotted $theme-gray-light; - } - .s-annc__related-file { - margin-bottom: 15px; - } - .s-annc__related-file, - .s-annc__related-link { - padding-bottom: 6px; - padding-left: 1.6em; - i { - margin: 8px 0 0 -1.6em; - float: left; - color: darken($theme-gray-light, 10%); - } - a { + .s-annc__show-title { + @extend .unity-title; + } - } + .s-annc__meta-wrap { + border-bottom: 1px solid $theme-gray-light; + @include clearfix; + + .s-annc__meta--item { + font-size: 0.875rem; + margin-right: 1em; + margin-bottom: 0.6em; + float: left; + + i { + color: darken($theme-gray-light, 10%); + } } - .s-annc__related-link-list, - .s-annc__related-file-list { - display: inline-block; + + .s-annc__tag-wrap { + position: relative; + margin-right: 0; + padding-left: 1.6em; + clear: both; + float: none; + + i { + position: absolute; + top: 7px; + left: 0; + } } - .s-annc__flie-title { - max-width: 9.375rem; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; + + .s-annc__tag-wrap { + .s-annc__tag { + font-weight: normal; + } } + } + + .s-annc__post-wrap { + @include clearfix; + margin-bottom: 2em; + } + + .s-annc__related-wrap { + padding-top: 1em; + border-top: 1px dotted $theme-gray-light; + } + + .s-annc__related-file { + margin-bottom: 15px; + } + + .s-annc__related-file, + .s-annc__related-link { + padding-bottom: 6px; + padding-left: 1.6em; + + i { + margin: 8px 0 0 -1.6em; + float: left; + color: darken($theme-gray-light, 10%); + } + a {} + } + + .s-annc__related-link-list, + .s-annc__related-file-list { + display: inline-block; + } + + .s-annc__flie-title { + max-width: 9.375rem; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } } \ No newline at end of file diff --git a/app/templates/orbit_bootstrap/assets/stylesheets/template/modules/member.scss b/app/templates/orbit_bootstrap/assets/stylesheets/template/modules/member.scss index 9d084b3..a35a63c 100644 --- a/app/templates/orbit_bootstrap/assets/stylesheets/template/modules/member.scss +++ b/app/templates/orbit_bootstrap/assets/stylesheets/template/modules/member.scss @@ -1,64 +1,126 @@ @charset "utf-8"; + @import "../initial"; -// Member index page -.index-member { - .index-title { - @extend .unity-title; - } - th, - td { - font-family: $sub-font; - font-size: .8125rem; - } - th[class^="member-data-title"] { - white-space: nowrap; - } - .index-member-item { - min-height: 200px; - margin-bottom: 20px; - } - .index-member-item:nth-child(2n+1) { - clear: both; - } - .member-data-title-job-title:before, - .member-data-title-name:before, - .member-data-title-email:before, - .member-data-title-office-tel:before { - font-family: "fontAwesome"; - font-size: .75rem; - display: inline-block; - min-width: 15px; - margin-right: .3125rem; - content: "\f007"; - color: gray; - } - .member-data-title-job-title:before { - content: "\f19d"; - } - .member-data-title-email:before { - content: "\f0e0"; - } - .member-data-title-office-tel:before { - content: "\f098"; - } - .member-profile-data-wrap { - overflow: hidden; - } - .member-pic { - border-radius: .25rem; - } -} -// Member show page -.show-member { - font-family: $sub-font; - th, td { - font-size: .8125rem; - } - .member-plugins { - margin-bottom: 20px; - a { - font-size: .8125rem; +// +// Index +// +// Member Index +// ## Gerneral styles for Index +// Index 2 +.index-member-2 { + .i-member-section { + max-width: 500px; + margin: auto; + } + .i-member-status-title { + @extend .unity-title; + } + .i-member-item-inner { + background: none; + border-radius: 0.25rem; + padding: 24px 1rem; + margin-bottom: 16px; + } + .i-member-pic-wrap { + height: auto; + margin-bottom: 16px; + } + .i-member-pic { + width: 100%; + } + .i-member-profile-list { + @include list-reset; + } + .i-member-profile-item { + margin-bottom: 8px; + font-size: $font-13; + } + // RWD + @media screen and (min-width: $screen-sm) { + .i-member-section { + max-width: 100%; + } + .i-member-item-inner { + background: $theme-gray-lighter; + } } - } } + +// // Index 3 +.index-member-3 { + .i-member-section { + max-width: 500px; + margin: auto; + } + .i-member-status-title { + @extend .unity-title; + } + .i-member-item-inner { + background: none; + border-radius: 0.25rem; + padding: 24px 1rem; + margin-bottom: 16px; + } + .i-member-pic-wrap { + height: auto; + margin-bottom: 16px; + } + .i-member-pic { + width: 100%; + } + .i-member-profile-list { + @include list-reset; + } + .i-member-profile-item { + margin-bottom: 8px; + font-size: $font-13; + } + .i-member-item:nth-child(odd) { + clear: both; + } + .i-member-item-inner {} + .i-member-pic-wrap { + padding: 0; + } + // RWD + @media screen and (min-width: $screen-sm) { + .i-member-section { + max-width: 100%; + } + .i-member-item-inner { + background: $theme-gray-lighter; + } + + } + @media screen and (min-width: $screen-md) { + .i-member-pic-wrap { + position: relative; + overflow: hidden; + height: 125px; + } + .i-member-pic { + position: absolute; + top: -100%; + left: 0; + right: 0; + bottom: -100%; + margin: auto; + width: 100%; + } + } +} + +// Show page +.show-member { + font-family: $sub-font; + th, td { + font-size: .8125rem; + } + .member-plugins { + margin-bottom: 20px; + a { + font-size: .8125rem; + } + } +} \ No newline at end of file diff --git a/app/templates/orbit_bootstrap/assets/stylesheets/template/template.scss b/app/templates/orbit_bootstrap/assets/stylesheets/template/template.scss index 006f71d..ef7c34f 100644 --- a/app/templates/orbit_bootstrap/assets/stylesheets/template/template.scss +++ b/app/templates/orbit_bootstrap/assets/stylesheets/template/template.scss @@ -1,3 +1,5 @@ +@import url("http://fonts.googleapis.com/css?family=Droid+Sans:400,700"); + // Base @import "base/pagination"; @import "base/orbitbar-override"; diff --git a/app/templates/orbit_bootstrap/modules/ad_banner/_ad_banner_widget1.html.erb b/app/templates/orbit_bootstrap/modules/ad_banner/_ad_banner_widget1.html.erb index 31c154f..867eeb4 100644 --- a/app/templates/orbit_bootstrap/modules/ad_banner/_ad_banner_widget1.html.erb +++ b/app/templates/orbit_bootstrap/modules/ad_banner/_ad_banner_widget1.html.erb @@ -5,7 +5,7 @@ data-cycle-slides=".w-ad-banner__slide" data-cycle-log="false" data-overlay=".w-ad-banner__caption" - data-pager=".w-ad-banner__pager" + data-pager=".w-ad-banner__pager-1" data-pager-template="
  • " data-pager-active-class="active-slide" > @@ -15,11 +15,11 @@ data-cycle-desc="{{context}}" data-overlay-template="

    {{title}}

    {{desc}}" > - +
    - + diff --git a/app/templates/orbit_bootstrap/modules/ad_banner/_ad_banner_widget2.html.erb b/app/templates/orbit_bootstrap/modules/ad_banner/_ad_banner_widget2.html.erb index 842ebc3..b820dbd 100644 --- a/app/templates/orbit_bootstrap/modules/ad_banner/_ad_banner_widget2.html.erb +++ b/app/templates/orbit_bootstrap/modules/ad_banner/_ad_banner_widget2.html.erb @@ -1,4 +1,4 @@ -
    +
    -
      +
      \ No newline at end of file diff --git a/app/templates/orbit_bootstrap/modules/ad_banner/_ad_banner_widget3.html.erb b/app/templates/orbit_bootstrap/modules/ad_banner/_ad_banner_widget3.html.erb index 0524e45..abf99db 100644 --- a/app/templates/orbit_bootstrap/modules/ad_banner/_ad_banner_widget3.html.erb +++ b/app/templates/orbit_bootstrap/modules/ad_banner/_ad_banner_widget3.html.erb @@ -4,16 +4,19 @@ data-level="0" data-cycle-slides=".w-ad-banner__slide" data-cycle-log="false" - data-pager=".w-ad-banner__pager" + data-pager=".w-ad-banner__pager-3" data-pager-template="
    • " data-pager-active-class="active-slide" >
      - +
      - +
      diff --git a/app/templates/orbit_bootstrap/modules/ad_banner/_ad_banner_widget4.html.erb b/app/templates/orbit_bootstrap/modules/ad_banner/_ad_banner_widget4.html.erb new file mode 100644 index 0000000..088cce7 --- /dev/null +++ b/app/templates/orbit_bootstrap/modules/ad_banner/_ad_banner_widget4.html.erb @@ -0,0 +1,15 @@ +
      +
      +
      + +
      +
      +
      + diff --git a/app/templates/orbit_bootstrap/modules/ad_banner/info.json b/app/templates/orbit_bootstrap/modules/ad_banner/info.json index b1a540b..8b460b0 100644 --- a/app/templates/orbit_bootstrap/modules/ad_banner/info.json +++ b/app/templates/orbit_bootstrap/modules/ad_banner/info.json @@ -19,8 +19,8 @@ { "filename" : "ad_banner_widget3", "name" : { - "zh_tw" : "3. 廣告輪播 ( 圖片 )", - "en" : "3. AD banner ( image )" + "zh_tw" : "3. 橫幅輪播 ( 圖片, 導航圖示 )", + "en" : "3. Carousel ( image, navigation )" }, "thumbnail" : "thumbnail-block.png" }, diff --git a/app/templates/orbit_bootstrap/modules/announcement/_admission_widget1.html.erb b/app/templates/orbit_bootstrap/modules/announcement/_admission_widget1.html.erb deleted file mode 100644 index b762ccc..0000000 --- a/app/templates/orbit_bootstrap/modules/announcement/_admission_widget1.html.erb +++ /dev/null @@ -1,24 +0,0 @@ -
      -

      - {{widget-title}} -

      - - - - - - - - - - - - - -
      {{category-head}}{{title-head}}
      {{category}} - - {{status}} - - {{title}} -
      -
      diff --git a/app/templates/orbit_bootstrap/modules/announcement/_annc_widget11.html.erb b/app/templates/orbit_bootstrap/modules/announcement/_annc_widget11.html.erb index dcbe3e5..16d806e 100644 --- a/app/templates/orbit_bootstrap/modules/announcement/_annc_widget11.html.erb +++ b/app/templates/orbit_bootstrap/modules/announcement/_annc_widget11.html.erb @@ -1,24 +1,19 @@ -
      +

      {{widget-title}}

      - - - - - - - - - - - - - -
      {{title-head}}{{date-head}}
      - - {{status}} - - {{title}} -
      -
      \ No newline at end of file + +
      diff --git a/app/templates/orbit_bootstrap/modules/announcement/_annc_widget12.html.erb b/app/templates/orbit_bootstrap/modules/announcement/_annc_widget12.html.erb index 07bdcc2..4504ea6 100644 --- a/app/templates/orbit_bootstrap/modules/announcement/_annc_widget12.html.erb +++ b/app/templates/orbit_bootstrap/modules/announcement/_annc_widget12.html.erb @@ -2,26 +2,23 @@

      {{widget-title}}

      -
      -
      - {{main_picture_description}} -
      -