Merge branch 'design_team' into ldap
Conflicts: Gemfile.lock app/controllers/admin/module_apps_controller.rb app/controllers/application_controller.rb vendor/built_in_modules/web_resource/web_resource.json
This commit is contained in:
commit
ebc8dd33ec
2
Gemfile
2
Gemfile
|
@ -11,11 +11,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 'mysql2'
|
gem 'mysql2'
|
||||||
gem 'nokogiri'
|
gem 'nokogiri'
|
||||||
|
|
|
@ -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)
|
||||||
libv8 (3.3.10.4)
|
libv8 (3.3.10.4)
|
||||||
linecache19 (0.5.12)
|
linecache19 (0.5.12)
|
||||||
|
@ -116,6 +119,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)
|
||||||
mysql2 (0.3.11)
|
mysql2 (0.3.11)
|
||||||
net-ldap (0.3.1)
|
net-ldap (0.3.1)
|
||||||
|
@ -273,10 +278,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
|
||||||
mysql2
|
mysql2
|
||||||
net-ldap (~> 0.3.1)
|
net-ldap (~> 0.3.1)
|
||||||
nokogiri
|
nokogiri
|
||||||
|
|
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
|
||||||
|
@ -15,3 +18,4 @@
|
||||||
//= require page_edit
|
//= require page_edit
|
||||||
//= require tinymce-jquery
|
//= require tinymce-jquery
|
||||||
//= require tinymce_orbit
|
//= 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
|
||||||
|
|
|
@ -12,13 +12,16 @@ class Admin::ModuleAppsController < ApplicationController
|
||||||
def reload_frontend_pages
|
def reload_frontend_pages
|
||||||
@categories =[]
|
@categories =[]
|
||||||
@module_app = ModuleApp.find(params[:id])
|
@module_app = ModuleApp.find(params[:id])
|
||||||
unless (@module_app.category.nil? rescue true)
|
case @module_app.key
|
||||||
@module_app.category.each do |category|
|
when 'announcement'
|
||||||
@categories << eval(category).all.entries
|
@categories = BulletinCategory.all
|
||||||
end
|
@tags = AnnouncementTag.all
|
||||||
@categories.flatten!
|
when 'news'
|
||||||
else
|
@categories = NewsBulletinCategory.all
|
||||||
@categories = nil
|
@tags = NewsTag.all
|
||||||
|
when 'web_resource'
|
||||||
|
@categories = WebLinkCategory.all
|
||||||
|
@tags = WebResourceTag.all
|
||||||
end
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js {}
|
format.js {}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Admin::NewInterfaceModuleAppsController < ApplicationController
|
class Admin::ModuleAppsNewInterfaceController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
before_filter :is_admin?
|
before_filter :is_admin?
|
||||||
include AdminHelper
|
include AdminHelper
|
||||||
|
@ -6,7 +6,7 @@ class Admin::NewInterfaceModuleAppsController < ApplicationController
|
||||||
layout "new_admin"
|
layout "new_admin"
|
||||||
|
|
||||||
def setting
|
def setting
|
||||||
@sys_users = User.all
|
@sys_users = User.all(conditions: {admin: false})
|
||||||
@module_app = ModuleApp.find(params[:module_app_id])
|
@module_app = ModuleApp.find(params[:module_app_id])
|
||||||
@options_from_collection_for_select_bulletin_categorys = [@module_app].collect{|ma| [ma.title,ma.id] }
|
@options_from_collection_for_select_bulletin_categorys = [@module_app].collect{|ma| [ma.title,ma.id] }
|
||||||
# if params.has_key? :category
|
# if params.has_key? :category
|
|
@ -0,0 +1,71 @@
|
||||||
|
class Admin::ObjectAuthsNewInterfaceController < ApplicationController
|
||||||
|
include OrbitCoreLib::PermissionUnility
|
||||||
|
layout "new_admin"
|
||||||
|
before_filter :force_order
|
||||||
|
|
||||||
|
layout "new_admin"
|
||||||
|
|
||||||
|
|
||||||
|
def setting
|
||||||
|
@sys_users = User.all(conditions: {admin: false})
|
||||||
|
@ob_auth = ObjectAuth.find params[:object_auth_id]
|
||||||
|
@options_from_collection_for_select_ob_auth = [@ob_auth].collect{|oa| [oa.auth_obj.pp_object,oa.id] }
|
||||||
|
@users_array = @ob_auth.privilege_users rescue []
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def update_setting
|
||||||
|
ob_auth = update_setting_by_params
|
||||||
|
if ob_auth.save!
|
||||||
|
flash[:notice] = t("admin.object_auth.update_done")
|
||||||
|
else
|
||||||
|
flash[:notice] = t("admin.object_auth.update_failed")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def user_list
|
||||||
|
@ob_auth = ObjectAuth.find params[:ob_auth][:id]
|
||||||
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
def update_setting_by_params
|
||||||
|
oa = ObjectAuth.find params[:ob_auth][:id]
|
||||||
|
user_sat = User.find params[:users].keys
|
||||||
|
users_to_new = user_sat - oa.auth_users
|
||||||
|
users_to_remove = oa.auth_users - user_sat
|
||||||
|
|
||||||
|
users_to_new.each do |new_user|
|
||||||
|
oa.add_user_to_privilege_list(new_user)
|
||||||
|
end
|
||||||
|
|
||||||
|
users_to_remove.each do |remove_user|
|
||||||
|
oa.remove_user_from_privilege_list(remove_user)
|
||||||
|
end
|
||||||
|
oa
|
||||||
|
end
|
||||||
|
|
||||||
|
# def get_categorys(id = nil)
|
||||||
|
# @bulletin_categorys = []
|
||||||
|
# if(is_manager? || is_admin?)
|
||||||
|
# @bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
|
||||||
|
# elsif is_sub_manager?
|
||||||
|
# @bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new')
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
def force_order
|
||||||
|
authenticate_user!
|
||||||
|
check_if_user_can_do_object_auth
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_if_user_can_do_object_auth
|
||||||
|
unless check_permission(:manager)
|
||||||
|
render :nothing => true, :status => 403
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -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
|
||||||
|
|
|
@ -45,9 +45,9 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
# Render the page
|
# Render the page
|
||||||
def render_page(id = nil)
|
def render_page
|
||||||
if @item
|
if @item
|
||||||
render :text => process_page(@item, id), :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
|
||||||
|
|
|
@ -23,7 +23,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
|
||||||
''
|
''
|
||||||
|
|
|
@ -68,9 +68,23 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def active_sys_call_for_app(controller_name,action_name,app_title,field = :id)
|
def active_for_ob_auths_object(object_class,field = :object_auth_id)
|
||||||
unless active_for_action(controller_name,action_name).nil?
|
unless active_for_action("object_auths_new_interface","setting").nil?
|
||||||
app = ModuleApp.find params[field]
|
ob_auth = ObjectAuth.find params[field]
|
||||||
|
ob_auth.obj_authable_type == object_class.to_s ? 'active' : nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def active_for_ob_auth(ob_auth_title,field = :object_auth_id)
|
||||||
|
unless active_for_action("module_apps_new_interface","setting").nil?
|
||||||
|
oa_auth = ObjectAuth.find params[field]
|
||||||
|
oa_auth.title == ob_auth_title ? 'active' : nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def active_for_app_auth(app_title ='', opt={:controller_name => 'module_apps_new_interface',:action_name=>'setting',:field => :module_app_id})
|
||||||
|
unless active_for_action(opt[:controller_name],opt[:action_name]).nil?
|
||||||
|
app = ModuleApp.find params[opt[:field]]
|
||||||
app.title == app_title ? 'active' : nil
|
app.title == app_title ? 'active' : nil
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
|
@ -90,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 = ''
|
||||||
|
@ -114,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
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
class RestartServer
|
||||||
|
@queue = :high
|
||||||
|
|
||||||
|
def self.perform()
|
||||||
|
CronMail.time_check("Going to restarting Orbit").deliver
|
||||||
|
%x[touch #{Rails.root}/tmp/restart]
|
||||||
|
end
|
||||||
|
end
|
|
@ -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 %>");
|
|
@ -1,13 +1,13 @@
|
||||||
<% if bulletin_category -%>
|
<% if ob_auth -%>
|
||||||
|
|
||||||
<div class="modal hide fade in" id="bulletin_category-<%=bulletin_category.id%>">
|
<div class="modal hide fade in" id="ob_auth-<%=ob_auth.id%>">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<a class="close" data-dismiss="modal">×</a>
|
<a class="close" data-dismiss="modal">×</a>
|
||||||
<h3><%= t("announcement.bulletin.submit_user_list") %></h3>
|
<h3><%= t("admin.object_auth.list_title_of_users",:auth_title => ob_auth.title) %></h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="clear">
|
<div class="clear">
|
||||||
<% bulletin_category.get_object_auth_by_title('submit').auth_users.each do |user| %>
|
<% ob_auth.auth_users.each do |user| %>
|
||||||
<div class="checkbox clear checked">
|
<div class="checkbox clear checked">
|
||||||
<div class='member-avatar'>
|
<div class='member-avatar'>
|
||||||
<% if user.avatar? %>
|
<% if user.avatar? %>
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$("#bulletin_category-<%=bulletin_category.id%>").on("show", function () {
|
$("#ob_auth-<%=ob_auth.id%>").on("show", function () {
|
||||||
});
|
});
|
||||||
$(".modal").on("hidden", function () {
|
$(".modal").on("hidden", function () {
|
||||||
$("#show_preview").remove();
|
$("#show_preview").remove();
|
||||||
|
@ -39,6 +39,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<% end -%>
|
<% end -%>
|
|
@ -1,6 +1,5 @@
|
||||||
<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
|
<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
|
||||||
<% sys_users = User.all -%>
|
<% @sys_users.each do |sys_user| -%>
|
||||||
<% sys_users.each do |sys_user| -%>
|
|
||||||
|
|
||||||
<div class="checkblock">
|
<div class="checkblock">
|
||||||
|
|
|
@ -12,21 +12,22 @@
|
||||||
<ul class="nav nav-pills filter pull-left">
|
<ul class="nav nav-pills filter pull-left">
|
||||||
<li class="accordion-group">
|
<li class="accordion-group">
|
||||||
<div class="form-search" style="margin: 5px 10px;">
|
<div class="form-search" style="margin: 5px 10px;">
|
||||||
<%= label_tag :category, t("announcement.bulletin.category") %>
|
<%= label_tag :object, @ob_auth.auth_obj.class %>
|
||||||
<%= select "category",'id',@options_from_collection_for_select_bulletin_categorys %>
|
<%= label_tag :module,"::" %>
|
||||||
|
<%= select "ob_auth",'id',@options_from_collection_for_select_ob_auth %>
|
||||||
<%= search_field_tag 'user_filter' %>
|
<%= search_field_tag 'user_filter' %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<%= link_to t("announcement.bulletin.submit_user_list"), panel_announcement_back_end_bulletin_category_user_list_path , :class=>'preview_trigger btn btn-success pull-right'%>
|
<%= link_to t("admin.object_auth.list_title_of_users",:auth_title => @ob_auth.title), admin_object_auth_ob_auth_show_path , :class=>'preview_trigger btn btn-success pull-right'%>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<%#= label_tag :role, t("admin.roles") %>
|
<%#= label_tag :role, t("admin.roles") %>
|
||||||
<div class="clear">
|
<div class="clear">
|
||||||
<%= content_tag :div do -%>
|
<%= content_tag :div do -%>
|
||||||
<% form_tag panel_announcement_back_end_approval_setting_path do %>
|
<% form_tag admin_object_auth_ob_auth_path do %>
|
||||||
<%= render :partial => "privilege_user", :locals => {:users => @users_array} %>
|
<%#= render :partial => "privilege_user", :locals => {:users => @users_array} %>
|
||||||
<div class="form-actions form-fixed pagination-right">
|
<div class="form-actions form-fixed pagination-right">
|
||||||
<%= submit_tag "Update", :class => 'btn btn-primary' %>
|
<%= submit_tag "Update", :class => 'btn btn-primary' %>
|
||||||
</div>
|
</div>
|
|
@ -0,0 +1,2 @@
|
||||||
|
$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_list',:locals => {:ob_auth => @ob_auth})) %>");
|
||||||
|
var start_modal_with_id = "ob_auth-<%=@ob_auth.id%>"
|
|
@ -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,3 +6,9 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
load_tinymce();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
|
@ -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,29 +5,29 @@
|
||||||
<%= javascript_include_tag "/static/kernel.js" %>
|
<%= javascript_include_tag "/static/kernel.js" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= content_tag :li, :class => (active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals') || active_sys_call_for_app('new_interface_module_apps','setting','Announcement',:module_app_id) ) do -%>
|
<%= content_tag :li, :class => (active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals') || active_for_app_auth('Announcement') || active_for_ob_auths_object("BulletinCategory") ) do -%>
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %>
|
<%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %>
|
||||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals')) do -%>
|
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals')) do -%>
|
||||||
<%= content_tag :li, link_to(t('announcement.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %>
|
<%= content_tag :li, link_to(t('announcement.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %>
|
||||||
<%= content_tag :li, link_to(t('announcement.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %>
|
<%= content_tag :li, link_to(t('announcement.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %>
|
||||||
<%= content_tag :li, link_to(t('announcement.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => (active_for_action('bulletin_categorys', 'index') || active_for_action('bulletin_category_setting', 'setting')) %>
|
<%= content_tag :li, link_to(t('announcement.categories'), panel_announcement_back_end_bulletin_categorys_path), :class =>( active_for_action('bulletin_categorys', 'index') || active_for_ob_auths_object("BulletinCategory") ) %>
|
||||||
<%= content_tag :li, link_to(t('announcement.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('/panel/announcement/back_end/tags', 'index') %>
|
<%= content_tag :li, link_to(t('announcement.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('/panel/announcement/back_end/tags', 'index') %>
|
||||||
<%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_announcement_back_end_approval_setting_path), :class => active_for_action('approvals', 'setting') if (is_manager? rescue nil) %>
|
<%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_announcement_back_end_approval_setting_path), :class => active_for_action('approvals', 'setting') if (is_manager? rescue nil) %>
|
||||||
<%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: "Announcement"}))), :class => active_sys_call_for_app('new_interface_module_apps','setting','Announcement',:module_app_id) if (is_admin? rescue nil) %>
|
<%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: "Announcement"}))), :class => active_for_app_auth('Announcement') if (is_admin? rescue nil) %>
|
||||||
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<%= content_tag :li, :class =>( active_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals')|| active_sys_call_for_app('new_interface_module_apps','setting','news',:module_app_id)) do -%>
|
<%= content_tag :li, :class =>( active_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals')|| active_for_app_auth('news') || active_for_ob_auths_object("NewsBulletinCategory")) do -%>
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.news'), panel_news_back_end_news_bulletins_path %>
|
<%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.news'), panel_news_back_end_news_bulletins_path %>
|
||||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals')) do -%>
|
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals')) do -%>
|
||||||
<%= content_tag :li, link_to(t('announcement.all_articles'), panel_news_back_end_news_bulletins_path), :class => active_for_action('news_bulletins', 'index') %>
|
<%= content_tag :li, link_to(t('announcement.all_articles'), panel_news_back_end_news_bulletins_path), :class => active_for_action('news_bulletins', 'index') %>
|
||||||
<%= content_tag :li, link_to(t('announcement.add_new'), new_panel_news_back_end_news_bulletin_path), :class => active_for_action('news_bulletins', 'new') %>
|
<%= content_tag :li, link_to(t('announcement.add_new'), new_panel_news_back_end_news_bulletin_path), :class => active_for_action('news_bulletins', 'new') %>
|
||||||
<%= content_tag :li, link_to(t('announcement.categories'), panel_news_back_end_news_bulletin_categorys_path), :class => (active_for_action('news_bulletin_categorys', 'index') || active_for_action('news_bulletin_category_setting', 'setting'))%>
|
<%= content_tag :li, link_to(t('announcement.categories'), panel_news_back_end_news_bulletin_categorys_path), :class => active_for_action('news_bulletin_categorys', 'index') || active_for_ob_auths_object("NewsBulletinCategory") %>
|
||||||
<%= content_tag :li, link_to(t('announcement.tags'), panel_news_back_end_tags_path), :class => active_for_action('/panel/news/back_end/tags', 'index') %>
|
<%= content_tag :li, link_to(t('announcement.tags'), panel_news_back_end_tags_path), :class => active_for_action('/panel/news/back_end/tags', 'index') %>
|
||||||
<%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_news_back_end_news_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue nil) %>
|
<%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_news_back_end_news_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue nil) %>
|
||||||
<%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "news"}))), :class => active_sys_call_for_app('new_interface_module_apps','setting','news',:module_app_id) if (is_admin? rescue nil) %>
|
<%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "news"}))), :class => active_for_app_auth('news') if (is_admin? rescue nil) %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
@ -47,14 +47,14 @@
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icons-window-block') + t('admin.design'), admin_designs_path %>
|
<%= link_to content_tag(:i, nil, :class => 'icons-window-block') + t('admin.design'), admin_designs_path %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<%= content_tag :li, :class => active_for_controllers('ad_banners', 'ad_images') || active_sys_call_for_app('module_apps','edit','ad_banners') do -%>
|
<%= content_tag :li, :class => active_for_controllers('ad_banners', 'ad_images') || active_for_app_auth('ad_banners') do -%>
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.ad_banner'), admin_ad_banners_path %>
|
<%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.ad_banner'), admin_ad_banners_path %>
|
||||||
|
|
||||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('ad_banners', 'ad_images') ) do -%>
|
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('ad_banners', 'ad_images') ) do -%>
|
||||||
<%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %>
|
<%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %>
|
||||||
<%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %>
|
<%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %>
|
||||||
<%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %>
|
<%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %>
|
||||||
<%= content_tag :li, link_to(t('admin.module.authorization'),edit_admin_module_app_path(ModuleApp.first(conditions: {title: "ad_banners"}))), :class => active_sys_call_for_app('module_apps','edit','ad_banners') if (is_admin? rescue nil) %>
|
<%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: "ad_banners"}))), :class => active_for_app_auth('ad_banners') if (is_admin? rescue nil) %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -197,9 +197,17 @@ en:
|
||||||
new_role: New user role
|
new_role: New user role
|
||||||
news: News
|
news: News
|
||||||
non_multilingual: Non multilingual
|
non_multilingual: Non multilingual
|
||||||
|
object_auth:
|
||||||
|
list_title_of_users: %{auth_title} Auth List
|
||||||
|
update_done: Update done,reulst showing in list
|
||||||
|
update_failed: Update failed
|
||||||
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
|
||||||
|
|
|
@ -197,10 +197,18 @@ zh_tw:
|
||||||
new_info: 新增用戶資料
|
new_info: 新增用戶資料
|
||||||
new_role: 新增用戶身份
|
new_role: 新增用戶身份
|
||||||
news: 新聞
|
news: 新聞
|
||||||
non_multilingual: 非多種語言
|
non_multilingual:
|
||||||
|
object_auth:
|
||||||
|
list_title_of_users: 授權清單-%{auth_title}
|
||||||
|
update_done: 更新完成,結果顯示於清單
|
||||||
|
update_failed: 更新失敗
|
||||||
options: 選項
|
options: 選項
|
||||||
orig_upload_file: 原上傳檔名
|
orig_upload_file: 原上傳檔名
|
||||||
page: 頁面管理
|
page: 頁面管理
|
||||||
|
page_part_kinds:
|
||||||
|
text: 文字區塊
|
||||||
|
public_r_tag: 系統模塊
|
||||||
|
module_widget: 外掛模塊
|
||||||
position: 位置
|
position: 位置
|
||||||
published?: 發布?
|
published?: 發布?
|
||||||
purchase: 購買
|
purchase: 購買
|
||||||
|
|
|
@ -10,6 +10,12 @@ nccu_daily_ldap_sync:
|
||||||
args:
|
args:
|
||||||
description: Sync NCCU middle site with Orbit for LDAP data
|
description: Sync NCCU middle site with Orbit for LDAP data
|
||||||
|
|
||||||
|
nccu_daily_restart:
|
||||||
|
cron: * * */3 * * *
|
||||||
|
class: RestartServer
|
||||||
|
args:
|
||||||
|
description: Restart NCCU site
|
||||||
|
|
||||||
nccu_claender_sync:
|
nccu_claender_sync:
|
||||||
cron: * * [0,12] * * *
|
cron: * * [0,12] * * *
|
||||||
class: NccuCalendar
|
class: NccuCalendar
|
||||||
|
|
|
@ -17,6 +17,11 @@ Orbit::Application.routes.draw do
|
||||||
resources :assets
|
resources :assets
|
||||||
resources :app_auths
|
resources :app_auths
|
||||||
resources :object_auths do
|
resources :object_auths do
|
||||||
|
match 'new_interface/:ob_type/:title/new' => "object_auths_new_interface#new" ,:as => :init_ob_auth,:via => :get
|
||||||
|
match 'new_interface' => "object_auths_new_interface#setting" ,:as => :ob_auth,:via => :get
|
||||||
|
match 'new_interface' => "object_auths_new_interface#update_setting" ,:as => :ob_auth,:via => :post
|
||||||
|
match 'new_interface' => "object_auths_new_interface#user_list" ,:as => :ob_auth_show,:via => :put
|
||||||
|
|
||||||
collection do
|
collection do
|
||||||
match 'new/:type/:obj_id',:action => 'new',:via => "get",:as => :init
|
match 'new/:type/:obj_id',:action => 'new',:via => "get",:as => :init
|
||||||
end
|
end
|
||||||
|
@ -50,6 +55,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'
|
||||||
|
@ -62,9 +68,9 @@ Orbit::Application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :module_apps do
|
resources :module_apps do
|
||||||
match 'manager_auth_proc' => "new_interface_module_apps#setting" ,:as => :manager_auth_proc,:via => :get
|
match 'manager_auth_proc' => "module_apps_new_interface#setting" ,:as => :manager_auth_proc,:via => :get
|
||||||
match 'manager_auth_proc' => "new_interface_module_apps#update_setting" ,:as => :manager_auth_proc,:via => :post
|
match 'manager_auth_proc' => "module_apps_new_interface#update_setting" ,:as => :manager_auth_proc,:via => :post
|
||||||
match 'manager_auth_proc' => "new_interface_module_apps#user_list" ,:as => :manager_auth_show,:via => :put
|
match 'manager_auth_proc' => "module_apps_new_interface#user_list" ,:as => :manager_auth_show,:via => :put
|
||||||
resources :app_auths do
|
resources :app_auths do
|
||||||
member do
|
member do
|
||||||
match 'remove/:type/:target_id' ,:action=> 'remove',:via => "delete",:as =>:remove
|
match 'remove/:type/:target_id' ,:action=> 'remove',:via => "delete",:as =>:remove
|
||||||
|
|
|
@ -19,6 +19,10 @@ module OrbitCoreLib
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def pp_object
|
||||||
|
"Object Auth method 'pp_object' need to be defined for class #{self.class}"
|
||||||
|
end
|
||||||
|
|
||||||
def get_object_auth_by_title(title)
|
def get_object_auth_by_title(title)
|
||||||
self.object_auths.where({title: title }).first
|
self.object_auths.where({title: title }).first
|
||||||
end
|
end
|
||||||
|
|
|
@ -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,67 +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 << "&tag_id=#{page.tag}" if page[:tag]
|
|
||||||
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].blank?
|
|
||||||
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?category_id=#{part[:category]}}'></div>"
|
|
||||||
elsif !part[:tag].blank?
|
|
||||||
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&tag_id=#{part[:tag]}'></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 !part[:category].blank?
|
|
||||||
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&category_id=#{part[:category]}'></div>"
|
|
||||||
elsif !part[:tag].blank?
|
|
||||||
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&tag_id=#{part[:tag]}'></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,6 +12,7 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
|
||||||
# end
|
# end
|
||||||
|
|
||||||
def setting
|
def setting
|
||||||
|
@sys_users = User.all(conditions: {admin: false})
|
||||||
@bulletin_categorys = BulletinCategory.all
|
@bulletin_categorys = BulletinCategory.all
|
||||||
@options_from_collection_for_select_bulletin_categorys = @bulletin_categorys.collect{|bc| [bc.i18n_variable[I18n.locale],bc.id] }
|
@options_from_collection_for_select_bulletin_categorys = @bulletin_categorys.collect{|bc| [bc.i18n_variable[I18n.locale],bc.id] }
|
||||||
if params.has_key? :category
|
if params.has_key? :category
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
class Panel::Announcement::BackEnd::BulletinCategorySettingController < OrbitBackendController
|
|
||||||
before_filter :authenticate_user!
|
|
||||||
before_filter :for_app_manager
|
|
||||||
include AdminHelper
|
|
||||||
# layout 'admin'
|
|
||||||
def preview_and_approve
|
|
||||||
@bulletin = Bulletin.find params[:bulletin_id]
|
|
||||||
end
|
|
||||||
|
|
||||||
# def approve
|
|
||||||
#
|
|
||||||
# end
|
|
||||||
|
|
||||||
def setting
|
|
||||||
@bulletin_categorys = []
|
|
||||||
@bulletin_categorys << BulletinCategory.find(params[:bulletin_category_id])
|
|
||||||
@options_from_collection_for_select_bulletin_categorys = @bulletin_categorys.collect{|bc| [bc.i18n_variable[I18n.locale],bc.id] }
|
|
||||||
if params.has_key? :category
|
|
||||||
@bulletin_category = BulletinCategory.find params[:category][:id]
|
|
||||||
else
|
|
||||||
@bulletin_category = @bulletin_categorys.first
|
|
||||||
end
|
|
||||||
preload_object_auth = @bulletin_category.object_auths.where(title: 'submit').empty?? (@bulletin_category.object_auths.create! :title=> 'submit') : @bulletin_category.object_auths.where(title: 'submit')
|
|
||||||
@users_array = preload_object_auth.first.privilege_users rescue []
|
|
||||||
respond_to do |format|
|
|
||||||
format.html
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def update_setting
|
|
||||||
object_auth = update_setting_by_params
|
|
||||||
if object_auth.save!
|
|
||||||
flash[:notice] = "Update Done"
|
|
||||||
else
|
|
||||||
flash[:notice] = "Update Failed"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def user_list
|
|
||||||
@bulletin_category = BulletinCategory.find params[:category][:id]
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
|
||||||
def update_setting_by_params
|
|
||||||
category = BulletinCategory.find params[:category][:id]
|
|
||||||
privilege_users = params[:users].collect{|key,value| User.find key } rescue []
|
|
||||||
object_auth_ary = category.object_auths.where(title: 'submit') || (category.object_auths.create :title=> 'submit')
|
|
||||||
object_auth = object_auth_ary.first
|
|
||||||
object_auth.privilege_users = privilege_users
|
|
||||||
object_auth
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_categorys(id = nil)
|
|
||||||
@bulletin_categorys = []
|
|
||||||
if(is_manager? || is_admin?)
|
|
||||||
@bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
|
|
||||||
elsif is_sub_manager?
|
|
||||||
@bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -45,9 +45,11 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
@bulletin_file = BulletinFile.new
|
@bulletin_file = BulletinFile.new
|
||||||
@file_url = panel_announcement_back_end_bulletins_path
|
@file_url = panel_announcement_back_end_bulletins_path
|
||||||
|
|
||||||
|
if(!is_admin? || !is_manager?)
|
||||||
@bulletins.delete_if{ |bulletin|
|
@bulletins.delete_if{ |bulletin|
|
||||||
bulletin.is_pending == true && (!bulletin.bulletin_category.authed_users('fact_check').include?(current_user) || bulletin.create_user_id!=current_user.id)
|
bulletin.is_pending == true && (!bulletin.bulletin_category.authed_users('fact_check').include?(current_user) || bulletin.create_user_id!=current_user.id)
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # index.html.erb
|
format.html # index.html.erb
|
||||||
|
|
|
@ -12,14 +12,14 @@ 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
|
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||||
elsif !params[:tag_id].blank?
|
elsif !params[:tag_id].blank?
|
||||||
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil
|
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil
|
||||||
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
|
@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)
|
@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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,7 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
||||||
# GET /bulletins.xml
|
# GET /bulletins.xml
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@title = params[:part_title]
|
||||||
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]).per(10)
|
||||||
|
@ -31,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
|
||||||
|
|
|
@ -10,7 +10,7 @@ include ActionView::Helpers::UrlHelper
|
||||||
oa = bulletin_category.get_object_auth_by_title(type)
|
oa = bulletin_category.get_object_auth_by_title(type)
|
||||||
end
|
end
|
||||||
# link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
|
# link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
|
||||||
link_to t('announcement.bulletin.cate_auth'),panel_announcement_back_end_bulletin_category_setting_path(bulletin_category)
|
link_to t('announcement.bulletin.cate_auth'),admin_object_auth_ob_auth_path(oa)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -18,6 +18,10 @@ class BulletinCategory
|
||||||
|
|
||||||
has_many :bulletins
|
has_many :bulletins
|
||||||
|
|
||||||
|
def pp_object
|
||||||
|
i18n_variable[I18n.locale]
|
||||||
|
end
|
||||||
|
|
||||||
def self.from_id(id)
|
def self.from_id(id)
|
||||||
BulletinCategory.find(id) rescue nil
|
BulletinCategory.find(id) rescue nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
|
<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
|
||||||
<% sys_users = User.all -%>
|
<% @sys_users.each do |sys_user| -%>
|
||||||
<% sys_users.each do |sys_user| -%>
|
|
||||||
|
|
||||||
<div class="checkblock">
|
<div class="checkblock">
|
||||||
|
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
|
|
||||||
<% sys_users = User.all -%>
|
|
||||||
<% sys_users.each do |sys_user| -%>
|
|
||||||
|
|
||||||
<div class="checkblock">
|
|
||||||
|
|
||||||
<% sys_user.sub_roles.each do |sr| %>
|
|
||||||
<div class="for_unit" style="display:none;"> <%= sr.key %></div>
|
|
||||||
<% end %>
|
|
||||||
<%= content_tag :div,:data=>{'original-title'=>t('announcement.bulletin.approval_setting_window_title'),:content => "#{sys_user.sub_roles.collect{|sr| sr.i18n_variable[I18n.locale]}.join(',')}"},:class=>"checkbox clear" do %>
|
|
||||||
<div class="check-icon">
|
|
||||||
</div>
|
|
||||||
<div class='member-avatar'>
|
|
||||||
<% if sys_user.avatar? %>
|
|
||||||
<%= image_tag(sys_user.avatar.thumb.url,:class => "member-img") %>
|
|
||||||
<% else %>
|
|
||||||
<%= image_tag "person.png",:class => "member-img" %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<%= label_tag "lab-user-#{sys_user.id}", (sys_user.name rescue ''),:class=>"member-name",:id=>nil -%>
|
|
||||||
<%= check_box_tag "[users][#{sys_user.id}]", 'true',users.include?(sys_user),:class => "check" -%>
|
|
||||||
<%end -%>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% end -%>
|
|
||||||
<% end -%>
|
|
|
@ -1,2 +0,0 @@
|
||||||
$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_list',:locals => {:bulletin_category => @bulletin_category})) %>");
|
|
||||||
var start_modal_with_id = "bulletin_category-<%=@bulletin_category.id%>"
|
|
|
@ -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,29 +1,3 @@
|
||||||
<% if @current_category %>
|
<div id="bulletin_widget">
|
||||||
<h1 class="h1"><%= @current_category.i18n_variable[I18n.locale] + t('announcement.bulletin.list_lower') %></h1>
|
<%= render 'index' %>
|
||||||
<% elsif @tag %>
|
</div>
|
||||||
<h1 class="h1"><%= @tag[I18n.locale] + t('announcement.bulletin.list_lower') %></h1>
|
|
||||||
<% else %>
|
|
||||||
<h1 class="h1"><%= t('announcement.list_announcement') %></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 => 'false'} %>
|
|
|
@ -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,7 +67,6 @@ 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
|
submit_user_list: Submit User
|
||||||
category: Category
|
category: Category
|
||||||
|
|
|
@ -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,7 +48,6 @@ zh_tw:
|
||||||
more: 更多+
|
more: 更多+
|
||||||
bulletins: 公告訊息
|
bulletins: 公告訊息
|
||||||
related_links: 相關連結
|
related_links: 相關連結
|
||||||
list_announcement: 公告列表
|
|
||||||
bulletin:
|
bulletin:
|
||||||
category: 分類
|
category: 分類
|
||||||
submit_user_list: 張貼人
|
submit_user_list: 張貼人
|
||||||
|
|
|
@ -21,11 +21,7 @@ Rails.application.routes.draw do
|
||||||
match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit
|
match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :bulletin_categorys do
|
resources :bulletin_categorys
|
||||||
match 'submit_setting' => "bulletin_category_setting#setting" ,:as => :setting,:via => :get
|
|
||||||
match 'submit_setting' => "bulletin_category_setting#update_setting" ,:as => :setting,:via => :post
|
|
||||||
match 'submit_setting' => "bulletin_category_setting#user_list" ,:as => :user_list,:via => :put
|
|
||||||
end
|
|
||||||
|
|
||||||
resources :bulletin_links, :controller => 'bulletin_links' do
|
resources :bulletin_links, :controller => 'bulletin_links' do
|
||||||
match "link_quick_edit/:bulletin_link_id" => "bulletin_links#link_quick_edit" ,:as => :link_quick_edit
|
match "link_quick_edit/:bulletin_link_id" => "bulletin_links#link_quick_edit" ,:as => :link_quick_edit
|
||||||
|
|
|
@ -4,9 +4,9 @@ namespace :nccu_data do
|
||||||
desc "load nccu data from csv"
|
desc "load nccu data from csv"
|
||||||
task :setup_ut_list => :environment do
|
task :setup_ut_list => :environment do
|
||||||
require 'csv'
|
require 'csv'
|
||||||
|
|
||||||
CSV.foreach("vendor/built_in_modules/announcement/lib/ut_list_from_nccu_2012feb.csv") do |row|
|
CSV.foreach("vendor/built_in_modules/announcement/lib/ut_list_from_nccu_2012feb.csv") do |row|
|
||||||
new_unit = UnitListForAnc.new(:order => row[0], :ut_code => row[1], :up_ut_code => row[2], :created_at => Time.now,:updated_at => Time.now)
|
new_unit = UnitListForAnc.new(:order => row[0], :ut_code => row[1], :up_ut_code => row[2], :created_at => Time.now,:updated_at => Time.now)
|
||||||
|
# order,ut_code,up_tu_code,ut_zh_tw,ut_en
|
||||||
new_unit.build_title :en => row[4], :zh_tw => row[3]
|
new_unit.build_title :en => row[4], :zh_tw => row[3]
|
||||||
new_unit.save
|
new_unit.save
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
order,ut_code,up_tu_code,ut_zh_tw,ut_en
|
|
||||||
0100,H00,H00,校長室,Office of the President
|
0100,H00,H00,校長室,Office of the President
|
||||||
0110,H01,H01,副校長室一,Office of the Vice President
|
0110,H01,H01,副校長室一,Office of the Vice President
|
||||||
0110,H03,H03,副校長室二,Office of the Vice President
|
0110,H03,H03,副校長室二,Office of the Vice President
|
||||||
|
|
|
|
@ -12,6 +12,7 @@ class Panel::News::BackEnd::NewsApprovalsController < OrbitBackendController
|
||||||
end
|
end
|
||||||
|
|
||||||
def setting
|
def setting
|
||||||
|
@sys_users = User.all(conditions: {admin: false})
|
||||||
@news_bulletin_categorys = NewsBulletinCategory.all
|
@news_bulletin_categorys = NewsBulletinCategory.all
|
||||||
if params.has_key?(:category_id)
|
if params.has_key?(:category_id)
|
||||||
first_category = NewsBulletinCategory.find params[:category_id]
|
first_category = NewsBulletinCategory.find params[:category_id]
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
class Panel::News::BackEnd::NewsBulletinCategorySettingController < OrbitBackendController
|
|
||||||
before_filter :authenticate_user!
|
|
||||||
before_filter :for_app_manager
|
|
||||||
include AdminHelper
|
|
||||||
# layout 'admin'
|
|
||||||
# def preview_and_approve
|
|
||||||
# @bulletin = Bulletin.find params[:bulletin_id]
|
|
||||||
# end
|
|
||||||
|
|
||||||
# def approve
|
|
||||||
#
|
|
||||||
# end
|
|
||||||
|
|
||||||
def setting
|
|
||||||
@bulletin_categorys = []
|
|
||||||
@bulletin_categorys << NewsBulletinCategory.find(params[:news_bulletin_category_id])
|
|
||||||
@options_from_collection_for_select_bulletin_categorys = @bulletin_categorys.collect{|bc| [bc.i18n_variable[I18n.locale],bc.id] }
|
|
||||||
if params.has_key? :category
|
|
||||||
@bulletin_category = NewsBulletinCategory.find params[:category][:id]
|
|
||||||
else
|
|
||||||
@bulletin_category = @bulletin_categorys.first
|
|
||||||
end
|
|
||||||
preload_object_auth = @bulletin_category.object_auths.where(title: 'submit').empty?? (@bulletin_category.object_auths.create! :title=> 'submit') : @bulletin_category.object_auths.where(title: 'submit')
|
|
||||||
@users_array = preload_object_auth.first.privilege_users rescue []
|
|
||||||
respond_to do |format|
|
|
||||||
format.html
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def update_setting
|
|
||||||
object_auth = update_setting_by_params
|
|
||||||
if object_auth.save!
|
|
||||||
flash[:notice] = "Update Done"
|
|
||||||
else
|
|
||||||
flash[:notice] = "Update Failed"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def user_list
|
|
||||||
@bulletin_category = NewsBulletinCategory.find params[:category][:id]
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
|
||||||
def update_setting_by_params
|
|
||||||
category = NewsBulletinCategory.find params[:category][:id]
|
|
||||||
privilege_users = params[:users].collect{|key,value| User.find key } rescue []
|
|
||||||
object_auth_ary = category.object_auths.where(title: 'submit') || (category.object_auths.create :title=> 'submit')
|
|
||||||
object_auth = object_auth_ary.first
|
|
||||||
object_auth.privilege_users = privilege_users
|
|
||||||
object_auth
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_categorys(id = nil)
|
|
||||||
@bulletin_categorys = []
|
|
||||||
if(is_manager? || is_admin?)
|
|
||||||
@bulletin_categorys = (id ? NewsBulletinCategory.find(id).to_a : NewsBulletinCategory.excludes('disabled' => true))
|
|
||||||
elsif is_sub_manager?
|
|
||||||
@bulletin_categorys = NewsBulletinCategory.authed_for_user(current_user,'submit_new')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -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,16 +9,17 @@ class Panel::News::Widget::NewsBulletinsController < OrbitWidgetController
|
||||||
# GET /news_bulletins.xml
|
# GET /news_bulletins.xml
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@title = params[:part_title]
|
||||||
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]).per(5)
|
||||||
@current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil
|
@current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil
|
||||||
elsif !params[:tag_id].blank?
|
elsif !params[:tag_id].blank?
|
||||||
@tag = NewsTag.find(params[:tag_id]) rescue nil
|
@tag = NewsTag.find(params[:tag_id]) rescue nil
|
||||||
@tag = NewsTag.where(key: params[:tag_id])[0] unless @tag
|
@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(10) rescue nil
|
@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.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]).per(5)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -28,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
|
||||||
|
|
|
@ -10,7 +10,7 @@ include ActionView::Helpers::UrlHelper
|
||||||
oa = news_bulletin_category.get_object_auth_by_title(type)
|
oa = news_bulletin_category.get_object_auth_by_title(type)
|
||||||
end
|
end
|
||||||
# link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
|
# link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
|
||||||
link_to t('announcement.bulletin.cate_auth'),panel_news_back_end_news_bulletin_category_setting_path(news_bulletin_category)
|
link_to t('announcement.bulletin.cate_auth'),admin_object_auth_ob_auth_path(oa)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,10 @@ class NewsBulletinCategory
|
||||||
|
|
||||||
has_many :news_bulletins
|
has_many :news_bulletins
|
||||||
|
|
||||||
|
def pp_object
|
||||||
|
i18n_variable[I18n.locale]
|
||||||
|
end
|
||||||
|
|
||||||
def self.from_id(id)
|
def self.from_id(id)
|
||||||
NewsBulletinCategory.find(id) rescue nil
|
NewsBulletinCategory.find(id) rescue nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
|
<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
|
||||||
<% sys_users = User.all -%>
|
<% @sys_users.each do |user| -%>
|
||||||
<% sys_users.each do |user| -%>
|
|
||||||
|
|
||||||
<div class="checkblock">
|
<div class="checkblock">
|
||||||
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
$("#users_checkbox_ary").replaceWith('<%= escape_javascript(render :partial => "privilege_user", :locals => {:users => @users_array})%>');
|
|
||||||
permissionCheckbox();
|
|
|
@ -1 +0,0 @@
|
||||||
alert( "<% flash.each do |key, msg| %><%= msg %><% end%>");
|
|
|
@ -1,2 +0,0 @@
|
||||||
$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_list',:locals => {:bulletin_category => @bulletin_category})) %>");
|
|
||||||
var start_modal_with_id = "bulletin_category-<%=@bulletin_category.id%>"
|
|
|
@ -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 %>
|
|
@ -1,33 +1,3 @@
|
||||||
<% # encoding: utf-8 %>
|
<div id='news_bulletin_widget'>
|
||||||
|
<%= render 'index' %>
|
||||||
<%= flash_messages %>
|
</div>
|
||||||
|
|
||||||
<% if @current_category %>
|
|
||||||
<h1 class="h1"><%= @current_category.i18n_variable[I18n.locale] + t('news.news_bulletin.list_lower') %></h1>
|
|
||||||
<% elsif @tag %>
|
|
||||||
<h1 class="h1"><%= @tag[I18n.locale] + t('news.news_bulletin.list_lower') %></h1>
|
|
||||||
<% else %>
|
|
||||||
<h1 class="h1"><%= t('news.list_news') %></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 => 'false'} %>
|
|
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: 列表
|
||||||
|
|
|
@ -20,11 +20,7 @@ Rails.application.routes.draw do
|
||||||
match "file_quick_edit/:news_bulletin_id" => "news_bulletins#file_quick_edit" ,:as => :file_quick_edit
|
match "file_quick_edit/:news_bulletin_id" => "news_bulletins#file_quick_edit" ,:as => :file_quick_edit
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :news_bulletin_categorys do
|
resources :news_bulletin_categorys
|
||||||
match 'submit_setting' => "news_bulletin_category_setting#setting" ,:as => :setting,:via => :get
|
|
||||||
match 'submit_setting' => "news_bulletin_category_setting#update_setting" ,:as => :setting,:via => :post
|
|
||||||
match 'submit_setting' => "news_bulletin_category_setting#user_list" ,:as => :user_list,:via => :put
|
|
||||||
end
|
|
||||||
|
|
||||||
resources :news_bulletin_links, :controller => 'news_bulletin_links' do
|
resources :news_bulletin_links, :controller => 'news_bulletin_links' do
|
||||||
match "link_quick_edit/:news_bulletin_link_id" => "news_bulletin_links#link_quick_edit" ,:as => :link_quick_edit
|
match "link_quick_edit/:news_bulletin_link_id" => "news_bulletin_links#link_quick_edit" ,:as => :link_quick_edit
|
||||||
|
|
|
@ -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", "home_banner"],
|
"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">
|
||||||
<li><%= link_to t('page_context.edit'), edit_panel_page_content_back_end_page_context_path(page_context) %></li>
|
<li><%= link_to t('page_context.edit'), edit_panel_page_content_back_end_page_context_path(page_context) %></li>
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue