Merge branch 'nccu_0509' of https://github.com/Rulingcom/orbit into nccu_0509
Conflicts: config/locales/zh_tw.yml
This commit is contained in:
		
						commit
						2cd67356a5
					
				
							
								
								
									
										2
									
								
								Gemfile
								
								
								
								
							
							
						
						
									
										2
									
								
								Gemfile
								
								
								
								
							|  | @ -10,11 +10,13 @@ gem 'devise', '1.5.3' | ||||||
| gem 'exception_notification' # Send error trace | gem 'exception_notification' # Send error trace | ||||||
| gem 'execjs' | gem 'execjs' | ||||||
| gem 'jquery-rails' | gem 'jquery-rails' | ||||||
|  | gem 'jquery-ui-rails' | ||||||
| 
 | 
 | ||||||
| gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git' | gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git' | ||||||
| 
 | 
 | ||||||
| gem 'mini_magick' | gem 'mini_magick' | ||||||
| gem 'mongoid' | gem 'mongoid' | ||||||
|  | gem 'mongoid-tree', :require => 'mongoid/tree' | ||||||
| gem "mongo_session_store-rails3" | gem "mongo_session_store-rails3" | ||||||
| gem 'nokogiri' | gem 'nokogiri' | ||||||
| gem 'radius' | gem 'radius' | ||||||
|  |  | ||||||
|  | @ -96,6 +96,9 @@ GEM | ||||||
|     jquery-rails (1.0.19) |     jquery-rails (1.0.19) | ||||||
|       railties (~> 3.0) |       railties (~> 3.0) | ||||||
|       thor (~> 0.14) |       thor (~> 0.14) | ||||||
|  |     jquery-ui-rails (0.4.0) | ||||||
|  |       jquery-rails | ||||||
|  |       railties (>= 3.1.0) | ||||||
|     json (1.6.5) |     json (1.6.5) | ||||||
|     linecache19 (0.5.12) |     linecache19 (0.5.12) | ||||||
|       ruby_core_source (>= 0.1.4) |       ruby_core_source (>= 0.1.4) | ||||||
|  | @ -115,6 +118,8 @@ GEM | ||||||
|       activemodel (~> 3.1) |       activemodel (~> 3.1) | ||||||
|       mongo (~> 1.3) |       mongo (~> 1.3) | ||||||
|       tzinfo (~> 0.3.22) |       tzinfo (~> 0.3.22) | ||||||
|  |     mongoid-tree (0.7.0) | ||||||
|  |       mongoid (~> 2.0) | ||||||
|     multi_json (1.1.0) |     multi_json (1.1.0) | ||||||
|     nokogiri (1.5.2) |     nokogiri (1.5.2) | ||||||
|     nokogiri (1.5.2-x86-mingw32) |     nokogiri (1.5.2-x86-mingw32) | ||||||
|  | @ -269,10 +274,12 @@ DEPENDENCIES | ||||||
|   execjs |   execjs | ||||||
|   factory_girl_rails |   factory_girl_rails | ||||||
|   jquery-rails |   jquery-rails | ||||||
|  |   jquery-ui-rails | ||||||
|   kaminari! |   kaminari! | ||||||
|   mini_magick |   mini_magick | ||||||
|   mongo_session_store-rails3 |   mongo_session_store-rails3 | ||||||
|   mongoid |   mongoid | ||||||
|  |   mongoid-tree | ||||||
|   nokogiri |   nokogiri | ||||||
|   radius |   radius | ||||||
|   rails (>= 3.1.0, < 3.2.0) |   rails (>= 3.1.0, < 3.2.0) | ||||||
|  |  | ||||||
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 2.9 KiB | 
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB | 
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB | 
|  | @ -0,0 +1,391 @@ | ||||||
|  | /* | ||||||
|  |  * jQuery UI Nested Sortable | ||||||
|  |  * v 1.3.4 / 28 apr 2011 | ||||||
|  |  * http://mjsarfatti.com/sandbox/nestedSortable
 | ||||||
|  |  * | ||||||
|  |  * Depends: | ||||||
|  |  *	 jquery.ui.sortable.js 1.8+ | ||||||
|  |  * | ||||||
|  |  * License CC BY-SA 3.0 | ||||||
|  |  * Copyright 2010-2011, Manuele J Sarfatti | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | (function($) { | ||||||
|  | 
 | ||||||
|  | 	$.widget("ui.nestedSortable", $.extend({}, $.ui.sortable.prototype, { | ||||||
|  | 
 | ||||||
|  | 		options: { | ||||||
|  | 			tabSize: 20, | ||||||
|  | 			disableNesting: 'ui-nestedSortable-no-nesting', | ||||||
|  | 			errorClass: 'ui-nestedSortable-error', | ||||||
|  | 			listType: 'ol', | ||||||
|  | 			maxLevels: 0, | ||||||
|  | 			revertOnError: 1 | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		_create: function() { | ||||||
|  | 			this.element.data('sortable', this.element.data('nestedSortable')); | ||||||
|  | 			return $.ui.sortable.prototype._create.apply(this, arguments); | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		destroy: function() { | ||||||
|  | 			this.element | ||||||
|  | 				.removeData("nestedSortable") | ||||||
|  | 				.unbind(".nestedSortable"); | ||||||
|  | 			return $.ui.sortable.prototype.destroy.apply(this, arguments); | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		_mouseDrag: function(event) { | ||||||
|  | 
 | ||||||
|  | 			//Compute the helpers position
 | ||||||
|  | 			this.position = this._generatePosition(event); | ||||||
|  | 			this.positionAbs = this._convertPositionTo("absolute"); | ||||||
|  | 
 | ||||||
|  | 			if (!this.lastPositionAbs) { | ||||||
|  | 				this.lastPositionAbs = this.positionAbs; | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			//Do scrolling
 | ||||||
|  | 			if(this.options.scroll) { | ||||||
|  | 				var o = this.options, scrolled = false; | ||||||
|  | 				if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') { | ||||||
|  | 
 | ||||||
|  | 					if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) | ||||||
|  | 						this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; | ||||||
|  | 					else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) | ||||||
|  | 						this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; | ||||||
|  | 
 | ||||||
|  | 					if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) | ||||||
|  | 						this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed; | ||||||
|  | 					else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) | ||||||
|  | 						this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed; | ||||||
|  | 
 | ||||||
|  | 				} else { | ||||||
|  | 
 | ||||||
|  | 					if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) | ||||||
|  | 						scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); | ||||||
|  | 					else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) | ||||||
|  | 						scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); | ||||||
|  | 
 | ||||||
|  | 					if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) | ||||||
|  | 						scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); | ||||||
|  | 					else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) | ||||||
|  | 						scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); | ||||||
|  | 
 | ||||||
|  | 				} | ||||||
|  | 
 | ||||||
|  | 				if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) | ||||||
|  | 					$.ui.ddmanager.prepareOffsets(this, event); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			//Regenerate the absolute position used for position checks
 | ||||||
|  | 			this.positionAbs = this._convertPositionTo("absolute"); | ||||||
|  | 
 | ||||||
|  | 			//Set the helper position
 | ||||||
|  | 			if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; | ||||||
|  | 			if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; | ||||||
|  | 
 | ||||||
|  | 			//Rearrange
 | ||||||
|  | 			for (var i = this.items.length - 1; i >= 0; i--) { | ||||||
|  | 
 | ||||||
|  | 				//Cache variables and intersection, continue if no intersection
 | ||||||
|  | 				var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item); | ||||||
|  | 				if (!intersection) continue; | ||||||
|  | 
 | ||||||
|  | 				if(itemElement != this.currentItem[0] //cannot intersect with itself
 | ||||||
|  | 					&&	this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
 | ||||||
|  | 					&&	!$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
 | ||||||
|  | 					&& (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true) | ||||||
|  | 					//&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
 | ||||||
|  | 				) { | ||||||
|  | 
 | ||||||
|  | 					$(itemElement).mouseenter(); | ||||||
|  | 
 | ||||||
|  | 					this.direction = intersection == 1 ? "down" : "up"; | ||||||
|  | 
 | ||||||
|  | 					if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) { | ||||||
|  | 						$(itemElement).mouseleave(); | ||||||
|  | 						this._rearrange(event, item); | ||||||
|  | 					} else { | ||||||
|  | 						break; | ||||||
|  | 					} | ||||||
|  | 
 | ||||||
|  | 					// Clear emtpy ul's/ol's
 | ||||||
|  | 					this._clearEmpty(itemElement); | ||||||
|  | 
 | ||||||
|  | 					this._trigger("change", event, this._uiHash()); | ||||||
|  | 					break; | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			var parentItem = (this.placeholder[0].parentNode.parentNode | ||||||
|  | 				       && $(this.placeholder[0].parentNode.parentNode).closest('.ui-sortable').length) | ||||||
|  | 				       ? $(this.placeholder[0].parentNode.parentNode) | ||||||
|  | 				       : null, | ||||||
|  | 			    level = this._getLevel(this.placeholder), | ||||||
|  | 			    childLevels = this._getChildLevels(this.helper), | ||||||
|  | 			    previousItem = this.placeholder[0].previousSibling ? $(this.placeholder[0].previousSibling) : null; | ||||||
|  | 
 | ||||||
|  | 			if (previousItem != null) { | ||||||
|  | 				while (previousItem[0].nodeName.toLowerCase() != 'li' || previousItem[0] == this.currentItem[0]) { | ||||||
|  | 					if (previousItem[0].previousSibling) { | ||||||
|  | 						previousItem = $(previousItem[0].previousSibling); | ||||||
|  | 					} else { | ||||||
|  | 						previousItem = null; | ||||||
|  | 						break; | ||||||
|  | 					} | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			newList = document.createElement(o.listType); | ||||||
|  | 
 | ||||||
|  | 			this.beyondMaxLevels = 0; | ||||||
|  | 
 | ||||||
|  | 			// If the item is moved to the left, send it to its parent level
 | ||||||
|  | 			if (parentItem != null && this.positionAbs.left < parentItem.offset().left) { | ||||||
|  | 				parentItem.after(this.placeholder[0]); | ||||||
|  | 				this._clearEmpty(parentItem[0]); | ||||||
|  | 				this._trigger("change", event, this._uiHash()); | ||||||
|  | 			} | ||||||
|  | 			// If the item is below another one and is moved to the right, make it a children of it
 | ||||||
|  | 			else if (previousItem != null && this.positionAbs.left > previousItem.offset().left + o.tabSize) { | ||||||
|  | 				this._isAllowed(previousItem, level+childLevels+1); | ||||||
|  | 				if (!previousItem.children(o.listType).length) { | ||||||
|  | 					previousItem[0].appendChild(newList); | ||||||
|  | 				} | ||||||
|  | 				previousItem.children(o.listType)[0].appendChild(this.placeholder[0]); | ||||||
|  | 				this._trigger("change", event, this._uiHash()); | ||||||
|  | 			} | ||||||
|  | 			else { | ||||||
|  | 				this._isAllowed(parentItem, level+childLevels); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			//Post events to containers
 | ||||||
|  | 			this._contactContainers(event); | ||||||
|  | 
 | ||||||
|  | 			//Interconnect with droppables
 | ||||||
|  | 			if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); | ||||||
|  | 
 | ||||||
|  | 			//Call callbacks
 | ||||||
|  | 			this._trigger('sort', event, this._uiHash()); | ||||||
|  | 
 | ||||||
|  | 			this.lastPositionAbs = this.positionAbs; | ||||||
|  | 			return false; | ||||||
|  | 
 | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		_mouseStop: function(event, noPropagation) { | ||||||
|  | 
 | ||||||
|  | 			// If the item is in a position not allowed, send it back
 | ||||||
|  | 			if (this.beyondMaxLevels) { | ||||||
|  | 
 | ||||||
|  | 				this.placeholder.removeClass(this.options.errorClass); | ||||||
|  | 
 | ||||||
|  | 				if (this.options.revertOnError) { | ||||||
|  | 					if (this.domPosition.prev) { | ||||||
|  | 						$(this.domPosition.prev).after(this.placeholder); | ||||||
|  | 					} else { | ||||||
|  | 						$(this.domPosition.parent).prepend(this.placeholder); | ||||||
|  | 					} | ||||||
|  | 					this._trigger("revert", event, this._uiHash()); | ||||||
|  | 				} else { | ||||||
|  | 					var parent = this.placeholder.parent().closest(this.options.items); | ||||||
|  | 
 | ||||||
|  | 					for (var i = this.beyondMaxLevels - 1; i > 0; i--) { | ||||||
|  | 						parent = parent.parent().closest(this.options.items); | ||||||
|  | 					} | ||||||
|  | 
 | ||||||
|  | 					parent.after(this.placeholder); | ||||||
|  | 					this._trigger("change", event, this._uiHash()); | ||||||
|  | 				} | ||||||
|  | 
 | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			// Clean last empty ul/ol
 | ||||||
|  | 			for (var i = this.items.length - 1; i >= 0; i--) { | ||||||
|  | 				var item = this.items[i].item[0]; | ||||||
|  | 				this._clearEmpty(item); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			$.ui.sortable.prototype._mouseStop.apply(this, arguments); | ||||||
|  | 
 | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		serialize: function(o) { | ||||||
|  | 
 | ||||||
|  | 			var items = this._getItemsAsjQuery(o && o.connected), | ||||||
|  | 			    str = []; o = o || {}; | ||||||
|  | 
 | ||||||
|  | 			$(items).each(function() { | ||||||
|  | 				var res = ($(o.item || this).attr(o.attribute || 'id') || '') | ||||||
|  | 						.match(o.expression || (/(.+)[-=_](.+)/)), | ||||||
|  | 				    pid = ($(o.item || this).parent(o.listType) | ||||||
|  | 						.parent('li') | ||||||
|  | 						.attr(o.attribute || 'id') || '') | ||||||
|  | 						.match(o.expression || (/(.+)[-=_](.+)/)); | ||||||
|  | 
 | ||||||
|  | 				if (res) { | ||||||
|  | 					str.push(((o.key || res[1]) + '[' + (o.key && o.expression ? res[1] : res[2]) + ']') | ||||||
|  | 						+ '=' | ||||||
|  | 						+ (pid ? (o.key && o.expression ? pid[1] : pid[2]) : 'root')); | ||||||
|  | 				} | ||||||
|  | 			}); | ||||||
|  | 
 | ||||||
|  | 			if(!str.length && o.key) { | ||||||
|  | 				str.push(o.key + '='); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			return str.join('&'); | ||||||
|  | 
 | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		toHierarchy: function(o) { | ||||||
|  | 
 | ||||||
|  | 			o = o || {}; | ||||||
|  | 			var sDepth = o.startDepthCount || 0, | ||||||
|  | 			    ret = []; | ||||||
|  | 
 | ||||||
|  | 			$(this.element).children('li').each(function () { | ||||||
|  | 				var level = _recursiveItems($(this)); | ||||||
|  | 				ret.push(level); | ||||||
|  | 			}); | ||||||
|  | 
 | ||||||
|  | 			return ret; | ||||||
|  | 
 | ||||||
|  | 			function _recursiveItems(li) { | ||||||
|  | 				var id = ($(li).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/)); | ||||||
|  | 				if (id) { | ||||||
|  | 					var item = {"id" : id[2]}; | ||||||
|  | 					if ($(li).children(o.listType).children('li').length > 0) { | ||||||
|  | 						item.children = []; | ||||||
|  | 						$(li).children(o.listType).children('li').each(function() { | ||||||
|  | 							var level = _recursiveItems($(this)); | ||||||
|  | 							item.children.push(level); | ||||||
|  | 						}); | ||||||
|  | 					} | ||||||
|  | 					return item; | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		toArray: function(o) { | ||||||
|  | 
 | ||||||
|  | 			o = o || {}; | ||||||
|  | 			var sDepth = o.startDepthCount || 0, | ||||||
|  | 			    ret = [], | ||||||
|  | 			    left = 2; | ||||||
|  | 
 | ||||||
|  | 			ret.push({ | ||||||
|  | 				"item_id": 'root', | ||||||
|  | 				"parent_id": 'none', | ||||||
|  | 				"depth": sDepth, | ||||||
|  | 				"left": '1', | ||||||
|  | 				"right": ($('li', this.element).length + 1) * 2 | ||||||
|  | 			}); | ||||||
|  | 
 | ||||||
|  | 			$(this.element).children('li').each(function () { | ||||||
|  | 				left = _recursiveArray(this, sDepth + 1, left); | ||||||
|  | 			}); | ||||||
|  | 
 | ||||||
|  | 			ret = ret.sort(function(a,b){ return (a.left - b.left); }); | ||||||
|  | 
 | ||||||
|  | 			return ret; | ||||||
|  | 
 | ||||||
|  | 			function _recursiveArray(item, depth, left) { | ||||||
|  | 
 | ||||||
|  | 				var right = left + 1, | ||||||
|  | 				    id, | ||||||
|  | 				    pid; | ||||||
|  | 
 | ||||||
|  | 				if ($(item).children(o.listType).children('li').length > 0) { | ||||||
|  | 					depth ++; | ||||||
|  | 					$(item).children(o.listType).children('li').each(function () { | ||||||
|  | 						right = _recursiveArray($(this), depth, right); | ||||||
|  | 					}); | ||||||
|  | 					depth --; | ||||||
|  | 				} | ||||||
|  | 
 | ||||||
|  | 				id = ($(item).attr(o.attribute || 'id')).match(o.expression || (/(.+)[-=_](.+)/)); | ||||||
|  | 
 | ||||||
|  | 				if (depth === sDepth + 1) { | ||||||
|  | 					pid = 'root'; | ||||||
|  | 				} else { | ||||||
|  | 					var parentItem = ($(item).parent(o.listType) | ||||||
|  | 						.parent('li') | ||||||
|  | 						.attr(o.attribute || 'id')) | ||||||
|  | 						.match(o.expression || (/(.+)[-=_](.+)/)); | ||||||
|  | 					pid = parentItem[2]; | ||||||
|  | 				} | ||||||
|  | 
 | ||||||
|  | 				if (id) { | ||||||
|  | 						ret.push({"item_id": id[2], "parent_id": pid, "depth": depth, "left": left, "right": right}); | ||||||
|  | 				} | ||||||
|  | 
 | ||||||
|  | 				left = right + 1; | ||||||
|  | 				return left; | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		_clearEmpty: function(item) { | ||||||
|  | 
 | ||||||
|  | 			var emptyList = $(item).children(this.options.listType); | ||||||
|  | 			if (emptyList.length && !emptyList.children().length) { | ||||||
|  | 				emptyList.remove(); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		_getLevel: function(item) { | ||||||
|  | 
 | ||||||
|  | 			var level = 1; | ||||||
|  | 
 | ||||||
|  | 			if (this.options.listType) { | ||||||
|  | 				var list = item.closest(this.options.listType); | ||||||
|  | 				while (!list.is('.ui-sortable')) { | ||||||
|  | 					level++; | ||||||
|  | 					list = list.parent().closest(this.options.listType); | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			return level; | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		_getChildLevels: function(parent, depth) { | ||||||
|  | 			var self = this, | ||||||
|  | 			    o = this.options, | ||||||
|  | 			    result = 0; | ||||||
|  | 			depth = depth || 0; | ||||||
|  | 
 | ||||||
|  | 			$(parent).children(o.listType).children(o.items).each(function (index, child) { | ||||||
|  | 					result = Math.max(self._getChildLevels(child, depth + 1), result); | ||||||
|  | 			}); | ||||||
|  | 
 | ||||||
|  | 			return depth ? result + 1 : result; | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		_isAllowed: function(parentItem, levels) { | ||||||
|  | 			var o = this.options; | ||||||
|  | 			// Are we trying to nest under a no-nest or are we nesting too deep?
 | ||||||
|  | 			if (parentItem == null || !(parentItem.hasClass(o.disableNesting))) { | ||||||
|  | 				if (o.maxLevels < levels && o.maxLevels != 0) { | ||||||
|  | 					this.placeholder.addClass(o.errorClass); | ||||||
|  | 					this.beyondMaxLevels = levels - o.maxLevels; | ||||||
|  | 				} else { | ||||||
|  | 					this.placeholder.removeClass(o.errorClass); | ||||||
|  | 					this.beyondMaxLevels = 0; | ||||||
|  | 				} | ||||||
|  | 			} else { | ||||||
|  | 				this.placeholder.addClass(o.errorClass); | ||||||
|  | 				if (o.maxLevels < levels && o.maxLevels != 0) { | ||||||
|  | 					this.beyondMaxLevels = levels - o.maxLevels; | ||||||
|  | 				} else { | ||||||
|  | 					this.beyondMaxLevels = 1; | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 	})); | ||||||
|  | 
 | ||||||
|  | 	$.ui.nestedSortable.prototype.options = $.extend({}, $.ui.sortable.prototype.options, $.ui.nestedSortable.prototype.options); | ||||||
|  | })(jQuery); | ||||||
|  | @ -6,4 +6,3 @@ | ||||||
| // | // | ||||||
| //= require jquery | //= require jquery | ||||||
| //= require jquery_ujs | //= require jquery_ujs | ||||||
| //= require news_link |  | ||||||
|  | @ -32,3 +32,24 @@ $('.part_kind').live('click', function() { | ||||||
| 	$('.part_kind_partial').hide(); | 	$('.part_kind_partial').hide(); | ||||||
| 	$('#part_' + $(this).attr('value')).show(); | 	$('#part_' + $(this).attr('value')).show(); | ||||||
| }); | }); | ||||||
|  | 
 | ||||||
|  | $(document).ready(function(){ | ||||||
|  | 	$('ol.sortable').nestedSortable({ | ||||||
|  | 		disableNesting: 'no-nest', | ||||||
|  | 		forcePlaceholderSize: true, | ||||||
|  | 		handle: 'i', | ||||||
|  | 		helper:	'clone', | ||||||
|  | 		items: 'li', | ||||||
|  | 		maxLevels: 3, | ||||||
|  | 		opacity: .5, | ||||||
|  | 		placeholder: 'placeholder', | ||||||
|  | 		revert: 250, | ||||||
|  | 		tabSize: 25, | ||||||
|  | 		tolerance: 'pointer', | ||||||
|  | 		toleranceElement: '> div', | ||||||
|  | 
 | ||||||
|  | 		stop: function(event, ui) { | ||||||
|  | 			$.post("<%= Rails.application.routes.url_helpers.admin_update_position_path %>", { id: ui.item.attr('id'), parent_id: ui.item.parent().closest('li').attr('id'), position: ui.item.index() } ); | ||||||
|  |   	} | ||||||
|  | 	}); | ||||||
|  | }); | ||||||
|  | @ -5,6 +5,9 @@ | ||||||
| // the compiled file.
 | // the compiled file.
 | ||||||
| //
 | //
 | ||||||
| //= require jquery
 | //= require jquery
 | ||||||
|  | //= require jquery.ui.draggable
 | ||||||
|  | //= require jquery.ui.droppable
 | ||||||
|  | //= require jquery.ui.sortable
 | ||||||
| //= require jquery_ujs
 | //= require jquery_ujs
 | ||||||
| //= require bootstrap
 | //= require bootstrap
 | ||||||
| //= require jquery.isotope.min
 | //= require jquery.isotope.min
 | ||||||
|  | @ -13,3 +16,6 @@ | ||||||
| //= require orbit-bar-search
 | //= require orbit-bar-search
 | ||||||
| //= require side_bar_history
 | //= require side_bar_history
 | ||||||
| //= require page_edit
 | //= require page_edit
 | ||||||
|  | //= require tinymce-jquery
 | ||||||
|  | //= require tinymce_orbit
 | ||||||
|  | //= require lib/jquery.ui.nestedSortable.js
 | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| $(function() { | function load_tinymce() { | ||||||
|   $('.tinymce_textarea').tinymce({ |   $('.tinymce_textarea').tinymce({ | ||||||
|     theme: 'advanced', |     theme: 'advanced', | ||||||
|         plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template", |         plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template", | ||||||
|  | @ -22,4 +22,8 @@ $(function() { | ||||||
|         external_image_list_url : "js/image_list.js", |         external_image_list_url : "js/image_list.js", | ||||||
|         media_external_list_url : "js/media_list.js" |         media_external_list_url : "js/media_list.js" | ||||||
|   }); |   }); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | $(document).ready(function() { | ||||||
|  |   load_tinymce(); | ||||||
| }); | }); | ||||||
|  | @ -6,13 +6,14 @@ | ||||||
| .nav-list li { | .nav-list li { | ||||||
| 	position: relative; | 	position: relative; | ||||||
| } | } | ||||||
| .nav-list ul { | .nav-list ol { | ||||||
| 	margin-left: 10px; | 	margin-left: 20px; | ||||||
| } | } | ||||||
| .nav-list ul li { | .nav-list ol li { | ||||||
| 	padding: 5px 0; | 	padding: 5px 0; | ||||||
|  | 	list-style: none; | ||||||
| } | } | ||||||
| .nav-list ul li a { | .nav-list ol li a { | ||||||
| 	font-size: 13px; | 	font-size: 13px; | ||||||
| 	padding: 3px 0px; | 	padding: 3px 0px; | ||||||
| 	display: block; | 	display: block; | ||||||
|  | @ -149,3 +150,27 @@ | ||||||
| #main-sidebar .quick-edit a:hover { | #main-sidebar .quick-edit a:hover { | ||||||
| 	background-color: #DDDDDD; | 	background-color: #DDDDDD; | ||||||
| } | } | ||||||
|  | ol.nav>li>.icons-moves { | ||||||
|  | 	display: none; | ||||||
|  | } | ||||||
|  | .sortable i { | ||||||
|  | 	position: absolute; | ||||||
|  | 	left: -20px; | ||||||
|  | 	top: 6px; | ||||||
|  | 	margin-right: 0; | ||||||
|  | 	opacity: 0.3; | ||||||
|  | 	filter: alpha(opacity=30); | ||||||
|  | } | ||||||
|  | .sortable i:hover { | ||||||
|  | 	cursor:move; | ||||||
|  | 	opacity: 0.7; | ||||||
|  | 	filter: alpha(opacity=70); | ||||||
|  | } | ||||||
|  | .placeholder { | ||||||
|  | 	background-color: rgba(0,136,204,.6); | ||||||
|  | 	border-radius: 3px; | ||||||
|  | } | ||||||
|  | .ui-nestedSortable-error { | ||||||
|  | 	background: rgba(255,206,206,.6); | ||||||
|  | 	color: #8a1f11; | ||||||
|  | } | ||||||
|  | @ -110,10 +110,8 @@ | ||||||
| 	padding:6px; | 	padding:6px; | ||||||
| } | } | ||||||
| #orbit-bar .nav > li.search { | #orbit-bar .nav > li.search { | ||||||
| 	background-image: none; |  | ||||||
| 	overflow: hidden; | 	overflow: hidden; | ||||||
| 	width: 28px; | 	width: 28px; | ||||||
| 	margin-bottom: 0; |  | ||||||
| 	position: relative; | 	position: relative; | ||||||
| } | } | ||||||
| #orbit-bar .nav > li > a.orbit-bar-home { | #orbit-bar .nav > li > a.orbit-bar-home { | ||||||
|  | @ -685,6 +683,33 @@ | ||||||
| #banner [id^="slideshow-"] { | #banner [id^="slideshow-"] { | ||||||
| 	z-index: 2 !important; | 	z-index: 2 !important; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | #back_main .editable { | ||||||
|  | 	position: relative; | ||||||
|  | } | ||||||
|  | #back_main .editable:after { | ||||||
|  | 	content: ''; | ||||||
|  | 	clear: both; | ||||||
|  | 	display: block; | ||||||
|  | 	visibility: hidden; | ||||||
|  | 	height: 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #back_main .edit_link a { | ||||||
|  | 	position: absolute; | ||||||
|  | 	z-index: 10; | ||||||
|  | 	width: 100%; | ||||||
|  | 	height: 100%; | ||||||
|  | 	top: 0; | ||||||
|  | 	left: 0; | ||||||
|  | 	text-indent: -9999px; | ||||||
|  | 	background: url(<%= asset_path 'editicon.png' %>) no-repeat center center rgba(255,255,255,.8); | ||||||
|  | 	-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 1); | ||||||
|  | 	-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 1); | ||||||
|  | 	box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 1); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| [class^="icons-"] { | [class^="icons-"] { | ||||||
| 	display: inline-block; | 	display: inline-block; | ||||||
| 	width: 16px; | 	width: 16px; | ||||||
|  | @ -1243,12 +1268,63 @@ | ||||||
| .icons-plus { | .icons-plus { | ||||||
| 	background-position: -288px -576px; | 	background-position: -288px -576px; | ||||||
| } | } | ||||||
|  | /*20*/ | ||||||
| .icons-power { | .icons-power { | ||||||
| 	background-position: -0px -608px; | 	background-position: -0px -608px; | ||||||
| } | } | ||||||
| /*20*/ | .icons-output { | ||||||
| .icons- { | 	background-position: -32px -608px; | ||||||
| 	background-position: -0px -608px; | } | ||||||
|  | .icons-col-resize { | ||||||
|  | 	background-position: -64px -608px; | ||||||
|  | } | ||||||
|  | .icons-move { | ||||||
|  | 	background-position: -96px -608px; | ||||||
|  | } | ||||||
|  | .icons-size-out { | ||||||
|  | 	background-position: -128px -608px; | ||||||
|  | } | ||||||
|  | .icons-size-in { | ||||||
|  | 	background-position: -160px -608px; | ||||||
|  | } | ||||||
|  | .icons-slash { | ||||||
|  | 	background-position: -192px -608px; | ||||||
|  | } | ||||||
|  | .icons-level { | ||||||
|  | 	background-position: -224px -608px; | ||||||
|  | } | ||||||
|  | .icons-share { | ||||||
|  | 	background-position: -256px -608px; | ||||||
|  | } | ||||||
|  | .icons-share2 { | ||||||
|  | 	background-position: -288px -608px; | ||||||
|  | } | ||||||
|  | .icons-re { | ||||||
|  | 	background-position: -320px -608px; | ||||||
|  | } | ||||||
|  | .icons-insert { | ||||||
|  | 	background-position: -352px -608px; | ||||||
|  | } | ||||||
|  | .icons-insert2 { | ||||||
|  | 	background-position: -384px -608px; | ||||||
|  | } | ||||||
|  | .icons-download { | ||||||
|  | 	background-position: -416px -608px; | ||||||
|  | } | ||||||
|  | .icons-tag-rignt { | ||||||
|  | 	background-position: -448px -608px; | ||||||
|  | } | ||||||
|  | .icons-tag-top { | ||||||
|  | 	background-position: -480px -608px; | ||||||
|  | } | ||||||
|  | .icons-tag-bottom { | ||||||
|  | 	background-position: -512px -608px; | ||||||
|  | } | ||||||
|  | .icons-tag-left { | ||||||
|  | 	background-position: -544px -608px; | ||||||
|  | } | ||||||
|  | .icons-moves { | ||||||
|  | 	background-position: -576px -608px; | ||||||
| } | } | ||||||
| /*21*/ | /*21*/ | ||||||
| .icons- { | .icons- { | ||||||
|  |  | ||||||
|  | @ -16,6 +16,12 @@ class Admin::ItemsController < ApplicationController | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|  |   def update_position | ||||||
|  |     item = Item.find(params[:id]) | ||||||
|  |     item.shift_to(params[:parent_id], params[:position]) | ||||||
|  |     render :nothing => true | ||||||
|  |   end | ||||||
|  |    | ||||||
|   protected |   protected | ||||||
|    |    | ||||||
|   def find_snippets |   def find_snippets | ||||||
|  |  | ||||||
|  | @ -11,7 +11,17 @@ class Admin::ModuleAppsController < ApplicationController | ||||||
| 
 | 
 | ||||||
|   def reload_frontend_pages |   def reload_frontend_pages | ||||||
|     @module_app = ModuleApp.find(params[:id]) |     @module_app = ModuleApp.find(params[:id]) | ||||||
|     @categories = @module_app.key.eql?('announcement') ? BulletinCategory.all : nil  |     case @module_app.key | ||||||
|  |       when 'announcement' | ||||||
|  |         @categories =  BulletinCategory.all | ||||||
|  |         @tags = AnnouncementTag.all | ||||||
|  |       when 'news' | ||||||
|  |         @categories =  NewsBulletinCategory.all | ||||||
|  |         @tags = NewsTag.all | ||||||
|  |       when 'web_resource' | ||||||
|  |         @categories =  WebLinkCategory.all | ||||||
|  |         @tags = WebResourceTag.all | ||||||
|  |     end | ||||||
|     respond_to do |format| |     respond_to do |format| | ||||||
|       format.js  {} |       format.js  {} | ||||||
|     end |     end | ||||||
|  |  | ||||||
|  | @ -22,17 +22,20 @@ class Admin::PagePartsController < ApplicationController | ||||||
| 
 | 
 | ||||||
|   def edit |   def edit | ||||||
|     @part = PagePart.find(params[:id]) |     @part = PagePart.find(params[:id]) | ||||||
|     @module_apps = ModuleApp.all(:conditions => {:enable_frontend => true}) |     @module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc) | ||||||
|     @module_app = @part.module_app ? @part.module_app : @module_apps[0] |     @module_app = @part.module_app ? @part.module_app : @module_apps[0] | ||||||
|     @r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag |     @r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag | ||||||
|     @tag_objects = @r_tag.classify.constantize.all rescue nil |     @tag_objects = @r_tag.classify.constantize.all rescue nil | ||||||
|       case @module_app.key |       case @module_app.key | ||||||
|         when 'announcement' |         when 'announcement' | ||||||
|           @categories =  BulletinCategory.all |           @categories =  BulletinCategory.all | ||||||
|  |           @tags = AnnouncementTag.all | ||||||
|         when 'news' |         when 'news' | ||||||
|           @categories =  NewsBulletinCategory.all |           @categories =  NewsBulletinCategory.all | ||||||
|  |           @tags = NewsTag.all | ||||||
|         when 'web_resource' |         when 'web_resource' | ||||||
|           @categories =  WebLinkCategory.all |           @categories =  WebLinkCategory.all | ||||||
|  |           @tags = WebResourceTag.all | ||||||
|       end |       end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|  | @ -69,10 +72,13 @@ class Admin::PagePartsController < ApplicationController | ||||||
|     case @module_app.key |     case @module_app.key | ||||||
|       when 'announcement' |       when 'announcement' | ||||||
|         @categories =  BulletinCategory.all |         @categories =  BulletinCategory.all | ||||||
|  |         @tags = AnnouncementTag.all | ||||||
|       when 'news' |       when 'news' | ||||||
|         @categories =  NewsBulletinCategory.all |         @categories =  NewsBulletinCategory.all | ||||||
|  |         @tags = NewsTag.all | ||||||
|       when 'web_resource' |       when 'web_resource' | ||||||
|         @categories =  WebLinkCategory.all |         @categories =  WebLinkCategory.all | ||||||
|  |         @tags = WebResourceTag.all | ||||||
|     end |     end | ||||||
|     respond_to do |format| |     respond_to do |format| | ||||||
|       format.js  {} |       format.js  {} | ||||||
|  |  | ||||||
|  | @ -20,14 +20,14 @@ class Admin::PagesController < ApplicationController | ||||||
|   def new |   def new | ||||||
|     @item = Page.new |     @item = Page.new | ||||||
|     @item.parent = Item.find(params[:parent_id]) rescue nil |     @item.parent = Item.find(params[:parent_id]) rescue nil | ||||||
|     @apps = ModuleApp.all |     @apps = ModuleApp.excludes(app_pages: nil).entries | ||||||
|     @designs = Design.all.entries |     @designs = Design.all.entries | ||||||
|     @design = Design.first |     @design = Design.first | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   def edit |   def edit | ||||||
|     @item = Page.find(params[:id]) |     @item = Page.find(params[:id]) | ||||||
|     @apps = ModuleApp.all |     @apps = ModuleApp.excludes(app_pages: nil).entries | ||||||
|     @designs = Design.all.entries |     @designs = Design.all.entries | ||||||
|     @design = @item.design ? @item.design : @designs.first |     @design = @item.design ? @item.design : @designs.first | ||||||
|     @app_frontend_urls = @item.module_app.app_pages if @item.module_app |     @app_frontend_urls = @item.module_app.app_pages if @item.module_app | ||||||
|  | @ -35,10 +35,13 @@ class Admin::PagesController < ApplicationController | ||||||
|       case @item.module_app.key |       case @item.module_app.key | ||||||
|         when 'announcement' |         when 'announcement' | ||||||
|           @categories =  BulletinCategory.all |           @categories =  BulletinCategory.all | ||||||
|  |           @tags = AnnouncementTag.all | ||||||
|         when 'news' |         when 'news' | ||||||
|           @categories =  NewsBulletinCategory.all |           @categories =  NewsBulletinCategory.all | ||||||
|  |           @tags = NewsTag.all | ||||||
|         when 'web_resource' |         when 'web_resource' | ||||||
|           @categories =  WebLinkCategory.all |           @categories =  WebLinkCategory.all | ||||||
|  |           @tags = WebResourceTag.all | ||||||
|       end |       end | ||||||
|     else |     else | ||||||
|       @categories = nil |       @categories = nil | ||||||
|  |  | ||||||
|  | @ -99,9 +99,9 @@ class ApplicationController < ActionController::Base | ||||||
|   end |   end | ||||||
|    |    | ||||||
|   # Render the page |   # Render the page | ||||||
|   def render_page(param={}) |   def render_page | ||||||
|     if @item |     if @item | ||||||
|       render :text => process_page(@item, param[:id], param), :layout => 'page_layout' |       render :text => parse_page_noko(@item), :layout => 'page_layout' | ||||||
|     else |     else | ||||||
|       render :text => '404 Not Found' |       render :text => '404 Not Found' | ||||||
|     end |     end | ||||||
|  |  | ||||||
|  | @ -24,7 +24,7 @@ class OrbitBackendController< ApplicationController | ||||||
|   def check_user_can_use  |   def check_user_can_use  | ||||||
|     unless check_permission |     unless check_permission | ||||||
|       #redirect_to polymorphic_path(['panel',@app_title,'back_end','public']) |       #redirect_to polymorphic_path(['panel',@app_title,'back_end','public']) | ||||||
|       render :text => '403 Forbidden' |       redirect_to root_url | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| class OrbitFrontendComponentController< ApplicationController | class OrbitFrontendComponentController< ApplicationController | ||||||
|   before_filter :setup_vars |   before_filter :setup_vars | ||||||
|   before_filter {|c| c.front_end_available(@app_title)} |   before_filter {|c| c.front_end_available(@app_title)} | ||||||
|   layout :false |   layout "module_widget" | ||||||
|    |    | ||||||
|   def setup_vars |   def setup_vars | ||||||
|     @app_title = request.fullpath.split('/')[2] |     @app_title = request.fullpath.split('/')[2] | ||||||
|  |  | ||||||
|  | @ -15,11 +15,11 @@ class PagesController < ApplicationController | ||||||
|    |    | ||||||
|   def show   |   def show   | ||||||
|      #begin   |      #begin   | ||||||
|        @item = Item.first(:conditions => {:full_name => params[:page_name]}) |        @item = Item.first(:conditions => {:path => params[:page_name]}) | ||||||
|        if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s)) |        if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s)) | ||||||
|          case @item._type |          case @item._type | ||||||
|            when 'Page'     |            when 'Page'     | ||||||
|              render_page(params) |              render_page | ||||||
|            when 'Link' |            when 'Link' | ||||||
|              redirect_to "http://#{@item[:url]}" |              redirect_to "http://#{@item[:url]}" | ||||||
|          end |          end | ||||||
|  | @ -32,17 +32,19 @@ class PagesController < ApplicationController | ||||||
|    end |    end | ||||||
|     |     | ||||||
|    def index_from_link |    def index_from_link | ||||||
|       if params[:page] |       url = "/#{@item.path}" | ||||||
|         redirect_to "/#{@item.full_name}?page=#{params[:page]}&category_id=#{params[:category_id]}&tag_id=#{params[:tag_id]}" |       options = '' | ||||||
|       else |       options << "?page_main=#{params[:page_main]}" unless params[:page_main].blank? | ||||||
|         redirect_to "/#{@item.full_name}?category_id=#{params[:category_id]}&tag_id=#{params[:tag_id]}" |       options << "#{options.blank? ? '?' : '&'}category_id=#{params[:category_id]}" unless params[:category_id].blank? | ||||||
|       end |       options << "#{options.blank? ? '?' : '&'}tag_id=#{params[:tag_id]}" unless params[:tag_id].blank? | ||||||
|  |       redirect_to url + options | ||||||
|    end |    end | ||||||
|     |     | ||||||
|    def show_from_link |    def show_from_link | ||||||
|      # debugger |       url = "/#{@item.path}?id=#{params[:id]}" | ||||||
|      # a=1 |       options = '' | ||||||
|      redirect_to "/#{@item.full_name}?id=#{params[:id]}&preview=#{params[:preview]}" |       options << "&preview=#{params[:preview]}" unless params[:preview].blank? | ||||||
|  |       redirect_to url + options | ||||||
|    end |    end | ||||||
|     |     | ||||||
|    def load_orbit_bar |    def load_orbit_bar | ||||||
|  |  | ||||||
|  | @ -8,9 +8,10 @@ module Admin::ItemHelper | ||||||
|           dest = admin_page_path(node) |           dest = admin_page_path(node) | ||||||
|         when 'Link' |         when 'Link' | ||||||
|           dest = admin_link_path(node) |           dest = admin_link_path(node) | ||||||
|  |           no_nested = 'no-nest' | ||||||
|       end |       end | ||||||
|       ret << "<ul>" unless node.parent.nil? |       ret << "<li id='#{node.id}' class='#{no_nested}'>" | ||||||
|       ret << "<li>" |       ret << "<i class='icons-moves'></i>" | ||||||
|       ret << "<div class='with_action'>" |       ret << "<div class='with_action'>" | ||||||
|       ret << (link_to node.i18n_variable[I18n.locale], dest) |       ret << (link_to node.i18n_variable[I18n.locale], dest) | ||||||
|       ret << "<div class='quick-edit hide'>" |       ret << "<div class='quick-edit hide'>" | ||||||
|  | @ -22,18 +23,19 @@ module Admin::ItemHelper | ||||||
|       ret << "</div>" |       ret << "</div>" | ||||||
|       ret << render_children(node) |       ret << render_children(node) | ||||||
|       ret << "</li>" |       ret << "</li>" | ||||||
|       ret << "</ul>" unless node.parent.nil? |  | ||||||
|     end |     end | ||||||
|     ret.html_safe |     ret.html_safe | ||||||
|   end |   end | ||||||
|    |    | ||||||
|   def render_children(parent) |   def render_children(parent) | ||||||
|     children = parent.ordered_children |     children = parent.children | ||||||
|     if !children.entries.blank? |     if !parent.children.entries.blank? | ||||||
|       ret = '' |       ret = '' | ||||||
|  |       ret << "<ol class='#{'sortable' if parent.parent.nil?}'>" | ||||||
|       children.each do |child| |       children.each do |child| | ||||||
|         ret << render_node_and_children(child) |         ret << render_node_and_children(child) | ||||||
|       end |       end | ||||||
|  |       ret << '</ol>' | ||||||
|       ret |       ret | ||||||
|     else |     else | ||||||
|       '' |       '' | ||||||
|  |  | ||||||
|  | @ -104,10 +104,6 @@ module ApplicationHelper | ||||||
|     ((controller.controller_name.eql?(controller_name) || request.fullpath.eql?(controller_name)) && controller.action_name.eql?(action_name)) ? 'active' : nil |     ((controller.controller_name.eql?(controller_name) || request.fullpath.eql?(controller_name)) && controller.action_name.eql?(action_name)) ? 'active' : nil | ||||||
|   end |   end | ||||||
|    |    | ||||||
|   def process_page(page, id, params) |  | ||||||
|     parse_page_noko(page, id, params) |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   def page_metas(page) |   def page_metas(page) | ||||||
|     tmp_meta = {} |     tmp_meta = {} | ||||||
|     metas = '' |     metas = '' | ||||||
|  | @ -128,7 +124,7 @@ module ApplicationHelper | ||||||
|   def page_title(page) |   def page_title(page) | ||||||
|     res = "<title>" |     res = "<title>" | ||||||
|     page_title = page.title ? page.title[I18n.locale] : page.i18n_variable[I18n.locale] |     page_title = page.title ? page.title[I18n.locale] : page.i18n_variable[I18n.locale] | ||||||
|     if page.is_home? && @site.title |     if page.root? && @site.title | ||||||
|       res << @site.title[I18n.locale] |       res << @site.title[I18n.locale] | ||||||
|     elsif @site.title && @site.title_always_on |     elsif @site.title && @site.title_always_on | ||||||
|       res << @site.title[I18n.locale] + ' - ' + page_title |       res << @site.title[I18n.locale] + ' - ' + page_title | ||||||
|  |  | ||||||
|  | @ -2,59 +2,31 @@ class Item | ||||||
| 
 | 
 | ||||||
|   include Mongoid::Document |   include Mongoid::Document | ||||||
|   include Mongoid::Timestamps |   include Mongoid::Timestamps | ||||||
|  |   include Mongoid::Tree | ||||||
|  |   include Mongoid::Tree::Ordering | ||||||
|    |    | ||||||
|   field :name, :index => true |   field :name | ||||||
|   field :full_name, :index => true |   field :path | ||||||
|   field :position, :type => Integer |   field :is_published, :type => Boolean, :default => false | ||||||
|   field :is_published, :type => Boolean, :default => false, :index => true |  | ||||||
|   field :enabled_for, :type => Array, :default => nil |   field :enabled_for, :type => Array, :default => nil | ||||||
|   field :menu_enabled_for, :type => Array, :default => nil |   field :menu_enabled_for, :type => Array, :default => nil | ||||||
|   |   | ||||||
|   validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/ |   validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/ | ||||||
|   validates :name, :exclusion => { :in => LIST[:forbidden_item_names] } |   validates :name, :exclusion => { :in => LIST[:forbidden_item_names] } | ||||||
|   validates_uniqueness_of :name, :scope => :parent_id |   validates_uniqueness_of :name, :scope => :parent_id | ||||||
|   validates_presence_of :name, :full_name, :position |   validates_presence_of :name | ||||||
|  | 
 | ||||||
|  |   validates_associated :parent, :children | ||||||
|  |   after_rearrange :rebuild_path | ||||||
|    |    | ||||||
|   belongs_to :parent, :class_name => "Item" |  | ||||||
|   has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy |   has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy | ||||||
|   has_many :children, :class_name => "Item", :as => 'parent' |  | ||||||
|    |  | ||||||
|   before_validation :setup_default_value |  | ||||||
|    |    | ||||||
|   def self.find_by_name(item_name) |   def self.find_by_name(item_name) | ||||||
|     Item.first(:conditions => { :name => item_name, :is_published => true }) |     Item.first(:conditions => { :name => item_name, :is_published => true }) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   # Get an array of ancestors |   def visible_children | ||||||
|   def ancestors |     objects = self.children | ||||||
|     node, nodes = self, [] |  | ||||||
|     nodes << node = node.parent while !node.parent.blank? rescue nil |  | ||||||
|     nodes.reverse |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   # Get an array of ancestor's id |  | ||||||
|   def ancestor_ids |  | ||||||
|     node, nodes = self, [] |  | ||||||
|     while !node.parent.blank? do |  | ||||||
|       node = node.parent rescue nil |  | ||||||
|       nodes << node.id if node |  | ||||||
|     end |  | ||||||
|     # nodes << node = node.parent while !node.parent.blank? rescue nil |  | ||||||
|     nodes.reverse |  | ||||||
|   end |  | ||||||
|    |  | ||||||
|   # Build the url from the array of ancestors |  | ||||||
|   def url |  | ||||||
|     urls = ancestors.map{ |a| a.name } << self.name |  | ||||||
|     urls.join("/") |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   def ordered_children |  | ||||||
|     self.children.asc(:position) |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   def ordered_and_visible_children |  | ||||||
|     objects = ordered_children |  | ||||||
|     a = [] |     a = [] | ||||||
|     if objects |     if objects | ||||||
|       objects.each do |object| |       objects.each do |object| | ||||||
|  | @ -64,20 +36,27 @@ class Item | ||||||
|     a |     a | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   protected |   def shift_to(new_parent, position) | ||||||
|    |     unless self.parent_id.to_s.eql?(new_parent) && self.position.eql?(position.to_i) | ||||||
|   def setup_default_value |       new_parent = Item.find(new_parent) | ||||||
|     # Set the position value within the parent scope |       current_position_sibling = find_by_parent_and_position(new_parent, position.to_i) | ||||||
|     if self.position.blank? |       if current_position_sibling | ||||||
|       max_page = Item.where(:parent_id => self.parent_id).count |         current_position_sibling.at_bottom? ? move_below(current_position_sibling) : move_above(current_position_sibling) | ||||||
|       self.position = (max_page)? max_page + 1 : 1 |       elsif self.parent != new_parent | ||||||
|  |         self.parent = new_parent | ||||||
|  |         save! | ||||||
|  |       end | ||||||
|  |     end | ||||||
|    end |    end | ||||||
|    |    | ||||||
|     # Build the full_name from the ancestors array |   protected | ||||||
|     full_node = self.ancestors.map{ |a| a.name }.push( self.name ) |    | ||||||
|     # Remove root node if not root |   def rebuild_path | ||||||
|     full_node.shift if full_node.size >= 2 |     self.path = (self.ancestors_and_self - [Item.root]).collect{|x| x.name unless x.root?}.join('/') | ||||||
|     self.full_name = full_node.join("/") |   end | ||||||
|  | 
 | ||||||
|  |   def find_by_parent_and_position(parent, position) | ||||||
|  |     parent.children.detect{|child| child.position == position} | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   # Enable the validation for parent_id |   # Enable the validation for parent_id | ||||||
|  |  | ||||||
|  | @ -3,6 +3,8 @@ class Page < Item | ||||||
|   field :content |   field :content | ||||||
|   field :app_frontend_url |   field :app_frontend_url | ||||||
|   field :theme_id, :type => BSON::ObjectId, :default => nil |   field :theme_id, :type => BSON::ObjectId, :default => nil | ||||||
|  |   field :category | ||||||
|  |   field :tag | ||||||
|    |    | ||||||
|   belongs_to :design |   belongs_to :design | ||||||
|   belongs_to :module_app |   belongs_to :module_app | ||||||
|  | @ -16,10 +18,6 @@ class Page < Item | ||||||
|    |    | ||||||
|   # embeds_many :custom_images, :class_name => 'Image', as: :design_image |   # embeds_many :custom_images, :class_name => 'Image', as: :design_image | ||||||
| 
 | 
 | ||||||
|   def is_home? |  | ||||||
|     self.parent ? false : true |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   def title |   def title | ||||||
|     @title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil |     @title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil | ||||||
|   end |   end | ||||||
|  |  | ||||||
|  | @ -11,9 +11,27 @@ class PagePart | ||||||
|   field :public_r_tag_option, :default => nil |   field :public_r_tag_option, :default => nil | ||||||
|   field :widget_path |   field :widget_path | ||||||
|    |    | ||||||
|   has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy |   has_one :i18n_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy | ||||||
|  |   has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy | ||||||
| 
 | 
 | ||||||
|   belongs_to :page |   belongs_to :page | ||||||
|   belongs_to :module_app |   belongs_to :module_app | ||||||
| 
 | 
 | ||||||
|  |   before_save :set_key | ||||||
|  | 
 | ||||||
|  |   def i18n_variable | ||||||
|  |     @i18n_variable ||= I18nVariable.first(:conditions => {:key => 'i18n_variable', :language_value_id => self.id, :language_value_type => self.class}) rescue nil | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|  |   def title | ||||||
|  |     @title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|  |   protected | ||||||
|  |    | ||||||
|  |   def set_key | ||||||
|  |     title.key = 'title' if title && (title.key.blank? rescue true) | ||||||
|  |     i18n_variable.key = 'i18n_variable' if i18n_variable && (i18n_variable.key.blank? rescue true) | ||||||
|  |   end | ||||||
|  | 
 | ||||||
| end | end | ||||||
|  | @ -1,2 +1,3 @@ | ||||||
| $('#app_page_url').html("<%= escape_javascript(select 'page', 'app_frontend_url', @module_app.app_pages) %>"); | $('#app_page_url').html("<%= escape_javascript(select 'page', 'app_frontend_url', @module_app.app_pages) %>"); | ||||||
| $('#app_page_category').html("<%= escape_javascript(select 'page', 'category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}) if @categories %>"); | $('#app_page_category').html("<%= j (select 'page', 'category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, {:include_blank => true}) if @categories %>"); | ||||||
|  | $('#app_page_tag').html("<%= j (select 'page', 'tag', @tags.collect{|tag| [tag[I18n.locale], tag.id]}, {:include_blank => true}) if @tags %>"); | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| 	 | 	 | ||||||
| 	<% LIST[:page_part_kinds].each do |kind| %> | 	<% LIST[:page_part_kinds].each do |kind| %> | ||||||
| 		<%= f.radio_button :kind, kind, :class => 'part_kind' %> | 		<%= f.radio_button :kind, kind, :class => 'part_kind' %> | ||||||
| 		<%= t(kind) %> | 		<%= t(kind, :scope => 'admin.page_part_kinds') %> | ||||||
| 	<% end %> | 	<% end %> | ||||||
| 	 | 	 | ||||||
| 	<% LIST[:page_part_kinds].each do |kind| %> | 	<% LIST[:page_part_kinds].each do |kind| %> | ||||||
|  |  | ||||||
|  | @ -1,3 +1,14 @@ | ||||||
|  | <div> | ||||||
|  | 	<%= f.fields_for :title, @part.title do |f| %> | ||||||
|  |   <% @site_valid_locales.each do |locale| %> | ||||||
|  |     <p> | ||||||
|  | 			<%= f.label :locale, "#{t('admin.title')} #{I18nVariable.from_locale(locale)}" %> | ||||||
|  | 			<%= f.text_field locale %> | ||||||
|  | 		</p> | ||||||
|  |   <% end %> | ||||||
|  | <% end %> | ||||||
|  | </div> | ||||||
|  | 
 | ||||||
| <span id='module_app_list'> | <span id='module_app_list'> | ||||||
| 	<%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :title, :selected => @module_app.id), {}, {:rel => admin_page_parts_path} %> | 	<%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :title, :selected => @module_app.id), {}, {:rel => admin_page_parts_path} %> | ||||||
| </span> | </span> | ||||||
|  | @ -6,7 +17,12 @@ | ||||||
| 	<%= f.select :widget_path, @module_app.widgets.collect{|widget| [widget.humanize, widget]}, :selected => @part.widget_path %> | 	<%= f.select :widget_path, @module_app.widgets.collect{|widget| [widget.humanize, widget]}, :selected => @part.widget_path %> | ||||||
| </span> | </span> | ||||||
| 
 | 
 | ||||||
|  | : | ||||||
| 
 | 
 | ||||||
| <span id="widget_category"> | <span id="widget_category"> | ||||||
| 	<%= render 'widget_categories' %> | 	<%= render 'widget_categories' %> | ||||||
| </span> | </span> | ||||||
|  | <%= t :or_lower %> | ||||||
|  | <span id="widget_tag"> | ||||||
|  | 	<%= render 'widget_tags' %> | ||||||
|  | </span> | ||||||
|  | @ -2,7 +2,13 @@ | ||||||
|   <% @site_valid_locales.each do |locale| %> |   <% @site_valid_locales.each do |locale| %> | ||||||
|     <div> |     <div> | ||||||
| 		  <%= I18nVariable.from_locale(locale) %> | 		  <%= I18nVariable.from_locale(locale) %> | ||||||
| 		  <%= f.text_area locale %> | 		  <%= f.text_area locale, :class => 'tinymce_textarea' %> | ||||||
| 	  </div> | 	  </div> | ||||||
|   <% end %> |   <% end %> | ||||||
| <% end %> | <% end %> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  | 	$(document).ready(function() { | ||||||
|  | 	  load_tinymce(); | ||||||
|  | 	}); | ||||||
|  | </script> | ||||||
|  |  | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  | 	<%= select 'page_part', 'tag', @tags.collect{|category| [category[I18n.locale], category.id]}, :selected => (@part ? @part[:tag] : nil), :include_blank => true if @tags && @tags.size > 0 %> | ||||||
|  | @ -1,2 +1,3 @@ | ||||||
| $('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|widget| [widget.humanize, widget]}) %>") | $('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|widget| [widget.humanize, widget]}) %>") | ||||||
| $('#widget_category').html("<%= j render 'widget_categories' %>") | $('#widget_category').html("<%= j render 'widget_categories' %>") | ||||||
|  | $('#widget_tag').html("<%= j render 'widget_tags' %>") | ||||||
|  | @ -1,10 +1,11 @@ | ||||||
| <%= flash_messages %> | <%= flash_messages %> | ||||||
| 
 | <div id="poststuff"> | ||||||
| 	<h1><%= t('admin.editing_page') %></h1> | 	<h1><%= t('admin.editing_page') %></h1> | ||||||
| 
 | 	<%= form_for @item, :url => admin_page_path(@item), :html => { :class => 'form-horizontal edit_page' }  do |f| %> | ||||||
| <%= form_for @item, :url => admin_page_path(@item) do |f| %> |  | ||||||
| 		<%= render :partial => "form", :locals => { :f => f } %> | 		<%= render :partial => "form", :locals => { :f => f } %> | ||||||
|   <p> | 		<div class="form-actions"> | ||||||
|     <%= f.submit t('update') %> <%= link_back %> | 			<%= f.submit t('update'), :class => 'btn btn-primary' %> | ||||||
|   </p> | 			<%= link_to t('cancel'), get_go_back, :class=>"btn" %> | ||||||
|  | 		</div> | ||||||
| 	<% end %> | 	<% end %> | ||||||
|  | </div> | ||||||
|  |  | ||||||
|  | @ -1,52 +1,95 @@ | ||||||
| <%= f.error_messages %> | <%= f.error_messages %> | ||||||
| <%= f.hidden_field :parent, :value => (@item.parent.id rescue nil) %> | <%= f.hidden_field :parent, :value => (@item.parent.id rescue nil) %> | ||||||
| 
 | 
 | ||||||
| <p> | <div class="control-group"> | ||||||
| <%= f.label :name, t('admin.name') %> | 	<%= f.label :name, t('admin.name'), :class => 'control-label' %> | ||||||
| <%= f.text_field :name, :class => 'text' %> | 	<div class="controls"> | ||||||
| </p> | 		<%= f.text_field :name, :class => 'text input-xlarge' %> | ||||||
|  | 		<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> --> | ||||||
|  | 	</div> | ||||||
|  | </div> | ||||||
| 
 | 
 | ||||||
| <%= f.fields_for :i18n_variable, (@item.new_record? ? @item.build_i18n_variable : @item.i18n_variable) do |f| %> | <%= f.fields_for :i18n_variable, (@item.new_record? ? @item.build_i18n_variable : @item.i18n_variable) do |f| %> | ||||||
| 	<% @site_valid_locales.each do |locale| %> | 	<% @site_valid_locales.each do |locale| %> | ||||||
|     <p> | 		<div class="control-group"> | ||||||
| 			<%= f.label :locale, "#{t('admin.title')} #{I18nVariable.from_locale(locale)}" %> | 			<%= f.label :locale, "#{t('admin.title')} #{I18nVariable.from_locale(locale)}", :class => 'control-label' %> | ||||||
| 			<%= f.text_field locale %> | 			<div class="controls"> | ||||||
| 		</p> | 				<%= f.text_field locale, :class => 'text input-xlarge' %> | ||||||
|  | 				<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> --> | ||||||
|  | 			</div> | ||||||
|  | 		</div> | ||||||
| 	<% end %> | 	<% end %> | ||||||
| <% end %> | <% end %> | ||||||
| 
 | 
 | ||||||
| <p> | <div class="control-group"> | ||||||
| 	<%= t('admin.design_name') %> | 	<%= f.label :name, t('admin.design_name'), :class => 'control-label' %> | ||||||
|  | 	<div class="controls"> | ||||||
| 		<%= f.collection_select :design, @designs, :id, :title, {:selected => @design.id}, {:rel => admin_pages_path} %> | 		<%= f.collection_select :design, @designs, :id, :title, {:selected => @design.id}, {:rel => admin_pages_path} %> | ||||||
| </p> | 		<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> --> | ||||||
| <p> | 	</div> | ||||||
| 	<%= t('admin.theme') %> | </div> | ||||||
|  | <div class="control-group"> | ||||||
|  | 	<%= f.label :name, t('admin.theme'), :class => 'control-label' %> | ||||||
|  | 	<div class="controls"> | ||||||
| 		<%= f.select :theme_id, @design.themes.collect { |t| [t.name.capitalize, t.id] }, :include_blank => true %> | 		<%= f.select :theme_id, @design.themes.collect { |t| [t.name.capitalize, t.id] }, :include_blank => true %> | ||||||
| </p> | 		<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> --> | ||||||
| <p> | 	</div> | ||||||
| 	<%= t('admin.module_app') %> | </div> | ||||||
|  | <div class="control-group"> | ||||||
|  | 	<%= f.label :name, t('admin.module_app'), :class => 'control-label' %> | ||||||
|  | 	<div class="controls"> | ||||||
| 		<%= render :partial => "app_selector", :locals => { :f => f } %> | 		<%= render :partial => "app_selector", :locals => { :f => f } %> | ||||||
| 	<span id="app_page_url"><%= select('page','app_frontend_url', @app_frontend_urls, :selected => @item.app_frontend_url ) rescue ''%> </span> | 		<span id="app_page_url"> | ||||||
| 	<span id="app_page_category"><%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category], :include_blank => true ) rescue ''%> </span> | 			<%= select('page','app_frontend_url', @app_frontend_urls, :selected => @item.app_frontend_url ) rescue ''%> | ||||||
| </p> | 		</span> | ||||||
| <p> | 		<span id="app_page_category"> | ||||||
| 	<%= f.label :is_published, "#{t('admin.is_published')} ?" %> | 			<%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category], :include_blank => true ) rescue ''%> | ||||||
| 	<%= f.radio_button :is_published, true %>Yes <%= f.radio_button :is_published, false %> No | 		</span> | ||||||
| </p> | 		<span id="app_page_tag"> | ||||||
| <p> | 			<%= select('page','tag', @tags.collect{|tag| [tag[I18n.locale], tag.id]}, :selected => @item[:tag], :include_blank => true ) rescue ''%> | ||||||
| 	<%= f.label :menu_enabled_for, "#{t('admin.menu_enabled_for')}:" %> | 		</span> | ||||||
|  | 		<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> --> | ||||||
|  | 	</div> | ||||||
|  | </div> | ||||||
|  | <div class="control-group"> | ||||||
|  | 	<%= f.label :is_published, "#{t('admin.is_published')} ?", :class => 'control-label' %> | ||||||
|  | 	<div class="controls"> | ||||||
|  | 		<label class="radio"> | ||||||
|  | 			<%= f.radio_button :is_published, true %> | ||||||
|  |             Yes | ||||||
|  |         </label> | ||||||
|  | 		<label class="radio"> | ||||||
|  | 			<%= f.radio_button :is_published, false %> | ||||||
|  | 			No | ||||||
|  |         </label>  | ||||||
|  | 		<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> --> | ||||||
|  | 	</div> | ||||||
|  | </div> | ||||||
|  | <div class="control-group"> | ||||||
|  | 	<%= f.label :menu_enabled_for, "#{t('admin.menu_enabled_for')}:", :class => 'control-label' %> | ||||||
|  | 	<div class="controls"> | ||||||
| 		<% @site_valid_locales.each do |valid_locale| %> | 		<% @site_valid_locales.each do |valid_locale| %> | ||||||
|  | 		<label class="checkbox"> | ||||||
| 			<%= check_box_tag 'page[menu_enabled_for][]', valid_locale, (@item.menu_enabled_for.nil? ? true : @item.menu_enabled_for.include?(valid_locale)) %> | 			<%= check_box_tag 'page[menu_enabled_for][]', valid_locale, (@item.menu_enabled_for.nil? ? true : @item.menu_enabled_for.include?(valid_locale)) %> | ||||||
| 			<%= I18nVariable.from_locale(valid_locale) %> | 			<%= I18nVariable.from_locale(valid_locale) %> | ||||||
|  |         </label> | ||||||
| 		<% end %> | 		<% end %> | ||||||
| 		<%= hidden_field_tag 'page[menu_enabled_for][]', '' %> | 		<%= hidden_field_tag 'page[menu_enabled_for][]', '' %> | ||||||
| </p> | 		<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> --> | ||||||
| <p> | 	</div> | ||||||
| 	<%= f.label :enabled_for, "#{t('admin.enabled_for')}:" %> | </div> | ||||||
|  | 
 | ||||||
|  | <div class="control-group"> | ||||||
|  | 	<%= f.label :enabled_for, "#{t('admin.enabled_for')}:", :class => 'control-label' %> | ||||||
|  | 	<div class="controls"> | ||||||
| 		<% @site_valid_locales.each do |valid_locale| %> | 		<% @site_valid_locales.each do |valid_locale| %> | ||||||
|  | 		<label class="checkbox"> | ||||||
| 			<%= check_box_tag 'page[enabled_for][]', valid_locale, (@item.enabled_for.nil? ? true : @item.enabled_for.include?(valid_locale)) %> | 			<%= check_box_tag 'page[enabled_for][]', valid_locale, (@item.enabled_for.nil? ? true : @item.enabled_for.include?(valid_locale)) %> | ||||||
| 			<%= I18nVariable.from_locale(valid_locale) %> | 			<%= I18nVariable.from_locale(valid_locale) %> | ||||||
|  |         </label> | ||||||
| 		<% end %> | 		<% end %> | ||||||
| 		<%= hidden_field_tag 'page[enabled_for][]', '' %> | 		<%= hidden_field_tag 'page[enabled_for][]', '' %> | ||||||
| </p> | 		<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> --> | ||||||
|  | 	</div> | ||||||
|  | </div> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,13 +1,11 @@ | ||||||
| <h1><%= t('admin.new_page') %></h1> |  | ||||||
| 
 |  | ||||||
| <%= flash_messages %> | <%= flash_messages %> | ||||||
| 
 | <div id="poststuff"> | ||||||
| <%= form_for @item, :url => admin_pages_path, :html => { :class => 'form' } do |f| %> | 	<h1><%= t('admin.new_page') %></h1> | ||||||
| 
 | 	<%= form_for @item, :url => admin_pages_path, :html => { :class => 'form-horizontal edit_page' }  do |f| %> | ||||||
| 		<%= render :partial => "form", :locals => { :f => f } %> | 		<%= render :partial => "form", :locals => { :f => f } %> | ||||||
|    | 		<div class="form-actions"> | ||||||
|   <p> | 			<%= f.submit t('update'), :class => 'btn btn-primary' %> | ||||||
|     <%= f.submit t('create') %> <%= link_back %> | 			<%= link_to t('cancel'), get_go_back, :class=>"btn" %> | ||||||
|   </p> | 		</div> | ||||||
|    |  | ||||||
| 	<% end %> | 	<% end %> | ||||||
|  | </div> | ||||||
|  | @ -5,7 +5,9 @@ | ||||||
| 	   <%= javascript_include_tag "html5" %> | 	   <%= javascript_include_tag "html5" %> | ||||||
| 	<![endif]--> | 	<![endif]--> | ||||||
| 	<%#= stylesheet_link_tag "module_widget" %> | 	<%#= stylesheet_link_tag "module_widget" %> | ||||||
| 	<%= javascript_include_tag "module_widget" %> | 	<%= javascript_include_tag "module" %> | ||||||
|  | 	<%#= javascript_include_tag "#{@app_title}/module_widget" %> | ||||||
|  | 	<%= yield :page_specific_javascript %> | ||||||
| 	<%= csrf_meta_tag %> | 	<%= csrf_meta_tag %> | ||||||
| </head> | </head> | ||||||
| <body> | <body> | ||||||
|  |  | ||||||
|  | @ -23,9 +23,9 @@ | ||||||
| 		</div> | 		</div> | ||||||
| 		<div class="viewport"> | 		<div class="viewport"> | ||||||
| 			<div id='back_sidebar' class="overview"> | 			<div id='back_sidebar' class="overview"> | ||||||
| 				<ul class="nav nav-list"> | 				<ol class="nav nav-list"> | ||||||
| 					<%= yield :sidebar %> | 					<%= yield :sidebar %> | ||||||
| 				</ul> | 				</ol> | ||||||
| 			</div> | 			</div> | ||||||
| 		</div> | 		</div> | ||||||
| 	</nav> | 	</nav> | ||||||
|  |  | ||||||
|  | @ -204,6 +204,10 @@ en: | ||||||
|     options: Options |     options: Options | ||||||
|     orig_upload_file: Original filename |     orig_upload_file: Original filename | ||||||
|     page: Page |     page: Page | ||||||
|  |     page_part_kinds: | ||||||
|  |       text: Text Area | ||||||
|  |       public_r_tag: System Widget | ||||||
|  |       module_widget: Plug-in Module Widget | ||||||
|     position: Position |     position: Position | ||||||
|     published?: Published? |     published?: Published? | ||||||
|     purchase: Purchase |     purchase: Purchase | ||||||
|  |  | ||||||
|  | @ -203,6 +203,10 @@ zh_tw: | ||||||
|       edit: 編輯 |       edit: 編輯 | ||||||
|       ob_auth: |       ob_auth: | ||||||
|         edit: 分類授權 |         edit: 分類授權 | ||||||
|  |     page_part_kinds: | ||||||
|  |       text: 文字區塊 | ||||||
|  |       public_r_tag: 系統模塊 | ||||||
|  |       module_widget: 外掛模塊 | ||||||
|     position: 位置 |     position: 位置 | ||||||
|     published?: 發布? |     published?: 發布? | ||||||
|     purchase: 購買 |     purchase: 購買 | ||||||
|  |  | ||||||
|  | @ -54,6 +54,7 @@ Orbit::Application.routes.draw do | ||||||
|       get 'add_attribute_field' |       get 'add_attribute_field' | ||||||
|     end |     end | ||||||
|     resources :items |     resources :items | ||||||
|  |     match 'update_position' => 'items#update_position' | ||||||
|     resources :links do |     resources :links do | ||||||
|       member do |       member do | ||||||
|         get 'delete' |         get 'delete' | ||||||
|  |  | ||||||
|  | @ -14,7 +14,7 @@ module ParserBackEnd | ||||||
|       #   }.join(' | ') |       #   }.join(' | ') | ||||||
|       # end |       # end | ||||||
|       # c.define_tag 'link' do |tag| |       # c.define_tag 'link' do |tag| | ||||||
|       #   item = Item.first(:conditions => { :full_name => tag.attr['name'] }) |       #   item = Item.first(:conditions => { :path => tag.attr['name'] }) | ||||||
|       #   ret = '' |       #   ret = '' | ||||||
|       #   ret << "<a href='" |       #   ret << "<a href='" | ||||||
|       #   ret << eval("admin_#{item._type.downcase}_path(item.id)") |       #   ret << eval("admin_#{item._type.downcase}_path(item.id)") | ||||||
|  | @ -23,64 +23,19 @@ module ParserBackEnd | ||||||
|       #   ret << "</a>" |       #   ret << "</a>" | ||||||
|       # end |       # end | ||||||
| 
 | 
 | ||||||
|   def parse_page_edit_noko(page, id = nil) |   def parse_page_edit_noko(page) | ||||||
|     body = Nokogiri::HTML(page.design.layout.body) |     body = Nokogiri::HTML(page.design.layout.body) | ||||||
|     parse_menu(body, page, true) |     parse_menu(body, page, true) | ||||||
|     public_r_tags = parse_content_edits(body, page, id) |     public_r_tags = parse_contents(body, page, true) | ||||||
|     parse_images(body, page) |     parse_images(body, page) | ||||||
|     parse_footer(body, page, true) |     parse_footer(body, page) | ||||||
|     parse_sub_menu(body, page, true) |     parse_sub_menu(body, page) | ||||||
| 
 |  | ||||||
|     public_r_tags.each do |tag| |     public_r_tags.each do |tag| | ||||||
|       send("parse_#{tag}s", body, page, id, true) |       send("parse_#{tag}s", body, page, true) | ||||||
|     end |     end | ||||||
| 
 |  | ||||||
|     body.to_html |     body.to_html | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   # page_contents |  | ||||||
|   def parse_content_edits(body, page, id) |  | ||||||
|     public_r_tags = [] |  | ||||||
|     body.css('.page_content').each do |content| |  | ||||||
|       ret = '' |  | ||||||
|       if (content["main"] == "true" && !page.module_app.nil?) |  | ||||||
|         ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}?inner=true&page_id=#{page.id}" |  | ||||||
|         ret << "&category_id=#{page.category}" if page[:category] |  | ||||||
|         ret << "'></div>" |  | ||||||
|       else |  | ||||||
|         part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil |  | ||||||
|         ret << "<div id='#{content['name']}' part_id='#{part.id}' class='editable' style='border:solid 1px; margin:5px; padding:5px;'>" if part |  | ||||||
|         ret << "<div class='edit_link' style='display:none'>" |  | ||||||
|         ret << " <a href='#{edit_admin_page_part_path(part.id)}' class='nav'>#{t(:edit)}</a>" if part |  | ||||||
|         ret << '</div>' |  | ||||||
|         case part.kind |  | ||||||
|         when 'text' |  | ||||||
|           ret << part.i18n_variable[I18n.locale] rescue '' |  | ||||||
|         when 'module_widget' |  | ||||||
|           if part[:category] |  | ||||||
|             ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?category_id=#{part[:category]}'></div>" |  | ||||||
|           else |  | ||||||
|             ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}'></div>" |  | ||||||
|           end |  | ||||||
|         when 'public_r_tag' |  | ||||||
|           ret << "<r:#{part.public_r_tag} id='#{part.public_r_tag_object_id}'/>" |  | ||||||
|           public_r_tags << part.public_r_tag |  | ||||||
|         else |  | ||||||
|             '' |  | ||||||
|         end if part |  | ||||||
|       end |  | ||||||
|       scope = "<#{content.name}" |  | ||||||
|       content.attributes.each_pair do |key, value| |  | ||||||
|         scope << " #{key}='#{value}'" |  | ||||||
|       end |  | ||||||
|       scope << ">#{ret}</#{content.name}>" |  | ||||||
|       fragment = Nokogiri::HTML::DocumentFragment.new(body, scope) |  | ||||||
|       content.swap(fragment) |  | ||||||
|     end |  | ||||||
|     public_r_tags.uniq |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|   def self.included(base) |   def self.included(base) | ||||||
|     base.send :helper_method, :parse_page_edit_noko if base.respond_to? :helper_method |     base.send :helper_method, :parse_page_edit_noko if base.respond_to? :helper_method | ||||||
|   end |   end | ||||||
|  |  | ||||||
|  | @ -3,7 +3,7 @@ module ParserCommon | ||||||
| 
 | 
 | ||||||
|   def menu_level(page, current_page, current, menu, edit = false) |   def menu_level(page, current_page, current, menu, edit = false) | ||||||
|     res = '' |     res = '' | ||||||
|     if page.ordered_and_visible_children.size > 0 |     if page.visible_children.size > 0 | ||||||
|       res << "<ul class='" |       res << "<ul class='" | ||||||
|       res << menu.values["class_#{current}"] rescue nil |       res << menu.values["class_#{current}"] rescue nil | ||||||
|       res << "'>" |       res << "'>" | ||||||
|  | @ -12,7 +12,7 @@ module ParserCommon | ||||||
|       if menu.values['home'] && current == 1 |       if menu.values['home'] && current == 1 | ||||||
|         res << menu_li(page, current_page, current, menu, i, edit) |         res << menu_li(page, current_page, current, menu, i, edit) | ||||||
|       end |       end | ||||||
|       page.ordered_and_visible_children.each do |child| |       page.visible_children.each do |child| | ||||||
|         res << menu_li(child, current_page, current, menu, i, edit) |         res << menu_li(child, current_page, current, menu, i, edit) | ||||||
|         i += 1 if i |         i += 1 if i | ||||||
|       end |       end | ||||||
|  | @ -25,18 +25,18 @@ module ParserCommon | ||||||
|     res = "<li class='" |     res = "<li class='" | ||||||
|     res << menu.values["li_class_#{current}"] rescue nil |     res << menu.values["li_class_#{current}"] rescue nil | ||||||
|     res << "_#{i}" if i |     res << "_#{i}" if i | ||||||
|     res << " active" if (current_page.id.eql?(page.id) || current_page.ancestor_ids.include?(page.id)) |     res << " active" if (current_page.id.eql?(page.id) || current_page.descendant_of?(page)) | ||||||
|     res << "'>" |     res << "'>" | ||||||
|     res << "<a href='/#{edit ? admin_page_path(page.id) : page.full_name}'><span>#{page.i18n_variable[I18n.locale]}</span></a>" |     res << "<a href='/#{edit ? admin_page_path(page.id) : page.path}'><span>#{page.i18n_variable[I18n.locale]}</span></a>" | ||||||
|     if page.ordered_and_visible_children.size > 0 && current <= menu.levels |     if page.visible_children.size > 0 && current <= menu.levels | ||||||
|       res << "<span class='dot'></span>" |       res << "<span class='dot'></span>" | ||||||
|       res << menu_level(page, current_page, current + 1, menu, edit) |       res << menu_level(page, current_page, current + 1, menu, edit) | ||||||
|     end unless (page.is_home? rescue nil) |     end unless (page.root? rescue nil) | ||||||
|     res << "</li>" |     res << "</li>" | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   # ad_banners |   # ad_banners | ||||||
|   def parse_ad_banners(body = nil, page = nil, id = nil, edit=nil) |   def parse_ad_banners(body = nil, page = nil, edit=nil) | ||||||
|     body.css('ad_banner').each do |banner| |     body.css('ad_banner').each do |banner| | ||||||
|       res = '' |       res = '' | ||||||
|       ad_banner = AdBanner.find(banner["id"]) rescue nil |       ad_banner = AdBanner.find(banner["id"]) rescue nil | ||||||
|  | @ -82,7 +82,7 @@ module ParserCommon | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   # page_images |   # page_images | ||||||
|   def parse_images(body, page, id = nil, edit=nil) |   def parse_images(body, page, edit=nil) | ||||||
|     body.css('.page_image').each do |page_image| |     body.css('.page_image').each do |page_image| | ||||||
|       # image = page.custom_images.detect{|image| image.name.eql?(tag.attr['name']) } |       # image = page.custom_images.detect{|image| image.name.eql?(tag.attr['name']) } | ||||||
|       # image = page.design.custom_images.detect{|image| image.name.eql?(tag.attr['name']) } unless image |       # image = page.design.custom_images.detect{|image| image.name.eql?(tag.attr['name']) } unless image | ||||||
|  | @ -109,17 +109,17 @@ module ParserCommon | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   # sub_menus |   # sub_menus | ||||||
|   def parse_sub_menus(body = nil, page = nil, id = nil, edit=nil) |   def parse_sub_menus(body = nil, page = nil, edit=nil) | ||||||
|     body.css('sub_menu').each do |sub_menu| |     body.css('sub_menu').each do |sub_menu| | ||||||
|       menu_page = Page.find(sub_menu['id']) rescue nil |       menu_page = Page.find(sub_menu['id']) rescue nil | ||||||
|       res = '' |       res = '' | ||||||
|       if menu_page && menu_page.ordered_and_visible_children.size > 0 |       if menu_page && menu_page.visible_children.size > 0 | ||||||
|         res << "<div class='category_list'>" |         res << "<div class='category_list'>" | ||||||
|         res << "<h3 class='h3'>#{menu_page.i18n_variable[I18n.locale]}</h3>" |         res << "<h3 class='h3'>#{menu_page.i18n_variable[I18n.locale]}</h3>" | ||||||
|         res << "<ul class='list'>" |         res << "<ul class='list'>" | ||||||
|         menu_page.ordered_and_visible_children.each do |child| |         menu_page.visible_children.each do |child| | ||||||
|           res << "<li class='#{page.id.eql?(child.id) ? 'active' : nil}'>" |           res << "<li class='#{page.id.eql?(child.id) ? 'active' : nil}'>" | ||||||
|           res << "<a href='/#{edit ? admin_page_path(child.id) : child.full_name}'>#{child.i18n_variable[I18n.locale]}</a>" |           res << "<a href='/#{edit ? admin_page_path(child.id) : child.path}'>#{child.i18n_variable[I18n.locale]}</a>" | ||||||
|           res << "</li>" |           res << "</li>" | ||||||
|         end |         end | ||||||
|         res << "</ul>" |         res << "</ul>" | ||||||
|  | @ -132,7 +132,7 @@ module ParserCommon | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   # page_footer |   # page_footer | ||||||
|   def parse_footer(body, page, edit=nil) |   def parse_footer(body, page) | ||||||
|     page_footer = body.css('.page_footer').first |     page_footer = body.css('.page_footer').first | ||||||
|     if page_footer |     if page_footer | ||||||
|       res = "<div id='#{page_footer['id']}', class='#{page_footer['class']}'>" |       res = "<div id='#{page_footer['id']}', class='#{page_footer['class']}'>" | ||||||
|  | @ -146,7 +146,7 @@ module ParserCommon | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   # page_sub_menu |   # page_sub_menu | ||||||
|   def parse_sub_menu(body, page, edit=nil) |   def parse_sub_menu(body, page) | ||||||
|     page_sub_menu = body.css('.page_sub_menu').first |     page_sub_menu = body.css('.page_sub_menu').first | ||||||
|     if page_sub_menu |     if page_sub_menu | ||||||
|       res = "<div id='#{page_sub_menu['id']}', class='#{page_sub_menu['class']}'>" |       res = "<div id='#{page_sub_menu['id']}', class='#{page_sub_menu['class']}'>" | ||||||
|  | @ -159,4 +159,50 @@ module ParserCommon | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|  |   # page_contents | ||||||
|  |   def parse_contents(body, page, edit=nil) | ||||||
|  |     public_r_tags = [] | ||||||
|  |     body.css('.page_content').each do |content| | ||||||
|  |       ret = '' | ||||||
|  |       category = params[:category_id].blank? ? page[:category] : params[:category_id] | ||||||
|  |       tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id] | ||||||
|  |       if (content["main"] == "true" && !page.module_app.nil?) | ||||||
|  |         ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}" | ||||||
|  |         ret << "/#{params[:id]}" if params[:id] && !params[:id].eql?(page.id.to_s) | ||||||
|  |         ret << "?inner=true&page_id=#{page.id}&category_id=#{category}&tag_id=#{tag}&preview=#{params[:preview]}&page_main=#{params[:page_main]}" | ||||||
|  |         ret << "'></div>" | ||||||
|  |       else | ||||||
|  |         part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil | ||||||
|  |         part_title = part.title[I18n.locale] rescue nil | ||||||
|  |         if edit | ||||||
|  |           ret << "<div id='#{content['name']}' part_id='#{part.id}' class='editable' style='border:solid 1px; margin:5px; padding:5px;'>" if part | ||||||
|  |           ret << "<div class='edit_link' style='display:none'>" | ||||||
|  |           ret << " <a href='#{edit_admin_page_part_path(part.id)}' class='nav'>#{t(:edit)}</a>" if part | ||||||
|  |           ret << '</div>' | ||||||
|  |         end | ||||||
|  |         case part.kind | ||||||
|  |         when 'text' | ||||||
|  |           ret << part.i18n_variable[I18n.locale] rescue '' | ||||||
|  |         when 'module_widget' | ||||||
|  |           url = "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true" | ||||||
|  |           options = "&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}" | ||||||
|  |           ret << "<div class='dymanic_load' path='#{url + options}'></div>" | ||||||
|  |         when 'public_r_tag' | ||||||
|  |           ret << "<r:#{part.public_r_tag} id='#{part.public_r_tag_object_id}'/>" | ||||||
|  |           public_r_tags << part.public_r_tag | ||||||
|  |         else | ||||||
|  |             '' | ||||||
|  |         end if part | ||||||
|  |       end | ||||||
|  |       scope = "<#{content.name}" | ||||||
|  |       content.attributes.each_pair do |key, value| | ||||||
|  |         scope << " #{key}='#{value}'" | ||||||
|  |       end | ||||||
|  |       scope << ">#{ret}</#{content.name}>" | ||||||
|  |       fragment = Nokogiri::HTML::DocumentFragment.new(body, scope) | ||||||
|  |       content.swap(fragment) | ||||||
|  |     end | ||||||
|  |     public_r_tags.uniq | ||||||
|  |   end | ||||||
|  | 
 | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -11,7 +11,7 @@ module ParserFrontEnd | ||||||
|     #     }.join(' | ') |     #     }.join(' | ') | ||||||
|     #   end |     #   end | ||||||
|     #   c.define_tag 'link' do |tag| |     #   c.define_tag 'link' do |tag| | ||||||
|     #     item = Item.first(:conditions => { :full_name => tag.attr['name'] }) |     #     item = Item.first(:conditions => { :path => tag.attr['name'] }) | ||||||
|     #     ret = '' |     #     ret = '' | ||||||
|     #     ret << "<a href='#{tag.attr['name']}'>" |     #     ret << "<a href='#{tag.attr['name']}'>" | ||||||
|     #     ret << item.i18n_variable[I18n.locale] |     #     ret << item.i18n_variable[I18n.locale] | ||||||
|  | @ -21,69 +21,18 @@ module ParserFrontEnd | ||||||
| 
 | 
 | ||||||
|   require 'nokogiri' |   require 'nokogiri' | ||||||
| 
 | 
 | ||||||
|   def parse_page_noko(page, id = nil,params) |   def parse_page_noko(page) | ||||||
|     body = Nokogiri::HTML(page.design.layout.body) |     body = Nokogiri::HTML(page.design.layout.body) | ||||||
|     parse_menu(body, page) |     parse_menu(body, page) | ||||||
|     public_r_tags = parse_contents(body, page, id,params[:preview]) |     public_r_tags = parse_contents(body, page) | ||||||
|     parse_images(body, page) |     parse_images(body, page) | ||||||
|     parse_footer(body, page) |     parse_footer(body, page) | ||||||
|     parse_sub_menu(body, page) |     parse_sub_menu(body, page) | ||||||
| 
 |  | ||||||
|     public_r_tags.each do |tag| |     public_r_tags.each do |tag| | ||||||
|       send("parse_#{tag}s", body, page,id) |       send("parse_#{tag}s", body, page) | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     body.to_html |     body.to_html | ||||||
|   end |   end | ||||||
|    |    | ||||||
|   # page_contents |  | ||||||
|   def parse_contents(body, page, id,preview = false) |  | ||||||
|     public_r_tags = [] |  | ||||||
|     body.css('.page_content').each do |content| |  | ||||||
|       ret = '' |  | ||||||
|       if (content["main"] == "true" && !page.module_app.nil?) |  | ||||||
|         ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}" |  | ||||||
|         ret << "/#{id}" if id |  | ||||||
|         ret << "?inner=true&page_id=#{page.id}" |  | ||||||
|         # ret << "&category_id=#{page.category}" if page[:category] |  | ||||||
|         ret << "&category_id=#{params[:category_id]}" if !params[:category_id].blank? |  | ||||||
|         ret << "&tag_id=#{params[:tag_id]}" if !params[:tag_id].blank? |  | ||||||
|         ret << "&preview=true" if preview.eql?('true') |  | ||||||
|         ret << "'></div>" |  | ||||||
|       else |  | ||||||
|         part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil |  | ||||||
|         case part.kind |  | ||||||
|         when 'text' |  | ||||||
|           ret << part.i18n_variable[I18n.locale] rescue '' |  | ||||||
|         when 'module_widget' |  | ||||||
|           # if part[:category] |  | ||||||
|           #   ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&category_id=#{part[:category]}'></div>" |  | ||||||
|           # else |  | ||||||
|           #   ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true'></div>" |  | ||||||
|           # end |  | ||||||
|           if !params[:category_id].blank? |  | ||||||
|             ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&category_id=#{params[:category_id]}'></div>" |  | ||||||
|           elsif !params[:tag_id].blank? |  | ||||||
|             ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&tag_id=#{params[:tag_id]}'></div>" |  | ||||||
|           else |  | ||||||
|             ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true'></div>" |  | ||||||
|           end |  | ||||||
|         when 'public_r_tag' |  | ||||||
|           ret << "<r:#{part.public_r_tag} id='#{part.public_r_tag_object_id}'/>" |  | ||||||
|           public_r_tags << part.public_r_tag |  | ||||||
|         else |  | ||||||
|             '' |  | ||||||
|         end if part |  | ||||||
|       end |  | ||||||
|       scope = "<#{content.name}" |  | ||||||
|       content.attributes.each_pair do |key, value| |  | ||||||
|         scope << " #{key}='#{value}'" |  | ||||||
|       end |  | ||||||
|       scope << ">#{ret}</#{content.name}>" |  | ||||||
|       fragment = Nokogiri::HTML::DocumentFragment.new(body, scope) |  | ||||||
|       content.swap(fragment) |  | ||||||
|     end |  | ||||||
|     public_r_tags.uniq |  | ||||||
|   end |  | ||||||
|    |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -0,0 +1,19 @@ | ||||||
|  | # encoding: utf-8  | ||||||
|  | 
 | ||||||
|  | namespace :items do | ||||||
|  |   task :tree_changes => :environment do | ||||||
|  |   	Item.all.each do |item| | ||||||
|  |   		item.position -= item.position > 5 ? 2 : 1 | ||||||
|  |   		item.parent_ids = ancestors(item) | ||||||
|  |   		item.rename(:full_name, :path) | ||||||
|  |   		item.save | ||||||
|  |   	end | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|  |   def ancestors(item) | ||||||
|  |     node, nodes = item, [] | ||||||
|  |     nodes << node = node.parent while !node.parent.blank? rescue nil | ||||||
|  |     nodes.reverse | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|  | end | ||||||
|  | @ -1,9 +0,0 @@ | ||||||
| // This is a manifest file that'll be compiled into including all the files listed below.
 |  | ||||||
| // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
 |  | ||||||
| // be included in the compiled file accessible from http://example.com/assets/application.js
 |  | ||||||
| // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
 |  | ||||||
| // the compiled file.
 |  | ||||||
| //
 |  | ||||||
| //= require jquery
 |  | ||||||
| //= require jquery_ujs
 |  | ||||||
| //= require announcement_link
 |  | ||||||
|  | @ -12,18 +12,16 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController | ||||||
|    |    | ||||||
|     date_now = Time.now |     date_now = Time.now | ||||||
|     if !params[:category_id].blank? |     if !params[:category_id].blank? | ||||||
|       @bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) |       @bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10) | ||||||
|  |       @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil | ||||||
|     elsif !params[:tag_id].blank? |     elsif !params[:tag_id].blank? | ||||||
|       tmp = AnnouncementTag.find(params[:tag_id]) rescue nil |       @tag = AnnouncementTag.find(params[:tag_id]) rescue nil | ||||||
|       tmp = AnnouncementTag.where(key: params[:tag_id])[0] unless tmp |       @tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag | ||||||
|       @bulletins = tmp.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) |       @bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10) | ||||||
|     else |     else | ||||||
|       @bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) |       @bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10) | ||||||
|     end |     end | ||||||
| 	   | 	   | ||||||
| 	  get_categorys |  | ||||||
| 	   |  | ||||||
| 	  @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil |  | ||||||
|   end |   end | ||||||
|    |    | ||||||
|   def show |   def show | ||||||
|  |  | ||||||
|  | @ -9,16 +9,17 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController | ||||||
|   # GET /bulletins.xml |   # GET /bulletins.xml | ||||||
|    |    | ||||||
|   def index |   def index | ||||||
| 	 |     @title = params[:part_title] | ||||||
| 	# deadline |     date_now = Time.now | ||||||
| 	# @bulletin_categorys = BulletinCategory.first; |  | ||||||
|     # @bulletins = Bulletin.widget_datas(@bulletin_categorys.id).limit(9) |  | ||||||
|     if !params[:category_id].blank? |     if !params[:category_id].blank? | ||||||
|       @bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).widget_datas.limit(9) |       @bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) | ||||||
|  |       @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil | ||||||
|     elsif !params[:tag_id].blank? |     elsif !params[:tag_id].blank? | ||||||
|       @bulletins = AnnouncementTag.find(params[:tag_id]).bulletins.can_display.widget_datas.limit(9) rescue nil |       @tag = AnnouncementTag.find(params[:tag_id]) rescue nil | ||||||
|  |       @tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag | ||||||
|  |       @bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) | ||||||
|     else |     else | ||||||
|       @bulletins = Bulletin.can_display.widget_datas.limit(9) |       @bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     get_categorys |     get_categorys | ||||||
|  | @ -30,7 +31,6 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController | ||||||
|     @selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0] |     @selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0] | ||||||
|     @bulletins = @selected_tag.get_visible_bulletins.can_display.page(params[:page]).per(5) rescue nil |     @bulletins = @selected_tag.get_visible_bulletins.can_display.page(params[:page]).per(5) rescue nil | ||||||
|     @web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil |     @web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil | ||||||
|     render :layout => 'module_widget' |  | ||||||
|   end |   end | ||||||
|    |    | ||||||
|   def reload_bulletins |   def reload_bulletins | ||||||
|  |  | ||||||
|  | @ -0,0 +1,44 @@ | ||||||
|  | <% if bulletin_category -%> | ||||||
|  | 
 | ||||||
|  | <div class="modal hide fade in" id="bulletin_category-<%=bulletin_category.id%>"> | ||||||
|  |   <div class="modal-header"> | ||||||
|  |     <a class="close" data-dismiss="modal">×</a> | ||||||
|  |     <h3><%= t("announcement.bulletin.submit_user_list") %></h3> | ||||||
|  |   </div> | ||||||
|  |   <div class="modal-body"> | ||||||
|  | 		<div class="clear"> | ||||||
|  | 			<% bulletin_category.get_object_auth_by_title('submit').auth_users.each do |user| %> | ||||||
|  | 			<div class="checkbox clear checked"> | ||||||
|  | 					<div class='member-avatar'> | ||||||
|  | 						<% if user.avatar? %> | ||||||
|  | 							<%= image_tag(user.avatar.thumb.url,:class => "member-img") %> | ||||||
|  | 						<% else %> | ||||||
|  | 							<%= image_tag "person.png",:class => "member-img" %> | ||||||
|  | 						<% end %>	 | ||||||
|  | 					</div> | ||||||
|  | 					<%= label_tag "lab-user-#{user.id}", (user.name rescue ''),:class=>"member-name",:id=>nil -%> | ||||||
|  | 			</div> | ||||||
|  | 			<% end -%> | ||||||
|  | 		<divl> | ||||||
|  |   </div> | ||||||
|  |   <div class="modal-footer"> | ||||||
|  |     <a href="#" class="btn" data-dismiss="modal"><%= t("modal.close") %></a> | ||||||
|  |   </div> | ||||||
|  |   <div> | ||||||
|  |   	<script type="text/javascript" src="/static/kernel.js"></script> | ||||||
|  | 		<script type="text/javascript"> | ||||||
|  | 			$(document).ready(function() { | ||||||
|  | 	 | ||||||
|  | 			$("#bulletin_category-<%=bulletin_category.id%>").on("show", function () { | ||||||
|  | 			}); | ||||||
|  | 		$(".modal").on("hidden", function () { | ||||||
|  | 	  $("#show_preview").remove(); | ||||||
|  | 			}); | ||||||
|  | 		}); | ||||||
|  | 		</script> | ||||||
|  | 	</div> | ||||||
|  | </div> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | <% end -%> | ||||||
|  | @ -3,9 +3,9 @@ | ||||||
| <%= flash_messages %> | <%= flash_messages %> | ||||||
| 
 | 
 | ||||||
| <% if @current_category %> | <% if @current_category %> | ||||||
| 	<h1 class="h1"><%= @current_category.i18n_variable[I18n.locale] + t('announcement.bulletin.list_lower') %></h1> | 	<h1 class="h1"><%= @current_category.i18n_variable[I18n.locale] %></h1> | ||||||
| <% else %> | <% else %> | ||||||
| 	<h1 class="h1"><%= t('announcement.list_announcement') %></h1> | 	<h1 class="h1"><%= t('announcement.announcement') %></h1> | ||||||
| <% end %> | <% end %> | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -29,5 +29,5 @@ | ||||||
| 
 | 
 | ||||||
| </table> | </table> | ||||||
| 
 | 
 | ||||||
| <%= paginate @bulletins, :params => {:inner => 'false'} %> | <%= paginate @bulletins, :param_name => :page_main, :params => {:inner => 'false'} %> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -0,0 +1,25 @@ | ||||||
|  | <% if @title %> | ||||||
|  | 	<h1 class="h1"><%= @title %></h1> | ||||||
|  | <% end %> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | <table class="table table-bordered"> | ||||||
|  |   <tr> | ||||||
|  | 	<th><%= t('announcement.bulletin.category') %></th> | ||||||
|  | 	<th><%= t('announcement.bulletin.title') %></th> | ||||||
|  | 	<th><%= t('announcement.bulletin.postdate') %></th> | ||||||
|  |   </tr> | ||||||
|  | 
 | ||||||
|  | <% @bulletins.each do |post| %> | ||||||
|  |   <tr> | ||||||
|  | 	<td><%= post.bulletin_category.i18n_variable[I18n.locale] %></td> | ||||||
|  | 	<td><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %> | ||||||
|  | 	</td> | ||||||
|  | 	<td><%= post.postdate %></td> | ||||||
|  |   </tr> | ||||||
|  |    | ||||||
|  | <% end %> | ||||||
|  | 
 | ||||||
|  | </table> | ||||||
|  | 
 | ||||||
|  | <%= paginate @bulletins, :params => {:inner => 'true'}, :remote => true %> | ||||||
|  | @ -17,3 +17,7 @@ | ||||||
| 		<%= render 'web_links' if @web_links %> | 		<%= render 'web_links' if @web_links %> | ||||||
| 	</ul> | 	</ul> | ||||||
| </div> | </div> | ||||||
|  | 
 | ||||||
|  | <% content_for :page_specific_javascript do %> | ||||||
|  | 	<%= javascript_include_tag "news_link" %> | ||||||
|  | <% end %> | ||||||
|  | @ -1,20 +1,3 @@ | ||||||
| <% # encoding: utf-8 %> | <div id="bulletin_widget"> | ||||||
| 
 | 	<%= render 'index' %> | ||||||
| <% if @bulletins and !@bulletins.nil? %> | </div> | ||||||
| 	<h2 class="topic_title"><%= t('announcement.campus_news')%></h2> |  | ||||||
| 	<%= link_to t('announcement.more'),panel_announcement_front_end_bulletins_path(), :class => "topic_note" %> |  | ||||||
| 	<div class="topic_prev">previous page</div> |  | ||||||
| 	<div class="topic_next">next page</div> |  | ||||||
| 	<ul id="topic_list"> |  | ||||||
| 		<% @bulletins.each do |post| %> |  | ||||||
| 		<li> |  | ||||||
| 			<div class="news_img"><%= image_tag(post.image.url, :size => "290x130") if post.image.file %></div> |  | ||||||
| 			<h3 class="h3 news_title"><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %></h3> |  | ||||||
| 			<p class="news_wrap"><%= post.subtitle[I18n.locale].html_safe %></p> |  | ||||||
| 		</li> |  | ||||||
| 		<% end %> |  | ||||||
| 	</ul> |  | ||||||
| 
 |  | ||||||
| <% end %> |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  | $('#bulletin_widget').html("<%= j render 'index' %>") | ||||||
|  | @ -58,6 +58,7 @@ en: | ||||||
|   announcement: |   announcement: | ||||||
|     all_articles: List |     all_articles: List | ||||||
|     add_new: Add |     add_new: Add | ||||||
|  |     announcement: Announcement | ||||||
|     categories: Categories |     categories: Categories | ||||||
|     error:  |     error:  | ||||||
|       no_avilb_cate_for_posting: You need a category to submit your post,please contact admin |       no_avilb_cate_for_posting: You need a category to submit your post,please contact admin | ||||||
|  | @ -66,8 +67,8 @@ en: | ||||||
|     more: more+ |     more: more+ | ||||||
|     bulletins: Bulletins |     bulletins: Bulletins | ||||||
|     related_links: Related Links |     related_links: Related Links | ||||||
|     list_announcement: List Announcement |  | ||||||
|     bulletin: |     bulletin: | ||||||
|  |       submit_user_list: Submit User | ||||||
|       category: Category |       category: Category | ||||||
|       list_lower: " list" |       list_lower: " list" | ||||||
|       title: Title |       title: Title | ||||||
|  |  | ||||||
|  | @ -37,6 +37,7 @@ zh_tw: | ||||||
|   announcement: |   announcement: | ||||||
|     add_new: 新增 |     add_new: 新增 | ||||||
|     all_articles: 列表 |     all_articles: 列表 | ||||||
|  |     announcement: 公告 | ||||||
|     error:  |     error:  | ||||||
|       no_avilb_cate_for_posting: 您目前沒有分類可以刊登公告,請聯絡系統管理員為您開通分類 |       no_avilb_cate_for_posting: 您目前沒有分類可以刊登公告,請聯絡系統管理員為您開通分類 | ||||||
|     tags: 標籤 |     tags: 標籤 | ||||||
|  | @ -47,9 +48,9 @@ zh_tw: | ||||||
|     more: 更多+ |     more: 更多+ | ||||||
|     bulletins: 公告訊息 |     bulletins: 公告訊息 | ||||||
|     related_links: 相關連結  |     related_links: 相關連結  | ||||||
|     list_announcement: 公告列表 |  | ||||||
|     bulletin: |     bulletin: | ||||||
|       category: 分類 |       category: 分類 | ||||||
|  |       submit_user_list: 張貼人 | ||||||
|       list_lower: 列表 |       list_lower: 列表 | ||||||
|       title: 標題 |       title: 標題 | ||||||
|       postdate: 張貼日期 |       postdate: 張貼日期 | ||||||
|  | @ -173,7 +174,9 @@ zh_tw: | ||||||
|      |      | ||||||
|   panel: |   panel: | ||||||
|      |      | ||||||
|      |   bulletin_category: | ||||||
|  |     edit: 修改 | ||||||
|  |     delete: 刪除   | ||||||
|      |      | ||||||
| # Chinese (Taiwan) translations for Ruby on Rails | # Chinese (Taiwan) translations for Ruby on Rails | ||||||
| # by tsechingho (http://github.com/tsechingho) | # by tsechingho (http://github.com/tsechingho) | ||||||
|  |  | ||||||
|  | @ -11,13 +11,13 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController | ||||||
|   def index |   def index | ||||||
|     date_now = Time.now |     date_now = Time.now | ||||||
|     if !params[:category_id].blank? |     if !params[:category_id].blank? | ||||||
|       @news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) |       @news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10) | ||||||
|     elsif !params[:tag_id].blank? |     elsif !params[:tag_id].blank? | ||||||
|       tmp = NewsTag.find(params[:tag_id]) rescue nil |       tmp = NewsTag.find(params[:tag_id]) rescue nil | ||||||
|       tmp = NewsTag.where(key: params[:tag_id])[0] unless tmp |       tmp = NewsTag.where(key: params[:tag_id])[0] unless tmp | ||||||
|       @news_bulletins = tmp.news_bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) rescue nil |       @news_bulletins = tmp.news_bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10) rescue nil | ||||||
|     else |     else | ||||||
|       @news_bulletins = NewsBulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) |       @news_bulletins = NewsBulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10) | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
| 	  get_categorys | 	  get_categorys | ||||||
|  |  | ||||||
|  | @ -9,20 +9,19 @@ class Panel::News::Widget::NewsBulletinsController < OrbitWidgetController | ||||||
|   # GET /news_bulletins.xml |   # GET /news_bulletins.xml | ||||||
|    |    | ||||||
|   def index |   def index | ||||||
| 	 |     @title = params[:part_title] | ||||||
| 	# deadline |     date_now = Time.now | ||||||
| 	# @news_bulletin_categorys = NewsBulletinCategory.first; |  | ||||||
|     # @news_bulletins = NewsBulletin.widget_datas(@news_bulletin_categorys.id).limit(9) |  | ||||||
|     if !params[:category_id].blank? |     if !params[:category_id].blank? | ||||||
|       @news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).widget_datas.limit(9) |       @news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(5) | ||||||
|  |       @current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil | ||||||
|     elsif !params[:tag_id].blank? |     elsif !params[:tag_id].blank? | ||||||
|       @news_bulletins = NewsTag.find(params[:tag_id]).news_bulletins.can_display.widget_datas.limit(9) rescue nil |       @tag = NewsTag.find(params[:tag_id]) rescue nil | ||||||
|  |       @tag = NewsTag.where(key: params[:tag_id])[0] unless @tag | ||||||
|  |       @news_bulletins = @tag.news_bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(5) rescue nil | ||||||
|     else |     else | ||||||
|       @news_bulletins = NewsBulletin.can_display.widget_datas.limit(9) |       @news_bulletins = NewsBulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(5) | ||||||
|     end |     end | ||||||
|      |      | ||||||
| 	get_categorys |  | ||||||
| 	 |  | ||||||
|   end |   end | ||||||
|    |    | ||||||
|   def news_bulletins_and_web_links |   def news_bulletins_and_web_links | ||||||
|  | @ -30,7 +29,6 @@ class Panel::News::Widget::NewsBulletinsController < OrbitWidgetController | ||||||
|     @selected_tag = NewsTag.find(params[:id]) rescue @tags[0] |     @selected_tag = NewsTag.find(params[:id]) rescue @tags[0] | ||||||
|     @news_bulletins = @selected_tag.get_visible_news_bulletins.can_display.page(params[:page]).per(5) rescue nil |     @news_bulletins = @selected_tag.get_visible_news_bulletins.can_display.page(params[:page]).per(5) rescue nil | ||||||
|     @web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil |     @web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil | ||||||
|     render :layout => 'module_widget' |  | ||||||
|   end |   end | ||||||
|    |    | ||||||
|   def reload_news_bulletins |   def reload_news_bulletins | ||||||
|  | @ -48,6 +46,18 @@ class Panel::News::Widget::NewsBulletinsController < OrbitWidgetController | ||||||
|     get_categorys |     get_categorys | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|  |   def home_banner | ||||||
|  |     if !params[:category_id].blank? | ||||||
|  |       @news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).widget_datas.limit(9) | ||||||
|  |     elsif !params[:tag_id].blank? | ||||||
|  |       @news_bulletins = NewsTag.find(params[:tag_id]).news_bulletins.can_display.widget_datas.limit(9) rescue nil | ||||||
|  |     else | ||||||
|  |       @news_bulletins = NewsBulletin.can_display.widget_datas.limit(9) | ||||||
|  |     end | ||||||
|  |     get_categorys | ||||||
|  | 
 | ||||||
|  |   end | ||||||
|  |    | ||||||
|    |    | ||||||
|   protected |   protected | ||||||
|    |    | ||||||
|  |  | ||||||
|  | @ -0,0 +1,56 @@ | ||||||
|  | <% content_for :page_specific_css do %> | ||||||
|  | 	<%= stylesheet_link_tag "inc/permission-checkbox"  %> | ||||||
|  | <% end %> | ||||||
|  | <% content_for :page_specific_javascript do %> | ||||||
|  | 	<%= javascript_include_tag "inc/permission-checkbox"  %> | ||||||
|  | 	<%= javascript_include_tag "inc/search"  %> | ||||||
|  | 	<%= javascript_include_tag "inc/modal-preview"  %> | ||||||
|  | <% end %> | ||||||
|  | <%#= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %> | ||||||
|  | <%= form_tag('', :remote => true,:class => "prevent_enter_submit_form")  %> | ||||||
|  | <div class="subnav clear"> | ||||||
|  |     <ul class="nav nav-pills filter pull-left"> | ||||||
|  |         <li class="accordion-group"> | ||||||
|  |             <div class="form-search" style="margin: 5px 10px;"> | ||||||
|  |                 <%= label_tag :category, t("announcement.bulletin.category") %> | ||||||
|  |                 <%= select "category",'id',@options_from_collection_for_select_bulletin_categorys %> | ||||||
|  | 								<%= search_field_tag 'user_filter' %> | ||||||
|  |             </div> | ||||||
|  | 
 | ||||||
|  |         </li> | ||||||
|  |     </ul> | ||||||
|  | 		<%= link_to t("announcement.bulletin.submit_user_list"), panel_news_back_end_news_bulletin_category_user_list_path , :class=>'preview_trigger btn btn-success pull-right'%>	 | ||||||
|  | 
 | ||||||
|  | </div> | ||||||
|  | <%#= label_tag :role, t("admin.roles") %> | ||||||
|  | <div class="clear"> | ||||||
|  | <%= content_tag :div do -%> | ||||||
|  | 	<% form_tag panel_news_back_end_news_bulletin_category_setting_path  do %> | ||||||
|  | 		<%= render :partial => "privilege_user", :locals => {:users => @users_array} %> | ||||||
|  | 	<div class="form-actions form-fixed pagination-right"> | ||||||
|  | 	<%= submit_tag "Update", :class => 'btn btn-primary' %> | ||||||
|  | 	</div> | ||||||
|  | 	<% end -%> | ||||||
|  | <% end -%> | ||||||
|  | </div> | ||||||
|  | 
 | ||||||
|  | <script type="text/javascript" charset="utf-8"> | ||||||
|  | var availableTags = []; | ||||||
|  | $(document).ready(function() { | ||||||
|  | 	 | ||||||
|  | 	$(".prevent_enter_submit_form").bind("keypress", function(e) { | ||||||
|  | 		if (e.keyCode == 13) { | ||||||
|  | 			return false; | ||||||
|  | 		} | ||||||
|  | 	}); | ||||||
|  |     | ||||||
|  | 	$('#category_id').change(function() { | ||||||
|  | 		$.ajax({ | ||||||
|  | 			type: 'GET', | ||||||
|  | 			dataType: "script", | ||||||
|  | 			url:$(this).parents("from").attr("href"), | ||||||
|  | 			data:$(this).parents("form").serialize() | ||||||
|  | 		}); | ||||||
|  | 	}); | ||||||
|  | }); | ||||||
|  | </script> | ||||||
|  | @ -3,9 +3,9 @@ | ||||||
| <%= flash_messages %> | <%= flash_messages %> | ||||||
| 
 | 
 | ||||||
| <% if @current_category %> | <% if @current_category %> | ||||||
| 	<h1 class="h1"><%= @current_category.i18n_variable[I18n.locale] + t('news.news_bulletin.list_lower') %></h1> | 	<h1 class="h1"><%= @current_category.i18n_variable[I18n.locale] %></h1> | ||||||
| <% else %> | <% else %> | ||||||
| 	<h1 class="h1"><%= t('news.list_news') %></h1> | 	<h1 class="h1"><%= t('news.news') %></h1> | ||||||
| <% end %> | <% end %> | ||||||
| 
 | 
 | ||||||
| <table class="table table-bordered"> | <table class="table table-bordered"> | ||||||
|  | @ -28,5 +28,5 @@ | ||||||
| 	</tbody> | 	</tbody> | ||||||
| </table> | </table> | ||||||
| 
 | 
 | ||||||
| <%= paginate @news_bulletins, :params => {:inner => 'false'} %> | <%= paginate @news_bulletins, :param_name => :page_main, :params => {:inner => 'false'} %> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										27
									
								
								vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_index.html.erb
								
								
								
									vendored
								
								
									Normal file
								
							
							
						
						
									
										27
									
								
								vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_index.html.erb
								
								
								
									vendored
								
								
									Normal file
								
							|  | @ -0,0 +1,27 @@ | ||||||
|  | <% # encoding: utf-8 %> | ||||||
|  | 
 | ||||||
|  | <% if @title %> | ||||||
|  | 	<h1 class="h1"><%= @title %></h1> | ||||||
|  | <% end %> | ||||||
|  | 
 | ||||||
|  | <table class="table table-bordered"> | ||||||
|  | 	<tbody> | ||||||
|  | 		<tr> | ||||||
|  | 			<th class="span2"><%= t('news.news_bulletin.image') %></th> | ||||||
|  | 			<th><%= t('news.news_bulletin.title') %></th> | ||||||
|  | 			<th class="span2 pagination-right"><%= t('news.news_bulletin.postdate') %></th> | ||||||
|  | 		</tr> | ||||||
|  | 		<% @news_bulletins.each do |post| %> | ||||||
|  | 		<tr> | ||||||
|  | 			<td><%= image_tag post.image %></td> | ||||||
|  | 			<td> | ||||||
|  | 				<%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %> | ||||||
|  | 				<%= post.subtitle[I18n.locale].html_safe %> | ||||||
|  | 			</td> | ||||||
|  | 			<td><%= post.postdate %></td> | ||||||
|  | 		</tr> | ||||||
|  | 		<% end %>  | ||||||
|  | 	</tbody> | ||||||
|  | </table> | ||||||
|  | 
 | ||||||
|  | <%= paginate @news_bulletins, :params => {:inner => 'true'}, :remote => true %> | ||||||
							
								
								
									
										28
									
								
								vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/home_banner.html.erb
								
								
								
									vendored
								
								
									Normal file
								
							
							
						
						
									
										28
									
								
								vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/home_banner.html.erb
								
								
								
									vendored
								
								
									Normal file
								
							|  | @ -0,0 +1,28 @@ | ||||||
|  | <% if @news_bulletins and !@news_bulletins.nil? %> | ||||||
|  | 	<h2 class="topic_title"><%= t('news.campus_news')%></h2> | ||||||
|  | 	<%#= link_to t('news.more'),panel_news_front_end_news_bulletins_path(), :class => "topic_note" %> | ||||||
|  | 	<div class="btn-group topic_note"> | ||||||
|  | 	  <a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> | ||||||
|  | 	    <%= t('news.more') %> | ||||||
|  | 	    <span class="caret"></span> | ||||||
|  | 	  </a> | ||||||
|  | 	  <ul class="dropdown-menu"> | ||||||
|  | 	    <% @news_bulletin_categorys.each do |category| %> | ||||||
|  | 	    	<li> | ||||||
|  | 	    		<%= link_to category.i18n_variable[I18n.locale], panel_news_front_end_news_bulletins_path(:category_id => category.id) %> | ||||||
|  | 	    	</li> | ||||||
|  | 	    <% end %> | ||||||
|  | 	  </ul> | ||||||
|  | 	</div> | ||||||
|  | 	<div class="topic_prev">previous page</div> | ||||||
|  | 	<div class="topic_next">next page</div> | ||||||
|  | 	<ul id="topic_list"> | ||||||
|  | 		<% @news_bulletins.each do |post| %> | ||||||
|  | 		<li> | ||||||
|  | 			<div class="news_img"><%= image_tag(post.image.url, :size => "290x130") if post.image.file %></div> | ||||||
|  | 			<h3 class="h3 news_title"><%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post, :category_id => post.news_bulletin_category_id) %></h3> | ||||||
|  | 			<p class="news_wrap"><%= post.subtitle[I18n.locale].html_safe %></p> | ||||||
|  | 		</li> | ||||||
|  | 		<% end %> | ||||||
|  | 	</ul> | ||||||
|  | <% end %> | ||||||
|  | @ -1,33 +1,3 @@ | ||||||
| <% # encoding: utf-8 %> | <div id='news_bulletin_widget'> | ||||||
| 
 | 	<%= render 'index' %> | ||||||
| <% if @news_bulletins and !@news_bulletins.nil? %> |  | ||||||
| 	<h2 class="topic_title"><%= t('news.campus_news')%></h2> |  | ||||||
| 	<%#= link_to t('news.more'),panel_news_front_end_news_bulletins_path(), :class => "topic_note" %> |  | ||||||
| 	<div class="btn-group topic_note"> |  | ||||||
| 	  <a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> |  | ||||||
| 	    <%= t('news.more') %> |  | ||||||
| 	    <span class="caret"></span> |  | ||||||
| 	  </a> |  | ||||||
| 	  <ul class="dropdown-menu"> |  | ||||||
| 	    <% @news_bulletin_categorys.each do |category| %> |  | ||||||
| 	    	<li> |  | ||||||
| 	    		<%= link_to category.i18n_variable[I18n.locale], panel_news_front_end_news_bulletins_path(:category_id => category.id) %> |  | ||||||
| 	    	</li> |  | ||||||
| 	    <% end %> |  | ||||||
| 	  </ul> |  | ||||||
| </div> | </div> | ||||||
| 	<div class="topic_prev">previous page</div> |  | ||||||
| 	<div class="topic_next">next page</div> |  | ||||||
| 	<ul id="topic_list"> |  | ||||||
| 		<% @news_bulletins.each do |post| %> |  | ||||||
| 		<li> |  | ||||||
| 			<div class="news_img"><%= image_tag(post.image.url, :size => "290x130") if post.image.file %></div> |  | ||||||
| 			<h3 class="h3 news_title"><%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post, :category_id => post.news_bulletin_category_id) %></h3> |  | ||||||
| 			<p class="news_wrap"><%= post.subtitle[I18n.locale].html_safe %></p> |  | ||||||
| 		</li> |  | ||||||
| 		<% end %> |  | ||||||
| 	</ul> |  | ||||||
| 
 |  | ||||||
| <% end %> |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|  |  | ||||||
							
								
								
									
										1
									
								
								vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/index.js.erb
								
								
								
									vendored
								
								
									Normal file
								
							
							
						
						
									
										1
									
								
								vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/index.js.erb
								
								
								
									vendored
								
								
									Normal file
								
							|  | @ -0,0 +1 @@ | ||||||
|  | $('#news_bulletin_widget').html("<%= j render 'index' %>") | ||||||
|  | @ -17,3 +17,7 @@ | ||||||
| 		<%= render 'web_links' if @web_links %> | 		<%= render 'web_links' if @web_links %> | ||||||
| 	</ul> | 	</ul> | ||||||
| </div> | </div> | ||||||
|  | 
 | ||||||
|  | <% content_for :page_specific_javascript do %> | ||||||
|  | 	<%= javascript_include_tag "announcement_link" %> | ||||||
|  | <% end %> | ||||||
|  | @ -63,7 +63,7 @@ en: | ||||||
|     more: more+ |     more: more+ | ||||||
|     news_bulletins: NewsBulletins |     news_bulletins: NewsBulletins | ||||||
|     related_links: Related Links |     related_links: Related Links | ||||||
|     list_news: List News |     news: News | ||||||
|     news_bulletin: |     news_bulletin: | ||||||
|       category: Category |       category: Category | ||||||
|       list_lower: " list" |       list_lower: " list" | ||||||
|  |  | ||||||
|  | @ -43,9 +43,9 @@ zh_tw: | ||||||
|     sure?: 確定嗎? |     sure?: 確定嗎? | ||||||
|     campus_news: 校園新聞 |     campus_news: 校園新聞 | ||||||
|     more: 更多+ |     more: 更多+ | ||||||
|     news_bulletins: 公告訊息 |     news_bulletins: 新聞訊息 | ||||||
|     related_links: 相關連結  |     related_links: 相關連結  | ||||||
|     list_news: 公告列表 |     news: 新聞 | ||||||
|     news_bulletin: |     news_bulletin: | ||||||
|       category: 分類 |       category: 分類 | ||||||
|       list_lower: 列表 |       list_lower: 列表 | ||||||
|  |  | ||||||
|  | @ -39,6 +39,7 @@ Rails.application.routes.draw do | ||||||
|       end |       end | ||||||
|       namespace :widget do |       namespace :widget do | ||||||
|         match "news_bulletins" => "news_bulletins#index" |         match "news_bulletins" => "news_bulletins#index" | ||||||
|  |         match "home_banner" => "news_bulletins#home_banner" | ||||||
|         match "news_bulletins_and_web_links" => "news_bulletins#news_bulletins_and_web_links" |         match "news_bulletins_and_web_links" => "news_bulletins#news_bulletins_and_web_links" | ||||||
|         match "reload_news_bulletins" => "news_bulletins#reload_news_bulletins" |         match "reload_news_bulletins" => "news_bulletins#reload_news_bulletins" | ||||||
|         match "reload_web_links" => "news_bulletins#reload_web_links" |         match "reload_web_links" => "news_bulletins#reload_web_links" | ||||||
|  |  | ||||||
|  | @ -7,6 +7,6 @@ | ||||||
|   "update_info": "Some info", |   "update_info": "Some info", | ||||||
|   "create_date": "11-11-2011", |   "create_date": "11-11-2011", | ||||||
| 	"app_pages":  ["news_bulletins"], | 	"app_pages":  ["news_bulletins"], | ||||||
| 	"widgets": ["news_bulletins", "news_bulletins_and_web_links"], | 	"widgets": ["news_bulletins", "home_banner"], | ||||||
| 	"enable_frontend": true | 	"enable_frontend": true | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| 
 | 
 | ||||||
| 			<tr id="<%= dom_id page_context %>" class="with_action"> | 			<tr id="<%= dom_id page_context %>" class="with_action"> | ||||||
| 				<td> | 				<td> | ||||||
| 					<%= page_context.page.i18n_variable[I18n.locale] %> | 					<%= page_context.page.path %> | ||||||
| 					<div class="quick-edit"> | 					<div class="quick-edit"> | ||||||
| 						<ul class="nav nav-pills hide"> | 						<ul class="nav nav-pills hide"> | ||||||
| 							<%if is_manager? || is_admin? ||  page_context.authed_users(:edit).include?(current_user)%> | 							<%if is_manager? || is_admin? ||  page_context.authed_users(:edit).include?(current_user)%> | ||||||
|  |  | ||||||
|  | @ -12,7 +12,7 @@ class Panel::WebResource::FrontEnd::WebLinksController < OrbitWidgetController | ||||||
|    |    | ||||||
| 	date_now = Time.now | 	date_now = Time.now | ||||||
| 	 | 	 | ||||||
| 	@web_links = WebLink.where( :is_hidden => false ).desc(:is_top, :name).page( params[:page]).per(20) | 	@web_links = WebLink.where( :is_hidden => false ).desc(:is_top, :name).page(params[:page]).per(10) | ||||||
| 
 | 
 | ||||||
| 	get_categorys | 	get_categorys | ||||||
|   end |   end | ||||||
|  |  | ||||||
|  | @ -8,7 +8,24 @@ class Panel::WebResource::Widget::WebLinksController < OrbitWidgetController | ||||||
|   # GET /web_links |   # GET /web_links | ||||||
|   # GET /web_links.xml |   # GET /web_links.xml | ||||||
|    |    | ||||||
|  | 
 | ||||||
|   def index |   def index | ||||||
|  |     if !params[:category_id].blank? | ||||||
|  |       @web_links = WebLink.where(:web_link_category => params[:category_id]).desc( :is_top, :postdate).page( params[:page]).per(10) | ||||||
|  |       @current_category = WebLinkCategory.from_id(params[:category_id]) rescue nil | ||||||
|  |     elsif !params[:tag_id].blank? | ||||||
|  |       @tag = WebResourceTag.find(params[:tag_id]) rescue nil | ||||||
|  |       @tag = WebResourceTag.where(key: params[:tag_id])[0] unless @tag | ||||||
|  |       @web_links = @tag.web_links.desc( :is_top, :postdate).page( params[:page]).per(10) | ||||||
|  |     else | ||||||
|  |       @web_links = WebLink.all.desc( :is_top, :postdate).page( params[:page]).per(10) | ||||||
|  |     end | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |   def home_list | ||||||
|  |     @title = params[:part_title] | ||||||
| 	 | 	 | ||||||
| 	# deadline | 	# deadline | ||||||
|    |    | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| 
 | 
 | ||||||
| <%= flash_messages %> | <%= flash_messages %> | ||||||
| 
 | 
 | ||||||
| <%= paginate @web_links %> | <%= paginate @web_links, :params => {:inner => false}%> | ||||||
| 
 | 
 | ||||||
| <h1><%= t('web_link.list_web_resource') %></h1> | <h1><%= t('web_link.list_web_resource') %></h1> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  | alert('bob'); | ||||||
|  | @ -0,0 +1,9 @@ | ||||||
|  | <div class="quicklinks"> | ||||||
|  | 	<% if @title %> | ||||||
|  | 		<h3 class="link_title"><%= @title %></h3> | ||||||
|  | 	<% end %> | ||||||
|  | 
 | ||||||
|  | 	<div id='web_links_links'> | ||||||
|  | 		<%= render 'web_links' %> | ||||||
|  | 	</div> | ||||||
|  | </div> | ||||||
|  | @ -1,5 +1,26 @@ | ||||||
| <h3 class="link_title"><%= t("announcement.related_links") %></h3> | <% if @current_category %> | ||||||
|  | 	<h1 class="h1"><%= @current_category.i18n_variable[I18n.locale] + " " + t('web_resource.list_lower') %></h1> | ||||||
|  | <% elsif @tag %> | ||||||
|  | 	<h1 class="h1"><%= @tag[I18n.locale] + " " + t('web_resource.list_lower') %></h1> | ||||||
|  | <% else %> | ||||||
|  | 	<h1 class="h1"><%= t('web_resource.list_link') %></h1> | ||||||
|  | <% end %> | ||||||
| 
 | 
 | ||||||
| <div id='web_links_links'> | <table class="table table-bordered"> | ||||||
| 	<%= render 'web_links' %> | 	<tbody> | ||||||
| </div> | 	  <tr> | ||||||
|  | 			<th><%= t('web_resource.category') %></th> | ||||||
|  | 			<th><%= t('web_resource.name') %></th> | ||||||
|  | 	  </tr> | ||||||
|  | 		<% @web_links.each do |post| %> | ||||||
|  | 		  <tr> | ||||||
|  | 				<td><%= post.web_link_category.i18n_variable[I18n.locale] %></td> | ||||||
|  | 				<td> | ||||||
|  | 					<%= link_to post.name[I18n.locale], post.url, {:target => '_blank', :title => post.name[I18n.locale]} %> | ||||||
|  | 				</td> | ||||||
|  | 		  </tr> | ||||||
|  | 		<% end %> | ||||||
|  | 	</tbody> | ||||||
|  | </table> | ||||||
|  | 
 | ||||||
|  | <%= paginate @web_links, :params => {:inner => 'false'} %> | ||||||
|  |  | ||||||
|  | @ -26,6 +26,12 @@ en: | ||||||
|   announcement: |   announcement: | ||||||
|       sure?: Sure? |       sure?: Sure? | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  |   web_resource: | ||||||
|  |     list_lower: list | ||||||
|  |     list_link: Links list | ||||||
|  | 
 | ||||||
|  |    | ||||||
|   # admin: |   # admin: | ||||||
|   #     action: Action |   #     action: Action | ||||||
|   #     add_language: Add language |   #     add_language: Add language | ||||||
|  |  | ||||||
|  | @ -18,102 +18,9 @@ zh_tw: | ||||||
|   update: 更新 |   update: 更新 | ||||||
|   yes_: "Yes" |   yes_: "Yes" | ||||||
|    |    | ||||||
|   admin: |   web_resource: | ||||||
|     action: 行動 |     list_lower: 列表 | ||||||
|     add_language: 新增語言 |     list_link: 鏈接列表 | ||||||
|     admin: 管理 |  | ||||||
|     action: 行動 |  | ||||||
|     announcement: 公告 |  | ||||||
|     asset: 資產 |  | ||||||
|     attributes: 屬性 |  | ||||||
|     cant_delete_self: 您不可以刪除自己。 |  | ||||||
|     cant_revoke_self_admin: 您不可以撤銷自己的管理作用。 |  | ||||||
|     class: 階級 |  | ||||||
|     content: 內容 |  | ||||||
|     create_error_link: 創建連接時出錯。 |  | ||||||
|     create_error_page: 創建頁面時出錯。 |  | ||||||
|     create_success_home: 首頁已成功創建。 |  | ||||||
|     create_success_layout: 樣板已成功創建。 |  | ||||||
|     create_success_link: 連結已成功創建。 |  | ||||||
|     create_success_page: 頁面已成功創建。 |  | ||||||
|     create_success_snippet: 片段已成功創建 |  | ||||||
|     create_success_user: 用戶已成功創建。。 |  | ||||||
|     data: 數據 |  | ||||||
|     delete_language: 刪除語言 |  | ||||||
|     description: 描述 |  | ||||||
|     disable_language: 禁用語言 |  | ||||||
|     editing_home: 編輯首頁 |  | ||||||
|     editing_layout: 編輯樣板 |  | ||||||
|     editing_link: 編輯連結 |  | ||||||
|     editing_page: 編輯頁面 |  | ||||||
|     editing_snippet: 編輯片段 |  | ||||||
|     editing_user_info: 編輯用戶資料 |  | ||||||
|     editing_user_role: 編輯用戶角色 |  | ||||||
|     email: Email |  | ||||||
|     enable_language: 啟用語言 |  | ||||||
|     file_name: 檔名 |  | ||||||
|     file_size: 檔案大小 |  | ||||||
|     format: 格式 |  | ||||||
|     home: 首頁 |  | ||||||
|     id: ID |  | ||||||
|     info: 資料 |  | ||||||
|     is_published: 被出版 |  | ||||||
|     item: 項目 |  | ||||||
|     key: 關鍵 |  | ||||||
|     language: 語言 |  | ||||||
|     layout: 佈局 |  | ||||||
|     layout_name: 佈局名字 |  | ||||||
|     list_assets: 資產清單 |  | ||||||
|     list_items: 項目清單 |  | ||||||
|     list_layouts: 佈局清單 |  | ||||||
|     list_snippets: 斷片清單 |  | ||||||
|     list_users: 使用清單 |  | ||||||
|     list_user_infos: 用戶資料清單 |  | ||||||
|     list_user_roles: 用戶角色清單 |  | ||||||
|     member: 會員 |  | ||||||
|     move_down: 往下移 |  | ||||||
|     move_up: 往上移 |  | ||||||
|     multilingual: 多種語言 |  | ||||||
|     my_avatar: 我的頭像 |  | ||||||
|     no_home_page: 您沒有首頁 |  | ||||||
|     no_layout: 您沒有佈局 |  | ||||||
|     name: 名稱 |  | ||||||
|     new_asset: 新增資產 |  | ||||||
|     new_component: 新增元件 |  | ||||||
|     new_home: 新增首頁 |  | ||||||
|     new_layout: 新增樣板 |  | ||||||
|     new_link: 新增連結 |  | ||||||
|     new_page: 新增頁面 |  | ||||||
|     new_snippet: 新增片段 |  | ||||||
|     new_user: 新增使用 |  | ||||||
|     new_user_info: 新增用戶資料 |  | ||||||
|     new_user_role: 新增用戶角色 |  | ||||||
|     non_multilingual: 非多種語言 |  | ||||||
|     options: 選項 |  | ||||||
|     orig_upload_file: 原上傳檔名 |  | ||||||
|     position: 位置 |  | ||||||
|     published?: 發布? |  | ||||||
|     role: 角色 |  | ||||||
|     roles: 角色。 |  | ||||||
|     title: 標題 |  | ||||||
|     translation: 翻譯 |  | ||||||
|     type: 類型 |  | ||||||
|     update_error_link: 更新鏈接時出現錯誤。 |  | ||||||
|     update_error_page: 更新頁面時出現錯誤。 |  | ||||||
|     update_success_content: 內容已成功更新。 |  | ||||||
|     update_success_home: 首頁已成功更新。 |  | ||||||
|     update_success_layout: 樣板已成功更新。 |  | ||||||
|     update_success_link: 連結已成功更新。 |  | ||||||
|     update_success_page: 頁面已成功更新。 |  | ||||||
|     update_success_snippet: 片段已成功更新。 |  | ||||||
|     update_success_user: 用戶已成功更新 |  | ||||||
|     url: URL |  | ||||||
|     user: 用戶 |  | ||||||
|     user_info: 用戶資料 |  | ||||||
|     user_panel: 用戶面板 |  | ||||||
|     user_role: 用戶角色 |  | ||||||
|      |  | ||||||
|   panel: |  | ||||||
|      |      | ||||||
|      |      | ||||||
|      |      | ||||||
|  |  | ||||||
|  | @ -13,11 +13,11 @@ Rails.application.routes.draw do | ||||||
|         resources :tags |         resources :tags | ||||||
|       end |       end | ||||||
|       namespace :front_end do |       namespace :front_end do | ||||||
|         root :to => "web_links#index" |  | ||||||
|         resources :web_links |         resources :web_links | ||||||
|       end |       end | ||||||
|       namespace :widget do |       namespace :widget do | ||||||
|         match "web_links" => "web_links#index" |         match "web_links" => "web_links#index" | ||||||
|  |         match "home_list" => "web_links#home_list" | ||||||
|         match "reload_web_links" => "web_links#reload_web_links" |         match "reload_web_links" => "web_links#reload_web_links" | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|  |  | ||||||
|  | @ -6,7 +6,6 @@ | ||||||
|   "intro": "A simple blog……", |   "intro": "A simple blog……", | ||||||
|   "update_info": "Some info", |   "update_info": "Some info", | ||||||
|   "create_date": "11-11-2011", |   "create_date": "11-11-2011", | ||||||
| 	"app_pages":  ["web_links"], | 	"widgets": ["home_list"], | ||||||
| 	"widgets": ["web_links"], |  | ||||||
| 	"enable_frontend": true | 	"enable_frontend": true | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue