Code merge
This commit is contained in:
commit
4d9244005a
Binary file not shown.
Before Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 12 KiB |
|
@ -0,0 +1,6 @@
|
||||||
|
var pic = $(".app-pic").length,w,h;
|
||||||
|
for(i=0; i<pic; i=i+1) {
|
||||||
|
w = $(".app-pic").eq(i).width();
|
||||||
|
h = $(".app-pic").eq(i).height();
|
||||||
|
$(".app-pic").eq(i).find('img').muImageResize({width: w, height: h});
|
||||||
|
}
|
|
@ -0,0 +1,147 @@
|
||||||
|
(function( $ ) {
|
||||||
|
$.fn.muImageResize = function( params ) {
|
||||||
|
var _defaultSettings = {
|
||||||
|
width:300,
|
||||||
|
height:300,
|
||||||
|
wrap_fix:true // Let image display like in-line.
|
||||||
|
};
|
||||||
|
var _set = $.extend(_defaultSettings, params);
|
||||||
|
var isIE7 = $.browser.msie && (7 == ~~ $.browser.version);
|
||||||
|
|
||||||
|
//var anyDynamicSource = $(this).attr("src");
|
||||||
|
//$(this).attr("src",anyDynamicSource+ "?" + new Date().getTime());
|
||||||
|
|
||||||
|
// Just bind load event once per element.
|
||||||
|
return this.one('load', function() {
|
||||||
|
// Remove all attributes and CSS rules.
|
||||||
|
this.removeAttribute( "width" );
|
||||||
|
this.removeAttribute( "height" );
|
||||||
|
this.style.width = this.style.height = "";
|
||||||
|
|
||||||
|
var ow, oh;
|
||||||
|
|
||||||
|
//[workaround] - msie need get width early
|
||||||
|
if ($.browser.msie)
|
||||||
|
{
|
||||||
|
// Get original size for calcutation.
|
||||||
|
ow = this.width;
|
||||||
|
oh = this.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_set.wrap_fix) {
|
||||||
|
$(this).wrap(function(){
|
||||||
|
return '<div style="width:'+_set.width+'px; height:'+_set.height+'px; display:inline-block;" />';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$.browser.msie)
|
||||||
|
{
|
||||||
|
// Get original size for calcutation.
|
||||||
|
ow = this.width;
|
||||||
|
oh = this.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if cannot get width or height.
|
||||||
|
if (0==ow || 0==oh){
|
||||||
|
$(this).width(_set.width);
|
||||||
|
$(this).height(_set.height);
|
||||||
|
}else{
|
||||||
|
|
||||||
|
// Merge position settings
|
||||||
|
var sh_margin_type='';
|
||||||
|
|
||||||
|
// if original image's width > height.
|
||||||
|
if (ow > oh) {
|
||||||
|
p = oh / _set.height;
|
||||||
|
oh = _set.height;
|
||||||
|
ow = ow / p;
|
||||||
|
|
||||||
|
// original image width smaller than settings.
|
||||||
|
if (ow < _set.width){
|
||||||
|
// need to resize again,
|
||||||
|
// because new image size range must can cover settings' range, than we can crop it correctly.
|
||||||
|
p = ow / _set.width;
|
||||||
|
ow = _set.width;
|
||||||
|
oh = oh / p;
|
||||||
|
|
||||||
|
// the crop range would be in the center of new image size.
|
||||||
|
sh = (oh-_set.height)/2;
|
||||||
|
t=sh+'px';
|
||||||
|
r=_set.width+'px';
|
||||||
|
b=(_set.height+sh)+'px';
|
||||||
|
l='0px';
|
||||||
|
|
||||||
|
// need to be adjust top position latter.
|
||||||
|
sh_margin_type = 'margin-top';
|
||||||
|
|
||||||
|
// original image width bigger than settings.
|
||||||
|
}else{
|
||||||
|
// new image range can cover settings' range.
|
||||||
|
sh = (ow-_set.width)/2;
|
||||||
|
t='0px';
|
||||||
|
r=(_set.width+sh)+'px';
|
||||||
|
b=_set.height+'px';
|
||||||
|
l=sh+'px';
|
||||||
|
// need to be adjust left position latter.
|
||||||
|
sh_margin_type = 'margin-left';
|
||||||
|
}
|
||||||
|
// ref above, change width to height then do same things.
|
||||||
|
}else{
|
||||||
|
p = ow / _set.width;
|
||||||
|
ow = _set.width;
|
||||||
|
oh = oh / p;
|
||||||
|
|
||||||
|
if (oh < _set.height) {
|
||||||
|
p = oh / _set.height;
|
||||||
|
oh = _set.height;
|
||||||
|
ow = ow / p;
|
||||||
|
|
||||||
|
sh = (ow-_set.width)/2;
|
||||||
|
t='0px';
|
||||||
|
r=(_set.width+sh)+'px';
|
||||||
|
b=_set.height+'px';
|
||||||
|
l=sh+'px';
|
||||||
|
sh_margin_type = 'margin-left';
|
||||||
|
}else{
|
||||||
|
sh = (oh-_set.height)/2;
|
||||||
|
t=sh+'px';
|
||||||
|
r=_set.width+'px';
|
||||||
|
b=(_set.height+sh)+'px';
|
||||||
|
l='0px';
|
||||||
|
sh_margin_type = 'margin-top';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resize img.
|
||||||
|
$(this).width(ow);
|
||||||
|
$(this).height(oh);
|
||||||
|
|
||||||
|
// Crop img by set clip style.
|
||||||
|
$(this).css('clip','rect('+t+' '+r+' '+b+' '+l+')');
|
||||||
|
|
||||||
|
var osh = 0;
|
||||||
|
if('auto' != $(this).css(sh_margin_type)){
|
||||||
|
osh = parseInt($(this).css(sh_margin_type));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 < sh) {sh*=-1;}
|
||||||
|
sh += osh;
|
||||||
|
|
||||||
|
$(this).css(sh_margin_type, sh+'px');
|
||||||
|
$(this).css('position','absolute');
|
||||||
|
}
|
||||||
|
$(this).fadeIn('slow');
|
||||||
|
})
|
||||||
|
.one( "error", function() {
|
||||||
|
//$(this).hide();
|
||||||
|
})
|
||||||
|
.each(function() {
|
||||||
|
$(this).hide();
|
||||||
|
// Trigger load event (for Gecko and MSIE)
|
||||||
|
if ( this.complete || $.browser.msie ) {
|
||||||
|
$( this ).trigger( "load" ).trigger( "error" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
})( jQuery );
|
|
@ -24,6 +24,10 @@ $("#module_app_list select").live('change', function() {
|
||||||
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widgets');
|
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widgets');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#widget_list select").live('change', function() {
|
||||||
|
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widget_styles?module_app_id=' + $("#module_app_list select").val());
|
||||||
|
});
|
||||||
|
|
||||||
$("#tag_list select").live('change', function() {
|
$("#tag_list select").live('change', function() {
|
||||||
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_r_tag_options');
|
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_r_tag_options');
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
#banner_nav>li>a {
|
#banner_nav>li>a {
|
||||||
|
display:block;
|
||||||
width: 10px;
|
width: 10px;
|
||||||
height: 10px;
|
height: 10px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
@import url(http://fonts.googleapis.com/css?family=Cuprum|Open+Sans:400,300);
|
/*style*/
|
||||||
|
|
||||||
|
@import url(http://fonts.googleapis.com/css?family=Cuprum);
|
||||||
@font-face{
|
@font-face{
|
||||||
font-family: 'WebSymbolsRegular';
|
font-family: 'WebSymbolsRegular';
|
||||||
src: url(<%= asset_path 'websymbols-regular-webfont.eot' %>);
|
src: url(<%= asset_path 'websymbols-regular-webfont.eot' %>);
|
||||||
|
@ -10,7 +11,7 @@
|
||||||
}
|
}
|
||||||
.login-logo {
|
.login-logo {
|
||||||
text-indent: -9999px;
|
text-indent: -9999px;
|
||||||
background: url(<%= asset_path 'sign-in-logo.png' %>) no-repeat center 80px;
|
background: url(<%= asset_path 'sign-in-logo.png' %>) no-repeat center 40px;
|
||||||
padding-top: 40px;
|
padding-top: 40px;
|
||||||
height: 160px;
|
height: 160px;
|
||||||
}
|
}
|
||||||
|
@ -33,6 +34,7 @@
|
||||||
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset;
|
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset;
|
||||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset;
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset;
|
||||||
|
|
||||||
|
/*
|
||||||
background-image: -moz-linear-gradient(top, #5282A6, #133757);
|
background-image: -moz-linear-gradient(top, #5282A6, #133757);
|
||||||
background-image: -ms-linear-gradient(top, #5282A6, #133757);
|
background-image: -ms-linear-gradient(top, #5282A6, #133757);
|
||||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5282A6), to(#133757));
|
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5282A6), to(#133757));
|
||||||
|
@ -40,7 +42,8 @@
|
||||||
background-image: -o-linear-gradient(top, #5282A6, #133757);
|
background-image: -o-linear-gradient(top, #5282A6, #133757);
|
||||||
background-image: linear-gradient(top, #5282A6, #133757);
|
background-image: linear-gradient(top, #5282A6, #133757);
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5282A6', endColorstr='#133757', GradientType=0);
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5282A6', endColorstr='#133757', GradientType=0);
|
||||||
/*
|
*/
|
||||||
|
|
||||||
background-image: -moz-linear-gradient(top, #545b60, #191a1c);
|
background-image: -moz-linear-gradient(top, #545b60, #191a1c);
|
||||||
background-image: -ms-linear-gradient(top, #545b60, #191a1c);
|
background-image: -ms-linear-gradient(top, #545b60, #191a1c);
|
||||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#545b60), to(#191a1c));
|
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#545b60), to(#191a1c));
|
||||||
|
@ -48,7 +51,7 @@
|
||||||
background-image: -o-linear-gradient(top, #545b60, #191a1c);
|
background-image: -o-linear-gradient(top, #545b60, #191a1c);
|
||||||
background-image: linear-gradient(top, #545b60, #191a1c);
|
background-image: linear-gradient(top, #545b60, #191a1c);
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#545b60', endColorstr='#191a1c', GradientType=0);
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#545b60', endColorstr='#191a1c', GradientType=0);
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
#orbit-bar .navbar-search {
|
#orbit-bar .navbar-search {
|
||||||
left: 28px;
|
left: 28px;
|
||||||
|
@ -80,8 +83,8 @@
|
||||||
width:100%;
|
width:100%;
|
||||||
}
|
}
|
||||||
#orbit-bar .orbit-logo .brand {
|
#orbit-bar .orbit-logo .brand {
|
||||||
/* background: url(<%= asset_path 'orbit-bar.png' %>) no-repeat -162px -5px; */
|
background: url(<%= asset_path 'orbit-bar.png' %>) no-repeat -162px -5px;
|
||||||
background: url(<%= asset_path 'nccu_logo.png' %>) no-repeat 6px 0px;
|
/* background: url(<%= asset_path 'nccu_logo.png' %>) no-repeat 6px 0px; */
|
||||||
text-indent:-9999px;
|
text-indent:-9999px;
|
||||||
padding: 5px 20px 4px;
|
padding: 5px 20px 4px;
|
||||||
}
|
}
|
||||||
|
@ -118,8 +121,8 @@
|
||||||
background-position: -10px -10px;
|
background-position: -10px -10px;
|
||||||
}
|
}
|
||||||
#orbit-bar .nav > li > a.orbit-bar-desktop {
|
#orbit-bar .nav > li > a.orbit-bar-desktop {
|
||||||
background-position: -73px -42px;
|
background-position: -106px -10px;
|
||||||
width: 48px;
|
width: 16px;
|
||||||
}
|
}
|
||||||
#orbit-bar .nav > li > a.orbit-bar-member {
|
#orbit-bar .nav > li > a.orbit-bar-member {
|
||||||
background-position: -4px -37px;
|
background-position: -4px -37px;
|
||||||
|
|
|
@ -11,6 +11,11 @@ class Admin::ModuleAppsController < ApplicationController
|
||||||
|
|
||||||
def reload_frontend_pages
|
def reload_frontend_pages
|
||||||
@module_app = ModuleApp.find(params[:id])
|
@module_app = ModuleApp.find(params[:id])
|
||||||
|
|
||||||
|
@frontend_path = @module_app.widgets.keys[0] if ( !@module_app.widgets.blank? && @module_app.widgets[0].blank? )
|
||||||
|
|
||||||
|
@frontend_style = @module_app.widgets[@frontend_path] if ( !@frontend_path.blank? )
|
||||||
|
|
||||||
case @module_app.key
|
case @module_app.key
|
||||||
when 'announcement'
|
when 'announcement'
|
||||||
@categories = BulletinCategory.all
|
@categories = BulletinCategory.all
|
||||||
|
|
|
@ -26,6 +26,10 @@ class Admin::PagePartsController < ApplicationController
|
||||||
@module_app = @part.module_app ? @part.module_app : @module_apps[0]
|
@module_app = @part.module_app ? @part.module_app : @module_apps[0]
|
||||||
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
|
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
|
||||||
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
||||||
|
|
||||||
|
@widget_path = @part.widget_path ? @part.widget_path : @module_app.widgets.keys[0]
|
||||||
|
@widget_style = @module_app.widgets[@widget_path]
|
||||||
|
|
||||||
case @module_app.key
|
case @module_app.key
|
||||||
when 'announcement'
|
when 'announcement'
|
||||||
@categories = BulletinCategory.all
|
@categories = BulletinCategory.all
|
||||||
|
@ -45,6 +49,10 @@ class Admin::PagePartsController < ApplicationController
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@part = PagePart.find(params[:id])
|
@part = PagePart.find(params[:id])
|
||||||
|
|
||||||
|
params[:page_part][:widget_field] = params[:page_part][:widget_field].zip( params[:page_part][:widget_field_type] )
|
||||||
|
params[:page_part][:widget_field_type] = nil
|
||||||
|
|
||||||
if @part.update_attributes(params[:page_part])
|
if @part.update_attributes(params[:page_part])
|
||||||
set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu')
|
set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu')
|
||||||
flash.now[:notice] = t('admin.update_success_content')
|
flash.now[:notice] = t('admin.update_success_content')
|
||||||
|
@ -69,6 +77,11 @@ class Admin::PagePartsController < ApplicationController
|
||||||
|
|
||||||
def reload_widgets
|
def reload_widgets
|
||||||
@module_app = ModuleApp.find(params[:id])
|
@module_app = ModuleApp.find(params[:id])
|
||||||
|
|
||||||
|
@widget_path = @module_app.widgets.keys[0] if ( @module_app.widgets[0].blank? )
|
||||||
|
|
||||||
|
@widget_style = @module_app.widgets[@widget_path] if ( !@widget_path.blank? )
|
||||||
|
|
||||||
case @module_app.key
|
case @module_app.key
|
||||||
when 'announcement'
|
when 'announcement'
|
||||||
@categories = BulletinCategory.all
|
@categories = BulletinCategory.all
|
||||||
|
@ -85,6 +98,16 @@ class Admin::PagePartsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def reload_widget_styles
|
||||||
|
@module_app = ModuleApp.find(params[:module_app_id])
|
||||||
|
|
||||||
|
@widget_style = @module_app.widgets[params[:id]]
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.js {}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def reload_r_tag_options
|
def reload_r_tag_options
|
||||||
@r_tag = (ModuleApp.find(params[:id]) rescue nil) || params[:id]
|
@r_tag = (ModuleApp.find(params[:id]) rescue nil) || params[:id]
|
||||||
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
||||||
|
|
|
@ -28,10 +28,19 @@ class Admin::PagesController < ApplicationController
|
||||||
def edit
|
def edit
|
||||||
@item = Page.find(params[:id])
|
@item = Page.find(params[:id])
|
||||||
@apps = ModuleApp.excludes(app_pages: nil).entries
|
@apps = ModuleApp.excludes(app_pages: nil).entries
|
||||||
|
|
||||||
|
@module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
|
||||||
|
|
||||||
@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
|
||||||
|
|
||||||
if @item.module_app
|
if @item.module_app
|
||||||
|
@module_app = @item.module_app
|
||||||
|
|
||||||
|
@frontend_path = @item.app_frontend_url ? @item.app_frontend_url : @module_app.widgets.keys[0]
|
||||||
|
@frontend_style = @module_app.widgets[@frontend_path] if !@frontend_path.blank? && !@module_app.widgets.blank?
|
||||||
|
|
||||||
case @item.module_app.key
|
case @item.module_app.key
|
||||||
when 'announcement'
|
when 'announcement'
|
||||||
@categories = BulletinCategory.all
|
@categories = BulletinCategory.all
|
||||||
|
@ -45,6 +54,7 @@ class Admin::PagesController < ApplicationController
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@categories = nil
|
@categories = nil
|
||||||
|
@module_app = @module_apps[0]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -79,6 +89,9 @@ class Admin::PagesController < ApplicationController
|
||||||
@item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )
|
@item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
params[:page][:frontend_field] = params[:page][:frontend_field].zip( params[:page][:frontend_field_type] )
|
||||||
|
params[:page][:frontend_field_type] = nil
|
||||||
|
|
||||||
if @item.update_attributes(params[:page])
|
if @item.update_attributes(params[:page])
|
||||||
flash[:notice] = t('admin.update_success_page')
|
flash[:notice] = t('admin.update_success_page')
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
|
@ -14,7 +14,9 @@ class ModuleApp
|
||||||
field :enable_frontend, type: Boolean, :default => true
|
field :enable_frontend, type: Boolean, :default => true
|
||||||
|
|
||||||
field :app_pages ,type: Array
|
field :app_pages ,type: Array
|
||||||
field :widgets ,type: Array
|
# field :widgets ,type: Array
|
||||||
|
field :widgets ,type: Hash
|
||||||
|
field :widget_fields ,type: Array
|
||||||
|
|
||||||
has_many :managers,as: :managing_app ,:class_name => "AppManager" #,:dependent => :destroy,:foreign_key => "managing_app_id",:inverse_of => :managing_app
|
has_many :managers,as: :managing_app ,:class_name => "AppManager" #,:dependent => :destroy,:foreign_key => "managing_app_id",:inverse_of => :managing_app
|
||||||
has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager"#, :dependent => :destroy,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app
|
has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager"#, :dependent => :destroy,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app
|
||||||
|
|
|
@ -10,6 +10,10 @@ class Page < Item
|
||||||
field :tag
|
field :tag
|
||||||
field :view_count, :type => Integer, :default => 0
|
field :view_count, :type => Integer, :default => 0
|
||||||
|
|
||||||
|
field :frontend_style
|
||||||
|
field :frontend_field , :type => Array
|
||||||
|
field :frontend_data_count
|
||||||
|
|
||||||
belongs_to :design
|
belongs_to :design
|
||||||
belongs_to :module_app
|
belongs_to :module_app
|
||||||
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
|
@ -18,7 +22,7 @@ class Page < Item
|
||||||
has_many :page_metas, :autosave => true, :dependent => :destroy
|
has_many :page_metas, :autosave => true, :dependent => :destroy
|
||||||
accepts_nested_attributes_for :page_parts, :allow_destroy => true
|
accepts_nested_attributes_for :page_parts, :allow_destroy => true
|
||||||
|
|
||||||
before_save :create_parts, :set_key
|
before_save :create_parts, :set_key , :delete_empty_frontend_field
|
||||||
|
|
||||||
# embeds_many :custom_images, :class_name => 'Image', as: :design_image
|
# embeds_many :custom_images, :class_name => 'Image', as: :design_image
|
||||||
|
|
||||||
|
@ -53,4 +57,18 @@ class Page < Item
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def delete_empty_frontend_field
|
||||||
|
|
||||||
|
if self.frontend_field
|
||||||
|
self.frontend_field.reject! { |ff| (ff[0].blank? || ff[1].blank?) }
|
||||||
|
# self.frontend_field.each do | ff |
|
||||||
|
# if ff[0].blank? || ff[1].blank?
|
||||||
|
# self.frontend_field.delete("") if self.frontend_field
|
||||||
|
# self.frontend_field.delete(ff)
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,13 +11,17 @@ class PagePart
|
||||||
field :public_r_tag_option, :default => nil
|
field :public_r_tag_option, :default => nil
|
||||||
field :widget_path
|
field :widget_path
|
||||||
|
|
||||||
|
field :widget_style
|
||||||
|
field :widget_field , :type => Array
|
||||||
|
field :widget_data_count
|
||||||
|
|
||||||
has_one :i18n_variable, :class_name => "I18nVariable", :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
|
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
|
before_save :set_key, :delete_empty_widget_field
|
||||||
|
|
||||||
def i18n_variable
|
def i18n_variable
|
||||||
@i18n_variable ||= I18nVariable.first(:conditions => {:key => 'i18n_variable', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
@i18n_variable ||= I18nVariable.first(:conditions => {:key => 'i18n_variable', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||||
|
@ -34,4 +38,12 @@ class PagePart
|
||||||
i18n_variable.key = 'i18n_variable' if i18n_variable && (i18n_variable.key.blank? rescue true)
|
i18n_variable.key = 'i18n_variable' if i18n_variable && (i18n_variable.key.blank? rescue true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def delete_empty_widget_field
|
||||||
|
|
||||||
|
if self.widget_field
|
||||||
|
self.widget_field.reject! { |wf| (wf[0].blank? || wf[1].blank?) }
|
||||||
|
end
|
||||||
|
# self.widget_field.delete("") if self.widget_field
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -18,6 +18,8 @@ class Site
|
||||||
field :school
|
field :school
|
||||||
field :department
|
field :department
|
||||||
|
|
||||||
|
mount_uploader :default_image, ImageUploader
|
||||||
|
|
||||||
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
has_one :footer, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
has_one :footer, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
has_one :sub_menu, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
has_one :sub_menu, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
|
|
|
@ -30,6 +30,9 @@ class ImageUploader < CarrierWave::Uploader::Base
|
||||||
# def default_url
|
# def default_url
|
||||||
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
||||||
# end
|
# end
|
||||||
|
def default_url
|
||||||
|
Site.first.default_image.url rescue "-sign-in-logo.png"
|
||||||
|
end
|
||||||
|
|
||||||
# Process files as they are uploaded:
|
# Process files as they are uploaded:
|
||||||
# process :scale => [200, 300]
|
# process :scale => [200, 300]
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
$('#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_frontend_style').html("<%= escape_javascript(select 'page', 'frontend_style', @module_app.widgets[@frontend_path]) if !@frontend_path.blank? %>");
|
||||||
$('#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_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 %>");
|
$('#app_page_tag').html("<%= j (select 'page', 'tag', @tags.collect{|tag| [tag[I18n.locale], tag.id]}, {:include_blank => true}) if @tags %>");
|
||||||
|
$('#app_page_frontend_field').html("<%= j render '../admin/pages/frontend_fields' %>")
|
|
@ -14,7 +14,12 @@
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span id='widget_list'>
|
<span id='widget_list'>
|
||||||
<%= f.select :widget_path, @module_app.widgets.collect{|widget| [widget.humanize, widget]}, :selected => @part.widget_path %>
|
<%#= f.select :widget_path, @module_app.widgets.collect{|widget| [widget.humanize, widget]}, :selected => @part.widget_path %>
|
||||||
|
<%= f.select :widget_path, @module_app.widgets.collect{|k,v| [k.humanize, k]}, {}, { :selected => @part.widget_path, :rel => admin_page_parts_path } %>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span id='widget_style_list'>
|
||||||
|
<%= f.select :widget_style, @widget_style, :selected => @part.widget_style %>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
:
|
:
|
||||||
|
@ -26,3 +31,21 @@
|
||||||
<span id="widget_tag">
|
<span id="widget_tag">
|
||||||
<%= render 'widget_tags' %>
|
<%= render 'widget_tags' %>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
<span id='widget_field'>
|
||||||
|
|
||||||
|
<%= render 'widget_fields' %>
|
||||||
|
|
||||||
|
<%#= f.label :widget_field %>
|
||||||
|
<%# @module_app.widget_fields.each_with_index do |widget_field, i| %>
|
||||||
|
<%#= i+1 %>
|
||||||
|
<%#= select_tag "page_part[widget_field][]", options_for_select(@module_app.widget_fields.collect{|widget_field| [widget_field.humanize, widget_field]}, (@part.widget_field ? @part.widget_field[i] : nil) ), :include_blank => true %> <br />
|
||||||
|
<%# end %>
|
||||||
|
|
||||||
|
<%#= select_tag "page_part[widget_field][]", options_for_select(@module_app.widget_fields.collect{|widget_field| [widget_field.humanize, widget_field]}, @part.widget_field.collect{|widget_field| widget_field}), {:multiple => :multiple, :size => 6} %>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<div id="widget_data_count">
|
||||||
|
<%= f.label :widget_data_count %>
|
||||||
|
<%= f.text_field :widget_data_count %>
|
||||||
|
</div>
|
|
@ -0,0 +1,12 @@
|
||||||
|
|
||||||
|
<% if (@module_app && @module_app.widget_fields) %>
|
||||||
|
|
||||||
|
<%= label_tag('widget_field') %>
|
||||||
|
|
||||||
|
<% @module_app.widget_fields.each_with_index do |widget_field, i| %>
|
||||||
|
<%= i+1 %>
|
||||||
|
<%= select_tag "page_part[widget_field][]", options_for_select(@module_app.widget_fields.collect{|widget_field| [widget_field.humanize, widget_field]}, (@part[:widget_field][i][0] if (@part && !@part[:widget_field].blank? && !@part[:widget_field][i].blank?)) ), :include_blank => true %>
|
||||||
|
<%= select_tag "page_part[widget_field_type][]", options_for_select(LIST[:widget_field_type].collect{|widget_field| [widget_field.humanize, widget_field]}, (@part[:widget_field][i][1] if (@part && !@part[:widget_field].blank? && !@part[:widget_field][i].blank?)) ), :include_blank => true %> <br />
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% end %>
|
|
@ -0,0 +1 @@
|
||||||
|
$('#widget_style_list select').html("<%= j options_for_select(@module_app.widgets[params[:id]]) %>")
|
|
@ -1,3 +1,5 @@
|
||||||
$('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|widget| [widget.humanize, widget]}) %>")
|
$('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|k,v| k}) %>")
|
||||||
|
$('#widget_style_list select').html("<%= j options_for_select( @module_app.widgets[@widget_path] ) if !@widget_path.blank? %>")
|
||||||
|
$('#widget_field').html("<%= j render 'widget_fields' %>")
|
||||||
$('#widget_category').html("<%= j render 'widget_categories' %>")
|
$('#widget_category').html("<%= j render 'widget_categories' %>")
|
||||||
$('#widget_tag').html("<%= j render 'widget_tags' %>")
|
$('#widget_tag').html("<%= j render 'widget_tags' %>")
|
|
@ -42,15 +42,27 @@
|
||||||
<span id="app_page_url">
|
<span id="app_page_url">
|
||||||
<%= select('page','app_frontend_url', @app_frontend_urls, :selected => @item.app_frontend_url ) rescue ''%>
|
<%= select('page','app_frontend_url', @app_frontend_urls, :selected => @item.app_frontend_url ) rescue ''%>
|
||||||
</span>
|
</span>
|
||||||
|
<span id="app_page_frontend_style">
|
||||||
|
<%= select('page','frontend_style', @frontend_style, :selected => @item[:frontend_style], :include_blank => true ) rescue ''%>
|
||||||
|
</span>
|
||||||
<span id="app_page_category">
|
<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 ''%>
|
<%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category], :include_blank => true ) rescue ''%>
|
||||||
</span>
|
</span>
|
||||||
<span id="app_page_tag">
|
<span id="app_page_tag">
|
||||||
<%= select('page','tag', @tags.collect{|tag| [tag[I18n.locale], tag.id]}, :selected => @item[:tag], :include_blank => true ) rescue ''%>
|
<%= select('page','tag', @tags.collect{|tag| [tag[I18n.locale], tag.id]}, :selected => @item[:tag], :include_blank => true ) rescue ''%>
|
||||||
</span>
|
</span>
|
||||||
|
<span id="app_page_frontend_field">
|
||||||
|
<%= render 'frontend_fields' %>
|
||||||
|
</span>
|
||||||
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
|
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :frontend_data_count, t('admin.frontend_data_count'), :class => 'control-label' %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :frontend_data_count %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<%= f.label :is_published, "#{t('admin.is_published')} ?", :class => 'control-label' %>
|
<%= f.label :is_published, "#{t('admin.is_published')} ?", :class => 'control-label' %>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
<% if (@module_app && @module_app.widget_fields) %>
|
||||||
|
<%= label_tag('frontend_field & frontend_field_type') %>
|
||||||
|
<% @module_app.widget_fields.each_with_index do |frontend_field, i| %>
|
||||||
|
<%= i+1 %>
|
||||||
|
<%= select_tag "page[frontend_field][]", options_for_select(@module_app.widget_fields.collect{|frontend_field| [frontend_field.humanize, frontend_field]}, (@item[:frontend_field][i][0] if (@item && !@item[:frontend_field].blank? && !@item[:frontend_field][i].blank?)) ), :include_blank => true %>
|
||||||
|
<%= select_tag "page[frontend_field_type][]", options_for_select(LIST[:widget_field_type].collect{|frontend_field| [frontend_field.humanize, frontend_field]}, (@item[:frontend_field][i][1] if (@item && !@item[:frontend_field].blank? && !@item[:frontend_field][i].blank?)) ), :include_blank => true %> <br />
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
<% # encoding: utf-8 %>
|
||||||
|
|
||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render 'side_bar' %>
|
<%= render 'side_bar' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -70,6 +72,24 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label"><%= t 'admin.default_image' %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.file_field :default_image, :id => "input-upload", :class => 'upload', :onchange => "document.getElementById('fu').innerHTML = this.form.fu.value = this.value;" %>
|
||||||
|
<span id='fu' class="file-name"></span>
|
||||||
|
<!--請程式務必將圖片尺寸加入到行內裡-->
|
||||||
|
<% if @site.default_image %>
|
||||||
|
<%= image_tag( @site.default_image, :size=>"120x120") rescue ''%>
|
||||||
|
<% else %>
|
||||||
|
<img class="pull-left upload-picture" src="/assets/default-img.png" />
|
||||||
|
<% end %>
|
||||||
|
<br>
|
||||||
|
<% if @site.default_image.file %>
|
||||||
|
<%= f.check_box :remove_default_image %>
|
||||||
|
<%= t('刪除已上傳檔案') %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -67,7 +67,6 @@
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
|
|
||||||
<%= content_tag :li, :class => active_for_controllers('orbit_galleries','/panel/gallery/back_end/tags') || active_for_app_auth("orbit_gallery") do -%>
|
<%= content_tag :li, :class => active_for_controllers('orbit_galleries','/panel/gallery/back_end/tags') || active_for_app_auth("orbit_gallery") do -%>
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icons-picture') + t('admin.orbit_gallery'), panel_gallery_back_end_orbit_gallery_path %>
|
<%= link_to content_tag(:i, nil, :class => 'icons-picture') + t('admin.orbit_gallery'), panel_gallery_back_end_orbit_gallery_path %>
|
||||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('orbit_galleries') ) do -%>
|
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('orbit_galleries') ) do -%>
|
||||||
|
|
|
@ -15,3 +15,26 @@ page_part_kinds:
|
||||||
- text
|
- text
|
||||||
- public_r_tag
|
- public_r_tag
|
||||||
- module_widget
|
- module_widget
|
||||||
|
|
||||||
|
widget_field:
|
||||||
|
- title
|
||||||
|
- category
|
||||||
|
- image
|
||||||
|
- date
|
||||||
|
- subtitle
|
||||||
|
- content
|
||||||
|
- link
|
||||||
|
- file
|
||||||
|
|
||||||
|
widget_field_type:
|
||||||
|
- title
|
||||||
|
- category
|
||||||
|
- img
|
||||||
|
- date
|
||||||
|
- text
|
||||||
|
- link
|
||||||
|
- file
|
||||||
|
- status
|
||||||
|
- tag
|
||||||
|
- viewcount
|
||||||
|
- poster
|
|
@ -9,7 +9,6 @@ defaults: &defaults
|
||||||
development:
|
development:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
database: prototype_r4_development
|
database: prototype_r4_development
|
||||||
|
|
||||||
test:
|
test:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
database: prototype_r4_test
|
database: prototype_r4_test
|
||||||
|
|
|
@ -97,6 +97,7 @@ Orbit::Application.routes.draw do
|
||||||
resources :page_parts do
|
resources :page_parts do
|
||||||
member do
|
member do
|
||||||
get 'reload_widgets'
|
get 'reload_widgets'
|
||||||
|
get 'reload_widget_styles'
|
||||||
get 'reload_r_tag_options'
|
get 'reload_r_tag_options'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -187,7 +187,7 @@ module ParserCommon
|
||||||
ret << part.i18n_variable[I18n.locale] rescue ''
|
ret << part.i18n_variable[I18n.locale] rescue ''
|
||||||
when 'module_widget'
|
when 'module_widget'
|
||||||
url = "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true"
|
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}"
|
options = "&category_id=#{!part[:category].blank? ? part[:category] : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}&part_id=#{part.id}"
|
||||||
ret << "<div class='dymanic_load' path='#{url + options}'></div>"
|
ret << "<div class='dymanic_load' path='#{url + options}'></div>"
|
||||||
when 'public_r_tag'
|
when 'public_r_tag'
|
||||||
ret << "<r:#{part.public_r_tag} id='#{part.public_r_tag_object_id}'/>"
|
ret << "<r:#{part.public_r_tag} id='#{part.public_r_tag_object_id}'/>"
|
||||||
|
|
|
@ -7,6 +7,10 @@
|
||||||
"update_info": "Some info",
|
"update_info": "Some info",
|
||||||
"create_date": "11-11-2011",
|
"create_date": "11-11-2011",
|
||||||
"app_pages": ["bulletins"],
|
"app_pages": ["bulletins"],
|
||||||
"widgets": ["bulletins", "bulletins_and_web_links"],
|
"widgets": {
|
||||||
|
"index":["1","2","3","4","5"],
|
||||||
|
"bulletins_and_web_links":[]
|
||||||
|
},
|
||||||
|
"widget_fields":["title","category","postdate"],
|
||||||
"enable_frontend": true
|
"enable_frontend": true
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,16 +10,26 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
||||||
|
@item = Page.find(params[:page_id])
|
||||||
|
|
||||||
|
if @item.frontend_data_count
|
||||||
|
@page_num = @item.frontend_data_count
|
||||||
|
else
|
||||||
|
@page_num = 10
|
||||||
|
end
|
||||||
|
|
||||||
|
@frontend_style = @item.frontend_style
|
||||||
|
|
||||||
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_main]).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(@page_num)
|
||||||
@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_main]).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(@page_num)
|
||||||
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_main]).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(@page_num)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,17 +9,62 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
||||||
# GET /bulletins.xml
|
# GET /bulletins.xml
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
||||||
|
@part = PagePart.find(params[:part_id])
|
||||||
|
|
||||||
|
if @part.widget_data_count
|
||||||
|
@page_num = @part.widget_data_count
|
||||||
|
else
|
||||||
|
@page_num = 4
|
||||||
|
end
|
||||||
|
|
||||||
|
if @part.widget_field
|
||||||
|
@widget_fields = @part.widget_field
|
||||||
|
else
|
||||||
|
@widget_fields = []
|
||||||
|
end
|
||||||
|
|
||||||
|
@title = params[:part_title]
|
||||||
|
|
||||||
|
@widget_style = @part.widget_style
|
||||||
|
|
||||||
|
@category_id = @part.category
|
||||||
|
|
||||||
|
date_now = Time.now
|
||||||
|
if !@category_id.blank?
|
||||||
|
@bulletins = Bulletin.can_display.where(:bulletin_category_id => @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(@page_num)
|
||||||
|
@current_category = BulletinCategory.from_id(@category_id) rescue nil
|
||||||
|
elsif !params[:tag_id].blank?
|
||||||
|
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil
|
||||||
|
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
|
||||||
|
@bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(@page_num)
|
||||||
|
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(@page_num)
|
||||||
|
end
|
||||||
|
|
||||||
|
get_categorys
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def bulletins_list_and_pic
|
||||||
|
|
||||||
|
if params[:widget_data_count]
|
||||||
|
@page_num = params[:widget_data_count];
|
||||||
|
else
|
||||||
|
@page_num = 4;
|
||||||
|
end
|
||||||
|
|
||||||
@title = params[:part_title]
|
@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(4)
|
@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(@page_num)
|
||||||
@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(4)
|
@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(@page_num)
|
||||||
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(4)
|
@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(@page_num)
|
||||||
end
|
end
|
||||||
|
|
||||||
get_categorys
|
get_categorys
|
||||||
|
|
|
@ -275,6 +275,7 @@
|
||||||
|
|
||||||
|
|
||||||
<% content_for :page_specific_javascript do %>
|
<% content_for :page_specific_javascript do %>
|
||||||
|
<%= javascript_include_tag "bulletin_form" %>
|
||||||
<%= javascript_include_tag "inc/jquery.imagesloaded.js" %>
|
<%= javascript_include_tag "inc/jquery.imagesloaded.js" %>
|
||||||
<script>
|
<script>
|
||||||
$('#add_bulletin_link a.add').live('click', function(){
|
$('#add_bulletin_link a.add').live('click', function(){
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<% if form_bulletin_link.new_record? %>
|
<% if form_bulletin_link.new_record? %>
|
||||||
<a class="delete"><i class="icon-remove"></i></a>
|
<a class="delete"><i class="icon-remove"></i></a>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= f.hidden_field :id %>
|
<%= f.hidden_field :id, :id => 'tr', :class => 'tr' %>
|
||||||
<a class="remove_existing_record"><i class="icon-remove"></i></a>
|
<a class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -8,15 +8,239 @@
|
||||||
<h1 class="h1"><%= t('announcement.announcement') %></h1>
|
<h1 class="h1"><%= t('announcement.announcement') %></h1>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if !@item.frontend_field.blank? %>
|
||||||
|
|
||||||
<table class="table table-bordered">
|
<% if @frontend_style == '1' %>
|
||||||
|
|
||||||
|
<div class="news news1">
|
||||||
|
<table class="newstb" border="0" cellpadding="0" cellspacing="0" >
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<% @item.frontend_field.each do |ff| %>
|
||||||
|
<th><span class="<%= ff[1] %>"><%= t("announcement.bulletin.#{ff[0]}") if !ff[0].blank? %></span></th>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<% @bulletins.each do |post| %>
|
||||||
|
<% @item.frontend_field.each do |ff| %>
|
||||||
|
<tr class="<%= cycle('odd', '')%>">
|
||||||
|
<td>
|
||||||
|
<span class="<%= ff[1] %>">
|
||||||
|
<% if ff[1] == 'title' %>
|
||||||
|
<%= link_to post.send("#{ff[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
|
||||||
|
<% elsif ff[1] == 'date' %>
|
||||||
|
<%= display_date(post.send(ff[0])) %>
|
||||||
|
<% elsif ff[1] == 'category' %>
|
||||||
|
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %>
|
||||||
|
<% elsif ff[1] == 'img' %>
|
||||||
|
<div class="img app-pic"><%= image_tag(post.send(wf[0]).url) %></div>
|
||||||
|
<% elsif ff[1] == 'text' %>
|
||||||
|
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
|
||||||
|
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %>
|
||||||
|
<% elsif ff[1] == 'status' %>
|
||||||
|
<% if post.is_top? %>
|
||||||
|
<span class="top"><%= t(:top) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% if post.is_hot? %>
|
||||||
|
<span class="hot"><%= t(:hot) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% elsif ff[1] == 'link' %>
|
||||||
|
<% elsif ff[1] == 'file' %>
|
||||||
|
<% elsif ff[1] == 'tag' %>
|
||||||
|
<% elsif ff[1] == 'viewcount' %>
|
||||||
|
<%= dislpay_view_count(post) %>
|
||||||
|
<% elsif ff[1] == 'poster' %>
|
||||||
|
<%= User.from_id(post.update_user_id).name rescue ''%>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% elsif @frontend_style == '2' %>
|
||||||
|
|
||||||
|
<div class="news news2">
|
||||||
|
<ul class="newslist">
|
||||||
|
<% @bulletins.each do |post| %>
|
||||||
|
<li class="<%= cycle('odd', '')%>">
|
||||||
|
<div class="img app-pic"><%= image_tag(post.image.url) %></div>
|
||||||
|
|
||||||
|
<% @item.frontend_field.each do |ff| %>
|
||||||
|
<span class="<%= ff[1] %>">
|
||||||
|
<% if ff[1] == 'title' %>
|
||||||
|
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
|
||||||
|
<% elsif ff[1] == 'date' %>
|
||||||
|
<%= display_date(post.send(ff[0])) %>
|
||||||
|
<% elsif ff[1] == 'category' %>
|
||||||
|
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %>
|
||||||
|
<% elsif ff[1] == 'text' %>
|
||||||
|
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
|
||||||
|
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %>
|
||||||
|
<% elsif ff[1] == 'status' %>
|
||||||
|
<% if post.is_top? %>
|
||||||
|
<span class="top"><%= t(:top) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% if post.is_hot? %>
|
||||||
|
<span class="hot"><%= t(:hot) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% elsif ff[1] == 'link' %>
|
||||||
|
<% elsif ff[1] == 'file' %>
|
||||||
|
<% elsif ff[1] == 'tag' %>
|
||||||
|
<% elsif ff[1] == 'viewcount' %>
|
||||||
|
<%= dislpay_view_count(post) %>
|
||||||
|
<% elsif ff[1] == 'poster' %>
|
||||||
|
<%= User.from_id(post.update_user_id).name rescue ''%>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% elsif @frontend_style == '3' %>
|
||||||
|
|
||||||
|
<div class="news news3">
|
||||||
|
<ul class="newslist">
|
||||||
|
|
||||||
|
<% @bulletins.each do |post| %>
|
||||||
|
<li class="<%= cycle('odd', '')%>">
|
||||||
|
<div class="img app-pic"><%= image_tag(post.image.url) %></div>
|
||||||
|
<div class="wrap">
|
||||||
|
<% @item.frontend_field.each do |ff| %>
|
||||||
|
<span class="<%= ff[1] %>">
|
||||||
|
<% if ff[1] == 'title' %>
|
||||||
|
<%= link_to post.send("#{ff[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
|
||||||
|
<% elsif ff[1] == 'date' %>
|
||||||
|
<%= display_date(post.send(ff[0])) %>
|
||||||
|
<% elsif ff[1] == 'category' %>
|
||||||
|
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %>
|
||||||
|
<% elsif ff[1] == 'text' %>
|
||||||
|
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
|
||||||
|
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %>
|
||||||
|
<% elsif ff[1] == 'status' %>
|
||||||
|
<% if post.is_top? %>
|
||||||
|
<span class="top"><%= t(:top) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% if post.is_hot? %>
|
||||||
|
<span class="hot"><%= t(:hot) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% elsif ff[1] == 'link' %>
|
||||||
|
<% elsif ff[1] == 'file' %>
|
||||||
|
<% elsif ff[1] == 'tag' %>
|
||||||
|
<% elsif ff[1] == 'viewcount' %>
|
||||||
|
<%= dislpay_view_count(post) %>
|
||||||
|
<% elsif ff[1] == 'poster' %>
|
||||||
|
<%= User.from_id(post.update_user_id).name rescue ''%>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% elsif @frontend_style == '4' %>
|
||||||
|
|
||||||
|
<div class="news news4">
|
||||||
|
<ul class="newslist">
|
||||||
|
|
||||||
|
<% @bulletins.each do |post| %>
|
||||||
|
<li class="<%= cycle('odd', '')%>">
|
||||||
|
<div class="img app-pic"><%= image_tag(post.image.url) %></div>
|
||||||
|
<div class="wrap">
|
||||||
|
<% @item.frontend_field.each do |ff| %>
|
||||||
|
<span class="<%= ff[1] %>">
|
||||||
|
<% if ff[1] == 'title' %>
|
||||||
|
<%= link_to post.send("#{ff[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
|
||||||
|
<% elsif ff[1] == 'date' %>
|
||||||
|
<%= display_date(post.send(ff[0])) %>
|
||||||
|
<% elsif ff[1] == 'category' %>
|
||||||
|
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %>
|
||||||
|
<% elsif ff[1] == 'text' %>
|
||||||
|
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
|
||||||
|
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %>
|
||||||
|
<% elsif ff[1] == 'status' %>
|
||||||
|
<% if post.is_top? %>
|
||||||
|
<span class="top"><%= t(:top) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% if post.is_hot? %>
|
||||||
|
<span class="hot"><%= t(:hot) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% elsif ff[1] == 'link' %>
|
||||||
|
<% elsif ff[1] == 'file' %>
|
||||||
|
<% elsif ff[1] == 'tag' %>
|
||||||
|
<% elsif ff[1] == 'viewcount' %>
|
||||||
|
<%= dislpay_view_count(post) %>
|
||||||
|
<% elsif ff[1] == 'poster' %>
|
||||||
|
<%= User.from_id(post.update_user_id).name rescue ''%>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% elsif @frontend_style == '5' %>
|
||||||
|
|
||||||
|
<div class="news news5">
|
||||||
|
<div class="img app-pic"><%= image_tag(@bulletins.first.image.url) %></div>
|
||||||
|
<ul class="newslist">
|
||||||
|
<% @bulletins.each do |post| %>
|
||||||
|
<li class="<%= cycle('odd', '')%>">
|
||||||
|
<% @item.frontend_field.each do |ff| %>
|
||||||
|
<span class="<%= ff[1] %>">
|
||||||
|
<% if ff[1] == 'title' %>
|
||||||
|
<%= link_to post.send("#{ff[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
|
||||||
|
<% elsif ff[1] == 'date' %>
|
||||||
|
<%= display_date(post.send(ff[0])) %>
|
||||||
|
<% elsif ff[1] == 'category' %>
|
||||||
|
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %>
|
||||||
|
<% elsif ff[1] == 'text' %>
|
||||||
|
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
|
||||||
|
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %>
|
||||||
|
<% elsif ff[1] == 'status' %>
|
||||||
|
<% if post.is_top? %>
|
||||||
|
<span class="top"><%= t(:top) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% if post.is_hot? %>
|
||||||
|
<span class="hot"><%= t(:hot) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% elsif ff[1] == 'link' %>
|
||||||
|
<% elsif ff[1] == 'file' %>
|
||||||
|
<% elsif ff[1] == 'tag' %>
|
||||||
|
<% elsif ff[1] == 'viewcount' %>
|
||||||
|
<%= dislpay_view_count(post) %>
|
||||||
|
<% elsif ff[1] == 'poster' %>
|
||||||
|
<%= User.from_id(post.update_user_id).name rescue ''%>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% else %>
|
||||||
|
|
||||||
|
<table class="table table-bordered">
|
||||||
<tr>
|
<tr>
|
||||||
<th><%= t('announcement.bulletin.category') %></th>
|
<th><%= t('announcement.bulletin.category') %></th>
|
||||||
<th><%= t('announcement.bulletin.title') %></th>
|
<th><%= t('announcement.bulletin.title') %></th>
|
||||||
<th><%= t('announcement.bulletin.postdate') %></th>
|
<th><%= t('announcement.bulletin.postdate') %></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% @bulletins.each do |post| %>
|
<% @bulletins.each do |post| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= post.bulletin_category.i18n_variable[I18n.locale] rescue nil %></td>
|
<td><%= post.bulletin_category.i18n_variable[I18n.locale] rescue nil %></td>
|
||||||
<td><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
|
<td><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
|
||||||
|
@ -25,9 +249,11 @@
|
||||||
<td><%= display_date_time(post.postdate) %></td>
|
<td><%= display_date_time(post.postdate) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= paginate @bulletins, :param_name => :page_main, :params => {:inner => 'false'} %>
|
<%= paginate @bulletins, :param_name => :page_main, :params => {:inner => 'false'} %>
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,259 @@
|
||||||
|
<% # encoding: utf-8 %>
|
||||||
<% if @title %>
|
<% if @title %>
|
||||||
<h1 class="h1"><%= @title %></h1>
|
<h1 class="h1"><%= @title %></h1>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<ul>
|
<% if !@widget_fields.blank? %>
|
||||||
|
|
||||||
|
<% if @widget_style == '1' %>
|
||||||
|
|
||||||
|
<div class="news news1">
|
||||||
|
<table class="newstb" border="0" cellpadding="0" cellspacing="0" >
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<% @widget_fields.each do |wf| %>
|
||||||
|
<th><span class="<%= wf[1] %>"><%= t("announcement.bulletin.#{wf[0]}") if !wf[0].blank? %></span></th>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<% @bulletins.each do |post| %>
|
||||||
|
<% @widget_fields.each do |wf| %>
|
||||||
|
<tr class="<%= cycle('odd', '')%>">
|
||||||
|
<td>
|
||||||
|
<span class="<%= wf[1] %>">
|
||||||
|
<% if wf[1] == 'title' %>
|
||||||
|
<%= link_to post.send("#{wf[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
|
||||||
|
<% elsif wf[1] == 'date' %>
|
||||||
|
<%= display_date(post.send(wf[0])) %>
|
||||||
|
<% elsif wf[1] == 'category' %>
|
||||||
|
<%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %>
|
||||||
|
<% elsif wf[1] == 'img' %>
|
||||||
|
<div class="img app-pic"><%= image_tag(post.send(wf[0]).url) %></div>
|
||||||
|
<% elsif wf[1] == 'text' %>
|
||||||
|
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
|
||||||
|
<%= post.send("#{wf[0]}")[I18n.locale].html_safe %>
|
||||||
|
<% elsif wf[1] == 'status' %>
|
||||||
|
<% if post.is_top? %>
|
||||||
|
<span class="top"><%= t(:top) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% if post.is_hot? %>
|
||||||
|
<span class="hot"><%= t(:hot) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% elsif wf[1] == 'link' %>
|
||||||
|
<% elsif wf[1] == 'file' %>
|
||||||
|
<% elsif wf[1] == 'tag' %>
|
||||||
|
<% elsif wf[1] == 'viewcount' %>
|
||||||
|
<%= dislpay_view_count(post) %>
|
||||||
|
<% elsif wf[1] == 'poster' %>
|
||||||
|
<%= User.from_id(post.update_user_id).name rescue ''%>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<% if !@category_id.blank? %>
|
||||||
|
<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path( :category_id => @category_id ) %></div>
|
||||||
|
<% else %>
|
||||||
|
<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path() %></div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% elsif @widget_style == '2' %>
|
||||||
|
|
||||||
|
<div class="news news2">
|
||||||
|
<ul class="newslist">
|
||||||
|
<% @bulletins.each do |post| %>
|
||||||
|
<li class="<%= cycle('odd', '')%>">
|
||||||
|
<div class="img app-pic"><%= image_tag(post.image.url) %></div>
|
||||||
|
|
||||||
|
<% @widget_fields.each do |wf| %>
|
||||||
|
<span class="<%= wf[1] %>">
|
||||||
|
<% if wf[1] == 'title' %>
|
||||||
|
<%= link_to post.send("#{wf[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
|
||||||
|
<% elsif wf[1] == 'date' %>
|
||||||
|
<%= display_date(post.send(wf[0])) %>
|
||||||
|
<% elsif wf[1] == 'category' %>
|
||||||
|
<%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %>
|
||||||
|
<% elsif wf[1] == 'text' %>
|
||||||
|
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
|
||||||
|
<%= post.send("#{wf[0]}")[I18n.locale].html_safe %>
|
||||||
|
<% elsif wf[1] == 'status' %>
|
||||||
|
<% if post.is_top? %>
|
||||||
|
<span class="top"><%= t(:top) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% if post.is_hot? %>
|
||||||
|
<span class="hot"><%= t(:hot) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% elsif wf[1] == 'link' %>
|
||||||
|
<% elsif wf[1] == 'file' %>
|
||||||
|
<% elsif wf[1] == 'tag' %>
|
||||||
|
<% elsif wf[1] == 'viewcount' %>
|
||||||
|
<%= dislpay_view_count(post) %>
|
||||||
|
<% elsif wf[1] == 'poster' %>
|
||||||
|
<%= User.from_id(post.update_user_id).name rescue ''%>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<% if !@category_id.blank? %>
|
||||||
|
<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path( :category_id => @category_id ) %></div>
|
||||||
|
<% else %>
|
||||||
|
<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path() %></div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% elsif @widget_style == '3' %>
|
||||||
|
|
||||||
|
<div class="news news3">
|
||||||
|
<ul class="newslist">
|
||||||
|
|
||||||
<% @bulletins.each do |post| %>
|
<% @bulletins.each do |post| %>
|
||||||
|
<li class="<%= cycle('odd', '')%>">
|
||||||
<li>
|
<div class="img app-pic"><%= image_tag(post.image.url) %></div>
|
||||||
<div class="pic"><%= image_tag(post.image.url, :size => "90x90") if post.image.file %></div>
|
<div class="wrap">
|
||||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
|
<% @widget_fields.each do |wf| %>
|
||||||
<span class="date"><%= display_date(post.postdate) %></span>
|
<span class="<%= wf[1] %>">
|
||||||
|
<% if wf[1] == 'title' %>
|
||||||
|
<%= link_to post.send("#{wf[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
|
||||||
|
<% elsif wf[1] == 'date' %>
|
||||||
|
<%= display_date(post.send(wf[0])) %>
|
||||||
|
<% elsif wf[1] == 'category' %>
|
||||||
|
<%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %>
|
||||||
|
<% elsif wf[1] == 'text' %>
|
||||||
|
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
|
||||||
|
<%= post.send("#{wf[0]}")[I18n.locale].html_safe %>
|
||||||
|
<% elsif wf[1] == 'status' %>
|
||||||
|
<% if post.is_top? %>
|
||||||
|
<span class="top"><%= t(:top) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% if post.is_hot? %>
|
||||||
|
<span class="hot"><%= t(:hot) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% elsif wf[1] == 'link' %>
|
||||||
|
<% elsif wf[1] == 'file' %>
|
||||||
|
<% elsif wf[1] == 'tag' %>
|
||||||
|
<% elsif wf[1] == 'viewcount' %>
|
||||||
|
<%= dislpay_view_count(post) %>
|
||||||
|
<% elsif wf[1] == 'poster' %>
|
||||||
|
<%= User.from_id(post.update_user_id).name rescue ''%>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<% if !@category_id.blank? %>
|
||||||
|
<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path( :category_id => @category_id ) %></div>
|
||||||
|
<% else %>
|
||||||
|
<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path() %></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</ul>
|
</div>
|
||||||
|
|
||||||
|
<% elsif @widget_style == '4' %>
|
||||||
|
|
||||||
|
<div class="news news4">
|
||||||
|
<ul class="newslist">
|
||||||
|
|
||||||
|
<% @bulletins.each do |post| %>
|
||||||
|
<li class="<%= cycle('odd', '')%>">
|
||||||
|
<div class="img app-pic"><%= image_tag(post.image.url) %></div>
|
||||||
|
<div class="wrap">
|
||||||
|
<% @widget_fields.each do |wf| %>
|
||||||
|
<span class="<%= wf[1] %>">
|
||||||
|
<% if wf[1] == 'title' %>
|
||||||
|
<%= link_to post.send("#{wf[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
|
||||||
|
<% elsif wf[1] == 'date' %>
|
||||||
|
<%= display_date(post.send(wf[0])) %>
|
||||||
|
<% elsif wf[1] == 'category' %>
|
||||||
|
<%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %>
|
||||||
|
<% elsif wf[1] == 'text' %>
|
||||||
|
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
|
||||||
|
<%= post.send("#{wf[0]}")[I18n.locale].html_safe %>
|
||||||
|
<% elsif wf[1] == 'status' %>
|
||||||
|
<% if post.is_top? %>
|
||||||
|
<span class="top"><%= t(:top) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% if post.is_hot? %>
|
||||||
|
<span class="hot"><%= t(:hot) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% elsif wf[1] == 'link' %>
|
||||||
|
<% elsif wf[1] == 'file' %>
|
||||||
|
<% elsif wf[1] == 'tag' %>
|
||||||
|
<% elsif wf[1] == 'viewcount' %>
|
||||||
|
<%= dislpay_view_count(post) %>
|
||||||
|
<% elsif wf[1] == 'poster' %>
|
||||||
|
<%= User.from_id(post.update_user_id).name rescue ''%>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<% if !@category_id.blank? %>
|
||||||
|
<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path( :category_id => @category_id ) %></div>
|
||||||
|
<% else %>
|
||||||
|
<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path() %></div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% elsif @widget_style == '5' %>
|
||||||
|
|
||||||
|
<div class="news news5">
|
||||||
|
<div class="img app-pic"><%= image_tag(@bulletins.first.image.url) %></div>
|
||||||
|
<ul class="newslist">
|
||||||
|
<% @bulletins.each do |post| %>
|
||||||
|
<li class="<%= cycle('odd', '')%>">
|
||||||
|
<% @widget_fields.each do |wf| %>
|
||||||
|
<span class="<%= wf[1] %>">
|
||||||
|
<% if wf[1] == 'title' %>
|
||||||
|
<%= link_to post.send("#{wf[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
|
||||||
|
<% elsif wf[1] == 'date' %>
|
||||||
|
<%= display_date(post.send(wf[0])) %>
|
||||||
|
<% elsif wf[1] == 'category' %>
|
||||||
|
<%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %>
|
||||||
|
<% elsif wf[1] == 'text' %>
|
||||||
|
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
|
||||||
|
<%= post.send("#{wf[0]}")[I18n.locale].html_safe %>
|
||||||
|
<% elsif wf[1] == 'status' %>
|
||||||
|
<% if post.is_top? %>
|
||||||
|
<span class="top"><%= t(:top) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% if post.is_hot? %>
|
||||||
|
<span class="hot"><%= t(:hot) %></span>
|
||||||
|
<% end %>
|
||||||
|
<% elsif wf[1] == 'link' %>
|
||||||
|
<% elsif wf[1] == 'file' %>
|
||||||
|
<% elsif wf[1] == 'tag' %>
|
||||||
|
<% elsif wf[1] == 'viewcount' %>
|
||||||
|
<%= dislpay_view_count(post) %>
|
||||||
|
<% elsif wf[1] == 'poster' %>
|
||||||
|
<%= User.from_id(post.update_user_id).name rescue ''%>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<% if !@category_id.blank? %>
|
||||||
|
<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path( :category_id => @category_id ) %></div>
|
||||||
|
<% else %>
|
||||||
|
<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path() %></div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% end %>
|
|
@ -1,3 +1,7 @@
|
||||||
|
|
||||||
|
<script type='text/javascript' src='/assets/jquery.mu.image.resize.js'></script>
|
||||||
|
<script type='text/javascript' src='/assets/jquery.mu.image.resize.degsin.js'></script>
|
||||||
|
|
||||||
<div id="bulletin_widget">
|
<div id="bulletin_widget">
|
||||||
<%= render 'index' %>
|
<%= render 'index' %>
|
||||||
</div>
|
</div>
|
|
@ -1,4 +1,7 @@
|
||||||
<%# encoding: utf-8 %>
|
<%# encoding: utf-8 %>
|
||||||
|
// refresh the imagesArray
|
||||||
|
// viewonly tags
|
||||||
|
|
||||||
$.extend($.expr[':'], {
|
$.extend($.expr[':'], {
|
||||||
'containsi': function (elem, i, match, array) {
|
'containsi': function (elem, i, match, array) {
|
||||||
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
|
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
|
||||||
|
@ -160,9 +163,10 @@ var galleryAPI = function(){
|
||||||
$.each(categories,function(x,category){
|
$.each(categories,function(x,category){
|
||||||
$.each(category,function(i,album){
|
$.each(category,function(i,album){
|
||||||
if(album.cover == "default")
|
if(album.cover == "default")
|
||||||
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='?album="+album._id+"'><img src='../../../assets/gallery/default.jpg' width='120px' height='90px'/></a><span class='albumname'>"+album.name+"</span><span class='tagnames'></span></div>");
|
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='?album="+album._id+"'><img src='../../../assets/gallery/default.jpg' width='120px' height='90px'/></a><span class='albumname'>"+album.name+"</span><span class='categoryname'>"+album.category_name+"</span><span class='tagnames'></span></div>");
|
||||||
else
|
else
|
||||||
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='?album="+album._id+"'><img src='"+album.cover_path+"' width='120px' height='90px'/></a><span class='albumname'>"+album.name+"</span><span class='tagnames'></span></div>");
|
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='?album="+album._id+"'><img src='"+album.cover_path+"' width='120px' height='90px'/></a><span class='albumname'>"+album.name+"</span><span class='categoryname'>"+album.category_name+"</span><span class='tagnames'></span></div>");
|
||||||
|
|
||||||
var tag_string = "";
|
var tag_string = "";
|
||||||
for(tag in album.tag_names){
|
for(tag in album.tag_names){
|
||||||
tag_string+= '<span class="label label-tags">' + album.tag_names[tag] + '</span>';
|
tag_string+= '<span class="label label-tags">' + album.tag_names[tag] + '</span>';
|
||||||
|
@ -514,20 +518,26 @@ var galleryAPI = function(){
|
||||||
// })
|
// })
|
||||||
|
|
||||||
})
|
})
|
||||||
|
var tag_panel_hidden = true;
|
||||||
|
var last_clicked = null;
|
||||||
$('.bt-tag').click(function(){
|
$('.bt-tag').click(function(){
|
||||||
|
|
||||||
$(this).toggleClass("active");
|
$(this).toggleClass("active");
|
||||||
|
|
||||||
var $tag_panel = $('#tag_panel'),
|
var $tag_panel = $('#tag_panel'),
|
||||||
tag_panel_position = 0;
|
tag_panel_position = 0;
|
||||||
|
|
||||||
if( $tag_panel.css('right') == '0px' ){
|
if( $tag_panel.css('right') == '0px' ){
|
||||||
tag_panel_position = -200;
|
tag_panel_position = -200;
|
||||||
}
|
}
|
||||||
|
if(last_clicked == $(this))
|
||||||
|
alert("same")
|
||||||
|
else
|
||||||
|
alert("no")
|
||||||
$tag_panel.animate({'right':tag_panel_position}, 300);
|
$tag_panel.animate({'right':tag_panel_position}, 300);
|
||||||
|
|
||||||
g.albumArea
|
g.albumArea
|
||||||
.delay(200)
|
.delay(200)
|
||||||
.animate({'margin-right':tag_panel_position+200},300);
|
.animate({'margin-right':tag_panel_position+200},300);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
g.albumArea.find("#tag_search_box").keyup(function(e){
|
g.albumArea.find("#tag_search_box").keyup(function(e){
|
||||||
|
|
617
vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI_frontend.js.erb
vendored
Normal file
617
vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI_frontend.js.erb
vendored
Normal file
|
@ -0,0 +1,617 @@
|
||||||
|
<%# encoding: utf-8 %>
|
||||||
|
$.extend($.expr[':'], {
|
||||||
|
'containsi': function (elem, i, match, array) {
|
||||||
|
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var galleryAPI = function(){
|
||||||
|
g = this;
|
||||||
|
this.urlVars = rcom.getUrlVars();
|
||||||
|
this.albumArea = $("#orbit_gallery");
|
||||||
|
this.loadArea = null;
|
||||||
|
this.tagList = $("ul#gallery_tag_list");
|
||||||
|
// this.authenticated = false;
|
||||||
|
this.initialize = function(callbackFn){
|
||||||
|
$(document).ready(function(){
|
||||||
|
bindHandlers();
|
||||||
|
var passid = null;
|
||||||
|
if(typeof g.urlVars['cat']!= "undefined"){
|
||||||
|
g.loadArea = "albums";
|
||||||
|
passid = g.urlVars['cat'];
|
||||||
|
g.loadAlbums(g.urlVars['cat']);
|
||||||
|
}else if(typeof g.urlVars['album']!= "undefined"){
|
||||||
|
g.loadArea = "images";
|
||||||
|
passid = g.urlVars['album'];
|
||||||
|
g.loadImages(g.urlVars['album']);
|
||||||
|
}else if(typeof g.urlVars['theater']!= "undefined"){
|
||||||
|
g.loadArea = "theater";
|
||||||
|
passid = g.urlVars['theater'];
|
||||||
|
g.loadTheater(g.urlVars['theater']);
|
||||||
|
}else if(typeof g.urlVars['edit']!= "undefined"){
|
||||||
|
g.loadArea = "edit";
|
||||||
|
passid = g.urlVars['edit'];
|
||||||
|
g.editAlbum(g.urlVars['edit']);
|
||||||
|
}else if(typeof g.urlVars['tag']!= "undefined"){
|
||||||
|
g.loadArea = "albums";
|
||||||
|
passid = g.urlVars['tag'];
|
||||||
|
g.loadAlbums(g.urlVars['tag']);
|
||||||
|
}else if(g.urlVars["locale"]){
|
||||||
|
g.loadArea = "albums";
|
||||||
|
g.loadAlbums("all");
|
||||||
|
}else if(g.urlVars.length == 0) {
|
||||||
|
g.loadArea = "albums";
|
||||||
|
g.loadAlbums("all");
|
||||||
|
}
|
||||||
|
if(typeof callbackFn == "function"){
|
||||||
|
callbackFn.call(this,g.loadArea,passid);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
var bindHandlers = function(){
|
||||||
|
$("#filter .filter_btns a").click(function(){
|
||||||
|
if(!$(this).hasClass("active")){
|
||||||
|
$(this).addClass("active");
|
||||||
|
if(g.urlVars.length == 0)
|
||||||
|
window.location = "orbit_gallery?" + $(this).attr("href");
|
||||||
|
else
|
||||||
|
window.location = window.location.href +"&"+ $(this).attr("href");
|
||||||
|
}else{
|
||||||
|
$(this).removeClass("active");
|
||||||
|
var loc = window.location.href;
|
||||||
|
var url = loc.replace($(this).attr("href")+"&","");
|
||||||
|
if(url == loc)
|
||||||
|
url = loc.replace($(this).attr("href"),"");
|
||||||
|
|
||||||
|
if(url.charAt(url.length-1)=="&" || url.charAt(url.length-1)=="?")
|
||||||
|
url = url.substr(0,url.length-1);
|
||||||
|
window.location = url;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
$("#filter .filter-clear a").click(function(){
|
||||||
|
var loc = window.location.href;
|
||||||
|
var url = null;
|
||||||
|
var forwhat = $(this).attr("for");
|
||||||
|
$("#filter ."+forwhat+" a.active").each(function(){
|
||||||
|
$(this).removeClass("active");
|
||||||
|
url = loc.replace($(this).attr("href")+"&","");
|
||||||
|
if(url == loc)
|
||||||
|
url = loc.replace($(this).attr("href"),"");
|
||||||
|
|
||||||
|
if(url.charAt(url.length-1)=="&" || url.charAt(url.length-1)=="?")
|
||||||
|
url = url.substr(0,url.length-1);
|
||||||
|
loc = url;
|
||||||
|
})
|
||||||
|
window.location = url;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.makeNewAlbum = function(){
|
||||||
|
$.get("add_album",function(html){
|
||||||
|
rcom.modalWindow({loadHtml:html,width:400,height:320,"closeBtn":false},function(dom){
|
||||||
|
dom.find("#album_name_save_btn").click(function(){
|
||||||
|
var options ={
|
||||||
|
cid : dom.find("select#category_list").val(),
|
||||||
|
albumname : {
|
||||||
|
"en" : dom.find("#name_en").val(),
|
||||||
|
"zh_tw" : dom.find("#name_zh_tw").val()
|
||||||
|
},
|
||||||
|
albumdesc : {
|
||||||
|
"en" : dom.find("#desc_en").val(),
|
||||||
|
"zh_tw" : dom.find("#desc_zh_tw").val()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(options.cid){
|
||||||
|
$.post("create_album",options,function(response){
|
||||||
|
if(g.loadArea == "albums")
|
||||||
|
g.loadAlbums("all");
|
||||||
|
rcom.modalWindowClose();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
dom.find("#album_name_close_btn").click(function(){
|
||||||
|
rcom.modalWindowClose();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.deleteAlbum = function(id){
|
||||||
|
if(confirm("<%= I18n.t('gallery.del_album?') %>")){
|
||||||
|
$.post("delete_album",{aid:id},function(){
|
||||||
|
window.location = "orbit_gallery";
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.loadAlbums = function(id){
|
||||||
|
g.loadFooterPanel(g.loadArea,id,function(headbtn){
|
||||||
|
headbtn = $(headbtn);
|
||||||
|
headbtn.click(function(){g.makeNewAlbum();})
|
||||||
|
g.albumArea.find(".rghead .rgfn").html(headbtn);
|
||||||
|
})
|
||||||
|
|
||||||
|
g.albumArea.addClass('o_gallery');
|
||||||
|
g.albumArea.find("#imgholder").empty();
|
||||||
|
// var $addsign = $('<div class="rgalbum"><a id="global_add" class="rgui bt-addnew" href="add" onclick="return false;">Add Album</a></div>');
|
||||||
|
// $addsign.find("a").click(function(){g.makeNewAlbum();})
|
||||||
|
|
||||||
|
if(id!="all"){
|
||||||
|
var cids = [];
|
||||||
|
var tids = [];
|
||||||
|
var href = null;
|
||||||
|
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
||||||
|
for(var i = 0; i < hashes.length; i++){
|
||||||
|
hash = hashes[i].split('=');
|
||||||
|
if(hash[0]=="cat"){
|
||||||
|
cids.push(hash[1]);
|
||||||
|
href = "cat="+hash[1];
|
||||||
|
}else if(hash[0]=="tag"){
|
||||||
|
tids.push(hash[1]);
|
||||||
|
href = "tag="+hash[1];
|
||||||
|
}
|
||||||
|
$("#filter .filter_btns a[href='"+href+"']").addClass("active");
|
||||||
|
}
|
||||||
|
if(cids.length == 0)
|
||||||
|
cids = "all";
|
||||||
|
}else{
|
||||||
|
var cids = "all";
|
||||||
|
}
|
||||||
|
$.getJSON("panel/gallery/front_end/get_albums",{cid:cids,tid:tids,"inner":true},function(categories){
|
||||||
|
$.each(categories,function(x,category){
|
||||||
|
$.each(category,function(i,album){
|
||||||
|
if(album.cover == "default")
|
||||||
|
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='?album="+album._id+"'><img src='../../../assets/gallery/default.jpg' width='120px' height='90px'/></a><span class='albumname'>"+album.name+"</span><span class='categoryname'>"+album.category_name+"</span><span class='tagnames'></span></div>");
|
||||||
|
else
|
||||||
|
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='?album="+album._id+"'><img src='"+album.cover_path+"' width='120px' height='90px'/></a><span class='albumname'>"+album.name+"</span><span class='categoryname'>"+album.category_name+"</span><span class='tagnames'></span></div>");
|
||||||
|
var tag_string = "";
|
||||||
|
for(tag in album.tag_names){
|
||||||
|
tag_string+= '<span class="label label-tags">' + album.tag_names[tag] + '</span>';
|
||||||
|
}
|
||||||
|
$img.find(".tagnames").html(tag_string);
|
||||||
|
g.albumArea.find("#imgholder").append($img);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
// g.albumArea.find("#imgholder").append($addsign);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.loadImages = function(id){
|
||||||
|
var panelopen = false;
|
||||||
|
g.loadFooterPanel(g.loadArea,id,function(headerPanel){
|
||||||
|
headarea = $(headerPanel);
|
||||||
|
g.albumArea.find(".rghead .rgfn").html(headarea);
|
||||||
|
$('.bt-tag').click(function(){
|
||||||
|
$(this).toggleClass("active");
|
||||||
|
var $tag_panel = $('#tag_panel'),
|
||||||
|
tag_panel_position = 0;
|
||||||
|
|
||||||
|
if( $tag_panel.css('right') == '0px' ){
|
||||||
|
tag_panel_position = -200;
|
||||||
|
}
|
||||||
|
$tag_panel.animate({'right':tag_panel_position}, 300);
|
||||||
|
|
||||||
|
g.albumArea
|
||||||
|
.delay(200)
|
||||||
|
.animate({'margin-right':tag_panel_position+200},300);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
g.albumArea.find("#tag_search_box").keyup(function(e){
|
||||||
|
sval = $(this).val();
|
||||||
|
if(sval == "<%= I18n.t('gallery.search_tags') %>")
|
||||||
|
sval = "";
|
||||||
|
sval = sval.replace(/(^\s*)|(\s*$)/g,'');
|
||||||
|
if(sval){
|
||||||
|
var re1 = new RegExp("^[\u4E00-\uFA29]*$"); //Chinese character range
|
||||||
|
var re2 = new RegExp("^[\uE7C7-\uE7F3]*$");
|
||||||
|
if ((re1.test(sval) && (re2.test(sval)))){
|
||||||
|
$("#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp();
|
||||||
|
}else{
|
||||||
|
$("#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$("#gallery_tag_list li").slideDown();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
g.albumArea.find("#tag_panel .bt-save").click(function(){
|
||||||
|
g.saveTags(id,g.loadArea);
|
||||||
|
})
|
||||||
|
g.albumArea.find(".rghead .rgfn .bt-add").click(function(){
|
||||||
|
showUploadPanel();
|
||||||
|
})
|
||||||
|
g.albumArea.find(".rghead .rgfn .bt-del").click(function(){
|
||||||
|
g.deleteAlbum(id);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
var uploadpanel = $('<div id="upload_panel_holder"><div class="rgfn"><a class="bt-cls btn btn-primary pull-right" title="Close" href="" onclick="return false;"><i class="icon-remove icon-white"></i>Close Panel</a></div></div>');
|
||||||
|
var frame = $('<iframe id="upload_panel" width="100%" scrolling="no" height="294" frameborder="0" src="upload_panel"></iframe>');
|
||||||
|
uploadpanel.find(".bt-cls").click(function(){
|
||||||
|
uploadpanel.hide("slide");
|
||||||
|
frame.remove();
|
||||||
|
g.loadImages(id);
|
||||||
|
panelopen = false;
|
||||||
|
})
|
||||||
|
var showUploadPanel = function(){
|
||||||
|
if(!panelopen){
|
||||||
|
uploadpanel.prepend(frame);
|
||||||
|
uploadpanel.show("slide");
|
||||||
|
panelopen = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g.albumArea.addClass('o_album');
|
||||||
|
g.albumArea.find(".rghead .rgfn").append(uploadpanel);
|
||||||
|
g.albumArea.find("#imgholder").empty();
|
||||||
|
$("#filter").remove();
|
||||||
|
g.albumArea.css("margin-top","");
|
||||||
|
// var $addsign = $('<div class="rgalbum"><a id="global_add" class="rgui bt-addnew" href="add" onclick="return false;">Add Album</a></div>');
|
||||||
|
// $addsign.find("a").click(function(){showUploadPanel();})
|
||||||
|
$.getJSON("get_images",{aid:id},function(album){
|
||||||
|
$.each(album.images,function(i,image){
|
||||||
|
var thumb = image.file.thumb.url;
|
||||||
|
var $img = $("<div class='rgphoto'><a title='"+image.description+"' href='?theater="+image._id+"'><img src='"+thumb+"'/></a></div>");
|
||||||
|
g.albumArea.find("#imgholder").append($img);
|
||||||
|
})
|
||||||
|
g.tagList.find("input").attr("checked",false);
|
||||||
|
$.each(album.tags,function(i,tag){
|
||||||
|
|
||||||
|
g.tagList.find("li[data-content="+tag+"] input").attr("checked",true);
|
||||||
|
})
|
||||||
|
// g.albumArea.find("#imgholder").append($addsign);
|
||||||
|
})
|
||||||
|
// g.albumArea.find("#imgholder").append($addsign);
|
||||||
|
// tag
|
||||||
|
|
||||||
|
}
|
||||||
|
this.loadTheater = function(id){
|
||||||
|
var imageArray;
|
||||||
|
var imagecount = 0;
|
||||||
|
var picHeight = 0;
|
||||||
|
var bindHandlers = function(){
|
||||||
|
var $slidelist = $('.slidelist'),
|
||||||
|
$rslide = $('.rslide'),
|
||||||
|
$rslidenav = $('.rslidenav'),
|
||||||
|
$img = $("#main_pic img"),
|
||||||
|
wHeight = $(window).height();
|
||||||
|
|
||||||
|
$("#main_pic").height(picHeight);
|
||||||
|
$img.height("100%");
|
||||||
|
|
||||||
|
$('.bt-tag').click(function(){
|
||||||
|
if(!$(this).hasClass("active"))
|
||||||
|
updatePhotoTag();
|
||||||
|
$(this).toggleClass("active");
|
||||||
|
var $tag_panel = $('#tag_panel'),
|
||||||
|
tag_panel_position = 0;
|
||||||
|
|
||||||
|
if( $tag_panel.css('right') == '0px' ){
|
||||||
|
tag_panel_position = -200;
|
||||||
|
}
|
||||||
|
$tag_panel.animate({'right':tag_panel_position}, 300);
|
||||||
|
|
||||||
|
g.albumArea
|
||||||
|
.delay(200)
|
||||||
|
.animate({'margin-right':tag_panel_position+200},300);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
var updatePhotoTag = function(){
|
||||||
|
var tags = imageArray[imagecount].tag_ids;
|
||||||
|
g.tagList.find("input").attr("checked",false);
|
||||||
|
for(tag in tags){
|
||||||
|
g.tagList.find("li[data-content="+tags[tag]+"] input").attr("checked",true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g.albumArea.find("#tag_search_box").keyup(function(e){
|
||||||
|
sval = $(this).val();
|
||||||
|
if(sval == "<%= I18n.t('gallery.search_tags') %>")
|
||||||
|
sval = "";
|
||||||
|
sval = sval.replace(/(^\s*)|(\s*$)/g,'');
|
||||||
|
if(sval){
|
||||||
|
var re1 = new RegExp("^[\u4E00-\uFA29]*$"); //Chinese character range
|
||||||
|
var re2 = new RegExp("^[\uE7C7-\uE7F3]*$");
|
||||||
|
if ((re1.test(sval) && (re2.test(sval)))){
|
||||||
|
$("#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp();
|
||||||
|
}else{
|
||||||
|
$("#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$("#gallery_tag_list li").slideDown();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
g.albumArea.find("#tag_panel .bt-save").click(function(){
|
||||||
|
g.saveTags(imageArray[imagecount]._id,g.loadArea);
|
||||||
|
})
|
||||||
|
$(".slidectrl a.togglelist").click(function(){
|
||||||
|
var rslide_h = $rslide.outerHeight();
|
||||||
|
if ( $slidelist.height() < 1 ){
|
||||||
|
$slidelist.stop().animate({'height':rslide_h - 30}, 300);
|
||||||
|
$slidelist.find("ul").show();
|
||||||
|
} else {
|
||||||
|
$slidelist.stop().animate({'height':'0px'}, 300);
|
||||||
|
$slidelist.find("ul").hide();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
$(".slidectrl .togglescreen").click(function(){
|
||||||
|
toggleFullscreen();
|
||||||
|
})
|
||||||
|
$(".slidectrl .browserfullscreen").click(function(){
|
||||||
|
browserFullScreen();
|
||||||
|
})
|
||||||
|
$slidelist.find(".list_element").click(function(){
|
||||||
|
imagecount = parseInt($(this).parent().attr("for"));
|
||||||
|
changeImage($(this));
|
||||||
|
})
|
||||||
|
$rslidenav.find(".navN").click(function(){
|
||||||
|
nextpic($(this));
|
||||||
|
})
|
||||||
|
$rslidenav.find("a.navP").click(function(){
|
||||||
|
prevpic($(this));
|
||||||
|
})
|
||||||
|
$("#nextpic").click(function(){
|
||||||
|
nextpic($(this));
|
||||||
|
})
|
||||||
|
|
||||||
|
$(document).keydown(function(e){
|
||||||
|
if (e.keyCode == 37){
|
||||||
|
prevpic($rslidenav.find(".navP"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(e.keyCode == 39){
|
||||||
|
nextpic($rslidenav.find(".navN"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(e.keyCode == 27){
|
||||||
|
toggleFullscreen();
|
||||||
|
$rslide.removeClass('browserFullScreen');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(e.keyCode == 70 || e.keyCode == 102){
|
||||||
|
if($rslide.hasClass("fullscreen"))
|
||||||
|
browserFullScreen();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var browserFullScreen = function(){
|
||||||
|
var el = document.documentElement,
|
||||||
|
rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen;
|
||||||
|
rfs.call(el);
|
||||||
|
$rslide.addClass('browserFullScreen');
|
||||||
|
}
|
||||||
|
var nextpic = function(dom){
|
||||||
|
if(imagecount == imageArray.length - 1)
|
||||||
|
imagecount = 0;
|
||||||
|
else
|
||||||
|
imagecount++;
|
||||||
|
changeImage(dom);
|
||||||
|
}
|
||||||
|
var prevpic = function(dom){
|
||||||
|
if(imagecount == 0)
|
||||||
|
imagecount = imageArray.length - 1
|
||||||
|
else
|
||||||
|
imagecount--;
|
||||||
|
changeImage(dom);
|
||||||
|
}
|
||||||
|
var toggleFullscreen = function(){
|
||||||
|
if($rslide.hasClass("fullscreen")){
|
||||||
|
$rslide.css("position","relative");
|
||||||
|
$rslide.removeClass("fullscreen");
|
||||||
|
$(".slidectrl .browserfullscreen").hide();
|
||||||
|
$img.css({"padding":""})
|
||||||
|
$("#main_pic").height(picHeight );
|
||||||
|
}else{
|
||||||
|
$("#main_pic").height(wHeight);
|
||||||
|
// $img.height("100%");
|
||||||
|
$rslide.css("position","");
|
||||||
|
$rslide.addClass("fullscreen");
|
||||||
|
$img.css({"padding":($rslide.height()-$img.height())/2})
|
||||||
|
$(".slidectrl .browserfullscreen").show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var changeImage = function(dom){
|
||||||
|
var pageurl = dom.attr('href');
|
||||||
|
$img.fadeOut(200,function(){
|
||||||
|
$img.attr({"src":dom.attr("data-content"),"height":picHeight+"px"});
|
||||||
|
$img.fadeIn(200);
|
||||||
|
if($rslide.hasClass("fullscreen")){
|
||||||
|
$img.css({"padding":($rslide.height()-$img.height())/2})
|
||||||
|
}
|
||||||
|
$slidelist.stop().animate({'height':'0px'}, 300);
|
||||||
|
$slidelist.find("ul").hide();
|
||||||
|
if(pageurl!=window.location){
|
||||||
|
window.history.pushState({path:pageurl},'',pageurl);
|
||||||
|
}
|
||||||
|
// $(".slideinfo b.info").text(imageArray[imagecount].title);
|
||||||
|
if($('.bt-tag').hasClass("active"))
|
||||||
|
updatePhotoTag();
|
||||||
|
$(".slideinfo .info").text(imageArray[imagecount].description);
|
||||||
|
if(imageArray.length > 1)
|
||||||
|
updateNavigation();
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
var updateNavigation = function(){
|
||||||
|
var next, prev;
|
||||||
|
if(imagecount == 0){
|
||||||
|
next = 1;
|
||||||
|
prev = imageArray.length - 1;
|
||||||
|
}else if(imagecount == imageArray.length - 1){
|
||||||
|
next = 0
|
||||||
|
prev = imageArray.length - 2;
|
||||||
|
}else{
|
||||||
|
next = imagecount + 1;
|
||||||
|
prev = imagecount - 1;
|
||||||
|
}
|
||||||
|
$(".navN").attr({"href":"orbit_gallery?theater="+imageArray[next]._id,"data-content":imageArray[next].file.url});
|
||||||
|
$(".navP").attr({"href":"orbit_gallery?theater="+imageArray[prev]._id,"data-content":imageArray[prev].file.url});
|
||||||
|
};
|
||||||
|
if(imageArray.length > 1)
|
||||||
|
updateNavigation();
|
||||||
|
}
|
||||||
|
|
||||||
|
var preparestage = function(albumid){
|
||||||
|
$.getJSON("get_images",{aid:albumid},function(album){
|
||||||
|
imageArray = eval(album.images);
|
||||||
|
$.each(album.images,function(i,image){
|
||||||
|
if(image._id == id)
|
||||||
|
imagecount = i;
|
||||||
|
})
|
||||||
|
bindHandlers();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
g.albumArea.find("#imgholder").load("theater?pic="+id,function(theater,response,xhr){
|
||||||
|
if(xhr.status == 404){
|
||||||
|
$(this).text("<%= I18n.t('gallery.pic_not_found') %>.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$("#filter").remove();
|
||||||
|
g.albumArea.css("margin-top","");
|
||||||
|
var albumid = $(theater).find("#main_pic").attr("data-content");
|
||||||
|
g.loadFooterPanel(g.loadArea,id,function(head){
|
||||||
|
head = $(head);
|
||||||
|
g.albumArea.find(".rghead .rgfn").html(head);
|
||||||
|
g.albumArea.find(".bt-back").attr("href","orbit_gallery?album="+albumid);
|
||||||
|
g.albumArea.find(".bt-edit").attr("href","orbit_gallery?edit="+albumid);
|
||||||
|
})
|
||||||
|
g.albumArea.css("margin-bottom","0");
|
||||||
|
picHeight = $(window).height() - ($("#orbit-bar").outerHeight() + $("#orbit_gallery .form-actions").outerHeight());
|
||||||
|
preparestage(albumid);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.editAlbum = function(id){
|
||||||
|
var bindHandlers = function(){
|
||||||
|
$(".nav .nav-tabs a").click(function(){
|
||||||
|
$(".tab_content .tab-pane").hide();
|
||||||
|
|
||||||
|
})
|
||||||
|
$(".description_loader .edit_fn .bt-cover").click(function(){
|
||||||
|
$(".bt-cover").removeClass("setcover");
|
||||||
|
$(this).addClass("setcover");
|
||||||
|
$.post("set_cover",{"imageid":$(this).attr("href"),"aid":id},function(){})
|
||||||
|
})
|
||||||
|
$(".description_loader .edit_fn .bt-dels").click(function(){
|
||||||
|
$(this)
|
||||||
|
.toggleClass("setdelete btn-danger active")
|
||||||
|
.find('span').toggleClass('icon-white');
|
||||||
|
if($(".description_loader .edit_fn .setdelete").length > 0){
|
||||||
|
g.albumArea.find(".rghead .rgfn .bt-delete").show();
|
||||||
|
}else{
|
||||||
|
g.albumArea.find(".rghead .rgfn .bt-delete").hide();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
g.albumArea.find(".rghead .rgfn .bt-save").click(function(){
|
||||||
|
// var dataArray = Array();
|
||||||
|
// $(".description_loader .en .txtchange").each(function(){
|
||||||
|
// var thisid = $(this).attr("for");
|
||||||
|
// dataArray.push({"id":thisid,"text":{"en":$(this).val(),"zh_tw":$(".description_loader .zh_tw .txtchange[for="+thisid+"]").val()}});
|
||||||
|
// })
|
||||||
|
// var albumnm = Array();
|
||||||
|
// $(".albumname_edit .txtchange").each(function(){
|
||||||
|
// albumnm.push($(this).val())
|
||||||
|
// })
|
||||||
|
// var dataArray = $("form#edit_album").serialize();
|
||||||
|
// $.post("update_album",{"data":dataArray},function(){
|
||||||
|
|
||||||
|
// })
|
||||||
|
|
||||||
|
})
|
||||||
|
$('.bt-tag').click(function(){
|
||||||
|
|
||||||
|
$(this).toggleClass("active");
|
||||||
|
var $tag_panel = $('#tag_panel'),
|
||||||
|
tag_panel_position = 0;
|
||||||
|
|
||||||
|
if( $tag_panel.css('right') == '0px' ){
|
||||||
|
tag_panel_position = -200;
|
||||||
|
}
|
||||||
|
$tag_panel.animate({'right':tag_panel_position}, 300);
|
||||||
|
|
||||||
|
g.albumArea
|
||||||
|
.delay(200)
|
||||||
|
.animate({'margin-right':tag_panel_position+200},300);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
g.albumArea.find("#tag_search_box").keyup(function(e){
|
||||||
|
sval = $(this).val();
|
||||||
|
if(sval == "<%= I18n.t('gallery.search_tags') %>")
|
||||||
|
sval = "";
|
||||||
|
sval = sval.replace(/(^\s*)|(\s*$)/g,'');
|
||||||
|
if(sval){
|
||||||
|
var re1 = new RegExp("^[\u4E00-\uFA29]*$"); //Chinese character range
|
||||||
|
var re2 = new RegExp("^[\uE7C7-\uE7F3]*$");
|
||||||
|
if ((re1.test(sval) && (re2.test(sval)))){
|
||||||
|
$("#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp();
|
||||||
|
}else{
|
||||||
|
$("#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$("#gallery_tag_list li").slideDown();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
g.albumArea.find("#tag_panel .bt-save").click(function(){
|
||||||
|
g.saveTags(imageArray[imagecount]._id,g.loadArea);
|
||||||
|
})
|
||||||
|
var tempval;
|
||||||
|
$(".txtchange").focus(function(){
|
||||||
|
tempval = $(this).val();
|
||||||
|
}).keyup(function(){
|
||||||
|
if($(this).val() != tempval)
|
||||||
|
g.albumArea.find(".rghead .rgfn .bt-save").show();
|
||||||
|
})
|
||||||
|
g.albumArea.find(".rghead .rgfn .bt-delete").click(function(){
|
||||||
|
var images_to_delete = new Array();
|
||||||
|
var delete_cover = false;
|
||||||
|
var doms_to_delete = new Array();
|
||||||
|
var thiscover = $(".description_loader .edit_fn .setcover").attr("href");
|
||||||
|
$(".description_loader .edit_fn .bt-dels").each(function(){
|
||||||
|
if($(this).hasClass("setdelete")){
|
||||||
|
images_to_delete.push($(this).attr("href"));
|
||||||
|
doms_to_delete.push($(this).parent().parent());
|
||||||
|
if(thiscover == $(this).attr("href"))
|
||||||
|
delete_cover = true;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if(confirm("Deleting "+images_to_delete.length+" image(s)?")){
|
||||||
|
$.post("delete_images",{"images":images_to_delete,"delete_cover":delete_cover,"aid":id},function(response){
|
||||||
|
if(response.success){
|
||||||
|
for(dom in doms_to_delete){
|
||||||
|
doms_to_delete[dom].hide("slide",function(){$(this).remove();})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g.albumArea.find(".rghead .rgfn .bt-delete").hide();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
$("#filter").remove();
|
||||||
|
g.albumArea.addClass('o_album_edit');
|
||||||
|
g.albumArea.css("margin-top","");
|
||||||
|
var head ='<a href="orbit_gallery?album='+id+'" class="bt-back btn pull-left" title="<%= I18n.t("gallery.back_to_photos") %>"><i class="icon-arrow-left icon-black"></i><%= I18n.t("gallery.back_to_photos") %></a></div>';
|
||||||
|
head+='<a class="bt-del bt-delete btn btn-primary pull-right" onclick="return false;" style="display:none;" title="<%= I18n.t("gallery.delete_selected") %>" href=""><i class="icon-trash icon-white"></i><%= I18n.t("gallery.delete_selected") %></a>';
|
||||||
|
head+='<a class="bt-save btn btn-primary pull-right" onclick="return false;" style="display:none;" title="Save" href=""><i class="icon-ok icon-white"></i>Save</a>';
|
||||||
|
g.albumArea.find(".rghead .rgfn").html(head);
|
||||||
|
g.albumArea.find("#imgholder").load("edit_album?aid="+id,function(data,response,xhr){
|
||||||
|
if(xhr.status == 404){
|
||||||
|
$(this).text("<%= I18n.t('gallery.album_not_found') %>");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bindHandlers();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.saveTags = function(id,tagsfor){
|
||||||
|
var tagids = new Array();
|
||||||
|
g.tagList.find("li input:checked").each(function(){
|
||||||
|
tagids.push($(this).parent().attr("data-content"));
|
||||||
|
})
|
||||||
|
var tag = null;
|
||||||
|
if(g.loadArea == "images")
|
||||||
|
tag = "album";
|
||||||
|
else if(g.loadArea == "theater")
|
||||||
|
tag = "pic";
|
||||||
|
|
||||||
|
$.post("save_tags",{"id":id,"tag":tag,"tids":tagids},function(){
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
galleryAPI.prototype.locale = "en";
|
|
@ -90,24 +90,20 @@ include AdminHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
i = 0
|
@output = Array.new
|
||||||
@albums.each do |album|
|
@albums.each do |album|
|
||||||
|
@albs = Array.new
|
||||||
album.each do |values|
|
album.each do |values|
|
||||||
# if values.tag_ids.kind_of?(Array)
|
|
||||||
tags = Array.new
|
tags = Array.new
|
||||||
values.tag_ids.each do |tag|
|
values.tag_ids.each do |tag|
|
||||||
tags << GalleryTag.find(tag)[I18n.locale]
|
tags << GalleryTag.find(tag)[I18n.locale]
|
||||||
end
|
end
|
||||||
# end
|
category = GalleryCategory.find(values.gallery_category_id).name
|
||||||
values.tag_names = tags
|
@albs << {"_id"=>values.id,"cover"=>values.cover,"cover_path"=>values.cover_path,"description"=>values.description,"category_name"=>category,"gallery_category_id" => values.gallery_category_id,"name"=>values.name,"tag_ids"=>values.tag_ids,"tag_names"=>tags}
|
||||||
values.save
|
|
||||||
end
|
end
|
||||||
i = i + 1
|
@output << @albs
|
||||||
end
|
end
|
||||||
# @albums = GalleryAlbum.find("5017a7babd98eb049900000a")
|
render :json=>@output.to_json
|
||||||
# @albums.update_attributes({:tag_ids =>["501ba786bd98eb0232000126"]})
|
|
||||||
|
|
||||||
render :json=>@albums.to_json
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def upload_image
|
def upload_image
|
||||||
|
|
|
@ -0,0 +1,228 @@
|
||||||
|
class Panel::Gallery::FrontEnd::OrbitGalleriesController < OrbitWidgetController
|
||||||
|
include AdminHelper
|
||||||
|
def index
|
||||||
|
@authenticated = false
|
||||||
|
@categorylist = GalleryCategory.all
|
||||||
|
@cid = params['cat']
|
||||||
|
@tags = GalleryTag.all
|
||||||
|
end
|
||||||
|
|
||||||
|
def new_category
|
||||||
|
names = params['category']
|
||||||
|
category = GalleryCategory.new
|
||||||
|
I18n.locale = :en
|
||||||
|
category.name = names['en']
|
||||||
|
I18n.locale = :zh_tw
|
||||||
|
category.name = names['zh_tw']
|
||||||
|
category.save!
|
||||||
|
render :json=>{"success"=>true,"id"=>category.id}.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
def categorylist
|
||||||
|
@categorylist = GalleryCategory.all
|
||||||
|
#render :layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
def gallery_category_delete
|
||||||
|
@category = GalleryCategory.find(params['id'])
|
||||||
|
@category.delete
|
||||||
|
render :json=>{"success"=>"true"}.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_album
|
||||||
|
if is_manager? || is_admin?
|
||||||
|
@categorylist = GalleryCategory.all
|
||||||
|
elsif is_sub_manager?
|
||||||
|
@categorylist = GalleryCategory.authed_for_user(current_user,"new_album")
|
||||||
|
end
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_album
|
||||||
|
category = GalleryCategory.find(params['cid'])
|
||||||
|
albumnames = params["albumname"]
|
||||||
|
albumdescs = params["albumdesc"]
|
||||||
|
album = category.gallery_albums.new
|
||||||
|
I18n.locale = :en
|
||||||
|
album.name = albumnames["en"]
|
||||||
|
album.description = albumdescs["en"]
|
||||||
|
I18n.locale = :zh_tw
|
||||||
|
album.name = albumnames["zh_tw"]
|
||||||
|
album.description = albumdescs["zh_tw"]
|
||||||
|
album.save!
|
||||||
|
#x = category.gallery_albums.create({name: params['albumname'],description: params['albumdesc']})
|
||||||
|
render :json=>{"success"=>true,"id"=>album.id}.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_albums
|
||||||
|
@categoryids = params["cid"]
|
||||||
|
@tags = params["tid"]
|
||||||
|
@albums = Array.new
|
||||||
|
if @categoryids == "all"
|
||||||
|
if @tags
|
||||||
|
if @tags.kind_of?(Array)
|
||||||
|
@tags.each do |tag|
|
||||||
|
@albums << GalleryAlbum.where(tag_ids: tag)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@albums << GalleryAlbum.where(tag_ids: @tags)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@albums << GalleryAlbum.all
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@categoryids.each do |id|
|
||||||
|
category = GalleryCategory.find(id)
|
||||||
|
if @tags
|
||||||
|
if @tags.kind_of?(Array)
|
||||||
|
@tags.each do |tag|
|
||||||
|
@albums << category.gallery_albums.where(tag_ids: tag)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@albums << category.gallery_albums.where(tag_ids: @tags)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@albums << category.gallery_albums.all
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
i = 0
|
||||||
|
@albums.each do |album|
|
||||||
|
album.each do |values|
|
||||||
|
# if values.tag_ids.kind_of?(Array)
|
||||||
|
tags = Array.new
|
||||||
|
values.tag_ids.each do |tag|
|
||||||
|
tags << GalleryTag.find(tag)[I18n.locale]
|
||||||
|
end
|
||||||
|
# end
|
||||||
|
values.tag_names = tags
|
||||||
|
values.save
|
||||||
|
end
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
# @albums = GalleryAlbum.find("5017a7babd98eb049900000a")
|
||||||
|
# @albums.update_attributes({:tag_ids =>["501ba786bd98eb0232000126"]})
|
||||||
|
|
||||||
|
render :json=>@albums.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
def upload_image
|
||||||
|
albumid = params['aid'];
|
||||||
|
@album = GalleryAlbum.find(albumid)
|
||||||
|
@files = params['files']
|
||||||
|
a = Array.new
|
||||||
|
@files.each do |file|
|
||||||
|
@image = @album.gallery_images.new
|
||||||
|
@image.file = file
|
||||||
|
@image.save!
|
||||||
|
a << {"thumbnail_url"=>@image.file.thumb.url}
|
||||||
|
end
|
||||||
|
render :json=>a.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
def upload_panel
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_images
|
||||||
|
@album = GalleryAlbum.find(params["aid"])
|
||||||
|
render :json=>{"images" => @album.gallery_images.all, "tags" => @album.tag_ids}.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
def theater
|
||||||
|
picid = params["pic"]
|
||||||
|
@image = GalleryImage.find(picid)
|
||||||
|
@albumid = @image.gallery_album_id
|
||||||
|
album = GalleryAlbum.find(@albumid)
|
||||||
|
@images = album.gallery_images.all
|
||||||
|
render :layout=>false
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete_album
|
||||||
|
aid = params['aid']
|
||||||
|
album = GalleryAlbum.find(aid)
|
||||||
|
album.delete
|
||||||
|
render :json =>{"success"=>true}.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit_album
|
||||||
|
if is_manager? || is_admin? || is_sub_manager?
|
||||||
|
aid = params['aid']
|
||||||
|
album = GalleryAlbum.find(aid)
|
||||||
|
@images = album.gallery_images.all
|
||||||
|
@album_name = album.name_translations
|
||||||
|
@cover = album.cover
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_cover
|
||||||
|
aid = params['aid']
|
||||||
|
album = GalleryAlbum.find(aid)
|
||||||
|
image = GalleryImage.find(params[:imageid])
|
||||||
|
album.update_attributes({:cover_path => image.file.thumb.url, :cover=>params[:imageid]})
|
||||||
|
render :json =>{"success"=>true}.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete_images
|
||||||
|
images = params['images']
|
||||||
|
images.each do |image|
|
||||||
|
img = GalleryImage.find(image)
|
||||||
|
img.delete
|
||||||
|
end
|
||||||
|
if params['delete_cover'] == "true"
|
||||||
|
album = GalleryAlbum.find(params['aid'])
|
||||||
|
album.update_attributes(:cover=>"default")
|
||||||
|
end
|
||||||
|
render :json =>{"success"=>true}.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
def update_album
|
||||||
|
# data = params['data']
|
||||||
|
# album_name = params['name']
|
||||||
|
# aid = params['aid']
|
||||||
|
# data.each do |d|
|
||||||
|
# image = GalleryImage.find(d[1][:id])
|
||||||
|
# image.update_attributes(:description=>d[1][:text])
|
||||||
|
# end
|
||||||
|
# album = GalleryAlbum.find(aid)
|
||||||
|
# album.update_attributes(:name => album_name)
|
||||||
|
album_names = params[:albumnm]
|
||||||
|
data = params[:data]
|
||||||
|
aid =params[:aid]
|
||||||
|
debugger
|
||||||
|
data.each do |d|
|
||||||
|
image = GalleryImage.find(d[1][:id])
|
||||||
|
@site_valid_locales.each do |locale|
|
||||||
|
image.description_translations[locale] = d[1][:text][locale]
|
||||||
|
end
|
||||||
|
image.save!
|
||||||
|
end
|
||||||
|
|
||||||
|
album = GalleryAlbum.find(aid)
|
||||||
|
|
||||||
|
@site_valid_locales.each_with_index do |locale,i|
|
||||||
|
album.name_translations[locale] = album_names[i]
|
||||||
|
end
|
||||||
|
album.save!
|
||||||
|
|
||||||
|
render :json =>{"success"=>true}.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
def save_tags
|
||||||
|
case params[:tag]
|
||||||
|
when "album"
|
||||||
|
@object = GalleryAlbum.find(params[:id])
|
||||||
|
when "pic"
|
||||||
|
@object = GalleryImage.find(params[:id])
|
||||||
|
end
|
||||||
|
@object.update_attributes({:tag_ids => params[:tids]})
|
||||||
|
render :json => {"success"=> "true"}.to_json
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<div class="rgphoto_edit <%= locale %>">
|
<div class="rgphoto_edit <%= locale %>">
|
||||||
<a href="orbit_gallery?theater=<%= image.id %>"><img src="<%= image.file.thumb.url %>"></a>
|
<a href="orbit_gallery?theater=<%= image.id %>"><img src="<%= image.file.thumb.url %>"></a>
|
||||||
<div class="inputui rginput rgih98 w380">
|
<div class="inputui rginput rgih98 w380">
|
||||||
<textarea name="gallery_album_gallery_images_attributes[<%= x %>][description_translations][<%= locale %>]" class="txtchange" for="<%= image.id %>"><%= image.description_translations[locale] %></textarea>
|
<textarea name="gallery_album_gallery_images_attributes[<%= x %>][description_translations][<%= locale %>]" class="txtchange" for="<%= image.id %>"><%= image.description_translations[locale] rescue nil %></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="edit_fn">
|
<div class="edit_fn">
|
||||||
<% if image.id.to_s == @cover %>
|
<% if image.id.to_s == @cover %>
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
<div class="modal-window" id="categories">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3><%= t("gallery.add_album") %></h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body add-album">
|
||||||
|
<select id="category_list">
|
||||||
|
<option value=""><%= t("gallery.select_category") %></option>
|
||||||
|
<% @categorylist.each do |category| %>
|
||||||
|
<option value='<%= category.id %>' ><%= category.name %></option>
|
||||||
|
<% end %>
|
||||||
|
</select>
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||||
|
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<div class="tab_content form-horizontal">
|
||||||
|
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||||
|
<% if i == 0 %>
|
||||||
|
<div class="<%= locale %> fade tab-pane in active">
|
||||||
|
<% else %>
|
||||||
|
<div class="<%= locale %> fade tab-pane" >
|
||||||
|
<% end %>
|
||||||
|
<p class="control-group"><label class="control-label"><%= t("gallery.album_name") %></label><input type="text" id="name_<%= locale %>" /></p>
|
||||||
|
<p class="control-group"><label class="control-label"><%= t("gallery.album_desc") %></label><input type="text" id="desc_<%= locale %>" /></p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<a href="#" class="btn" data-dismiss="modal" id="album_name_close_btn" onclick="return false;"><%= t("gallery.close") %></a>
|
||||||
|
<a href="#" class="btn btn-primary" id="album_name_save_btn" onclick="return false;"><%= t("gallery.save_changes") %></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,89 @@
|
||||||
|
<div id="tags" class="clear">
|
||||||
|
<% @categorylist.each do |category| %>
|
||||||
|
<div class="tag clear">
|
||||||
|
<div class="tagitem">
|
||||||
|
<i class="icon-folder-close"></i>
|
||||||
|
<% @site_valid_locales.each do |locale| %>
|
||||||
|
<span class="value" for="<%= locale %>"><%= category.name_translations[locale] %> </span>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="action">
|
||||||
|
<a href="<%= category.id %>" class='delete' onclick='return false;'><%= t("gallery.delete") %></a>
|
||||||
|
<a href="<%= category.id %>" class='edit' onclick='return false;'><%= t("gallery.edit") %></a>
|
||||||
|
<%= show_gallery_category_permission_link(category) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="form-actions form-fixed pagination-right">
|
||||||
|
<div style="margin:0;padding:0;display:inline">
|
||||||
|
<%= t("gallery.new_category")+"["+ t("gallery.english")+"]" %> : <input type="text" id="category_name_en" />
|
||||||
|
<%= t("gallery.new_category") +"["+ t("gallery.chinese")+"]" %> : <input type="text" id="category_name_zh_tw" />
|
||||||
|
<a href="#" class="btn btn-primary" id="category_save_btn" onclick="return false;"><%= t("gallery.save") %></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var deleteCategory = function(a){
|
||||||
|
var cid = a.attr("href");
|
||||||
|
var parent = a.parent().parent();
|
||||||
|
$.post("gallery_category_delete",{id:cid},function(response){
|
||||||
|
if(response.success)
|
||||||
|
parent.hide("slide",function(){parent.remove();})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
var editCategory = function(a){
|
||||||
|
var cid = a.attr("href");
|
||||||
|
var parent = a.parent().parent();
|
||||||
|
var parenthtml = parent.html();
|
||||||
|
var tempdom = $("<div class='tagitem'></div>");
|
||||||
|
parent.find("span.value").each(function(){
|
||||||
|
var locale = $(this).attr("for");
|
||||||
|
var lang = {
|
||||||
|
"en" : "English",
|
||||||
|
"zh_tw" : "Chinese"
|
||||||
|
}
|
||||||
|
tempdom.append("<label>"+lang[locale] + " :</label><input type='text' id='temp_name_"+locale+"' value='"+$(this).text()+"' />");
|
||||||
|
})
|
||||||
|
tempdom.append('<br /><a href="#" class="btn btn-primary" id="temp_save_btn" onclick="return false;"><%= I18n.t("gallery.save") %></a> <a href="#" class="btn btn-primary" id="temp_cancel_btn" onclick="return false;"><%= I18n.t("gallery.cancel") %></a>');
|
||||||
|
tempdom.find("a#temp_cancel_btn").click(function(){
|
||||||
|
parent.html(parenthtml);
|
||||||
|
parent.find("div.action a.delete").click(function(){
|
||||||
|
deleteCategory($(this));
|
||||||
|
})
|
||||||
|
parent.find(" div.action a.edit").click(function(){
|
||||||
|
editCategory($(this));
|
||||||
|
})
|
||||||
|
})
|
||||||
|
parent.html(tempdom);
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
$("#tags div.action a.delete").click(function(){
|
||||||
|
deleteCategory($(this));
|
||||||
|
})
|
||||||
|
$("#tags div.action a.edit").click(function(){
|
||||||
|
editCategory($(this));
|
||||||
|
})
|
||||||
|
$("#category_save_btn").click(function(){
|
||||||
|
var lang = {
|
||||||
|
"en" : $("#category_name_en").val(),
|
||||||
|
"zh_tw" : $("#category_name_zh_tw").val()
|
||||||
|
};
|
||||||
|
|
||||||
|
$.post("gallery_category_save",{"category":lang},function(response){
|
||||||
|
if(response.success){
|
||||||
|
var $dom = $('<div class="tag clear hide"><div class="tagitem"><i class="icons-star"></i>'+lang.en+' '+lang.zh_tw+'</div> <div class="action"><a href="'+response.id+'" class="delete" onclick="return false;"><%= I18n.t("gallery.delete") %></a></div></div>');
|
||||||
|
$("div#tags").append($dom);
|
||||||
|
$dom.show('slide');
|
||||||
|
$dom.find("a.delete").click(function(){
|
||||||
|
deleteCategory($(this));
|
||||||
|
})
|
||||||
|
$("input[type=text]").val("");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
|
@ -0,0 +1,74 @@
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><span>Home</span><span class="divider">/</span></li>
|
||||||
|
<li><span><%= t('admin.orbit_gallery') %></span><span class="divider">/</span></li>
|
||||||
|
<li class="text-blue"><%= t('gallery.edit') %></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||||
|
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<form id="edit_album" action="update_album" method="post">
|
||||||
|
<div class="tab_content">
|
||||||
|
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||||
|
<% if i == 0 %>
|
||||||
|
<div class="<%= locale %> fade tab-pane in active">
|
||||||
|
<% else %>
|
||||||
|
<div class="<%= locale %> fade tab-pane" >
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div class="albumname_edit">
|
||||||
|
<label for=""><%= t("gallery.album_name") %></label>
|
||||||
|
<div class="inputui rginput rgih26 w380"><input type="text" name="gallery_album[name_translations][<%= locale %>]" value="<%= @album_name[locale] %>" class="txtchange" /></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='description_loader'>
|
||||||
|
<% @images.each_with_index do |image,x| %>
|
||||||
|
<div class="rgphoto_edit <%= locale %>">
|
||||||
|
<a href="orbit_gallery?theater=<%= image.id %>"><img src="<%= image.file.thumb.url %>"></a>
|
||||||
|
<div class="inputui rginput rgih98 w380">
|
||||||
|
<textarea name="gallery_album_gallery_images_attributes[<%= x %>][description_translations][<%= locale %>]" class="txtchange" for="<%= image.id %>"><%= image.description_translations[locale] %></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="edit_fn">
|
||||||
|
<% if image.id.to_s == @cover %>
|
||||||
|
<a class="btn btn-primary rgbtsg bt-cover setcover active" onclick="return false;" title="<%= t("gallery.cover") %>" href="<%= image.id %>"><span class="icon-star icon-white"></span></a>
|
||||||
|
<% else %>
|
||||||
|
<a class="btn rgbtsg bt-cover" onclick="return false;" title="<%= t("gallery.set_cover") %>" href="<%= image.id %>"><span class="icon-star-empty"></span></a>
|
||||||
|
<% end %>
|
||||||
|
<a class="btn rgbtsg bt-tag" onclick="return false;" title="<%= t("gallery.photo_tag") %>" href="<%= image.id %>"><span class="icon-tags"></span></a>
|
||||||
|
<a class="btn rgbtsg bt-dels" onclick="return false;" title="<%= t("gallery.delete") %>" href="<%= image.id %>"><span class="icon-trash"></span></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<input type="submit" value="Submit" />
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<!-- <div class="tab-pane in active">
|
||||||
|
<div class="albumname_edit">
|
||||||
|
<label for="">Album Name:</label>
|
||||||
|
<div class="inputui rginput rgih26 w380"><span><input type="text" id='album_name_text' value="<%= @album_name %>" class="txtchange" /></span></div>
|
||||||
|
</div>
|
||||||
|
<div id='description_loader'>
|
||||||
|
<% @images.each do |image| %>
|
||||||
|
<div class="rgphoto_edit">
|
||||||
|
<a href="orbit_gallery?theater=<%= image.id %>"><img src="<%= image.file.thumb.url %>"></a>
|
||||||
|
<div class="inputui rginput rgih98 w380">
|
||||||
|
<span>
|
||||||
|
<textarea name="description_box" class="txtchange" for="<%= image.id%>"><%= image.description %></textarea>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="edit_fn">
|
||||||
|
<a class="rgui rgbt rgbtsg bt-dels" onclick="return false;" title="Delete" href="<%= image.id %>">Delete</a>
|
||||||
|
<% if image.id.to_s == @cover %>
|
||||||
|
<a class="rgui rgbt rgbtsg bt-cover setcover" onclick="return false;" title="Set Cover" href="<%= image.id %>">Set Cover</a>
|
||||||
|
<% else %>
|
||||||
|
<a class="rgui rgbt rgbtsg bt-cover" onclick="return false;" title="Set Cover" href="<%= image.id %>">Set Cover</a>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div> -->
|
166
vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/orbit_galleries/index.html.erb
vendored
Normal file
166
vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/orbit_galleries/index.html.erb
vendored
Normal file
|
@ -0,0 +1,166 @@
|
||||||
|
|
||||||
|
<%= stylesheet_link_tag "gallery" %>
|
||||||
|
|
||||||
|
<div id="filter" class="subnav">
|
||||||
|
<ul class="nav nav-pills filter">
|
||||||
|
<li class="accordion-group">
|
||||||
|
<div class="accordion-heading">
|
||||||
|
<a href="#collapse-categories" data-toggle="collapse" data-parent=".filters" class="accordion-toggle"><%= t("gallery.category") %> <b class="web-symbol"></b></a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="accordion-group">
|
||||||
|
<div class="accordion-heading">
|
||||||
|
<a href="#collapse-tags" data-toggle="collapse" data-parent=".filters" class="accordion-toggle"><%= t("gallery.tag") %> <b class="web-symbol"></b></a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="filters">
|
||||||
|
<div class="accordion-body collapse" id="collapse-categories">
|
||||||
|
<div class="accordion-inner filter_btns cats" data-toggle="buttons-checkbox">
|
||||||
|
<% @categorylist.each do |category| %>
|
||||||
|
<a href="cat=<%= category.id %>" class="btn" onclick="return false;"><%= category.name %></a>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="filter-clear">
|
||||||
|
<a href="" class="btn" onclick="return false;" for="cats"><i class="icons-brush-large"></i>清除</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="accordion-body collapse" id="collapse-tags">
|
||||||
|
<div class="accordion-inner filter_btns tags" data-toggle="buttons-checkbox">
|
||||||
|
<% @tags.each do |tag| %>
|
||||||
|
<a href="tag=<%= tag.id %>" class="btn" onclick="return false;"><%= tag[I18n.locale] %></a>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="filter-clear">
|
||||||
|
<a href="" class="btn" onclick="return false;" for="tags"><i class="icons-brush-large" ></i>清除</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- <table id="gallery_list" class="table main-list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="span1"></th>
|
||||||
|
<th class="span2"></th>
|
||||||
|
<th class="span2"></th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="tbody_gallery" class="sort-holder">
|
||||||
|
<tr>
|
||||||
|
<td class="span1"></td>
|
||||||
|
<td class="span2"></td>
|
||||||
|
<td class="span2"></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table> -->
|
||||||
|
<div id="orbit_gallery" class="rg">
|
||||||
|
<!-- <div class="rghead">
|
||||||
|
<div class="rgfn">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div class="rgbody">
|
||||||
|
<div id="imgholder">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- tag part -->
|
||||||
|
<% if @authenticated %>
|
||||||
|
<div id="tag_panel" class="my_scroll">
|
||||||
|
<div class="scrollbar">
|
||||||
|
<div class="track">
|
||||||
|
<div class="thumb">
|
||||||
|
<div class="end"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%
|
||||||
|
@locales = Array.new
|
||||||
|
@site_valid_locales.each do |locale|
|
||||||
|
@locales << locale
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<div class="viewport">
|
||||||
|
<div class="overview">
|
||||||
|
<ul class="tag_list" id="gallery_tag_list">
|
||||||
|
<% @tags.each do |tag| %>
|
||||||
|
<li data-content="<%= tag.id %>"><input id="tag_<%= tag.id %>" type="checkbox"><label for="tag_<%= tag.id %>"><%= tag[I18n.locale] %></label><span style="display:none;"><%= tag[@locales[1]] %> <%= tag[@locales[0]] %></span></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="tag_search"><div class="icon-search"></div><input type="text" value="<%= t('gallery.search_tags') %>" onblur="if(this.value=='')this.value='<%= t('gallery.search_tags') %>';" onfocus="if(this.value=='<%= t("gallery.search_tags") %>')this.value='';" id="tag_search_box"><div class="tag_save"><a class="btn bt-save"><i class="icon-ok"></i><%= I18n.t("gallery.save") %></a></div></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% content_for :page_specific_javascript do %>
|
||||||
|
<%= javascript_include_tag "galleryAPI" %>
|
||||||
|
<%= javascript_include_tag "jquery.tinyscrollbar" %>
|
||||||
|
<% end %>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var $tag_panel = $('#tag_panel');
|
||||||
|
orbit_bar_height = $('#orbit-bar').outerHeight();
|
||||||
|
action_panel_height = $('.form-actions').outerHeight();
|
||||||
|
window_height = $(window).height();
|
||||||
|
|
||||||
|
|
||||||
|
$tag_panel.height( window_height - orbit_bar_height - 90 );
|
||||||
|
$tag_panel.tinyscrollbar();
|
||||||
|
|
||||||
|
$(window).resize(function(){
|
||||||
|
$tag_panel.tinyscrollbar_update('relative');
|
||||||
|
$tag_panel.height( $(window).height() - orbit_bar_height - 90 );
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<!-- tag end -->
|
||||||
|
<div class="form-actions form-fixed pagination-right rghead">
|
||||||
|
<div class="rgfn">
|
||||||
|
<!-- <a href="" class="btn btn-primary pull-right"><i class="icon-plus icon-white"></i>新增</a> -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
galleryAPI.prototype.loadFooterPanel = function(area,id,callbackFn){
|
||||||
|
var headarea = null;
|
||||||
|
if(area == "images"){
|
||||||
|
headarea = '<a class="bt-back btn btn-primary pull-left" title="<%= I18n.t("gallery.back_to_albums") %>" href="orbit_gallery"><i class="icon-arrow-left icon-white"></i><%= I18n.t("gallery.back_to_albums") %></a> ';
|
||||||
|
<% if @authenticated %>
|
||||||
|
headarea+='<a class="bt-add btn btn-primary pull-right" title="<%= I18n.t("gallery.add_images") %>" href="images" onclick="return false;"><i class="icon-plus icon-white"></i><%= I18n.t("gallery.add_images") %></a> ';
|
||||||
|
headarea+='<a class="bt-del btn btn-primary pull-right" title="<%= I18n.t("gallery.del_album") %>" href="delete" onclick="return false;"><i class="icon-trash icon-white"></i><%= I18n.t("gallery.del_album") %></a> ';
|
||||||
|
headarea+='<a class="bt-edit btn btn-primary pull-right" title="<%= I18n.t("gallery.edit") %>" href="orbit_gallery?edit='+id+'" ><i class="icon-pencil icon-white"></i><%= I18n.t("gallery.edit") %></a>';
|
||||||
|
headarea+='<a class="bt-tag btn btn-primary pull-right" title="<%= I18n.t("gallery.album_tag") %>" href="" ><i class="icon-tag icon-white"></i><%= I18n.t("gallery.album_tag") %></a>';
|
||||||
|
<% end %>
|
||||||
|
}else if(area == "albums"){
|
||||||
|
<% if @authenticated %>
|
||||||
|
headarea = '<a class="btn btn-primary pull-right" title="<%= I18n.t("gallery.add_album") %>" href="albums" onclick="return false;"><i class="icon-plus icon-white"></i><%= I18n.t("gallery.add_album") %></a>';
|
||||||
|
<% end %>
|
||||||
|
}else if (area == "theater"){
|
||||||
|
headarea = '<a href="" class="bt-back btn pull-left" title="<%= I18n.t("gallery.back_to_photos") %>"><i class="icon-arrow-left icon-black"></i><%= I18n.t("gallery.back_to_photos") %></a></div>';
|
||||||
|
headarea+= '<a class="bt-edit btn btn-primary pull-right" title="<%= I18n.t("gallery.edit") %>" href="" ><i class="icon-pencil icon-white"></i><%= I18n.t("gallery.edit") %></a>';
|
||||||
|
headarea+= '<a class="bt-tag btn btn-primary pull-right" title="<%= I18n.t("gallery.photo_tag") %>" href="" ><i class="icon-tag icon-white"></i><%= I18n.t("gallery.photo_tag") %></a>';
|
||||||
|
}
|
||||||
|
if(typeof callbackFn == "function"){
|
||||||
|
callbackFn.call(this,headarea);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<% content_for :page_specific_javascript do %>
|
||||||
|
<%= javascript_include_tag "galleryAPI" %>
|
||||||
|
<%= javascript_include_tag "rss" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
galleryAPI.prototype.locale = "<%= I18n.locale %>";
|
||||||
|
var gallery = new galleryAPI();
|
||||||
|
gallery.initialize();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
34
vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/orbit_galleries/theater.html.erb
vendored
Executable file
34
vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/orbit_galleries/theater.html.erb
vendored
Executable file
|
@ -0,0 +1,34 @@
|
||||||
|
<!-- <div class="rghead">
|
||||||
|
<div class="rgfn">
|
||||||
|
<a href="" class="rgui bt-back rgbt" title="Back" id='bakbtngallery'><span id='album_name_span'>Back to photos</span></a>
|
||||||
|
</div>
|
||||||
|
<div class="rgtitle">Gallery</div>
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
|
<div class="rslide" style="position:relative; width:100%;">
|
||||||
|
<div class="rslideinside"><div id="loading" style="display:none;"></div>
|
||||||
|
<div class="comp" id='main_pic' data-content='<%= @image.gallery_album_id %>'><a href="" id="nextpic" class="navN" title="下一張" onclick="return false;" ><img src="<%= @image.file.url %>" alt="" /></a></div>
|
||||||
|
<div class="rslidenav">
|
||||||
|
<a href="" class="navP" title="上一張" onclick="return false;">Prev</a>
|
||||||
|
<a href="" class="navN" title="下一張" onclick="return false;">Next</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="slidelist">
|
||||||
|
<ul id='galleryimagelist' style="display:none;">
|
||||||
|
<% i=0 %>
|
||||||
|
<% @images.each do |image| %>
|
||||||
|
<li for="<%= i %>"><a href="orbit_gallery?theater=<%= image.id %>" class="list_element" data-content="<%= image.file.url %>" onclick="return false;"><img src="<%= image.file.thumb.url %>" alt="" /></a></li>
|
||||||
|
<% i=i+1 %>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="slidectrl">
|
||||||
|
<a href="" class="togglescreen" title="切換全螢幕" onclick="return false;">Screen</a>
|
||||||
|
<a href="" class="togglelist" title="顯示照片清單" onclick="return false;">List</a>
|
||||||
|
<a href="" class="browserfullscreen" title="顯示照片清單" onclick="return false;">F</a>
|
||||||
|
<div class="slideinfo">
|
||||||
|
<!-- <b class="info"><%= @image.title %></b> -->
|
||||||
|
<span class="info"><%= @image.description %></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
108
vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/orbit_galleries/upload_panel.html.erb
vendored
Executable file
108
vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/orbit_galleries/upload_panel.html.erb
vendored
Executable file
|
@ -0,0 +1,108 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<%= csrf_meta_tag %>
|
||||||
|
<%= javascript_include_tag "jquery-latest" %>
|
||||||
|
<%= stylesheet_link_tag "jquery-ui" %>
|
||||||
|
<%= stylesheet_link_tag "jquery.fileupload-ui.css" %>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id='scroller_for_panel'>
|
||||||
|
<div id="fileupload">
|
||||||
|
<form action="upload_image" method="POST" enctype="multipart/form-data">
|
||||||
|
<div class="fileupload-buttonbar">
|
||||||
|
<label class="fileinput-button">
|
||||||
|
<span>Add files...</span>
|
||||||
|
<input type="file" name="files[]" multiple>
|
||||||
|
</label>
|
||||||
|
<input type="hidden" value="" name="aid" id="fileupload_aid" />
|
||||||
|
<button type="submit" class="start">Start upload</button>
|
||||||
|
<button type="reset" class="cancel">Cancel upload</button>
|
||||||
|
<!-- <button type="button" class="delete">Delete files</button>-->
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<div class="fileupload-content">
|
||||||
|
<table class="files"></table>
|
||||||
|
<div class="fileupload-progressbar"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script id="template-upload" type="text/x-jquery-tmpl">
|
||||||
|
<tr class="template-upload{{if error}} ui-state-error{{/if}}">
|
||||||
|
<td class="preview"></td>
|
||||||
|
<td class="name">{{if name}}${name}{{else}}Untitled{{/if}}</td>
|
||||||
|
<td class="size">${sizef}</td>
|
||||||
|
{{if error}}
|
||||||
|
<td class="error" colspan="2">Error:
|
||||||
|
{{if error === 'maxFileSize'}}File is too big
|
||||||
|
{{else error === 'minFileSize'}}File is too small
|
||||||
|
{{else error === 'acceptFileTypes'}}Filetype not allowed
|
||||||
|
{{else error === 'maxNumberOfFiles'}}Max number of files exceeded
|
||||||
|
{{else}}${error}
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
|
{{else}}
|
||||||
|
<td class="progress"><div></div></td>
|
||||||
|
<td class="start"><button>Start</button></td>
|
||||||
|
{{/if}}
|
||||||
|
<td class="cancel"><button>Cancel</button></td>
|
||||||
|
</tr>
|
||||||
|
</script>
|
||||||
|
<script id="template-download" type="text/x-jquery-tmpl">
|
||||||
|
<tr class="template-download{{if error}} ui-state-error{{/if}}">
|
||||||
|
{{if error}}
|
||||||
|
<td></td>
|
||||||
|
<td class="name">${name}</td>
|
||||||
|
<td class="size">${sizef}</td>
|
||||||
|
<td class="error" colspan="2">Error:
|
||||||
|
{{if error === 1}}File exceeds upload_max_filesize (php.ini directive)
|
||||||
|
{{else error === 2}}File exceeds MAX_FILE_SIZE (HTML form directive)
|
||||||
|
{{else error === 3}}File was only partially uploaded
|
||||||
|
{{else error === 4}}No File was uploaded
|
||||||
|
{{else error === 5}}Missing a temporary folder
|
||||||
|
{{else error === 6}}Failed to write file to disk
|
||||||
|
{{else error === 7}}File upload stopped by extension
|
||||||
|
{{else error === 'maxFileSize'}}File is too big
|
||||||
|
{{else error === 'minFileSize'}}File is too small
|
||||||
|
{{else error === 'acceptFileTypes'}}Filetype not allowed
|
||||||
|
{{else error === 'maxNumberOfFiles'}}Max number of files exceeded
|
||||||
|
{{else error === 'uploadedBytes'}}Uploaded bytes exceed file size
|
||||||
|
{{else error === 'emptyResult'}}Empty file upload result
|
||||||
|
{{else}}${error}
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
|
{{else}}
|
||||||
|
<td class="preview">
|
||||||
|
{{if thumbnail_url}}
|
||||||
|
<a href="${url}" target="_blank"><img src="${thumbnail_url}"></a>
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
|
<td class="name">
|
||||||
|
<a href="${url}"{{if thumbnail_url}} target="_blank"{{/if}}>${name}</a>
|
||||||
|
</td>
|
||||||
|
<td class="size">${sizef}</td>
|
||||||
|
<td colspan="2"></td>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("input#fileupload_aid").val(parent.g.urlVars['album']);
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= javascript_include_tag "jquery-ui.min" %>
|
||||||
|
<%= javascript_include_tag "jquery.tmpl.min" %>
|
||||||
|
<%= javascript_include_tag "jquery.iframe-transport" %>
|
||||||
|
<%= javascript_include_tag "jquery.fileupload" %>
|
||||||
|
<%= javascript_include_tag "jquery.fileupload-ui" %>
|
||||||
|
<%= javascript_include_tag "upload" %>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<!-- <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
|
||||||
|
<script src="//ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
|
||||||
|
<script src="../../js/gallery/jquery.iframe-transport.js"></script>
|
||||||
|
<script src="../../js/gallery/jquery.fileupload.js"></script>
|
||||||
|
<script src="../../js/gallery/jquery.fileupload-ui.js"></script>
|
||||||
|
<script src="../../js/gallery/upload.js"></script> -->
|
|
@ -20,6 +20,10 @@ Rails.application.routes.draw do
|
||||||
match "update_album" => "orbit_galleries#update_album"
|
match "update_album" => "orbit_galleries#update_album"
|
||||||
match "save_tags" => "orbit_galleries#save_tags"
|
match "save_tags" => "orbit_galleries#save_tags"
|
||||||
resources :tags
|
resources :tags
|
||||||
|
end
|
||||||
|
namespace :front_end do
|
||||||
|
match "orbit_galleries" => "orbit_galleries#index"
|
||||||
|
match "get_albums" => "orbit_galleries#get_albums"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue