Compare commits
5 Commits
1017_ntu_g
...
master
Author | SHA1 | Date |
---|---|---|
chris | f8bb0bba56 | |
Spen | 47b8b3e277 | |
chris | ecc3581106 | |
Matthew K. Fu JuYuan | 6d4d3ccfd4 | |
Harry Bomrah | 141b708392 |
|
@ -15,6 +15,11 @@ function load_tinymce() {
|
|||
theme_advanced_statusbar_location : "bottom",
|
||||
theme_advanced_resizing : true,
|
||||
|
||||
// Domain Absolute URLs
|
||||
relative_urls : false,
|
||||
remove_script_host : false,
|
||||
document_base_url: window.location.protocol + '//' + window.location.host,
|
||||
|
||||
// Skin options
|
||||
skin : "o2k7",
|
||||
skin_variant : "silver",
|
||||
|
|
|
@ -43,7 +43,7 @@ class MobileController < ApplicationController
|
|||
|
||||
def page
|
||||
@page_title = t('mobile.page')
|
||||
@page_contexts = PageContext.where(:archived => false).page(params[:page_main]).per(15)
|
||||
@page_contexts = get_sorted_page_from_structure
|
||||
end
|
||||
|
||||
def page_content
|
||||
|
@ -57,4 +57,12 @@ class MobileController < ApplicationController
|
|||
@no_footer = true if request.path =~ /app/
|
||||
end
|
||||
|
||||
def get_sorted_page_from_structure
|
||||
page_contexts = Item.structure_ordered_items.inject([]){ |pages, page|
|
||||
pages << page.page_contexts.where(archived: false).limit(1)[0] if page.is_a?(Page) && !page.page_contexts.blank?
|
||||
pages
|
||||
}
|
||||
Kaminari.paginate_array(page_contexts).page(params[:page]).per(15)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -29,8 +29,8 @@ module Announcement
|
|||
|
||||
widgets do
|
||||
default_widget do
|
||||
sorting 'desc(:postdate)'
|
||||
query 'Bulletin.available_for_lang(I18n.locale).any_of( {deadline: nil,:postdate.lte => Time.now} , {:deadline.gte => Time.now,:postdate.lte => Time.now} )'
|
||||
sorting 'desc(:is_top, :postdate)'
|
||||
query 'Bulletin.can_display.available_for_lang(I18n.locale).any_of( {deadline: nil,:postdate.lte => Time.now} , {:deadline.gte => Time.now,:postdate.lte => Time.now} )'
|
||||
enable ["typeA","typeB_style3","typeC"]
|
||||
image :image
|
||||
field :postdate
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
|
@ -9,15 +9,38 @@ class Panel::Gallery::Widget::AlbumsController < OrbitWidgetController
|
|||
@album = GalleryAlbum.find(@part.widget_options['album_id']) rescue nil
|
||||
@album_images = @album.gallery_images if @album
|
||||
|
||||
|
||||
@settings = {"vertical"=>vertical,"horizontal"=>horizontal} #[note] horizontal has it's limitation from 2 to 6
|
||||
@class = "c" + @settings["horizontal"].to_s
|
||||
@total = @settings["vertical"] * @settings["horizontal"]
|
||||
@rnd = Random.new
|
||||
@images = []
|
||||
for i in 0..@total-1
|
||||
image = @album_images[@rnd.rand(0...@album_images.count)]
|
||||
values = {"show_link"=>theater_panel_gallery_front_end_album_path(image),"thumb"=>image.file.thumb.url}
|
||||
@images << values
|
||||
|
||||
if @album_images.count > @total
|
||||
@randoms = []
|
||||
until @randoms.count == @total do
|
||||
r = @rnd.rand(0...@album_images.count)
|
||||
if !@randoms.include?r
|
||||
@randoms << r
|
||||
image = @album_images[r]
|
||||
values = {"show_link"=>theater_panel_gallery_front_end_album_path(image),"thumb"=>image.file.thumb.url}
|
||||
@images << values
|
||||
end
|
||||
end
|
||||
elsif @album_images.count == @total
|
||||
@album_images.each do |image|
|
||||
values = {"show_link"=>theater_panel_gallery_front_end_album_path(image),"thumb"=>image.file.thumb.url}
|
||||
@images << values
|
||||
end
|
||||
else
|
||||
@album_images.each do |image|
|
||||
values = {"show_link"=>theater_panel_gallery_front_end_album_path(image),"thumb"=>image.file.thumb.url}
|
||||
@images << values
|
||||
end
|
||||
until @images.count == @total do
|
||||
values = {"show_link"=>"javascript:void(0);","thumb"=>"assets/gallery/nodata.jpg"}
|
||||
@images << values
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue